Skip to content

Mesh

Renderable node that draws a Geometry with a 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()

Constructs a mesh instance with the given geometry and material.

cpp
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.

Factories preferred


Mesh::Create() auto

Creates a shared pointer to a Mesh object.

cpp
static auto 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.

Functions

GetGeometry() std::shared_ptr<Geometry>

Returns the geometry associated with this mesh.

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

GetMaterial() std::shared_ptr<Material>

Returns the material associated with this mesh.

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

GetNodeType() Node::Type

Returns node type.

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

GetWireframeGeometry() std::shared_ptr<Geometry>

Returns the wireframe version of the mesh geometry.

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

SetGeometry() void

Sets the geometry used to render this mesh.

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

SetMaterial() auto

Sets the material used to render this mesh.

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

Released under the MIT License.