Added WoWVxDisplay view config

This commit is contained in:
Robert Osfield 2013-05-16 09:08:27 +00:00
parent 625821a91a
commit e3ed763c15
6 changed files with 1547 additions and 1426 deletions

View File

@ -31,6 +31,7 @@
#include <osgViewer/Viewer>
#include <osgViewer/ViewerEventHandlers>
#include <osgViewer/config/SingleWindow>
#include <osgViewer/config/WoWVxDisplay>
int main( int argc, char **argv )
@ -46,7 +47,7 @@ int main( int argc, char **argv )
}
if (!config)
{
config = new osgViewer::SingleWindow(100,100,800,600,0);
config = new osgViewer::WoWVxDisplay(); // new osgViewer::SingleWindow(100,100,800,600,0);
}
OSG_NOTICE<<"Config "<<config.get()<<std::endl;

View File

@ -69,80 +69,6 @@ class OSGVIEWER_EXPORT PanoramicSphericalDisplay : public Config
osg::Matrixd _projectorMatrix;
};
#if 0
/** autostereoscopic Philips WoWvx display.*/
class OSGVIEWER_EXPORT ViewForWoWVxDisplay : public Config
{
public:
ViewForWoWVxDisplay();
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);
ViewForWoWVxDisplay(const ViewForWoWVxDisplay& rhs, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
META_Object(osgViewer,ViewForWoWVxDisplay);
virtual void configure(osgViewer::View& view) const;
void setScreenNum(unsigned int n) { _screenNum = n; }
unsigned int getScreenNum() const { return _screenNum; }
void set(unsigned char c) { _wow_content = c; }
double get() const { return _wow_content; }
void set(unsigned char c) { _wow_factor = c; }
double get() const { return _wow_factor; }
void set(unsigned char c) { _wow_offset = c; }
double get() const { return _wow_offset; }
void setWowDisparityZD(float c) { _wow_disparity_Zd = c; }
float getWowDisparityZD() const { return _wow_disparity_Zd; }
void setWowDisparityVZ(float c) { _wow_disparity_vz = c; }
float getWowDisparityVZ() const { return _wow_disparity_vz; }
void setWowDisparityM(float c) { _wow_disparity_M = c; }
float getWowDisparityM() const { return _wow_disparity_M; }
void setWowDisparityC(float c) { _wow_disparity_C = c; }
float getWowDisparityC() const { return _wow_disparity_C; }
protected:
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;
};
/** Configure view with DepthPartition.*/
class OSGVIEWER_EXPORT DepthPartition : public Config
{
public:
DepthPartition(DepthPartitionSettings* dsp=0);
DepthPartition(const ViewForWoWVxDisplay& rhs, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
META_Object(osgViewer,DepthPartition);
void setDepthPartionSettings(DepthPartitionSettings* dsp) const { _dps = dps; }
const DepthPartitionSettings* getDepthPartionSettings() const { return _dps; }
/** for setting up depth partitioning on the specified camera.*/
bool setUpDepthPartitionForCamera(osg::Camera* cameraToPartition, DepthPartitionSettings* dps=0);
virtual void configure(osgViewer::View& view) const;
protected:
};
#endif
}

View File

