raisin::example::Capture
class · #include <rayrai/example_common.hpp>
Captures what an example renders, as the environment asks, for documentation and tests.
- RAYRAI_EXAMPLE_CAPTURE: a .png file saves one frame; any other path is a folder that receives frame_000.png, frame_001.png, ... The example quits once the capture is written.
- RAYRAI_EXAMPLE_CAPTURE_SIZE: window and image size, WIDTHxHEIGHT. A capturing window is never scaled for high-DPI displays, so its images are in pixels of the window size.
- RAYRAI_EXAMPLE_CAPTURE_START: frames rendered before the first capture (default 3), counted once the viewer has no meshes left to load.
- RAYRAI_EXAMPLE_CAPTURE_FRAMES: frames in a folder capture (default 60).
- RAYRAI_EXAMPLE_CAPTURE_EVERY: capture every N-th rendered frame (default 1).
- RAYRAI_EXAMPLE_CAPTURE_SWAY: the camera swings by up to this many radians about the vertical through the point RAYRAI_EXAMPLE_CAPTURE_PIVOT metres (default 3) ahead of it, one full swing over the capture, so the frames loop. A camera that orbits a target or follows an object swings about that point instead.
- RAYRAI_EXAMPLE_CAPTURE_WINDOW=1: save the whole window, panels included, instead of the viewer image. An example that draws no viewer image always saves its window.
Constructors & destructor
Capture
cpp
Capture()Public member functions
active
cpp
bool active() constTrue when the environment asked for a capture.
wholeWindow
cpp
bool wholeWindow() constTrue when the whole window is saved instead of the viewer image.
applySize
cpp
void applySize(int &width, int &height) constReplace a requested window size with the capture size, if one is set.
beforeRender
cpp
void beforeRender(raisin::Camera &camera)Swing the camera for the frame about to be rendered.
afterRender
cpp
bool afterRender(raisin::Camera &camera, bool loading=false)Save the frame just rendered when it is due.
Parameters
| Parameter | Description |
|---|---|
loading | The viewer still loads meshes: the frame does not count towards the start. |
Returns True once the capture is complete.
afterWindowRender
cpp
bool afterWindowRender(SDL_Window *window, bool loading=false)Like afterRender(), saving the window's back buffer; call it before the swap.