Skip to content

Mesh

Renderable node that draws a [Geometry](/reference/geometries/geometry) with a [Material](/reference/materials/material).

Mesh is a scene node that owns a geometry and a material and exposes them through the Renderable interface so the renderer can process and draw it.

An optional wireframe geometry can be provided for debug rendering.

cpp
auto geometry = vglx::BoxGeometry::Create();
auto material = vglx::UnlitMaterial::Create(0x00FFAA);
auto mesh = vglx::Mesh::Create(geometry, material);
my_scene->Add(mesh);

Construction

Constructors


Mesh()

cpp
vglx::Mesh::Mesh(std::shared_ptr< Geometry > geometry, std::shared_ptr< Material > material)
ParameterDescription
geometryShared pointer to a geometry instance.
materialShared pointer to a material instance.

Constructs a mesh instance with the given geometry and material.

Factories preferred


Mesh::Create() auto

cpp
static auto vglx::Mesh::Create(std::shared_ptr< Geometry > geometry, std::shared_ptr< Material > material)
ParameterDescription
geometryShared pointer to a geometry instance.
materialShared pointer to a material instance.

Creates a shared pointer to a Mesh object.

Functions

GetGeometry() std::shared_ptr<Geometry>

cpp
std::shared_ptr< Geometry > vglx::Mesh::GetGeometry() override

Returns the geometry associated with this mesh.

GetMaterial() std::shared_ptr<Material>

cpp
std::shared_ptr< Material > vglx::Mesh::GetMaterial() override

Returns the material associated with this mesh.

GetNodeType() Node::Type

cpp
Node::Type vglx::Mesh::GetNodeType() const override

Returns node type.

GetWireframeGeometry() std::shared_ptr<Geometry>

cpp
std::shared_ptr< Geometry > vglx::Mesh::GetWireframeGeometry()

Returns the wireframe version of the mesh geometry.

SetGeometry() void

cpp
void vglx::Mesh::SetGeometry(std::shared_ptr< Geometry > geometry)
ParameterDescription
geometryShared pointer to the new geometry.

Sets the geometry used to render this mesh.

SetMaterial() auto

cpp
auto vglx::Mesh::SetMaterial(std::shared_ptr< Material > material)
ParameterDescription
materialShared pointer to the new material.

Sets the material used to render this mesh.

Released under the MIT License.