123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- precision highp float;
- // Attributes
- attribute vec3 position;
- #ifdef NORMAL
- attribute vec3 normal;
- #endif
- #ifdef UV1
- attribute vec2 uv;
- #endif
- #ifdef UV2
- attribute vec2 uv2;
- #endif
- #ifdef VERTEXCOLOR
- attribute vec4 color;
- #endif
- #include<bonesDeclaration>
- // Uniforms
- #include<instancesDeclaration>
- uniform mat4 view;
- uniform mat4 viewProjection;
- #ifdef DIFFUSE
- varying vec2 vDiffuseUV;
- uniform mat4 diffuseMatrix;
- uniform vec2 vDiffuseInfos;
- #endif
- #ifdef POINTSIZE
- uniform float pointSize;
- #endif
- // Output
- varying vec3 vPositionW;
- #ifdef NORMAL
- varying vec3 vNormalW;
- #endif
- #ifdef VERTEXCOLOR
- varying vec4 vColor;
- #endif
- #include<clipPlaneVertexDeclaration>
- #include<fogVertexDeclaration>
- #include<__decl__lightFragment>[0..maxSimultaneousLights]
- void main(void) {
- #include<instancesVertex>
- #include<bonesVertex>
- gl_Position = viewProjection * finalWorld * vec4(position, 1.0);
- vec4 worldPos = finalWorld * vec4(position, 1.0);
- vPositionW = vec3(worldPos);
- #ifdef NORMAL
- vNormalW = normalize(vec3(finalWorld * vec4(normal, 0.0)));
- #endif
- // Texture coordinates
- #ifndef UV1
- vec2 uv = vec2(0., 0.);
- #endif
- #ifndef UV2
- vec2 uv2 = vec2(0., 0.);
- #endif
- #ifdef DIFFUSE
- if (vDiffuseInfos.x == 0.)
- {
- vDiffuseUV = vec2(diffuseMatrix * vec4(uv, 1.0, 0.0));
- }
- else
- {
- vDiffuseUV = vec2(diffuseMatrix * vec4(uv2, 1.0, 0.0));
- }
- #endif
- // Clip plane
- #include<clipPlaneVertex>
- // Fog
- #include<fogVertex>
- #include<shadowsVertex>[0..maxSimultaneousLights]
- // Vertex color
- #ifdef VERTEXCOLOR
- vColor = color;
- #endif
- // Point size
- #ifdef POINTSIZE
- gl_PointSize = pointSize;
- #endif
- }
|