j3d.org Aviatrix3D

org.j3d.aviatrix3d
Class Appearance

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

public class Appearance
extends NodeComponent

Describes the appearance of an object.

Version:
$Revision: 1.17 $
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
Appearance()
          The default constructor.
 
Method Summary
protected  void checkForCyclicChild(SceneGraphObject parent)
          Check to see if this node is the same reference as the passed node that is a parent of this node.
 Material getMaterial()
          Get the current material in use.
 PolygonAttributes getPolygonAttributes()
          Get the current polygon rendering attributes in use.
 Shader getShader()
          Get the current shader in use.
 void getTextureUnits(TextureUnit[] texUnits)
          Get the texture units used by the material.
 boolean isVisible()
          Check to see if this appearance is making the geometry visible or not.
 int numTextureUnits()
          Get the current number of texture units that are valid
 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.
protected  void setLive(boolean state)
          Notification that this object is live now.
 void setMaterial(Material mat)
          Set the material to use.
 void setPolygonAttributes(PolygonAttributes attr)
          Set the polygon rendering attributes to use.
 void setShader(Shader s)
          Set the shader to use.
 void setTextureUnits(TextureUnit[] texUnits, int num)
          Set the texture units to use.
protected  void setUpdateHandler(NodeUpdateHandler handler)
          Set the scenegraph update handler for this node.
 void setVisible(boolean state)
          Set the visibility state of any geometry associated with this instance.
 
Methods inherited from class org.j3d.aviatrix3d.NodeComponent
addParent, getParents, hasChanged, numParents, removeParent
 
Methods inherited from class org.j3d.aviatrix3d.SceneGraphObject
checkForCyclicParent, dataChanged, getUserData, isLive, setUserData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Appearance

public Appearance()
The default constructor.

Method Detail

setVisible

public void setVisible(boolean state)
Set the visibility state of any geometry associated with this instance.

Parameters:
state - true to make the object visible

isVisible

public boolean isVisible()
Check to see if this appearance is making the geometry visible or not.

Returns:
true when the geometry is visible

setMaterial

public void setMaterial(Material mat)
                 throws InvalidWriteTimingException
Set the material to use. Null will clear the material.

Parameters:
mat - The new material
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener callback method

getMaterial

public Material getMaterial()
Get the current material in use.

Returns:
The current material instance or null

setPolygonAttributes

public void setPolygonAttributes(PolygonAttributes attr)
                          throws InvalidWriteTimingException
Set the polygon rendering attributes to use. Null will clear the current attributes.

Parameters:
attr - The new attributes or null
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener callback method

getPolygonAttributes

public PolygonAttributes getPolygonAttributes()
Get the current polygon rendering attributes in use.

Returns:
The current attributes instance or null

setShader

public void setShader(Shader s)
               throws InvalidWriteTimingException
Set the shader to use. Null will clear the current shader.

Parameters:
s - The new shader instance to use or null
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener callback method

getShader

public Shader getShader()
Get the current shader in use.

Returns:
The current shader instance or null

setTextureUnits

public void setTextureUnits(TextureUnit[] texUnits,
                            int num)
                     throws InvalidWriteTimingException
Set the texture units to use. Null will disable texturing.

Parameters:
texUnits - The new Texture lists to set
num - The number of valid entries in the array
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener callback method

numTextureUnits

public int numTextureUnits()
Get the current number of texture units that are valid

Returns:
a positive number

getTextureUnits

public void getTextureUnits(TextureUnit[] texUnits)
Get the texture units used by the material.


setUpdateHandler

protected void setUpdateHandler(NodeUpdateHandler handler)
Set the scenegraph update handler for this node. It will notify all its children of the value. A null value will clear the current handler.

Overrides:
setUpdateHandler in class SceneGraphObject
Parameters:
handler - The instance to use as a handler

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.

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

setLive

protected void setLive(boolean state)
Notification that this object is live now. Overridden to make sure that the live state of the nodes represents the same state as the parent scene graph.

Overrides:
setLive in class SceneGraphObject
Parameters:
state - true if this should be marked as live now

checkForCyclicChild

protected void checkForCyclicChild(SceneGraphObject parent)
                            throws CyclicSceneGraphStructureException
Check to see if this node is the same reference as the passed node that is a parent of this node. This is the downwards check to ensure that there is no cyclic scene graph structures at the point where someone adds a node to the scenegraph. When the reference and this are the same, an exception is generated. Since each class may have different lists of child node setups, this should be overriden by any class that can take children, and have the call passed along to the children.

Overrides:
checkForCyclicChild in class SceneGraphObject
Parameters:
parent - The reference to check against this class
Throws:
CyclicSceneGraphStructureException - Equal parent and child

j3d.org Aviatrix3D

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