SCM Library
Spherical Cube Map rendering library
|
An scm_sphere generates the adaptive rendered geometry of the 3D sphere. More...
#include <scm-sphere.hpp>
Public Member Functions | |
scm_sphere (int d, int l) | |
Create a new spherical geometry rendering object. Initialize the necessary OpenGL vertex buffer object state. More... | |
~scm_sphere () | |
Finalize all OpenGL state. | |
void | set_detail (int d) |
Set the geometric detail of the sphere. Each page will be rendered as a d-by-d grid. This value is limited to the range 0 to 256, which ensures that the vertex index count is a 16-bit number. Changing the detail will trigger a regeneration of the sphere's vertex buffer object data, so it should not be done every frame. | |
void | set_limit (int l) |
Set the subdivision limit in pixels. That is, if the on-screen size of a page exceeds l then it will be drawn as four sub-pages. The proper value for this parameter depends upon the format of the SCM data rendered. | |
int | get_detail () const |
int | get_limit () const |
void | prep (scm_scene *, const double *, int, int, int, bool) |
Prepare to render the sphere. Perform all visibility and subdivision calculations. Cache the results for use by a subsequent draw call. More... | |
void | draw (scm_scene *, const double *, int, int, int, int) |
Render the sphere using cached visibility and subdivision state. More... | |
void | set_zoom (double x, double y, double z, double k) |
Set the direction and magnitude of the zoom. | |
An scm_sphere generates the adaptive rendered geometry of the 3D sphere.
The sphere performs all visibility testing and subdivision necessary to optimally render a given scene. Detail and limit parameters tune this facility. Optional zoom direction and degree are maintained if needed.
scm_sphere::scm_sphere | ( | int | d, |
int | l | ||
) |
Create a new spherical geometry rendering object. Initialize the necessary OpenGL vertex buffer object state.
d | Detail with which sphere pages are drawn (in vertices) |
l | Limit at which sphere pages are subdivided (in pixels) |
void scm_sphere::prep | ( | scm_scene * | scene, |
const double * | M, | ||
int | width, | ||
int | height, | ||
int | channel, | ||
bool | zoom | ||
) |
Prepare to render the sphere. Perform all visibility and subdivision calculations. Cache the results for use by a subsequent draw call.
scene | Scene giving the data to be rendered |
M | Model-view-projection matrix in OpenGL column-major order |
width | Width of the render target (in pixels) |
height | Height of the render target (in pixels) |
channel | Channel index (e.g. 0 for left eye, 1 for right eye) |
zoom | Is zooming enabled? |
void scm_sphere::draw | ( | scm_scene * | scene, |
const double * | M, | ||
int | width, | ||
int | height, | ||
int | channel, | ||
int | frame | ||
) |
Render the sphere using cached visibility and subdivision state.
scene | Scene giving the data to be rendered |
M | Model-view-projection matrix in OpenGL column-major order |
width | Width of the render target (in pixels) |
height | Height of the render target (in pixels) |
channel | Channel index (e.g. 0 for left eye, 1 for right eye) |
frame | Frame number (for cache line aging) |