From 0ea5fc66924303d1bf73ba283a383e2aadee02f2 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Aug 2018 20:21:34 +0200 Subject: Initial commit --- docs/doxygen/nel/a03709.html | 638 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 638 insertions(+) create mode 100644 docs/doxygen/nel/a03709.html (limited to 'docs/doxygen/nel/a03709.html') diff --git a/docs/doxygen/nel/a03709.html b/docs/doxygen/nel/a03709.html new file mode 100644 index 00000000..6f41190f --- /dev/null +++ b/docs/doxygen/nel/a03709.html @@ -0,0 +1,638 @@ + + +NeL: NL3D::CVisualCollisionManager::CStaticGrid class Reference + + + +
+

NL3D::CVisualCollisionManager::CStaticGrid Class Reference

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Public Member Functions

void add (uint16 id, const NLMISC::CAABBox &bbox)
void compile ()
void create (uint nbQuads, uint nbElts, const NLMISC::CAABBox &gridBBox)
uint select (const NLMISC::CAABBox &bbox, std::vector< uint16 > &res)

Private Attributes

NLMISC::CObjectVector< CEltBuild,
+ false > 
_EltBuild
NLMISC::CObjectVector< CCase,
+ false > 
_Grid
NLMISC::CObjectVector< uint16,
+ false > 
_GridData
uint32 _GridDataSize
CVector _GridPos
CVector _GridScale
uint32 _GridSize
uint32 _GridSizePower
uint32 _ItSession
NLMISC::CObjectVector< uint32,
+ false > 
_Sessions
+

Member Function Documentation

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NL3D::CVisualCollisionManager::CStaticGrid::add uint16  id,
const NLMISC::CAABBox bbox
+
+ + + + + +
+   + + +

+ +

+Definition at line 200 of file visual_collision_manager.cpp. +

+References _EltBuild, _GridDataSize, _GridPos, _GridScale, _GridSize, _GridSizePower, NLMISC::clamp(), NLMISC::CAABBox::getMax(), NLMISC::CAABBox::getMin(), sint, uint, uint16, x, NLMISC::CVector::x, y, and NLMISC::CVector::y. +

+Referenced by NL3D::CVisualCollisionManager::CMeshCol::build(). +

+

00201 {
+00202         CVector minp= bbox.getMin() - _GridPos;
+00203         CVector maxp= bbox.getMax() - _GridPos;
+00204 
+00205         // compute the 2D bbox
+00206         sint    xmin= (sint)floorf(minp.x*_GridScale.x);
+00207         sint    ymin= (sint)floorf(minp.y*_GridScale.y);
+00208         sint    xmax= (sint)ceilf(maxp.x*_GridScale.x);
+00209         sint    ymax= (sint)ceilf(maxp.y*_GridScale.y);
+00210         clamp(xmin, 0, (sint)_GridSize-1);
+00211         clamp(ymin, 0, (sint)_GridSize-1);
+00212         clamp(xmax, 0, (sint)_GridSize);
+00213         clamp(ymax, 0, (sint)_GridSize);
+00214 
+00215         // set in the elt build
+00216         _EltBuild[id].X0= xmin;
+00217         _EltBuild[id].Y0= ymin;
+00218         _EltBuild[id].X1= xmax;
+00219         _EltBuild[id].Y1= ymax;
+00220 
+00221         // for each case touched, increment NumElts
+00222         for(uint y=ymin;y<(uint)ymax;y++)
+00223         {
+00224                 for(uint x=xmin;x<(uint)xmax;x++)
+00225                 {
+00226                         _Grid[(y<<_GridSizePower)+x].NumElts++;
+00227                         _GridDataSize++;
+00228                 }
+00229         }
+00230 }
+
+

+ + + + +
+ + + + + + + + + +
void NL3D::CVisualCollisionManager::CStaticGrid::compile  ) 
+
+ + + + + +
+   + + +

+ +

+Definition at line 233 of file visual_collision_manager.cpp. +

+References _EltBuild, _GridData, _GridDataSize, _GridSizePower, _Sessions, NLMISC::CObjectVector< CEltBuild, false >::clear(), NLMISC::CObjectVector< uint32, false >::fill(), nlassert, NL3D::CVisualCollisionManager::CStaticGrid::CCase::NumElts, NLMISC::CObjectVector< uint32, false >::resize(), NLMISC::CObjectVector< uint16, false >::resize(), NLMISC::CObjectVector< CEltBuild, false >::size(), NLMISC::CObjectVector< CCase, false >::size(), NL3D::CVisualCollisionManager::CStaticGrid::CCase::Start, uint, x, NL3D::CVisualCollisionManager::CStaticGrid::CEltBuild::X0, NL3D::CVisualCollisionManager::CStaticGrid::CEltBuild::X1, y, NL3D::CVisualCollisionManager::CStaticGrid::CEltBuild::Y0, and NL3D::CVisualCollisionManager::CStaticGrid::CEltBuild::Y1. +

