j3md Fix for default textures (#1052)

accellbaker
Riccardo Balbo 6 years ago committed by Stephen Gold
parent 1ad324aa57
commit cf7b15bc23
  1. 6
      jme3-core/src/main/java/com/jme3/material/MaterialDef.java
  2. 5
      jme3-core/src/plugins/java/com/jme3/material/plugins/J3MLoader.java

@ -38,6 +38,7 @@ import com.jme3.texture.image.ColorSpace;
import java.util.*; import java.util.*;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import com.jme3.texture.Texture;
/** /**
* Describes a J3MD (Material definition). * Describes a J3MD (Material definition).
@ -129,10 +130,11 @@ public class MaterialDef{
* @param type Type of the parameter * @param type Type of the parameter
* @param name Name of the parameter * @param name Name of the parameter
* @param colorSpace the color space of the texture required by this texture param * @param colorSpace the color space of the texture required by this texture param
* @param value Default value of the parameter
* @see ColorSpace * @see ColorSpace
*/ */
public void addMaterialParamTexture(VarType type, String name, ColorSpace colorSpace) { public void addMaterialParamTexture(VarType type, String name, ColorSpace colorSpace,Texture value) {
matParams.put(name, new MatParamTexture(type, name, null, colorSpace)); matParams.put(name, new MatParamTexture(type, name, value, colorSpace));
} }
/** /**

@ -295,8 +295,7 @@ public class J3MLoader implements AssetLoader {
for (final TextureOptionValue textureOptionValue : textureOptionValues) { for (final TextureOptionValue textureOptionValue : textureOptionValues) {
textureOptionValue.applyToTexture(texture); textureOptionValue.applyToTexture(texture);
} }
} }
return texture; return texture;
} }
@ -402,7 +401,7 @@ public class J3MLoader implements AssetLoader {
defaultValObj = readValue(type, defaultVal); defaultValObj = readValue(type, defaultVal);
} }
if(type.isTextureType()){ if(type.isTextureType()){
materialDef.addMaterialParamTexture(type, name, colorSpace); materialDef.addMaterialParamTexture(type, name, colorSpace,(Texture)defaultValObj);
}else{ }else{
materialDef.addMaterialParam(type, name, defaultValObj); materialDef.addMaterialParam(type, name, defaultValObj);
} }

Loading…
Cancel
Save