Skip to content

Commit fc2c075

Browse files
committed
Add shorthand aliases for code golfing
1 parent 5959d0f commit fc2c075

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
### Added
1111
- Low resolution control
12+
- Shorthand aliases for code golfing
1213

1314
### Changed
1415
- Mouse position is only updated when pressing down

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,14 @@ They must write on the `vec4 out_color` output to produce a color.
4949

5050
The compatibility is currently set to `300 es`.
5151

52+
### Shorthand aliases
53+
54+
- `P`: `gl_FragCoord.xy`
55+
- `O`: `out_color`
56+
- `T`: `time`
57+
- `R`: `resolution`
58+
- `M`: `mouse`
59+
5260
## Live controls
5361

5462
To expose controls to the web UI, declare a uniform in your fragment shader.

shader_workshop/frag.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@
1717
uniform float time;
1818
uniform vec2 resolution;
1919
uniform vec2 mouse;
20+
21+
#define P gl_FragCoord.xy
22+
#define O out_color
23+
#define T time
24+
#define R resolution
25+
#define M mouse
2026
"""
2127
)
2228

0 commit comments

Comments
 (0)