Show bonus/malus timer text if available
[ryzomcore.git] / nel / src / 3d / anim_detail_trav.cpp
blob563e95da8e4a72bfd8081140fa06a0454cd8b7e0
1 // NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 #include "std3d.h"
19 #include "nel/3d/anim_detail_trav.h"
20 #include "nel/3d/hrc_trav.h"
21 #include "nel/3d/transform.h"
22 #include "nel/3d/skeleton_model.h"
23 #include "nel/misc/hierarchical_timer.h"
24 #include "nel/misc/debug.h"
27 using namespace NLMISC;
29 #ifdef DEBUG_NEW
30 #define new DEBUG_NEW
31 #endif
33 namespace NL3D
37 // ***************************************************************************
38 CAnimDetailTrav::CAnimDetailTrav()
40 CurrentDate=0;
41 // prepare some space
42 _VisibleList.resize(1024);
43 _CurrentNumVisibleModels= 0;
46 // ***************************************************************************
47 void CAnimDetailTrav::clearVisibleList()
49 _CurrentNumVisibleModels= 0;
53 // ***************************************************************************
54 void CAnimDetailTrav::traverse()
56 H_AUTO( NL3D_TravAnimDetail );
58 // Inc the date.
59 CurrentDate++;
61 // Traverse all nodes of the visibility list.
62 for(uint i=0; i<_CurrentNumVisibleModels; i++)
64 // NB: some model creation may be done by CParticleSystemModel during this pass.
65 // createModel() may resize _VisibleList.
66 // Hence, must test the actual _VisibleList vector, and not a temporary pointer.
67 CTransform *model= _VisibleList[i];
68 // If this object has an ancestorSkeletonModel
69 if(model->_AncestorSkeletonModel)
71 // then just skip it! because it will be parsed hierarchically by the first
72 // skeletonModel whith _AncestorSkeletonModel==NULL. (only if this one is visible)
73 continue;
75 else
77 // If this is a skeleton model, and because _AncestorSkeletonModel==NULL,
78 // then it means that it is the Root of a hierarchy of transform that have
79 // _AncestorSkeletonModel!=NULL.
80 if( model->isSkeleton() )
82 // Then I must update hierarchically me and the sons (according to HRC hierarchy graph) of this model.
83 traverseHrcRecurs(model);
85 else
87 // else, just traverse AnimDetail, an do nothing for Hrc sons
88 model->traverseAnimDetail();
95 // ***************************************************************************
96 void CAnimDetailTrav::traverseHrcRecurs(CTransform *model)
98 // first, just doIt me
99 model->traverseAnimDetail();
102 // then doIt my sons in Hrc.
103 uint num= model->hrcGetNumChildren();
104 for(uint i=0;i<num;i++)
105 traverseHrcRecurs(model->hrcGetChild(i));
109 // ***************************************************************************
110 void CAnimDetailTrav::reserveVisibleList(uint numModels)
112 // enlarge only.
113 if(numModels>_VisibleList.size())
114 _VisibleList.resize(numModels);
118 } // NL3D