Skip to content

Commit cf7b15b

Browse files
riccardoblstephengold
authored andcommitted
j3md Fix for default textures (#1052)
1 parent 1ad324a commit cf7b15b

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

jme3-core/src/main/java/com/jme3/material/MaterialDef.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
import java.util.*;
3939
import java.util.logging.Level;
4040
import java.util.logging.Logger;
41+
import com.jme3.texture.Texture;
4142

4243
/**
4344
* Describes a J3MD (Material definition).
@@ -129,10 +130,11 @@ public void addMaterialParam(VarType type, String name, Object value) {
129130
* @param type Type of the parameter
130131
* @param name Name of the parameter
131132
* @param colorSpace the color space of the texture required by this texture param
133+
* @param value Default value of the parameter
132134
* @see ColorSpace
133135
*/
134-
public void addMaterialParamTexture(VarType type, String name, ColorSpace colorSpace) {
135-
matParams.put(name, new MatParamTexture(type, name, null, colorSpace));
136+
public void addMaterialParamTexture(VarType type, String name, ColorSpace colorSpace,Texture value) {
137+
matParams.put(name, new MatParamTexture(type, name, value, colorSpace));
136138
}
137139

138140
/**

jme3-core/src/plugins/java/com/jme3/material/plugins/J3MLoader.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -295,8 +295,7 @@ private Texture parseTextureType(final VarType type, final String value) {
295295
for (final TextureOptionValue textureOptionValue : textureOptionValues) {
296296
textureOptionValue.applyToTexture(texture);
297297
}
298-
}
299-
298+
}
300299
return texture;
301300
}
302301

@@ -402,7 +401,7 @@ private void readParam(String statement) throws IOException{
402401
defaultValObj = readValue(type, defaultVal);
403402
}
404403
if(type.isTextureType()){
405-
materialDef.addMaterialParamTexture(type, name, colorSpace);
404+
materialDef.addMaterialParamTexture(type, name, colorSpace,(Texture)defaultValObj);
406405
}else{
407406
materialDef.addMaterialParam(type, name, defaultValObj);
408407
}

0 commit comments

Comments
 (0)