|
|
@ -32,6 +32,7 @@ |
|
|
|
package com.jme3.material; |
|
|
|
package com.jme3.material; |
|
|
|
|
|
|
|
|
|
|
|
import com.jme3.asset.AssetManager; |
|
|
|
import com.jme3.asset.AssetManager; |
|
|
|
|
|
|
|
import com.jme3.renderer.Caps; |
|
|
|
import com.jme3.shader.VarType; |
|
|
|
import com.jme3.shader.VarType; |
|
|
|
import com.jme3.texture.image.ColorSpace; |
|
|
|
import com.jme3.texture.image.ColorSpace; |
|
|
|
import java.util.*; |
|
|
|
import java.util.*; |
|
|
@ -51,8 +52,7 @@ public class MaterialDef { |
|
|
|
private String assetName; |
|
|
|
private String assetName; |
|
|
|
private AssetManager assetManager; |
|
|
|
private AssetManager assetManager; |
|
|
|
|
|
|
|
|
|
|
|
private List<TechniqueDef> defaultTechs; |
|
|
|
private Map<String, List<TechniqueDef>> techniques; |
|
|
|
private Map<String, TechniqueDef> techniques; |
|
|
|
|
|
|
|
private Map<String, MatParam> matParams; |
|
|
|
private Map<String, MatParam> matParams; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -70,9 +70,8 @@ public class MaterialDef { |
|
|
|
public MaterialDef(AssetManager assetManager, String name){ |
|
|
|
public MaterialDef(AssetManager assetManager, String name){ |
|
|
|
this.assetManager = assetManager; |
|
|
|
this.assetManager = assetManager; |
|
|
|
this.name = name; |
|
|
|
this.name = name; |
|
|
|
techniques = new HashMap<String, TechniqueDef>(); |
|
|
|
techniques = new HashMap<String, List<TechniqueDef>>(); |
|
|
|
matParams = new HashMap<String, MatParam>(); |
|
|
|
matParams = new HashMap<String, MatParam>(); |
|
|
|
defaultTechs = new ArrayList<TechniqueDef>(); |
|
|
|
|
|
|
|
logger.log(Level.FINE, "Loaded material definition: {0}", name); |
|
|
|
logger.log(Level.FINE, "Loaded material definition: {0}", name); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -164,40 +163,26 @@ public class MaterialDef { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Adds a new technique definition to this material definition. |
|
|
|
* Adds a new technique definition to this material definition. |
|
|
|
* <p> |
|
|
|
* |
|
|
|
* If the technique name is "Default", it will be added |
|
|
|
|
|
|
|
* to the list of {@link MaterialDef#getDefaultTechniques() default techniques}. |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param technique The technique definition to add. |
|
|
|
* @param technique The technique definition to add. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void addTechniqueDef(TechniqueDef technique) { |
|
|
|
public void addTechniqueDef(TechniqueDef technique) { |
|
|
|
if (technique.getName().equals("Default")) { |
|
|
|
List<TechniqueDef> list = techniques.get(technique.getName()); |
|
|
|
defaultTechs.add(technique); |
|
|
|
if (list == null) { |
|
|
|
} else { |
|
|
|
list = new ArrayList<>(); |
|
|
|
techniques.put(technique.getName(), technique); |
|
|
|
techniques.put(technique.getName(), list); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
list.add(technique); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Returns a list of all default techniques. |
|
|
|
* Returns technique definitions with the given name. |
|
|
|
* |
|
|
|
* |
|
|
|
* @return a list of all default techniques. |
|
|
|
* @param name The name of the technique definitions to find |
|
|
|
*/ |
|
|
|
* |
|
|
|
public List<TechniqueDef> getDefaultTechniques(){ |
|
|
|
* @return The technique definitions, or null if cannot be found. |
|
|
|
return defaultTechs; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Returns a technique definition with the given name. |
|
|
|
|
|
|
|
* This does not include default techniques which can be |
|
|
|
|
|
|
|
* retrieved via {@link MaterialDef#getDefaultTechniques() }. |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param name The name of the technique definition to find |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @return The technique definition, or null if cannot be found. |
|
|
|
|
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public TechniqueDef getTechniqueDef(String name) { |
|
|
|
public List<TechniqueDef> getTechniqueDefs(String name) { |
|
|
|
return techniques.get(name); |
|
|
|
return techniques.get(name); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|