![]() |
RigsofRods
2023.09
Soft-body Physics Simulation
|
Builds and manages softbody actors (physics on background thread, networking) More...
#include <ActorManager.h>
Public Types | |
| typedef std::vector< FreeForce > | FreeForceVec_t |
Public Member Functions | |
| ActorManager () | |
| ~ActorManager () | |
| void | UpdateActors (ActorPtr player_actor) |
| void | SyncWithSimThread () |
| void | UpdatePhysicsSimulation () |
| void | WakeUpAllActors () |
| void | SendAllActorsSleeping () |
| unsigned long | GetNetTime () |
| int | GetNetTimeOffset (int sourceid) |
| void | UpdateNetTimeOffset (int sourceid, int offset) |
| void | AddStreamMismatch (int sourceid, int streamid) |
| int | CheckNetworkStreamsOk (int sourceid) |
| int | CheckNetRemoteStreamsOk (int sourceid) |
| void | SetTrucksForcedAwake (bool forced) |
| bool | AreTrucksForcedAwake () const |
| void | SetSimulationSpeed (float speed) |
| float | GetSimulationSpeed () const |
| bool | IsSimulationPaused () const |
| void | SetSimulationPaused (bool v) |
| float | GetTotalTime () const |
| RoR::CmdKeyInertiaConfig & | GetInertiaConfig () |
| void | CleanUpSimulation () |
| Call this after simulation loop finishes. More... | |
| void | RepairActor (Collisions *collisions, const Ogre::String &inst, const Ogre::String &box, bool keepPosition=false) |
| void | UpdateSleepingState (ActorPtr player_actor, float dt) |
| void | UpdateInputEvents (float dt) |
| RigDef::DocumentPtr | FetchActorDef (RoR::ActorSpawnRequest &rq) |
| void | ExportActorDef (RigDef::DocumentPtr def, std::string filename, std::string rg_name) |
| void | HandleActorStreamData (std::vector< RoR::NetRecvPacket > packet) |
| bool | LoadScene (Ogre::String filename) |
| bool | SaveScene (Ogre::String filename) |
| void | RestoreSavedState (ActorPtr actor, rapidjson::Value const &j_entry) |
| ActorPtrVec & | GetActors () |
| std::vector< ActorPtr > | GetLocalActors () |
| std::pair< ActorPtr, float > | GetNearestActor (Ogre::Vector3 position) |
| bool | AreActorsDirectlyLinked (const ActorPtr &a1, const ActorPtr &a2) |
Actor lifetime | |
| ActorPtr | CreateNewActor (ActorSpawnRequest rq, RigDef::DocumentPtr def) |
| void | DeleteActorInternal (ActorPtr actor) |
Do not call directly; use GameContext::DeleteActor() More... | |
Actor lookup | |
| const ActorPtr & | GetActorById (ActorInstanceID_t actor_id) |
| const ActorPtr & | GetActorByNetworkLinks (int source_id, int stream_id) |
| ActorPtr | FindActorInsideBox (Collisions *collisions, const Ogre::String &inst, const Ogre::String &box) |
| const ActorPtr & | FetchNextVehicleOnList (ActorPtr player, ActorPtr prev_player) |
| const ActorPtr & | FetchPreviousVehicleOnList (ActorPtr player, ActorPtr prev_player) |
| const ActorPtr & | FetchRescueVehicle () |
Free forces | |
| void | AddFreeForce (FreeForceRequest *rq) |
| void | ModifyFreeForce (FreeForceRequest *rq) |
| void | RemoveFreeForce (FreeForceID_t id) |
| bool | FindFreeForce (FreeForceID_t id, FreeForceVec_t::iterator &out_itor) |
| FreeForceVec_t & | GetFreeForces () |
Data Fields | |
| std::map< beam_t *, std::pair< ActorPtr, ActorPtr > > | inter_actor_links |
Static Public Attributes | |
| static const ActorPtr | ACTORPTR_NULL |
Private Member Functions | |
| bool | CheckActorCollAabbIntersect (int a, int b) |
| Returns whether or not the bounding boxes of truck a and truck b intersect. Based on the truck collision bounding boxes. More... | |
| bool | PredictActorCollAabbIntersect (int a, int b) |
| Returns whether or not the bounding boxes of truck a and truck b might intersect during the next framestep. Based on the truck collision bounding boxes. More... | |
| void | RemoveStreamSource (int sourceid) |
| void | RecursiveActivation (int j, std::vector< bool > &visited) |
| void | ForwardCommands (ActorPtr source_actor) |
| Fowards things to trailers. More... | |
| void | UpdateTruckFeatures (ActorPtr vehicle, float dt) |
| void | CalcFreeForces () |
| Apply FreeForces - intentionally as a separate pass over all actors. More... | |
Private Attributes | |
| std::map< int, std::set< int > > | m_stream_mismatches |
| Networking: A set of streams without a corresponding actor in the actor-array for each stream source. More... | |
| std::map< int, int > | m_stream_time_offsets |
| Networking: A network time offset for each stream source. More... | |
| Ogre::Timer | m_net_timer |
| ActorPtrVec | m_actors |
Use MSG_SIM_{SPAWN/DELETE}_ACTOR_REQUESTED More... | |
| ActorInstanceID_t | m_actor_next_instance_id = 1 |
| Unique sequential ID for each Actor. More... | |
| bool | m_forced_awake = false |
| disables sleep counters More... | |
| int | m_physics_steps = 0 |
| float | m_dt_remainder = 0.f |
| Keeps track of the rounding error in the time step calculation. More... | |
| float | m_simulation_speed = 1.f |
| slow motion < 1.0 < fast motion More... | |
| float | m_last_simulation_speed = 0.1f |
| previously used time ratio between real time (evt.timeSinceLastFrame) and physics time ('dt' used in calcPhysics) More... | |
| float | m_simulation_time = 0.f |
| Amount of time the physics simulation is going to be advanced. More... | |
| bool | m_simulation_paused = false |
| float | m_total_sim_time = 0.f |
| FreeForceVec_t | m_free_forces |
| Global forces added ad-hoc by scripts. More... | |
| FreeForceID_t | m_free_force_next_id = 0 |
| Unique ID for each FreeForce. More... | |
| std::unique_ptr< ThreadPool > | m_sim_thread_pool |
| std::shared_ptr< Task > | m_sim_task |
| RoR::CmdKeyInertiaConfig | m_inertia_config |
Builds and manages softbody actors (physics on background thread, networking)
Definition at line 43 of file ActorManager.h.
| typedef std::vector<FreeForce> RoR::ActorManager::FreeForceVec_t |
Definition at line 47 of file ActorManager.h.
| ActorManager::ActorManager | ( | ) |
Definition at line 67 of file ActorManager.cpp.
| ActorManager::~ActorManager | ( | ) |
Definition at line 77 of file ActorManager.cpp.
| void ActorManager::AddFreeForce | ( | FreeForceRequest * | rq | ) |
Definition at line 1767 of file ActorManager.cpp.
|
inline |
Definition at line 87 of file ActorManager.h.
Definition at line 733 of file ActorManager.cpp.
|
inline |
Definition at line 91 of file ActorManager.h.
|
private |
Apply FreeForces - intentionally as a separate pass over all actors.
Definition at line 1522 of file ActorManager.cpp.
|
private |
Returns whether or not the bounding boxes of truck a and truck b intersect. Based on the truck collision bounding boxes.
Definition at line 579 of file ActorManager.cpp.
| int ActorManager::CheckNetRemoteStreamsOk | ( | int | sourceid | ) |
Definition at line 547 of file ActorManager.cpp.
| int ActorManager::CheckNetworkStreamsOk | ( | int | sourceid | ) |
Definition at line 528 of file ActorManager.cpp.
| void ActorManager::CleanUpSimulation | ( | ) |
Call this after simulation loop finishes.
Definition at line 865 of file ActorManager.cpp.
| ActorPtr ActorManager::CreateNewActor | ( | ActorSpawnRequest | rq, |
| RigDef::DocumentPtr | def | ||
| ) |
Definition at line 82 of file ActorManager.cpp.
| void ActorManager::DeleteActorInternal | ( | ActorPtr | actor | ) |
Do not call directly; use GameContext::DeleteActor()
Definition at line 878 of file ActorManager.cpp.
| void ActorManager::ExportActorDef | ( | RigDef::DocumentPtr | def, |
| std::string | filename, | ||
| std::string | rg_name | ||
| ) |
Definition at line 1329 of file ActorManager.cpp.
| RigDef::DocumentPtr ActorManager::FetchActorDef | ( | RoR::ActorSpawnRequest & | rq | ) |
Definition at line 1250 of file ActorManager.cpp.
Definition at line 959 of file ActorManager.cpp.
Definition at line 984 of file ActorManager.cpp.
| const ActorPtr & ActorManager::FetchRescueVehicle | ( | ) |
Definition at line 1011 of file ActorManager.cpp.
| ActorPtr ActorManager::FindActorInsideBox | ( | Collisions * | collisions, |
| const Ogre::String & | inst, | ||
| const Ogre::String & | box | ||
| ) |
Definition at line 816 of file ActorManager.cpp.
| bool ActorManager::FindFreeForce | ( | FreeForceID_t | id, |
| FreeForceVec_t::iterator & | out_itor | ||
| ) |
Definition at line 1761 of file ActorManager.cpp.
|
private |
Fowards things to trailers.
Definition at line 662 of file ActorManager.cpp.
| const ActorPtr & ActorManager::GetActorById | ( | ActorInstanceID_t | actor_id | ) |
Definition at line 1139 of file ActorManager.cpp.
| const ActorPtr & ActorManager::GetActorByNetworkLinks | ( | int | source_id, |
| int | stream_id | ||
| ) |
Definition at line 566 of file ActorManager.cpp.
|
inline |
Definition at line 121 of file ActorManager.h.
|
inline |
Definition at line 76 of file ActorManager.h.
|
inline |
Definition at line 97 of file ActorManager.h.
| std::vector< ActorPtr > ActorManager::GetLocalActors | ( | ) |
Definition at line 1360 of file ActorManager.cpp.
| std::pair< ActorPtr, float > ActorManager::GetNearestActor | ( | Ogre::Vector3 | position | ) |
Definition at line 849 of file ActorManager.cpp.
|
inline |
Definition at line 84 of file ActorManager.h.
| int ActorManager::GetNetTimeOffset | ( | int | sourceid | ) |
Definition at line 510 of file ActorManager.cpp.
|
inline |
Definition at line 93 of file ActorManager.h.
|
inline |
Definition at line 96 of file ActorManager.h.
| void ActorManager::HandleActorStreamData | ( | std::vector< RoR::NetRecvPacket > | packet | ) |
Definition at line 360 of file ActorManager.cpp.
|
inline |
Definition at line 94 of file ActorManager.h.
| bool ActorManager::LoadScene | ( | Ogre::String | filename | ) |
Definition at line 240 of file Savegame.cpp.
| void ActorManager::ModifyFreeForce | ( | FreeForceRequest * | rq | ) |
Definition at line 1786 of file ActorManager.cpp.
|
private |
Returns whether or not the bounding boxes of truck a and truck b might intersect during the next framestep. Based on the truck collision bounding boxes.
Definition at line 608 of file ActorManager.cpp.
|
private |
Definition at line 637 of file ActorManager.cpp.
| void ActorManager::RemoveFreeForce | ( | FreeForceID_t | id | ) |
Definition at line 1804 of file ActorManager.cpp.
|
private |
Definition at line 343 of file ActorManager.cpp.
| void ActorManager::RepairActor | ( | Collisions * | collisions, |
| const Ogre::String & | inst, | ||
| const Ogre::String & | box, | ||
| bool | keepPosition = false |
||
| ) |
Definition at line 835 of file ActorManager.cpp.
| void ActorManager::RestoreSavedState | ( | ActorPtr | actor, |
| rapidjson::Value const & | j_entry | ||
| ) |
Definition at line 787 of file Savegame.cpp.
| bool ActorManager::SaveScene | ( | Ogre::String | filename | ) |
Definition at line 418 of file Savegame.cpp.
| void ActorManager::SendAllActorsSleeping | ( | ) |
Definition at line 804 of file ActorManager.cpp.
|
inline |
Definition at line 95 of file ActorManager.h.
|
inline |
Definition at line 92 of file ActorManager.h.
|
inline |
Definition at line 90 of file ActorManager.h.
| void ActorManager::SyncWithSimThread | ( | ) |
Definition at line 1231 of file ActorManager.cpp.
| void ActorManager::UpdateActors | ( | ActorPtr | player_actor | ) |
Definition at line 1023 of file ActorManager.cpp.
| void ActorManager::UpdateInputEvents | ( | float | dt | ) |
Definition at line 1371 of file ActorManager.cpp.
| void ActorManager::UpdateNetTimeOffset | ( | int | sourceid, |
| int | offset | ||
| ) |
Definition at line 520 of file ActorManager.cpp.
| void ActorManager::UpdatePhysicsSimulation | ( | ) |
Definition at line 1151 of file ActorManager.cpp.
| void ActorManager::UpdateSleepingState | ( | ActorPtr | player_actor, |
| float | dt | ||
| ) |
Definition at line 747 of file ActorManager.cpp.
|
private |
Definition at line 1461 of file ActorManager.cpp.
| void ActorManager::WakeUpAllActors | ( | ) |
Definition at line 792 of file ActorManager.cpp.
|
static |
Definition at line 129 of file ActorManager.h.
Definition at line 126 of file ActorManager.h.
|
private |
Unique sequential ID for each Actor.
Definition at line 148 of file ActorManager.h.
|
private |
Use MSG_SIM_{SPAWN/DELETE}_ACTOR_REQUESTED
Definition at line 147 of file ActorManager.h.
|
private |
Keeps track of the rounding error in the time step calculation.
Definition at line 151 of file ActorManager.h.
|
private |
disables sleep counters
Definition at line 149 of file ActorManager.h.
|
private |
Unique ID for each FreeForce.
Definition at line 158 of file ActorManager.h.
|
private |
Global forces added ad-hoc by scripts.
Definition at line 157 of file ActorManager.h.
|
private |
Definition at line 163 of file ActorManager.h.
|
private |
previously used time ratio between real time (evt.timeSinceLastFrame) and physics time ('dt' used in calcPhysics)
Definition at line 153 of file ActorManager.h.
|
private |
Definition at line 144 of file ActorManager.h.
|
private |
Definition at line 150 of file ActorManager.h.
|
private |
Definition at line 162 of file ActorManager.h.
|
private |
Definition at line 161 of file ActorManager.h.
|
private |
Definition at line 155 of file ActorManager.h.
|
private |
slow motion < 1.0 < fast motion
Definition at line 152 of file ActorManager.h.
|
private |
Amount of time the physics simulation is going to be advanced.
Definition at line 154 of file ActorManager.h.
|
private |
Networking: A set of streams without a corresponding actor in the actor-array for each stream source.
Definition at line 142 of file ActorManager.h.
|
private |
Networking: A network time offset for each stream source.
Definition at line 143 of file ActorManager.h.
|
private |
Definition at line 156 of file ActorManager.h.
1.8.17