00001 /*======================================================================= 00002 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), *** 00003 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. *** 00004 *** *** 00005 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS *** 00006 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR *** 00007 *** WRITTEN AUTHORIZATION OF FEI S.A.S. *** 00008 *** *** 00009 *** RESTRICTED RIGHTS LEGEND *** 00010 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS *** 00011 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN *** 00012 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT *** 00013 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN *** 00014 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. *** 00015 *** *** 00016 *** COPYRIGHT (C) 1996-2020 BY FEI S.A.S, *** 00017 *** BORDEAUX, FRANCE *** 00018 *** ALL RIGHTS RESERVED *** 00019 **=======================================================================*/ 00020 /*======================================================================= 00021 ** Author : VSG (MMM YYYY) 00022 **=======================================================================*/ 00023 00024 #ifndef _SO_WIN_INTERLACEDSTEREO 00025 #define _SO_WIN_INTERLACEDSTEREO 00026 00027 #include <Inventor/components/stereo/SoBaseStereo.h> 00028 #include <Inventor/sys/SoGLType.h> 00029 00030 class SoStereoViewer; 00031 00057 class SoInterlacedStereo : public SoBaseStereo { 00058 public: 00060 enum InterlacedMode { 00062 HORIZONTAL = 0, // default 00064 VERTICAL 00065 } ; 00066 00070 SoInterlacedStereo(SoStereoViewer *stereoVwr = NULL); 00071 00075 ~SoInterlacedStereo(); 00076 00080 virtual void reverseStereoView(SbBool reverse); 00084 virtual SbBool isStereoViewReversed(); 00085 00089 void setInterlacedMode(InterlacedMode mode) { interlacedMode = mode; } 00093 InterlacedMode getInterlacedMode() { return interlacedMode; } 00094 00102 void setScreenInterlacing(SbBool screen) { screenInterlacing = screen; } 00106 SbBool isScreenInterlacing() { return screenInterlacing; } 00107 00111 void setFastInterlacing(SbBool fast=TRUE) { withQuality = !fast; } 00115 SbBool isFastInterlacing() { return !withQuality; } 00116 00120 virtual void renderStereoView(); 00121 00125 virtual StereoViewType getStereoViewType() { return INTERLACED_STEREO; } 00129 virtual SbBool canClearBeforeRender() { return clearBuffer; } 00130 00136 virtual SbBool requireHardware() { return FALSE; } 00137 00141 virtual void clearStereo(); 00142 00146 virtual void enableGreenShift( SbBool enable ) { m_doGreenShift = enable; } 00147 00151 virtual SbBool isGreenShiftEnabled() const { return m_doGreenShift; } 00152 00153 private: 00154 /* stereo for MPViewers */ 00155 void doLeftEyeSettings(); 00156 void doRightEyeSettings(); 00157 void doMonoscopicSettings(); 00158 00159 private: 00163 virtual SbBool renderUsingTextures(); 00164 00165 private: 00166 InterlacedMode interlacedMode; 00167 SbBool reversed; 00168 SbBool clearBuffer; 00169 SbBool screenInterlacing; 00170 SbBool withQuality; 00171 GLfloat * pixels, * result; 00172 GLubyte * mask; 00173 int width, height; 00174 SbBool m_doGreenShift; 00175 00176 // State for texture based rendering 00177 GLuint m_texId[2]; 00178 GLsizei m_texWidth; 00179 GLsizei m_texHeight; 00180 }; 00181 00182 #endif // _SO_WIN_INTERLACEDSTEREO 00183 00184 00185