Inheritance diagram for col::CollisionPipeline:
Collision detection module API | |
CollisionPipeline (const osg::Char8 *thread_name=NULL, unsigned int thread_id=0) | |
Initialize the collision detection module. | |
void | check (unsigned int *num_moved=NULL) |
Collision detection query. | |
void | run (unsigned int number) |
If Pipeline is used as with OSGThreads, then this function starts the thread. | |
void | setSyncFun (SyncFun *fun) |
Set the synchronization-function. | |
void | useConvexHulls (bool useconvexhulls) |
Inital value is false. | |
void | addCallback (Callback *callback) |
Add a callback to the collision pipeline. | |
void | addCycleCallback (Callback *callback) |
Add a cycle-callback to the collision pipeline. | |
void | makeCollidable (osg::NodePtr node) |
Add an object to the collision pipeline, and set it active. | |
void | deactivate (osg::NodePtr node) |
Deactivate an object of the collision pipeline. | |
void | activate (osg::NodePtr node) |
Reactivate an object of the collision pipeline. | |
unsigned int | getCycle (void) |
Get current collision cycle counter. | |
bool | getUseGrid () |
Returns the grid-status. | |
void | useGrid (unsigned int size[3], float min[3], float max[3]) |
use a grid for finding neighbors | |
void | verbose (bool verbPrint, bool verbShowHulls) |
This is primarily for testingand debugging;. | |
bool | getVerbPrint () |
The default value is false. | |
bool | getVerbShowHulls () |
The default value is false. | |
unsigned int | getNumObjs () |
| |
void | setUseHulls (bool useHulls) |
intial value is false | |
bool | getUseHulls () |
| |
virtual | ~CollisionPipeline () |
Delete all internal structures of the collision detection pipeline. | |
static CollisionPipeline * | runConcurrently (char *thread_name=NULL) |
Start the collision pipeline in its own thread. | |
static CollisionPipeline * | get (char *name) |
Return the pipeline, if threading is used. | |
static CollisionPipeline * | find (char *name) |
Find a thread by its name. | |
static osg::BaseThread * | create (const osg::Char8 *thread_name, osg::UInt32 thread_id) |
virtual void | workProc (void) |
Concurrent collision detection loop. | |
Static Public Member Functions | |
static AlgoE | getAlgorithm () |
Return the algorithm which is used. | |
Public Attributes | |
unsigned int | m_thread_id |
The thread id. | |
unsigned int | m_nonEmptyCycles |
Collision detection loop counter. | |
Queue< Request > * | m_requests |
The queue for collision queries (add/remove objects). | |
Matrix * | m_collmatrix |
Collision interest matrix. | |
std::vector< ColObj > * | m_colobjs |
The list of "collidable" objects. | |
std::vector< Callback * > | m_cycle_callbacks |
List of cycle callbacks. | |
ColPipelineData * | m_pipelinedata |
Pipeline Data struct. It consist of the some data, which is used in the pipeline. | |
Grid * | m_grid |
3D grid | |
Static Public Attributes | |
static AlgoE | M_PipelineAlgorithm = ALGO_DOPTREE |
The algorithm to use at the back end (must be specified before check() is called). | |
static int | m_Processor = -1 |
The number of processor on which to lock the coll.det. process. | |
Static Protected Attributes | |
static osg::MPThreadType | m_type |
The idea is that you can have one instance running concurrently with the other threads of your application. (In theory, even multiple instances could be created, but this is untested.)
Exception | If some condition cannot be handled. |
col::CollisionPipeline::CollisionPipeline | ( | const osg::Char8 * | thread_name = NULL , |
|
unsigned int | thread_id = 0 | |||
) |
Initialize the collision detection module.
thread_id | Identification of the thread | |
thread_name | Name of the thread |
useHulls
Feature vereinfachen; es gibt zu viele Stellen, wo man dieses beeinflussen kann.
void col::CollisionPipeline::check | ( | unsigned int * | num_moved = NULL |
) |
Collision detection query.
num_moved | number of objects that have moved since last check (out) |
exception | This function should not throw any exception. The idea is that exceptions are thrown only in init, construction, and other set-up functions (if any). |
CollisionPipeline * col::CollisionPipeline::runConcurrently | ( | char * | thread_name = NULL |
) | [static] |
Start the collision pipeline in its own thread.
After this function returns, the collision pipeline will run in its own thread concurrently to all other threads.
After the thread has been created, you must @ not call check() any more!
Locking the new process to a certain processor work only for SGI currently. You must make sure that the processor has been isolated earlier (see man
mpadmin
).
CollisionPipeline * col::CollisionPipeline::get | ( | char * | name | ) | [static] |
Return the pipeline, if threading is used.
name | the name of the thread |
CollisionPipeline * col::CollisionPipeline::find | ( | char * | name | ) | [static] |
Find a thread by its name.
name | the name of the thread |
void col::CollisionPipeline::run | ( | unsigned int | number | ) |
If Pipeline is used as with OSGThreads, then this function starts the thread.
number | the thread id |
void col::CollisionPipeline::setSyncFun | ( | SyncFun * | fun | ) |
Set the synchronization-function.
fun | the synchronization-function |
void col::CollisionPipeline::addCallback | ( | Callback * | callback | ) |
Add a callback to the collision pipeline.
callback | the callback-struct |
void col::CollisionPipeline::addCycleCallback | ( | Callback * | callback | ) |
Add a cycle-callback to the collision pipeline.
callback | the callback-struct |
void col::CollisionPipeline::makeCollidable | ( | osg::NodePtr | node | ) |
Add an object to the collision pipeline, and set it active.
node | the objetct wich should be tested for collision |
void col::CollisionPipeline::deactivate | ( | osg::NodePtr | node | ) |
Deactivate an object of the collision pipeline.
When an object is deactivated, it will not be tested for collisions anymore
node | the objetct wich should be deactivated |
void col::CollisionPipeline::activate | ( | osg::NodePtr | node | ) |
Reactivate an object of the collision pipeline.
After an object was deactivated from collision testing, it can be reactivated with this function. It is not necessary to call this function after makeCollidable, because makeCollidable sets automatically every object as active.
node | the objetct wich should be reactivated |
unsigned int col::CollisionPipeline::getCycle | ( | void | ) |
Get current collision cycle counter.
Every time the collision detection module finishes a non-empty loop, this counter will be incremented. A loop is empty, if no objects have moved since the last check(). A loop finishes, when it finds out that no pairs have to be checked, or after all pairs have been checked for collision and all callbacks have been called.
The initial value of this counter is 0.
bool col::CollisionPipeline::getUseGrid | ( | ) |
Returns the grid-status.
void col::CollisionPipeline::useGrid | ( | unsigned int | size[3], | |
float | min[3], | |||
float | max[3] | |||
) |
use a grid for finding neighbors
If useGrid is not set, then pairs of "close" neighbors are determined by bbox tests. If useGrid is set, then beighbors are determined by a 3-dimensional grid. However, this gains performance only, if the number of objects is very large (>>100) and the number of polygons per object is low. Set the Parameters for the Grid
size | the grid will have size[0]~size[1]~size[2] cells | |
min,max | extent of the univers |
void col::CollisionPipeline::verbose | ( | bool | verbPrint, | |
bool | verbShowHulls | |||
) |
This is primarily for testingand debugging;.
verbPrint | some additional information as output | |
verbShowHulls | show the hulls of the objects |
bool col::CollisionPipeline::getVerbPrint | ( | ) |
The default value is false.
bool col::CollisionPipeline::getVerbShowHulls | ( | ) |
The default value is false.
void col::CollisionPipeline::setUseHulls | ( | bool | useHulls | ) |
intial value is false
useHulls |
void col::CollisionPipeline::workProc | ( | void | ) | [protected, virtual] |
Concurrent collision detection loop.
Call check() all the time. If there is nothing to do, sleep 100 microsec.
unsigned int col::CollisionPipeline::m_nonEmptyCycles |
Collision detection loop counter.
This can be used by the application to determine if a new collision cycle has started.
The queue for collision queries (add/remove objects).