Skip to content

Commit 37ee57e

Browse files
riccardoblstephengold
authored andcommitted
j3md Fix for default textures (#1052)
1 parent 67b3279 commit 37ee57e

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
@@ -297,8 +297,7 @@ private Texture parseTextureType(final VarType type, final String value) {
297297
for (final TextureOptionValue textureOptionValue : textureOptionValues) {
298298
textureOptionValue.applyToTexture(texture);
299299
}
300-
}
301-
300+
}
302301
return texture;
303302
}
304303

@@ -404,7 +403,7 @@ private void readParam(String statement) throws IOException{
404403
defaultValObj = readValue(type, defaultVal);
405404
}
406405
if(type.isTextureType()){
407-
materialDef.addMaterialParamTexture(type, name, colorSpace);
406+
materialDef.addMaterialParamTexture(type, name, colorSpace,(Texture)defaultValObj);
408407
}else{
409408
materialDef.addMaterialParam(type, name, defaultValObj);
410409
}

0 commit comments

Comments
 (0)