* Fix issue 514

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9541 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
Sha..rd 13 years ago
parent c2ac08f70b
commit 050f630383
  1. 9
      engine/src/core-plugins/com/jme3/scene/plugins/MTLLoader.java
  2. 8
      engine/src/core-plugins/com/jme3/scene/plugins/OBJLoader.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:

@ -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++){

Loading…
Cancel
Save