+Referenced by NL3D::CVisualCollisionManager::CMeshCol::build(). +

+

00234 {
+00235         uint    i;
+00236 
+00237         // create the data
+00238         _GridData.resize(_GridDataSize);
+00239 
+00240         // Init Start ptr for each case
+00241         uint    idx= 0;
+00242         for(i=0;i<_Grid.size();i++)
+00243         {
+00244                 _Grid[i].Start= idx;
+00245                 idx+= _Grid[i].NumElts;
+00246                 // reset NumElts, because use it like an index below
+00247                 _Grid[i].NumElts= 0;
+00248         }
+00249         nlassert(_GridDataSize==idx);
+00250 
+00251         // For each element, fill the grid and grid data
+00252         for(i=0;i<_EltBuild.size();i++)
+00253         {
+00254                 CEltBuild       &eb= _EltBuild[i];
+00255 
+00256                 for(uint y=eb.Y0;y<eb.Y1;y++)
+00257                 {
+00258                         for(uint x=eb.X0;x<eb.X1;x++)
+00259                         {
+00260                                 CCase   &gcase= _Grid[(y<<_GridSizePower)+x];
+00261                                 uint    idx= gcase.Start + gcase.NumElts;
+00262                                 // store the idx
+00263                                 _GridData[idx]= i;
+00264                                 // increment the number of elements for this case
+00265                                 gcase.NumElts++;
+00266                         }
+00267                 }
+00268         }
+00269 
+00270         // create the temp array used for intersection test
+00271         _Sessions.resize(_EltBuild.size());
+00272         _Sessions.fill(0);
+00273         
+00274         // clear no more needed data
+00275         _EltBuild.clear();
+00276 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
void NL3D::CVisualCollisionManager::CStaticGrid::create uint  nbQuads,
uint  nbElts,
const NLMISC::CAABBox gridBBox
+
+ + + + + +
+   + + +

+ +

+Definition at line 172 of file visual_collision_manager.cpp. +

+References _EltBuild, _GridDataSize, _GridPos, _GridScale, _GridSize, _GridSizePower, _ItSession, NLMISC::CAABBox::getMin(), NLMISC::getPowerOf2(), NLMISC::CObjectVector< CCase, false >::getPtr(), NLMISC::CAABBox::getSize(), NLMISC::isPowerOf2(), nlassert, NLMISC::CObjectVector< CEltBuild, false >::resize(), NLMISC::CObjectVector< CCase, false >::resize(), NLMISC::CObjectVector< CCase, false >::size(), uint, NLMISC::CVector::x, and NLMISC::CVector::y. +

+Referenced by NL3D::CVisualCollisionManager::CMeshCol::build(). +

+

00173 {
+00174         nlassert(nbQuads>0 && isPowerOf2(nbQuads));
+00175 
+00176         // init the grid
+00177         _GridSize= nbQuads;
+00178         _GridSizePower= getPowerOf2(nbQuads);
+00179         _Grid.resize(_GridSize*_GridSize);
+00180         // start with 0 elt in each case
+00181         memset(_Grid.getPtr(), 0, _Grid.size() * sizeof(CCase));
+00182 
+00183         // init the Elt Build
+00184         _EltBuild.resize(nbElts);
+00185 
+00186         // total size is 0
+00187         _GridDataSize= 0;
+00188 
+00189         // bbox init
+00190         _GridPos= gridBBox.getMin();
+00191         _GridScale= gridBBox.getSize();
+00192         _GridScale.x= _GridSize / _GridScale.x;
+00193         _GridScale.y= _GridSize / _GridScale.y;
+00194 
+00195         // reset intersection data
+00196         _ItSession= 0;
+00197 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
uint NL3D::CVisualCollisionManager::CStaticGrid::select const NLMISC::CAABBox bbox,
std::vector< uint16 > &  res
+
+ + + + + +
+   + + +

+ +

+Definition at line 279 of file visual_collision_manager.cpp. +

+References _GridData, _GridPos, _GridScale, _GridSize, _GridSizePower, _ItSession, _Sessions, NLMISC::clamp(), NLMISC::CAABBox::getMax(), NLMISC::CAABBox::getMin(), NL3D::CVisualCollisionManager::CStaticGrid::CCase::NumElts, res, sint, NLMISC::CObjectVector< uint32, false >::size(), NL3D::CVisualCollisionManager::CStaticGrid::CCase::Start, uint, x, NLMISC::CVector::x, y, and NLMISC::CVector::y. +

+Referenced by NL3D::CVisualCollisionManager::CMeshCol::getCameraCollision(). +

+

00280 {
+00281         // increment the intersection session
+00282         _ItSession++;
+00283         // enlarge the result array as needed
+00284         if(res.size()<_Sessions.size())
+00285                 res.resize(_Sessions.size());
+00286         // the number of selected element
+00287         uint    numSel= 0;
+00288 
+00289         // compute the 2D bbox
+00290         CVector minp= bbox.getMin() - _GridPos;
+00291         CVector maxp= bbox.getMax() - _GridPos;
+00292         sint    xmin= (sint)floorf(minp.x*_GridScale.x);
+00293         sint    ymin= (sint)floorf(minp.y*_GridScale.y);
+00294         sint    xmax= (sint)ceilf(maxp.x*_GridScale.x);
+00295         sint    ymax= (sint)ceilf(maxp.y*_GridScale.y);
+00296         clamp(xmin, 0, (sint)_GridSize-1);
+00297         clamp(ymin, 0, (sint)_GridSize-1);
+00298         clamp(xmax, 0, (sint)_GridSize);
+00299         clamp(ymax, 0, (sint)_GridSize);
+00300 
+00301         // for each case touched, increment NumElts
+00302         for(uint y=ymin;y<(uint)ymax;y++)
+00303         {
+00304                 for(uint x=xmin;x<(uint)xmax;x++)
+00305                 {
+00306                         CCase   &gcase= _Grid[(y<<_GridSizePower)+x];
+00307                         // for each element in this case
+00308                         for(uint i= gcase.Start;i<gcase.Start + gcase.NumElts;i++)
+00309                         {
+00310                                 uint    elt= _GridData[i];
+00311 
+00312                                 // if not alread inserted in the dest
+00313                                 if(_Sessions[elt]!=_ItSession)
+00314                                 {
+00315                                         // mark as intersected
+00316                                         _Sessions[elt]= _ItSession;
+00317                                         // append
+00318                                         res[numSel++]= elt;
+00319                                 }
+00320                         }
+00321                 }
+00322         }
+00323         
+00324         // return the number of selected elements
+00325         return numSel;
+00326 }
+
+


Field Documentation

+

+ + + + +
+ + +
NLMISC::CObjectVector<CEltBuild, false> NL3D::CVisualCollisionManager::CStaticGrid::_EltBuild [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 172 of file visual_collision_manager.h. +

+Referenced by add(), compile(), and create().

+

+ + + + +
+ + +
NLMISC::CObjectVector<CCase, false> NL3D::CVisualCollisionManager::CStaticGrid::_Grid [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 168 of file visual_collision_manager.h.

+

+ + + + +
+ + +
NLMISC::CObjectVector<uint16, false> NL3D::CVisualCollisionManager::CStaticGrid::_GridData [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 170 of file visual_collision_manager.h. +

+Referenced by compile(), and select().

+

+ + + + +
+ + +
uint32 NL3D::CVisualCollisionManager::CStaticGrid::_GridDataSize [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 173 of file visual_collision_manager.h. +

+Referenced by add(), compile(), and create().

+

+ + + + +
+ + +
CVector NL3D::CVisualCollisionManager::CStaticGrid::_GridPos [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 165 of file visual_collision_manager.h. +

+Referenced by add(), create(), and select().

+

+ + + + +
+ + +
CVector NL3D::CVisualCollisionManager::CStaticGrid::_GridScale [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 166 of file visual_collision_manager.h. +

+Referenced by add(), create(), and select().

+

+ + + + +
+ + +
uint32 NL3D::CVisualCollisionManager::CStaticGrid::_GridSize [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 164 of file visual_collision_manager.h. +

+Referenced by add(), create(), and select().

+

+ + + + +
+ + +
uint32 NL3D::CVisualCollisionManager::CStaticGrid::_GridSizePower [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 163 of file visual_collision_manager.h. +

+Referenced by add(), compile(), create(), and select().

+

+ + + + +
+ + +
uint32 NL3D::CVisualCollisionManager::CStaticGrid::_ItSession [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 176 of file visual_collision_manager.h. +

+Referenced by create(), and select().

+

+ + + + +
+ + +
NLMISC::CObjectVector<uint32, false> NL3D::CVisualCollisionManager::CStaticGrid::_Sessions [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 178 of file visual_collision_manager.h. +

+Referenced by compile(), and select().

+


The documentation for this class was generated from the following files: +
Generated on Tue Mar 16 08:27:05 2004 for NeL by + +doxygen +1.3.6
+ + -- cgit v1.2.1