com.mascotcapsule.micro3d.v3
Class Figure

java.lang.Object
  extended bycom.mascotcapsule.micro3d.v3.Figure

public class Figure
extends java.lang.Object

This class maintains the 3D model data. It loads meta model data and maintains polygon data. The pose of the model can be changed by using the ActionTable object. The initial state of the pose is composed by the 3D coordinates in the meta data.


Constructor Summary
Figure(byte[] b)
          Creates a model object from the meta model data.
Figure(java.lang.String name)
          Creates a model object from the meta data specified by the resource name.
 
Method Summary
 void dispose()
          Disposes of model data being maintained.
 int getNumPattern()
          Gets the number of model external appearances.
 int getNumTextures()
          Gets the setting for the number of textures.
 Texture getTexture()
          Gets the texture data set for the 3D model.
 void selectTexture(int idx)
          Sets one of the texture data sets for this object as the 3D model texture data.
 void setPattern(int idx)
          Enters the number of model external appearances.
 void setPosture(ActionTable act, int action, int frame)
          Enters a pose setting for the 3D model.
 void setTexture(Texture t)
          Enters texture data settings for the 3D model.
 void setTexture(Texture[] t)
          Enters the reference setting for the texture data set.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Figure

public Figure(byte[] b)
Creates a model object from the meta model data.

Parameters:
b - Data byte column
Throws:
java.lang.NullPointerException - When argument is null.
java.lang.RuntimeException - Generated when object creation fails, such as from false data.

Figure

public Figure(java.lang.String name)
       throws java.io.IOException
Creates a model object from the meta data specified by the resource name.

Parameters:
name - Resourece name
Throws:
java.lang.NullPointerException - When argument name is null.
java.lang.RuntimeException - Object creation failure, such as from false data.
java.io.IOException - I/O error when reading data.
Method Detail

dispose

public final void dispose()
Disposes of model data being maintained.


setPosture

public final void setPosture(ActionTable act,
                             int action,
                             int frame)
Enters a pose setting for the 3D model.

Parameters:
act - Action data
action - Action index number
frame - Action frame value
Throws:
java.lang.NullPointerException - When argument act is null.
java.lang.IllegalArgumentException - When argument action is false.

getTexture

public final Texture getTexture()
Gets the texture data set for the 3D model.

Returns:
Texture object

setTexture

public final void setTexture(Texture t)
Enters texture data settings for the 3D model.

Parameters:
t - Texture object
Throws:
java.lang.NullPointerException - When argument is null.
java.lang.IllegalArgumentException - When the texture data is not for the model (but for environment mapping)

setTexture

public final void setTexture(Texture[] t)
Enters the reference setting for the texture data set. Use the selectTexure() method when entering texture data settings for the 3D model.

Parameters:
t - Texture object array
Throws:
java.lang.NullPointerException - When either the argument is null or one of the elements is null.
java.lang.IllegalArgumentException - When some of the textures are not for the model(but for environment mapping)

getNumTextures

public final int getNumTextures()
Gets the setting for the number of textures.

Returns:
t Number of textures

selectTexture

public final void selectTexture(int idx)
Sets one of the texture data sets for this object as the 3D model texture data.

Parameters:
idx - Index value
Throws:
java.lang.IllegalArgumentException - When argument idx is false.

getNumPattern

public final int getNumPattern()
Gets the number of model external appearances.

Returns:
Model external appearances

setPattern

public final void setPattern(int idx)
Enters the number of model external appearances. Normally, the state of pose and external appearance are set by calling the setPosture() method; however, this is used when it is a reasonable solution to create animation by not venturing to use the ActionTable object. The external appearance states of the model have been given a number of specific meanings, and it might be a good idea to use them when there is a desire to clearly specify the combinations. There are a maximum of 33 states that are external states of the model, including the base state (common set). (The number of settable model external states can be obtained by using the getNumPattern() method). When specifying the nth (1 or more) external state, enter the value (1 << (n-1)) as the argument for this method. To have an external appearance specified to do nothing (common set), enter a 0.
 Examples:
  External state0: Face with common set
  External state1: Closed right eye
  External state2: Open right eye
  External state3: Closed left eye
  External state4: Open left eye
  External state5: Closed mouth
  External state6: Open mouth
  When there is a model with the external appearance states shown above:
  setPattern(0) ?¨ Face with neither eyes nor mouth
  setPattern(1<<0) ?¨ Face with closed right eye
  setPattern(1<<1) ?¨ Face with open right eye
  setPattern(1<<2) ?¨ Face with closed left eye
  setPattern(1<<3) ?¨ Face with open left eye
  setPattern((1<<1)|(1<<3)|(1<<5)) ?¨ Face with both eyes and mouth open
  setPattern((1<<0)|(1<<1)) ?¨ Face with both closed right eye and open right eye
 

Parameters:
idx - State of model external appearance