j3d.org Code

org.j3d.loaders.ac3d
Class Ac3dSurface

java.lang.Object
  extended by org.j3d.loaders.ac3d.Ac3dSurface

public class Ac3dSurface
extends java.lang.Object

Representation of the attributes for a polygon surface in the AC3D file format definition.

Primitives are used wherever possible to reduce memory usage and object clutter.

TODO:

Version:
$Revision: 1.3 $
Author:
Ryan Wilhm (ryan@entrophica.com)

Field Summary
static int FLAG_CLOSEDLINE
          Surface flag for a closed line loop
static int FLAG_LINE
          Surface flag for an open line
static int FLAG_POLYGON
          Surface flag for a polygon
static int FLAG_SHADED
          Surface flag for a shaded polygon
static int FLAG_TWOSIDED
          Surface flag for a double sided polygon
 
Constructor Summary
Ac3dSurface()
          Default constructor, which sets up the initial state.
 
Method Summary
 void addRef(int index, int vertex, float[] texCoord)
          Append an additional reference to the surface.
 boolean checkFlag(int flag)
          Helper function that tests to see if the requested flag is set in the local instance state.
 int getFlags()
          Accessor to get the current flag state.
 int getMaterial()
          Get the material index reference for this surface.
 int getNumrefs()
          Retrieve the number of vertex references for this surface.
 float[] getTextureCoordinates()
          Accessor for the textureCoordinates property.
 int[] getVerticesIndex()
          Get the array of vertices.
 void setFlags(int flags)
          Mutator to set the current flag state.
 void setMaterial(int mat)
          Set the material index reference.
 void setNumrefs(int numrefs)
          Mutator to set the number of vertex references for this surface.
 java.lang.String toString()
          Creates and returns the stringified version of the internal state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

FLAG_POLYGON

public static final int FLAG_POLYGON
Surface flag for a polygon

See Also:
Constant Field Values

FLAG_CLOSEDLINE

public static final int FLAG_CLOSEDLINE
Surface flag for a closed line loop

See Also:
Constant Field Values

FLAG_LINE

public static final int FLAG_LINE
Surface flag for an open line

See Also:
Constant Field Values

FLAG_SHADED

public static final int FLAG_SHADED
Surface flag for a shaded polygon

See Also:
Constant Field Values

FLAG_TWOSIDED

public static final int FLAG_TWOSIDED
Surface flag for a double sided polygon

See Also:
Constant Field Values
Constructor Detail

Ac3dSurface

public Ac3dSurface()
Default constructor, which sets up the initial state.

Method Detail

setNumrefs

public void setNumrefs(int numrefs)

Mutator to set the number of vertex references for this surface. This also allocates space for all of the associated data.

Parameters:
numrefs - The number of references this surface is to have.

getNumrefs

public int getNumrefs()
Retrieve the number of vertex references for this surface.

Returns:
The number of surface references.

setFlags

public void setFlags(int flags)

Mutator to set the current flag state.

Parameters:
flags - The value ot set the current flag state to.

getFlags

public int getFlags()

Accessor to get the current flag state.

Returns:
The current flag state.

setMaterial

public void setMaterial(int mat)
Set the material index reference.

Parameters:
mat - The material index to associate this surface to.

getMaterial

public int getMaterial()
Get the material index reference for this surface.

Returns:
The material index associated with this surface.

addRef

public void addRef(int index,
                   int vertex,
                   float[] texCoord)
Append an additional reference to the surface. These identify the coordinates of the vertex, as well as texture coordinates.

Parameters:
index - Indicates the index number of the surface vertes.
vertex - The index of the vertex in the object the surface is a part of.
texCoord - The texture coordinates for the surface vertex relating to the texture map.

getVerticesIndex

public int[] getVerticesIndex()
Get the array of vertices.

Returns:
The array of vertices.

getTextureCoordinates

public float[] getTextureCoordinates()

Accessor for the textureCoordinates property.

Returns:
The array of texture coordinates.

checkFlag

public boolean checkFlag(int flag)
Helper function that tests to see if the requested flag is set in the local instance state.

Parameters:
flag - The flag to check for.
Returns:
Whether or not the flag is set in the local state.

toString

public java.lang.String toString()

Creates and returns the stringified version of the internal state.

Overrides:
toString in class java.lang.Object
Returns:
The stringified value for the state.

j3d.org Code

Latest Info from http://code.j3d.org/
Copyright © 2001 - j3d.org