Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## javax.media.j3d
Class PolygonAttributes

    java.lang.Object
      javax.media.j3d.SceneGraphObject
          javax.media.j3d.NodeComponent
              javax.media.j3d.PolygonAttributes

    public class PolygonAttributes

extends NodeComponent

The PolygonAttributes object defines attributes for rendering polygon primitives. Polygon primitives include triangles, triangle strips, triangle fans, and quads. The polygon attributes that can be defined are:

- Rasterization mode - defines how the polygon is drawn: as points, outlines, or filled.

  - POLYGON_POINT - the polygon is rendered as points drawn at the vertices.

  - POLYGON_LINE - the polygon is rendered as lines drawn between consecutive vertices.

  - POLYGON_FILL - the polygon is rendered by filling the interior between the vertices. The default mode.

- Face culling - defines which polygons are culled (discarded) before they are converted to screen coordinates.

  - CULL_NONE - disables face culling.
  - CULL_BACK - culls all back-facing polygons. The default.
  - CULL_FRONT - culls all front-facing polygons.

- Back-face normal flip - specifies whether vertex normals of back-facing polygons are flipped (negated) prior to lighting. The setting is either true, meaning to flip back-facing normals, or false. The default is false.

- Offset - the depth values of all pixels generated by polygon rasterization can be offset by a value that is computed for that polygon. Two values are used to specify the offset:

- Offset bias - the constant polygon offset that is added to the final device coordinate Z value of polygon primitives.

- Offset factor - the factor to be multiplied by the slope of the polygon and then added to the final, device coordinate Z value of the polygon primitives.

These values can be either positive or negative. The default for both of these values is 0.0.

See Also:
  `Appearance`

Field Summary
`static int` | `ALLOW_CULL_FACE_READ` Specifies that this PolygonAttributes object allows reading its cull face information.
`static int` | `ALLOW_CULL_FACE_WRITE` Specifies that this PolygonAttributes object allows writing its cull face information.
`static int` | `ALLOW_MODE_READ` Specifies that this PolygonAttributes object allows reading its polygon mode information.
`static int` | `ALLOW_MODE_WRITE` Specifies that this PolygonAttributes object allows writing its polygon mode information.
`static int` | `ALLOW_NORMAL_FLIP_READ` Specifies that this PolygonAttributes object allows reading its back face normal flip flag.
`static int` | `ALLOW_NORMAL_FLIP_WRITE` Specifies that this PolygonAttributes object allows writing its back face normal flip flag.
`static int` | `ALLOW_OFFSET_READ` Specifies that this PolygonAttributes object allows reading its polygon offset information.
`static int` | `ALLOW_OFFSET_WRITE` Specifies that this PolygonAttributes object allows writing its polygon offset information.
`static int` | `CULL_BACK` Cull all back-facing polygons.
`static int` | `CULL_FRONT` Cull all front-facing polygons.
`static int` | `CULL_NONE` Don't perform any face culling.
`static int` | `POLYGON_FILL` Render polygonal primitives by filling the interior of the polygon.
`static int` | `POLYGON_LINE` Render polygonal primitives as lines drawn between consecutive vertices of the polygon.
`static int` | `POLYGON_POINT` Render polygonal primitives as points drawn at the vertices of the polygon.

Constructor Summary
`PolygonAttributes()` Constructs a PolygonAttributes object with default parameters.
`PolygonAttributes(int polygonMode, int cullFace, float polygonOffset)` Constructs a PolygonAttributes object with specified values.
`PolygonAttributes(int polygonMode, int cullFace, float polygonOffset, boolean backFaceNormalFlip)` Constructs PolygonAttributes object with specified values.
`PolygonAttributes(int polygonMode, int cullFace, float polygonOffset, boolean backFaceNormalFlip, float polygonOffsetFactor)` Constructs PolygonAttributes object with specified values.

Method Summary
`NodeComponent` | `cloneNodeComponent()` Deprecated. replaced with cloneNodeComponent(boolean forceDuplicate)
`boolean` | `getBackFaceNormalFlip()` Gets the back face normal flip flag.
`int` | `getCullFace()` Gets the face culling for this appearance component object.
`int` | `getPolygonMode()` Gets the polygon rasterization mode for this appearance component object.
`float` | `getPolygonOffset()` Gets the constant polygon offset.
`float` | `getPolygonOffsetFactor()` Gets the polygon offset factor.
`void` | `setBackFaceNormalFlip(boolean backFaceNormalFlip)` Sets the back face normal flip flag to the specified value.
`void` | `setCullFace(int cullFace)` Sets the face culling for this appearance component object.
`void` | `setPolygonMode(int polygonMode)` Sets the polygon rasterization mode for this appearance component object.
`void` | `setPolygonOffset(float polygonOffset)` Sets the constant polygon offset to the specified value.
`void` | `setPolygonOffsetFactor(float polygonOffsetFactor)` Sets the polygon offset factor to the specified value.

