Shininess is now loaded from the material as a uniform instead of being hardcoded.

--HG--
branch : gsoc2013-dfighter
hg/feature/gsoc2013-dfighter
dfighter1985 11 years ago
parent 4ba9d815d4
commit 6c58856ed7

@ -83,6 +83,14 @@ namespace NL3D
Light5ColSpec,
Light6ColSpec,
Light7ColSpec,
Light0Shininess,
Light1Shininess,
Light2Shininess,
Light3Shininess,
Light4Shininess,
Light5Shininess,
Light6Shininess,
Light7Shininess,
NUM_UNIFORMS
};

@ -228,7 +228,15 @@ namespace NL3D
"light4ColSpec",
"light5ColSpec",
"light6ColSpec",
"light7ColSpec"
"light7ColSpec",
"light0Shininess",
"light1Shininess",
"light2Shininess",
"light3Shininess",
"light4Shininess",
"light5Shininess",
"light6Shininess",
"light7Shininess"
};
void CGLSLProgram::cacheUniformIndices()

@ -365,6 +365,7 @@ namespace NL3D
ss << "uniform vec4 light" << i << "ColDiff;" << std::endl;
ss << "uniform vec4 light" << i << "ColAmb;" << std::endl;
ss << "uniform vec4 light" << i << "ColSpec;" << std::endl;
ss << "uniform float light" << i << "Shininess;" << std::endl;
break;
}
}
@ -442,7 +443,7 @@ namespace NL3D
//ss << "float angle = dot( normal3, reflection );" << std::endl;
ss << "float angle = dot( normal3, halfVector );" << std::endl;
ss << "angle = max( 0.0, angle );" << std::endl;
ss << "float si = pow( angle, 128.0 );" << std::endl;
ss << "float si = pow( angle, light" << num << "Shininess );" << std::endl;
ss << "return si;" << std::endl;
ss << "}" << std::endl;
ss << std::endl;

@ -412,6 +412,12 @@ namespace NL3D
setUniform4f( lsc, glCol[ 0 ], glCol[ 1 ], glCol[ 2 ], glCol[ 3 ] );
}
int shl = currentProgram->getUniformIndex( IProgramObject::EUniform( IProgramObject::Light0Shininess + i ) );
if( shl != -1 )
{
setUniform1f( shl, mat.getShininess() );
}
int lac = currentProgram->getUniformIndex( IProgramObject::EUniform( IProgramObject::Light0ColAmb + i ) );
if( lac != -1 )
{

Loading…
Cancel
Save