#ifdef GL_ES precision highp int; precision highp float; #endif #define USE_OGRE_FROM_FUTURE #include OGRE_UNIFORMS( uniform mat4 worldViewProj; uniform vec4 ambient; uniform vec4 objSpaceLight; uniform vec4 lightColour; ) MAIN_PARAMETERS IN(vec4 vertex, POSITION) IN(vec3 normal, NORMAL) OUT(vec4 oColour, TEXCOORD0) MAIN_DECLARATION { gl_Position = mul(worldViewProj, vertex); // get vertex light direction (support directional and point) vec3 light = normalize(objSpaceLight.xyz - (vertex.xyz * vec3_splat(objSpaceLight.w))); float diffuseFactor = abs(dot(normal, light)); oColour = ambient + (vec4_splat(diffuseFactor) * lightColour); }