com.jme3.material
Class MaterialDef

java.lang.Object
  extended by com.jme3.material.MaterialDef

public class MaterialDef
extends java.lang.Object

Describes a J3MD (Material definition).


Constructor Summary
MaterialDef()
          Serialization only.
MaterialDef(AssetManager assetManager, java.lang.String name)
          Creates a new material definition with the given name.
 
Method Summary
 void addMaterialParam(VarType type, java.lang.String name, java.lang.Object value, FixedFuncBinding ffBinding)
          Adds a new material parameter.
 void addTechniqueDef(TechniqueDef technique)
          Adds a new technique definition to this material definition.
 AssetManager getAssetManager()
          Returns the AssetManager passed in the constructor.
 java.lang.String getAssetName()
          Returns the asset key name of the asset from which this material definition was loaded.
 java.util.List<TechniqueDef> getDefaultTechniques()
          Returns a list of all default techniques.
 MatParam getMaterialParam(java.lang.String name)
          Returns the material parameter with the given name.
 java.util.Collection<MatParam> getMaterialParams()
          Returns a collection of all material parameters declared in this material definition.
 java.lang.String getName()
          The debug name of the material definition.
 TechniqueDef getTechniqueDef(java.lang.String name)
          Returns a technique definition with the given name.
 void setAssetName(java.lang.String assetName)
          Set the asset key name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MaterialDef

public MaterialDef()
Serialization only. Do not use.


MaterialDef

public MaterialDef(AssetManager assetManager,
                   java.lang.String name)
Creates a new material definition with the given name.

Parameters:
assetManager - The asset manager to use to load shaders
name - The debug name of the material definition
Method Detail

getAssetName

public java.lang.String getAssetName()
Returns the asset key name of the asset from which this material definition was loaded.

Returns:
Asset key name of the j3md file

setAssetName

public void setAssetName(java.lang.String assetName)
Set the asset key name.

Parameters:
assetName - the asset key name

getAssetManager

public AssetManager getAssetManager()
Returns the AssetManager passed in the constructor.

Returns:
the AssetManager passed in the constructor.

getName

public java.lang.String getName()
The debug name of the material definition.

Returns:
debug name of the material definition.

addMaterialParam

public void addMaterialParam(VarType type,
                             java.lang.String name,
                             java.lang.Object value,
                             FixedFuncBinding ffBinding)
Adds a new material parameter.

Parameters:
type - Type of the parameter
name - Name of the parameter
value - Default value of the parameter
ffBinding - Fixed function binding for the parameter

getMaterialParam

public MatParam getMaterialParam(java.lang.String name)
Returns the material parameter with the given name.

Parameters:
name - The name of the parameter to retrieve
Returns:
The material parameter, or null if it does not exist.

getMaterialParams

public java.util.Collection<MatParam> getMaterialParams()
Returns a collection of all material parameters declared in this material definition.

Modifying the material parameters or the collection will lead to undefined results.

Returns:
All material parameters declared in this definition.

addTechniqueDef

public void addTechniqueDef(TechniqueDef technique)
Adds a new technique definition to this material definition.

If the technique name is "Default", it will be added to the list of default techniques.

Parameters:
technique - The technique definition to add.

getDefaultTechniques

public java.util.List<TechniqueDef> getDefaultTechniques()
Returns a list of all default techniques.

Returns:
a list of all default techniques.

getTechniqueDef

public TechniqueDef getTechniqueDef(java.lang.String name)
Returns a technique definition with the given name. This does not include default techniques which can be retrieved via getDefaultTechniques().

Parameters:
name - The name of the technique definition to find
Returns:
The technique definition, or null if cannot be found.