public interface MeshBuilder
You can pass a MeshBuilder object to
ResourceManager to create a mesh resource.
| 限定符和类型 | 接口 | 说明 |
|---|---|---|
static class |
MeshBuilder.Primitive |
Represents the primitive used to build a mesh.
|
static class |
MeshBuilder.VertexData |
Provides the vertex data for creating a mesh.
|
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
void |
addPrimitive(MeshBuilder.Primitive primitive) |
Adds a primitive and related information to the current mesh.
|
void |
allocate() |
Allocates memory for the current mesh.
|
int |
getIndexCount() |
Obtains the index count.
|
int |
getVertexCount() |
Obtains the vertex count.
|
void |
release() |
Releases the current mesh.
|
void |
setAabb(int primitiveIndex,
BoundingBox bounds) |
Sets an axis-aligned bounding box (AABB) for a primitive.
|
void |
setIndexData(int primitiveIndex,
ByteBuffer indices) |
Sets indices to triangles for a primitive.
|
void |
setVertexData(int primitiveIndex,
MeshBuilder.VertexData vertexData) |
Sets geometry data for a given primitive.
|
void allocate()
This method should be called after all primitives have been added to this mesh and before data is being fed to primitives.
void release()
void addPrimitive(MeshBuilder.Primitive primitive)
primitive - Indicates the primitive to add and the related information that determines memory requirements.void setVertexData(int primitiveIndex,
MeshBuilder.VertexData vertexData)
primitiveIndex - Indicates the index of the primitive.vertexData - Indicates the data buffers for creating a mesh.void setIndexData(int primitiveIndex,
ByteBuffer indices)
primitiveIndex - Indicates the index of the primitive.indices - Indicates index data as a byte array
(the format of which is defined by the information related to the primitive).void setAabb(int primitiveIndex,
BoundingBox bounds)
primitiveIndex - Indicates the index of the primitive.bounds - Indicates the primitive bounds.int getVertexCount()
This method should be called after allocate() has been called.
int getIndexCount()
16-bit indices are packed (two per one 32-bit slot), and there might be paddings involved.