edu.mines.jtk.sgl
Class MaterialState

java.lang.Object
  extended by edu.mines.jtk.sgl.MaterialState
All Implemented Interfaces:
State

public class MaterialState
extends java.lang.Object
implements State

OpenGL material state.

When applied, this state enables GL_LIGHTING, always.

Version:
2005.05.31
Author:
Dave Hale, Colorado School of Mines

Constructor Summary
MaterialState()
          Constructs material state.
 
Method Summary
 void apply()
          Applies this OpenGL state.
 java.awt.Color getAmbientBack()
          Gets the ambient color for back faces.
 java.awt.Color getAmbientFront()
          Gets the ambient color for front faces.
 int getAttributeBits()
          Gets the OpenGL attribute bits for this state.
 int getColorMaterialBack()
          Gets the color material mode for back faces.
 int getColorMaterialFront()
          Gets the color material mode for front faces.
 java.awt.Color getDiffuseBack()
          Gets the diffuse color for back faces.
 java.awt.Color getDiffuseFront()
          Gets the diffuse color for front faces.
 java.awt.Color getEmissiveBack()
          Gets the emissive color for back faces.
 java.awt.Color getEmissiveFront()
          Gets the emissive color for front faces.
 float getShininessBack()
          Gets the shininess for back faces.
 float getShininessFront()
          Gets the shininess for front faces.
 java.awt.Color getSpecularBack()
          Gets the specular color for back faces.
 java.awt.Color getSpecularFront()
          Gets the specular color for front faces.
 boolean hasAmbientBack()
          Determines whether ambient color for back faces is set.
 boolean hasAmbientFront()
          Determines whether ambient color for front faces is set.
 boolean hasColorMaterialBack()
          Determines whether color material mode for back faces is set.
 boolean hasColorMaterialFront()
          Determines whether color material mode for front faces is set.
 boolean hasDiffuseBack()
          Determines whether diffuse color for back faces is set.
 boolean hasDiffuseFront()
          Determines whether diffuse color for front faces is set.
 boolean hasEmissiveBack()
          Determines whether emissive color for back faces is set.
 boolean hasEmissiveFront()
          Determines whether emissive color for front faces is set.
 boolean hasShininessBack()
          Determines whether shininess for back faces is set.
 boolean hasShininessFront()
          Determines whether shininess for front faces is set.
 boolean hasSpecularBack()
          Determines whether specular color for back faces is set.
 boolean hasSpecularFront()
          Determines whether specular color for front faces is set.
 void setAmbient(java.awt.Color ambient)
          Sets the ambient color for front and back faces.
 void setAmbientBack(java.awt.Color ambient)
          Sets the ambient color for back faces.
 void setAmbientFront(java.awt.Color ambient)
          Sets the ambient color for front faces.
 void setColorMaterial(int mode)
          Sets the color material mode for front and back faces.
 void setColorMaterialBack(int mode)
          Sets the color material mode for back faces.
 void setColorMaterialFront(int mode)
          Sets the color material mode for front faces.
 void setDiffuse(java.awt.Color diffuse)
          Sets the diffuse color for front and back faces.
 void setDiffuseBack(java.awt.Color diffuse)
          Sets the diffuse color for back faces.
 void setDiffuseFront(java.awt.Color diffuse)
          Sets the diffuse color for front faces.
 void setEmissive(java.awt.Color emissive)
          Sets the emissive color for front and back faces.
 void setEmissiveBack(java.awt.Color emissive)
          Sets the emissive color for back faces.
 void setEmissiveFront(java.awt.Color emissive)
          Sets the emissive color for front faces.
 void setShininess(float shininess)
          Sets the shininess for front and back faces.
 void setShininessBack(float shininess)
          Sets the shininess for back faces.
 void setShininessFront(float shininess)
          Sets the shininess for front faces.
 void setSpecular(java.awt.Color specular)
          Sets the specular color for front and back faces.
 void setSpecularBack(java.awt.Color specular)
          Sets the specular color for back faces.
 void setSpecularFront(java.awt.Color specular)
          Sets the specular color for front faces.
 void unsetAmbient()
          Unsets the ambient color for front and back faces.
 void unsetAmbientBack()
          Unsets the ambient color for back faces.
 void unsetAmbientFront()
          Unsets the ambient color for front faces.
 void unsetColorMaterial()
          Unsets the color material mode for front and back faces.
 void unsetColorMaterialBack()
          Unsets the color material mode for back faces.
 void unsetColorMaterialFront()
          Unsets the color material mode for front faces.
 void unsetDiffuse()
          Unsets the diffuse color for front and back faces.
 void unsetDiffuseBack()
          Unsets the diffuse color for back faces.
 void unsetDiffuseFront()
          Unsets the diffuse color for front faces.
 void unsetEmissive()
          Unsets the emissive color for front and back faces.
 void unsetEmissiveBack()
          Unsets the emissive color for back faces.
 void unsetEmissiveFront()
          Unsets the emissive color for front faces.
 void unsetShininess()
          Unsets the shininess for front and back faces.
 void unsetShininessBack()
          Unsets the shininess for back faces.
 void unsetShininessFront()
          Unsets the shininess for front faces.
 void unsetSpecular()
          Unsets the specular color for front and back faces.
 void unsetSpecularBack()
          Unsets the specular color for back faces.
 void unsetSpecularFront()
          Unsets the specular color for front faces.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MaterialState

