Tiny shader optimization
parent
87a551ede7
commit
908daf95cf
|
@ -1818,13 +1818,14 @@ ShaderManager::buildVertexShader(const ShaderProperties& props)
|
||||||
if (props.hasRingShadows())
|
if (props.hasRingShadows())
|
||||||
{
|
{
|
||||||
source += "vec3 ringShadowProj;\n";
|
source += "vec3 ringShadowProj;\n";
|
||||||
|
source += "float t = -(dot(gl_Vertex.xyz, ringPlane.xyz) + ringPlane.w);\n";
|
||||||
for (unsigned int j = 0; j < props.nLights; j++)
|
for (unsigned int j = 0; j < props.nLights; j++)
|
||||||
{
|
{
|
||||||
if (props.hasRingShadowForLight(j))
|
if (props.hasRingShadowForLight(j))
|
||||||
{
|
{
|
||||||
source += "ringShadowProj = gl_Vertex.xyz + " +
|
source += "ringShadowProj = gl_Vertex.xyz + " +
|
||||||
LightProperty(j, "direction") +
|
LightProperty(j, "direction") +
|
||||||
" * max(0.0, -(dot(gl_Vertex.xyz, ringPlane.xyz) + ringPlane.w) / dot(" +
|
" * max(0.0, t / dot(" +
|
||||||
LightProperty(j, "direction") + ", ringPlane.xyz));\n";
|
LightProperty(j, "direction") + ", ringPlane.xyz));\n";
|
||||||
|
|
||||||
source += RingShadowTexCoord(j) +
|
source += RingShadowTexCoord(j) +
|
||||||
|
|
Loading…
Reference in New Issue