from_raw_data method
from_raw_data(, vd, vertices, indices, generate_vertex_mapping)
Create TriMesh from raw data
Returns
The TriMesh
instance that encapsulated the input byte array.
@staticmethod
def from_raw_data(vd, vertices, indices, generate_vertex_mapping):
...
Parameter | Type | Description |
---|---|---|
vd | aspose.threed.utilities.VertexDeclaration | Vertex declaration, must contains at least one field. |
vertices | bytes | The input vertex data, the minimum length of the vertices must be greater or equal to vertex declaration’s size |
indices | list | The triangle indices |
generate_vertex_mapping | bool | Generate Vertex for each vertex, which is not necessary for just serialization/deserialization. |
Remarks
The returned TriMesh will not copy the input byte array for performance, external changes on the array will be reflected to this instance.
Example
The following code shows how to construct a TriMesh from raw bytes, this is useful when build your own 3D format
from aspose.threed.entities import TriMesh
from aspose.threed.utilities import VertexDeclaration, VertexFieldDataType, VertexFieldSemantic
indices = [0, 1, 2 ]
vertices = [ 0, 0, 0, 191, 0, 0, 0, 0, 0, 0, 0, 191, 0, 0, 0, 191, 0, 0, 0, 0, 0, 0, 0, 63, 0, 0, 0, 63, 0, 0, 0, 0, 0, 0, 0, 63
]
vd = VertexDeclaration()
vd.add_field(VertexFieldDataType.F_VECTOR3, VertexFieldSemantic.POSITION)
triMesh = TriMesh.from_raw_data(vd, vertices, indices, True)
See Also
- module
aspose.threed.entities
- class
TriMesh
- class
Vertex