Partilhar via


Class MeshComponent

Renders a mesh at the position of the Entity.

The referenced MeshComponent.Mesh is rendered at the location of the owner entity. The mesh component also allows to override the materials that are used for rendering. If the mesh has been converted with collision information, it will also participate in spatial queries.

class Microsoft::Azure::RemoteRendering::MeshComponent final : public Microsoft::Azure::RemoteRendering::ComponentBase

Methods

SetMaterial

Sets an override material for a given material slot.

A Result.IndexOutOfRange error occurs if 'idx' is outside the valid range.

auto SetMaterial(int32_t idx, ApiHandle<Microsoft::Azure::RemoteRendering::Material> const& material) noexcept -> Microsoft::Azure::RemoteRendering::Status;

Parameters

Name Type Description
idx int A valid index into the array.
material Material The material to set as the override. Passing null clears any previous override, such that the mesh's default material is used again.

Properties

Materials

Returns the list of materials set on this component.

These are materials that were specifically set to override the default mesh materials, through SetMaterial(). The array will always be the same size as Mesh.Materials, however, entries for which no override is set, will be null.

auto GetMaterials(std::vector<ApiHandle<Microsoft::Azure::RemoteRendering::Material>> & out) const noexcept -> void;

See also

Mesh

The Mesh used for rendering and spatial queries.

auto GetMesh() const noexcept -> ApiHandle<Microsoft::Azure::RemoteRendering::Mesh>;
auto SetMesh(ApiHandle<Microsoft::Azure::RemoteRendering::Mesh> const& value) noexcept -> Microsoft::Azure::RemoteRendering::Status;

UsedMaterials

Returns the list of actually used materials for rendering the mesh.

The array will either contain the override material (MeshComponent.Materials) or, if no override was set, the default material of the referenced MeshComponent.Mesh.

auto GetUsedMaterials(std::vector<ApiHandle<Microsoft::Azure::RemoteRendering::Material>> & out) const noexcept -> void;

See also

See also