"varying mediump vec3 ShadowMapTC;\n"
"#endif\n"
"\n"
+"#ifdef USEBOUNCEGRID\n"
+"varying mediump vec3 BounceGridTexCoord;\n"
+"#endif\n"
+"\n"
+"\n"
"\n"
"\n"
"\n"
"#ifdef USESHADOWMAPORTHO\n"
"uniform highp mat4 ShadowMapMatrix;\n"
"#endif\n"
+"#ifdef USEBOUNCEGRID\n"
+"uniform highp mat4 BounceGridMatrix;\n"
+"#endif\n"
"void main(void)\n"
"{\n"
"#if defined(MODE_VERTEXCOLOR) || defined(USEVERTEXTEXTUREBLEND)\n"
" TexCoordLightmap = vec2(Attrib_TexCoord4);\n"
"#endif\n"
"\n"
+"#ifdef USEBOUNCEGRID\n"
+" BounceGridTexCoord = vec3(BounceGridMatrix * Attrib_Position);\n"
+"#endif\n"
+"\n"
"#ifdef MODE_LIGHTSOURCE\n"
" // transform vertex position into light attenuation/cubemap space\n"
" // (-1 to +1 across the light box)\n"
"#ifdef MODE_LIGHTSOURCE\n"
"uniform myhalf3 LightColor;\n"
"#endif\n"
+"#ifdef USEBOUNCEGRID\n"
+"uniform sampler3D Texture_BounceGrid;\n"
+"uniform float BounceGridIntensity;\n"
+"#endif\n"
"void main(void)\n"
"{\n"
"#ifdef USEOFFSETMAPPING\n"
" color.rgb += glosstex.rgb * myhalf3(texture2D(Texture_ScreenSpecular, ScreenTexCoord)) * DeferredMod_Specular;\n"
"#endif\n"
"\n"
+"#ifdef USEBOUNCEGRID\n"
+" color.rgb += diffusetex * myhalf3(texture3D(Texture_BounceGrid, BounceGridTexCoord)) * BounceGridIntensity;\n"
+"#endif\n"
+"\n"
"#ifdef USEGLOW\n"
"#ifdef USEVERTEXTEXTUREBLEND\n"
" color.rgb += mix(myhalf3(texture2D(Texture_SecondaryGlow, TexCoord2)), myhalf3(texture2D(Texture_Glow, TexCoord)), terrainblend) * Color_Glow;\n"