PlottingOpenGL::SceneRenderer
PlottingOpenGL::SceneRenderer
Coordinates rendering of a complete RenderableScene. More…
#include <SceneRenderer.hpp>
Public Types
| Name | |
|---|---|
| enum class | BatchType { Rectangle, PolyLine, Glyph} Set the rendering order for batch types. |
Public Functions
| Name | |
|---|---|
| SceneRenderer() | |
| ~SceneRenderer() | |
| SceneRenderer(SceneRenderer const & ) =delete | |
| SceneRenderer & | operator=(SceneRenderer const & ) =delete |
| SceneRenderer(SceneRenderer && ) =delete | |
| SceneRenderer & | operator=(SceneRenderer && ) =delete |
| bool | initialize() Initialize all batch renderers. |
| void | cleanup() Release all GPU resources. |
| bool | isInitialized() const Check if all renderers are initialized. |
| void | uploadScene(CorePlotting::RenderableScene const & scene) Upload a complete scene for rendering. |
| void | clearScene() Clear all uploaded scene data. |
| void | render() Render the current scene. |
| void | render(glm::mat4 const & view_matrix, glm::mat4 const & projection_matrix) Render with explicit View/Projection matrices. |
| void | setRenderOrder(std::vector< BatchType > const & order) |
| PolyLineRenderer & | polyLineRenderer() |
| GlyphRenderer & | glyphRenderer() |
| RectangleRenderer & | rectangleRenderer() |
| PreviewRenderer & | previewRenderer() |
| void | renderPreview(CorePlotting::Interaction::GlyphPreview const & preview, int viewport_width, int viewport_height) Render an interactive preview overlay. |
Detailed Description
class PlottingOpenGL::SceneRenderer;Coordinates rendering of a complete RenderableScene.
See: CorePlotting::RenderableScene
SceneRenderer is the main entry point for rendering CorePlotting scenes using OpenGL. It manages the lifecycle of individual batch renderers and orchestrates the rendering of all primitives in a scene.
Usage:
// In initializeGL():
SceneRenderer renderer;
renderer.initialize();
// When scene data changes:
renderer.uploadScene(scene);
// In paintGL():
renderer.render();
// Before context destruction:
renderer.cleanup();The SceneRenderer holds the View and Projection matrices from the scene and passes them to each batch renderer along with the batch’s Model matrix.
Public Types Documentation
enum BatchType
| Enumerator | Value | Description |
|---|---|---|
| Rectangle | ||
| PolyLine | ||
| Glyph |
Set the rendering order for batch types.
By default, the order is: Rectangles -> PolyLines -> Glyphs (back to front, so rectangles are behind lines and points).
Public Functions Documentation
function SceneRenderer
SceneRenderer()function ~SceneRenderer
~SceneRenderer()function SceneRenderer
SceneRenderer(
SceneRenderer const &
) =deletefunction operator=
SceneRenderer & operator=(
SceneRenderer const &
) =deletefunction SceneRenderer
SceneRenderer(
SceneRenderer &&
) =deletefunction operator=
SceneRenderer & operator=(
SceneRenderer &&
) =deletefunction initialize
bool initialize()Initialize all batch renderers.
Return: true if all renderers initialized successfully
Must be called with a valid OpenGL context.
function cleanup
void cleanup()Release all GPU resources.
Should be called before the OpenGL context is destroyed.
function isInitialized
bool isInitialized() constCheck if all renderers are initialized.
function uploadScene
void uploadScene(
CorePlotting::RenderableScene const & scene
)Upload a complete scene for rendering.
Parameters:
- scene The scene to upload
This distributes the scene’s batches to the appropriate renderers and stores the View/Projection matrices.
function clearScene
void clearScene()Clear all uploaded scene data.
function render
void render()Render the current scene.
Draws all uploaded batches using the stored View/Projection matrices. Call this in your paintGL() or equivalent.
function render
void render(
glm::mat4 const & view_matrix,
glm::mat4 const & projection_matrix
)Render with explicit View/Projection matrices.
Parameters:
- view_matrix Camera/view transformation
- projection_matrix Projection to NDC
Overrides the stored matrices for this render call only. Useful for rendering the same scene from different viewpoints.
function setRenderOrder
void setRenderOrder(
std::vector< BatchType > const & order
)function polyLineRenderer
inline PolyLineRenderer & polyLineRenderer()function glyphRenderer
inline GlyphRenderer & glyphRenderer()function rectangleRenderer
inline RectangleRenderer & rectangleRenderer()function previewRenderer
inline PreviewRenderer & previewRenderer()function renderPreview
void renderPreview(
CorePlotting::Interaction::GlyphPreview const & preview,
int viewport_width,
int viewport_height
)Render an interactive preview overlay.
Parameters:
- preview The preview geometry to render
- viewport_width Width of the viewport in pixels
- viewport_height Height of the viewport in pixels
Call this after render() to draw interactive preview geometry (drag rectangles, selection lines, etc.) on top of the scene.
Updated on 2026-11-13 at 20:25:41 +0000