public MaterialState()
Constructs material state.

Method Detail

hasAmbientFront

public boolean hasAmbientFront()
Determines whether ambient color for front faces is set.

Returns:
true, if set; false, otherwise.

hasAmbientBack

public boolean hasAmbientBack()
Determines whether ambient color for back faces is set.

Returns:
true, if set; false, otherwise.

getAmbientFront

public java.awt.Color getAmbientFront()
Gets the ambient color for front faces.

Returns:
the ambient color.

getAmbientBack

public java.awt.Color getAmbientBack()
Gets the ambient color for back faces.

Returns:
the ambient color.

setAmbient

public void setAmbient(java.awt.Color ambient)
Sets the ambient color for front and back faces.

Parameters:
ambient - the ambient color.

setAmbientFront

public void setAmbientFront(java.awt.Color ambient)
Sets the ambient color for front faces.

Parameters:
ambient - the ambient color.

setAmbientBack

public void setAmbientBack(java.awt.Color ambient)
Sets the ambient color for back faces.

Parameters:
ambient - the ambient color.

unsetAmbient

public void unsetAmbient()
Unsets the ambient color for front and back faces.


unsetAmbientFront

public void unsetAmbientFront()
Unsets the ambient color for front faces.


unsetAmbientBack

public void unsetAmbientBack()
Unsets the ambient color for back faces.


hasDiffuseFront

public boolean hasDiffuseFront()
Determines whether diffuse color for front faces is set.

Returns:
true, if set; false, otherwise.

hasDiffuseBack

public boolean hasDiffuseBack()
Determines whether diffuse color for back faces is set.

Returns:
true, if set; false, otherwise.

getDiffuseFront

public java.awt.Color getDiffuseFront()
Gets the diffuse color for front faces.

Returns:
the diffuse color.

getDiffuseBack

public java.awt.Color getDiffuseBack()
Gets the diffuse color for back faces.

Returns:
the diffuse color.

setDiffuse

public void setDiffuse(java.awt.Color diffuse)
Sets the diffuse color for front and back faces.

Parameters:
diffuse - the diffuse color.

setDiffuseFront

public void setDiffuseFront(java.awt.Color diffuse)
Sets the diffuse color for front faces.

Parameters:
diffuse - the diffuse color.

setDiffuseBack

public void setDiffuseBack(java.awt.Color diffuse)
Sets the diffuse color for back faces.

Parameters:
diffuse - the diffuse color.

unsetDiffuse

public void unsetDiffuse()
Unsets the diffuse color for front and back faces.


unsetDiffuseFront

public void unsetDiffuseFront()
Unsets the diffuse color for front faces.


unsetDiffuseBack

public void unsetDiffuseBack()
Unsets the diffuse color for back faces.


hasSpecularFront

public boolean hasSpecularFront()
Determines whether specular color for front faces is set.

Returns:
true, if set; false, otherwise.

hasSpecularBack

public boolean hasSpecularBack()
Determines whether specular color for back faces is set.

Returns:
true, if set; false, otherwise.

getSpecularFront

public java.awt.Color getSpecularFront()
Gets the specular color for front faces.

Returns:
the specular color.

getSpecularBack

public java.awt.Color getSpecularBack()
Gets the specular color for back faces.

Returns:
the specular color.

setSpecular

public void setSpecular(java.awt.Color specular)
Sets the specular color for front and back faces.

Parameters:
specular - the specular color.

setSpecularFront

public void setSpecularFront(java.awt.Color specular)
Sets the specular color for front faces.

Parameters:
specular - the specular color.

setSpecularBack

public void setSpecularBack(java.awt.Color specular)
Sets the specular color for back faces.

Parameters:
specular - the specular color.

