SPH
Public Member Functions | List of all members
ParticleRenderer Class Reference

#include <ParticleRenderer.h>

Inheritance diagram for ParticleRenderer:
IRenderer Polymorphic

Public Member Functions

 ParticleRenderer (const GuiSettings &settings)
 
virtual void initialize (const Storage &storage, const IColorizer &colorizer, const ICamera &camera) override
 Prepares the objects for rendering and updates its data. More...
 
virtual bool isInitialized () const override
 Checks if the renderer has been initialized. More...
 
virtual void render (const RenderParams &params, Statistics &stats, IRenderOutput &output) const override
 Draws particles into the bitmap, given the data provided in initialize. More...
 
virtual void cancelRender () override
 Stops the rendering if it is currently in progress. More...
 
- Public Member Functions inherited from Polymorphic
virtual ~Polymorphic ()
 

Detailed Description

Definition at line 26 of file ParticleRenderer.h.

Constructor & Destructor Documentation

◆ ParticleRenderer()

ParticleRenderer::ParticleRenderer ( const GuiSettings settings)
explicit

Definition at line 190 of file ParticleRenderer.cpp.

Member Function Documentation

◆ cancelRender()

void ParticleRenderer::cancelRender ( )
overridevirtual

Stops the rendering if it is currently in progress.

Implements IRenderer.

Definition at line 387 of file ParticleRenderer.cpp.

◆ initialize()

void ParticleRenderer::initialize ( const Storage storage,
const IColorizer colorizer,
const ICamera camera 
)
overridevirtual

Prepares the objects for rendering and updates its data.

Called every time a parameter changes. Renderer should cache any data necessary for rendering of particles (particle positions, colors, etc.).

Parameters
storageStorage containing positions of particles, must match the particles in colorizer.
colorizerData-to-color conversion object for particles. Must be already initialized!
cameraCamera used for rendering.
Todo:
could be changed to AOS to sort only once

Implements IRenderer.

Definition at line 199 of file ParticleRenderer.cpp.

◆ isInitialized()

bool ParticleRenderer::isInitialized ( ) const
overridevirtual

Checks if the renderer has been initialized.

Implements IRenderer.

Definition at line 269 of file ParticleRenderer.cpp.

◆ render()

void ParticleRenderer::render ( const RenderParams params,
Statistics stats,
IRenderOutput output 
) const
overridevirtual

Draws particles into the bitmap, given the data provided in initialize.

This function is called every time the view changes (display parameters change, camera pan & zoom, ...). Implementation shall be callable from any thread, but does not have to be thread-safe (never will be executed from multiple threads at once).

Parameters
paramsParameters of the render
statsInput-output parameter, contains run statistics that can be included in the render (run time, timestep, ...), renderers can also output some statistics of their own (time used in rendering, framerate, ...)

Implements IRenderer.

Definition at line 290 of file ParticleRenderer.cpp.

Member Data Documentation

◆ cameraDir

Vector ParticleRenderer::cameraDir

Camera direction for which the cached values have been sorted.

Definition at line 49 of file ParticleRenderer.h.

◆ colors

Array<Rgba> ParticleRenderer::colors

Colors of particles assigned by the colorizer.

Definition at line 40 of file ParticleRenderer.h.

◆ idxs

Array<Size> ParticleRenderer::idxs

Indices (in parent storage) of particles.

Definition at line 37 of file ParticleRenderer.h.

◆ palette

Optional<Palette> ParticleRenderer::palette

Color palette or NOTHING if no palette is drawn.

Definition at line 46 of file ParticleRenderer.h.

◆ positions

Array<Vector> ParticleRenderer::positions

Positions of particles.

Definition at line 34 of file ParticleRenderer.h.

◆ vectors

Array<Vector> ParticleRenderer::vectors

Vectors representing the colorized quantity. May be empty.

Definition at line 43 of file ParticleRenderer.h.


The documentation for this class was generated from the following files: