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