* Fix colors reference issue in MTL loader

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7537 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
sha..rd 14 years ago
parent 8cefea550e
commit c9a5e0953a
  1. 8
      engine/src/core-plugins/com/jme3/scene/plugins/MTLLoader.java

@ -111,15 +111,15 @@ public class MTLLoader implements AssetLoader {
if (shadeless){ if (shadeless){
material = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); material = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
material.setColor("Color", diffuse); material.setColor("Color", diffuse.clone());
material.setTexture("ColorMap", diffuseMap); material.setTexture("ColorMap", diffuseMap);
// TODO: Add handling for alpha map? // TODO: Add handling for alpha map?
}else{ }else{
material = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md"); material = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
material.setBoolean("UseMaterialColors", true); material.setBoolean("UseMaterialColors", true);
material.setColor("Ambient", ambient); material.setColor("Ambient", ambient.clone());
material.setColor("Diffuse", diffuse); material.setColor("Diffuse", diffuse.clone());
material.setColor("Specular", specular); material.setColor("Specular", specular.clone());
material.setFloat("Shininess", shininess); // prevents "premature culling" bug material.setFloat("Shininess", shininess); // prevents "premature culling" bug
if (diffuseMap != null) material.setTexture("DiffuseMap", diffuseMap); if (diffuseMap != null) material.setTexture("DiffuseMap", diffuseMap);

Loading…
Cancel
Save