Merge branch 'main/rendor-staging' into fixes
[ryzomcore.git] / nel / src / 3d / vegetable_instance_group.cpp
blob2e48f740a3f09904b7b654970b3f9e18432f8c98
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/vegetable_instance_group.h"
21 #ifdef DEBUG_NEW
22 #define new DEBUG_NEW
23 #endif
25 namespace NL3D
29 // ***************************************************************************
30 CVegetableInstanceGroup::CVegetableInstanceGroup()
32 _ClipOwner= NULL;
33 _SortOwner= NULL;
34 _HasZSortPassInstances= false;
35 _TriangleQuadrantOrderNumTriangles= 0;
36 _ULPrec= this;
37 _ULNext= this;
38 _ULNumVertices= 0;
42 // ***************************************************************************
43 CVegetableInstanceGroup::~CVegetableInstanceGroup()
45 unlinkUL();
49 // ***************************************************************************
50 void CVegetableInstanceGroup::linkBeforeUL(CVegetableInstanceGroup *igNext)
52 nlassert(igNext);
54 // first, unlink others from me. NB: works even if _ULPrec==_ULNext==this.
55 _ULNext->_ULPrec= _ULPrec;
56 _ULPrec->_ULNext= _ULNext;
57 // link to igNext.
58 _ULNext= igNext;
59 _ULPrec= igNext->_ULPrec;
60 // link others to me.
61 _ULNext->_ULPrec= this;
62 _ULPrec->_ULNext= this;
65 // ***************************************************************************
66 void CVegetableInstanceGroup::unlinkUL()
68 // unlink others from me. NB: works even if _ULPrec==_ULNext==this.
69 _ULNext->_ULPrec= _ULPrec;
70 _ULPrec->_ULNext= _ULNext;
71 // reset
72 _ULPrec= this;
73 _ULNext= this;
77 // ***************************************************************************
78 CVegetableInstanceGroupReserve::CVegetableInstanceGroupReserve()
83 // ***************************************************************************
84 bool CVegetableInstanceGroup::isEmpty() const
86 for(uint i=0; i<NL3D_VEGETABLE_NRDRPASS; i++)
88 const CVegetableRdrPass &vegetRdrPass= _RdrPass[i];
89 // If some triangles to render, the ig is not empty
90 if(vegetRdrPass.NTriangles != 0)
91 return false;
94 // for all pass, no triangles to render => the ig is empty.
95 return true;
100 } // NL3D