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: VertexElementMaterialVertexElement

The VertexElementMaterial type exposes the following members:

Constructors

ConstructorDescription
__init__(self)Initializes a new instance of the VertexElementMaterial class.

Properties

PropertyDescription
vertex_element_typeGets the type of the VertexElement
nameGets or sets the name.
mapping_modeGets or sets how the element is mapped.
reference_modeGets or sets how the element is referenced.
indicesGets the indices data

Methods

MethodDescription
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