SCM Library
Spherical Cube Map rendering library
 All Classes Files Functions Variables Friends Pages
Public Member Functions | List of all members
scm_sphere Class Reference

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.
 

Detailed Description

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.

Constructor & Destructor Documentation

scm_sphere::scm_sphere ( int  d,
int  l 
)

Create a new spherical geometry rendering object. Initialize the necessary OpenGL vertex buffer object state.

Parameters
dDetail with which sphere pages are drawn (in vertices)
lLimit at which sphere pages are subdivided (in pixels)

Member Function Documentation

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.

Parameters
sceneScene giving the data to be rendered
MModel-view-projection matrix in OpenGL column-major order
widthWidth of the render target (in pixels)
heightHeight of the render target (in pixels)
channelChannel index (e.g. 0 for left eye, 1 for right eye)
zoomIs 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.

Parameters
sceneScene giving the data to be rendered
MModel-view-projection matrix in OpenGL column-major order
widthWidth of the render target (in pixels)
heightHeight of the render target (in pixels)
channelChannel index (e.g. 0 for left eye, 1 for right eye)
frameFrame number (for cache line aging)

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