Class dnx.ice.ModelBuilder
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class dnx.ice.ModelBuilder

java.lang.Object
   |
   +----dnx.ice.ModelBuilder

public class ModelBuilder
extends Object
implements ModelSource
A model consists of, at the very least, an array of points plus an array of indices the specifies how the vertices are joined into faces. It may also contain texture coordinates, color lists, and surface normals.

Constructor Index

 o ModelBuilder()
Create a model with default bindings--color binding set to none, face normals, and texturing off.
 o ModelBuilder(int, int, int, int)
Create a new model.

Method Index

 o addComponent(int, int[], int[], int[], int[])
Add a component.
 o addNormal(float, float, float)
Normalize a surface normal and add it to the model.
 o addNormal(Vector3)
Add a new normal to the model.
 o addTextureCoord(float, float)
Add a new texture coordinate to the model.
 o addTextureCoord(Point2)
Add a new texture coordinate to the model.
 o addVertex(float, float, float)
Add a new vertex to the model.
 o addVertex(Point3)
Add a new vertex to the model.
 o hasChanged()
 o quad(int, int, int, int)
Add a quadrilateral with the specified vertex indices--this method only works if the model has no per-vertex or per-face properties or auto-generated properties.
 o sendModelData(Model)
 o setColorBinding(int)
Set the color binding.
 o setCreaseAngle(float)
 o setNormalBinding(int)
Set the texture binding.
 o setTextureCoordBinding(int)
Set the texture binding.
 o size()
 o triangle(int, int, int)
Add a triangle with the specified vertex indices--this method only works if the model has no per-vertex or per-face properties or auto-generated properties.

Constructors

 o ModelBuilder
  public ModelBuilder(int type,
                      int normalBinding,
                      int colorBinding,
                      int textureCoordBinding) throws InvalidModelException
Create a new model. Give the color binding and normal binding which will be used for the entire model.
 o ModelBuilder
  public ModelBuilder()
Create a model with default bindings--color binding set to none, face normals, and texturing off.

Methods

 o addVertex
  public synchronized void addVertex(float x,
                                     float y,
                                     float z)
Add a new vertex to the model.
 o addVertex
  public synchronized void addVertex(Point3 p)
Add a new vertex to the model.
 o addNormal
  public synchronized void addNormal(float x,
                                     float y,
                                     float z)
Normalize a surface normal and add it to the model.
 o addNormal
  public synchronized void addNormal(Vector3 n)
Add a new normal to the model.
 o addTextureCoord
  public synchronized void addTextureCoord(float u,
                                           float v)
Add a new texture coordinate to the model.
 o addTextureCoord
  public synchronized void addTextureCoord(Point2 p)
Add a new texture coordinate to the model.
 o size
  public int size()
 o addComponent
  public synchronized void addComponent(int nPoints,
                                        int v[],
                                        int n[],
                                        int t[],
                                        int c[]) throws InvalidModelException
Add a component. An array of vertex indices must always be given. Color, normal, and texture indices are only necessary if the model's bindings require it--if the the model was created with a color binding of bindingNone, m can be null. If the color binding for the model is BINDING_PER_FACE, m need only contain one element.
Parameters:
v - array of vertex indices
n - array of normal indices
t - array of texture indices
c - array of colors
 o triangle
  public synchronized void triangle(int vi0,
                                    int vi1,
                                    int vi2)
Add a triangle with the specified vertex indices--this method only works if the model has no per-vertex or per-face properties or auto-generated properties.
 o quad
  public synchronized void quad(int vi0,
                                int vi1,
                                int vi2,
                                int vi3)
Add a quadrilateral with the specified vertex indices--this method only works if the model has no per-vertex or per-face properties or auto-generated properties.
 o setColorBinding
  public synchronized void setColorBinding(int binding) throws InvalidModelException
Set the color binding. Valid values are BINDING_NONE, BINDINER_PER_FACE, and BINDING_PER_VERTEX. @throws InvalidModelException If binding isn't a valid value.
 o setNormalBinding
  public synchronized void setNormalBinding(int binding) throws InvalidModelException
Set the texture binding. Valid values are BINDING_NONE, BINDING_PER_FACE, BINDING_PER_VERTEX, BINDING_PER_FACE_GENERATE, and BINDING_PER_VERTEX_GENERATE. @throws InvalidModelException If binding isn't a valid value.
 o setTextureCoordBinding
  public synchronized void setTextureCoordBinding(int binding) throws InvalidModelException
Set the texture binding. Valid values are BINDING_NONE, BINDING_PER_VERTEX, and BINDING_PER_VERTEX_GENERATE. @throws InvalidModelException If binding isn't a valid value.
 o setCreaseAngle
  public synchronized void setCreaseAngle(float creaseAngle)
 o sendModelData
  public synchronized int sendModelData(Model model)
 o hasChanged
  public synchronized boolean hasChanged()

All Packages  Class Hierarchy  This Package  Previous  Next  Index