@@ -32,33 +32,29 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
3232 uniform mat3x2 u_TextureMatrix;
3333#endif
3434
35- uniform vec3 u_ViewOrigin;
35+ uniform vec3 u_ViewOrigin;
3636
37- uniform float u_Time;
37+ uniform float u_Time;
3838
3939uniform uint u_ColorModulateColorGen;
4040uniform uint u_Color;
41+
4142#if defined(USE_TCGEN_ENVIRONMENT)
42- uniform mat4 u_ModelMatrix;
43+ uniform mat4 u_ModelMatrix;
4344#endif
44- uniform mat4 u_ModelViewProjectionMatrix;
45+ uniform mat4 u_ModelViewProjectionMatrix;
4546
4647#if defined(USE_DEPTH_FADE)
47- uniform float u_DepthScale;
48- OUT(smooth ) vec2 var_FadeDepth;
48+ uniform float u_DepthScale;
49+ OUT(smooth ) vec2 var_FadeDepth;
4950#endif
5051
51- OUT(smooth ) vec2 var_TexCoords;
52- OUT(smooth ) vec4 var_Color;
52+ OUT(smooth ) vec2 var_TexCoords;
53+ OUT(smooth ) vec4 var_Color;
5354
54- void DeformVertex( inout vec4 pos,
55- inout vec3 normal,
56- inout vec2 st,
57- inout vec4 color,
58- in float time );
55+ void DeformVertex( inout vec4 pos, inout vec3 normal, inout vec2 st, inout vec4 color, in float time );
5956
60- void main()
61- {
57+ void main() {
6258 #insert material_vp
6359
6460 vec4 position;
@@ -78,30 +74,28 @@ void main()
7874 gl_Position = u_ModelViewProjectionMatrix * position;
7975
8076 // transform texcoords
81- #if defined(USE_TCGEN_ENVIRONMENT)
82- {
77+ #if defined(USE_TCGEN_ENVIRONMENT)
8378 // TODO: Explain why only the rotational part of u_ModelMatrix is relevant
84- position.xyz = mat3 (u_ModelMatrix) * position.xyz;
79+ position.xyz = mat3 ( u_ModelMatrix ) * position.xyz;
8580
86- vec3 viewer = normalize (u_ViewOrigin - position.xyz);
81+ vec3 viewer = normalize ( u_ViewOrigin - position.xyz );
8782
88- float d = dot (LB.normal, viewer);
83+ float d = dot ( LB.normal, viewer );
8984
9085 vec3 reflected = LB.normal * 2.0 * d - viewer;
9186
92- var_TexCoords = 0.5 + vec2 (0.5 , - 0.5 ) * reflected.yz;
93- }
94- #elif defined(USE_TCGEN_LIGHTMAP)
95- var_TexCoords = (u_TextureMatrix * vec3 (lmCoord, 1.0 )).xy;
96- #else
97- var_TexCoords = (u_TextureMatrix * vec3 (texCoord, 1.0 )).xy;
98- #endif
99-
100- #if defined(USE_DEPTH_FADE)
101- // compute z of end of fading effect
102- vec4 fadeDepth = u_ModelViewProjectionMatrix * (position - u_DepthScale * vec4 (LB.normal, 0.0 ));
103- var_FadeDepth = fadeDepth.zw;
104- #endif
87+ var_TexCoords = 0.5 + vec2 ( 0.5 , - 0.5 ) * reflected.yz;
88+ #elif defined(USE_TCGEN_LIGHTMAP)
89+ var_TexCoords = ( u_TextureMatrix * vec3 ( lmCoord, 1.0 ) ).xy;
90+ #else
91+ var_TexCoords = ( u_TextureMatrix * vec3 ( texCoord, 1.0 ) ).xy;
92+ #endif
93+
94+ #if defined(USE_DEPTH_FADE)
95+ // compute z of end of fading effect
96+ vec4 fadeDepth = u_ModelViewProjectionMatrix * (position - u_DepthScale * vec4 ( LB.normal, 0.0 ) );
97+ var_FadeDepth = fadeDepth.zw;
98+ #endif
10599
106100 SHADER_PROFILER_SET
107101
0 commit comments