Fix to textures loading (material color should now not interfere with the texture).
git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9179 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
@@ -69,10 +69,10 @@ public final class MaterialContext {
|
||||
diffuseShader = DiffuseShader.values()[diff_shader];
|
||||
|
||||
if(this.shadeless) {
|
||||
float r = ((Number) structure.getFieldValue("r")).floatValue();
|
||||
float g = ((Number) structure.getFieldValue("g")).floatValue();
|
||||
float b = ((Number) structure.getFieldValue("b")).floatValue();
|
||||
float alpha = ((Number) structure.getFieldValue("alpha")).floatValue();
|
||||
float r = ((Number) structure.getFieldValue("r")).floatValue();
|
||||
float g = ((Number) structure.getFieldValue("g")).floatValue();
|
||||
float b = ((Number) structure.getFieldValue("b")).floatValue();
|
||||
float alpha = ((Number) structure.getFieldValue("alpha")).floatValue();
|
||||
|
||||
diffuseColor = new ColorRGBA(r, g, b, alpha);
|
||||
specularShader = null;
|
||||
@@ -95,8 +95,6 @@ public final class MaterialContext {
|
||||
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>();
|
||||
textures = new ArrayList<Structure>();
|
||||
|
||||
@@ -142,6 +140,10 @@ public final class MaterialContext {
|
||||
Map<Number, List<Structure[]>> sortedTextures = this.sortAndFilterTextures();
|
||||
loadedTextures = new HashMap<Number, Texture>(sortedTextures.size());
|
||||
textureToMTexMap = new HashMap<Texture, Structure>();
|
||||
if(sortedTextures.size() > 0) {//texutre covers the material color
|
||||
diffuseColor.set(1, 1, 1, 1);
|
||||
}
|
||||
float[] diffuseColorArray = new float[] {diffuseColor.r, diffuseColor.g, diffuseColor.b, diffuseColor.a};
|
||||
TextureHelper textureHelper = blenderContext.getHelper(TextureHelper.class);
|
||||
for(Entry<Number, List<Structure[]>> entry : sortedTextures.entrySet()) {
|
||||
if(entry.getValue().size()>0) {
|
||||
|
||||
@@ -198,7 +198,7 @@ public class MaterialHelper extends AbstractBlenderHelper {
|
||||
MaterialContext materialContext = new MaterialContext(structure, blenderContext);
|
||||
LOGGER.log(Level.INFO, "Material's name: {0}", materialContext.name);
|
||||
|
||||
if(materialContext.textures.size() > 0) {
|
||||
if(materialContext.textures.size() > 1) {
|
||||
LOGGER.log(Level.WARNING, "Attetion! Many textures found for material: {0}. Only the first of each supported mapping types will be used!", materialContext.name);
|
||||
}
|
||||
|
||||
@@ -241,12 +241,12 @@ public class MaterialHelper extends AbstractBlenderHelper {
|
||||
} else {
|
||||
if (materialContext.shadeless) {
|
||||
result = new Material(blenderContext.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
|
||||
|
||||
if (!materialContext.transparent) {
|
||||
materialContext.diffuseColor.a = 1;
|
||||
}
|
||||
|
||||
result.setColor("Color", materialContext.diffuseColor);
|
||||
|
||||
if (!materialContext.transparent) {
|
||||
materialContext.diffuseColor.a = 1;
|
||||
}
|
||||
|
||||
result.setColor("Color", materialContext.diffuseColor);
|
||||
} else {
|
||||
result = new Material(blenderContext.getAssetManager(), "Common/MatDefs/Light/Lighting.j3md");
|
||||
result.setBoolean("UseMaterialColors", Boolean.TRUE);
|
||||
|
||||
Reference in New Issue
Block a user