瀏覽代碼

* Fix colors reference issue in MTL loader

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7537 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
sha..rd 14 年之前
父節點
當前提交
c9a5e0953a
共有 1 個文件被更改,包括 4 次插入4 次删除
  1. 4 4
      engine/src/core-plugins/com/jme3/scene/plugins/MTLLoader.java

+ 4 - 4
engine/src/core-plugins/com/jme3/scene/plugins/MTLLoader.java

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