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
static MaterialState DEFAULT
          The default material.
static MaterialState WHITE
          A simple white material.
 
Fields inherited from class com.threerings.opengl.renderer.state.RenderState
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
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.

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


Copyright © 2011. All Rights Reserved.