Skip to content

Renderable ​

Base class for scene nodes that can be drawn.

Renderable extends Node with the interface the renderer needs to issue a draw call: a Geometry, a Material, and bounding volumes used for visibility culling. It is the common base for all drawable node types, such as Mesh, InstancedMesh, and Billboard.

This class is not instantiated directly. Use one of the concrete renderable types, or derive from it to implement a custom drawable.

INFO

Derives from Node and inherits all public properties and methods.

Properties ​

cast_shadow bool ​

When true this object casts shadows onto shadow receivers.

cpp
bool cast_shadow {false};

frustum_culled bool ​

When true this object participates in view frustum culling.

cpp
bool frustum_culled {true};

receive_shadow bool ​

When true this object receives shadows from shadow casters.

cpp
bool receive_shadow {false};

render_order int ​

Explicit draw-order override within a render pass.

Objects with a lower value are drawn first. Objects that share a value fall back to the pass's distance-based sort: front-to-back for opaque objects and back-to-front for transparent ones. Useful for layering objects that render without depth testing.

cpp
int render_order {0};

Functions ​

BoundingBox() Box3 virtual ​

Returns the object's bounding box.

Defaults to the bounding box of the object's geometry. Subclasses override this when their effective bounds differ, such as InstancedMesh.

cpp
virtual Box3 Renderable::BoundingBox();

BoundingSphere() Sphere virtual ​

Returns the object's bounding sphere.

Defaults to the bounding sphere of the object's geometry. Subclasses override this when their effective bounds differ.

cpp
virtual Sphere Renderable::BoundingSphere();

CanRender() bool ​

Returns true if this object has everything it needs to be drawn.

Checks that the object has a geometry with vertex positions, a material, and that the material type is compatible with the node type.

cpp
bool Renderable::CanRender() const;

GetGeometry() std::shared_ptr<Geometry> pure virtual ​

Returns the geometry used to draw this object.

cpp
virtual std::shared_ptr<Geometry> Renderable::GetGeometry() const=0;

GetMaterial() std::shared_ptr<Material> pure virtual ​

Returns the material used to draw this object.

cpp
virtual std::shared_ptr<Material> Renderable::GetMaterial() const=0;

GetNodeType() Node::Type virtual ​

Identifies this node as Node::Type::Renderable.

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

InFrustum() bool ​

Returns true if this object's world-space bounds intersect the frustum.

cpp
bool Renderable::InFrustum(const Frustum& frustum);
ParameterDescription
frustumFrustum to test against in world space.

IsRenderable() bool virtual ​

Returns true, identifying this node as renderable.

cpp
bool Renderable::IsRenderable() const override;

Released under the MIT License.