SCM Library
Spherical Cube Map rendering library
|
An scm_scene encapsulates the definition of a sphere and its parameters. More...
#include <scm-scene.hpp>
Public Member Functions | |
scm_scene (scm_system *) | |
Create a new SCM scene for use in the given SCM system. | |
~scm_scene () | |
Finalize all SCM scene state. | |
Image collection handlers | |
int | add_image (int i) |
Allocate and insert a new image before index i. Return its index. | |
void | del_image (int i) |
Delete the image at index i. | |
scm_image * | get_image (int i) |
Return a pointer to the image at index i. | |
int | get_image_count () const |
Return the number of images in the collection. | |
Configuration | |
void | set_color (GLuint c) |
Set the label color. More... | |
void | set_name (const std::string &s) |
Set the scene name. | |
void | set_label (const std::string &s) |
Set the label text. More... | |
void | set_vert (const std::string &s) |
Set the vertex shader and reinitialize the uniforms. More... | |
void | set_frag (const std::string &s) |
Set the fragment shader and reinitialize the uniforms. More... | |
Query | |
GLuint | get_color () const |
const std::string & | get_name () const |
const std::string & | get_label () const |
const std::string & | get_vert () const |
const std::string & | get_frag () const |
Internal Interface | |
void | init_uniforms () |
Request and store the uniform locations for the current program. | |
void | draw_label () |
Render the labels for this scene, if any. | |
void | bind (int) const |
Bind the program and all image textures matching the given channel. More... | |
void | unbind (int) const |
Unbind the program and all image textures matching the given channel. More... | |
void | bind_page (int, int, int, long long) const |
Bind a page in each image matching a channel. More... | |
void | unbind_page (int, int) const |
Unbind a page in each image matching a channel. More... | |
void | touch_page (int, int, long long) const |
Touch a page in each image matching a channel. More... | |
float | get_minimum_ground () const |
Return the smallest value in the height image. More... | |
float | get_current_ground (const double *) const |
Sample the height image at the given location. More... | |
void | get_page_bounds (int, long long, float &, float &) const |
Determine the minimum and maximum values of one page of the height image. More... | |
bool | get_page_status (int, long long) const |
Return true if any one of the images has page i in cache. More... | |
Friends | |
class | scm_sphere |
An scm_scene encapsulates the definition of a sphere and its parameters.
This definition consists primarily of a set of scm_image objects plus the vertex and fragment shaders that reference and render them. In addition, an scm_label gives annotations and a name string allows a scene to be requested by name.
void scm_scene::set_color | ( | GLuint | c | ) |
Set the label color.
c | Color in 32-bit RGBA form |
void scm_scene::set_label | ( | const std::string & | s | ) |
Set the label text.
The scm_label object itself is not instantiated until actually used.
s | CSV string giving annotations |
void scm_scene::set_vert | ( | const std::string & | s | ) |
Set the vertex shader and reinitialize the uniforms.
s | GLSL vertex shader source (not file name) |
void scm_scene::set_frag | ( | const std::string & | s | ) |
Set the fragment shader and reinitialize the uniforms.
s | GLSL fragment shader source (not file name) |
void scm_scene::bind | ( | int | channel | ) | const |
Bind the program and all image textures matching the given channel.
void scm_scene::unbind | ( | int | channel | ) | const |
Unbind the program and all image textures matching the given channel.
void scm_scene::bind_page | ( | int | channel, |
int | depth, | ||
int | frame, | ||
long long | i | ||
) | const |
Bind a page in each image matching a channel.
void scm_scene::unbind_page | ( | int | channel, |
int | depth | ||
) | const |
Unbind a page in each image matching a channel.
void scm_scene::touch_page | ( | int | channel, |
int | frame, | ||
long long | i | ||
) | const |
Touch a page in each image matching a channel.
float scm_scene::get_minimum_ground | ( | ) | const |
Return the smallest value in the height image.
float scm_scene::get_current_ground | ( | const double * | v | ) | const |
Sample the height image at the given location.
v | Vector from the center of the planet to the query position. |
void scm_scene::get_page_bounds | ( | int | channel, |
long long | i, | ||
float & | r0, | ||
float & | r1 | ||
) | const |
Determine the minimum and maximum values of one page of the height image.
bool scm_scene::get_page_status | ( | int | channel, |
long long | i | ||
) | const |
Return true if any one of the images has page i in cache.