@ -0,0 +1,142 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#ifndef OSGVIEWER_PanoramicSphericalDisplay
#define OSGVIEWER_PanoramicSphericalDisplay 1
#include <osgViewer/Config>
namespace osgViewer {
/** autostereoscopic Philips WoWvx display.*/
class OSGVIEWER_EXPORT WoWVxDisplay : public Config
{
public:
// default to 20" display, type can be 20 to 42.
WoWVxDisplay(unsigned int type=20, unsigned int screenNum=0):
_screenNum(0),
_wow_content(0x02),
_wow_factor(0x40),
_wow_offset(0x80),
_wow_disparity_Zd(0.459813f),
_wow_disparity_vz(6.180772f),
_wow_disparity_M(-1586.34f),
_wow_disparity_C(127.5f) { if (type==42) WoWVx42(); }
WoWVxDisplay(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):
_screenNum(screenNum),
_wow_content(wow_content),
_wow_factor(wow_factor),
_wow_offset(wow_offset),
_wow_disparity_Zd(wow_disparity_Zd),
_wow_disparity_vz(wow_disparity_vz),
_wow_disparity_M(wow_disparity_M),
_wow_disparity_C(wow_disparity_C) {}
WoWVxDisplay(const WoWVxDisplay& rhs, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY):
Config(rhs, copyop),
_screenNum(rhs._screenNum),
_wow_content(rhs._wow_content),
_wow_factor(rhs._wow_factor),
_wow_offset(rhs._wow_offset),
_wow_disparity_Zd(rhs._wow_disparity_Zd),
_wow_disparity_vz(rhs._wow_disparity_vz),
_wow_disparity_M(rhs._wow_disparity_M),
_wow_disparity_C(rhs._wow_disparity_C) {}
META_Object(osgViewer, WoWVxDisplay);
virtual void configure(osgViewer::View& view) const;
void setScreenNum(unsigned int n) { _screenNum = n; }
unsigned int getScreenNum() const { return _screenNum; }
void WoWVx20()
{
_wow_disparity_Zd = 0.459813f;
_wow_disparity_vz = 6.180772f;
_wow_disparity_M = -1586.34f;
_wow_disparity_C = 127.5f;
}
void WoWVx42()
{
_wow_disparity_Zd = 0.467481f;
_wow_disparity_vz = 7.655192f;
_wow_disparity_M = -1960.37f;
_wow_disparity_C = 127.5f;
}
void setContent(unsigned char c) { _wow_content = c; }
double getContent() const { return _wow_content; }
void setFactor(unsigned char c) { _wow_factor = c; }
double getFactor() const { return _wow_factor; }
void setOffset(unsigned char c) { _wow_offset = c; }
double getOffset() const { return _wow_offset; }
void setDisparityZD(float c) { _wow_disparity_Zd = c; }
float getDisparityZD() const { return _wow_disparity_Zd; }
void setDisparityVZ(float c) { _wow_disparity_vz = c; }
float getDisparityVZ() const { return _wow_disparity_vz; }
void setDisparityM(float c) { _wow_disparity_M = c; }
float getDisparityM() const { return _wow_disparity_M; }
void setDisparityC(float c) { _wow_disparity_C = c; }
float getDisparityC() const { return _wow_disparity_C; }
protected:
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;
};
#if 0
/** Configure view with DepthPartition.*/
class OSGVIEWER_EXPORT DepthPartition : public Config
{
public:
DepthPartition(DepthPartitionSettings* dsp=0);
DepthPartition(const ViewForWoWVxDisplay& rhs, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
META_Object(osgViewer,DepthPartition);
void setDepthPartionSettings(DepthPartitionSettings* dsp) const { _dps = dps; }
const DepthPartitionSettings* getDepthPartionSettings() const { return _dps; }
/** for setting up depth partitioning on the specified camera.*/
bool setUpDepthPartitionForCamera(osg::Camera* cameraToPartition, DepthPartitionSettings* dps=0);
virtual void configure(osgViewer::View& view) const;
protected:
};
#endif
}
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,22 @@
#include <osgViewer/config/WoWVxDisplay>
#include <osgDB/ObjectWrapper>
#include <osgDB/InputStream>
#include <osgDB/OutputStream>
REGISTER_OBJECT_WRAPPER( osgViewer_WoWVxDisplay,
new osgViewer::WoWVxDisplay,
osgViewer::WoWVxDisplay,
"osg::Object osgViewer::Config osgViewer::WoWVxDisplay" )
{
ADD_UINT_SERIALIZER(ScreenNum, 0u);
ADD_UCHAR_SERIALIZER(Content, 0);
ADD_UCHAR_SERIALIZER(Factor, 0);
ADD_UCHAR_SERIALIZER(Offset, 0);
ADD_FLOAT_SERIALIZER(DisparityZD, 0);
ADD_FLOAT_SERIALIZER(DisparityVZ, 0);
ADD_FLOAT_SERIALIZER(DisparityM, 0);
ADD_FLOAT_SERIALIZER(DisparityC, 0);
}