j3d.org Code

org.j3d.loaders.ac3d
Class Ac3dObject

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

public class Ac3dObject
extends java.lang.Object

AC3DObject provides a modeling of the properties that constitute an object in the AC3D file format specification.

TODO:

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

Constructor Summary
Ac3dObject()
          Default constructor.
 
Method Summary
 void addChild(Ac3dObject child)
          Add a child to this object.
 void addSurface(Ac3dSurface surface)
          Adds a Ac3dSurface at the given index.
 void addVertex(int index, float[] vertex)
          Mutator to add one vertex at the specified index.
 Ac3dObject getChild(int index)
          Get the child at the given index.
 float getCreaseAngle()
          Get the crease angle that the object uses for rendering surfaces and calculating normals.
 java.lang.String getData()
          Get the character data associated with this object.
 float[] getLocation()
          Get the current location displacement vector.
 java.lang.String getName()
          Get the name associated with this object.
 int getNumKids()
          Get the number of children objects that this object aggregates.
 int getNumSurfaces()
          Query for the number of surfaces that this object contains.
 int getNumvert()
          Get the number of verticies for the object.
 float[] getRotation()
          Get the rotation matrix for the object.
 Ac3dSurface getSurface(int index)
          Get the Ac3dSurface> at the given index.
 java.lang.String getTexture()
          Get the texture file name associated with this material.
 float[] getTextureRepeat()
          Get the current texture repeat values.
 java.lang.String getType()
          Get the type of object that this instance represents.
 java.lang.String getURL()
          Get the URL associated with this object.
 void getVertex(int index, float[] vtx)
          Get an individual vertex at a given index.
 float[] getVertices()
          Get the entire array of vertices.
 void setCreaseAngle(float angle)
          Set the crease angle that the object should use when shading.
 void setData(java.lang.String str)
          Set the random character data that was associated with this object.
 void setLocation(float[] loc)
          Change the location displacement vector.
 void setName(java.lang.String name)
          Set the name property.
 void setNumvert(int num)
          Set the number of verticies for the object.
 void setRotation(float[] rot)
          Mutator to set the rotation matrix for the object.
 void setTexture(java.lang.String texture)
          Set the name of the texture file to use
 void setTextureRepeat(float[] rep)
          Change the texture repeat values.
 void setType(java.lang.String type)
          Set the type of object that this instance represents.
 void setURL(java.lang.String str)
          Set the informational URL that could be associated with this object.
 java.lang.String toString()
          Generate a string representation of the internal state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Ac3dObject

public Ac3dObject()
Default constructor.

Method Detail

setName

public void setName(java.lang.String name)
Set the name property. A null value will clear the current name.

Parameters:
name - The value to set the internal name to.

getName

public java.lang.String getName()
Get the name associated with this object. If no name is set, it will return null.

Returns:
The value of the internal name.

setType

public void setType(java.lang.String type)
Set the type of object that this instance represents.

Parameters:
type - The type to set this object to.

getType

public java.lang.String getType()
Get the type of object that this instance represents. Type is determined by the AC3D file format.

Returns:
The type of object that this instance represents.

setCreaseAngle

public void setCreaseAngle(float angle)
Set the crease angle that the object should use when shading. Crease angle is represented in degrees.

Parameters:
angle - The crease angle to use

getCreaseAngle

public float getCreaseAngle()
Get the crease angle that the object uses for rendering surfaces and calculating normals. Angle is in degrees.

Returns:
The type of object that this instance represents.

getNumKids

public int getNumKids()
Get the number of children objects that this object aggregates.

Returns:
The number of children that this object has.

addChild

public void addChild(Ac3dObject child)
Add a child to this object.

Parameters:
child - The new child object instance to add

getChild

public Ac3dObject getChild(int index)
Get the child at the given index. If the index is out of bounds, null will be returned.

Parameters:
index - The index of the child to get

setNumvert

public void setNumvert(int num)
Set the number of verticies for the object.

Parameters:
num - The number of verticies to set for the object.

getNumvert

public int getNumvert()
Get the number of verticies for the object.

Returns:
The number of verticies for the object.

setLocation

public void setLocation(float[] loc)
Change the location displacement vector.

Parameters:
loc - The location displacement vector to set to.

getLocation

public float[] getLocation()
Get the current location displacement vector.

Returns:
The location displacement vector

setRotation

public void setRotation(float[] rot)
Mutator to set the rotation matrix for the object.

Parameters:
rot - The rotation matrix to set our internal state to.

getRotation

public float[] getRotation()
Get the rotation matrix for the object.

Returns:
The rotationation matrix.

getNumSurfaces

public int getNumSurfaces()
Query for the number of surfaces that this object contains.

Returns:
A non-negative value for the number of surfaces

addSurface

public void addSurface(Ac3dSurface surface)
Adds a Ac3dSurface at the given index.

Parameters:
surface - The surface to add.

getSurface

public Ac3dSurface getSurface(int index)
Get the Ac3dSurface> at the given index.

Returns:
The surface at the requested index.

addVertex

public void addVertex(int index,
                      float[] vertex)
Mutator to add one vertex at the specified index.

Parameters:
index - The index at which to add the vertex.
vertex - Tuple of floats specifying the coordinate.

getVertices

public float[] getVertices()
Get the entire array of vertices.

Returns:
All of the verticies for the object.

getVertex

public void getVertex(int index,
                      float[] vtx)
Get an individual vertex at a given index.

Parameters:
index - The index of the vertex to be fetched
vtx - An array of length 3 to copy the vertex value to

setTexture

public void setTexture(java.lang.String texture)
Set the name of the texture file to use

Parameters:
texture - The value to set the internal texture name to.

getTexture

public java.lang.String getTexture()
Get the texture file name associated with this material. If none is set it will return null.

Returns:
The value of the internal texture name.

setTextureRepeat

public void setTextureRepeat(float[] rep)
Change the texture repeat values. The array needs to be at least length two, with two values for the S and T axes. Default values are 1,1.

Parameters:
rep - The repeat factors

getTextureRepeat

public float[] getTextureRepeat()
Get the current texture repeat values.

Returns:
A length 2 array for S and T repeat amounts

setData

public void setData(java.lang.String str)
Set the random character data that was associated with this object.

Parameters:
str - The string to use

getData

public java.lang.String getData()
Get the character data associated with this object. If no data is given this will return null.

Returns:
The data string or null if none

setURL

public void setURL(java.lang.String str)
Set the informational URL that could be associated with this object. If there is none, it will be null. No checking of the sanity is done.

Parameters:
str - The string to use for the URL

getURL

public java.lang.String getURL()
Get the URL associated with this object. If no URL is given this will return null.

Returns:
The URL string or null if none

toString

public java.lang.String toString()
Generate a string representation of the internal state.

Overrides:
toString in class java.lang.Object
Returns:
A stringified version of the internal state.

j3d.org Code

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