unsetSpecular

public void unsetSpecular()
Unsets the specular color for front and back faces.


unsetSpecularFront

public void unsetSpecularFront()
Unsets the specular color for front faces.


unsetSpecularBack

public void unsetSpecularBack()
Unsets the specular color for back faces.


hasEmissiveFront

public boolean hasEmissiveFront()
Determines whether emissive color for front faces is set.

Returns:
true, if set; false, otherwise.

hasEmissiveBack

public boolean hasEmissiveBack()
Determines whether emissive color for back faces is set.

Returns:
true, if set; false, otherwise.

getEmissiveFront

public java.awt.Color getEmissiveFront()
Gets the emissive color for front faces.

Returns:
the emissive color.

getEmissiveBack

public java.awt.Color getEmissiveBack()
Gets the emissive color for back faces.

Returns:
the emissive color.

setEmissive

public void setEmissive(java.awt.Color emissive)
Sets the emissive color for front and back faces.

Parameters:
emissive - the emissive color.

setEmissiveFront

public void setEmissiveFront(java.awt.Color emissive)
Sets the emissive color for front faces.

Parameters:
emissive - the emissive color.

setEmissiveBack

public void setEmissiveBack(java.awt.Color emissive)
Sets the emissive color for back faces.

Parameters:
emissive - the emissive color.

unsetEmissive

public void unsetEmissive()
Unsets the emissive color for front and back faces.


unsetEmissiveFront

public void unsetEmissiveFront()
Unsets the emissive color for front faces.


unsetEmissiveBack

public void unsetEmissiveBack()
Unsets the emissive color for back faces.


hasShininessFront

public boolean hasShininessFront()
Determines whether shininess for front faces is set.

Returns:
true, if set; false, otherwise.

hasShininessBack

public boolean hasShininessBack()
Determines whether shininess for back faces is set.

Returns:
true, if set; false, otherwise.

getShininessFront

public float getShininessFront()
Gets the shininess for front faces.

Returns:
the shininess.

getShininessBack

public float getShininessBack()
Gets the shininess for back faces.

Returns:
the shininess.

setShininess

public void setShininess(float shininess)
Sets the shininess for front and back faces.

Parameters:
shininess - the shininess.

setShininessFront

public void setShininessFront(float shininess)
Sets the shininess for front faces.

Parameters:
shininess - the shininess.

setShininessBack

public void setShininessBack(float shininess)
Sets the shininess for back faces.

Parameters:
shininess - the shininess.

unsetShininess

public void unsetShininess()
Unsets the shininess for front and back faces.


unsetShininessFront

public void unsetShininessFront()
Unsets the shininess for front faces.


unsetShininessBack

public void unsetShininessBack()
Unsets the shininess for back faces.


hasColorMaterialFront

public boolean hasColorMaterialFront()
Determines whether color material mode for front faces is set.

Returns:
true, if set; false, otherwise.

hasColorMaterialBack

public boolean hasColorMaterialBack()
Determines whether color material mode for back faces is set.

Returns:
true, if set; false, otherwise.

getColorMaterialFront

public int getColorMaterialFront()
Gets the color material mode for front faces.

Returns:
the color material mode.

getColorMaterialBack

public int getColorMaterialBack()
Gets the color material mode for back faces.

Returns:
the color material mode.

setColorMaterial

public void setColorMaterial(int mode)
Sets the color material mode for front and back faces.

Parameters:
mode - the color material mode.

setColorMaterialFront

public void setColorMaterialFront(int mode)
Sets the color material mode for front faces.

Parameters:
mode - the color material mode.

setColorMaterialBack

public void setColorMaterialBack(int mode)
Sets the color material mode for back faces.

Parameters:
mode - the color material mode.

unsetColorMaterial

public void unsetColorMaterial()
Unsets the color material mode for front and back faces.


unsetColorMaterialFront

public void unsetColorMaterialFront()
Unsets the color material mode for front faces.


unsetColorMaterialBack

public void unsetColorMaterialBack()
Unsets the color material mode for back faces.


apply

public void apply()
Description copied from interface: State
Applies this OpenGL state. This method makes OpenGL state consistent with any attribute fields in this state that are currently set.

Specified by:
apply in interface State

getAttributeBits

public int getAttributeBits()
Description copied from interface: State
Gets the OpenGL attribute bits for this state. These bits indicate what OpenGL state is changed by the method State.apply(). If these bits are passed to glPushAttrib before calling State.apply(), then glPopAttrib will restore any OpenGL state that is changed by that method.

Specified by:
getAttributeBits in interface State