Skip to content

Commit

Permalink
Adding TextureAlpha material variable
Browse files Browse the repository at this point in the history
  • Loading branch information
rumblesan committed Apr 23, 2021
1 parent c8183b8 commit 7ce70bb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions examples/texture.pz
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
materialVar(:TextureAlpha, 0.5)
background(155, 0, 0)
noStroke()
rotate()
Expand Down
2 changes: 2 additions & 0 deletions materials/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ materials:
defaults:
- name: StrokeSize
value: 0.08
- name: TextureAlpha
value: 1.0
7 changes: 6 additions & 1 deletion materials/texture.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,14 @@ fragmentShader: |
in vec2 Texcoord;
uniform sampler2D Texture;
uniform float TextureAlpha;
vec4 textureColours;
float alpha;
out vec4 finalColour;
void main() {
finalColour = texture(Texture, Texcoord);
textureColours = texture(Texture, Texcoord);
alpha = textureColours.a;
finalColour = vec4(textureColours.rgb, alpha * TextureAlpha);
}

0 comments on commit 7ce70bb

Please sign in to comment.