Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tlinden/kageviewer
Viewer for shaders written in Kage, similar to glslviewer
https://github.com/tlinden/kageviewer
command-line ebitengine game-development golang kage shader shell viewer
Last synced: 4 days ago
JSON representation
Viewer for shaders written in Kage, similar to glslviewer
- Host: GitHub
- URL: https://github.com/tlinden/kageviewer
- Owner: TLINDEN
- License: gpl-3.0
- Created: 2024-03-25T09:16:59.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-04-08T08:29:36.000Z (9 months ago)
- Last Synced: 2024-06-21T06:30:27.668Z (7 months ago)
- Topics: command-line, ebitengine, game-development, golang, kage, shader, shell, viewer
- Language: Go
- Homepage:
- Size: 38.9 MB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# kageviewer - Viewer for shaders written in Kage, similar to glslviewer
![Logo](https://github.com/TLINDEN/kageviewer/blob/main/.github/assets/logo.png)
[![License](https://img.shields.io/badge/license-GPL-blue.svg)](https://github.com/tlinden/kageviewer/blob/master/LICENSE)
[![Go Report Card](https://goreportcard.com/badge/github.com/tlinden/kageviewer)](https://goreportcard.com/report/github.com/tlinden/kageviewer)This little tool can be used to test shaders written in
[Kage](https://ebitengine.org/en/documents/shader.html), a shader meta
language for
[Ebitengine](https://github.com/hajimehoshi/ebiten). kageviewer
reloads changed assets, which allows you to develop your shader and
see live, how it responds to your changes. If loading fails, an error
will be printed to STDOUT. The same applies for images.## Screenshot
![Screenshot](https://github.com/TLINDEN/kageviewer/blob/main/.github/assets/screenshot.png)
## Installation
Since `kageviewer` is primarily aimed at golang game developers, no
pre built binaries are provided.### Installation with go
```shell
go install github.com/tlinden/kageviewer@latest
```### Installation from source
You will need the Golang toolchain in order to build from source. GNU
Make will also help but is not strictly neccessary.If you want to compile the tool yourself, use `git clone` to clone the
repository. Then execute `go mod tidy` to install all
dependencies. Then just enter `go build` or - if you have GNU Make
installed - `make`.To install after building either copy the binary or execute `sudo make
install`.# Usage
```shell
kageviewer -h
This is kageviewer, a shader viewer.Usage: kageviewer [-vd] [-c ] [-g geom] [-p geom] \
-i -i -sOptions:
-c --config Config file to use (optional)
-i --image Image to load (multiple times allowed, up to 4)
-s --shader Shader to run
-g --geometry Window size
-p --position Position of image0
-b --background Image to load as background
-t --tps At how many ticks per second to run
--map-flag Map Flag uniform to
--map-ticks Map Ticks uniform to
--map-time Map Time uniform to
--map-slider Map Slider uniform to
--map-mouse Map Mouse uniform to
-d --debug Show debugging output
-v --version Show program version
```Example usage using the provided example:
```shell
kageviewer -g 32x32 -i example/wall.png -i example/damage.png -s example/destruct.kg
```Hit `SPACE` or press the left mouse button to toggle the damage
mask. Press the `UP` or `DOWN` key to adjust the damage scale.# Uniforms
Since this is a generic viewer, you cannot (yet) use custom
uniforms. If you need this, just edit the source accordingly.Uniforms supported so far:
- `var Flag int`: a flag which toggles between 0 and 1 by pressing
`SPACE` or pusing the left mouse button
- `var Slider float`: a normalized float value, you can increment it
with `UP` or `DOWN`
- `var Time float`: the time the game runs (ticks / TPS)
- `var Ticks float`: the number of updates happened so far
- `var Mouse vec2`: the current mouse positionIf you want to test an existing shader and don't want to rename the
uniforms, you can map the ones provided by **kageviewer** to custom
names using the `--map-*` options. For example:```shell
kageviewer -g 640x480 --map-ticks Time --map-mouse Cursor examples/shader/default.go
```This executes the example shader in the ebitenging source repository.
# Config File
You can use a config file to store your own codes, once you found one
you like. A configfile is searched in these locations in this order:* `/etc/kageviewer.conf`
* `/usr/local/etc/kageviewer.conf`
* `$HOME/.config/kageviewer/config`
* `$HOME/.kageviewer`You may also specify a config file on the commandline using the `-c`
flag.Config files are expected to be in the [TOML format](https://toml.io/en/).
Possible parameters equal the long command line options.
# TODO
- [X] Implement loading of images and shader files
- [X] Implement basic shader rendering and user input
- [ ] Add custom uniforms (maybe using lua code?)
- [x] Provide a way to respond live to shader code changes (use lua as
well?)# Report bugs
[Please open an issue](https://github.com/TLINDEN/kageviewer/issues). Thanks!
# License
This work is licensed under the terms of the General Public Licens
version 3.# Author
Copyleft (c) 2024 Thomas von Dein