#include <move_primitive.h>
Inheritance diagram for NLPACS::CMovePrimitive:

This primitive can be a 2d oriented box or a 2d oriented cylinder.
Nevrax France
Definition at line 52 of file move_primitive.h.
From UMovePrimitive | |
| bool | checkTestTime (uint32 testTime, uint32 maxTestIteration) |
| float | getAbsorbtion () const |
| TCollisionMask | getCollisionMask () const |
| NLMISC::CVectorD | getFinalPosition (uint8 worldImage) const |
| void | getGlobalPosition (UGlobalPosition &pos, uint8 worldImage) const |
| float | getHeight () const |
| float | getMass () const |
| bool | getObstacle () const |
| TCollisionMask | getOcclusionMask () const |
| double | getOrientation (uint8 worldImage) const |
| TType | getPrimitiveType () const |
| float | getRadius () const |
| TReaction | getReactionType () const |
| void | getSize (float &width, float &depth) const |
| const NLMISC::CVectorD & | getSpeed (uint8 worldImage) const |
| TTrigger | getTriggerType () const |
| void | insertInWorldImage (uint8 worldImage) |
| bool | isInCollision (CMovePrimitive *primitive) |
| void | move (const NLMISC::CVectorD &speed, uint8 worldImage) |
| void | removeFromWorldImage (uint8 worldImage) |
| void | setAbsorbtion (float attenuation) |
| void | setGlobalPosition (const UGlobalPosition &pos, uint8 worldImage) |
| void | setGlobalPosition (const NLMISC::CVectorD &pos, uint8 worldImage, UGlobalPosition::TType type=UGlobalPosition::Unspecified) |
| void | setOrientation (double rot, uint8 worldImage) |
| float | _Attenuation |
| TCollisionMask | _CollisionMask |
| CMoveContainer * | _Container |
| uint8 | _FirstWorldImage |
| float | _Height |
| sint32 | _IterationCount |
| uint32 | _LastTestTime |
| float | _Length [2] |
| uint8 | _NumWorldImage |
| TCollisionMask | _OcclusionMask |
| CCollisionOTInfo * | _RootOTInfo |
| uint16 | _StaticFlags |
| CPrimitiveWorldImage ** | _WorldImages |
Public Types | |
| typedef uint32 | TCollisionMask |
| Type of the collision mask. | |
| enum | TReaction { DoNothing = 0x0, Slide = 0x10, Reflexion = 0x20, Stop = 0x40 } |
| Reaction mode. More... | |
| enum | TTrigger { NotATrigger = 0x0, EnterTrigger = 0x100, ExitTrigger = 0x200, OverlapTrigger = 0x400 } |
| Reaction mode. More... | |
| enum | TType { _2DOrientedBox = 0x0, _2DOrientedCylinder = 0x1 } |
| Primitive mode. More... | |
| typedef uint64 | TUserData |
Public Member Functions | |
| void | addCollisionOTInfo (CCollisionOTInfo *info) |
| Add a collision time ordered table element. | |
| void | checkSortedList () |
| Check sorted lists. | |
| CMovePrimitive (CMoveContainer *container, uint8 firstWorldImage, uint8 numWorldImage) | |
| Constructor. | |
| void | dirtAllPos () |
| float | getAttenuation () const |
| Get attenuation. | |
| TCollisionMask | getCollisionMaskInternal () const |
| Get collision mask. | |
| bool | getDontSnapToGround () const |
| Test if snapping to ground is off. | |
| uint8 | getFirstWorldImage () const |
| virtual uint8 | getFirstWorldImageV () const |
| float | getHeightInternal () const |
| Get height. | |
| float | getLength (uint where) const |
| Get length. | |
| uint8 | getNumWorldImage () const |
| virtual uint8 | getNumWorldImageV () const |
| TCollisionMask | getOcclusionMaskInternal () const |
| Get occlusion mask. | |
| TType | getPrimitiveTypeInternal () const |
| Get primitive type. | |
| float | getRadiusInternal () const |
| Get length. | |
| TReaction | getReactionTypeInternal () const |
| Get reaction type. | |
| TTrigger | getTriggerTypeInternal () const |
| Get reaction type. | |
| CPrimitiveWorldImage * | getWorldImage (uint i) const |
| bool | isCollisionable () const |
| Is collisionable. | |
| bool | isInserted (uint i) const |
| bool | isNonCollisionable () const |
| bool | isObstacle () const |
| Is an obstacle ? | |
| bool | isTriggered (CMovePrimitive &second, bool enter, bool exit) |
| Check trigger flag. | |
| void | removeCollisionOTInfo () |
| Remove all collision time ordered table element. | |
| void | removeCollisionOTInfo (CCollisionOTInfo *toRemove) |
| Remove one collision time ordered table element. | |
| void | setCollisionMask (TCollisionMask mask) |
| virtual void | setDontSnapToGround (bool dont) |
| void | setHeight (float height) |
| void | setNonCollisionable (bool nonCollisionable) |
| void | setObstacle (bool obstacle) |
| void | setOcclusionMask (TCollisionMask mask) |
| void | setPrimitiveType (TType type) |
| void | setRadius (float radius) |
| void | setReactionType (TReaction type) |
| void | setSize (float width, float depth) |
| void | setTriggerType (TTrigger type) |
| virtual | ~CMovePrimitive () |
| Destructor. | |
Data Fields | |
| TUserData | UserData |
Private Types | |
| enum | TStaticFlags { PrimitiveMask = 0x000f, ReactionMask = 0x00f0, TriggerMask = 0x0f00, ObstacleFlag = 0x1000, NonCollisionableFlag = 0x2000, DontSnapToGroundFlag = 0x4000, ForceSize = 0xffff } |
Friends | |
| class | CMoveContainer |
|
|
Type of the collision mask.
Definition at line 57 of file u_move_primitive.h. Referenced by NLNET::CPacsClient::setCollisionMask(), and NLNET::CPacsClient::setOcclusionMask(). |
|
|
|
Reaction mode.
Definition at line 80 of file u_move_primitive.h.
|
|
|
Definition at line 58 of file move_primitive.h.
00059 {
00060 // Mask for the primitive type
00061 PrimitiveMask =0x000f,
00062
00063 // Mask for the primitive type
00064 ReactionMask =0x00f0,
00065
00066 // Mask for the trigger type
00067 TriggerMask =0x0f00,
00068
00069 // Obstacle flag. This flag tells that this object is an obstacle for others objects.
00070 ObstacleFlag =0x1000,
00071
00072 // Ghost flag. This flag tells that this object is a ghost object or not.
00073 NonCollisionableFlag =0x2000,
00074
00076 DontSnapToGroundFlag = 0x4000,
00077
00078 // Force the size to uint16.
00079 ForceSize =0xffff
00080 };
|
|
|
Reaction mode.
Definition at line 104 of file u_move_primitive.h.
00105 {
00109 NotATrigger=0x0,
00110
00114 EnterTrigger=0x100,
00115
00119 ExitTrigger=0x200,
00120
00124 OverlapTrigger=0x400,
00125 };
|
|
|
Primitive mode.
Definition at line 61 of file u_move_primitive.h.
00062 {
00068 _2DOrientedBox=0x0,
00069
00075 _2DOrientedCylinder=0x1,
00076 };
|
|
||||||||||||||||
|
Constructor.
|
|
|
Destructor.
|
|
|
Add a collision time ordered table element.
Definition at line 349 of file move_primitive.h. References _RootOTInfo, and NLPACS::CCollisionOTInfo::primitiveLink().
00350 {
00351 // Link to the list
00352 info->primitiveLink (this, _RootOTInfo);
00353 _RootOTInfo=info;
00354 }
|
|
|
Check sorted lists.
|
|
||||||||||||
|
Definition at line 393 of file move_primitive.h. References _IterationCount, _LastTestTime, and uint32. Referenced by NLPACS::CPrimitiveWorldImage::evalCollision().
00394 {
00395 // Already checked for this test time ?
00396 if (testTime!=_LastTestTime)
00397 {
00398 // First time this primitive is visited at this test
00399 _LastTestTime=testTime;
00400
00401 // Test counter
00402 _IterationCount=maxTestIteration;
00403 }
00404 else
00405 {
00406 // Too many test this primitive ?
00407 if (_IterationCount<=0)
00408 {
00409 // nlwarning("in checkTestTime(): Get to the max iteration count");
00410 return false;
00411 }
00412 else
00413 _IterationCount--;
00414 }
00415 // Ok, test can be performed
00416 return true;
00417 }
|
|
|
Definition at line 154 of file move_primitive.h. References _Container, _NumWorldImage, _WorldImages, NLPACS::CPrimitiveWorldImage::dirtPos(), and uint.
00155 {
00156 for (uint i=0; i<_NumWorldImage; i++)
00157 {
00158 // Get world image and check if it exist
00159 CPrimitiveWorldImage *worldImage=_WorldImages[i];
00160
00161 // Dirt its pos
00162 worldImage->dirtPos (_Container, this, i+_FirstWorldImage);
00163 }
00164 }
|
|
|
Set the attenuation of collision for this object. Default value is 1. Should be between 0~1. 0, all the enrgy is attenuated by the collision. 1, all the energy stay in the object. Used only with the flag Reflexion.
Implements NLPACS::UMovePrimitive. |
|
|
Get attenuation.
Definition at line 313 of file move_primitive.h. References _Attenuation. Referenced by NLPACS::CPrimitiveWorldImage::reaction().
00314 {
00315 return _Attenuation;
00316 }
|
|
|
Set the collision mask for this primitive. Default mask is 0xffffffff.
Implements NLPACS::UMovePrimitive. |
|
|
Get collision mask.
Definition at line 299 of file move_primitive.h. References _CollisionMask. Referenced by NLPACS::CPrimitiveWorldImage::evalCollision().
00300 {
00301 // New position
00302 return _CollisionMask;
00303 }
|
|
|
Test if snapping to ground is off.
Implements NLPACS::UMovePrimitive. Definition at line 96 of file move_primitive.h. References _StaticFlags, and DontSnapToGroundFlag.
00097 {
00098 return (_StaticFlags & DontSnapToGroundFlag) != 0;
00099 }
|
|
|
Get the position of the move primitive at the end of the movement. This method is slow. Just for initilisation and teleportation. If you modify a noncollisionable primitive with this method, you must evaluate in the world image where you have modify it before modify any other dynamic properties in another world image.
Implements NLPACS::UMovePrimitive. |
|
|
Definition at line 142 of file move_primitive.h. References uint8.
00143 {
00144 return _FirstWorldImage;
00145 }
|
|
|
Return the first world image Implements NLPACS::UMovePrimitive. |
|
||||||||||||
|
Set the global position of the move primitive. This method is fast because you must pass the global position of the primitive. If you modify a noncollisionable primitive with this method, you must evaluate in the world image where you have modify it before modify any other dynamic properties in another world image.
Implements NLPACS::UMovePrimitive. |
|
|
Set the height. For boxes or cylinder.
Implements NLPACS::UMovePrimitive. |
|
|
Get height.
Definition at line 325 of file move_primitive.h. Referenced by NLPACS::CPrimitiveWorldImage::evalCollisionOCoverOC(), NLPACS::CPrimitiveWorldImage::evalCollisionPoverOC(), NLPACS::CPrimitiveWorldImage::evalCollisionPoverS(), and NLPACS::CPrimitiveWorldImage::evalCollisionSoverOC().
00326 {
00327 return _Height;
00328 }
|
|
|
Get length.
Definition at line 319 of file move_primitive.h. References uint. Referenced by NLPACS::CPrimitiveWorldImage::evalCollision(), NLPACS::CPrimitiveWorldImage::evalCollisionPoverS(), NLPACS::CPrimitiveWorldImage::evalCollisionSoverOC(), and NLPACS::CPrimitiveWorldImage::precalcPos().
00320 {
00321 return _Length[where];
00322 }
|
|
|
Definition at line 421 of file move_primitive.h. References _StaticFlags, nlassert, and PrimitiveMask. Referenced by NLPACS::CPrimitiveWorldImage::reaction().
00422 {
00423 // Box ?
00424 if ( (_StaticFlags&PrimitiveMask) == _2DOrientedBox )
00425 return _Length[0]*_Length[1]*_Height;
00426 // Cylinder ?
00427 else
00428 {
00429 nlassert ( (_StaticFlags&PrimitiveMask) == _2DOrientedCylinder );
00430 return _Length[0]*(float)NLMISC::Pi*_Height;
00431 }
00432 }
|
|
|
Definition at line 148 of file move_primitive.h. References _NumWorldImage, and uint8.
00149 {
00150 return _NumWorldImage;
00151 }
|
|
|
Return the num of world image Implements NLPACS::UMovePrimitive. |
|
|
Set the obstacle flag.
Implements NLPACS::UMovePrimitive. |
|
|
Set the occlusion mask for this primitive. Default mask is 0xffffffff.
Implements NLPACS::UMovePrimitive. |
|
|
Get occlusion mask.
Definition at line 306 of file move_primitive.h. References _OcclusionMask. Referenced by NLPACS::CPrimitiveWorldImage::evalCollision().
00307 {
00308 // New position
00309 return _OcclusionMask;
00310 }
|
|
|
Set the new orientation of the move primitive. Only for the box primitives. If you modify a noncollisionable primitive with this method, you must evaluate in the world image where you have modify it before modify any other dynamic properties in another world image.
Implements NLPACS::UMovePrimitive. |
|
|
Set the primitive type.
Implements NLPACS::UMovePrimitive. |
|
|
Get primitive type.
Definition at line 278 of file move_primitive.h. References _StaticFlags, PrimitiveMask, and uint32. Referenced by NLPACS::CPrimitiveWorldImage::evalCollision(), NLPACS::CPrimitiveWorldImage::evalCollisionOBoverOB(), NLPACS::CPrimitiveWorldImage::evalCollisionOBoverOC(), NLPACS::CPrimitiveWorldImage::evalCollisionOCoverOC(), NLPACS::CPrimitiveWorldImage::evalCollisionPoverOC(), NLPACS::CPrimitiveWorldImage::evalCollisionPoverS(), NLPACS::CPrimitiveWorldImage::evalCollisionSoverOC(), NLPACS::CPrimitiveWorldImage::precalcBB(), and NLPACS::CPrimitiveWorldImage::precalcPos().
00279 {
00280 // New position
00281 return (TType)(_StaticFlags&(uint32)PrimitiveMask);
00282 }
|
|
|
Set the cylinder size. Only for cylinder.
Implements NLPACS::UMovePrimitive. |
|
|
Get length.
Definition at line 331 of file move_primitive.h. Referenced by NLPACS::CPrimitiveWorldImage::evalCollision(), NLPACS::CPrimitiveWorldImage::evalCollisionOCoverOC(), NLPACS::CPrimitiveWorldImage::evalCollisionPoverOC(), NLPACS::CPrimitiveWorldImage::evalCollisionSoverOC(), and NLPACS::CPrimitiveWorldImage::precalcBB().
00332 {
00333 return _Length[0];
00334 }
|
|
|
Set the reaction type.
Implements NLPACS::UMovePrimitive. |
|
|
Get reaction type.
Definition at line 285 of file move_primitive.h. References _StaticFlags, ReactionMask, and uint32. Referenced by NLPACS::CPrimitiveWorldImage::reaction().
00286 {
00287 // New position
00288 return (TReaction)(_StaticFlags&(uint32)ReactionMask);
00289 }
|
|
||||||||||||
|
Set the box size. Only for boxes.
Implements NLPACS::UMovePrimitive. |
|
|
Get the speed vector for this primitive. the new speed vector. Implements NLPACS::UMovePrimitive. |
|
|
Set the trigger type. Default type is NotATrigger.
Implements NLPACS::UMovePrimitive. |
|
|
Get reaction type.
Definition at line 292 of file move_primitive.h. References _StaticFlags, TriggerMask, and uint32.
00293 {
00294 // New position
00295 return (TTrigger)(_StaticFlags&(uint32)TriggerMask);
00296 }
|
|
|
Definition at line 116 of file move_primitive.h. References _NumWorldImage, _WorldImages, nlassert, and uint. Referenced by NLPACS::CMoveContainer::changed(), NLPACS::CPrimitiveWorldImage::checkSortedList(), isInserted(), and NLPACS::CMoveCell::updateSortedLists().
00117 {
00118 // Checks this primitive belong of the requested world image.
00119 nlassert ((i>=(uint)_FirstWorldImage)&&(i<(uint)_FirstWorldImage+(uint)_NumWorldImage));
00120
00121 // Return the good one
00122 return _WorldImages[i-_FirstWorldImage];
00123 }
|
|
|
Insert the primitive in a world image of the move container. This primitive must a collisionable primitive.
Implements NLPACS::UMovePrimitive. |
|
|
Is collisionable.
Implements NLPACS::UMovePrimitive. Definition at line 343 of file move_primitive.h. References isNonCollisionable(). Referenced by NLPACS::CMoveContainer::changed().
00344 {
00345 return !isNonCollisionable();
00346 }
|
|
|
|
|
|
Definition at line 126 of file move_primitive.h. References _NumWorldImage, getWorldImage(), NLPACS::CPrimitiveWorldImage::isInWorldImageFlag(), and uint.
00127 {
00128 // Checks
00129 if ((i>=(uint)_FirstWorldImage)&&(i<(uint)_FirstWorldImage+(uint)_NumWorldImage))
00130 {
00131 // Get world image
00132 return getWorldImage (i)->isInWorldImageFlag ();
00133 }
00134 else
00135 return false;
00136 }
|
|
|
Definition at line 101 of file move_primitive.h. References _StaticFlags, and NonCollisionableFlag. Referenced by isCollisionable().
00102 {
00103 return (_StaticFlags&NonCollisionableFlag)!=0;
00104 }
|
|
|
Is an obstacle ?
Definition at line 337 of file move_primitive.h. References _StaticFlags, and ObstacleFlag. Referenced by NLPACS::CPrimitiveWorldImage::reaction().
00338 {
00339 return (_StaticFlags&ObstacleFlag)!=0;
00340 }
|
|
||||||||||||||||
|
Check trigger flag.
|
|
||||||||||||
|
Move the primitive. This method is fast. Use it to move primitives. If you modify a noncollisionable primitive with this method, you must evaluate in the world image where you have modify it before modify any other dynamic properties in another world image.
Implements NLPACS::UMovePrimitive. |
|
|
Remove all collision time ordered table element.
|
|
|
Remove one collision time ordered table element.
Referenced by NLPACS::CCollisionOTStaticInfo::removeFromPrimitives(), and NLPACS::CCollisionOTDynamicInfo::removeFromPrimitives(). |
|
|
Remove the primitive from a world image of the move container. This primitive must a collisionable primitive.
Implements NLPACS::UMovePrimitive. |
|
|
Set the attenuation of collision for this object. Default value is 1. Should be between 0~1. 0, all the enrgy is attenuated by the collision. 1, all the energy stay in the object. Used only with the flag Reflexion.
Implements NLPACS::UMovePrimitive. |
|
|
Set the collision mask for this primitive. Default mask is 0xffffffff.
Implements NLPACS::UMovePrimitive. Definition at line 207 of file move_primitive.h. References _CollisionMask.
00208 {
00209 _CollisionMask=mask;
00210 }
|
|
|
Tells that the primitive should not be snapped to ground. The default is false Implements NLPACS::UMovePrimitive. Definition at line 90 of file move_primitive.h. References _StaticFlags, and DontSnapToGroundFlag.
00091 {
00092 if (dont) _StaticFlags |= DontSnapToGroundFlag;
00093 else _StaticFlags &= ~DontSnapToGroundFlag;
00094 }
|
|
||||||||||||
|
Set the global position of the move primitive. This method is fast because you must pass the global position of the primitive. If you modify a noncollisionable primitive with this method, you must evaluate in the world image where you have modify it before modify any other dynamic properties in another world image.
Implements NLPACS::UMovePrimitive. |
|
||||||||||||||||
|
Set the global position of the move primitive. Setting the global position can take a long time if you use a UGlobalRetriever. Set the position with this method only the first time or for teleporting. If you modify a noncollisionable primitive with this method, you must evaluate in the world image where you have modify it before modify any other dynamic properties in another world image.
Implements NLPACS::UMovePrimitive. |
|
|
Set the height. For boxes or cylinder.
Implements NLPACS::UMovePrimitive. Definition at line 257 of file move_primitive.h. References height.
|
|
|
Definition at line 107 of file move_primitive.h. References _StaticFlags, and NonCollisionableFlag.
00108 {
00109 if (nonCollisionable)
00110 _StaticFlags|=NonCollisionableFlag;
00111 else
00112 _StaticFlags&=~NonCollisionableFlag;
00113 }
|
|
|
Set the obstacle flag.
Implements NLPACS::UMovePrimitive. Definition at line 227 of file move_primitive.h. References _StaticFlags, ObstacleFlag, and uint32.
00228 {
00229 // New flag
00230 if (obstacle)
00231 _StaticFlags|=ObstacleFlag;
00232 else
00233 _StaticFlags&=~(uint32)ObstacleFlag;
00234 }
|
|
|
Set the occlusion mask for this primitive. Default mask is 0xffffffff.
Implements NLPACS::UMovePrimitive. Definition at line 217 of file move_primitive.h. References _OcclusionMask.
00218 {
00219 _OcclusionMask=mask;
00220 }
|
|
||||||||||||
|
Set the new orientation of the move primitive. Only for the box primitives. If you modify a noncollisionable primitive with this method, you must evaluate in the world image where you have modify it before modify any other dynamic properties in another world image.
Implements NLPACS::UMovePrimitive. |
|
|
Set the primitive type.
Implements NLPACS::UMovePrimitive. Definition at line 171 of file move_primitive.h. References _StaticFlags, PrimitiveMask, type, and uint32.
00172 {
00173 // New position
00174 _StaticFlags&=~(uint32)PrimitiveMask;
00175 _StaticFlags|=type;
00176 }
|
|
|
Set the cylinder size. Only for cylinder.
Implements NLPACS::UMovePrimitive. Definition at line 268 of file move_primitive.h. References _StaticFlags, nlassert, PrimitiveMask, and uint32.
|
|
|
Set the reaction type.
Implements NLPACS::UMovePrimitive. Definition at line 183 of file move_primitive.h. References _StaticFlags, ReactionMask, type, and uint32.
00184 {
00185 // New position
00186 _StaticFlags&=~(uint32)ReactionMask;
00187 _StaticFlags|=type;
00188 }
|
|
||||||||||||
|
Set the box size. Only for boxes.
Implements NLPACS::UMovePrimitive. Definition at line 242 of file move_primitive.h. References _StaticFlags, depth, nlassert, PrimitiveMask, uint32, and width.
|
|
|
Set the trigger type. Default type is NotATrigger.
Implements NLPACS::UMovePrimitive. Definition at line 195 of file move_primitive.h. References _StaticFlags, TriggerMask, type, and uint32.
00196 {
00197 // New position
00198 _StaticFlags&=~(uint32)TriggerMask;
00199 _StaticFlags|=type;
00200 }
|
|
|
Definition at line 55 of file move_primitive.h. |
|
|
Definition at line 447 of file move_primitive.h. Referenced by getAttenuation(). |
|
|
Definition at line 462 of file move_primitive.h. Referenced by getCollisionMaskInternal(), and setCollisionMask(). |
|
|
Definition at line 465 of file move_primitive.h. Referenced by dirtAllPos(). |
|
|
Definition at line 456 of file move_primitive.h. |
|
|
Definition at line 444 of file move_primitive.h. |
|
|
Definition at line 477 of file move_primitive.h. Referenced by checkTestTime(). |
|
|
Definition at line 474 of file move_primitive.h. Referenced by checkTestTime(). |
|
|
Definition at line 441 of file move_primitive.h. |
|
|
Definition at line 453 of file move_primitive.h. Referenced by dirtAllPos(), getNumWorldImage(), getWorldImage(), and isInserted(). |
|
|
Definition at line 459 of file move_primitive.h. Referenced by getOcclusionMaskInternal(), and setOcclusionMask(). |
|
|
Definition at line 468 of file move_primitive.h. Referenced by addCollisionOTInfo(). |
|
|
Definition at line 450 of file move_primitive.h. Referenced by getDontSnapToGround(), getMass(), getPrimitiveTypeInternal(), getReactionTypeInternal(), getTriggerTypeInternal(), isNonCollisionable(), isObstacle(), setDontSnapToGround(), setNonCollisionable(), setObstacle(), setPrimitiveType(), setRadius(), setReactionType(), setSize(), and setTriggerType(). |
|
|
Definition at line 471 of file move_primitive.h. Referenced by dirtAllPos(), and getWorldImage(). |
|
|
User data. Definition at line 130 of file u_move_primitive.h. |
1.3.6