com.threerings.opengl.renderer.state
Class MaterialState

java.lang.Object
  extended by com.threerings.opengl.renderer.state.RenderState
      extended by com.threerings.opengl.renderer.state.MaterialState

public class MaterialState
extends RenderState

Contains the material state.


Field Summary
protected  Color4f _backAmbient
          The back ambient color.
protected  Color4f _backDiffuse
          The back diffuse color.
protected  Color4f _backEmission
          The back emissive color.
protected  float _backShininess
          The back shininess.
protected  Color4f _backSpecular
          The back specular color.
protected  int _colorMaterialFace
          The color material face.
protected  int _colorMaterialMode
          The color material mode (or -1 if disabled).
protected  boolean _flatShading
          The flat shading flag.
protected  Color4f _frontAmbient
          The front ambient color.
protected  Color4f _frontDiffuse
          The front diffuse color.
protected  Color4f _frontEmission
          The front emissive color.
protected  float _frontShininess
          The front shininess.
protected  Color4f _frontSpecular
          The front specular color.
protected  boolean _localViewer
          The local viewer flag.
protected  boolean _separateSpecular
          The separate specular flag.
protected  boolean _twoSide
          Whether or not to use two-sided lighting.
static MaterialState DEFAULT
          The default material.
static MaterialState WHITE
          A simple white material.
 
Fields inherited from class com.threerings.opengl.renderer.state.RenderState
_defaults, _dirty, ALPHA_STATE, ARRAY_STATE, COLOR_MASK_STATE, COLOR_STATE, CULL_STATE, DEPTH_STATE, FOG_STATE, LIGHT_STATE, LINE_STATE, MATERIAL_STATE, POINT_STATE, POLYGON_STATE, SHADER_STATE, STATE_COUNT, STENCIL_STATE, TEXTURE_STATE, TRANSFORM_STATE
 
Constructor Summary
MaterialState()
          Creates a new material state.
MaterialState(Color4f frontAmbient, Color4f frontDiffuse, Color4f frontSpecular, Color4f frontEmission, float frontShininess, Color4f backAmbient, Color4f backDiffuse, Color4f backSpecular, Color4f backEmission, float backShininess, int colorMaterialMode, int colorMaterialFace, boolean localViewer, boolean separateSpecular, boolean flatShading)
          Creates a new two-sided material state.
MaterialState(Color4f frontAmbient, Color4f frontDiffuse, Color4f frontSpecular, Color4f frontEmission, float frontShininess, Color4f backAmbient, Color4f backDiffuse, Color4f backSpecular, Color4f backEmission, float backShininess, int colorMaterialMode, int colorMaterialFace, boolean twoSide, boolean localViewer, boolean separateSpecular, boolean flatShading)
          Creates a new material state.
MaterialState(Color4f ambient, Color4f diffuse, Color4f specular, Color4f emission, float shininess, int colorMaterialMode, boolean localViewer, boolean separateSpecular, boolean flatShading)
          Creates a new one-sided material state.
 
Method Summary
 void apply(Renderer renderer)
          Applies this state.
 boolean equals(Object other)
           
 Color4f getBackAmbient()
          Returns a reference to the back ambient color.
 Color4f getBackDiffuse()
          Returns a reference to the back diffuse color.
 Color4f getBackEmission()
          Returns a reference to the back emissive color.
 float getBackShininess()
          Returns the back shininess.
 Color4f getBackSpecular()
          Returns a reference to the back specular color.
 int getColorMaterialFace()
          Returns the color material face.
 int getColorMaterialMode()
          Returns the color material mode (or -1 if disabled).
 boolean getFlatShading()
          Returns whether or not flat shading is enabled.
 Color4f getFrontAmbient()
          Returns a reference to the front ambient color.
 Color4f getFrontDiffuse()
          Returns a reference to the front diffuse color.
 Color4f getFrontEmission()
          Returns a reference to the front emissive color.
 float getFrontShininess()
          Returns the front shininess.
 Color4f getFrontSpecular()
          Returns a reference to the front specular color.
