projects
/
carveJwlIkooP6JGAAIwe30JlM.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
the luxuries of a modern C compiler
[carveJwlIkooP6JGAAIwe30JlM.git]
/
shaders
/
cloud.vs
diff --git
a/shaders/cloud.vs
b/shaders/cloud.vs
index 431afd05c28f3163ad0c42c9b373231d21b59758..88b0d4dd721dd438cacd726c1e3dac09eac0bcd9 100644
(file)
--- a/
shaders/cloud.vs
+++ b/
shaders/cloud.vs
@@
-7,8
+7,7
@@
uniform mat4x3 uMdl;
uniform mat3 uNormMtx;
uniform mat4 uPv;
uniform mat4 uPvmPrev;
uniform mat3 uNormMtx;
uniform mat4 uPv;
uniform mat4 uPvmPrev;
-uniform vec2 uTime;
-uniform vec4 uTransform;
+uniform vec4 uAnim;
out vec4 aColour;
out vec3 aWorldCo;
out vec4 aColour;
out vec3 aWorldCo;
@@
-21,37
+20,34
@@
vec2 rand_hash22( vec2 p )
return fract(vec2((p3.x + p3.y)*p3.z, (p3.x+p3.z)*p3.y));
}
return fract(vec2((p3.x + p3.y)*p3.z, (p3.x+p3.z)*p3.y));
}
-vec3
mapP( vec3 p
)
+vec3
gridify( vec3 p, float s, float t
)
{
{
- return p;
- float t = max(0.0,uTime.y);
+ vec3 co = p*s;
+ vec2 r2 = rand_hash22(p.xz);
+ vec3 grid = vec3(floor(co.x),co.y,floor(co.z)) * (1.0/s);
- vec3 lco = p * 20.0;
- vec3 grid = vec3(floor(lco.x),lco.y,floor(lco.z));//fract(p);
+ float t1 = 1.0-t;
+ t1 = 1.0-t1*t1;
+ float t2 = t*t;
- return mix(
p,grid * (1.0/20.0), t)*vec3(1.0+t,1.0-t,1.0+t
);
+ return mix(
p, grid, t1 ) + t2*vec3(0.0,r2.y*r2.y*0.2,0.0
);
}
void main()
{
}
void main()
{
- vec3
mco = a_co.xyz * uTransform.w + uTransform.xyz
;
+ vec3
co = gridify( a_co.xyz, uAnim.x, uAnim.y )
;
-
- vec3 center = vec3(0.5);
- vec3 lco = mapP(mco);
-
- vec3 world_pos0 = uMdl * vec4( mco, 1.0 );
+ vec3 world_pos0 = uMdl * vec4( co, 1.0 );
vec4 vproj0 = uPv * vec4( world_pos0, 1.0 );
vec4 vproj0 = uPv * vec4( world_pos0, 1.0 );
- vec4 vproj1 = uPvmPrev * vec4(
m
co, 1.0 );
+ vec4 vproj1 = uPvmPrev * vec4( co, 1.0 );
- float t = max(0.0,uTime.y);
- float scaler = smoothstep(0.6,0.58,length(lco.xz));
+ float scaler = smoothstep(0.6,0.58,length(co.xz));
vs_motion_out( vproj0, vproj1 );
gl_Position = vproj0;
vs_motion_out( vproj0, vproj1 );
gl_Position = vproj0;
- gl_PointSize = (9.0*
uTransform.w*
scaler) / (gl_Position.z + 0.01);
+ gl_PointSize = (9.0*scaler) / (gl_Position.z + 0.01);
aWorldCo = world_pos0;
aWorldCo = world_pos0;
- aColour = a_colour*scaler;
- aCo =
m
co;
+ aColour = a_colour*scaler
*(1.0-uAnim.y*uAnim.y)
;
+ aCo = co;
}
}