liballofw
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
allofw::OmniStereo Class Referenceabstract

Class for Omnistereo rendering. More...

#include <omnistereo.h>

Classes

struct  CompositeInfo
 Composite info structure. More...
 
class  Delegate
 OmniStereo delegate class. More...
 
struct  StereoTexture
 Panorama is cubemap. More...
 

Public Member Functions

virtual void setResolution (int size=1024)=0
 
virtual void setStereoMode (StereoMode stereo_mode)=0
 
virtual void setPose (const Pose &pose)=0
 
virtual void setLens (float eye_separation=0.0f, float sphere_radius=1.0f)=0
 
virtual void setClipRange (float near, float far)=0
 
virtual StereoTexture getCubemapTexture ()=0
 
virtual StereoTexture getDepthCubemapTexture ()=0
 
virtual void capture ()=0
 Capture the scene. More...
 
virtual void composite (const Rectangle2i &viewport, const CompositeInfo &info=CompositeInfo())=0
 
virtual GLuint compositeCustomizeShader (const char *code)=0
 
virtual void compositeRestoreShader ()=0
 Restore the composite shader to default. More...
 
virtual const char * getShaderCode ()=0
 
virtual void setUniforms (GLuint program, const Delegate::CaptureInfo &info)=0
 
virtual void setDelegate (Delegate *delegate)=0
 

Static Public Member Functions

static OmniStereoCreate (Configuration *conf)
 
static void Destroy (OmniStereo *omnistereo)
 

Protected Member Functions

virtual ~OmniStereo ()
 
typedef int StereoMode
 Stereo mode. More...
 
static const int kStereoMode_Mono = 0
 
static const int kStereoMode_Left = 100
 Mono. More...
 
static const int kStereoMode_Right = 101
 Only show left eye. More...
 
static const int kStereoMode_Active = 200
 Only show right eye. More...
 
static const int kStereoMode_Dual_LR = 300
 Active stereo. More...
 
static const int kStereoMode_Dual_RL = 301
 Dual, left-right. More...
 
static const int kStereoMode_Anaglyph_Red_Cyan = 400
 Dual, right-left. More...
 
typedef int PanoramaMode
 Anaglyph, red/cyan. More...
 
static const int kPanoramaModeEquirectangular = 0
 
typedef int Eye
 Equirectangular panorama mode. More...
 
static const int kEye = 0
 
static const int kEye_Left = 0
 Single eye. More...
 
static const int kEye_Right = 1
 Left eye. More...
 
typedef int CompositeMask
 Right eye. More...
 
static const int kCompositeMask_Scene = 1 << 0
 
static const int kCompositeMask_Back = 1 << 1
 Show the scene. More...
 
static const int kCompositeMask_Front = 1 << 2
 Show the back buffer. More...
 
static const int kCompositeMask_Panorama = 1 << 3
 Show the front buffer. More...
 
static const int kCompositeMask_Panorama_Equirectangular = 1 << 4
 Show the panorama. More...
 
static const int kCompositeMask_Panorama_Cubemap = 1 << 5
 Panorama is equirectangular. More...
 
static const int kCompositeMask_Panorama_Cubemap_YUV420P = 1 << 6
 Panorama is cubemap. More...
 

Detailed Description

Class for Omnistereo rendering.

Member Typedef Documentation

Right eye.

Composite mask.

Equirectangular panorama mode.

Eye index.

Anaglyph, red/cyan.

Panorama mode.

Stereo mode.

Constructor & Destructor Documentation

virtual allofw::OmniStereo::~OmniStereo ( )
protectedvirtual

Member Function Documentation

virtual void allofw::OmniStereo::capture ( )
pure virtual

Capture the scene.

virtual void allofw::OmniStereo::composite ( const Rectangle2i viewport,
const CompositeInfo info = CompositeInfo() 
)
pure virtual

Composite the scene: Draw internal buffers to current viewport.

Parameters
viewportThe viewport in pixels.
infoThe CompositeInfo.
virtual GLuint allofw::OmniStereo::compositeCustomizeShader ( const char *  code)
pure virtual

Create a customized composite shader.

Parameters
codeCustom shader code.
Returns
The program ID of the compiled composite shader.
virtual void allofw::OmniStereo::compositeRestoreShader ( )
pure virtual

Restore the composite shader to default.

static OmniStereo* allofw::OmniStereo::Create ( Configuration conf)
static

Create new OmniStereo with configuration information.

Parameters
confThe Configuration object.
static void allofw::OmniStereo::Destroy ( OmniStereo omnistereo)
static

Destroy OmniStereo object.

