#ifdef GL_ES precision mediump int; precision highp float; #endif #define USE_OGRE_FROM_FUTURE #include OGRE_UNIFORMS( uniform mat4 worldViewProjMatrix; uniform mat4 worldMat; uniform mat4 witMat; uniform mat4 texMatrix0; uniform mat4 texMat; ) MAIN_PARAMETERS IN(vec4 vertex, POSITION) IN(vec4 normal, NORMAL) IN(vec2 uv0, TEXCOORD0) OUT(vec3 oUv, TEXCOORD0) OUT(vec3 oShadowLightspacePos, TEXCOORD1) OUT(vec3 oWp, TEXCOORD2) OUT(vec3 oNormal, TEXCOORD3) MAIN_DECLARATION { // calculate output position vec4 oPos = mul(worldViewProjMatrix, vertex); vec4 wp = mul(worldMat, vertex); oNormal = normalize(mul(witMat, normal).xyz); // Calculate vertex position in light space oShadowLightspacePos = mul(texMatrix0, wp).xyz; oUv.xy = mul(texMat, vec4(uv0.x, uv0.y, 0.0, 1.0)).xy; // Store vertex distance from camera for use in shadows oUv.z = oPos.z; oWp = wp.xyz; gl_Position = oPos; }