Bugfix: fixes to specular shininess loading.

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10763 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
experimental
Kae..pl 12 years ago
parent b4dfd528ee
commit 1b17c4fd04
  1. 9
      engine/src/blender/com/jme3/scene/plugins/blender/materials/MaterialContext.java

@ -91,15 +91,14 @@ public final class MaterialContext {
int spec_shader = ((Number) structure.getFieldValue("spec_shader")).intValue(); int spec_shader = ((Number) structure.getFieldValue("spec_shader")).intValue();
specularShader = SpecularShader.values()[spec_shader]; specularShader = SpecularShader.values()[spec_shader];
specularColor = this.readSpecularColor(structure, specularShader); specularColor = this.readSpecularColor(structure, specularShader);
float shininess = ((Number) structure.getFieldValue("har")).floatValue();//this is (probably) the specular hardness in blender
this.shininess = shininess > 0.0f ? shininess : MaterialHelper.DEFAULT_SHININESS;
float r = ((Number) structure.getFieldValue("ambr")).floatValue(); float r = ((Number) structure.getFieldValue("ambr")).floatValue();
float g = ((Number) structure.getFieldValue("ambg")).floatValue(); float g = ((Number) structure.getFieldValue("ambg")).floatValue();
float b = ((Number) structure.getFieldValue("ambb")).floatValue(); float b = ((Number) structure.getFieldValue("ambb")).floatValue();
float alpha = ((Number) structure.getFieldValue("alpha")).floatValue(); float alpha = ((Number) structure.getFieldValue("alpha")).floatValue();
ambientColor = new ColorRGBA(r, g, b, alpha); ambientColor = new ColorRGBA(r, g, b, alpha);
float shininess = ((Number) structure.getFieldValue("emit")).floatValue();
this.shininess = shininess > 0.0f ? shininess : MaterialHelper.DEFAULT_SHININESS;
} }
DynamicArray<Pointer> mtexsArray = (DynamicArray<Pointer>) structure.getFieldValue("mtex"); DynamicArray<Pointer> mtexsArray = (DynamicArray<Pointer>) structure.getFieldValue("mtex");
@ -207,9 +206,9 @@ public final class MaterialContext {
material.setBoolean("WardIso", specularShader == SpecularShader.WARDISO); material.setBoolean("WardIso", specularShader == SpecularShader.WARDISO);
material.setColor("Specular", specularColor); material.setColor("Specular", specularColor);
material.setFloat("Shininess", shininess);
material.setColor("Ambient", ambientColor); material.setColor("Ambient", ambientColor);
material.setFloat("Shininess", shininess);
} }
// applying textures // applying textures

Loading…
Cancel
Save