-
Notifications
You must be signed in to change notification settings - Fork 0
/
bird_geometry_shader.glsl.js
35 lines (31 loc) · 1.22 KB
/
bird_geometry_shader.glsl.js
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
export default `
uniform sampler2D texturesBird[ 9 ];
varying vec2 vUV;
varying mat2 vUVRot;
varying float vFrameId;
varying vec2 v_reference;
uniform vec3 color1;
uniform vec3 color2;
uniform vec3 color3;
void main() {
vec2 uv = 0.9 * vec2( 1.0 / 11.0 ) * ( gl_PointCoord - 0.5 ) * vUVRot + vUV;
int id = int( vFrameId );
vec4 col;
if ( id == 0 ) { col = texture2D( texturesBird[ 0 ], uv ); }
else if ( id == 1 ) { col = texture2D( texturesBird[ 1 ], uv ); }
else if ( id == 2 ) { col = texture2D( texturesBird[ 2 ], uv ); }
else if ( id == 3 ) { col = texture2D( texturesBird[ 3 ], uv ); }
else if ( id == 4 ) { col = texture2D( texturesBird[ 4 ], uv ); }
else if ( id == 5 ) { col = texture2D( texturesBird[ 5 ], uv ); }
else if ( id == 6 ) { col = texture2D( texturesBird[ 6 ], uv ); }
else if ( id == 7 ) { col = texture2D( texturesBird[ 7 ], uv ); }
else if ( id == 8 ) { col = texture2D( texturesBird[ 8 ], uv ); }
if (int(v_reference.x / 0.3) == 0) {
gl_FragColor = vec4(color1, col.a);
}else if (int(v_reference.x / 0.3) == 1) {
gl_FragColor = vec4(color2, col.a);
}else if (int(v_reference.x / 0.3) == 2) {
gl_FragColor = vec4(color3, col.a);
}
}
`;