1
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
3
* This library is open source and may be redistributed and/or modified under
4
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5
* (at your option) any later version. The full license is in LICENSE file
6
* included with this distribution, and on the openscenegraph.org website.
8
* This library is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* OpenSceneGraph Public License for more details.
14
#ifndef OSGVIEWER_SphericalDisplay
15
#define OSGVIEWER_SphericalDisplay 1
17
#include <osgViewer/View>
21
/** spherical display using 6 slave cameras rendering the 6 sides of a cube map, and 7th camera doing distortion correction to present on a spherical display.*/
22
class OSGVIEWER_EXPORT SphericalDisplay : public ViewConfig
26
SphericalDisplay(double radius=1.0, double collar=0.45, unsigned int screenNum=0, osg::Image* intensityMap=0, const osg::Matrixd& projectorMatrix = osg::Matrixd()):
29
_screenNum(screenNum),
30
_intensityMap(intensityMap),
31
_projectorMatrix(projectorMatrix) {}
33
SphericalDisplay(const SphericalDisplay& rhs, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY):
34
ViewConfig(rhs,copyop),
37
_screenNum(rhs._screenNum),
38
_intensityMap(rhs._intensityMap),
39
_projectorMatrix(rhs._projectorMatrix) {}
41
META_Object(osgViewer,SphericalDisplay);
43
virtual void configure(osgViewer::View& view) const;
45
void setRadius(double r) { _radius = r; }
46
double getRadius() const { return _radius; }
48
void setCollar(double r) { _collar = r; }
49
double getCollar() const { return _collar; }
51
void setScreenNum(unsigned int n) { _screenNum = n; }
52
unsigned int getScreenNum() const { return _screenNum; }
54
void setIntensityMap(osg::Image* im) { _intensityMap = im; }
55
const osg::Image* getIntensityMap() const { return _intensityMap.get(); }
57
void setProjectionMatrix(const osg::Matrixd& m) { _projectorMatrix = m; }
58
const osg::Matrixd& getProjectionMatrix() const { return _projectorMatrix; }
62
osg::Geometry* create3DSphericalDisplayDistortionMesh(const osg::Vec3& origin, const osg::Vec3& widthVector, const osg::Vec3& heightVector, double sphere_radius, double collar_radius,osg::Image* intensityMap, const osg::Matrix& projectorMatrix) const;
66
unsigned int _screenNum;
67
osg::ref_ptr<osg::Image> _intensityMap;
68
osg::Matrixd _projectorMatrix;
72
/** spherical display by rendering main scene to a panoramic 2:1 texture and then doing distortion correction to present onto a spherical display.*/
73
class OSGVIEWER_EXPORT ViewForPanoramicSphericalDisplay : public Config
77
ViewForPanoramicSphericalDisplay(double radius=1.0, double collar=0.45, unsigned int screenNum=0, osg::Image* intensityMap=0, const osg::Matrixd& projectorMatrix = osg::Matrixd());
78
ViewForPanoramicSphericalDisplay(const ViewForPanoramicSphericalDisplay& rhs, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
80
META_Object(osgViewer,ViewOnSingleScreen);
82
virtual void configure(osgViewer::View& view) const;
84
void setRadius(double r) { _radius = r; }
85
double getRadius() const { return _radius; }
87
void setCollar(double r) { _collar = r; }
88
double getCollar() const { return _collar; }
90
void setScreenNum(unsigned int n) { _screenNum = n; }
91
unsigned int getScreenNum() const { return _screenNum; }
93
void setIntensityMap(osg::Image* im) { _intensityMap = im; }
94
const osg::Image* getIntensityMap() const { return _intensityMap; }
96
void setProjectionMatrix(const osg::Matrixd& m) { _projectorMatrix = m; }
97
const osg::Matrixd& getProjectionMatrix() const { return _projectorMatrix; }
103
unsigned int _screenNum;
104
osg::ref_ref<osg::Image> _intensityMap;
105
osg::Matrixd _projectorMatrix;
108
/** autostereoscopic Philips WoWvx display.*/
109
class OSGVIEWER_EXPORT ViewForWoWVxDisplay : public Config
113
ViewForWoWVxDisplay();
114
ViewForWoWVxDisplay(unsigned int screenNum, unsigned char wow_content, unsigned char wow_factor, unsigned char wow_offset, float wow_disparity_Zd, float wow_disparity_vz, float wow_disparity_M, float wow_disparity_C);
115
ViewForWoWVxDisplay(const ViewForWoWVxDisplay& rhs, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
117
META_Object(osgViewer,ViewForWoWVxDisplay);
119
virtual void configure(osgViewer::View& view) const;
121
void setScreenNum(unsigned int n) { _screenNum = n; }
122
unsigned int getScreenNum() const { return _screenNum; }
124
void set(unsigned char c) { _wow_content = c; }
125
double get() const { return _wow_content; }
127
void set(unsigned char c) { _wow_factor = c; }
128
double get() const { return _wow_factor; }
130
void set(unsigned char c) { _wow_offset = c; }
131
double get() const { return _wow_offset; }
133
void setWowDisparityZD(float c) { _wow_disparity_Zd = c; }
134
float getWowDisparityZD() const { return _wow_disparity_Zd; }
136
void setWowDisparityVZ(float c) { _wow_disparity_vz = c; }
137
float getWowDisparityVZ() const { return _wow_disparity_vz; }
139
void setWowDisparityM(float c) { _wow_disparity_M = c; }
140
float getWowDisparityM() const { return _wow_disparity_M; }
142
void setWowDisparityC(float c) { _wow_disparity_C = c; }
143
float getWowDisparityC() const { return _wow_disparity_C; }
147
unsigned int _screenNum;
148
unsigned char _wow_content;
149
unsigned char _wow_factor;
150
unsigned char _wow_offset;
151
float _wow_disparity_Zd;
152
float _wow_disparity_vz;
153
float _wow_disparity_M;
154
float _wow_disparity_C;
157
/** Configure view with DepthPartition.*/
158
class OSGVIEWER_EXPORT DepthPartition : public Config
162
DepthPartition(DepthPartitionSettings* dsp=0);
164
DepthPartition(const ViewForWoWVxDisplay& rhs, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
166
META_Object(osgViewer,DepthPartition);
168
void setDepthPartionSettings(DepthPartitionSettings* dsp) const { _dps = dps; }
169
const DepthPartitionSettings* getDepthPartionSettings() const { return _dps; }
171
/** for setting up depth partitioning on the specified camera.*/
172
bool setUpDepthPartitionForCamera(osg::Camera* cameraToPartition, DepthPartitionSettings* dps=0);
174
virtual void configure(osgViewer::View& view) const;