SCM Library
Spherical Cube Map rendering library
|
An scm_image represents an SCM data file in use by an scm_scene. More...
#include <scm-image.hpp>
Public Member Functions | |
scm_image (scm_system *) | |
Initialize a new empty image for use in the given SCM system. | |
~scm_image () | |
Finalize this image's SCM file. | |
Configuration modifiers | |
void | set_scm (const std::string &s) |
Configure this image to read data from the named SCM file. More... | |
void | set_name (const std::string &s) |
Set the name by which GLSL sampler uniforms may access this image. More... | |
void | set_channel (int c) |
Set the channel index for this image. More... | |
void | set_normal_min (float k) |
Set the input value to be mapped onto 0 in the output. | |
void | set_normal_max (float k) |
Set the input value to be mapped onto 1 in the output. | |
Configuration queries | |
const std::string & | get_scm () const |
const std::string & | get_name () const |
int | get_channel () const |
float | get_normal_min () const |
float | get_normal_max () const |
bool | is_channel (int c) const |
bool | is_height () const |
Internal Interface | |
void | init_uniforms (GLuint) |
Request and store GLSL uniform locations for this image's parameters. | |
void | bind (GLuint, GLuint) const |
Set all GLSL uniform values for this image and bind the cache's texture. | |
void | unbind (GLuint) const |
Unbind the cache's texture by binding the texture unit to zero. | |
void | bind_page (GLuint, int, int, long long) const |
Set the GLSL uniforms necessary to map a page of texture data. More... | |
void | unbind_page (GLuint, int) const |
Set the texture mapping uniforms to reference cache line zero (which is always blank). | |
void | touch_page (int, long long) const |
Set the last-used time of a page. | |
float | get_page_sample (const double *) const |
Sample this image at the given location, returning a normalized result. More... | |
void | get_page_bounds (long long, float &, float &) const |
Determine the minimum and maximum values of one page, returning a normalized result. More... | |
bool | get_page_status (long long) const |
Return true if a page is present in this image. More... | |
An scm_image represents an SCM data file in use by an scm_scene.
This object is largely responsible for mapping SCM data onto OpenGL state, including OpenGL textures and GLSL uniforms. Notably, this includes those parameters mapping texture coordinates onto a scm_cache texture atlas.
void scm_image::set_scm | ( | const std::string & | s | ) |
Configure this image to read data from the named SCM file.
This method can have ripple effects throughout the SCM system...
void scm_image::set_name | ( | const std::string & | s | ) |
Set the name by which GLSL sampler uniforms may access this image.
The name "height" indicates that this image gives height map data, and that an subsequent ground-level queries may use this image.
void scm_image::set_channel | ( | int | c | ) |
Set the channel index for this image.
In this case "channel" indicates left-eye (0), right-eye (1), etc. rather than red (0), green (1), or similar.
void scm_image::bind_page | ( | GLuint | program, |
int | d, | ||
int | t, | ||
long long | i | ||
) | const |
Set the GLSL uniforms necessary to map a page of texture data.
program | GLSL program object |
d | SCM page depth. |
t | Current time |
i | SCM page index. |
float scm_image::get_page_sample | ( | const double * | v | ) | const |
Sample this image at the given location, returning a normalized result.
void scm_image::get_page_bounds | ( | long long | i, |
float & | r0, | ||
float & | r1 | ||
) | const |
Determine the minimum and maximum values of one page, returning a normalized result.
bool scm_image::get_page_status | ( | long long | i | ) | const |
Return true if a page is present in this image.