Rigs of Rods 2026.01
Soft-body Physics Simulation
Loading...
Searching...
No Matches
GfxScene.cpp
Go to the documentation of this file.
1/*
2 This source file is part of Rigs of Rods
3 Copyright 2005-2012 Pierre-Michel Ricordel
4 Copyright 2007-2012 Thomas Fischer
5 Copyright 2013-2020 Petr Ohlidal
6
7 For more information, see http://www.rigsofrods.org/
8
9 Rigs of Rods is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License version 3, as
11 published by the Free Software Foundation.
12
13 Rigs of Rods is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with Rigs of Rods. If not, see <http://www.gnu.org/licenses/>.
20*/
21
22#include "GfxScene.h"
23
24#include "AppContext.h"
25#include "Actor.h"
26#include "ActorManager.h"
27#include "ApproxMath.h"
28#include "Console.h"
29#include "DustPool.h"
30#include "HydraxWater.h"
31#include "GameContext.h"
32#include "GUIManager.h"
33#include "GUIUtils.h"
34#include "GUI_DirectionArrow.h"
35#include "OverlayWrapper.h"
36#include "SkyManager.h"
37#include "SkyXManager.h"
39#include "Terrain.h"
41#include "Utils.h"
42
43#include "imgui_internal.h"
44
45#include <Ogre.h>
46
47using namespace Ogre;
48using namespace RoR;
49
51{
52 ROR_ASSERT(m_dustpools.size() == 0);
53 m_dustpools["dust"] = new DustPool(m_scene_manager, "tracks/Dust", 20);
54 m_dustpools["clump"] = new DustPool(m_scene_manager, "tracks/Clump", 20);
55 m_dustpools["sparks"] = new DustPool(m_scene_manager, "tracks/Sparks", 10);
56 m_dustpools["drip"] = new DustPool(m_scene_manager, "tracks/Drip", 50);
57 m_dustpools["splash"] = new DustPool(m_scene_manager, "tracks/Splash", 20);
58 m_dustpools["ripple"] = new DustPool(m_scene_manager, "tracks/Ripple", 20);
59}
60
62{
63 // Delete dustpools
64 for (auto itor : m_dustpools)
65 {
66 itor.second->Discard(m_scene_manager);
67 delete itor.second;
68 }
69 m_dustpools.clear();
70
71 // Delete game elements
72 m_all_gfx_actors.clear();
74
75 // Wipe scene manager
76 m_scene_manager->clearScene();
78
79 // Recover from the wipe
82 m_gfx_freebeams_grouping_node = m_scene_manager->getRootSceneNode()->createChildSceneNode("FreeBeam Visuals");
83}
84
86{
88 m_scene_manager = App::GetAppContext()->GetOgreRoot()->createSceneManager();
89 m_gfx_freebeams_grouping_node = m_scene_manager->getRootSceneNode()->createChildSceneNode("FreeBeam Visuals");
90
92}
93
95{
96 // NOTE: The `dt` parameter here is simulation time (0 when paused), not real time!
97 // ================================================================================
98
99 // Actors - start threaded tasks
100 for (GfxActor* gfx_actor: m_live_gfx_actors)
101 {
102 gfx_actor->UpdateFlexbodies(); // Push flexbody tasks to threadpool
103 gfx_actor->UpdateWheelVisuals(); // Push flexwheel tasks to threadpool
104 }
105
106 // Var
107 GfxActor* player_gfx_actor = nullptr;
108 if (m_simbuf.simbuf_player_actor != nullptr)
109 {
110 player_gfx_actor = m_simbuf.simbuf_player_actor->GetGfxActor();
111 }
112
113 // FOV
115 {
118 RoR::App::GetCameraManager()->GetCamera()->setFOVy(Ogre::Degree(fov));
119 }
120
121 // Particles
122 if (App::gfx_particles_mode->getInt() == 1)
123 {
124 // Generate particles as needed
125 for (GfxActor* gfx_actor: m_all_gfx_actors)
126 {
127 float dt_actor = (!gfx_actor->GetSimDataBuffer().simbuf_physics_paused) ? dt : 0.f;
128 gfx_actor->UpdateParticles(dt_actor);
129 }
130
131 // Update particle movement
132 for (auto itor : m_dustpools)
133 {
134 itor.second->AdjustDustPoolSpeedFactor();
135 itor.second->update();
136 }
137 }
138
139 // Realtime reflections on player vehicle
140 // IMPORTANT: Toggles visibility of all meshes -> must be done before any other visibility control is evaluated (i.e. aero propellers)
141 if (player_gfx_actor != nullptr)
142 {
143 // Safe to be called here, only modifies OGRE objects, doesn't read any physics state.
144 m_envmap.UpdateEnvMap(player_gfx_actor->GetSimDataBuffer().simbuf_pos, player_gfx_actor);
145 }
146
147 // Terrain - animated meshes and paged geometry
149
150 // Terrain - lightmap; TODO: ported as-is from Terrain::update(), is it needed? ~ only_a_ptr, 05/2018
151 App::GetGameContext()->GetTerrain()->getGeometryManager()->UpdateMainLightPosition(); // TODO: Is this necessary? I'm leaving it here just in case ~ only_a_ptr, 04/2017
152
153 // Terrain - water
154 auto water = App::GetGameContext()->GetTerrain()->getWater();
155 auto gfx_water = App::GetGameContext()->GetTerrain()->getGfxWater();
156 if (water)
157 {
158 if (player_gfx_actor != nullptr)
159 {
160 gfx_water->SetReflectionPlaneHeight(water->CalcWavesHeight(player_gfx_actor->GetSimDataBuffer().simbuf_pos));
161 }
162 else
163 {
164 gfx_water->SetReflectionPlaneHeight(water->GetStaticWaterHeight());
165 }
166 gfx_water->FrameStepWater(dt);
167 }
168
169 // Terrain - sky
170#ifdef USE_CAELUM
171 SkyManager* sky = App::GetGameContext()->GetTerrain()->getSkyManager();
172 if (sky != nullptr)
173 {
174 sky->DetectSkyUpdate();
175 }
176#endif
177
179 if (skyx_man != nullptr)
180 {
181 skyx_man->update(dt); // Light update
182 }
183
184 // GUI - race
186 {
187 if (m_simbuf.simbuf_race_in_progress) // Started
188 {
190 }
191 else // Ended
192 {
194 }
195 }
197 {
199 }
200
201 // GUI - vehicle pressure
203 {
205 }
206
207 // HUD - network labels (always update)
208 for (GfxActor* gfx_actor: m_all_gfx_actors)
209 {
210 gfx_actor->UpdateNetLabels(dt);
211 }
212
213 // Player avatars
215 {
216 a->UpdateCharacterInScene();
217 }
218
219 // Actors - update misc visuals
220 for (GfxActor* gfx_actor: m_all_gfx_actors)
221 {
222 float dt_actor = (!gfx_actor->GetSimDataBuffer().simbuf_physics_paused) ? dt : 0.f;
223 if (gfx_actor->IsActorLive())
224 {
225 gfx_actor->UpdateRods();
226 gfx_actor->UpdateCabMesh();
227 gfx_actor->UpdateWingMeshes();
228 gfx_actor->UpdateAirbrakes();
229 gfx_actor->UpdateCParticles();
230 gfx_actor->UpdateExhausts();
231 gfx_actor->UpdateAeroEngines();
232 gfx_actor->UpdatePropAnimations(dt_actor);
233 }
234 // Beacon flares must always be updated
235 gfx_actor->UpdateProps(dt_actor, (gfx_actor == player_gfx_actor));
236 // Blinkers (turn signals) must always be updated
237 gfx_actor->UpdateFlares(dt_actor, (gfx_actor == player_gfx_actor));
238 }
239 if (player_gfx_actor != nullptr)
240 {
241 float dt_actor = (!player_gfx_actor->GetSimDataBuffer().simbuf_physics_paused) ? dt : 0.f;
242 player_gfx_actor->UpdateVideoCameras(dt_actor);
243
244 // The old-style render-to-texture dashboard (based on OGRE overlays)
246 {
248 }
250 {
251 RoR::App::GetOverlayWrapper()->UpdateAerialHUD(player_gfx_actor);
252 }
253 }
254
255 App::GetGuiManager()->DrawSimGuiBuffered(player_gfx_actor);
256
258
259 this->UpdateFreeBeamGfx(dt);
260
261 // Actors - finalize threaded tasks
262 for (GfxActor* gfx_actor: m_live_gfx_actors)
263 {
264 gfx_actor->FinishWheelUpdates();
265 gfx_actor->FinishFlexbodyTasks();
266 }
267}
268
270{
271 for (auto itor : m_dustpools)
272 {
273 itor.second->setVisible(visible);
274 }
275}
276
278{
279 auto found = m_dustpools.find(name);
280 if (found != m_dustpools.end())
281 {
282 return found->second;
283 }
284 else
285 {
286 return nullptr;
287 }
288}
289
291{
292 m_all_gfx_actors.push_back(gfx_actor);
293}
294
296{
302
303 // Race system
312
313 m_live_gfx_actors.clear();
314 for (GfxActor* a: m_all_gfx_actors)
315 {
316 if (a->IsActorLive() || !a->IsActorInitialized())
317 {
318 a->UpdateSimDataBuffer();
319 m_live_gfx_actors.push_back(a);
320 a->InitializeActor();
321 }
322 }
323
325 {
326 a->BufferSimulationData();
327 }
328}
329
331{
332 auto itor = std::remove(m_all_gfx_actors.begin(), m_all_gfx_actors.end(), remove_me);
333 if (itor != m_all_gfx_actors.end())
334 {
335 m_all_gfx_actors.erase(itor, m_all_gfx_actors.end());
336 }
337}
338
340{
341 // Do the work `UpdateScene()` would, but for a single actor.
342 // Needed for i.e. terrain editor mode.
343 // ------------------------------------------------------
344
345 // Start threaded stuff
346 gfx_actor->UpdateFlexbodies(); // Push flexbody tasks to threadpool
347 gfx_actor->UpdateWheelVisuals(); // Push flexwheel tasks to threadpool
348
349 // Do sync stuff
350 gfx_actor->UpdateRods();
351 gfx_actor->UpdateCabMesh();
352 gfx_actor->UpdateWingMeshes();
353 gfx_actor->UpdateAirbrakes();
354
355 // Finish threaded stuff
356 gfx_actor->FinishWheelUpdates();
357 gfx_actor->FinishFlexbodyTasks();
358}
359
361{
362 m_all_gfx_characters.push_back(gfx_character);
363}
364
366{
367 auto itor = std::remove(m_all_gfx_characters.begin(), m_all_gfx_characters.end(), remove_me);
368 if (itor != m_all_gfx_characters.end())
369 {
371 }
372}
373
374void GfxScene::DrawNetLabel(Ogre::Vector3 scene_pos, float cam_dist, std::string const& nick, int colornum)
375{
376#if USE_SOCKETW
377
378 // this ensures that the nickname is always in a readable size
379 float font_size = std::max(0.6, cam_dist / 40.0);
380 std::string caption;
381 if (cam_dist > 1000) // 1000 ... vlen
382 {
383 caption =
384 nick + " (" + TOSTRING((float)(ceil(cam_dist / 100) / 10.0) ) + " km)";
385 }
386 else if (cam_dist > 20) // 20 ... vlen ... 1000
387 {
388 caption =
389 nick + " (" + TOSTRING((int)cam_dist) + " m)";
390 }
391 else // 0 ... vlen ... 20
392 {
393 caption = nick;
394 }
395
396 // draw with DearIMGUI
397
398 ImVec2 screen_size = ImGui::GetIO().DisplaySize;
399 World2ScreenConverter world2screen(
400 App::GetCameraManager()->GetCamera()->getViewMatrix(true), App::GetCameraManager()->GetCamera()->getProjectionMatrix(), Ogre::Vector2(screen_size.x, screen_size.y));
401
402 Ogre::Vector3 pos_xyz = world2screen.Convert(scene_pos);
403
404 // only draw when in front of camera
405 if (pos_xyz.z < 0.f)
406 {
407 // Align position to whole pixels, to minimize jitter.
408 ImVec2 pos((int)pos_xyz.x+0.5, (int)pos_xyz.y+0.5);
409
410 ImVec2 text_size = ImGui::CalcTextSize(caption.c_str());
412
413 ImDrawList* drawlist = GetImDummyFullscreenWindow();
414 ImGuiContext* g = ImGui::GetCurrentContext();
415
416 ImVec2 text_pos(pos.x - ((text_size.x / 2)), pos.y - ((text_size.y / 2)));
417
418 // Draw background rectangle
419 const float PADDING = 4.f;
420 drawlist->AddRectFilled(
421 text_pos - ImVec2(PADDING, PADDING),
422 text_pos + text_size + ImVec2(PADDING, PADDING),
423 ImColor(theme.semitransparent_window_bg),
424 ImGui::GetStyle().WindowRounding);
425
426 // draw colored text
427 Ogre::ColourValue color = App::GetNetwork()->GetPlayerColor(colornum);
428 ImVec4 text_color(color.r, color.g, color.b, 1.f);
429 drawlist->AddText(g->Font, g->FontSize, text_pos, ImColor(text_color), caption.c_str());
430 }
431
432#endif // USE_SOCKETW
433}
434
435void GfxScene::AdjustParticleSystemTimeFactor(Ogre::ParticleSystem* psys, GfxActor* gfx_actor /* = nullptr */)
436{
437 float speed_factor = 0.f;
438 if (App::sim_state->getEnum<SimState>() == SimState::RUNNING && !App::GetGameContext()->GetActorManager()->IsSimulationPaused())
439 {
440 speed_factor = m_simbuf.simbuf_sim_speed;
441 }
442
443 if (gfx_actor && gfx_actor->GetSimDataBuffer().simbuf_physics_paused)
444 {
445 speed_factor = 0.f;
446 }
447
448 psys->setSpeedFactor(speed_factor);
449}
450
452{
453 auto itor = std::find_if(m_gfx_freebeams.begin(), m_gfx_freebeams.end(),
454 [rq](const FreeBeamGfx& obj) { return obj.fbx_id == rq->fbr_id; });
455 if (itor != m_gfx_freebeams.end())
456 {
458 fmt::format("FreeBeamGfx with ID %d already exists, ignoring request.",rq->fbr_id));
459 return;
460 }
461
462 FreeBeamGfx obj;
463 obj.fbx_id = rq->fbr_id;
466 obj.fbx_diameter = rq->fbr_diameter;
467
468 Ogre::Entity* e = m_scene_manager->createEntity(fmt::format("FreeBeamGfx_{}", rq->fbr_id), rq->fbr_mesh_name);
469 e->setMaterialName(rq->fbr_material_name);
470
471 obj.fbx_scenenode = m_gfx_freebeams_grouping_node->createChildSceneNode(fmt::format("FreeBeamGfx_{}", rq->fbr_id));
472 obj.fbx_scenenode->setScale(rq->fbr_diameter, -1, rq->fbr_diameter);
473 obj.fbx_scenenode->attachObject(e);
474
475 m_gfx_freebeams.push_back(obj);
476}
477
479{
480 auto itor = std::find_if(m_gfx_freebeams.begin(), m_gfx_freebeams.end(),
481 [rq](const FreeBeamGfx& obj) { return obj.fbx_id == rq->fbr_id; });
482 if (itor == m_gfx_freebeams.end())
483 {
485 fmt::format("FreeBeamGfx with ID %d not found, ignoring request.", rq->fbr_id));
486 return;
487 }
488
489 FreeBeamGfx& obj = *itor;
490 this->RemoveFreeBeamGfx(rq->fbr_id);
491 this->AddFreeBeamGfx(rq);
492}
493
495{
496 auto itor = std::find_if(m_gfx_freebeams.begin(), m_gfx_freebeams.end(),
497 [id](const FreeBeamGfx& obj) { return obj.fbx_id == id; });
498 if (itor == m_gfx_freebeams.end())
499 {
501 fmt::format("FreeBeamGfx with ID %d not found, ignoring request.", id));
502 return;
503 }
504
505 FreeBeamGfx& obj = *itor;
506 m_scene_manager->destroyEntity((Ogre::Entity*)obj.fbx_scenenode->getAttachedObject(0));
508 m_gfx_freebeams.erase(itor);
509}
510
512{
513 for (FreeBeamGfx& freebeam : m_gfx_freebeams)
514 {
515 // Sanity checks - primary freeforce
516 ROR_ASSERT(freebeam.fbx_id != FREEBEAMGFXID_INVALID);
517 ROR_ASSERT(freebeam.fbx_freeforce_primary != FREEFORCEID_INVALID);
518 ActorManager::FreeForceVec_t::iterator itor;
519 const bool exists = App::GetGameContext()->GetActorManager()->FindFreeForce(freebeam.fbx_freeforce_primary, itor);
520 ROR_ASSERT(exists);
521 if (!exists)
522 {
523 continue;
524 }
525 FreeForce& freeforce = *itor;
526
527 // Sanity checks - base actor
528 ROR_ASSERT(freeforce.ffc_base_actor);
530 GfxActor* gfx_actor_base = freeforce.ffc_base_actor->GetGfxActor();
531 ROR_ASSERT(gfx_actor_base);
533 ROR_ASSERT(freeforce.ffc_base_node < freeforce.ffc_base_actor->ar_num_nodes);
534
535 // Sanity checks - target actor
536 ROR_ASSERT(freeforce.ffc_target_actor);
538 GfxActor* gfx_actor_target = freeforce.ffc_target_actor->GetGfxActor();
539 ROR_ASSERT(gfx_actor_target);
542
543 // Get node positions
544 Ogre::Vector3 basenode_pos = gfx_actor_base->GetSimNodeBuffer()[freeforce.ffc_base_node].AbsPosition;
545 Ogre::Vector3 targetnode_pos = gfx_actor_target->GetSimNodeBuffer()[freeforce.ffc_target_node].AbsPosition;
546
547 // Do the transforms
548 freebeam.fbx_scenenode->setPosition(basenode_pos.midPoint(targetnode_pos));
549 freebeam.fbx_scenenode->setOrientation(GfxScene::SpecialGetRotationTo(Ogre::Vector3::UNIT_Y, (basenode_pos - targetnode_pos)));
550 freebeam.fbx_scenenode->setScale(freebeam.fbx_diameter, basenode_pos.distance(targetnode_pos), freebeam.fbx_diameter);
551 }
552}
553
555{
556 auto itor_secondary = std::find_if(m_gfx_freebeams.begin(), m_gfx_freebeams.end(),
557 [id](const FreeBeamGfx& obj) { return obj.fbx_freeforce_secondary == id; });
558 if (itor_secondary != m_gfx_freebeams.end())
559 {
560 // Just clear the freeforce ID
561 itor_secondary->fbx_freeforce_secondary = FREEFORCEID_INVALID;
562 }
563 else
564 {
565 auto itor_primary = std::find_if(m_gfx_freebeams.begin(), m_gfx_freebeams.end(),
566 [id](const FreeBeamGfx& obj) { return obj.fbx_freeforce_primary == id; });
567 if (itor_primary != m_gfx_freebeams.end())
568 {
569 // Remove the whole freebeam
570 this->RemoveFreeBeamGfx(itor_primary->fbx_id);
571 }
572 }
573}
574
576{
577 auto itor = std::find_if(m_gfx_freebeams.begin(), m_gfx_freebeams.end(),
578 [id](const FreeBeamGfx& obj) { return obj.fbx_freeforce_primary == id || obj.fbx_freeforce_secondary == id; });
579 if (itor != m_gfx_freebeams.end())
580 {
581 // Remove the whole freebeam if either freeforce broke
582 this->RemoveFreeBeamGfx(itor->fbx_id);
583 }
584}
585
586Ogre::Quaternion RoR::GfxScene::SpecialGetRotationTo(const Ogre::Vector3& src, const Ogre::Vector3& dest)
587{
588 // Based on Stan Melax's article in Game Programming Gems
589 Ogre::Quaternion q;
590 // Copy, since cannot modify local
591 Ogre::Vector3 v0 = src;
592 Ogre::Vector3 v1 = dest;
593 v0.normalise();
594 v1.normalise();
595
596 // NB if the crossProduct approaches zero, we get unstable because ANY axis will do
597 // when v0 == -v1
598 Ogre::Real d = v0.dotProduct(v1);
599 // If dot == 1, vectors are the same
600 if (d >= 1.0f)
601 {
602 return Ogre::Quaternion::IDENTITY;
603 }
604 if (d < (1e-6f - 1.0f))
605 {
606 // Generate an axis
607 Ogre::Vector3 axis = Ogre::Vector3::UNIT_X.crossProduct(src);
608 if (axis.isZeroLength()) // pick another if colinear
609 axis = Ogre::Vector3::UNIT_Y.crossProduct(src);
610 axis.normalise();
611 q.FromAngleAxis(Ogre::Radian(Ogre::Math::PI), axis);
612 }
613 else
614 {
615 Ogre::Real s = fast_sqrt((1 + d) * 2);
616 if (s == 0)
617 return Ogre::Quaternion::IDENTITY;
618
619 Ogre::Vector3 c = v0.crossProduct(v1);
620 Ogre::Real invs = 1 / s;
621
622 q.x = c.x * invs;
623 q.y = c.y * invs;
624 q.z = c.z * invs;
625 q.w = s * 0.5;
626 }
627 return q;
628}
System integration layer; inspired by OgreBites::ApplicationContext.
#define ROR_ASSERT(_EXPR)
Definition Application.h:40
#define TOSTRING(x)
Definition Application.h:58
float fast_sqrt(const float x)
Definition ApproxMath.h:135
Race direction arrow and text info (using OGRE Overlay)
Game state manager and message-queue provider.
EnginePtr ar_engine
Definition Actor.h:467
GfxActor * GetGfxActor()
Definition Actor.h:344
ActorState ar_state
Definition Actor.h:567
int ar_num_nodes
Definition Actor.h:380
ActorType ar_driveable
Sim attr; marks vehicle type and features.
Definition Actor.h:466
bool IsSimulationPaused() const
float GetSimulationSpeed() const
bool FindFreeForce(FreeForceID_t id, FreeForceVec_t::iterator &out_itor)
Ogre::Root * GetOgreRoot()
Definition AppContext.h:68
float getFloat() const
Definition CVar.h:96
void ReCreateCameraNode()
Needed since we call Ogre::SceneManager::ClearScene() after end of sim. session.
CameraBehaviors GetCurrentBehavior() const
Ogre::Camera * GetCamera()
Ogre::Vector3 getPosition()
Definition Character.cpp:92
@ CONSOLE_MSGTYPE_INFO
Generic message.
Definition Console.h:60
void putMessage(MessageArea area, MessageType type, std::string const &msg, std::string icon="")
Definition Console.cpp:103
@ CONSOLE_SYSTEM_WARNING
Definition Console.h:53
void CreateArrow()
Must be called again after OGRE scenemanager is cleared.
void DrawSimGuiBuffered(GfxActor *player_gfx_actor)
Reads data from simbuffer.
GuiTheme & GetTheme()
Definition GUIManager.h:171
GUI::DirectionArrow DirectionArrow
Definition GUIManager.h:137
Character * GetPlayerCharacter()
const ActorPtr & GetPlayerActor()
const TerrainPtr & GetTerrain()
SceneMouse & GetSceneMouse()
ActorManager * GetActorManager()
RaceSystem & GetRaceSystem()
void UpdateVideoCameras(float dt)
Definition GfxActor.cpp:468
void UpdateWheelVisuals()
ActorSB & GetSimDataBuffer()
Definition GfxActor.h:125
void UpdateRods()
void FinishFlexbodyTasks()
void UpdateAirbrakes()
void UpdateCabMesh()
NodeSB * GetSimNodeBuffer()
Definition GfxActor.h:126
void FinishWheelUpdates()
void UpdateWingMeshes()
void UpdateFlexbodies()
void UpdateEnvMap(Ogre::Vector3 center, GfxActor *gfx_actor, bool full=false)
void CreateDustPools()
Definition GfxScene.cpp:50
Ogre::SceneNode * m_gfx_freebeams_grouping_node
Only for nicer scenegraph when viewing through Inspector gadget.
Definition GfxScene.h:103
void ForceUpdateSingleGfxActor(RoR::GfxActor *gfx_actor)
Definition GfxScene.cpp:339
std::vector< GfxActor * > m_live_gfx_actors
Definition GfxScene.h:94
void RegisterGfxActor(RoR::GfxActor *gfx_actor)
Definition GfxScene.cpp:290
static Ogre::Quaternion SpecialGetRotationTo(const Ogre::Vector3 &src, const Ogre::Vector3 &dest)
Definition GfxScene.cpp:586
void DrawNetLabel(Ogre::Vector3 pos, float cam_dist, std::string const &nick, int colornum)
Definition GfxScene.cpp:374
void ClearScene()
Definition GfxScene.cpp:61
GameContextSB m_simbuf
Definition GfxScene.h:97
void SetParticlesVisible(bool visible)
Definition GfxScene.cpp:269
std::vector< FreeBeamGfx > m_gfx_freebeams
Definition GfxScene.h:101
std::vector< GfxActor * > m_all_gfx_actors
Definition GfxScene.h:93
void RegisterGfxCharacter(RoR::GfxCharacter *gfx_character)
Definition GfxScene.cpp:360
std::map< std::string, DustPool * > m_dustpools
Definition GfxScene.h:91
void RemoveGfxActor(RoR::GfxActor *gfx_actor)
Definition GfxScene.cpp:330
RoR::GfxEnvmap m_envmap
Definition GfxScene.h:96
void AdjustParticleSystemTimeFactor(Ogre::ParticleSystem *psys, GfxActor *gfx_actor=nullptr)
Definition GfxScene.cpp:435
DustPool * GetDustPool(const char *name)
Definition GfxScene.cpp:277
void RemoveFreeBeamGfx(FreeBeamGfxID_t id)
Definition GfxScene.cpp:494
Ogre::SceneManager * m_scene_manager
Definition GfxScene.h:92
std::vector< GfxCharacter * > m_all_gfx_characters
Definition GfxScene.h:95
void OnFreeForceBroken(FreeForceID_t id)
Definition GfxScene.cpp:575
void RemoveGfxCharacter(RoR::GfxCharacter *gfx_character)
Definition GfxScene.cpp:365
void ModifyFreeBeamGfx(FreeBeamGfxRequest *rq)
Definition GfxScene.cpp:478
void OnFreeForceRemoved(FreeForceID_t id)
Definition GfxScene.cpp:554
void BufferSimulationData()
Run this when simulation is halted.
Definition GfxScene.cpp:295
SkidmarkConfig m_skidmark_conf
Definition GfxScene.h:98
void UpdateScene(float dt)
Definition GfxScene.cpp:94
void AddFreeBeamGfx(FreeBeamGfxRequest *rq)
Definition GfxScene.cpp:451
void UpdateFreeBeamGfx(float dt)
Definition GfxScene.cpp:511
virtual void SetReflectionPlaneHeight(float)
Definition IGfxWater.h:47
Ogre::ColourValue GetPlayerColor(int color_num)
Definition Network.cpp:95
void UpdatePressureOverlay(RoR::GfxActor *ga)
void UpdateRacingGui(RoR::GfxScene *gs)
void UpdateLandVehicleHUD(RoR::GfxActor *ga)
void UpdateAerialHUD(RoR::GfxActor *ga)
float GetRaceTime() const
std::string const & GetDirArrowText() const
Definition RaceSystem.h:49
Ogre::Vector3 GetDirArrowTarget()
Definition RaceSystem.h:48
float GetRaceTimeDiff() const
Definition RaceSystem.h:42
bool IsRaceInProgress() const
Definition RaceSystem.h:36
float GetRaceBestTime() const
Definition RaceSystem.h:45
bool IsDirArrowVisible() const
Definition RaceSystem.h:50
void LoadDefaultSkidmarkDefs()
Definition Skidmark.cpp:34
bool update(float dt)
SkyXManager * getSkyXManager()
Definition Terrain.h:83
TerrainObjectManager * getObjectManager()
Definition Terrain.h:80
SkyManager * getSkyManager()
Definition Terrain.cpp:521
TerrainGeometryManager * getGeometryManager()
Definition Terrain.h:79
IGfxWater * getGfxWater()
Definition Terrain.h:88
Wavefield * getWater()
Definition Terrain.h:87
< Keeps data close for faster access.
Definition Utils.h:83
Ogre::Vector3 Convert(Ogre::Vector3 world_pos)
Definition Utils.h:90
@ TRUCK
its a truck (or other land vehicle)
Definition SimData.h:85
@ AIRPLANE
its an airplane
Definition SimData.h:86
@ DISPOSED
removed from simulation, still in memory to satisfy pointers.
AppContext * GetAppContext()
CVar * sim_state
OverlayWrapper * GetOverlayWrapper()
CameraManager * GetCameraManager()
CVar * gfx_particles_mode
GUIManager * GetGuiManager()
GameContext * GetGameContext()
CVar * gfx_fov_external
Console * GetConsole()
CVar * gfx_fov_internal
Network * GetNetwork()
static const NodeNum_t NODENUM_INVALID
int FreeForceID_t
Unique sequentially generated ID of FreeForce; use ActorManager::GetFreeForceNextId().
static const FreeBeamGfxID_t FREEBEAMGFXID_INVALID
ImDrawList * GetImDummyFullscreenWindow(const std::string &name="RoR_TransparentFullscreenWindow")
Definition GUIUtils.cpp:394
int FreeBeamGfxID_t
Index into GfxScene::m_gfx_freebeams, use RoR::FREEBEAMGFXID_INVALID as empty value.
static const FreeForceID_t FREEFORCEID_INVALID
bool simbuf_physics_paused
Definition SimBuffers.h:116
Ogre::Vector3 simbuf_pos
Definition SimBuffers.h:123
Visuals of a 'freebeam' (a pair of HALFBEAM_ freeforces)
Definition GfxData.h:279
FreeForceID_t fbx_freeforce_secondary
Not required for fixed-end beams.
Definition GfxData.h:283
FreeBeamGfxID_t fbx_id
ID of the freebeam gfx, use GfxScene::GetFreeBeamGfxNextId()
Definition GfxData.h:280
float fbx_diameter
meters
Definition GfxData.h:287
Ogre::SceneNode * fbx_scenenode
Definition GfxData.h:286
FreeForceID_t fbx_freeforce_primary
Required.
Definition GfxData.h:282
Used by MSG_EDI_[ADD/MODIFY]_FREEBEAMGFX_REQUESTED; tailored for use with AngelScript thru GameScript...
Definition GfxData.h:293
std::string fbr_material_name
Definition GfxData.h:302
double fbr_diameter
meters
Definition GfxData.h:303
int64_t fbr_freeforce_primary
Required.
Definition GfxData.h:298
int64_t fbr_id
ID of the freebeam gfx, use GfxScene::GetFreeBeamGfxNextId()
Definition GfxData.h:296
int64_t fbr_freeforce_secondary
Not required for fixed-end beams.
Definition GfxData.h:299
std::string fbr_mesh_name
Definition GfxData.h:301
Global force affecting particular (base) node of particular (base) actor; added ad-hoc by scripts.
Definition SimData.h:755
ActorPtr ffc_base_actor
Definition SimData.h:760
ActorPtr ffc_target_actor
Definition SimData.h:765
NodeNum_t ffc_base_node
Definition SimData.h:761
NodeNum_t ffc_target_node
Definition SimData.h:766
Ogre::Vector3 simbuf_character_pos
Definition SimBuffers.h:205
bool simbuf_dir_arrow_visible
Definition SimBuffers.h:219
float simbuf_race_time_diff
Definition SimBuffers.h:214
ActorPtr simbuf_player_actor
Definition SimBuffers.h:204
CameraManager::CameraBehaviors simbuf_camera_behavior
Definition SimBuffers.h:209
Ogre::Vector3 simbuf_dir_arrow_target
Definition SimBuffers.h:217
float simbuf_race_best_time
Definition SimBuffers.h:213
bool simbuf_race_in_progress_prev
Definition SimBuffers.h:216
std::string simbuf_dir_arrow_text
Definition SimBuffers.h:218
Ogre::Vector3 AbsPosition
Definition SimBuffers.h:69