From cf7b15bc235b164f5ad25622ab7c8264d7ed46d0 Mon Sep 17 00:00:00 2001 From: Riccardo Balbo Date: Wed, 27 Mar 2019 18:19:37 +0100 Subject: [PATCH] j3md Fix for default textures (#1052) --- jme3-core/src/main/java/com/jme3/material/MaterialDef.java | 6 ++++-- .../plugins/java/com/jme3/material/plugins/J3MLoader.java | 5 ++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/jme3-core/src/main/java/com/jme3/material/MaterialDef.java b/jme3-core/src/main/java/com/jme3/material/MaterialDef.java index 66c615a68..59e84db62 100644 --- a/jme3-core/src/main/java/com/jme3/material/MaterialDef.java +++ b/jme3-core/src/main/java/com/jme3/material/MaterialDef.java @@ -38,6 +38,7 @@ import com.jme3.texture.image.ColorSpace; import java.util.*; import java.util.logging.Level; import java.util.logging.Logger; +import com.jme3.texture.Texture; /** * Describes a J3MD (Material definition). @@ -129,10 +130,11 @@ public class MaterialDef{ * @param type Type of the parameter * @param name Name of the parameter * @param colorSpace the color space of the texture required by this texture param + * @param value Default value of the parameter * @see ColorSpace */ - public void addMaterialParamTexture(VarType type, String name, ColorSpace colorSpace) { - matParams.put(name, new MatParamTexture(type, name, null, colorSpace)); + public void addMaterialParamTexture(VarType type, String name, ColorSpace colorSpace,Texture value) { + matParams.put(name, new MatParamTexture(type, name, value, colorSpace)); } /** diff --git a/jme3-core/src/plugins/java/com/jme3/material/plugins/J3MLoader.java b/jme3-core/src/plugins/java/com/jme3/material/plugins/J3MLoader.java index 1afa6e3a7..88674fdff 100644 --- a/jme3-core/src/plugins/java/com/jme3/material/plugins/J3MLoader.java +++ b/jme3-core/src/plugins/java/com/jme3/material/plugins/J3MLoader.java @@ -295,8 +295,7 @@ public class J3MLoader implements AssetLoader { for (final TextureOptionValue textureOptionValue : textureOptionValues) { textureOptionValue.applyToTexture(texture); } - } - + } return texture; } @@ -402,7 +401,7 @@ public class J3MLoader implements AssetLoader { defaultValObj = readValue(type, defaultVal); } if(type.isTextureType()){ - materialDef.addMaterialParamTexture(type, name, colorSpace); + materialDef.addMaterialParamTexture(type, name, colorSpace,(Texture)defaultValObj); }else{ materialDef.addMaterialParam(type, name, defaultValObj); }