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.
-
ModelBuilder()
- Create a model with default bindings--color binding set to none,
face normals, and texturing off.
-
ModelBuilder(int, int, int, int)
- Create a new model.
-
addComponent(int, int[], int[], int[], int[])
- Add a component.
-
addNormal(float, float, float)
- Normalize a surface normal and add it to the model.
-
addNormal(Vector3)
- Add a new normal to the model.
-
addTextureCoord(float, float)
- Add a new texture coordinate to the model.
-
addTextureCoord(Point2)
- Add a new texture coordinate to the model.
-
addVertex(float, float, float)
- Add a new vertex to the model.
-
addVertex(Point3)
- Add a new vertex to the model.
-
hasChanged()
-
-
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.
-
sendModelData(Model)
-
-
setColorBinding(int)
- Set the color binding.
-
setCreaseAngle(float)
-
-
setNormalBinding(int)
- Set the texture binding.
-
setTextureCoordBinding(int)
- Set the texture binding.
-
size()
-
-
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.
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.
ModelBuilder
public ModelBuilder()
- Create a model with default bindings--color binding set to none,
face normals, and texturing off.
addVertex
public synchronized void addVertex(float x,
float y,
float z)
- Add a new vertex to the model.
addVertex
public synchronized void addVertex(Point3 p)
- Add a new vertex to the model.
addNormal
public synchronized void addNormal(float x,
float y,
float z)
- Normalize a surface normal and add it to the model.
addNormal
public synchronized void addNormal(Vector3 n)
- Add a new normal to the model.
addTextureCoord
public synchronized void addTextureCoord(float u,
float v)
- Add a new texture coordinate to the model.
addTextureCoord
public synchronized void addTextureCoord(Point2 p)
- Add a new texture coordinate to the model.
size
public int size()
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
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.
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.
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.
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.
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.
setCreaseAngle
public synchronized void setCreaseAngle(float creaseAngle)
sendModelData
public synchronized int sendModelData(Model model)
hasChanged
public synchronized boolean hasChanged()
All Packages Class Hierarchy This Package Previous Next Index