mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 23:23:52 +00:00
Merge branch 'move_actors_into_scene' into 'master'
Move actors into the scene after a teleport See merge request OpenMW/openmw!438
This commit is contained in:
commit
a3dfdde9ef
4 changed files with 12 additions and 11 deletions
|
@ -297,12 +297,19 @@ namespace MWPhysics
|
|||
return mPreviousMovementResults;
|
||||
}
|
||||
|
||||
const PtrPositionList& PhysicsTaskScheduler::resetSimulation()
|
||||
const PtrPositionList& PhysicsTaskScheduler::resetSimulation(const ActorMap& actors)
|
||||
{
|
||||
std::unique_lock lock(mSimulationMutex);
|
||||
mMovementResults.clear();
|
||||
mPreviousMovementResults.clear();
|
||||
mActorsFrameData.clear();
|
||||
|
||||
for (const auto& [_, actor] : actors)
|
||||
{
|
||||
actor->resetPosition();
|
||||
actor->setStandingOnPtr(nullptr);
|
||||
mMovementResults[actor->getPtr()] = actor->getWorldPosition();
|
||||
}
|
||||
return mMovementResults;
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace MWPhysics
|
|||
/// @return new position of each actor
|
||||
const PtrPositionList& moveActors(int numSteps, float timeAccum, std::vector<ActorFrameData>&& actorsData, osg::Timer_t frameStart, unsigned int frameNumber, osg::Stats& stats);
|
||||
|
||||
const PtrPositionList& resetSimulation();
|
||||
const PtrPositionList& resetSimulation(const ActorMap& actors);
|
||||
|
||||
// Thread safe wrappers
|
||||
void rayTest(const btVector3& rayFromWorld, const btVector3& rayToWorld, btCollisionWorld::RayResultCallback& resultCallback) const;
|
||||
|
|
|
@ -677,14 +677,7 @@ namespace MWPhysics
|
|||
mTimeAccum -= numSteps * mPhysicsDt;
|
||||
|
||||
if (skipSimulation)
|
||||
{
|
||||
for (auto& [_, actor] : mActors)
|
||||
{
|
||||
actor->resetPosition();
|
||||
actor->setStandingOnPtr(nullptr);
|
||||
}
|
||||
return mTaskScheduler->resetSimulation();
|
||||
}
|
||||
return mTaskScheduler->resetSimulation(mActors);
|
||||
|
||||
return mTaskScheduler->moveActors(numSteps, mTimeAccum, prepareFrameData(numSteps), frameStart, frameNumber, stats);
|
||||
}
|
||||
|
|
|
@ -57,6 +57,8 @@ namespace MWPhysics
|
|||
class Actor;
|
||||
class PhysicsTaskScheduler;
|
||||
|
||||
using ActorMap = std::map<MWWorld::ConstPtr, std::shared_ptr<Actor>>;
|
||||
|
||||
struct ContactPoint
|
||||
{
|
||||
MWWorld::Ptr mObject;
|
||||
|
@ -265,7 +267,6 @@ namespace MWPhysics
|
|||
|
||||
std::set<Object*> mAnimatedObjects; // stores pointers to elements in mObjects
|
||||
|
||||
using ActorMap = std::map<MWWorld::ConstPtr, std::shared_ptr<Actor>>;
|
||||
ActorMap mActors;
|
||||
|
||||
using HeightFieldMap = std::map<std::pair<int, int>, HeightField *>;
|
||||
|
|
Loading…
Reference in a new issue