13 #ifndef SCM_SYSTEM_HPP
14 #define SCM_SYSTEM_HPP
20 #include <SDL_thread.h>
23 #include "scm-step.hpp"
91 typedef std::vector<scm_step *> scm_step_v;
92 typedef std::vector<scm_step *>::iterator scm_step_i;
94 typedef std::vector<scm_scene *> scm_scene_v;
95 typedef std::vector<scm_scene *>::iterator scm_scene_i;
105 active_pair() : file(0), cache(0) { }
112 typedef std::map<int, active_pair> active_pair_m;
118 active_file() : file(0), uses(0), index(-1) { }
125 typedef std::map<std::string, active_file> active_file_m;
131 active_cache() : cache(0), uses(0) { }
142 cache_param(
scm_file *file) : n(int(file->get_w()) - 2),
143 c(int(file->get_c())),
144 b(int(file->get_b())) { }
150 bool operator<(
const cache_param& that)
const {
151 if (n < that.n)
return true;
152 else if (n > that.n)
return false;
153 else if (c < that.c)
return true;
154 else if (c > that.c)
return false;
155 else if (b < that.b)
return true;
160 typedef std::map<cache_param, active_cache> active_cache_m;
161 typedef std::map<cache_param, active_cache>::iterator active_cache_i;
182 void render_sphere(
const double *,
const double *,
int)
const;
274 active_cache_m caches;
bool get_page_status(int f, long long i)
Return true if a page is present in the SCM file. O(log n).
Definition: scm-system.cpp:648
void update_cache()
Update all image caches. This is among the most significant entry points of the SCM API as it handles...
Definition: scm-system.cpp:395
float get_minimum_ground() const
Return the minimum ground level of the current scene, e.g. the radius of the planet at the bottom of ...
Definition: scm-system.cpp:464
int get_scene_count() const
Return the number of scenes in the collection.
Definition: scm-system.cpp:174
scm_sphere * get_sphere() const
Return a pointer to the sphere geometry handler.
Definition: scm-system.cpp:100
void del_step(int i)
Delete the step at index i.
Definition: scm-system.cpp:227
void del_scene(int i)
Delete the scene at index i.
Definition: scm-system.cpp:149
An scm_render manages the rendering of background and foreground spheres.
Definition: scm-render.hpp:39
scm_cache * get_cache(int)
Return the cache associated with the given file index.
Definition: scm-system.cpp:589
bool get_synchronous() const
Return the synchronous flag.
Definition: scm-system.cpp:437
An scm_step defines a view configuration.
Definition: scm-step.hpp:32
An scm_scene encapsulates the definition of a sphere and its parameters.
Definition: scm-scene.hpp:40
scm_render * get_render() const
Return a pointer to the render manager.
Definition: scm-system.cpp:107
scm_file * get_file(int)
Return the file associated with the given file index.
Definition: scm-system.cpp:599
void flush_cache()
Flush all image caches. All pages are ejected from all caches.
Definition: scm-system.cpp:420
An scm_file encapsulates an open SCM data file.
Definition: scm-file.hpp:37
float get_current_ground(const double *) const
Return the ground level of current scene at the given location. O(log n). This may incur data access ...
Definition: scm-system.cpp:449
scm_step * get_step(int i)
Return a pointer to the step at index i.
Definition: scm-system.cpp:237
An scm_sphere generates the adaptive rendered geometry of the 3D sphere.
Definition: scm-sphere.hpp:30
scm_system(int w, int h, int d, int l)
Create a new empty SCM system. Instantiate a render handler and a sphere handler. ...
Definition: scm-system.cpp:47
void append_queue(scm_step *)
Take ownership of the given step and append it to the current queue.
Definition: scm-system.cpp:373
float get_page_sample(int f, const double *v)
Sample an SCM file at the given location. O(log n). This may incur data access in the render thread...
Definition: scm-system.cpp:615
int get_step_count() const
Return the number of steps in the collection.
Definition: scm-system.cpp:247
void import_queue(const std::string &)
Parse the given string as a series of camera states. Enqueue each. This function ingests Maya MOV exp...
Definition: scm-system.cpp:296
int acquire_scm(const std::string &)
Internal: Load the named SCM file, if not already loaded.
Definition: scm-system.cpp:485
void set_synchronous(bool)
In synchronous mode, scm_cache::update will block until all background input handling is complete...
Definition: scm-system.cpp:430
int release_scm(const std::string &)
Release the named SCM file.
Definition: scm-system.cpp:535
scm_step get_step_blend(double) const
Compute the interpolated values of the current step queue at the given time. Extrapolate the first an...
Definition: scm-system.cpp:280
double set_scene_blend(double)
Set the scene caches and fade coefficient to produce a rendering of the current step queue at time t...
Definition: scm-system.cpp:182
void export_queue(std::string &)
Print all steps on the current queue to the given string using the same format expected by import_que...
Definition: scm-system.cpp:339
void render_cache()
Render a 2D overlay of the contents of all caches. This can be a helpful visual debugging tool as wel...
Definition: scm-system.cpp:406
int add_step(int i)
Allocate and insert a new step before index i. Return its index.
Definition: scm-system.cpp:211
void get_page_bounds(int f, long long i, float &r0, float &r1)
Determine the minimum and maximum values of an SCM file page. O(log n).
Definition: scm-system.cpp:631
scm_scene * get_scene(int i)
Return a pointer to the scene at index i, or 0 if i is out-of-range.
Definition: scm-system.cpp:164
scm_scene * get_back() const
Return a pointer to the current background scene.
Definition: scm-system.cpp:121
~scm_system()
Finalize all SCM system state.
Definition: scm-system.cpp:63
scm_scene * get_fore() const
Return a pointer to the current foreground scene.
Definition: scm-system.cpp:114
void render_sphere(const double *, const double *, int) const
Render the sphere. This is among the most significant entry points of the SCM API as it is the simple...
Definition: scm-system.cpp:89
An scm_system encapsulates all of the state of an SCM renderer. Its interface is the primary API of t...
Definition: scm-system.hpp:175
int add_scene(int i)
Allocate and insert a new scene before index i. Return its index.
Definition: scm-system.cpp:130
void flush_queue()
Flush the current step queue, deleting all steps in it.
Definition: scm-system.cpp:380
scm_scene * find_scene(const std::string &) const
Return the scene with the given name.
Definition: scm-system.cpp:578
An scm_cache is a virtual texture, demand-paged with threaded data access, represented as a single la...
Definition: scm-cache.hpp:35