A container for movable objects Some constraints: * The move bounding box must be lower than the cell size. More...
#include <u_move_container.h>
Inherited by NLPACS::CMoveContainer.
Public Member Functions | |
| virtual | ~UMoveContainer () |
| destructor | |
Manage primitives. | |
| virtual UMovePrimitive * | addCollisionablePrimitive (uint8 firstWorldImage, uint8 numWorldImage, const UMovePrimitive *copyFrom=NULL)=0 |
| Add a collisionable primitive in the container. | |
| virtual UMovePrimitive * | addNonCollisionablePrimitive (const UMovePrimitive *copyFrom=NULL)=0 |
| Add a noncollisionable primitive in the container. | |
| virtual bool | loadCollisionablePrimitiveBlock (const char *filename, uint8 firstWorldImage, uint8 numWorldImage, std::vector< UMovePrimitive * > *primitives, float orientation, const NLMISC::CVector &position, bool dontSnapToGround=false)=0 |
| Load a PACS primitive block. | |
| virtual void | addCollisionnablePrimitiveBlock (UPrimitiveBlock *pb, uint8 firstWorldImage, uint8 numWorldImage, std::vector< UMovePrimitive * > *primitives, float orientation, const NLMISC::CVector &position, bool dontSnapToGround=false, const NLMISC::CVector &scale=NLMISC::CVector(1.0f, 1.0f, 1.0f))=0 |
| The same as loadCollisionablePrimitiveBlock, but the primitive block is provided by the caller. | |
| virtual void | removePrimitive (UMovePrimitive *primitive)=0 |
| Remove a primitive from the container. | |
| virtual void | getPrimitives (std::vector< const UMovePrimitive * > &dest) const =0 |
| Get all the primitives in the container. | |
Primitive evaluation. | |
| virtual void | evalCollision (double deltaTime, uint8 worldImage)=0 |
| Evaluation of a worldImage of the collision system. | |
| virtual bool | evalNCPrimitiveCollision (double deltaTime, UMovePrimitive *primitive, uint8 worldImage)=0 |
| Evaluation of a single non collisionable primitive. | |
| virtual bool | testMove (UMovePrimitive *primitive, const NLMISC::CVectorD &speed, double deltaTime, uint8 worldImage, NLMISC::CVectorD *contactNormal)=0 |
| Test the move of a primitive in a specific world image. | |
World image management. | |
| virtual void | setAsStatic (uint8 worldImage)=0 |
| Set world image as static world image. | |
| virtual void | duplicateWorldImage (uint8 source, uint8 dest)=0 |
| Duplicate a world image in another. | |
Triggers info. | |
| virtual uint | getNumTriggerInfo () const =0 |
| Get number of trigger informations. | |
| virtual const UTriggerInfo & | getTriggerInfo (uint id) const =0 |
| Get the n-th trigger informations. | |
Static Public Member Functions | |
Create methods. | |
| static UMoveContainer * | createMoveContainer (double xmin, double ymin, double xmax, double ymax, uint widthCellCount, uint heightCellCount, double primitiveMaxSize, uint8 numWorldImage=NELPACS_DEFAULT_NUM_WORLD_IMAGE, uint maxIteration=NELPACS_DEFAULT_MAX_TEST_ITERATION, uint otSize=NELPACS_DEFAULT_OT_SIZE) |
| static UMoveContainer * | createMoveContainer (UGlobalRetriever *retriever, uint widthCellCount, uint heightCellCount, double primitiveMaxSize, uint8 numWorldImage=NELPACS_DEFAULT_NUM_WORLD_IMAGE, uint maxIteration=NELPACS_DEFAULT_MAX_TEST_ITERATION, uint otSize=NELPACS_DEFAULT_OT_SIZE) |
| static void | deleteMoveContainer (UMoveContainer *container) |
| static void | getPACSCoordsFromMatrix (NLMISC::CVector &pos, float &angle, const NLMISC::CMatrix &mat) |
| Get a pacs position and an orientation from a matrix. | |
A container for movable objects Some constraints: * The move bounding box must be lower than the cell size.
Definition at line 58 of file u_move_container.h.
| virtual NLPACS::UMoveContainer::~UMoveContainer | ( | ) | [inline, virtual] |
destructor
Definition at line 65 of file u_move_container.h.
| virtual UMovePrimitive* NLPACS::UMoveContainer::addCollisionablePrimitive | ( | uint8 | firstWorldImage, | |
| uint8 | numWorldImage, | |||
| const UMovePrimitive * | copyFrom = NULL | |||
| ) | [pure virtual] |
Add a collisionable primitive in the container.
Return the pointer on the primitive. This primitive will generate collisions when the system evaluate other primitives against.
You must specify the ids of each world image where the primitive can be inserted. Thoses ids are consecutives. If you choose 5 as first id and 3 as id count, this primitive could be inserted in the world image #5, #6 and #7.
This primtive should be inserted in a world image before use. See UMovePrimitive::insertInWorldImage.
| firstWorldImage | is the first world image where the primitive can be inserted. | |
| numWorldImage | is the count of world image where the primitive can be inserted. |
Implemented in NLPACS::CMoveContainer.
| virtual void NLPACS::UMoveContainer::addCollisionnablePrimitiveBlock | ( | UPrimitiveBlock * | pb, | |
| uint8 | firstWorldImage, | |||
| uint8 | numWorldImage, | |||
| std::vector< UMovePrimitive * > * | primitives, | |||
| float | orientation, | |||
| const NLMISC::CVector & | position, | |||
| bool | dontSnapToGround = false, |
|||
| const NLMISC::CVector & | scale = NLMISC::CVector(1.0f, 1.0f, 1.0f) | |||
| ) | [pure virtual] |
The same as loadCollisionablePrimitiveBlock, but the primitive block is provided by the caller.
Implemented in NLPACS::CMoveContainer.
| virtual UMovePrimitive* NLPACS::UMoveContainer::addNonCollisionablePrimitive | ( | const UMovePrimitive * | copyFrom = NULL |
) | [pure virtual] |
Add a noncollisionable primitive in the container.
Return the pointer on the primitive. This primitive won't generate collisions when the system evaluate other primitives against.
This primitive can't be inserted in a world image.
| copyFrom | is an optional primitive to copy attributes from (so the primitive is initialised with same values) |
Implemented in NLPACS::CMoveContainer.
| UMoveContainer * NLPACS::UMoveContainer::createMoveContainer | ( | UGlobalRetriever * | retriever, | |
| uint | widthCellCount, | |||
| uint | heightCellCount, | |||
| double | primitiveMaxSize, | |||
| uint8 | numWorldImage = NELPACS_DEFAULT_NUM_WORLD_IMAGE, |
|||
| uint | maxIteration = NELPACS_DEFAULT_MAX_TEST_ITERATION, |
|||
| uint | otSize = NELPACS_DEFAULT_OT_SIZE | |||
| ) | [static] |
Definition at line 1757 of file move_container.cpp.
References nlassert.
| UMoveContainer * NLPACS::UMoveContainer::createMoveContainer | ( | double | xmin, | |
| double | ymin, | |||
| double | xmax, | |||
| double | ymax, | |||
| uint | widthCellCount, | |||
| uint | heightCellCount, | |||
| double | primitiveMaxSize, | |||
| uint8 | numWorldImage = NELPACS_DEFAULT_NUM_WORLD_IMAGE, |
|||
| uint | maxIteration = NELPACS_DEFAULT_MAX_TEST_ITERATION, |
|||
| uint | otSize = NELPACS_DEFAULT_OT_SIZE | |||
| ) | [static] |
Definition at line 1746 of file move_container.cpp.
| void NLPACS::UMoveContainer::deleteMoveContainer | ( | UMoveContainer * | container | ) | [static] |
Definition at line 1382 of file move_container.cpp.
| virtual void NLPACS::UMoveContainer::duplicateWorldImage | ( | uint8 | source, | |
| uint8 | dest | |||
| ) | [pure virtual] |
Duplicate a world image in another.
All primitive will be removed from the destination world image. Then, the source world image will be copied in the destination world image.
Warning, only primitives from the source that have been declared as using the destination world image will be copied.
The source world image remain the same.
| source | is the id of the source world image for the copy. | |
| dest | is the id of the destination world image for the copy. |
Implemented in NLPACS::CMoveContainer.
| virtual void NLPACS::UMoveContainer::evalCollision | ( | double | deltaTime, | |
| uint8 | worldImage | |||
| ) | [pure virtual] |
Evaluation of a worldImage of the collision system.
This method will evaluate the move of each modified collisionable primitives inserted in the world image. The method first test collisions against the terrain, then test collisions against primitives inserted in the world images declared as static, then test collisions against the primitives inserted in the world image to evaluate.
| deltaTime | is the delta time of the system evaluation. | |
| worldImage | is the world image to eval. |
Implemented in NLPACS::CMoveContainer.
| virtual bool NLPACS::UMoveContainer::evalNCPrimitiveCollision | ( | double | deltaTime, | |
| UMovePrimitive * | primitive, | |||
| uint8 | worldImage | |||
| ) | [pure virtual] |
Evaluation of a single non collisionable primitive.
The method first test collisions against the terrain, then test collisions against primitives inserted in the world images declared as static, then test collisions against the primitives inserted in the world image to evaluate.
| deltaTime | is the delta time of the system evaluation. | |
| primitive | is the primitive pointer | |
| worldImage | is the world image to eval. |
Implemented in NLPACS::CMoveContainer.
| virtual uint NLPACS::UMoveContainer::getNumTriggerInfo | ( | ) | const [pure virtual] |
Get number of trigger informations.
Implemented in NLPACS::CMoveContainer.
| void NLPACS::UMoveContainer::getPACSCoordsFromMatrix | ( | NLMISC::CVector & | pos, | |
| float & | angle, | |||
| const NLMISC::CMatrix & | mat | |||
| ) | [static] |
Get a pacs position and an orientation from a matrix.
Definition at line 1928 of file move_container.cpp.
References NLMISC::CMatrix::getPos(), NLMISC::CVector::I, NLMISC::CMatrix::mulVector(), NLMISC::CVector::normalize(), NLMISC::Pi, NLMISC::CVector::x, NLMISC::CVector::y, and NLMISC::CVector::z.
| virtual void NLPACS::UMoveContainer::getPrimitives | ( | std::vector< const UMovePrimitive * > & | dest | ) | const [pure virtual] |
Get all the primitives in the container.
Implemented in NLPACS::CMoveContainer.
| virtual const UTriggerInfo& NLPACS::UMoveContainer::getTriggerInfo | ( | uint | id | ) | const [pure virtual] |
Get the n-th trigger informations.
Implemented in NLPACS::CMoveContainer.
| virtual bool NLPACS::UMoveContainer::loadCollisionablePrimitiveBlock | ( | const char * | filename, | |
| uint8 | firstWorldImage, | |||
| uint8 | numWorldImage, | |||
| std::vector< UMovePrimitive * > * | primitives, | |||
| float | orientation, | |||
| const NLMISC::CVector & | position, | |||
| bool | dontSnapToGround = false | |||
| ) | [pure virtual] |
Load a PACS primitive block.
(*.pacs_prim)
Add a set of collisionable primitive in the container. If success, fill an array with primitives's pointers. The primitive are inserted in the requested world image of the container. Then a setGlobalPosition is done to place the primitives in the world image. The world images are not evaluated.
You must specify the ids of each world image where the primitives can be inserted. Thoses ids are consecutives. If you choose 5 as first id and 3 as id count, those primitives could be inserted in the world image #5, #6 and #7.
Those primtives should be inserted in a world image before use. See UMovePrimitive::insertInWorldImage.
Return false if the world image numbers are not present in the move container.
Can raise unhandled NLMISC::Exception if trouble during serialisation.
| filename | is the file to load. | |
| firstWorldImage | is the first world image where the primitive can be inserted. | |
| numWorldImage | is the count of world image where the primitive can be inserted. | |
| primitives | is a pointer on an array of primitive pointer to fill if success. If NULL, Do return nothing. | |
| orientation | is the orientation to give to the primitives. | |
| position | is the position to give to the primitives. | |
| primitives | is a pointer on an array of primitive pointer to fill if success. If NULL, Do return nothing. | |
| dontSnapToGround | force the inserted primitive to be flagged as 'DontSnapToGround' |
Implemented in NLPACS::CMoveContainer.
| virtual void NLPACS::UMoveContainer::removePrimitive | ( | UMovePrimitive * | primitive | ) | [pure virtual] |
Remove a primitive from the container.
| primitive | is the pointer on the primitive to remove. |
Implemented in NLPACS::CMoveContainer.
| virtual void NLPACS::UMoveContainer::setAsStatic | ( | uint8 | worldImage | ) | [pure virtual] |
Set world image as static world image.
This method set this world image as static. It means that primitives inserted there don't move. Each primitive evaluation methods will first test all the primitives in the world images declared as static. Then, the evalutation test the primtive in the asked worldImage.
| worldImage | is the id of the world image to set as static. |
Implemented in NLPACS::CMoveContainer.
| virtual bool NLPACS::UMoveContainer::testMove | ( | UMovePrimitive * | primitive, | |
| const NLMISC::CVectorD & | speed, | |||
| double | deltaTime, | |||
| uint8 | worldImage, | |||
| NLMISC::CVectorD * | contactNormal | |||
| ) | [pure virtual] |
Test the move of a primitive in a specific world image.
This method will test the move of each modified primitives inserted in the world image. The method will first test collisions against primitives inserted in the world images declared as static, then test collisions against the primitives inserted in the world image choosed to test the move of the primitive.
| primitive | is a pointer on the primitive | |
| speed | is the wanted speed of the primitive | |
| deltaTime | is the deltaTime of the move of the primitive. | |
| worldImage | is the world image where you want to test the move of the primitive. | |
| contactNormal | is a pointer to CVectorD to store contactNormal with terrain, if not NULL |
Implemented in NLPACS::CMoveContainer.
1.6.1