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)
Parameter | Description |
---|---|
geometry | Shared pointer to a geometry instance. |
material | Shared 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)
Parameter | Description |
---|---|
geometry | Shared pointer to a geometry instance. |
material | Shared pointer to a material instance. |
Creates a shared pointer to a Mesh object.
Functions
cpp
std::shared_ptr< Geometry > vglx::Mesh::GetGeometry() override
Returns the geometry associated with this mesh.
cpp
std::shared_ptr< Material > vglx::Mesh::GetMaterial() override
Returns the material associated with this mesh.
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)
Parameter | Description |
---|---|
geometry | Shared 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)
Parameter | Description |
---|---|
material | Shared pointer to the new material. |
Sets the material used to render this mesh.