static MaterialState getInstance(Color4f frontAmbient, Color4f frontDiffuse, Color4f frontSpecular, Color4f frontEmission, float frontShininess, Color4f backAmbient, Color4f backDiffuse, Color4f backSpecular, Color4f backEmission, float backShininess, int colorMaterialMode, int colorMaterialFace, boolean localViewer, boolean separateSpecular, boolean flatShading)
          If there is a shared instance with the supplied parameters, returns a reference to it; otherwise, returns a new state with the parameters.
static MaterialState getInstance(Color4f frontAmbient, Color4f frontDiffuse, Color4f frontSpecular, Color4f frontEmission, float frontShininess, Color4f backAmbient, Color4f backDiffuse, Color4f backSpecular, Color4f backEmission, float backShininess, int colorMaterialMode, int colorMaterialFace, boolean twoSide, boolean localViewer, boolean separateSpecular, boolean flatShading)
          If there is a shared instance with the supplied parameters, returns a reference to it; otherwise, returns a new state with the parameters.
static MaterialState getInstance(Color4f ambient, Color4f diffuse, Color4f specular, Color4f emission, float shininess, int colorMaterialMode, boolean localViewer, boolean separateSpecular, boolean flatShading)
          If there is a shared instance with the supplied parameters, returns a reference to it; otherwise, returns a new state with the parameters.
static MaterialState getInstance(MaterialState state)
          If there is a shared equivalent to the specified state, this method will return the shared state; otherwise, it will simply return the parameter.
 boolean getLocalViewer()
          Returns whether or not local viewer mode is enabled.
 boolean getSeparateSpecular()
          Returns whether or not separate specular is enabled.
 boolean getTwoSide()
          Returns whether or not two sided lighting is enabled.
 int getType()
          Returns the type of this state.
 
Methods inherited from class com.threerings.opengl.renderer.state.RenderState
copy, createDefaultSet, createEmptySet, getDefaults, isDirty, setDirty
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT

public static final MaterialState DEFAULT
The default material.


WHITE

public static final MaterialState WHITE
A simple white material.


_frontAmbient

protected Color4f _frontAmbient
The front ambient color.


_frontDiffuse

protected Color4f _frontDiffuse
The front diffuse color.


_frontSpecular

protected Color4f _frontSpecular
The front specular color.


_frontEmission

protected Color4f _frontEmission
The front emissive color.


_frontShininess

protected float _frontShininess
The front shininess.


_backAmbient

protected Color4f _backAmbient
The back ambient color.


_backDiffuse

protected Color4f _backDiffuse
The back diffuse color.


_backSpecular

protected Color4f _backSpecular
The back specular color.


_backEmission

protected Color4f _backEmission
The back emissive color.


_backShininess

protected float _backShininess
The back shininess.


_colorMaterialMode

protected int _colorMaterialMode
The color material mode (or -1 if disabled).


_colorMaterialFace

protected int _colorMaterialFace
The color material face.


_twoSide

protected boolean _twoSide
Whether or not to use two-sided lighting.


_localViewer

protected boolean _localViewer
The local viewer flag.


_separateSpecular

protected boolean _separateSpecular
The separate specular flag.


_flatShading

protected boolean _flatShading
The flat shading flag.

Constructor Detail

MaterialState

public MaterialState(Color4f ambient,
                     Color4f diffuse,
                     Color4f specular,
                     Color4f emission,
                     float shininess,
                     int colorMaterialMode,
                     boolean localViewer,
                     boolean separateSpecular,
                     boolean flatShading)
Creates a new one-sided material state.


MaterialState

public MaterialState(Color4f frontAmbient,
                     Color4f frontDiffuse,
                     Color4f frontSpecular,
                     Color4f frontEmission,
                     float frontShininess,
                     Color4f backAmbient,
                     Color4f backDiffuse,
                     Color4f backSpecular,
                     Color4f backEmission,
                     float backShininess,
                     int colorMaterialMode,
                     int colorMaterialFace,
                     boolean localViewer,
                     boolean separateSpecular,
                     boolean flatShading)
Creates a new two-sided material state.


MaterialState

