OSG  3.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SphericalDisplay.h
Go to the documentation of this file.
1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
2  *
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.
7  *
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.
12 */
13 
14 #ifndef OSGVIEWER_SphericalDisplay
15 #define OSGVIEWER_SphericalDisplay 1
16 
17 #include <osgViewer/View>
18 
19 namespace osgViewer {
20 
23 {
24  public:
25 
26  SphericalDisplay(double radius=1.0, double collar=0.45, unsigned int screenNum=0, osg::Image* intensityMap=0, const osg::Matrixd& projectorMatrix = osg::Matrixd()):
27  _radius(radius),
28  _collar(collar),
29  _screenNum(screenNum),
30  _intensityMap(intensityMap),
31  _projectorMatrix(projectorMatrix) {}
32 
34  ViewConfig(rhs,copyop),
35  _radius(rhs._radius),
36  _collar(rhs._collar),
37  _screenNum(rhs._screenNum),
38  _intensityMap(rhs._intensityMap),
39  _projectorMatrix(rhs._projectorMatrix) {}
40 
42 
43  virtual void configure(osgViewer::View& view) const;
44 
45  void setRadius(double r) { _radius = r; }
46  double getRadius() const { return _radius; }
47 
48  void setCollar(double r) { _collar = r; }
49  double getCollar() const { return _collar; }
50 
51  void setScreenNum(unsigned int n) { _screenNum = n; }
52  unsigned int getScreenNum() const { return _screenNum; }
53 
54  void setIntensityMap(osg::Image* im) { _intensityMap = im; }
55  const osg::Image* getIntensityMap() const { return _intensityMap.get(); }
56 
57  void setProjectionMatrix(const osg::Matrixd& m) { _projectorMatrix = m; }
58  const osg::Matrixd& getProjectionMatrix() const { return _projectorMatrix; }
59 
60  protected:
61 
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;
63 
64  double _radius;
65  double _collar;
66  unsigned int _screenNum;
69 };
70 
71 #if 0
72 
73 class OSGVIEWER_EXPORT ViewForPanoramicSphericalDisplay : public Config
74 {
75  public:
76 
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);
79 
80  META_Object(osgViewer,ViewOnSingleScreen);
81 
82  virtual void configure(osgViewer::View& view) const;
83 
84  void setRadius(double r) { _radius = r; }
85  double getRadius() const { return _radius; }
86 
87  void setCollar(double r) { _collar = r; }
88  double getCollar() const { return _collar; }
89 
90  void setScreenNum(unsigned int n) { _screenNum = n; }
91  unsigned int getScreenNum() const { return _screenNum; }
92 
93  void setIntensityMap(osg::Image* im) { _intensityMap = im; }
94  const osg::Image* getIntensityMap() const { return _intensityMap; }
95 
96  void setProjectionMatrix(const osg::Matrixd& m) { _projectorMatrix = m; }
97  const osg::Matrixd& getProjectionMatrix() const { return _projectorMatrix; }
98 
99  protected:
100 
101  double _radius;
102  double _collar;
103  unsigned int _screenNum;
104  osg::ref_ref<osg::Image> _intensityMap;
105  osg::Matrixd _projectorMatrix;
106 };
107 
109 class OSGVIEWER_EXPORT ViewForWoWVxDisplay : public Config
110 {
111  public:
112 
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);
116 
117  META_Object(osgViewer,ViewForWoWVxDisplay);
118 
119  virtual void configure(osgViewer::View& view) const;
120 
121  void setScreenNum(unsigned int n) { _screenNum = n; }
122  unsigned int getScreenNum() const { return _screenNum; }
123 
124  void set(unsigned char c) { _wow_content = c; }
125  double get() const { return _wow_content; }
126 
127  void set(unsigned char c) { _wow_factor = c; }
128  double get() const { return _wow_factor; }
129 
130  void set(unsigned char c) { _wow_offset = c; }
131  double get() const { return _wow_offset; }
132 
133  void setWowDisparityZD(float c) { _wow_disparity_Zd = c; }
134  float getWowDisparityZD() const { return _wow_disparity_Zd; }
135 
136  void setWowDisparityVZ(float c) { _wow_disparity_vz = c; }
137  float getWowDisparityVZ() const { return _wow_disparity_vz; }
138 
139  void setWowDisparityM(float c) { _wow_disparity_M = c; }
140  float getWowDisparityM() const { return _wow_disparity_M; }
141 
142  void setWowDisparityC(float c) { _wow_disparity_C = c; }
143  float getWowDisparityC() const { return _wow_disparity_C; }
144 
145  protected:
146 
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;
155 };
156 
158 class OSGVIEWER_EXPORT DepthPartition : public Config
159 {
160  public:
161 
162  DepthPartition(DepthPartitionSettings* dsp=0);
163 
164  DepthPartition(const ViewForWoWVxDisplay& rhs, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
165 
166  META_Object(osgViewer,DepthPartition);
167 
168  void setDepthPartionSettings(DepthPartitionSettings* dsp) const { _dps = dps; }
169  const DepthPartitionSettings* getDepthPartionSettings() const { return _dps; }
170 
172  bool setUpDepthPartitionForCamera(osg::Camera* cameraToPartition, DepthPartitionSettings* dps=0);
173 
174  virtual void configure(osgViewer::View& view) const;
175 
176  protected:
177 };
178 
179 #endif
180 
181 }
182 
183 
184 #endif
SphericalDisplay(const SphericalDisplay &rhs, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
#define OSGVIEWER_EXPORT
Definition: Export.h:40
void setScreenNum(unsigned int n)
void setIntensityMap(osg::Image *im)
void setProjectionMatrix(const osg::Matrixd &m)
SphericalDisplay(double radius=1.0, double collar=0.45, unsigned int screenNum=0, osg::Image *intensityMap=0, const osg::Matrixd &projectorMatrix=osg::Matrixd())
osg::ref_ptr< osg::Image > _intensityMap
#define META_Object(library, name)
Definition: Object.h:42
const osg::Matrixd & getProjectionMatrix() const
const osg::Image * getIntensityMap() const
unsigned int getScreenNum() const