|
|
@ -413,7 +413,9 @@ namespace NL3D
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ss << "float getIntensity" << num << "( vec3 normal3 )" << std::endl;
|
|
|
|
ss << "float getIntensity" << num << "( vec3 normal3 )" << std::endl;
|
|
|
|
ss << "{" << std::endl;
|
|
|
|
ss << "{" << std::endl;
|
|
|
|
ss << "float angle = dot( normalize( light" << num << "Dir ), normal3 );" << std::endl;
|
|
|
|
ss << "vec4 lightDir4 = mvMatrix * vec4( light" << num << "Dir, 1.0 );" << std::endl;
|
|
|
|
|
|
|
|
ss << "vec3 lightDir = lightDir4.xyz / lightDir4.w;" << std::endl;
|
|
|
|
|
|
|
|
ss << "float angle = dot( normalize( lightDir ), normal3 );" << std::endl;
|
|
|
|
ss << "angle = max( 0.0, angle );" << std::endl;
|
|
|
|
ss << "angle = max( 0.0, angle );" << std::endl;
|
|
|
|
ss << "return angle;" << std::endl;
|
|
|
|
ss << "return angle;" << std::endl;
|
|
|
|
ss << "}" << std::endl;
|
|
|
|
ss << "}" << std::endl;
|
|
|
@ -421,7 +423,9 @@ namespace NL3D
|
|
|
|
|
|
|
|
|
|
|
|
ss << "float getSpecIntensity" << num << "( vec3 normal3 )" << std::endl;
|
|
|
|
ss << "float getSpecIntensity" << num << "( vec3 normal3 )" << std::endl;
|
|
|
|
ss << "{" << std::endl;
|
|
|
|
ss << "{" << std::endl;
|
|
|
|
ss << "vec3 halfVector = normalize( light" << num << "Dir + normal3 );" << std::endl;
|
|
|
|
ss << "vec4 lightDir4 = mvMatrix * vec4( light" << num << "Dir, 1.0 );" << std::endl;
|
|
|
|
|
|
|
|
ss << "vec3 lightDir = lightDir4.xyz / lightDir4.w;" << std::endl;
|
|
|
|
|
|
|
|
ss << "vec3 halfVector = normalize( lightDir + normal3 );" << std::endl;
|
|
|
|
ss << "float angle = dot( normal3, halfVector );" << std::endl;
|
|
|
|
ss << "float angle = dot( normal3, halfVector );" << std::endl;
|
|
|
|
ss << "angle = max( 0.0, angle );" << std::endl;
|
|
|
|
ss << "angle = max( 0.0, angle );" << std::endl;
|
|
|
|
ss << "float si = pow( angle, light" << num << "Shininess );" << std::endl;
|
|
|
|
ss << "float si = pow( angle, light" << num << "Shininess );" << std::endl;
|
|
|
@ -464,7 +468,9 @@ namespace NL3D
|
|
|
|
ss << "vec4 getLight" << num << "Color()" << std::endl;
|
|
|
|
ss << "vec4 getLight" << num << "Color()" << std::endl;
|
|
|
|
ss << "{" << std::endl;
|
|
|
|
ss << "{" << std::endl;
|
|
|
|
ss << "vec3 ecPos3 = ecPos4.xyz / ecPos4.w;" << std::endl;
|
|
|
|
ss << "vec3 ecPos3 = ecPos4.xyz / ecPos4.w;" << std::endl;
|
|
|
|
ss << "vec3 lightDirection = light" << num << "Pos - ecPos3;" << std::endl;
|
|
|
|
ss << "vec4 lightPos4 = mvMatrix * vec4( light" << num << "Pos, 1.0 );" << std::endl;
|
|
|
|
|
|
|
|
ss << "vec3 lightPos = lightPos4.xyz / lightPos4.w;" << std::endl;
|
|
|
|
|
|
|
|
ss << "vec3 lightDirection = lightPos - ecPos3;" << std::endl;
|
|
|
|
ss << "float lightDistance = length( lightDirection );" << std::endl;
|
|
|
|
ss << "float lightDistance = length( lightDirection );" << std::endl;
|
|
|
|
ss << "lightDirection = normalize( lightDirection );" << std::endl;
|
|
|
|
ss << "lightDirection = normalize( lightDirection );" << std::endl;
|
|
|
|
|
|
|
|
|
|
|
|