Orrery
A GPU-accelerated N-body gravitational simulator
Loading...
Searching...
No Matches
orrery::viz::PointRenderer Class Reference

The two-pass point renderer described above. More...

#include <orrery/viz/point_renderer.hpp>

Public Member Functions

 PointRenderer (GlProcedureLoader loader, std::size_t width, std::size_t height)
 Build every OpenGL object the renderer needs, for a target of the given size.
 PointRenderer (const PointRenderer &)=delete
PointRendereroperator= (const PointRenderer &)=delete
 PointRenderer (PointRenderer &&)=delete
PointRendereroperator= (PointRenderer &&)=delete
void resize (std::size_t width, std::size_t height)
 Change the size of the accumulation target.
std::size_t width () const noexcept
std::size_t height () const noexcept
void accumulate (core::Vec3Span< const core::Real > positions, std::span< const float > tints, const Mat4 &view_projection, const RenderSettings &settings)
 Draw the particles into the accumulation target, replacing what was there.
void present (const RenderSettings &settings)
 Tone map the accumulation target onto the default framebuffer, which is the window.
std::size_t radiance_size () const noexcept
 How many floats read_radiance needs, which is three per pixel.
void read_radiance (std::span< float > radiance) const
 Read the accumulated radiance back from the device.
std::string device_description () const
 What the driver calls itself, for the line a run prints about where its frames came from.

Detailed Description

The two-pass point renderer described above.

Constructor & Destructor Documentation

◆ PointRenderer()

orrery::viz::PointRenderer::PointRenderer ( GlProcedureLoader loader,
std::size_t width,
std::size_t height )

Build every OpenGL object the renderer needs, for a target of the given size.

A context must be current on the calling thread. Throws std::runtime_error if an entry point is missing, a shader fails to compile or link, or the framebuffer is incomplete, each with what the driver said about it.

Member Function Documentation

◆ resize()

void orrery::viz::PointRenderer::resize ( std::size_t width,
std::size_t height )

Change the size of the accumulation target.

Does nothing if the size has not changed, which is what makes it safe to call on every frame from a window that reports its size each time.

◆ accumulate()

void orrery::viz::PointRenderer::accumulate ( core::Vec3Span< const core::Real > positions,
std::span< const float > tints,
const Mat4 & view_projection,
const RenderSettings & settings )

Draw the particles into the accumulation target, replacing what was there.

tints selects between the two colours of the settings for each particle and may be empty, which draws everything in the cool colour. If it is not empty it must hold one value per particle.

◆ present()

void orrery::viz::PointRenderer::present ( const RenderSettings & settings)

Tone map the accumulation target onto the default framebuffer, which is the window.

Separate from accumulate because the offline export does not want it: what an exported frame is made from is the accumulated radiance, and it is tone mapped on the host so that the result does not depend on how a driver rounds a fragment shader. ADR-0036.

◆ read_radiance()

void orrery::viz::PointRenderer::read_radiance ( std::span< float > radiance) const

Read the accumulated radiance back from the device.

The first row is the bottom of the picture, which is OpenGL's convention and what tone_map_into calls bottom up.

This is a synchronous read of the whole target and stalls the pipeline. It is what the export path does once per frame and what nothing else should do at all.


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