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

An scm_sample samples an SCM TIFF file. More...

#include <scm-sample.hpp>

Public Member Functions

 scm_sample (scm_file *)
 Create a new SCM TIFF file sampler. More...
 
float get (const double *)
 Perform a sample along a vector. More...
 

Detailed Description

An scm_sample samples an SCM TIFF file.

This facility is used primarily to implement collision detection with the sphere. This is slightly inelegant. The mechanism of the SCM renderer is designed for optimal GPU performance. As such, SCM data is never touched by the render thread. Instead, data moves straight from the loader thread decompressors into the VRAM texture cache via asynchronous transfer.

Unfortunately, collision detection requires that the main CPU thread have knowledge of SCM height data. This object provides that knowledge. Sadly, data access incurs latency, and the main thread is also the render thread, so collision detection has the potential to delay the generation of the frame, running contrary to the spirit of the entire library.

It's a necessary evil.

Constructor & Destructor Documentation

scm_sample::scm_sample ( scm_file file)

Create a new SCM TIFF file sampler.

The given scm_file object includes the path and parameters of the TIFF file. Open that TIFF and prepare to make cached access to it.

Member Function Documentation

float scm_sample::get ( const double *  v)

Perform a sample along a vector.

Seek the deepest page that contains the given vector and return a linearly- filtered sample of it. In the interest of performance, cache the page and cache the most recent result. In the interest of minimizing latency, read only a single scanline at a time.

Parameters
vVector from the center of the sphere to the sample point

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