Physics Simulation & Visualization Tool 0.1
A C++ physics simulation engine with real-time 3D visualization
Loading...
Searching...
No Matches
IDrawable Interface Referenceabstract

Base interface for all renderable objects in the scene. More...

#include <IDrawable.h>

Inheritance diagram for IDrawable:
[legend]

Public Member Functions

virtual ~IDrawable ()=default
 Virtual destructor for proper cleanup of derived classes.
 
virtual ShadergetShader () const =0
 Gets the shader used to render this object.
 
virtual MeshgetMesh () const =0
 Gets the mesh geometry for this object.
 
virtual uint32_t getObjectID () const =0
 Gets the unique identifier for this object.
 

Detailed Description

Base interface for all renderable objects in the scene.

IDrawable defines the minimal contract for objects that can be rendered. It provides access to the core rendering resources (shader, mesh, object ID) without specifying how rendering is performed.

Derived interfaces (IInstancedDrawable, ICustomDrawable) define specific rendering strategies:

This design allows Scene::draw() to efficiently batch compatible objects while supporting specialized rendering when needed.

Note
Objects must implement either IInstancedDrawable or ICustomDrawable, not IDrawable directly.
See also
IInstancedDrawable
ICustomDrawable
Scene::draw()

Definition at line 33 of file IDrawable.h.

Constructor & Destructor Documentation

◆ ~IDrawable()

virtual IDrawable::~IDrawable ( )
virtualdefault

Virtual destructor for proper cleanup of derived classes.

Member Function Documentation

◆ getMesh()

virtual Mesh * IDrawable::getMesh ( ) const
pure virtual

Gets the mesh geometry for this object.

The mesh is used as part of the batch key for instanced rendering, grouping objects that share the same shader and mesh.

Returns
Pointer to the Mesh object. Must not be null.
See also
ResourceManager::getMesh()
Scene::draw()

Implemented in Gizmo, SceneObject, Colliders, Forces, and PathTraces.

◆ getObjectID()

virtual uint32_t IDrawable::getObjectID ( ) const
pure virtual

Gets the unique identifier for this object.

This ID is used for:

  • Object picking and selection
  • Hover state highlighting via shader uniforms
  • Per-instance identification in the rendering pipeline
Returns
The object's unique identifier.
See also
Scene::allocateObjectID()
Scene::freeObjectID()

Implemented in Gizmo, SceneObject, Colliders, Forces, and PathTraces.

Here is the caller graph for this function:

◆ getShader()

virtual Shader * IDrawable::getShader ( ) const
pure virtual

Gets the shader used to render this object.

The shader is used as part of the batch key for instanced rendering, grouping objects that share the same shader and mesh.

Returns
Pointer to the Shader object. Must not be null.
See also
ResourceManager::getShader()
Scene::draw()

Implemented in Gizmo, SceneObject, Colliders, Forces, and PathTraces.


The documentation for this interface was generated from the following file: