1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
pig is a tool to assist developing shaders for games
at this time it targets just gl2.1 and is fairly minimal,
it expects you to supply the vertex shader and fragment shader
paths on argv as such:
```
./pig path/to/vertex-shader path/to/fragment-shader
```
If the files don't exist or are otherwise unusable, pig will just
skip running the shader but continue drawing a checkered bg with
the variables changing as usual. Shaders get reloaded every 1s,
so you may edit them in your text editor of choice while watching
the output.
The set of uniforms pig wires up to the shaders are currently:
```
uniform float alpha;
uniform float time;
uniform float T;
uniform vec3 color;
uniform float seed;
uniform float rand;
```
alpha: is always 1.f currently, this comes in by virtue of libstage
integration. When your shader is used as a shader-node w/libstage for
instance, this value would reflect stage_t.alpha, set via
stage_set_alpha() or at stage_t create time via stage_conf_t.alpha.
time: time since program start in seconds.fraction
T: 0.f - 1.f, cycled at 1HZ, intended for driving animation/effects. The
time uniform can be considered absolute time, whereas this would be
relative to the shader's start, with a duration assumed of 1 second. In
the future there will probably be flags or something to set the duration
and range.
color: 0.f - 1.f, a random color, randomized every cycle of T
seed: 0.f - 1.f, a random seed, randomized every cycle of T
rand: 0.f - 1.f, a random number, randomized every run of the shader
For externally controlling uniforms, GNU Rocket support has been integrated as
well. The current implementation exposes any float type uniforms as tracks for
external control.
|