|
|
|
|
Documentation |
|
Main Page Namespace List Class Hierarchy Alphabetical List Compound List File List Namespace Members Compound Members File Members Related Pages Search
NL3D::CTessFacePriorityList Class ReferenceThis class manage a Priority list of elements, inserted with a "distance".
More...
#include <tess_face_priority_list.h>
List of all members.
Detailed Description
This class manage a Priority list of elements, inserted with a "distance".
The priority list can be shifted, so elements with new distance <=0 are pulled from the priority list.
NB: it works quite well if you have (as example) a distStep of 1, and you shift only with value of 0.01 etc.., because it manages a "Remainder system", which do the good stuff. How does it works? in essence, it is a Rolling table, with 1+ shift back when necessary (maybe not at each shift()).
Additionally, it includes a "2D quadrant" notion. If you use this class to know when the "camera" enters a specific area, then Quadrants help you because the notion of direction is kept. Only the XY plane is used here.
Instead, if you use this class to know when the "camera" leaves a specific area, then the quadrant notion is not interesting since the camera can leave the area in any direction...
-
Author:
-
Lionel Berenguier , Nevrax France
-
Date:
-
2001
Definition at line 112 of file tess_face_priority_list.h.
Constructor & Destructor Documentation
NL3D::CTessFacePriorityList::CTessFacePriorityList |
( |
|
) |
|
|
NL3D::CTessFacePriorityList::~CTessFacePriorityList |
( |
|
) |
|
|
Member Function Documentation
void NL3D::CTessFacePriorityList::clear |
( |
|
) |
|
|
const NLMISC::CVector& NL3D::CTessFacePriorityList::getQuadrantDirection |
( |
uint |
quadrantId |
) |
const [inline] |
|
void NL3D::CTessFacePriorityList::init |
( |
float |
distStep, |
|
|
uint |
numEntries, |
|
|
float |
distMaxMod, |
|
|
uint |
numQuadrant |
|
) |
|
|
|
Clear and Init the priority list.
It reserve (numQuadrants+1) Rolling table of numEntries entries. -
Parameters:
-
numEntries |
gives the number of entries and MUST be powerOf2. distMax= numEntries*distStep |
-
m distMaxMod is important for performance and MUST be < 1. eg: distMaxMod= 0.8.
-
It is a trick to avoid the "Too Far Priority problem". Imagine you have a setup such distMax= 1000, and you insert(1100, an element). If we clamp to the max, it may be a bad thing, because ALL elements inserted after 1000 will be poped in one shift(), after 1000 shift(1) for example. To avoid this, if distMaxMod==0.8, then insert(1050) will really insert at 850, so elements will be poped not as the same time (for the extra cost of some elements get poped too early...).
-
Parameters:
-
numQuadrant |
set 0 if don't want to support quadrant notion. else set >=4 and a power of 2 (else nlassert) |
Definition at line 150 of file tess_face_priority_list.cpp.
References _EntryModStart, _MaskEntries, _MaskQuadrant, _NEntries, _NumQuadrant, _OODistStep, _QuarterQuadrantEnd, _QuarterQuadrantStart, _RollingTables, NLMISC::clamp, clear, NLMISC::isPowerOf2, nlassert, and NLMISC::Pi. |
void NL3D::CTessFacePriorityList::insert |
( |
uint |
quadrantId, |
|
|
float |
distance, |
|
|
CTessFace * |
value |
|
) |
|
|
|
Insert an element at a given distance, and in a given quadrant.
Insert at the closest step. eg insert(1.2, elt) will insert elt at entry 1 (assuming distStep==1 here). Special case: if distance<=0, it is ensured that at each shift(), the element will be pulled. NB: manage correctly the entry where it is inserted, according to the Remainder system.
USE OptFastFloor if distance>0 => MUST be enclosed in OptFastFloorBegin/OptFastFloorEnd() -
Parameters:
-
quadrantId |
set 0 if you want to insert in the "direction less" rolling table. else set the value returned by selectQuadrant() |
distance |
if quadrantId==0, distance should be the norm()-SphereSize, else it shoudl be direction*quadrantDirection-SphereSize. |
Definition at line 273 of file tess_face_priority_list.cpp.
References _EntryModStart, _MaskEntries, _NEntries, _OODistStep, _RollingTables, nlassert, NL3D::OptFastFloor, and value. |
|
Shift the Priority list in a given direction.
NB: for each rolling table, even if shiftDistance==0, all elements in the entry 0 are pulled out. -
m pulledElements is the root of the list which will contains elements pulled from the list.
-
Definition at line 314 of file tess_face_priority_list.cpp.
References _NEntries, _OODistStep, _RollingTables, and nlassert. |
Member Data Documentation
uint NL3D::CTessFacePriorityList::_EntryModStart [private]
|
|
uint NL3D::CTessFacePriorityList::_MaskEntries [private]
|
|
uint NL3D::CTessFacePriorityList::_MaskQuadrant [private]
|
|
uint NL3D::CTessFacePriorityList::_NEntries [private]
|
|
uint NL3D::CTessFacePriorityList::_NumQuadrant [private]
|
|
float NL3D::CTessFacePriorityList::_OODistStep [private]
|
|
uint NL3D::CTessFacePriorityList::_QuarterQuadrantEnd[4] [private]
|
|
uint NL3D::CTessFacePriorityList::_QuarterQuadrantStart[4] [private]
|
|
float NL3D::CTessFacePriorityList::_Remainder [private]
|
|
std::vector<CRollingTable> NL3D::CTessFacePriorityList::_RollingTables [private]
|
|
The documentation for this class was generated from the following files:
|
|