| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262 |
- #include<__decl__defaultVertex>
- // Attributes
- #define CUSTOM_VERTEX_BEGIN
- attribute vec3 position;
- #ifdef NORMAL
- attribute vec3 normal;
- #endif
- #ifdef TANGENT
- attribute vec4 tangent;
- #endif
- #ifdef UV1
- attribute vec2 uv;
- #endif
- #ifdef UV2
- attribute vec2 uv2;
- #endif
- #ifdef VERTEXCOLOR
- attribute vec4 color;
- #endif
- #include<helperFunctions>
- #include<bonesDeclaration>
- // Uniforms
- #include<instancesDeclaration>
- #ifdef MAINUV1
- varying vec2 vMainUV1;
- #endif
- #ifdef MAINUV2
- varying vec2 vMainUV2;
- #endif
- #if defined(DIFFUSE) && DIFFUSEDIRECTUV == 0
- varying vec2 vDiffuseUV;
- #endif
- #if defined(AMBIENT) && AMBIENTDIRECTUV == 0
- varying vec2 vAmbientUV;
- #endif
- #if defined(OPACITY) && OPACITYDIRECTUV == 0
- varying vec2 vOpacityUV;
- #endif
- #if defined(EMISSIVE) && EMISSIVEDIRECTUV == 0
- varying vec2 vEmissiveUV;
- #endif
- #if defined(LIGHTMAP) && LIGHTMAPDIRECTUV == 0
- varying vec2 vLightmapUV;
- #endif
- #if defined(SPECULAR) && defined(SPECULARTERM) && SPECULARDIRECTUV == 0
- varying vec2 vSpecularUV;
- #endif
- #if defined(BUMP) && BUMPDIRECTUV == 0
- varying vec2 vBumpUV;
- #endif
- // Output
- varying vec3 vPositionW;
- #ifdef NORMAL
- varying vec3 vNormalW;
- #endif
- #ifdef VERTEXCOLOR
- varying vec4 vColor;
- #endif
- #include<bumpVertexDeclaration>
- #include<clipPlaneVertexDeclaration>
- #include<fogVertexDeclaration>
- #include<__decl__lightFragment>[0..maxSimultaneousLights]
- #include<morphTargetsVertexGlobalDeclaration>
- #include<morphTargetsVertexDeclaration>[0..maxSimultaneousMorphTargets]
- #ifdef REFLECTIONMAP_SKYBOX
- varying vec3 vPositionUVW;
- #endif
- #if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)
- varying vec3 vDirectionW;
- #endif
- #include<logDepthDeclaration>
- #define CUSTOM_VERTEX_DEFINITIONS
- void main(void) {
-
- #define CUSTOM_VERTEX_MAIN_BEGIN
-
- vec3 positionUpdated = position;
- #ifdef NORMAL
- vec3 normalUpdated = normal;
- #endif
- #ifdef TANGENT
- vec4 tangentUpdated = tangent;
- #endif
- #include<morphTargetsVertex>[0..maxSimultaneousMorphTargets]
- #ifdef REFLECTIONMAP_SKYBOX
- #ifdef REFLECTIONMAP_SKYBOX_TRANSFORMED
- vPositionUVW = (reflectionMatrix * vec4(position, 1.0)).xyz;
- #else
- vPositionUVW = position;
- #endif
- #endif
- #define CUSTOM_VERTEX_UPDATE_POSITION
- #define CUSTOM_VERTEX_UPDATE_NORMAL
- #include<instancesVertex>
- #include<bonesVertex>
- #ifdef MULTIVIEW
- if (gl_ViewID_OVR == 0u) {
- gl_Position = viewProjection * finalWorld * vec4(positionUpdated, 1.0);
- } else {
- gl_Position = viewProjectionR * finalWorld * vec4(positionUpdated, 1.0);
- }
- #else
- gl_Position = viewProjection * finalWorld * vec4(positionUpdated, 1.0);
- #endif
-
- vec4 worldPos = finalWorld * vec4(positionUpdated, 1.0);
- vPositionW = vec3(worldPos);
- #ifdef NORMAL
- mat3 normalWorld = mat3(finalWorld);
- #ifdef NONUNIFORMSCALING
- normalWorld = transposeMat3(inverseMat3(normalWorld));
- #endif
- vNormalW = normalize(normalWorld * normalUpdated);
- #endif
- #if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)
- vDirectionW = normalize(vec3(finalWorld * vec4(positionUpdated, 0.0)));
- #endif
- // Texture coordinates
- #ifndef UV1
- vec2 uv = vec2(0., 0.);
- #endif
- #ifndef UV2
- vec2 uv2 = vec2(0., 0.);
- #endif
- #ifdef MAINUV1
- vMainUV1 = uv;
- #endif
- #ifdef MAINUV2
- vMainUV2 = uv2;
- #endif
- #if defined(DIFFUSE) && DIFFUSEDIRECTUV == 0
- if (vDiffuseInfos.x == 0.)
- {
- vDiffuseUV = vec2(diffuseMatrix * vec4(uv, 1.0, 0.0));
- }
- else
- {
- vDiffuseUV = vec2(diffuseMatrix * vec4(uv2, 1.0, 0.0));
- }
- #endif
- #if defined(AMBIENT) && AMBIENTDIRECTUV == 0
- if (vAmbientInfos.x == 0.)
- {
- vAmbientUV = vec2(ambientMatrix * vec4(uv, 1.0, 0.0));
- }
- else
- {
- vAmbientUV = vec2(ambientMatrix * vec4(uv2, 1.0, 0.0));
- }
- #endif
- #if defined(OPACITY) && OPACITYDIRECTUV == 0
- if (vOpacityInfos.x == 0.)
- {
- vOpacityUV = vec2(opacityMatrix * vec4(uv, 1.0, 0.0));
- }
- else
- {
- vOpacityUV = vec2(opacityMatrix * vec4(uv2, 1.0, 0.0));
- }
- #endif
- #if defined(EMISSIVE) && EMISSIVEDIRECTUV == 0
- if (vEmissiveInfos.x == 0.)
- {
- vEmissiveUV = vec2(emissiveMatrix * vec4(uv, 1.0, 0.0));
- }
- else
- {
- vEmissiveUV = vec2(emissiveMatrix * vec4(uv2, 1.0, 0.0));
- }
- #endif
- #if defined(LIGHTMAP) && LIGHTMAPDIRECTUV == 0
- if (vLightmapInfos.x == 0.)
- {
- vLightmapUV = vec2(lightmapMatrix * vec4(uv, 1.0, 0.0));
- }
- else
- {
- vLightmapUV = vec2(lightmapMatrix * vec4(uv2, 1.0, 0.0));
- }
- #endif
- #if defined(SPECULAR) && defined(SPECULARTERM) && SPECULARDIRECTUV == 0
- if (vSpecularInfos.x == 0.)
- {
- vSpecularUV = vec2(specularMatrix * vec4(uv, 1.0, 0.0));
- }
- else
- {
- vSpecularUV = vec2(specularMatrix * vec4(uv2, 1.0, 0.0));
- }
- #endif
- #if defined(BUMP) && BUMPDIRECTUV == 0
- if (vBumpInfos.x == 0.)
- {
- vBumpUV = vec2(bumpMatrix * vec4(uv, 1.0, 0.0));
- }
- else
- {
- vBumpUV = vec2(bumpMatrix * vec4(uv2, 1.0, 0.0));
- }
- #endif
- #include<bumpVertex>
- #include<clipPlaneVertex>
- #include<fogVertex>
- #include<shadowsVertex>[0..maxSimultaneousLights]
- #ifdef VERTEXCOLOR
- // Vertex color
- vColor = color;
- #endif
- #include<pointCloudVertex>
- #include<logDepthVertex>
- #define CUSTOM_VERTEX_MAIN_END
- }
|