| VRS - The Virtual Rendering System |
| version 3.3 |
00001 /********************************************************************** 00002 VRS - The Virtual Rendering System 00003 Copyright (C) 2001 Computer Graphics Systems Group at the 00004 Hasso-Plattner-Institute, Potsdam, Germany. 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Lesser General Public 00007 License as published by the Free Software Foundation; either 00008 version 2.1 of the License, or (at your option) any later version. 00009 This library is distributed in the hope that it will be useful, but 00010 WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00012 See the GNU Lesser General Public License for more details. 00013 You should have received a copy of the GNU Lesser+ General Public 00014 License along with this library; if not, write to the FreeSoftware 00015 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA, 02111-1307, USA. 00016 **********************************************************************/ 00017 // $Id: mirrortechniquegl.h 6014 2007-08-09 07:51:16Z Konstantin_Baumann $ 00018 // $Date: 2007-08-09 09:51:16 +0200 (Thu, 09 Aug 2007) $ 00019 // $Revision: 6014 $ 00020 // $State$ 00021 // $Author: Konstantin_Baumann $ 00022 // 00023 // $Log$ 00024 // Revision 1.33 2005/01/03 01:43:09 klimetschek 00025 // - modified win32 project layout, splitted vrs.vcproj into vrs_container, vrs_core, vrs_sg, vrs_image, vrs_opengl and vrs_io 00026 // - removed vrs.vcproj 00027 // minor things: 00028 // - added all glutexamples to vrs4glut.sln 00029 // - fixed some problems in glutexamples 00030 // - removed all project references from all VS projects (using solution wide project dependencies instead) 00031 // 00032 // Revision 1.32 2004/06/27 11:47:59 kirsch 00033 // code cleanup 00034 // 00035 // Revision 1.31 2004/03/12 16:28:40 baumann 00036 // macros VRS_NAMESPACE_BEGIN/_END expanded and removed 00037 // 00038 // Revision 1.30 2004/01/19 11:43:58 baumann 00039 // serialization mechanism improved 00040 // 00041 // Revision 1.29 2003/11/29 11:29:23 kirsch 00042 // - added support for local poly attributes 00043 // - removed PolyAttribute::switchDefault() and Attribute::rememberTransform() 00044 // - renamed Engine::SwType: On/Off/All to Engine::SwitchType: ON/OFF/ALL 00045 // - changed class hierarchy of TechniqueProcessor and Technique 00046 // - GLCanvas::prepareRedisplay() / finishRedisplay() now push / pop standard attributes 00047 // 00048 // Revision 1.28 2003/06/17 10:51:24 kirsch 00049 // made Mirror independent of ShapeMaterialGL 00050 // 00051 // Revision 1.27 2003/03/21 17:06:03 kirsch 00052 // changed Facet orientation to make it match VRS' left-handed coordinate system 00053 // 00054 // Revision 1.26 2002/10/10 14:45:49 kirsch 00055 // comparison between signed/unsigned warning fix 00056 // 00057 // Revision 1.25 2002/07/04 14:23:56 kirsch 00058 // removed IteratorWrapper 00059 // 00060 // Revision 1.24 2002/07/03 09:21:33 kersting 00061 // added NonPersistent 00062 // 00063 // Revision 1.23 2002/07/02 15:23:48 baumann 00064 // non-persistent containers now have the prefix NonPersistent, e.g. NonPersistentArray<T> 00065 // persistent containers now have no prefix, e.g. Array<T> 00066 // 00067 // Revision 1.22 2002/07/02 06:12:34 baumann 00068 // VRS::Iterator<T> completely rewritten 00069 // 00070 // Revision 1.21 2002/06/24 14:03:38 baumann 00071 // changed List<T> to Array<T> 00072 // 00073 // Revision 1.20 2002/06/20 10:05:30 kirsch 00074 // added PlanarMirror, derived from (now abstract) class Mirror 00075 // 00076 // Revision 1.19 2002/05/13 15:11:03 kirsch 00077 // using occlusionquery to discard non-visible mirrors, thus saving some passes 00078 // 00079 // Revision 1.18 2002/04/25 08:29:43 kirsch 00080 // added persistency 00081 // 00082 // Revision 1.17 2002/04/19 08:22:06 kirsch 00083 // removed typo 00084 // 00085 // Revision 1.16 2002/03/04 12:00:26 kersting 00086 // directory structure changes 00087 // 00088 // Revision 1.15 2002/03/03 21:44:26 kosta 00089 // VRS_TYPEINFO-macro rewritten 00090 // 00091 // Revision 1.14 2002/02/19 10:34:19 kosta 00092 // undone all changes since 2002-02-15 00093 // 00094 // Revision 1.11 2002/01/25 16:42:06 kirsch 00095 // added canBeUsed() for techniques, and properly react in some OpenGL 00096 // techniques when needed extensions are missing 00097 // 00098 // Revision 1.10 2002/01/15 16:25:55 kosta 00099 // macros rewritten for a better namespace support 00100 // 00101 // Revision 1.9 2001/11/13 16:36:31 kirsch 00102 // changed line feed to unix style (removed control-M) 00103 // 00104 // Revision 1.8 2001/09/13 11:14:28 kirsch 00105 // created usesPass() that returns true for all passes between MIRRORPASSESBEGIN 00106 // and MIRRORPASSESEND 00107 // 00108 // Revision 1.7 2001/09/10 21:01:00 kirsch 00109 // Shapes with SurfaceStyleGL now are also mirrored with this SurfaceStyleGL 00110 // 00111 // Revision 1.6 2001/09/05 14:14:36 kirsch 00112 // Documentation updates 00113 // 00114 // Revision 1.5 2001/08/20 13:47:37 kirsch 00115 // Stencilbuffer was cleared unnecessarily in TechniqueGL 00116 // 00117 // Revision 1.4 2001/08/01 13:20:07 kirsch 00118 // using engine to save retrieve modelview/projection matrix in 00119 // clearDepthBufferWhereTheMirrorsAre 00120 // 00121 // Revision 1.3 2001/07/31 08:22:59 kirsch 00122 // mirror is correctly clipped now 00123 // 00124 // Revision 1.2 2001/07/30 15:25:36 kirsch 00125 // Added mirrors 00126 // 00127 // Revision 1.1.2.2 2001/06/27 19:54:06 kirsch 00128 // first working mirror, cleaned up mirrortechniquegl a bit 00129 // 00130 // Revision 1.1.2.1 2001/06/15 12:56:05 kirsch 00131 // pretraversal integrated, synthesizer replaced, polyattributes don't get 00132 // properly rendered 00133 // 00134 00135 #ifndef VRS_OPENGL_MIRRORTECHNIQUEGL_H 00136 #define VRS_OPENGL_MIRRORTECHNIQUEGL_H 00137 00138 #include <vrs/opengl/techniquegl.h> 00139 #include <vrs/engine.h> 00140 00141 namespace VRS { 00142 00143 class ClipPlane; 00144 class Mirror; 00145 class OcclusionQueryGL; 00146 class PlanarMirror; 00147 class ShapeMaterialGL; 00148 class StencilBitGL; 00149 template<typename T> class NonPersistentArray; 00150 template<typename T, typename V> class NonPersistentDictionary; 00151 00152 class VRS_CORE_API MirrorTechniqueGL : public TechniqueGL { 00153 public: 00154 MirrorTechniqueGL(); 00171 virtual void start(Engine*); 00172 virtual void stop(Engine*); 00173 00174 virtual bool preparePass(Engine*); 00175 virtual void finishPass(Engine*); 00176 virtual void nextPass(Engine*); 00177 00178 virtual bool usesPass(int pass) const; 00185 virtual bool prepareEval(Engine* engine, const Shape* shape); 00186 virtual void finishEval(Engine* engine, const Shape* shape); 00187 00188 virtual bool canBeUsed(Engine* engine) const; 00191 VRS_TYPEINFO(MirrorTechniqueGL, TechniqueGL); 00192 VRS_SERIALIZABLE(MirrorTechniqueGL); 00193 00194 static bool haveMirroredReferencingMirror(const Mirror*, Engine*, Engine::SwitchType); 00196 static ShapeMaterialGL* newMaterialWithAlphaAsQuality(const Mirror*, Engine* engine); 00198 00202 private: 00203 void clearDepthBufferWhereTheMirrorsAre(Engine* engine) const; 00204 00205 enum { NORMAL = 1, STENCIL = 2 }; 00206 00207 PlanarMirror* planarMirror_; 00208 00209 int mainpass_; 00210 bool mirrorPass_; 00211 00212 SO<OcclusionQueryGL> mirrorOcclusionTest_; 00213 00214 SO<ClipPlane> clip_; 00215 00216 SO<NonPersistentArray<SO<MonoAttribute> > > mirrorList_; 00217 unsigned int mirrorIndex_; 00218 00219 SO<NonPersistentDictionary<SO<SharedObj>, SO<StencilBitGL> > > stencilDict_; 00220 }; 00221 00222 } // namespace VRS 00223 00224 #endif // VRS_OPENGL_MIRRORTECHNIQUEGL_H