Aviatrix3D 1.0

org.j3d.aviatrix3d
Class Appearance

java.lang.Object
  extended byorg.j3d.aviatrix3d.SceneGraphObject
      extended byorg.j3d.aviatrix3d.NodeComponent
          extended byorg.j3d.aviatrix3d.Appearance
All Implemented Interfaces:
Renderable, RenderableObject

public class Appearance
extends NodeComponent
implements RenderableObject

Describes the appearance of an object.

Attribute classes are used to control various visual details about the object being rendered. Although a single instance of this class can take all the attribute types at once, you'll need to consider what this object is being used for. Most of the time you should only ever need to use one of Point/Line/Polygon attributes.

Note: If you have semi-transparent objects that need blending, you do not need provide an instance of BlendAttributes. Aviatrix3D will internally handle the correct settings that you need, so there is no need to provide your own. Only use it when you want to blend objects with something different than the standard blending setup for non-transparent and transparent objects as it will remove this object from the normal transparency sorting processing and into a separate state.

Version:
$Revision: 1.30.2.1 $
Author:
Alan Hudson, Justin Couch

Field Summary
 
Fields inherited from class org.j3d.aviatrix3d.NodeComponent
lastParent, liveCount, parentList
 
Fields inherited from class org.j3d.aviatrix3d.SceneGraphObject
alive, LISTENER_SET_NOT_LIVE_MESSAGE, 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.
 BlendAttributes getBlendAttributes()
          Get the current blend rendering attributes in use.
 LineAttributes getLineAttributes()
          Get the current line rendering attributes in use.
 Material getMaterial()
          Get the current material in use.
 PointAttributes getPointAttributes()
          Get the current pointgon rendering attributes 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 postRender(net.java.games.jogl.GL gl, net.java.games.jogl.GLU glu)
          Restore all openGL state.
 void render(net.java.games.jogl.GL gl, net.java.games.jogl.GLU glu)
          Issue ogl commands needed for this component.
 void setBlendAttributes(BlendAttributes attr)
          Set the blend rendering attributes to use.
 void setLineAttributes(LineAttributes attr)
          Set the line rendering attributes to use.
protected  void setLive(boolean state)
          Notification that this object is live now.
 void setMaterial(Material mat)
          Set the material to use.
 void setPointAttributes(PointAttributes attr)
          Set the point rendering attributes 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

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

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

render

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

Specified by:
render in interface RenderableObject
Parameters:
gl - The gl context to draw with
glu - The utility context to draw with

postRender

public void postRender(net.java.games.jogl.GL gl,
                       net.java.games.jogl.GLU glu)
Restore all openGL state.

Specified by:
postRender in interface RenderableObject
Parameters:
gl - The gl context to draw with
glu - The utility context to draw with

setVisible

public void setVisible(boolean state)
Set the visibility state of any geometry associated with this instance. This can only be set during the data-changed callback as it only effects visual state and not rendering state. An object that is not visible is still valid for the bounds, which means it can be picked etc. That is, making something invisible does not effect the bounds of the parent objects.

Parameters:
state - true to make the object visible
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener callback method

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

setLineAttributes

public void setLineAttributes(LineAttributes attr)
                       throws InvalidWriteTimingException
Set the line 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

getLineAttributes

public LineAttributes getLineAttributes()
Get the current line rendering attributes in use.

Returns:
The current attributes instance or null

setPointAttributes

public void setPointAttributes(PointAttributes attr)
                        throws InvalidWriteTimingException
Set the point 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

getPointAttributes

public PointAttributes getPointAttributes()
Get the current pointgon rendering attributes in use.

Returns:
The current attributes instance or null

setBlendAttributes

public void setBlendAttributes(BlendAttributes attr)
                        throws InvalidWriteTimingException
Set the blend rendering attributes to use. Null will clear the current attributes. Setting a value will disable state sorting for transparency on this object.

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

getBlendAttributes

public BlendAttributes getBlendAttributes()
Get the current blend 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.

Parameters:
texUnits - An array to copy the texture units into
Throws:
java.lang.IllegalArgumentException - The provided array is not big enough to hold all the texture units

Aviatrix3D 1.0

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