Package com.ardor3d.renderer.state
Class MaterialState
java.lang.Object
com.ardor3d.renderer.state.RenderState
com.ardor3d.renderer.state.MaterialState
- All Implemented Interfaces:
Savable
MaterialState defines parameters used in conjunction with the lighting model to produce a surface color. Please note
therefore that this state has no effect if lighting is disabled. It is also worth noting that material properties set
for Front face will in fact affect both front and back unless two sided lighting is enabled.
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
static enum
Nested classes/interfaces inherited from class com.ardor3d.renderer.state.RenderState
RenderState.StateStack, RenderState.StateType
-
Field Summary
Modifier and TypeFieldDescriptionprotected final ColorRGBA
protected final ColorRGBA
protected final ColorRGBA
protected float
protected final ColorRGBA
protected MaterialState.ColorMaterial
protected MaterialState.MaterialFace
protected final ColorRGBA
protected final ColorRGBA
protected final ColorRGBA
protected float
protected final ColorRGBA
static final ReadOnlyColorRGBA
Default ambient color for all material states. (.2, .2, .2, 1)static final MaterialState.ColorMaterial
Default color material mode for all material states.static final MaterialState.MaterialFace
Default color material face for all material states.static final ReadOnlyColorRGBA
Default diffuse color for all material states. (.8, .8, .8, 1)static final ReadOnlyColorRGBA
Default emissive color for all material states. (0, 0, 0, 1)static final float
Default shininess for all material states.static final ReadOnlyColorRGBA
Default specular color for all material states. (0, 0, 0, 1)Fields inherited from class com.ardor3d.renderer.state.RenderState
_quickCompare
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfloat
float
getType()
void
read
(InputCapsule capsule) void
setAmbient
(ReadOnlyColorRGBA ambient) Sets the ambient color for front and back to the given value.void
setAmbient
(MaterialState.MaterialFace face, ReadOnlyColorRGBA ambient) void
setColorMaterial
(MaterialState.ColorMaterial material) void
void
setDiffuse
(ReadOnlyColorRGBA diffuse) Sets the diffuse color for front and back to the given value.void
setDiffuse
(MaterialState.MaterialFace face, ReadOnlyColorRGBA diffuse) void
setEmissive
(ReadOnlyColorRGBA emissive) Sets the emissive color for front and back to the given value.void
setEmissive
(MaterialState.MaterialFace face, ReadOnlyColorRGBA emissive) void
setShininess
(float shininess) Sets the shininess value for front and back to the given value.void
setShininess
(MaterialState.MaterialFace face, float shininess) void
setSpecular
(ReadOnlyColorRGBA specular) Sets the specular color for front and back to the given value.void
setSpecular
(MaterialState.MaterialFace face, ReadOnlyColorRGBA specular) void
write
(OutputCapsule capsule) Methods inherited from class com.ardor3d.renderer.state.RenderState
createState, extract, getClassTag, isEnabled, needsRefresh, setEnabled, setNeedsRefresh, setQuickCompares
-
Field Details
-
DEFAULT_AMBIENT
Default ambient color for all material states. (.2, .2, .2, 1) -
DEFAULT_DIFFUSE
Default diffuse color for all material states. (.8, .8, .8, 1) -
DEFAULT_SPECULAR
Default specular color for all material states. (0, 0, 0, 1) -
DEFAULT_EMISSIVE
Default emissive color for all material states. (0, 0, 0, 1) -
DEFAULT_SHININESS
public static final float DEFAULT_SHININESSDefault shininess for all material states.- See Also:
-
DEFAULT_COLOR_MATERIAL
Default color material mode for all material states. -
DEFAULT_COLOR_MATERIAL_FACE
Default color material face for all material states. -
_frontAmbient
-
_frontDiffuse
-
_frontSpecular
-
_frontEmissive
-
_frontShininess
protected float _frontShininess -
_backAmbient
-
_backDiffuse
-
_backSpecular
-
_backEmissive
-
_backShininess
protected float _backShininess -
_colorMaterial
-
_colorMaterialFace
-
-
Constructor Details
-
MaterialState
public MaterialState()Constructor instantiates a newMaterialState
object.
-
-
Method Details
-
getAmbient
- Returns:
- the ambient color (or front face color, if two sided lighting is used) of this material.
-
getBackAmbient
- Returns:
- the ambient back face color of this material. This is only used if two sided lighting is used.
-
setAmbient
Sets the ambient color for front and back to the given value.- Parameters:
ambient
- the new ambient color
-
setAmbient
- Parameters:
face
- the face to apply the ambient color toambient
- the new ambient color
-
getDiffuse
- Returns:
- the diffuse color (or front face color, if two sided lighting is used) of this material.
-
getBackDiffuse
- Returns:
- the diffuse back face color of this material. This is only used if two sided lighting is used.
-
setDiffuse
Sets the diffuse color for front and back to the given value.- Parameters:
diffuse
- the new diffuse color
-
setDiffuse
- Parameters:
face
- the face to apply the diffuse color todiffuse
- the new diffuse color
-
getEmissive
- Returns:
- the emissive color (or front face color, if two sided lighting is used) of this material.
-
getBackEmissive
- Returns:
- the emissive back face color of this material. This is only used if two sided lighting is used.
-
setEmissive
Sets the emissive color for front and back to the given value.- Parameters:
emissive
- the new emissive color
-
setEmissive
- Parameters:
face
- the face to apply the emissive color toemissive
- the new emissive color
-
getSpecular
- Returns:
- the specular color (or front face color, if two sided lighting is used) of this material.
-
getBackSpecular
- Returns:
- the specular back face color of this material. This is only used if two sided lighting is used.
-
setSpecular
Sets the specular color for front and back to the given value.- Parameters:
specular
- the new specular color
-
setSpecular
- Parameters:
face
- the face to apply the specular color tospecular
- the new specular color
-
getShininess
public float getShininess()- Returns:
- the shininess value (or front face shininess value, if two sided lighting is used) of the material.
-
getBackShininess
public float getBackShininess()- Returns:
- the shininess value of the back face of this material. This is only used if two sided lighting is used.
-
setShininess
public void setShininess(float shininess) Sets the shininess value for front and back to the given value.- Parameters:
shininess
- the new shininess for this material. Must be between 0 and 128. Higher numbers result in "tighter" specular reflections.
-
setShininess
- Parameters:
face
- the face to apply the shininess color toshininess
- the new shininess for this material. Must be between 0 and 128. Higher numbers result in "tighter" specular reflections.
-
getColorMaterial
- Returns:
- the color material mode of this material, which determines how geometry colors affect the material.
- See Also:
-
setColorMaterial
- Parameters:
material
- the new color material mode- Throws:
IllegalArgumentException
- if material is null
-
getColorMaterialFace
- Returns:
- the color material face of this material, which determines how geometry colors affect the material.
- See Also:
-
setColorMaterialFace
- Parameters:
face
- the new color material face- Throws:
IllegalArgumentException
- if face is null
-
getType
- Specified by:
getType
in classRenderState
- Returns:
- An statetype enum value for the subclass.
- See Also:
-
write
- Specified by:
write
in interfaceSavable
- Overrides:
write
in classRenderState
- Throws:
IOException
-
read
- Specified by:
read
in interfaceSavable
- Overrides:
read
in classRenderState
- Throws:
IOException
-
createStateRecord
- Specified by:
createStateRecord
in classRenderState
-