VertexElementMaterial class
VertexElementMaterial class
Defines material index for specified components.
A node can have multiple materials, the VertexElementMaterial is used to render different part of the geometry in different materials.
Inheritance: VertexElementMaterial →
VertexElement
The VertexElementMaterial type exposes the following members:
Constructors
| Constructor | Description | 
|---|---|
| __init__(self) | Initializes a new instance of the VertexElementMaterialclass. | 
Properties
| Property | Description | 
|---|---|
| vertex_element_type | Gets the type of the VertexElement | 
| name | Gets or sets the name. | 
| mapping_mode | Gets or sets how the element is mapped. | 
| reference_mode | Gets or sets how the element is referenced. | 
| indices | Gets the indices data | 
Methods
| Method | Description | 
|---|---|
| set_indices(self, data) | Load indices | 
| clear(self) | Removes all elements from the direct and the index arrays. | 
Example
The following code shows how to assign different material to different face of a box.
from aspose import pycore
from aspose.threed.entities import Box, MappingMode, ReferenceMode, VertexElementMaterial, VertexElementType
#  Create a mesh of box(A box is composed by 6 planes)
box = Box().to_mesh()
#  Create a material element on this mesh
mat = pycore.cast(VertexElementMaterial, box.create_element(VertexElementType.MATERIAL, MappingMode.POLYGON, ReferenceMode.INDEX))
#  And specify different material index for each plane
mat.indices.extend([0, 1, 2, 3, 4, 5 ])
See Also
- module aspose.threed.entities
- class VertexElement
- class VertexElementMaterial