j3d.org Aviatrix3D

org.j3d.aviatrix3d
Class Material

java.lang.Object
  extended byorg.j3d.aviatrix3d.SceneGraphObject
      extended byorg.j3d.aviatrix3d.NodeComponent
          extended byorg.j3d.aviatrix3d.Material

public class Material
extends NodeComponent

Describes the material properties of an object.

Version:
$Revision: 1.10 $
Author:
Alan Hudson

Field Summary
 
Fields inherited from class org.j3d.aviatrix3d.NodeComponent
liveCount
 
Fields inherited from class org.j3d.aviatrix3d.SceneGraphObject
alive, updateHandler, WRITE_TIMING_MSG
 
Constructor Summary
Material()
          Constructs a material with default values.
Material(float[] ambientColor, float[] emissiveColor, float[] diffuseColor, float[] specularColor, float shininess, float transparency)
          Create a new material with all the colours specified.
 
Method Summary
 float getTransparency()
          Get the value for the existing transparency values
 boolean isLightingEnabled()
          Get the current lighting enabled flag.
 void renderState(net.java.games.jogl.GL gl, net.java.games.jogl.GLU glu)
          Issue ogl commands needed for this component
 void restoreState(net.java.games.jogl.GL gl, net.java.games.jogl.GLU glu)
          Restore all openGL state to the given drawable
 void setAmbientColor(float[] col)
          Set the ambient color to the new value.
 void setDiffuseColor(float[] col)
          Set the diffuse color to the new value.
 void setEmissiveColor(float[] col)
          Set the emissive color to the new value.
 void setLightingEnabled(boolean state)
          Set the flag that enables or disables lighting on any geometry using this material.
 void setShininess(float s)
          Set the shininess factor.
 void setSpecularColor(float[] col)
          Set the specular color to the new value.
 void setTransparency(float transparency)
          Set the amount of transparency to be used for this material.
 
Methods inherited from class org.j3d.aviatrix3d.NodeComponent
addParent, getParents, hasChanged, numParents, removeParent
 
Methods inherited from class org.j3d.aviatrix3d.SceneGraphObject
checkForCyclicChild, checkForCyclicParent, dataChanged, getUserData, isLive, setLive, setUpdateHandler, setUserData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Material

public Material()
Constructs a material with default values.
 ambient color = (0.2, 0.2, 0.2)
 emisive color = (0.0, 0.0, 0.0)
 diffuse color = (0.8, 0.8, 0.8)
 specular color = (0, 0, 0)
 shininess = 0.2
 transparency = 1
 


Material

public Material(float[] ambientColor,
                float[] emissiveColor,
                float[] diffuseColor,
                float[] specularColor,
                float shininess,
                float transparency)
Create a new material with all the colours specified.

Parameters:
ambientColor -
emissiveColor -
diffuseColor -
specularColor -
shininess - The shininess factor value
transparency - A transparency value between 0 and 1
Method Detail

setShininess

public void setShininess(float s)
                  throws InvalidWriteTimingException
Set the shininess factor.

Parameters:
s - The shininess factor value
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener callback method

setDiffuseColor

public void setDiffuseColor(float[] col)
                     throws InvalidWriteTimingException
Set the diffuse color to the new value.

Parameters:
col - The new colour to use
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener callback method

setSpecularColor

public void setSpecularColor(float[] col)
                      throws InvalidWriteTimingException
Set the specular color to the new value.

Parameters:
col - The new colour to use
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener callback method

setEmissiveColor

public void setEmissiveColor(float[] col)
                      throws InvalidWriteTimingException
Set the emissive color to the new value.

Parameters:
col - The new colour to use
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener callback method

setAmbientColor

public void setAmbientColor(float[] col)
                     throws InvalidWriteTimingException
Set the ambient color to the new value.

Parameters:
col - The new colour to use
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener callback method

setTransparency

public void setTransparency(float transparency)
                     throws InvalidWriteTimingException
Set the amount of transparency to be used for this material.

Parameters:
transparency - A value between 0 and 1
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener callback method

getTransparency

public float getTransparency()
Get the value for the existing transparency values

Returns:
The current transparency setting

setLightingEnabled

public void setLightingEnabled(boolean state)
                        throws InvalidWriteTimingException
Set the flag that enables or disables lighting on any geometry using this material.

Parameters:
state - true if lighting should be used
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener callback method

isLightingEnabled

public boolean isLightingEnabled()
Get the current lighting enabled flag.


renderState

public void renderState(net.java.games.jogl.GL gl,
                        net.java.games.jogl.GLU glu)
Issue ogl commands needed for this component

Overrides:
renderState in class NodeComponent
Parameters:
gl - The gl context to draw with
glu - The utility context to draw with

restoreState

public void restoreState(net.java.games.jogl.GL gl,
                         net.java.games.jogl.GLU glu)
Restore all openGL state to the given drawable

Overrides:
restoreState in class NodeComponent
Parameters:
gl - The gl context to draw with
glu - The utility context to draw with

j3d.org Aviatrix3D

Latest Info from http://aviatrix3d.j3d.org/
Copyright © 2003 - j3d.org