00001 /*---------------------------------------------------------------------------*\ 00002 * OpenSG * 00003 * * 00004 * * 00005 * Copyright (C) 2000-2002 by the OpenSG Forum * 00006 * * 00007 * www.opensg.org * 00008 * * 00009 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de * 00010 * * 00011 \*---------------------------------------------------------------------------*/ 00012 /*---------------------------------------------------------------------------*\ 00013 * License * 00014 * * 00015 * This library is free software; you can redistribute it and/or modify it * 00016 * under the terms of the GNU Library General Public License as published * 00017 * by the Free Software Foundation, version 2. * 00018 * * 00019 * This library is distributed in the hope that it will be useful, but * 00020 * WITHOUT ANY WARRANTY; without even the implied warranty of * 00021 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00022 * Library General Public License for more details. * 00023 * * 00024 * You should have received a copy of the GNU Library General Public * 00025 * License along with this library; if not, write to the Free Software * 00026 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * 00027 * * 00028 \*---------------------------------------------------------------------------*/ 00029 /*---------------------------------------------------------------------------*\ 00030 * Changes * 00031 * * 00032 * * 00033 * * 00034 * * 00035 * * 00036 * * 00037 \*---------------------------------------------------------------------------*/ 00038 00039 #ifndef _OSGMATERIALPOOL_H_ 00040 #define _OSGMATERIALPOOL_H_ 00041 00042 #ifdef __sgi 00043 #pragma once 00044 #endif 00045 00046 #include <set> 00047 #include <vector> 00048 00049 #include <OSGConfig.h> 00050 #include <OSGSystemDef.h> 00051 #include <OSGMaterialPoolBase.h> 00052 #include <OSGAction.h> 00053 00054 OSG_BEGIN_NAMESPACE 00055 00056 class OSG_SYSTEMLIB_DLLMAPPING MaterialPool : public MaterialPoolBase 00057 { 00058 /*========================== PUBLIC =================================*/ 00059 public: 00060 00061 /*---------------------------------------------------------------------*/ 00065 virtual void changed(BitVector whichField, 00066 UInt32 origin ); 00067 00069 /*---------------------------------------------------------------------*/ 00073 void sync (void ); 00074 00075 UInt32 getCount (void ) const; 00076 00077 void add (const MaterialPtr &mat ); 00078 void add (const NodePtr &root ); 00079 void add (const MaterialPoolPtr &mp ); 00080 00081 Int32 find (const MaterialPtr &mat ) const; 00082 00083 void sub (const MaterialPtr &mat ); 00084 void sub (const NodePtr &root ); 00085 void sub (const MaterialPoolPtr &mp ); 00086 void sub ( UInt32 mat ); 00087 00088 MaterialPtr get ( UInt32 index ); 00089 void get (std::vector<MaterialPtr> &mats); 00090 const std::set<MaterialPtr> &get(void); 00091 00092 void clear (void ); 00093 00095 /*---------------------------------------------------------------------*/ 00099 virtual void dump( UInt32 uiIndent = 0, 00100 const BitVector bvFlags = 0) const; 00101 00103 /*========================= PROTECTED ===============================*/ 00104 protected: 00105 00106 typedef MaterialPoolBase Inherited; 00107 00108 /*---------------------------------------------------------------------*/ 00112 MaterialPool(void); 00113 MaterialPool(const MaterialPool &source); 00114 00116 /*---------------------------------------------------------------------*/ 00120 virtual ~MaterialPool(void); 00121 00122 void onDestroy(void); 00123 00125 /*========================== PRIVATE ================================*/ 00126 private: 00127 00128 friend class FieldContainer; 00129 friend class MaterialPoolBase; 00130 00131 /*---------------------------------------------------------------------*/ 00135 static void initMethod(void); 00136 00138 /*---------------------------------------------------------------------*/ 00139 00141 void operator =(const MaterialPool &source); 00142 00143 OSG::Action::ResultE addMaterialCB(OSG::NodePtr &node); 00144 OSG::Action::ResultE subMaterialCB(OSG::NodePtr &node); 00145 00146 std::set<MaterialPtr> _mats; 00147 }; 00148 00149 typedef MaterialPool *MaterialPoolP; 00150 00151 OSG_END_NAMESPACE 00152 00153 #include <OSGMaterialPoolBase.inl> 00154 #include <OSGMaterialPool.inl> 00155 00156 #define OSGMATERIALPOOL_HEADER_CVSID "@(#)$Id: OSGMaterialPool.h,v 1.1 2005/04/30 15:03:20 a-m-z Exp $" 00157 00158 #endif /* _OSGMATERIALPOOL_H_ */
1.5.5