public MaterialState(Color4f frontAmbient,
                     Color4f frontDiffuse,
                     Color4f frontSpecular,
                     Color4f frontEmission,
                     float frontShininess,
                     Color4f backAmbient,
                     Color4f backDiffuse,
                     Color4f backSpecular,
                     Color4f backEmission,
                     float backShininess,
                     int colorMaterialMode,
                     int colorMaterialFace,
                     boolean twoSide,
                     boolean localViewer,
                     boolean separateSpecular,
                     boolean flatShading)
Creates a new material state.


MaterialState

public MaterialState()
Creates a new material state.

Method Detail

getInstance

public static MaterialState getInstance(Color4f ambient,
                                        Color4f diffuse,
                                        Color4f specular,
                                        Color4f emission,
                                        float shininess,
                                        int colorMaterialMode,
                                        boolean localViewer,
                                        boolean separateSpecular,
                                        boolean flatShading)
If there is a shared instance with the supplied parameters, returns a reference to it; otherwise, returns a new state with the parameters.


getInstance

public static MaterialState getInstance(Color4f frontAmbient,
                                        Color4f frontDiffuse,
                                        Color4f frontSpecular,
                                        Color4f frontEmission,
                                        float frontShininess,
                                        Color4f backAmbient,
                                        Color4f backDiffuse,
                                        Color4f backSpecular,
                                        Color4f backEmission,
                                        float backShininess,
                                        int colorMaterialMode,
                                        int colorMaterialFace,
                                        boolean localViewer,
                                        boolean separateSpecular,
                                        boolean flatShading)
If there is a shared instance with the supplied parameters, returns a reference to it; otherwise, returns a new state with the parameters.


getInstance

public static MaterialState getInstance(Color4f frontAmbient,
                                        Color4f frontDiffuse,
                                        Color4f frontSpecular,
                                        Color4f frontEmission,
                                        float frontShininess,
                                        Color4f backAmbient,
                                        Color4f backDiffuse,
                                        Color4f backSpecular,
                                        Color4f backEmission,
                                        float backShininess,
                                        int colorMaterialMode,
                                        int colorMaterialFace,
                                        boolean twoSide,
                                        boolean localViewer,
                                        boolean separateSpecular,
                                        boolean flatShading)
If there is a shared instance with the supplied parameters, returns a reference to it; otherwise, returns a new state with the parameters.


getInstance

public static MaterialState getInstance(MaterialState state)
If there is a shared equivalent to the specified state, this method will return the shared state; otherwise, it will simply return the parameter.


getFrontAmbient

public Color4f getFrontAmbient()
Returns a reference to the front ambient color.


getFrontDiffuse

public Color4f getFrontDiffuse()
Returns a reference to the front diffuse color.


getFrontSpecular

public Color4f getFrontSpecular()
Returns a reference to the front specular color.


getFrontEmission

public Color4f getFrontEmission()
Returns a reference to the front emissive color.


getFrontShininess

public float getFrontShininess()
Returns the front shininess.


getBackAmbient

public Color4f getBackAmbient()
Returns a reference to the back ambient color.


getBackDiffuse

public Color4f getBackDiffuse()
Returns a reference to the back diffuse color.


getBackSpecular

public Color4f getBackSpecular()
Returns a reference to the back specular color.


getBackEmission

public Color4f getBackEmission()
Returns a reference to the back emissive color.


getBackShininess

public float getBackShininess()
Returns the back shininess.


getColorMaterialMode

public int getColorMaterialMode()
Returns the color material mode (or -1 if disabled).


getColorMaterialFace

public int getColorMaterialFace()
Returns the color material face.


getTwoSide

public boolean getTwoSide()
Returns whether or not two sided lighting is enabled.


getLocalViewer

public boolean getLocalViewer()
Returns whether or not local viewer mode is enabled.


getSeparateSpecular

public boolean getSeparateSpecular()
Returns whether or not separate specular is enabled.


getFlatShading

public boolean getFlatShading()
Returns whether or not flat shading is enabled.


getType

public int getType()
Description copied from class: RenderState
Returns the type of this state.

Specified by:
getType in class RenderState

apply

public void apply(Renderer renderer)
Description copied from class: RenderState
Applies this state.

Specified by:
apply in class RenderState

equals

public boolean equals(Object other)
Overrides:
equals in class Object