* Fix Lighting.frag compile error
* Replaced nondescript NullPointerException in OBJLoader with proper exception for missing material in MTL git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7026 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
8da5e751dd
commit
0df414d2f0
@ -188,20 +188,22 @@ void main(){
|
|||||||
specularColor.rgb *= texture2D(m_ColorRamp, vec2(light.y, 0.0)).rgb;
|
specularColor.rgb *= texture2D(m_ColorRamp, vec2(light.y, 0.0)).rgb;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Workaround, since it is not possible to modify varying variables
|
||||||
|
vec4 SpecularSum2 = SpecularSum;
|
||||||
#ifdef USE_REFLECTION
|
#ifdef USE_REFLECTION
|
||||||
vec4 refColor = Optics_GetEnvColor(m_EnvMap, refVec.xyz);
|
vec4 refColor = Optics_GetEnvColor(m_EnvMap, refVec.xyz);
|
||||||
|
|
||||||
// Interpolate light specularity toward reflection color
|
// Interpolate light specularity toward reflection color
|
||||||
// Multiply result by specular map
|
// Multiply result by specular map
|
||||||
specularColor = mix(SpecularSum * light.y, refColor, refVec.w) * specularColor;
|
specularColor = mix(SpecularSum2 * light.y, refColor, refVec.w) * specularColor;
|
||||||
|
|
||||||
SpecularSum = vec4(1.0);
|
SpecularSum2 = vec4(1.0);
|
||||||
light.y = 1.0;
|
light.y = 1.0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gl_FragColor = AmbientSum * diffuseColor +
|
gl_FragColor = AmbientSum * diffuseColor +
|
||||||
DiffuseSum * diffuseColor * light.x +
|
DiffuseSum * diffuseColor * light.x +
|
||||||
SpecularSum * specularColor * light.y;
|
SpecularSum2 * specularColor * light.y;
|
||||||
#endif
|
#endif
|
||||||
gl_FragColor.a = alpha;
|
gl_FragColor.a = alpha;
|
||||||
}
|
}
|
||||||
|
@ -332,6 +332,9 @@ public final class OBJLoader implements AssetLoader {
|
|||||||
}else if (cmd.equals("usemtl")){
|
}else if (cmd.equals("usemtl")){
|
||||||
// use material from MTL lib for the following faces
|
// use material from MTL lib for the following faces
|
||||||
currentMatName = scan.next();
|
currentMatName = scan.next();
|
||||||
|
if (!matList.containsKey(currentMatName))
|
||||||
|
throw new IOException("Cannot locate material " + currentMatName + " in MTL file!");
|
||||||
|
|
||||||
}else if (cmd.equals("mtllib")){
|
}else if (cmd.equals("mtllib")){
|
||||||
// specify MTL lib to use for this OBJ file
|
// specify MTL lib to use for this OBJ file
|
||||||
String mtllib = scan.nextLine().trim();
|
String mtllib = scan.nextLine().trim();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user