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

Interface for objects with specialized rendering requirements. More...

#include <IDrawable.h>

Inheritance diagram for ICustomDrawable:
[legend]
Collaboration diagram for ICustomDrawable:
[legend]

Public Member Functions

virtual void draw () const =0
 Performs custom rendering for this object.
 
- Public Member Functions inherited from IDrawable
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

Interface for objects with specialized rendering requirements.

Objects implementing this interface have full control over their rendering process. This is used for objects that:

  • Cannot be efficiently batched (e.g., Gizmos with dynamic geometry)
  • Require special rendering state (e.g., depth testing disabled)
  • Need custom draw logic (e.g., multiple passes, compute shaders)

Custom drawables bypass the instancing system and are rendered individually after all instanced objects.

Warning
Custom rendering has higher overhead than instanced rendering. Use IInstancedDrawable when possible.

Example usage:

class Gizmo : public ICustomDrawable {
void draw() const override {
glDisable(GL_DEPTH_TEST);
shader->use();
mesh->drawInstanced(handleInstances);
glEnable(GL_DEPTH_TEST);
}
};
Interactive 3D manipulation widget for transforming scene objects.
Definition Gizmo.h:62
Interface for objects with specialized rendering requirements.
Definition IDrawable.h:181
See also
Scene::draw()
Gizmo

Definition at line 181 of file IDrawable.h.

Member Function Documentation

◆ draw()

virtual void ICustomDrawable::draw ( ) const
pure virtual

Performs custom rendering for this object.

Implementations are responsible for:

  • Binding appropriate shaders and setting uniforms
  • Managing OpenGL state (depth testing, blending, etc.)
  • Issuing draw calls (direct or instanced)
  • Restoring OpenGL state if modified

This method is called after all instanced objects are rendered.

Note
The camera matrices uniform buffer is already bound when called.
See also
Scene::draw()

Implemented in Gizmo, Colliders, Forces, and PathTraces.


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