Parameters
omnistereoThe object to destroy.
virtual StereoTexture allofw::OmniStereo::getCubemapTexture ( )
pure virtual

Get the cubemap (only allowed in cubemap mode).

Returns
A StereoTexture struct with left/right eye texture IDs.
virtual StereoTexture allofw::OmniStereo::getDepthCubemapTexture ( )
pure virtual

Get the depth cubemap (only allowed in cubemap mode).

Returns
A StereoTexture struct with left/right eye texture IDs.
virtual const char* allofw::OmniStereo::getShaderCode ( )
pure virtual

Get OmniStereo shader prefix code.

Necessary functions and uniforms for use in shader programs.

  • vec3 omni_transform(vec3 v) : Transform coordinates to camera space.
  • vec3 omni_transform_normal(vec3 v) : Transform normal to camera space.
  • vec4 omni_displace(vec4 v) : Perform Omnistereo displacement on vertex.
  • vec4 omni_project(vec4 v) : Perform projection to render target.
  • vec4 omni_render(vec4 v) : Short for 'omni_project(omni_displace(v))'

Uniforms:

  • omni_eye, omni_radius: Half eye separation, sphere radius.
  • omni_viewport_rotation, omni_viewport_projection: Viewport pose and projection information, handled internally.

Call setUniforms() to set these uniforms to your shader.

Returns
The shader code to be included.
virtual void allofw::OmniStereo::setClipRange ( float  near,
float  far 
)
pure virtual

Set clip range.

Parameters
nearThe near clipping distance in OpenGL units.
farThe far clipping distance in OpenGL units.
virtual void allofw::OmniStereo::setDelegate ( Delegate delegate)
pure virtual

Set the delegate.

Parameters
delegateSet the delegate object.
virtual void allofw::OmniStereo::setLens ( float  eye_separation = 0.0f,
float  sphere_radius = 1.0f 
)
pure virtual

Set lens.

Parameters
eye_separationDistance between the two eyes in OpenGL units.
sphere_radiusThe radius of the spherical display in OpenGL units
virtual void allofw::OmniStereo::setPose ( const Pose pose)
pure virtual

Set pose.

Parameters
poseThe pose.
virtual void allofw::OmniStereo::setResolution ( int  size = 1024)
pure virtual

Set cubemap resolution, allocate the cubemap.

Parameters
sizeWidth/height of the cubemap faces.
virtual void allofw::OmniStereo::setStereoMode ( StereoMode  stereo_mode)
pure virtual

Enable stereo or not.

Parameters
stereo_modeThe stereo mode.
virtual void allofw::OmniStereo::setUniforms ( GLuint  program,
const Delegate::CaptureInfo info 
)
pure virtual

Set uniforms to a shader program using getShaderCode().

Parameters
programThe OpenGL id of the program.
infoThe CaptureInfo given by onCaptureViewport.

Member Data Documentation

const int allofw::OmniStereo::kCompositeMask_Back = 1 << 1
static

Show the scene.

const int allofw::OmniStereo::kCompositeMask_Front = 1 << 2
static

Show the back buffer.

const int allofw::OmniStereo::kCompositeMask_Panorama = 1 << 3
static

Show the front buffer.

const int allofw::OmniStereo::kCompositeMask_Panorama_Cubemap = 1 << 5
static

Panorama is equirectangular.

const int allofw::OmniStereo::kCompositeMask_Panorama_Cubemap_YUV420P = 1 << 6
static

Panorama is cubemap.

const int allofw::OmniStereo::kCompositeMask_Panorama_Equirectangular = 1 << 4
static

Show the panorama.

const int allofw::OmniStereo::kCompositeMask_Scene = 1 << 0
static
const int allofw::OmniStereo::kEye = 0
static
const int allofw::OmniStereo::kEye_Left = 0
static

Single eye.

const int allofw::OmniStereo::kEye_Right = 1
static

Left eye.

const int allofw::OmniStereo::kPanoramaModeEquirectangular = 0
static
const int allofw::OmniStereo::kStereoMode_Active = 200
static

Only show right eye.

const int allofw::OmniStereo::kStereoMode_Anaglyph_Red_Cyan = 400
static

Dual, right-left.

const int allofw::OmniStereo::kStereoMode_Dual_LR = 300
static

Active stereo.

const int allofw::OmniStereo::kStereoMode_Dual_RL = 301
static

Dual, left-right.

const int allofw::OmniStereo::kStereoMode_Left = 100
static

Mono.

const int allofw::OmniStereo::kStereoMode_Mono = 0
static
const int allofw::OmniStereo::kStereoMode_Right = 101
static

Only show left eye.


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