Mesh
Mesh represents a draw call in the scene: it owns a shared pointer to a Geometry and a Material and exposes them through the renderable interface. The renderer queries meshes for their geometry, material, and world transform, then issues the appropriate GPU commands. Meshes can also lazily generate a wireframe representation for debugging.
auto geometry = vglx::BoxGeometry::Create();
auto material = vglx::UnlitMaterial::Create(0x00FFAA);
my_scene->Add(vglx::Mesh::Create(geometry, material));Construction
Constructors
Mesh()
Constructs a mesh.
Mesh::Mesh(std::shared_ptr<Geometry> geometry, std::shared_ptr<Material> material);| Parameter | Description |
|---|---|
| geometry | Shared pointer to the mesh geometry. |
| material | Shared pointer to the material used for rendering. |
Factories preferred
Creates an instance of Mesh.
static std::unique_ptr<Mesh> Mesh::Create(std::shared_ptr<Geometry> geometry, std::shared_ptr<Material> material);| Parameter | Description |
|---|---|
| geometry | Shared pointer to the mesh geometry. |
| material | Shared pointer to the material used for rendering. |
Functions
Returns the geometry used by this mesh.
std::shared_ptr<Geometry> Mesh::GetGeometry() const override;Returns the material used by this mesh.
std::shared_ptr<Material> Mesh::GetMaterial() const override;GetNodeType() Node::Type
Identifies this node as Node::Type::Mesh.
Type vglx::Mesh::GetNodeType() const override;Returns a wireframe representation of the current geometry.
The wireframe geometry is generated on first use from the mesh's triangle-based geometry and cached for subsequent calls.
std::shared_ptr<Geometry> Mesh::GetWireframeGeometry();SetGeometry() void
Replaces the geometry used by this mesh.
void Mesh::SetGeometry(std::shared_ptr<Geometry> geometry);| Parameter | Description |
|---|---|
| geometry | New geometry to assign. |
SetMaterial() void
Replaces the material used by this mesh.
void Mesh::SetMaterial(std::shared_ptr<Material> material);| Parameter | Description |
|---|---|
| material | New material to assign. |