Skip to content

Commit

Permalink
j3md Fix for default textures (#1052)
Browse files Browse the repository at this point in the history
  • Loading branch information
riccardobl authored and stephengold committed Jul 10, 2019
1 parent 67b3279 commit 37ee57e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 4 additions & 2 deletions jme3-core/src/main/java/com/jme3/material/MaterialDef.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.jme3.texture.Texture;

/**
* Describes a J3MD (Material definition).
Expand Down Expand Up @@ -129,10 +130,11 @@ public void addMaterialParam(VarType type, String name, Object value) {
* @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));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,7 @@ private Texture parseTextureType(final VarType type, final String value) {
for (final TextureOptionValue textureOptionValue : textureOptionValues) {
textureOptionValue.applyToTexture(texture);
}
}

}
return texture;
}

Expand Down Expand Up @@ -404,7 +403,7 @@ private void readParam(String statement) throws IOException{
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);
}
Expand Down

0 comments on commit 37ee57e

Please sign in to comment.