| VRS - The Virtual Rendering System |
| version 3.3 |
00001 /****************************************************************************** 00002 * VRS - The Virtual Rendering System 00003 * Copyright (C) 2002 Computer Graphics Systems Group at the 00004 * Hasso-Plattner-Institute (HPI), Potsdam, Germany. 00005 * 00006 * This library is free software; you can redistribute it and/or modify it 00007 * under the terms of the GNU Lesser General Public License as published by 00008 * the Free Software Foundation; either version 2.1 of the License, or (at 00009 * your option) any later version. This library is distributed in the hope 00010 * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied 00011 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU Lesser General Public License for more details. You should have received 00013 * a copy of the GNU Lesser+ General Public License along with this library; if 00014 * not, write to the FreeSoftware Foundation, Inc., 59 Temple Place, Suite 330, 00015 * Boston, MA, 02111-1307, USA. 00016 ******************************************************************************/ 00017 00018 // $Id: texturemirrortechniquegl.h 6014 2007-08-09 07:51:16Z Konstantin_Baumann $ 00019 // $Date: 2007-08-09 09:51:16 +0200 (Thu, 09 Aug 2007) $ 00020 // $Revision: 6014 $ 00021 // $State$ 00022 // $Author: Konstantin_Baumann $ 00023 // 00024 // $Log$ 00025 // Revision 1.3 2005/01/03 01:43:10 klimetschek 00026 // - modified win32 project layout, splitted vrs.vcproj into vrs_container, vrs_core, vrs_sg, vrs_image, vrs_opengl and vrs_io 00027 // - removed vrs.vcproj 00028 // minor things: 00029 // - added all glutexamples to vrs4glut.sln 00030 // - fixed some problems in glutexamples 00031 // - removed all project references from all VS projects (using solution wide project dependencies instead) 00032 // 00033 // Revision 1.2 2004/10/21 14:53:27 kirsch 00034 // use cached resource for holding internal textures 00035 // 00036 // Revision 1.1 2004/06/27 12:49:30 kirsch 00037 // added texture mirror technique 00038 // 00039 // Revision 1.6 2004/06/27 11:49:54 kirsch 00040 // code cleanups to prepare inclusion to VRS 00041 // 00042 // Revision 1.4 2004/03/15 08:18:02 kirsch 00043 // removed vrs namespace macros 00044 // 00045 // Revision 1.3 2004/02/13 12:22:50 kirsch 00046 // serialization changes 00047 // 00048 // Revision 1.2 2004/01/22 12:31:59 kirsch 00049 // recent serialization changes 00050 // 00051 // Revision 1.1 2003/12/05 16:43:46 kirsch 00052 // added csglibmirror, also with shadows 00053 // 00054 // Revision 1.2 2003/08/01 10:03:08 kirsch 00055 // various compile fixes 00056 // 00057 // Revision 1.1 2003/06/16 12:33:48 kirsch 00058 // added texturemirror 00059 // 00060 00061 #ifndef _VRS_OPENGL_TEXTUREMIRRORTECHNIQUEGL_H_ 00062 #define _VRS_OPENGL_TEXTUREMIRRORTECHNIQUEGL_H_ 00063 00064 #include <vrs/opengl/techniquegl.h> 00065 #include <vrs/opengl/texturegl.h> 00066 00067 namespace VRS { 00068 00069 class ClipPlane; 00070 class PBufferCanvasGL; 00071 class PlanarMirror; 00072 class Texture2DGL; 00073 template<typename T> class NonPersistentArray; 00074 template<typename T, typename V> class CachedResource; 00075 00076 class VRS_CORE_API TextureMirrorTechniqueGL : public TechniqueGL { 00077 public: 00078 TextureMirrorTechniqueGL(int textureResolution = 256, TextureGL::FilterMode filter = TextureGL::LINEAR); 00088 void setTextureResolution(int); 00091 int getTextureResolution() const; 00093 00094 virtual void start(Engine*); 00095 virtual void stop(Engine*); 00096 00097 virtual bool preparePass(Engine*); 00098 virtual void finishPass(Engine*); 00099 virtual void nextPass(Engine*); 00100 00101 virtual bool prepareEval(Engine* engine, const Shape* shape); 00102 virtual void finishEval(Engine* engine, const Shape* shape); 00103 00104 virtual bool canBeUsed(Engine* engine) const; 00105 00106 VRS_TYPEINFO(TextureMirrorTechniqueGL, TechniqueGL); 00107 VRS_SERIALIZABLE(TextureMirrorTechniqueGL); 00108 00109 private: 00110 int textureResolution_; 00111 TextureGL::FilterMode filter_; 00112 00113 enum pass { 00114 GATHERMIRRORS = 25, 00115 GENERATEMIRRORTEXTURE = 26, 00116 APPLYMIRROR = 120 00117 }; 00118 00119 SO<ClipPlane> clip_; 00120 00121 // helper attributes that are not visible from outside 00122 SO<PlanarMirror> planarMirror_; 00123 SO<NonPersistentArray<SO<PlanarMirror> > > mirrorList_; 00124 unsigned int mirrorIndex_; 00125 SO<CachedResource<SO<PlanarMirror>, SO<Texture2DGL> > > textureDict_; 00126 00127 SO<PBufferCanvasGL> pbuffer_; 00128 00129 Matrix originalModelview_; 00130 Matrix originalProjection_; 00131 00132 bool render_; 00133 int recursions_; 00134 }; 00135 00136 } // namespace VRS 00137 00138 #endif // _VRS_OPENGL_TEXTUREMIRRORTECHNIQUEGL_H_