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 _OSGDRAWACTION_H_ 00040 #define _OSGDRAWACTION_H_ 00041 #ifdef __sgi 00042 #pragma once 00043 #endif 00044 00045 //--------------------------------------------------------------------------- 00046 // Includes 00047 //--------------------------------------------------------------------------- 00048 00049 #include <vector> 00050 00051 #include <OSGSystemDef.h> 00052 #include <OSGBaseTypes.h> 00053 #include <OSGDrawActionBase.h> 00054 00055 OSG_BEGIN_NAMESPACE 00056 00057 //--------------------------------------------------------------------------- 00058 // Forward References 00059 //--------------------------------------------------------------------------- 00060 00061 class Material; 00062 00063 //--------------------------------------------------------------------------- 00064 // Types 00065 //--------------------------------------------------------------------------- 00066 00067 //--------------------------------------------------------------------------- 00068 // Class 00069 //--------------------------------------------------------------------------- 00070 00074 class OSG_SYSTEMLIB_DLLMAPPING DrawAction : public DrawActionBase 00075 { 00076 public: 00077 00078 //----------------------------------------------------------------------- 00079 // enums 00080 //----------------------------------------------------------------------- 00081 00082 //----------------------------------------------------------------------- 00083 // types 00084 //----------------------------------------------------------------------- 00085 00086 //----------------------------------------------------------------------- 00087 // class functions 00088 //----------------------------------------------------------------------- 00089 00090 static const char *getClassname(void) { return "DrawAction"; }; 00091 00092 // create a new DrawAction by cloning the prototype 00093 static DrawAction * create( void ); 00094 00095 // prototype access 00096 // after setting the prototype all new DrawActions are clones of it 00097 static void setPrototype( DrawAction * proto ); 00098 static DrawAction *getPrototype( void ); 00099 00100 //----------------------------------------------------------------------- 00101 // instance functions 00102 //----------------------------------------------------------------------- 00103 00104 virtual ~DrawAction(void); 00105 00106 // default registration. static, so it can be called during static init 00107 00108 static void registerEnterDefault( const FieldContainerType &type, 00109 const Action::Functor &func); 00110 00111 static void registerLeaveDefault( const FieldContainerType &type, 00112 const Action::Functor &func); 00113 00114 /*------------------------- your_category -------------------------------*/ 00115 00116 UInt32 getLightCount(void) const; 00117 void incLightCount(void); 00118 void decLightCount(void); 00119 00120 00121 // initialisation 00122 virtual Action::ResultE start( void ); 00123 00124 /*------------------------- your_operators ------------------------------*/ 00125 00126 // test a single node 00127 bool isVisible( Node* node ); 00128 00129 /*------------------------- assignment ----------------------------------*/ 00130 00131 /*------------------------- comparison ----------------------------------*/ 00132 00133 bool operator < (const DrawAction &other) const; 00134 00135 bool operator == (const DrawAction &other) const; 00136 bool operator != (const DrawAction &other) const; 00137 00138 protected: 00139 00140 //----------------------------------------------------------------------- 00141 // enums 00142 //----------------------------------------------------------------------- 00143 00144 //----------------------------------------------------------------------- 00145 // types 00146 //----------------------------------------------------------------------- 00147 00148 //----------------------------------------------------------------------- 00149 // class variables 00150 //----------------------------------------------------------------------- 00151 00152 //----------------------------------------------------------------------- 00153 // class functions 00154 //----------------------------------------------------------------------- 00155 00156 //----------------------------------------------------------------------- 00157 // instance variables 00158 //----------------------------------------------------------------------- 00159 00160 //----------------------------------------------------------------------- 00161 // instance functions 00162 //----------------------------------------------------------------------- 00163 00164 DrawAction(void); 00165 DrawAction(const DrawAction &source); 00166 00167 // access default functors 00168 00169 virtual std::vector<Functor>* getDefaultEnterFunctors(void); 00170 virtual std::vector<Functor>* getDefaultLeaveFunctors(void); 00171 00172 private: 00173 00174 //----------------------------------------------------------------------- 00175 // enums 00176 //----------------------------------------------------------------------- 00177 00178 //----------------------------------------------------------------------- 00179 // types 00180 //----------------------------------------------------------------------- 00181 00182 typedef DrawActionBase Inherited; 00183 00184 //----------------------------------------------------------------------- 00185 // friend classes 00186 //----------------------------------------------------------------------- 00187 00188 //----------------------------------------------------------------------- 00189 // friend functions 00190 //----------------------------------------------------------------------- 00191 00192 //----------------------------------------------------------------------- 00193 // class variables 00194 //----------------------------------------------------------------------- 00195 00196 static char cvsid[]; 00197 00198 // the prototype which is copied to create new actions 00199 static DrawAction * _prototype; 00200 00201 // default functors for instantiation 00202 static std::vector<Functor> *_defaultEnterFunctors; 00203 static std::vector<Functor> *_defaultLeaveFunctors; 00204 00205 //----------------------------------------------------------------------- 00206 // class functions 00207 //----------------------------------------------------------------------- 00208 00209 //----------------------------------------------------------------------- 00210 // instance variables 00211 //----------------------------------------------------------------------- 00212 00213 UInt32 _lightCount; 00214 00215 //----------------------------------------------------------------------- 00216 // instance functions 00217 //----------------------------------------------------------------------- 00218 00219 // prohibit default functions (move to 'public' if you need one) 00220 00221 DrawAction& operator =(const DrawAction &source); 00222 }; 00223 00224 //--------------------------------------------------------------------------- 00225 // Exported Types 00226 //--------------------------------------------------------------------------- 00227 00228 // class pointer 00229 00230 typedef DrawAction *DrawActionP; 00231 00232 OSG_END_NAMESPACE 00233 00234 #include "OSGDrawAction.inl" 00235 00236 #endif /* _OSGDRAWACTION_H_ */ 00237 00238
1.4.3