SCM Library
Spherical Cube Map rendering library
|
An scm_render manages the rendering of background and foreground spheres. More...
#include <scm-render.hpp>
Public Member Functions | |
scm_render (int, int) | |
Create a new render manager. Initialize the necessary OpenGL state framebuffer object state. More... | |
~scm_render () | |
Finalize all OpenGL state. | |
void | set_size (int, int) |
Set the size of the off-screen render targets. This entails the destruction and recreation of OpenGL framebuffer objects, so it should not be called every frame. | |
void | set_blur (int) |
Set the motion blur degree. Higher degrees incur greater rendering loads. 8 is an effective value. Set 0 to disable motion blur completely. | |
void | set_wire (bool) |
Set the wireframe option. | |
int | get_blur () const |
bool | get_wire () const |
void | render (scm_sphere *, scm_scene *, scm_scene *, scm_scene *, scm_scene *, const double *, const double *, int, int, double) |
Render the foreground and background with optional blur and dissolve. More... | |
void | render (scm_sphere *, scm_scene *, scm_scene *, const double *, const double *, int, int) |
Render the foreground and background spheres without blur or dissolve. More... | |
An scm_render manages the rendering of background and foreground spheres.
In the simplest case, this entails merely invoking the scm_sphere's render function to draw geometry to the screen. However, the render manager also supports motion blur and dissolve transitions. These features require the sphere to be rendered first to an off-screen buffer which is then drawn to the screen as a single rectangle with the appropriate shader enabled.
The render manager also maintains the wireframe debug option, which would otherwise conflict with more sophisticated capabilities.
scm_render::scm_render | ( | int | w, |
int | h | ||
) |
Create a new render manager. Initialize the necessary OpenGL state framebuffer object state.
Motion blur is disabled (set to zero) by default.
w | Width of the off-screen render targets (in pixels). |
h | Height of the off-screen render targets (in pixels). |
void scm_render::render | ( | scm_sphere * | sphere, |
scm_scene * | fore0, | ||
scm_scene * | fore1, | ||
scm_scene * | back0, | ||
scm_scene * | back1, | ||
const double * | P, | ||
const double * | M, | ||
int | channel, | ||
int | frame, | ||
double | t | ||
) |
Render the foreground and background with optional blur and dissolve.
sphere | Sphere geometry manager to perform the rendering |
fore0 | Foreground scene at the beginning of a dissolve |
fore1 | Foreground scene at the end of a dissolve |
back0 | Background scene at the beginning of a dissolve |
back1 | Background scene at the end of a dissolve |
P | Projection matrix in OpenGL column-major order |
M | Model-view matrix in OpenGL column-major order |
channel | Channel index |
frame | Frame number |
t | Dissolve time between 0 and 1 |
void scm_render::render | ( | scm_sphere * | sphere, |
scm_scene * | fore, | ||
scm_scene * | back, | ||
const double * | P, | ||
const double * | M, | ||
int | channel, | ||
int | frame | ||
) |
Render the foreground and background spheres without blur or dissolve.
This function is usually called by the previous function as needed to produce the desired effects. Calling it directly is a legitimate means of circumventing these options.
sphere | Sphere geometry manager to perform the rendering |
fore | Foreground scene |
back | Background scene |
P | Projection matrix in OpenGL column-major order |
M | Model-view matrix in OpenGL column-major order |
channel | Channel index |
frame | Frame number |