1 #ifndef OPENMW_MWPHYSICS_PHYSICSSYSTEM_H
2 #define OPENMW_MWPHYSICS_PHYSICSSYSTEM_H
11 #include "../mwworld/ptr.hpp"
27 class BulletShapeManager;
36 class btCollisionWorld;
37 class btBroadphaseInterface;
38 class btDefaultCollisionConfiguration;
39 class btCollisionDispatcher;
40 class btCollisionObject;
41 class btCollisionShape;
83 void addHeightField (
const float* heights,
int x,
int y,
float triSize,
float sqrtVerts);
96 const osg::Vec3f &origin,
97 const osg::Quat &orientation,
190 typedef std::map<MWWorld::ConstPtr, Actor*>
ActorMap;
std::vector< std::pair< MWWorld::Ptr, osg::Vec3f > > PtrVelocityList
Definition: physicssystem.hpp:45
void disableWater()
Definition: physicssystem.cpp:1470
Resource::ResourceSystem * mResourceSystem
Definition: physicssystem.hpp:183
void updatePtr(const MWWorld::Ptr &old, const MWWorld::Ptr &updated)
Definition: physicssystem.cpp:1198
Wrapper class that constructs and provides access to the most commonly used resource subsystems...
Definition: resourcesystem.hpp:24
RayResult castRay(const osg::Vec3f &from, const osg::Vec3f &to, MWWorld::ConstPtr ignore=MWWorld::ConstPtr(), int mask=CollisionType_World|CollisionType_HeightMap|CollisionType_Actor|CollisionType_Door, int group=0xff) const
Definition: physicssystem.cpp:915
std::auto_ptr< btCollisionShape > mWaterCollisionShape
Definition: physicssystem.hpp:215
std::set< Object * > mAnimatedObjects
Definition: physicssystem.hpp:188
osg::ref_ptr< osg::Group > mParentNode
Definition: physicssystem.hpp:219
std::auto_ptr< Resource::BulletShapeManager > mShapeManager
Definition: physicssystem.hpp:182
HeightFieldMap mHeightFields
Definition: physicssystem.hpp:194
void addActor(const MWWorld::Ptr &ptr, const std::string &mesh)
Definition: physicssystem.cpp:1300
float mWaterHeight
Definition: physicssystem.hpp:211
btCollisionDispatcher * mDispatcher
Definition: physicssystem.hpp:179
float mTimeAccum
Definition: physicssystem.hpp:209
void getActorsStandingOn(const MWWorld::ConstPtr &object, std::vector< MWWorld::Ptr > &out) const
Get the handle of all actors standing on object in this frame.
Definition: physicssystem.cpp:1449
void enableWater(float height)
Definition: physicssystem.cpp:1479
void setUnrefQueue(SceneUtil::UnrefQueue *unrefQueue)
Definition: physicssystem.cpp:737
btCollisionWorld * mCollisionWorld
Definition: physicssystem.hpp:180
bool mDebugDrawEnabled
Definition: physicssystem.hpp:196
btDefaultCollisionConfiguration * mCollisionConfiguration
Definition: physicssystem.hpp:178
const Object * getObject(const MWWorld::ConstPtr &ptr) const
Definition: physicssystem.cpp:1237
ObjectMap mObjects
Definition: physicssystem.hpp:186
PtrVelocityList mMovementQueue
Definition: physicssystem.hpp:206
ActorMap mActors
Definition: physicssystem.hpp:191
Definition: collisiontype.hpp:8
osg::ref_ptr< SceneUtil::UnrefQueue > mUnrefQueue
Definition: physicssystem.hpp:175
bool mHit
Definition: physicssystem.hpp:109
std::map< std::pair< int, int >, HeightField * > HeightFieldMap
Definition: physicssystem.hpp:193
Definition: collisiontype.hpp:11
const PtrVelocityList & applyQueuedMovement(float dt)
Apply all queued movements, then clear the list.
Definition: physicssystem.cpp:1344
void markAsNonSolid(const MWWorld::ConstPtr &ptr)
Definition: physicssystem.cpp:762
Definition: physicssystem.hpp:51
Definition: collisiontype.hpp:9
bool toggleDebugRendering()
Definition: physicssystem.cpp:747
~PhysicsSystem()
Definition: physicssystem.cpp:707
std::map< MWWorld::Ptr, MWWorld::Ptr > CollisionMap
Definition: physicssystem.hpp:200
void addHeightField(const float *heights, int x, int y, float triSize, float sqrtVerts)
Definition: physicssystem.cpp:1122
osg::Vec3f getHalfExtents(const MWWorld::ConstPtr &actor) const
Get physical half extents (scaled) of the given actor.
Definition: physicssystem.cpp:1043
Definition: collisiontype.hpp:10
bool isOnGround(const MWWorld::Ptr &actor)
Definition: physicssystem.cpp:1002
void updateRotation(const MWWorld::Ptr &ptr)
Definition: physicssystem.cpp:1264
void getActorsCollidingWith(const MWWorld::ConstPtr &object, std::vector< MWWorld::Ptr > &out) const
Get the handle of all actors colliding with object in this frame.
Definition: physicssystem.cpp:1464
std::pair< MWWorld::Ptr, osg::Vec3f > getHitContact(const MWWorld::ConstPtr &actor, const osg::Vec3f &origin, const osg::Quat &orientation, float queryDistance)
Definition: physicssystem.cpp:828
void updatePosition(const MWWorld::Ptr &ptr)
Definition: physicssystem.cpp:1282
void clearQueuedMovement()
Clear the queued movements list without applying.
Definition: physicssystem.cpp:1338
PtrVelocityList mMovementResults
Definition: physicssystem.hpp:207
bool toggleCollisionMode()
Definition: physicssystem.cpp:1309
std::auto_ptr< MWRender::DebugDrawer > mDebugDrawer
Definition: physicssystem.hpp:217
osg::Vec3f traceDown(const MWWorld::Ptr &ptr, float maxHeight)
Definition: physicssystem.cpp:1113
Pointer to a const LiveCellRef.
Definition: ptr.hpp:90
std::auto_ptr< btCollisionObject > mWaterCollisionObject
Definition: physicssystem.hpp:214
void stepSimulation(float dt)
Definition: physicssystem.cpp:1422
bool isActorCollidingWith(const MWWorld::Ptr &actor, const MWWorld::ConstPtr &object) const
Definition: physicssystem.cpp:1458
osg::Vec3f getRenderingHalfExtents(const MWWorld::ConstPtr &actor) const
Definition: physicssystem.cpp:1052
float mWaterEnabled
Definition: physicssystem.hpp:212
std::vector< MWWorld::Ptr > getCollisions(const MWWorld::ConstPtr &ptr, int collisionGroup, int collisionMask) const
get handles this object collides with
Definition: physicssystem.cpp:1096
void updateCollisionMapPtr(CollisionMap &map, const MWWorld::Ptr &old, const MWWorld::Ptr &updated)
Definition: physicssystem.cpp:1182
Definition: physicssystem.cpp:561
osg::Vec3f mHitPos
Definition: physicssystem.hpp:110
btBroadphaseInterface * mBroadphase
Definition: physicssystem.hpp:177
void removeHeightField(int x, int y)
Definition: physicssystem.cpp:1131
Actor * getActor(const MWWorld::Ptr &ptr)
Definition: physicssystem.cpp:1221
void debugDraw()
Definition: physicssystem.cpp:1433
RayResult castSphere(const osg::Vec3f &from, const osg::Vec3f &to, float radius)
Definition: physicssystem.cpp:952
void setWaterHeight(float height)
Definition: physicssystem.cpp:1489
bool isActorStandingOn(const MWWorld::Ptr &actor, const MWWorld::ConstPtr &object) const
Definition: physicssystem.cpp:1439
void updateScale(const MWWorld::Ptr &ptr)
Definition: physicssystem.cpp:1245
bool isOnSolidGround(const MWWorld::Ptr &actor) const
Definition: physicssystem.cpp:771
CollisionMap mStandingCollisions
Definition: physicssystem.hpp:201
osg::Vec3f getCollisionObjectPosition(const MWWorld::ConstPtr &actor) const
Definition: physicssystem.cpp:1061
std::map< MWWorld::ConstPtr, Object * > ObjectMap
Definition: physicssystem.hpp:185
Definition: physicssystem.hpp:107
PhysicsSystem & operator=(const PhysicsSystem &)
bool getLineOfSight(const MWWorld::ConstPtr &actor1, const MWWorld::ConstPtr &actor2) const
Return true if actor1 can see actor2.
Definition: physicssystem.cpp:976
Handles unreferencing of objects through the WorkQueue. Typical use scenario would be the main thread...
Definition: unrefqueue.hpp:19
Pointer to a LiveCellRef.
Definition: ptr.hpp:19
PhysicsSystem(Resource::ResourceSystem *resourceSystem, osg::ref_ptr< osg::Group > parentNode)
Definition: physicssystem.cpp:685
osg::Vec3f mHitNormal
Definition: physicssystem.hpp:111
std::map< MWWorld::ConstPtr, Actor * > ActorMap
Definition: physicssystem.hpp:190
Resource::BulletShapeManager * getShapeManager()
Definition: physicssystem.cpp:742
void updateWater()
Definition: physicssystem.cpp:1498
bool canMoveToWaterSurface(const MWWorld::ConstPtr &actor, const float waterlevel)
Definition: physicssystem.cpp:1029
MWWorld::Ptr mHitObject
Definition: physicssystem.hpp:112
Definition: physicssystem.cpp:509
Definition: bulletshapemanager.hpp:25
void queueObjectMovement(const MWWorld::Ptr &ptr, const osg::Vec3f &velocity)
Definition: physicssystem.cpp:1323
void addObject(const MWWorld::Ptr &ptr, const std::string &mesh, int collisionType=CollisionType_World)
Definition: physicssystem.cpp:1142
float getHitDistance(const osg::Vec3f &point, const MWWorld::ConstPtr &target) const
Definition: physicssystem.cpp:866