From 050f630383672c307bd601db5533a1877e3a3ec5 Mon Sep 17 00:00:00 2001 From: "Sha..rd" Date: Sun, 8 Jul 2012 19:39:18 +0000 Subject: [PATCH] * Fix issue 514 git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9541 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../core-plugins/com/jme3/scene/plugins/MTLLoader.java | 9 ++------- .../core-plugins/com/jme3/scene/plugins/OBJLoader.java | 8 +++++--- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/engine/src/core-plugins/com/jme3/scene/plugins/MTLLoader.java b/engine/src/core-plugins/com/jme3/scene/plugins/MTLLoader.java index 1f701cd4c..bad560a36 100644 --- a/engine/src/core-plugins/com/jme3/scene/plugins/MTLLoader.java +++ b/engine/src/core-plugins/com/jme3/scene/plugins/MTLLoader.java @@ -70,7 +70,6 @@ public class MTLLoader implements AssetLoader { protected String matName; protected float alpha = 1; protected boolean transparent = false; - protected boolean disallowTransparency = false; protected boolean disallowAmbient = false; protected boolean disallowSpecular = false; @@ -110,7 +109,6 @@ public class MTLLoader implements AssetLoader { diffuse.set(ColorRGBA.LightGray); specular.set(ColorRGBA.Black); shininess = 16; - disallowTransparency = false; disallowAmbient = false; disallowSpecular = false; shadeless = false; @@ -126,7 +124,7 @@ public class MTLLoader implements AssetLoader { protected void createMaterial(){ Material material; - if (alpha < 1f && transparent && !disallowTransparency){ + if (alpha < 1f && transparent){ diffuse.a = alpha; } @@ -149,7 +147,7 @@ public class MTLLoader implements AssetLoader { if (alphaMap != null) material.setTexture("AlphaMap", alphaMap); } - if (transparent && !disallowTransparency){ + if (transparent){ material.setTransparent(true); material.getAdditionalRenderState().setBlendMode(BlendMode.Alpha); material.getAdditionalRenderState().setAlphaTest(true); @@ -255,17 +253,14 @@ public class MTLLoader implements AssetLoader { case 0: // no lighting shadeless = true; - disallowTransparency = true; break; case 1: disallowSpecular = true; - disallowTransparency = true; break; case 2: case 3: case 5: case 8: - disallowTransparency = true; break; case 4: case 6: diff --git a/engine/src/core-plugins/com/jme3/scene/plugins/OBJLoader.java b/engine/src/core-plugins/com/jme3/scene/plugins/OBJLoader.java index 57fb1c270..c772bcae8 100644 --- a/engine/src/core-plugins/com/jme3/scene/plugins/OBJLoader.java +++ b/engine/src/core-plugins/com/jme3/scene/plugins/OBJLoader.java @@ -38,8 +38,8 @@ import com.jme3.material.MaterialList; import com.jme3.math.Vector2f; import com.jme3.math.Vector3f; import com.jme3.renderer.queue.RenderQueue.Bucket; -import com.jme3.scene.*; import com.jme3.scene.Mesh.Mode; +import com.jme3.scene.*; import com.jme3.scene.VertexBuffer.Type; import com.jme3.scene.mesh.IndexBuffer; import com.jme3.scene.mesh.IndexIntBuffer; @@ -52,8 +52,8 @@ import java.io.InputStream; import java.nio.FloatBuffer; import java.nio.IntBuffer; import java.nio.ShortBuffer; -import java.util.*; import java.util.Map.Entry; +import java.util.*; import java.util.logging.Level; import java.util.logging.Logger; @@ -268,8 +268,10 @@ public final class OBJLoader implements AssetLoader { vertList.add(vx); } - if (vertList.size() > 4 || vertList.size() <= 2) + if (vertList.size() > 4 || vertList.size() <= 2) { logger.warning("Edge or polygon detected in OBJ. Ignored."); + return; + } f.verticies = new Vertex[vertList.size()]; for (int i = 0; i < vertList.size(); i++){