FIXED: Issue 430: Blender loader sets blend mode = alpha on material that is not really transparent

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8900 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
Kae..pl 13 years ago
parent 4b55383ba0
commit 0e4f115e84
  1. 17
      engine/src/blender/com/jme3/scene/plugins/blender/materials/MaterialContext.java

@ -63,7 +63,6 @@ public final class MaterialContext {
int mode = ((Number) structure.getFieldValue("mode")).intValue();
shadeless = (mode & 0x4) != 0;
vertexColor = (mode & 0x80) != 0;
transparent = (mode & 0x10000) != 0;
vTangent = (mode & 0x4000000) != 0; // NOTE: Requires tangents
int diff_shader = ((Number) structure.getFieldValue("diff_shader")).intValue();
@ -90,6 +89,7 @@ public final class MaterialContext {
float shininess = ((Number) structure.getFieldValue("emit")).floatValue();
this.shininess = shininess > 0.0f ? shininess : MaterialHelper.DEFAULT_SHININESS;
}
float[] diffuseColorArray = new float[] {diffuseColor.r, diffuseColor.g, diffuseColor.b, diffuseColor.a};//TODO: czy trzeba wstawiac te dane?
mTexs = new ArrayList<Structure>();
@ -161,6 +161,21 @@ public final class MaterialContext {
this.texturesCount = mTexs.size();
this.textureType = firstTextureType;
//veryfying if the transparency is present
//(in blender transparent mask is 0x10000 but its better to verify it because blender can indicate transparency when
//it is not required
boolean transparent = false;
if(diffuseColor != null) {
transparent = diffuseColor.a < 1.0f;
}
if(specularColor != null) {
transparent = transparent || specularColor.a < 1.0f;
}
if(ambientColor != null) {
transparent = transparent || ambientColor.a < 1.0f;
}
this.transparent = transparent;
}
/**

Loading…
Cancel
Save