specularColor.rgb *= texture2D(m_ColorRamp, vec2(light.y, 0.0)).rgb;\r
#endif\r
\r
+ // Workaround, since it is not possible to modify varying variables\r
+ vec4 SpecularSum2 = SpecularSum;\r
#ifdef USE_REFLECTION\r
vec4 refColor = Optics_GetEnvColor(m_EnvMap, refVec.xyz);\r
\r
// Interpolate light specularity toward reflection color\r
// Multiply result by specular map\r
- specularColor = mix(SpecularSum * light.y, refColor, refVec.w) * specularColor;\r
+ specularColor = mix(SpecularSum2 * light.y, refColor, refVec.w) * specularColor;\r
\r
- SpecularSum = vec4(1.0);\r
+ SpecularSum2 = vec4(1.0);\r
light.y = 1.0;\r
#endif\r
\r
gl_FragColor = AmbientSum * diffuseColor +\r
DiffuseSum * diffuseColor * light.x +\r
- SpecularSum * specularColor * light.y;\r
+ SpecularSum2 * specularColor * light.y;\r
#endif\r
gl_FragColor.a = alpha;\r
}\r
}else if (cmd.equals("usemtl")){
// use material from MTL lib for the following faces
currentMatName = scan.next();
+ if (!matList.containsKey(currentMatName))
+ throw new IOException("Cannot locate material " + currentMatName + " in MTL file!");
+
}else if (cmd.equals("mtllib")){
// specify MTL lib to use for this OBJ file
String mtllib = scan.nextLine().trim();