mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 07:23:54 +00:00
Accept a ConstPtr in various physics getters
This commit is contained in:
parent
795032621c
commit
0796f49c17
5 changed files with 24 additions and 24 deletions
|
@ -374,7 +374,7 @@ namespace MWBase
|
|||
virtual bool isUnderwater(const MWWorld::CellStore* cell, const osg::Vec3f &pos) const = 0;
|
||||
virtual bool isOnGround(const MWWorld::Ptr &ptr) const = 0;
|
||||
|
||||
virtual osg::Matrixf getActorHeadTransform(const MWWorld::Ptr& actor) const = 0;
|
||||
virtual osg::Matrixf getActorHeadTransform(const MWWorld::ConstPtr& actor) const = 0;
|
||||
|
||||
virtual void togglePOV() = 0;
|
||||
virtual bool isFirstPerson() const = 0;
|
||||
|
@ -541,14 +541,14 @@ namespace MWBase
|
|||
/// Resets all actors in the current active cells to their original location within that cell.
|
||||
virtual void resetActors() = 0;
|
||||
|
||||
virtual bool isWalkingOnWater (const MWWorld::Ptr& actor) = 0;
|
||||
virtual bool isWalkingOnWater (const MWWorld::ConstPtr& actor) = 0;
|
||||
|
||||
/// Return a vector aiming the actor's weapon towards a target.
|
||||
/// @note The length of the vector is the distance between actor and target.
|
||||
virtual osg::Vec3f aimToTarget(const MWWorld::Ptr& actor, const MWWorld::Ptr& target) = 0;
|
||||
virtual osg::Vec3f aimToTarget(const MWWorld::ConstPtr& actor, const MWWorld::ConstPtr& target) = 0;
|
||||
|
||||
/// Return the distance between actor's weapon and target's collision box.
|
||||
virtual float getHitDistance(const MWWorld::Ptr& actor, const MWWorld::Ptr& target) = 0;
|
||||
virtual float getHitDistance(const MWWorld::ConstPtr& actor, const MWWorld::ConstPtr& target) = 0;
|
||||
|
||||
virtual void removeContainerScripts(const MWWorld::Ptr& reference) = 0;
|
||||
};
|
||||
|
|
|
@ -808,7 +808,7 @@ namespace MWPhysics
|
|||
return std::make_pair(MWWorld::Ptr(), osg::Vec3f());
|
||||
}
|
||||
|
||||
float PhysicsSystem::getHitDistance(const osg::Vec3f &point, const MWWorld::Ptr &target) const
|
||||
float PhysicsSystem::getHitDistance(const osg::Vec3f &point, const MWWorld::ConstPtr &target) const
|
||||
{
|
||||
btCollisionObject* targetCollisionObj = NULL;
|
||||
const Actor* actor = getActor(target);
|
||||
|
@ -965,7 +965,7 @@ namespace MWPhysics
|
|||
}
|
||||
}
|
||||
|
||||
osg::Vec3f PhysicsSystem::getHalfExtents(const MWWorld::Ptr &actor) const
|
||||
osg::Vec3f PhysicsSystem::getHalfExtents(const MWWorld::ConstPtr &actor) const
|
||||
{
|
||||
const Actor* physactor = getActor(actor);
|
||||
if (physactor)
|
||||
|
@ -974,7 +974,7 @@ namespace MWPhysics
|
|||
return osg::Vec3f();
|
||||
}
|
||||
|
||||
osg::Vec3f PhysicsSystem::getRenderingHalfExtents(const MWWorld::Ptr &actor) const
|
||||
osg::Vec3f PhysicsSystem::getRenderingHalfExtents(const MWWorld::ConstPtr &actor) const
|
||||
{
|
||||
const Actor* physactor = getActor(actor);
|
||||
if (physactor)
|
||||
|
@ -983,7 +983,7 @@ namespace MWPhysics
|
|||
return osg::Vec3f();
|
||||
}
|
||||
|
||||
osg::Vec3f PhysicsSystem::getPosition(const MWWorld::Ptr &actor) const
|
||||
osg::Vec3f PhysicsSystem::getPosition(const MWWorld::ConstPtr &actor) const
|
||||
{
|
||||
const Actor* physactor = getActor(actor);
|
||||
if (physactor)
|
||||
|
@ -1157,7 +1157,7 @@ namespace MWPhysics
|
|||
return NULL;
|
||||
}
|
||||
|
||||
const Actor *PhysicsSystem::getActor(const MWWorld::Ptr &ptr) const
|
||||
const Actor *PhysicsSystem::getActor(const MWWorld::ConstPtr &ptr) const
|
||||
{
|
||||
ActorMap::const_iterator found = mActors.find(ptr);
|
||||
if (found != mActors.end())
|
||||
|
|
|
@ -63,7 +63,7 @@ namespace MWPhysics
|
|||
void updatePtr (const MWWorld::Ptr& old, const MWWorld::Ptr& updated);
|
||||
|
||||
Actor* getActor(const MWWorld::Ptr& ptr);
|
||||
const Actor* getActor(const MWWorld::Ptr& ptr) const;
|
||||
const Actor* getActor(const MWWorld::ConstPtr& ptr) const;
|
||||
|
||||
// Object or Actor
|
||||
void remove (const MWWorld::Ptr& ptr);
|
||||
|
@ -95,7 +95,7 @@ namespace MWPhysics
|
|||
/// target vector hits the collision shape and then calculates distance from the intersection point.
|
||||
/// This can be used to find out how much nearer we need to move to the target for a "getHitContact" to be successful.
|
||||
/// \note Only Actor targets are supported at the moment.
|
||||
float getHitDistance(const osg::Vec3f& point, const MWWorld::Ptr& target) const;
|
||||
float getHitDistance(const osg::Vec3f& point, const MWWorld::ConstPtr& target) const;
|
||||
|
||||
struct RayResult
|
||||
{
|
||||
|
@ -117,14 +117,14 @@ namespace MWPhysics
|
|||
bool isOnGround (const MWWorld::Ptr& actor);
|
||||
|
||||
/// Get physical half extents (scaled) of the given actor.
|
||||
osg::Vec3f getHalfExtents(const MWWorld::Ptr& actor) const;
|
||||
osg::Vec3f getHalfExtents(const MWWorld::ConstPtr& actor) const;
|
||||
|
||||
/// @see MWPhysics::Actor::getRenderingHalfExtents
|
||||
osg::Vec3f getRenderingHalfExtents(const MWWorld::Ptr& actor) const;
|
||||
osg::Vec3f getRenderingHalfExtents(const MWWorld::ConstPtr& actor) const;
|
||||
|
||||
/// Get the position of the collision shape for the actor. Use together with getHalfExtents() to get the collision bounds in world space.
|
||||
/// @note The collision shape's origin is in its center, so the position returned can be described as center of the actor collision box in world space.
|
||||
osg::Vec3f getPosition(const MWWorld::Ptr& actor) const;
|
||||
osg::Vec3f getPosition(const MWWorld::ConstPtr& actor) const;
|
||||
|
||||
/// Queues velocity movement for a Ptr. If a Ptr is already queued, its velocity will
|
||||
/// be overwritten. Valid until the next call to applyQueuedMovement.
|
||||
|
|
|
@ -1038,9 +1038,9 @@ namespace MWWorld
|
|||
return facedObject;
|
||||
}
|
||||
|
||||
osg::Matrixf World::getActorHeadTransform(const MWWorld::Ptr& actor) const
|
||||
osg::Matrixf World::getActorHeadTransform(const MWWorld::ConstPtr& actor) const
|
||||
{
|
||||
MWRender::Animation *anim = mRendering->getAnimation(actor);
|
||||
const MWRender::Animation *anim = mRendering->getAnimation(actor);
|
||||
if(anim)
|
||||
{
|
||||
const osg::Node *node = anim->getNode("Head");
|
||||
|
@ -3285,22 +3285,22 @@ namespace MWWorld
|
|||
}
|
||||
}
|
||||
|
||||
bool World::isWalkingOnWater(const Ptr &actor)
|
||||
bool World::isWalkingOnWater(const ConstPtr &actor)
|
||||
{
|
||||
MWPhysics::Actor* physicActor = mPhysics->getActor(actor);
|
||||
const MWPhysics::Actor* physicActor = mPhysics->getActor(actor);
|
||||
if (physicActor && physicActor->isWalkingOnWater())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
osg::Vec3f World::aimToTarget(const Ptr &actor, const MWWorld::Ptr& target)
|
||||
osg::Vec3f World::aimToTarget(const ConstPtr &actor, const MWWorld::ConstPtr& target)
|
||||
{
|
||||
osg::Vec3f weaponPos = getActorHeadTransform(actor).getTrans();
|
||||
osg::Vec3f targetPos = mPhysics->getPosition(target);
|
||||
return (targetPos - weaponPos);
|
||||
}
|
||||
|
||||
float World::getHitDistance(const Ptr &actor, const Ptr &target)
|
||||
float World::getHitDistance(const ConstPtr &actor, const ConstPtr &target)
|
||||
{
|
||||
osg::Vec3f weaponPos = getActorHeadTransform(actor).getTrans();
|
||||
return mPhysics->getHitDistance(weaponPos, target);
|
||||
|
|
|
@ -470,7 +470,7 @@ namespace MWWorld
|
|||
virtual bool isWading(const MWWorld::Ptr &object) const;
|
||||
virtual bool isOnGround(const MWWorld::Ptr &ptr) const;
|
||||
|
||||
virtual osg::Matrixf getActorHeadTransform(const MWWorld::Ptr& actor) const;
|
||||
virtual osg::Matrixf getActorHeadTransform(const MWWorld::ConstPtr& actor) const;
|
||||
|
||||
virtual void togglePOV();
|
||||
|
||||
|
@ -640,14 +640,14 @@ namespace MWWorld
|
|||
/// Resets all actors in the current active cells to their original location within that cell.
|
||||
virtual void resetActors();
|
||||
|
||||
virtual bool isWalkingOnWater (const MWWorld::Ptr& actor);
|
||||
virtual bool isWalkingOnWater (const MWWorld::ConstPtr& actor);
|
||||
|
||||
/// Return a vector aiming the actor's weapon towards a target.
|
||||
/// @note The length of the vector is the distance between actor and target.
|
||||
virtual osg::Vec3f aimToTarget(const MWWorld::Ptr& actor, const MWWorld::Ptr& target);
|
||||
virtual osg::Vec3f aimToTarget(const MWWorld::ConstPtr& actor, const MWWorld::ConstPtr& target);
|
||||
|
||||
/// Return the distance between actor's weapon and target's collision box.
|
||||
virtual float getHitDistance(const MWWorld::Ptr& actor, const MWWorld::Ptr& target);
|
||||
virtual float getHitDistance(const MWWorld::ConstPtr& actor, const MWWorld::ConstPtr& target);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue