forked from playcanvas/engine
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update gsplat example shaders to latest structure (playcanvas#7021)
- Loading branch information
Showing
3 changed files
with
67 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,34 @@ | ||
uniform float uTime; | ||
varying float height; | ||
|
||
void main(void) | ||
{ | ||
// get splat color and alpha | ||
gl_FragColor = evalSplat(); | ||
|
||
void animate(inout vec4 clr) { | ||
float sineValue = abs(sin(uTime * 5.0 + height)); | ||
|
||
#ifdef CUTOUT | ||
|
||
// in cutout mode, remove pixels along the wave | ||
if (sineValue < 0.5) { | ||
gl_FragColor.a = 0.0; | ||
clr.a = 0.0; | ||
} | ||
|
||
#else | ||
|
||
// in non-cutout mode, add a golden tint to the wave | ||
vec3 gold = vec3(1.0, 0.85, 0.0); | ||
float blend = smoothstep(0.9, 1.0, sineValue); | ||
gl_FragColor.xyz = mix(gl_FragColor.xyz, gold, blend); | ||
clr.xyz = mix(clr.xyz, gold, blend); | ||
|
||
#endif | ||
} | ||
|
||
varying mediump vec2 texCoord; | ||
varying mediump vec4 color; | ||
|
||
void main(void) | ||
{ | ||
vec4 clr = evalSplat(texCoord, color); | ||
|
||
animate(clr); | ||
|
||
gl_FragColor = clr; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters