WoWVxDisplay 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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. #ifndef OSGVIEWER_WoWVxDisplay
  14. #define OSGVIEWER_WoWVxDisplay 1
  15. #include <osgViewer/View>
  16. namespace osgViewer {
  17. /** autostereoscopic Philips WoWvx display.*/
  18. class OSGVIEWER_EXPORT WoWVxDisplay : public ViewConfig
  19. {
  20. public:
  21. // default to 20" display, type can be 20 to 42.
  22. WoWVxDisplay(unsigned int type=20, unsigned int screenNum=0):
  23. _screenNum(screenNum),
  24. _wow_content(0x02),
  25. _wow_factor(0x40),
  26. _wow_offset(0x80),
  27. _wow_disparity_Zd(0.459813f),
  28. _wow_disparity_vz(6.180772f),
  29. _wow_disparity_M(-1586.34f),
  30. _wow_disparity_C(127.5f) { if (type==42) WoWVx42(); }
  31. 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):
  32. _screenNum(screenNum),
  33. _wow_content(wow_content),
  34. _wow_factor(wow_factor),
  35. _wow_offset(wow_offset),
  36. _wow_disparity_Zd(wow_disparity_Zd),
  37. _wow_disparity_vz(wow_disparity_vz),
  38. _wow_disparity_M(wow_disparity_M),
  39. _wow_disparity_C(wow_disparity_C) {}
  40. WoWVxDisplay(const WoWVxDisplay& rhs, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY):
  41. ViewConfig(rhs, copyop),
  42. _screenNum(rhs._screenNum),
  43. _wow_content(rhs._wow_content),
  44. _wow_factor(rhs._wow_factor),
  45. _wow_offset(rhs._wow_offset),
  46. _wow_disparity_Zd(rhs._wow_disparity_Zd),
  47. _wow_disparity_vz(rhs._wow_disparity_vz),
  48. _wow_disparity_M(rhs._wow_disparity_M),
  49. _wow_disparity_C(rhs._wow_disparity_C) {}
  50. META_Object(osgViewer, WoWVxDisplay);
  51. virtual void configure(osgViewer::View& view) const;
  52. void setScreenNum(unsigned int n) { _screenNum = n; }
  53. unsigned int getScreenNum() const { return _screenNum; }
  54. void WoWVx20()
  55. {
  56. _wow_disparity_Zd = 0.459813f;
  57. _wow_disparity_vz = 6.180772f;
  58. _wow_disparity_M = -1586.34f;
  59. _wow_disparity_C = 127.5f;
  60. }
  61. void WoWVx42()
  62. {
  63. _wow_disparity_Zd = 0.467481f;
  64. _wow_disparity_vz = 7.655192f;
  65. _wow_disparity_M = -1960.37f;
  66. _wow_disparity_C = 127.5f;
  67. }
  68. void setContent(unsigned char c) { _wow_content = c; }
  69. double getContent() const { return _wow_content; }
  70. void setFactor(unsigned char c) { _wow_factor = c; }
  71. double getFactor() const { return _wow_factor; }
  72. void setOffset(unsigned char c) { _wow_offset = c; }
  73. double getOffset() const { return _wow_offset; }
  74. void setDisparityZD(float c) { _wow_disparity_Zd = c; }
  75. float getDisparityZD() const { return _wow_disparity_Zd; }
  76. void setDisparityVZ(float c) { _wow_disparity_vz = c; }
  77. float getDisparityVZ() const { return _wow_disparity_vz; }
  78. void setDisparityM(float c) { _wow_disparity_M = c; }
  79. float getDisparityM() const { return _wow_disparity_M; }
  80. void setDisparityC(float c) { _wow_disparity_C = c; }
  81. float getDisparityC() const { return _wow_disparity_C; }
  82. protected:
  83. unsigned int _screenNum;
  84. unsigned char _wow_content;
  85. unsigned char _wow_factor;
  86. unsigned char _wow_offset;
  87. float _wow_disparity_Zd;
  88. float _wow_disparity_vz;
  89. float _wow_disparity_M;
  90. float _wow_disparity_C;
  91. };
  92. #if 0
  93. /** Configure view with DepthPartition.*/
  94. class OSGVIEWER_EXPORT DepthPartition : public Config
  95. {
  96. public:
  97. DepthPartition(DepthPartitionSettings* dsp=0);
  98. DepthPartition(const ViewForWoWVxDisplay& rhs, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
  99. META_Object(osgViewer,DepthPartition);
  100. void setDepthPartionSettings(DepthPartitionSettings* dsp) const { _dps = dps; }
  101. const DepthPartitionSettings* getDepthPartionSettings() const { return _dps; }
  102. /** for setting up depth partitioning on the specified camera.*/
  103. bool setUpDepthPartitionForCamera(osg::Camera* cameraToPartition, DepthPartitionSettings* dps=0);
  104. virtual void configure(osgViewer::View& view) const;
  105. protected:
  106. };
  107. #endif
  108. }
  109. #endif