Methods inherited from class javax.media.j3d.NodeComponent
`cloneNodeComponent, duplicateNodeComponent, duplicateNodeComponent, getDuplicateOnCloneTree, setDuplicateOnCloneTree`

Methods inherited from class javax.media.j3d.SceneGraphObject
`clearCapability, clearCapabilityIsFrequent, duplicateSceneGraphObject, getCapability, getCapabilityIsFrequent, getName, getUserData, isCompiled, isLive, setCapability, setCapabilityIsFrequent, setName, setUserData, toString, updateNodeReferences`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### ALLOW_CULL_FACE_READ

    public static final int ALLOW_CULL_FACE_READ

  Specifies that this PolygonAttributes object allows reading its cull face information.

  See Also:
    Constant Field Values

### ALLOW_CULL_FACE_WRITE

    public static final int ALLOW_CULL_FACE_WRITE

  Specifies that this PolygonAttributes object allows writing its cull face information.

  See Also:
    Constant Field Values

### ALLOW_NORMAL_FLIP_READ

    public static final int ALLOW_NORMAL_FLIP_READ

  Specifies that this PolygonAttributes object allows reading its back face normal flip flag.

  See Also:
    Constant Field Values

### ALLOW_NORMAL_FLIP_WRITE

    public static final int ALLOW_NORMAL_FLIP_WRITE

  Specifies that this PolygonAttributes object allows writing its back face normal flip flag.

  See Also:
    Constant Field Values

### ALLOW_MODE_READ

    public static final int ALLOW_MODE_READ

  Specifies that this PolygonAttributes object allows reading its polygon mode information.

  See Also:
    Constant Field Values

### ALLOW_MODE_WRITE

    public static final int ALLOW_MODE_WRITE

  Specifies that this PolygonAttributes object allows writing its polygon mode information.

  See Also:
    Constant Field Values

### ALLOW_OFFSET_READ

    public static final int ALLOW_OFFSET_READ

  Specifies that this PolygonAttributes object allows reading its polygon offset information.

  See Also:
    Constant Field Values

### ALLOW_OFFSET_WRITE

    public static final int ALLOW_OFFSET_WRITE

  Specifies that this PolygonAttributes object allows writing its polygon offset information.

  See Also:
    Constant Field Values

### POLYGON_POINT

    public static final int POLYGON_POINT

  Render polygonal primitives as points drawn at the vertices of the polygon.

  See Also:
    Constant Field Values

### POLYGON_LINE

    public static final int POLYGON_LINE

  Render polygonal primitives as lines drawn between consecutive vertices of the polygon.

  See Also:
    Constant Field Values

### POLYGON_FILL

    public static final int POLYGON_FILL

  Render polygonal primitives by filling the interior of the polygon.

  See Also:
    Constant Field Values

### CULL_NONE

    public static final int CULL_NONE

  Don't perform any face culling.

  See Also:
    Constant Field Values

### CULL_BACK

    public static final int CULL_BACK

  Cull all back-facing polygons. This is the default mode.

  See Also:
    Constant Field Values

### CULL_FRONT

    public static final int CULL_FRONT

  Cull all front-facing polygons.

  See Also:
    Constant Field Values

Constructor Detail

### PolygonAttributes

    public PolygonAttributes()

  Constructs a PolygonAttributes object with default parameters. The default values are as follows:
  cull face : CULL_BACK
  back face normal flip : false
  polygon mode : POLYGON_FILL
  polygon offset : 0.0
  polygon offset factor : 0.0

### PolygonAttributes

    public PolygonAttributes(int polygonMode,
                             int cullFace,
                             float polygonOffset)

  Constructs a PolygonAttributes object with specified values.

  Parameters:
    `polygonMode` - polygon rasterization mode; one of POLYGON_POINT, POLYGON_LINE, or POLYGON_FILL
    `cullFace` - polygon culling mode; one of CULL_NONE, CULL_BACK, or CULL_FRONT
    `polygonOffset` - constant polygon offset

### PolygonAttributes

    public PolygonAttributes(int polygonMode,
                             int cullFace,
                             float polygonOffset,
                             boolean backFaceNormalFlip)

  Constructs PolygonAttributes object with specified values.

  Parameters:
    `polygonMode` - polygon rasterization mode; one of POLYGON_POINT, POLYGON_LINE, or POLYGON_FILL
    `cullFace` - polygon culling mode; one of CULL_NONE, CULL_BACK, or CULL_FRONT
    `polygonOffset` - constant polygon offset
    `backFaceNormalFlip` - back face normal flip flag; true or false

