| VRS - The Virtual Rendering System |
| version 3.3 |
00001 /****************************************************************************** 00002 * VRS - The Virtual Rendering System 00003 * Copyright (C) 2003 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: objectcachegl.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.13 2005/05/13 14:56:14 buchholz 00026 // optimize scene improved: It provides a rayintersection-option and 00027 // does not use ObjectCachesGL anymore but MappedVertexAttributeShapes 00028 // 00029 // Revision 1.12 2005/01/03 01:43:09 klimetschek 00030 // - modified win32 project layout, splitted vrs.vcproj into vrs_container, vrs_core, vrs_sg, vrs_image, vrs_opengl and vrs_io 00031 // - removed vrs.vcproj 00032 // minor things: 00033 // - added all glutexamples to vrs4glut.sln 00034 // - fixed some problems in glutexamples 00035 // - removed all project references from all VS projects (using solution wide project dependencies instead) 00036 // 00037 // Revision 1.11 2004/11/03 14:45:06 saar 00038 // Class comment changed (Doxygen style) 00039 // 00040 // Revision 1.10 2004/09/30 08:35:15 baumann 00041 // additional include added 00042 // 00043 // Revision 1.9 2004/07/04 15:15:36 kirsch 00044 // iVRS fixes 00045 // 00046 // Revision 1.8 2004/06/02 16:58:02 buchholz 00047 // Iterator* replaced by SO<Iterator> to avoid memory leaks 00048 // 00049 // Revision 1.7 2004/03/12 16:28:40 baumann 00050 // macros VRS_NAMESPACE_BEGIN/_END expanded and removed 00051 // 00052 // Revision 1.6 2004/01/22 13:59:36 buchholz 00053 // optimization method added 00054 // 00055 // Revision 1.5 2004/01/19 11:43:58 baumann 00056 // serialization mechanism improved 00057 // 00058 // Revision 1.4 2004/01/19 07:28:02 baumann 00059 // serialization mechanism improved 00060 // 00061 // Revision 1.3 2003/12/09 14:59:15 buchholz 00062 // - serialization added 00063 // - convenience-constructor for PolygonSets added 00064 // - mode-parameter added 00065 // - getCacheNode replaced by getScene 00066 // 00067 // Revision 1.2 2003/11/24 16:21:30 buchholz 00068 // new static member maxVertices included. 00069 // It is now possible to limit the number of vertices 00070 // of the internally combined vertex arrays. 00071 // 00072 // Revision 1.1 2003/11/03 15:53:37 buchholz 00073 // new caching class that builds combined vertex arrays and display lists 00074 // 00075 00076 #ifndef VRS_OPENGL_OBJECTCACHEGL_H 00077 #define VRS_OPENGL_OBJECTCACHEGL_H 00078 00079 #include <vrs/opengl/mappedvertexattributeshapegl.h> 00080 #include <vrs/shape.h> 00081 00082 namespace VRS { 00083 00084 class SceneThing; 00085 class PolygonSet; 00086 template<typename T> class StaticArray; 00087 00093 class VRS_CORE_API ObjectCacheGL : public Shape { 00094 public: 00095 enum Mode { DISPLAYLIST_ONLY, DISPLAYLIST_AND_SCENE, SCENE_ONLY }; 00096 VRS_SERIALIZABLE_CLASS_ENUM(Mode); 00097 00098 ObjectCacheGL(SO<VRS::Iterator<SO<VRS::SharedObj> > > objects, Mode mode = ObjectCacheGL::DISPLAYLIST_AND_SCENE); 00099 ObjectCacheGL(SO<VRS::Iterator<SO<VRS::PolygonSet> > > objects); 00114 SO<SceneThing> getScene() const; 00118 SO<Iterator<SO<MappedVertexAttributeShapeGL> > > getVertexArrays() const; 00119 00120 Bounds boundingBox() const; 00121 00122 static void setMaxVertices(unsigned int maxVertices = 0xffff); 00130 static unsigned int getMaxVertices(); 00132 00133 static void optimizeScene(SO<SceneThing> scene, bool enableRayIntersection = true); 00141 VRS_TYPEINFO(ObjectCacheGL, Shape); 00142 VRS_SERIALIZABLE(ObjectCacheGL); 00143 00144 private: 00145 00146 void init(SO<VRS::Iterator<SO<VRS::SharedObj> > > objects, Mode mode = DISPLAYLIST_AND_SCENE); 00147 ObjectCacheGL(); // only for serialization! 00148 static unsigned int maxVertices_; 00149 Bounds bounds_; 00150 SO<SceneThing> scene_; 00151 SO<StaticArray<SO<MappedVertexAttributeShapeGL> > > vertexArrays_; 00152 Mode mode_; 00153 }; 00154 00155 } // namespace VRS 00156 00157 #endif // VRS_OPENGL_OBJECTCACHEGL_H