precision mediump float; // Attributes attribute vec3 position; attribute vec3 normal; #ifdef UV1 attribute vec2 uv; #endif #ifdef UV2 attribute vec2 uv2; #endif #ifdef VERTEXCOLOR attribute vec4 color; #endif #include // Uniforms uniform mat4 world; uniform mat4 view; uniform mat4 viewProjection; #ifdef ALBEDO varying vec2 vAlbedoUV; uniform mat4 albedoMatrix; uniform vec2 vAlbedoInfos; #endif #ifdef AMBIENT varying vec2 vAmbientUV; uniform mat4 ambientMatrix; uniform vec2 vAmbientInfos; #endif #ifdef OPACITY varying vec2 vOpacityUV; uniform mat4 opacityMatrix; uniform vec2 vOpacityInfos; #endif #ifdef EMISSIVE varying vec2 vEmissiveUV; uniform vec2 vEmissiveInfos; uniform mat4 emissiveMatrix; #endif #if defined(REFLECTIVITY) varying vec2 vReflectivityUV; uniform vec2 vReflectivityInfos; uniform mat4 reflectivityMatrix; #endif // Output varying vec3 vPositionW; varying vec3 vNormalW; #ifdef VERTEXCOLOR varying vec4 vColor; #endif #include void main(void) { mat4 finalWorld = world; #include finalWorld = finalWorld * influence; #endif gl_Position = viewProjection * finalWorld * vec4(position, 1.0); vec4 worldPos = finalWorld * vec4(position, 1.0); vPositionW = vec3(worldPos); vNormalW = normalize(vec3(finalWorld * vec4(normal, 0.0))); // Texture coordinates #ifndef UV1 vec2 uv = vec2(0., 0.); #endif #ifndef UV2 vec2 uv2 = vec2(0., 0.); #endif #ifdef ALBEDO if (vAlbedoInfos.x == 0.) { vAlbedoUV = vec2(albedoMatrix * vec4(uv, 1.0, 0.0)); } else { vAlbedoUV = vec2(albedoMatrix * vec4(uv2, 1.0, 0.0)); } #endif #ifdef AMBIENT if (vAmbientInfos.x == 0.) { vAmbientUV = vec2(ambientMatrix * vec4(uv, 1.0, 0.0)); } else { vAmbientUV = vec2(ambientMatrix * vec4(uv2, 1.0, 0.0)); } #endif #ifdef OPACITY if (vOpacityInfos.x == 0.) { vOpacityUV = vec2(opacityMatrix * vec4(uv, 1.0, 0.0)); } else { vOpacityUV = vec2(opacityMatrix * vec4(uv2, 1.0, 0.0)); } #endif #ifdef EMISSIVE 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(REFLECTIVITY) if (vReflectivityInfos.x == 0.) { vReflectivityUV = vec2(reflectivityMatrix * vec4(uv, 1.0, 0.0)); } else { vReflectivityUV = vec2(reflectivityMatrix * vec4(uv2, 1.0, 0.0)); } #endif #include // Vertex color #ifdef VERTEXCOLOR vColor = color; #endif }