### PolygonAttributes

    public PolygonAttributes(int polygonMode,
                             int cullFace,
                             float polygonOffset,
                             boolean backFaceNormalFlip,
                             float polygonOffsetFactor)

  Constructs PolygonAttributes object with specified values.

  Parameters:
    `polygonMode` - polygon rasterization mode; one of POLYGON_POINT, POLYGON_LINE, or POLYGON_FILL
    `cullFace` - polygon culling mode; one of CULL_NONE, CULL_BACK, or CULL_FRONT
    `polygonOffset` - constant polygon offset
    `backFaceNormalFlip` - back face normal flip flag; true or false
    `polygonOffsetFactor` - polygon offset factor for slope-based polygon offset
  Since:
    Java 3D 1.2

Method Detail

### setCullFace

    public void setCullFace(int cullFace)

  Sets the face culling for this appearance component object.

  Parameters:
    `cullFace` - the face to be culled, one of: CULL_NONE, CULL_FRONT, or CULL_BACK
  Throws:
    `CapabilityNotSetException` - if appropriate capability is not set and this object is part of live or compiled scene graph

### getCullFace

    public int getCullFace()

  Gets the face culling for this appearance component object.

  Returns:
    the face to be culled
  Throws:
    `CapabilityNotSetException` - if appropriate capability is not set and this object is part of live or compiled scene graph

### setBackFaceNormalFlip

    public void setBackFaceNormalFlip(boolean backFaceNormalFlip)

  Sets the back face normal flip flag to the specified value. This flag indicates whether vertex normals of back facing polygons should be flipped (negated) prior to lighting. When this flag is set to true and back face culling is disabled, polygons are rendered as if the polygon had two sides with opposing normals. This feature is disabled by default.

  Parameters:
    `backFaceNormalFlip` - the back face normal flip flag
  Throws:
    `CapabilityNotSetException` - if appropriate capability is not set and this object is part of live or compiled scene graph

### getBackFaceNormalFlip

    public boolean getBackFaceNormalFlip()

  Gets the back face normal flip flag.

  Returns:
    the back face normal flip flag
  Throws:
    `CapabilityNotSetException` - if appropriate capability is not set and this object is part of live or compiled scene graph

### setPolygonMode

    public void setPolygonMode(int polygonMode)

  Sets the polygon rasterization mode for this appearance component object.

  Parameters:
    `polygonMode` - the polygon rasterization mode to be used; one of POLYGON_FILL, POLYGON_LINE, or POLYGON_POINT
  Throws:
    `CapabilityNotSetException` - if appropriate capability is not set and this object is part of live or compiled scene graph

### getPolygonMode

    public int getPolygonMode()

  Gets the polygon rasterization mode for this appearance component object.

  Returns:
    the polygon rasterization mode
  Throws:
    `CapabilityNotSetException` - if appropriate capability is not set and this object is part of live or compiled scene graph

### setPolygonOffset

    public void setPolygonOffset(float polygonOffset)

  Sets the constant polygon offset to the specified value. This screen space offset is added to the final, device coordinate Z value of polygon primitives.

  Parameters:
    `polygonOffset` - the constant polygon offset
  Throws:
    `CapabilityNotSetException` - if appropriate capability is not set and this object is part of live or compiled scene graph

### getPolygonOffset

    public float getPolygonOffset()

  Gets the constant polygon offset.

  Returns:
    the constant polygon offset
  Throws:
    `CapabilityNotSetException` - if appropriate capability is not set and this object is part of live or compiled scene graph

### setPolygonOffsetFactor

    public void setPolygonOffsetFactor(float polygonOffsetFactor)

  Sets the polygon offset factor to the specified value. This factor is multiplied by the slope of the polygon, and then added to the final, device coordinate Z value of polygon primitives.

  Parameters:
    `polygonOffsetFactor` - the polygon offset factor
  Throws:
    `CapabilityNotSetException` - if appropriate capability is not set and this object is part of live or compiled scene graph
  Since:
    Java 3D 1.2

### getPolygonOffsetFactor

    public float getPolygonOffsetFactor()

  Gets the polygon offset factor.

  Returns:
    the polygon offset factor.
  Throws:
    `CapabilityNotSetException` - if appropriate capability is not set and this object is part of live or compiled scene graph
  Since:
    Java 3D 1.2

### cloneNodeComponent

    public NodeComponent cloneNodeComponent()

  Deprecated. replaced with cloneNodeComponent(boolean forceDuplicate)

  Overrides:
    `cloneNodeComponent` in class `NodeComponent`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved. Use is subject to license terms.