j3d.org Aviatrix3D

org.j3d.aviatrix3d
Class PolygonAttributes

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

public class PolygonAttributes
extends NodeComponent

Describes attributes used when rendering a polygon.

Version:
$Revision: 1.8 $
Author:
Justin Couch

Field Summary
static int CULL_BACK
          The cull mode says to draw back faces only
static int CULL_BOTH
          The cull mode says to not draw any faces
static int CULL_FRONT
          The cull mode says to draw front faces only
static int CULL_NONE
          The cull mode says to draw both front and back faces
static int DRAW_FILLED
          Draw the face filled as a solid object
static int DRAW_LINE
          Draw the face as outline lines only
static int DRAW_POINT
          Draw the face as the points of the vertices only
 
Fields inherited from class org.j3d.aviatrix3d.NodeComponent
liveCount
 
Fields inherited from class org.j3d.aviatrix3d.SceneGraphObject
alive, updateHandler, WRITE_TIMING_MSG
 
Constructor Summary
PolygonAttributes()
          Constructs a attribute set with default values.
 
Method Summary
 int getCulledFace()
          Get the current face culled flag.
 int getDrawMode(boolean front)
          Get the draw mode for the specified face.
 void getPolygonOffset(float[] values)
          Get the current polygon offset details.
 boolean isCCW()
          Check the state of the CCW flag setting for this geometry.
 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 setCCW(boolean state)
          Set the CCW flag.
 void setCulledFace(int face)
          Set which face is to be culled.
 void setDrawMode(boolean front, int mode)
          Set the draw mode for either the front or back face.
 void setPolygonOffset(float factor, float units)
          Set the polygon offset details.
 void setStipplePattern(byte[] pattern)
          Set the stipple mask to be used on the polygon.
 
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
 

Field Detail

CULL_NONE

public static final int CULL_NONE
The cull mode says to draw both front and back faces

See Also:
Constant Field Values

CULL_FRONT

public static final int CULL_FRONT
The cull mode says to draw front faces only

See Also:
Constant Field Values

CULL_BACK

public static final int CULL_BACK
The cull mode says to draw back faces only

See Also:
Constant Field Values

CULL_BOTH

public static final int CULL_BOTH
The cull mode says to not draw any faces

See Also:
Constant Field Values

DRAW_POINT

public static final int DRAW_POINT
Draw the face as the points of the vertices only

See Also:
Constant Field Values

DRAW_LINE

public static final int DRAW_LINE
Draw the face as outline lines only

See Also:
Constant Field Values

DRAW_FILLED

public static final int DRAW_FILLED
Draw the face filled as a solid object

See Also:
Constant Field Values
Constructor Detail

PolygonAttributes

public PolygonAttributes()
Constructs a attribute set with default values.

Method Detail

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

setCCW

public void setCCW(boolean state)
            throws InvalidWriteTimingException
Set the CCW flag. By default CCW is true.

Parameters:
state - True to use CCW triangles, false for CW
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener callback method

isCCW

public boolean isCCW()
Check the state of the CCW flag setting for this geometry.

Returns:
true if the vertices are rendered counter clockwise

setCulledFace

public void setCulledFace(int face)
                   throws InvalidWriteTimingException
Set which face is to be culled. It should be one of the base constants defined by this class.

Parameters:
face - The face that should be culled
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener callback method

getCulledFace

public int getCulledFace()
Get the current face culled flag.

Returns:
one of the four CULL_X constants

setDrawMode

public void setDrawMode(boolean front,
                        int mode)
                 throws java.lang.IllegalArgumentException,
                        InvalidWriteTimingException
Set the draw mode for either the front or back face.

Parameters:
front - true if this is the front-face setting
mode - The mode to use for this face
Throws:
java.lang.IllegalArgumentException - Invalid mode supplied
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener callback method

getDrawMode

public int getDrawMode(boolean front)
Get the draw mode for the specified face.

Parameters:
front - true if requesting the front-face setting

setPolygonOffset

public void setPolygonOffset(float factor,
                             float units)
                      throws InvalidWriteTimingException
Set the polygon offset details. Factor and unit applied as per the OpenGL specification.

Parameters:
factor - The offset factor mulitplier
units - The offset unit multiplier
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener callback method

getPolygonOffset

public void getPolygonOffset(float[] values)
Get the current polygon offset details. The array is used to copy the current values into and therefore must be at least 2 items in length. Index 0 is the factor, index 1 is the units

Parameters:
values - The array to copy the current values into

setStipplePattern

public void setStipplePattern(byte[] pattern)
                       throws InvalidWriteTimingException
Set the stipple mask to be used on the polygon. If the stipple is null then it will clear the current stipple setup. If not null, it must be at least an array length 1024 (32x32). The value is used by reference

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

j3d.org Aviatrix3D

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