Home | nevrax.com |
|
hrc_trav.hGo to the documentation of this file.00001 00007 /* Copyright, 2000 Nevrax Ltd. 00008 * 00009 * This file is part of NEVRAX NEL. 00010 * NEVRAX NEL is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2, or (at your option) 00013 * any later version. 00014 00015 * NEVRAX NEL is distributed in the hope that it will be useful, but 00016 * WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 * General Public License for more details. 00019 00020 * You should have received a copy of the GNU General Public License 00021 * along with NEVRAX NEL; see the file COPYING. If not, write to the 00022 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, 00023 * MA 02111-1307, USA. 00024 */ 00025 00026 #ifndef NL_HRC_TRAV_H 00027 #define NL_HRC_TRAV_H 00028 00029 #include "3d/trav_scene.h" 00030 #include "nel/misc/matrix.h" 00031 #include "nel/misc/debug.h" 00032 00033 00034 namespace NL3D 00035 { 00036 00037 00038 using NLMISC::CVector; 00039 using NLMISC::CPlane; 00040 using NLMISC::CMatrix; 00041 00042 00043 class IBaseHrcObs; 00044 class CSkipModel; 00045 class IBaseClipObs; 00046 class IBaseAnimDetailObs; 00047 00048 // *************************************************************************** 00049 // ClassIds. 00050 const NLMISC::CClassId HrcTravId=NLMISC::CClassId(0x5ad56382, 0x2a711530); 00051 00052 00053 // *************************************************************************** 00064 class CHrcTrav : public ITravScene 00065 { 00066 public: 00068 enum TVisibility 00069 { 00070 Show=0, // The model is shown in hte hierarchy 00071 Hide, // The model is hidden in hte hierarchy 00072 Herit, // The model herit the visibilty from his father 00073 00074 VisibilityCount 00075 }; 00076 00077 public: 00078 00080 CHrcTrav() 00081 { 00082 // NB: Now, observers update is done before ALL traversals. 00083 // Hence, we must inc the value before scene rendering. This is equivalent to start with 1, and inc at end of traverse(). 00084 CurrentDate= 1; 00085 } 00086 00087 00089 00090 IObs *createDefaultObs() const; 00091 NLMISC::CClassId getClassId() const {return HrcTravId;} 00092 sint getRenderOrder() const {return 1000;} 00093 void traverse(); 00095 00096 00097 public: 00098 00099 std::vector<IModel*> _MovingObjects; 00100 00101 // ONLY FOR OBSERVERS. 00102 00103 sint64 CurrentDate; // The current date of the traversal, usefull for matrix update. 00104 }; 00105 00106 00107 00108 // *************************************************************************** 00126 class IBaseHrcObs : public IObs 00127 { 00128 public: 00130 IBaseClipObs *ClipObs; 00131 IBaseAnimDetailObs *AnimDetailObs; 00132 00133 public: 00134 00135 00137 00138 CMatrix LocalMatrix; 00139 CHrcTrav::TVisibility LocalVis; // The visibility state of the node. 00140 sint64 LocalDate; // The update date of the LocalMatrix. 00142 00143 00145 00146 CMatrix WorldMatrix; 00147 bool WorldVis; // Is the node visible? (enabled?) 00148 sint64 WorldDate; // The update date of the WorldMatrix. 00150 00151 00152 public: 00153 00154 00156 IBaseHrcObs() 00157 { 00158 LocalVis= CHrcTrav::Herit; LocalMatrix.identity(); LocalDate=0; 00159 WorldVis= true; WorldMatrix.identity(); 00160 // Init the WorldDate to -1 so at first pass, LocalDate>WorldDate, and so 00161 // the model will be processed and so it'll may be inserted in LightingManager (for example) 00162 WorldDate=-1; 00163 } 00165 virtual void init(); 00166 00167 00169 00170 00171 virtual void traverse(IObs *caller) =0; 00173 00174 00176 // @{ 00178 virtual void addParent(IObs *father); 00179 // @} 00180 00181 }; 00182 00183 00184 // *************************************************************************** 00196 class CDefaultHrcObs : public IBaseHrcObs 00197 { 00198 public: 00199 00200 00202 CDefaultHrcObs() {} 00203 00204 00206 virtual void traverse(IObs *caller) 00207 { 00208 // DoIt the sons. 00209 traverseSons(); 00210 } 00211 00212 00213 }; 00214 00215 00216 } 00217 00218 00219 #endif // NL_HRC_TRAV_H 00220 00221 /* End of hrc_trav.h */ |