| 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: cubeenvmirrortechniquegl.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.17 2005/01/03 01:43:09 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.16 2004/11/07 19:55:42 kirsch 00034 // added Dynamic, Static and CheckModified update modes 00035 // 00036 // Revision 1.15 2004/11/06 21:10:15 kirsch 00037 // added bumped cube environment mapping 00038 // 00039 // Revision 1.14 2004/10/21 19:19:13 kirsch 00040 // use cached resource 00041 // 00042 // Revision 1.13 2004/06/27 11:47:59 kirsch 00043 // code cleanup 00044 // 00045 // Revision 1.12 2004/03/12 16:28:40 baumann 00046 // macros VRS_NAMESPACE_BEGIN/_END expanded and removed 00047 // 00048 // Revision 1.11 2004/01/19 11:43:58 baumann 00049 // serialization mechanism improved 00050 // 00051 // Revision 1.10 2004/01/19 07:28:02 baumann 00052 // serialization mechanism improved 00053 // 00054 // Revision 1.9 2003/11/07 14:19:25 kirsch 00055 // removed leading underscore from include guards 00056 // 00057 // Revision 1.8 2003/06/17 10:51:24 kirsch 00058 // made Mirror independent of ShapeMaterialGL 00059 // 00060 // Revision 1.7 2002/11/13 07:20:50 baumann 00061 // changed TextureGL enum values to uppercase 00062 // added TextureGL::definesComponent() 00063 // 00064 // Revision 1.6 2002/10/24 14:21:26 kirsch 00065 // use PBufferManagerGL 00066 // 00067 // Revision 1.5 2002/10/10 14:41:59 kirsch 00068 // comparison between signed/unsigned warning fix 00069 // 00070 // Revision 1.4 2002/09/19 11:42:00 kirsch 00071 // made arrays non persistent 00072 // 00073 // Revision 1.3 2002/09/19 11:33:44 kirsch 00074 // use arrays instead of dictionaries 00075 // 00076 // Revision 1.2 2002/09/13 15:15:15 baumann 00077 // missing return type (void) added 00078 // 00079 // Revision 1.1 2002/09/13 14:00:50 kirsch 00080 // added cubeenvmirror and cubeenvmirrortechniquegl 00081 // 00082 00083 #ifndef VRS_OPENGL_CUBEENVMIRRORTECHNIQUEGL_H_ 00084 #define VRS_OPENGL_CUBEENVMIRRORTECHNIQUEGL_H_ 00085 00086 #include <vrs/opengl/techniquegl.h> 00087 #include <vrs/opengl/texturegl.h> 00088 #include <vrs/bounds.h> 00089 00090 namespace VRS { 00091 00092 class CubeEnvMirror; 00093 class CubeMapTextureGL; 00094 class GLCanvas; 00095 class PBufferCanvasGL; 00096 template <typename T, typename V> class CachedResource; 00097 00099 00100 class VRS_CORE_API CubeEnvMirrorTechniqueGL : public TechniqueGL { 00101 public: 00102 CubeEnvMirrorTechniqueGL(int textureResolution = 256, TextureGL::FilterMode filter = TextureGL::LINEAR); 00115 ~CubeEnvMirrorTechniqueGL (); 00116 00117 void setTextureResolution(int); 00120 int getTextureResolution() const; 00122 00123 void setFilter(TextureGL::FilterMode); 00126 TextureGL::FilterMode getFilter() const; 00130 virtual void start(Engine*); 00131 virtual void stop(Engine*); 00132 00133 virtual bool preparePass(Engine*); 00134 virtual void finishPass(Engine*); 00135 virtual void nextPass(Engine*); 00136 00137 virtual bool prepareEval(Engine* engine, const Shape* shape); 00138 virtual void finishEval(Engine* engine, const Shape* shape); 00139 00140 virtual bool canBeUsed(Engine* engine) const; 00141 00142 VRS_TYPEINFO(CubeEnvMirrorTechniqueGL, TechniqueGL); 00143 VRS_SERIALIZABLE(CubeEnvMirrorTechniqueGL); 00144 00145 private: 00146 struct CubeMapInfo { 00147 CubeMapInfo() : cubeMap_(0), transaction_(currentTransactionNo()) { } 00148 SO<CubeMapTextureGL> cubeMap_; 00149 TransactionNo transaction_; 00150 }; 00151 00152 // attributes that can be set/get from outside 00153 int textureResolution_; 00154 TextureGL::FilterMode filter_; 00155 00156 // passes of the technique 00157 enum pass { 00158 GATHERMIRRORS = 10, 00159 RIGHT = 11, 00160 LEFT = 12, 00161 TOP = 13, 00162 BOTTOM = 14, 00163 FRONT = 15, 00164 BACK = 16, 00165 APPLYMIRROR = 116 00166 }; 00167 00168 // helper attributes that are not visible from outside 00169 SO<NonPersistentArray<SO<CubeEnvMirror> > > mirrorList_; 00170 SO<NonPersistentArray<Bounds> > mirrorBounds_; 00171 SO<CachedResource<SO<CubeEnvMirror>, CubeMapInfo> > cubeMapDict_; 00172 unsigned int mirrorIndex_; 00173 00174 SO<PBufferCanvasGL> pbuffer_; 00175 00176 Matrix orientInverse_; 00177 00178 bool render_; 00179 int recursions_; 00180 }; 00181 00182 } // namespace VRS 00183 00184 #endif // VRS_OPENGL_CUBEENVMIRRORTECHNIQUEGL_H_