Package com.aspose.threed
Class TriMesh
- java.lang.Object
-
- com.aspose.threed.A3DObject
-
- com.aspose.threed.Entity
-
- com.aspose.threed.TriMesh
-
public class TriMesh extends Entity
A TriMesh contains raw data that can be used by GPU directly. This class is a utility to help to construct a mesh that only contains per-vertex data.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
TriMesh(java.lang.String name)
Initialize aTriMesh
TriMesh(java.lang.String name, VertexDeclaration declaration)
Initialize an instance ofTriMesh
-
Method Summary
Modifier and Type Method Description Vertex
beginVertex()
Begin adding vertexvoid
endVertex()
End adding vertexstatic TriMesh
fromMesh(Mesh mesh)
Create a TriMesh from given mesh object, the vertex declaration are based on the input mesh's structure.static TriMesh
fromMesh(Mesh mesh, boolean useFloat)
Create a TriMesh from given mesh object, the vertex declaration are based on the input mesh's structure.static TriMesh
fromMesh(VertexDeclaration declaration, Mesh mesh)
Create a TriMesh from given mesh object with given vertex layout.int
getCapacity()
The capacity of preallocated vertices.int
getIndicesCount()
The count of indices in thisTriMesh
int
getUnmergedVerticesCount()
The count of unmerged vertices that passed in bybeginVertex()
andendVertex()
.VertexDeclaration
getVertexDeclaration()
The vertex layout of theTriMesh
.int
getVerticesCount()
The count of vertices in thisTriMesh
int
getVerticesSizeInBytes()
The total size of all vertices in bytesvoid
indicesToArray(int[][] result)
Convert the indices to 32bit integer arrayvoid
indicesToArray(short[][] result)
Convert the indices to 16bit integer arrayjava.lang.String
toString()
Gets the string representation ofTriMesh
byte[]
verticesToArray()
Convert the vertices data to byte arrayvoid
write16bIndicesTo(com.aspose.csporter.helpers.Stream stream)
Write the indices data as 16bit integer to the streamvoid
write32bIndicesTo(com.aspose.csporter.helpers.Stream stream)
Write the indices data as 32bit integer to the streamvoid
writeVerticesTo(com.aspose.csporter.helpers.Stream stream)
Write vertices data to the specified stream-
Methods inherited from class com.aspose.threed.Entity
createRenderableResource, getBoundingBox, getExcluded, getParentNode, getParentNodes, setExcluded, setParentNode
-
Methods inherited from class com.aspose.threed.A3DObject
findProperty, getName, getProperty, removeProperty, removeProperty, setName, setProperty
-
-
-
-
Constructor Detail
-
TriMesh
protected TriMesh(java.lang.String name)
Initialize aTriMesh
-
TriMesh
public TriMesh(java.lang.String name, VertexDeclaration declaration)
Initialize an instance ofTriMesh
- Parameters:
name
- The name of this TriMeshdeclaration
- The vertex's declaration
-
-
Method Detail
-
getVertexDeclaration
public VertexDeclaration getVertexDeclaration()
The vertex layout of theTriMesh
.
-
getVerticesCount
public int getVerticesCount()
The count of vertices in thisTriMesh
-
getIndicesCount
public int getIndicesCount()
The count of indices in thisTriMesh
-
getUnmergedVerticesCount
public int getUnmergedVerticesCount()
The count of unmerged vertices that passed in bybeginVertex()
andendVertex()
.
-
getCapacity
public int getCapacity()
The capacity of preallocated vertices.
-
getVerticesSizeInBytes
public int getVerticesSizeInBytes()
The total size of all vertices in bytes
-
fromMesh
public static TriMesh fromMesh(VertexDeclaration declaration, Mesh mesh)
Create a TriMesh from given mesh object with given vertex layout.- Parameters:
declaration
-mesh
-
-
fromMesh
public static TriMesh fromMesh(Mesh mesh, boolean useFloat)
Create a TriMesh from given mesh object, the vertex declaration are based on the input mesh's structure.
-
fromMesh
public static TriMesh fromMesh(Mesh mesh)
Create a TriMesh from given mesh object, the vertex declaration are based on the input mesh's structure.
-
beginVertex
public Vertex beginVertex()
Begin adding vertex- Returns:
- The reference of internal vertex object in type
Vertex
-
endVertex
public void endVertex()
End adding vertex
-
writeVerticesTo
public void writeVerticesTo(com.aspose.csporter.helpers.Stream stream) throws java.io.IOException
Write vertices data to the specified stream- Parameters:
stream
- The stream that the vertices data will be written to- Throws:
java.io.IOException
-
write16bIndicesTo
public void write16bIndicesTo(com.aspose.csporter.helpers.Stream stream) throws java.io.IOException
Write the indices data as 16bit integer to the stream- Parameters:
stream
-- Throws:
java.io.IOException
-
write32bIndicesTo
public void write32bIndicesTo(com.aspose.csporter.helpers.Stream stream) throws java.io.IOException
Write the indices data as 32bit integer to the stream- Parameters:
stream
-- Throws:
java.io.IOException
-
verticesToArray
public byte[] verticesToArray()
Convert the vertices data to byte array
-
indicesToArray
public void indicesToArray(short[][] result)
Convert the indices to 16bit integer array- Parameters:
result
-
-
indicesToArray
public void indicesToArray(int[][] result)
Convert the indices to 32bit integer array- Parameters:
result
-
-
toString
public java.lang.String toString()
Gets the string representation ofTriMesh
- Overrides:
toString
in classjava.lang.Object
-
-