Rigs of Rods 2023.09
Soft-body Physics Simulation
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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->update();
135 }
136 }
137
138 // Realtime reflections on player vehicle
139 // IMPORTANT: Toggles visibility of all meshes -> must be done before any other visibility control is evaluated (i.e. aero propellers)
140 if (player_gfx_actor != nullptr)
141 {
142 // Safe to be called here, only modifies OGRE objects, doesn't read any physics state.
143 m_envmap.UpdateEnvMap(player_gfx_actor->GetSimDataBuffer().simbuf_pos, player_gfx_actor);
144 }
145
146 // Terrain - animated meshes and paged geometry
148
149 // Terrain - lightmap; TODO: ported as-is from Terrain::update(), is it needed? ~ only_a_ptr, 05/2018
150 App::GetGameContext()->GetTerrain()->getGeometryManager()->UpdateMainLightPosition(); // TODO: Is this necessary? I'm leaving it here just in case ~ only_a_ptr, 04/2017
151
152 // Terrain - water
153 auto water = App::GetGameContext()->GetTerrain()->getWater();
154 auto gfx_water = App::GetGameContext()->GetTerrain()->getGfxWater();
155 if (water)
156 {
157 if (player_gfx_actor != nullptr)
158 {
159 gfx_water->SetReflectionPlaneHeight(water->CalcWavesHeight(player_gfx_actor->GetSimDataBuffer().simbuf_pos));
160 }
161 else
162 {
163 gfx_water->SetReflectionPlaneHeight(water->GetStaticWaterHeight());
164 }
165 gfx_water->FrameStepWater(dt);
166 }
167
168 // Terrain - sky
169#ifdef USE_CAELUM
170 SkyManager* sky = App::GetGameContext()->GetTerrain()->getSkyManager();
171 if (sky != nullptr)
172 {
173 sky->DetectSkyUpdate();
174 }
175#endif
176
178 if (skyx_man != nullptr)
179 {
180 skyx_man->update(dt); // Light update
181 }
182
183 // GUI - race
185 {
186 if (m_simbuf.simbuf_race_in_progress) // Started
187 {
189 }
190 else // Ended
191 {
193 }
194 }
196 {
198 }
199
200 // GUI - vehicle pressure
202 {
204 }
205
206 // HUD - network labels (always update)
207 for (GfxActor* gfx_actor: m_all_gfx_actors)
208 {
209 gfx_actor->UpdateNetLabels(dt);
210 }
211
212 // Player avatars
214 {
215 a->UpdateCharacterInScene();
216 }
217
218 // Actors - update misc visuals
219 for (GfxActor* gfx_actor: m_all_gfx_actors)
220 {
221 float dt_actor = (!gfx_actor->GetSimDataBuffer().simbuf_physics_paused) ? dt : 0.f;
222 if (gfx_actor->IsActorLive())
223 {
224 gfx_actor->UpdateRods();
225 gfx_actor->UpdateCabMesh();
226 gfx_actor->UpdateWingMeshes();
227 gfx_actor->UpdateAirbrakes();
228 gfx_actor->UpdateCParticles();
229 gfx_actor->UpdateExhausts();
230 gfx_actor->UpdateAeroEngines();
231 gfx_actor->UpdatePropAnimations(dt_actor);
232 gfx_actor->UpdateRenderdashRTT();
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)
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 psys->setSpeedFactor(speed_factor);
444}
445
447{
448 auto itor = std::find_if(m_gfx_freebeams.begin(), m_gfx_freebeams.end(),
449 [rq](const FreeBeamGfx& obj) { return obj.fbx_id == rq->fbr_id; });
450 if (itor != m_gfx_freebeams.end())
451 {
453 fmt::format("FreeBeamGfx with ID %d already exists, ignoring request.",rq->fbr_id));
454 return;
455 }
456
457 FreeBeamGfx obj;
458 obj.fbx_id = rq->fbr_id;
461 obj.fbx_diameter = rq->fbr_diameter;
462
463 Ogre::Entity* e = m_scene_manager->createEntity(fmt::format("FreeBeamGfx_{}", rq->fbr_id), rq->fbr_mesh_name);
464 e->setMaterialName(rq->fbr_material_name);
465
466 obj.fbx_scenenode = m_gfx_freebeams_grouping_node->createChildSceneNode(fmt::format("FreeBeamGfx_{}", rq->fbr_id));
467 obj.fbx_scenenode->setScale(rq->fbr_diameter, -1, rq->fbr_diameter);
468 obj.fbx_scenenode->attachObject(e);
469
470 m_gfx_freebeams.push_back(obj);
471}
472
474{
475 auto itor = std::find_if(m_gfx_freebeams.begin(), m_gfx_freebeams.end(),
476 [rq](const FreeBeamGfx& obj) { return obj.fbx_id == rq->fbr_id; });
477 if (itor == m_gfx_freebeams.end())
478 {
480 fmt::format("FreeBeamGfx with ID %d not found, ignoring request.", rq->fbr_id));
481 return;
482 }
483
484 FreeBeamGfx& obj = *itor;
485 this->RemoveFreeBeamGfx(rq->fbr_id);
486 this->AddFreeBeamGfx(rq);
487}
488
490{
491 auto itor = std::find_if(m_gfx_freebeams.begin(), m_gfx_freebeams.end(),
492 [id](const FreeBeamGfx& obj) { return obj.fbx_id == id; });
493 if (itor == m_gfx_freebeams.end())
494 {
496 fmt::format("FreeBeamGfx with ID %d not found, ignoring request.", id));
497 return;
498 }
499
500 FreeBeamGfx& obj = *itor;
501 m_scene_manager->destroyEntity((Ogre::Entity*)obj.fbx_scenenode->getAttachedObject(0));
503 m_gfx_freebeams.erase(itor);
504}
505
507{
508 for (FreeBeamGfx& freebeam : m_gfx_freebeams)
509 {
510 // Sanity checks - primary freeforce
511 ROR_ASSERT(freebeam.fbx_id != FREEBEAMGFXID_INVALID);
512 ROR_ASSERT(freebeam.fbx_freeforce_primary != FREEFORCEID_INVALID);
513 ActorManager::FreeForceVec_t::iterator itor;
514 const bool exists = App::GetGameContext()->GetActorManager()->FindFreeForce(freebeam.fbx_freeforce_primary, itor);
515 ROR_ASSERT(exists);
516 if (!exists)
517 {
518 continue;
519 }
520 FreeForce& freeforce = *itor;
521
522 // Sanity checks - base actor
523 ROR_ASSERT(freeforce.ffc_base_actor);
525 GfxActor* gfx_actor_base = freeforce.ffc_base_actor->GetGfxActor();
526 ROR_ASSERT(gfx_actor_base);
528 ROR_ASSERT(freeforce.ffc_base_node < freeforce.ffc_base_actor->ar_num_nodes);
529
530 // Sanity checks - target actor
531 ROR_ASSERT(freeforce.ffc_target_actor);
533 GfxActor* gfx_actor_target = freeforce.ffc_target_actor->GetGfxActor();
534 ROR_ASSERT(gfx_actor_target);
537
538 // Get node positions
539 Ogre::Vector3 basenode_pos = gfx_actor_base->GetSimNodeBuffer()[freeforce.ffc_base_node].AbsPosition;
540 Ogre::Vector3 targetnode_pos = gfx_actor_target->GetSimNodeBuffer()[freeforce.ffc_target_node].AbsPosition;
541
542 // Do the transforms
543 freebeam.fbx_scenenode->setPosition(basenode_pos.midPoint(targetnode_pos));
544 freebeam.fbx_scenenode->setOrientation(GfxScene::SpecialGetRotationTo(Ogre::Vector3::UNIT_Y, (basenode_pos - targetnode_pos)));
545 freebeam.fbx_scenenode->setScale(freebeam.fbx_diameter, basenode_pos.distance(targetnode_pos), freebeam.fbx_diameter);
546 }
547}
548
550{
551 auto itor_secondary = std::find_if(m_gfx_freebeams.begin(), m_gfx_freebeams.end(),
552 [id](const FreeBeamGfx& obj) { return obj.fbx_freeforce_secondary == id; });
553 if (itor_secondary != m_gfx_freebeams.end())
554 {
555 // Just clear the freeforce ID
556 itor_secondary->fbx_freeforce_secondary = FREEFORCEID_INVALID;
557 }
558 else
559 {
560 auto itor_primary = std::find_if(m_gfx_freebeams.begin(), m_gfx_freebeams.end(),
561 [id](const FreeBeamGfx& obj) { return obj.fbx_freeforce_primary == id; });
562 if (itor_primary != m_gfx_freebeams.end())
563 {
564 // Remove the whole freebeam
565 this->RemoveFreeBeamGfx(itor_primary->fbx_id);
566 }
567 }
568}
569
571{
572 auto itor = std::find_if(m_gfx_freebeams.begin(), m_gfx_freebeams.end(),
573 [id](const FreeBeamGfx& obj) { return obj.fbx_freeforce_primary == id || obj.fbx_freeforce_secondary == id; });
574 if (itor != m_gfx_freebeams.end())
575 {
576 // Remove the whole freebeam if either freeforce broke
577 this->RemoveFreeBeamGfx(itor->fbx_id);
578 }
579}
580
581Ogre::Quaternion RoR::GfxScene::SpecialGetRotationTo(const Ogre::Vector3& src, const Ogre::Vector3& dest)
582{
583 // Based on Stan Melax's article in Game Programming Gems
584 Ogre::Quaternion q;
585 // Copy, since cannot modify local
586 Ogre::Vector3 v0 = src;
587 Ogre::Vector3 v1 = dest;
588 v0.normalise();
589 v1.normalise();
590
591 // NB if the crossProduct approaches zero, we get unstable because ANY axis will do
592 // when v0 == -v1
593 Ogre::Real d = v0.dotProduct(v1);
594 // If dot == 1, vectors are the same
595 if (d >= 1.0f)
596 {
597 return Ogre::Quaternion::IDENTITY;
598 }
599 if (d < (1e-6f - 1.0f))
600 {
601 // Generate an axis
602 Ogre::Vector3 axis = Ogre::Vector3::UNIT_X.crossProduct(src);
603 if (axis.isZeroLength()) // pick another if colinear
604 axis = Ogre::Vector3::UNIT_Y.crossProduct(src);
605 axis.normalise();
606 q.FromAngleAxis(Ogre::Radian(Ogre::Math::PI), axis);
607 }
608 else
609 {
610 Ogre::Real s = fast_sqrt((1 + d) * 2);
611 if (s == 0)
612 return Ogre::Quaternion::IDENTITY;
613
614 Ogre::Vector3 c = v0.crossProduct(v1);
615 Ogre::Real invs = 1 / s;
616
617 q.x = c.x * invs;
618 q.y = c.y * invs;
619 q.z = c.z * invs;
620 q.w = s * 0.5;
621 }
622 return q;
623}
System integration layer; inspired by OgreBites::ApplicationContext.
#define ROR_ASSERT(_EXPR)
Definition Application.h:40
#define TOSTRING(x)
Definition Application.h:57
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:432
GfxActor * GetGfxActor()
Definition Actor.h:309
ActorState ar_state
Definition Actor.h:518
int ar_num_nodes
Definition Actor.h:345
ActorType ar_driveable
Sim attr; marks vehicle type and features.
Definition Actor.h:431
bool IsSimulationPaused() const
float GetSimulationSpeed() const
bool FindFreeForce(FreeForceID_t id, FreeForceVec_t::iterator &out_itor)
Ogre::Root * GetOgreRoot()
Definition AppContext.h:65
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:168
GUI::DirectionArrow DirectionArrow
Definition GUIManager.h:136
Character * GetPlayerCharacter()
const ActorPtr & GetPlayerActor()
const TerrainPtr & GetTerrain()
SceneMouse & GetSceneMouse()
ActorManager * GetActorManager()
RaceSystem & GetRaceSystem()
void UpdateVideoCameras(float dt)
Definition GfxActor.cpp:471
void UpdateWheelVisuals()
ActorSB & GetSimDataBuffer()
Definition GfxActor.h:128
void UpdateRods()
void FinishFlexbodyTasks()
void UpdateAirbrakes()
void UpdateCabMesh()
NodeSB * GetSimNodeBuffer()
Definition GfxActor.h:129
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:581
void AdjustParticleSystemTimeFactor(Ogre::ParticleSystem *psys)
Definition GfxScene.cpp:435
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
DustPool * GetDustPool(const char *name)
Definition GfxScene.cpp:277
void RemoveFreeBeamGfx(FreeBeamGfxID_t id)
Definition GfxScene.cpp:489
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:570
void RemoveGfxCharacter(RoR::GfxCharacter *gfx_character)
Definition GfxScene.cpp:365
void ModifyFreeBeamGfx(FreeBeamGfxRequest *rq)
Definition GfxScene.cpp:473
void OnFreeForceRemoved(FreeForceID_t id)
Definition GfxScene.cpp:549
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:446
void UpdateFreeBeamGfx(float dt)
Definition GfxScene.cpp:506
virtual void SetReflectionPlaneHeight(float)
Definition IGfxWater.h:47
Ogre::ColourValue GetPlayerColor(int color_num)
Definition Network.cpp:94
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:522
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:278
FreeForceID_t fbx_freeforce_secondary
Not required for fixed-end beams.
Definition GfxData.h:282
FreeBeamGfxID_t fbx_id
ID of the freebeam gfx, use GfxScene::GetFreeBeamGfxNextId()
Definition GfxData.h:279
float fbx_diameter
meters
Definition GfxData.h:286
Ogre::SceneNode * fbx_scenenode
Definition GfxData.h:285
FreeForceID_t fbx_freeforce_primary
Required.
Definition GfxData.h:281
Used by MSG_EDI_[ADD/MODIFY]_FREEBEAMGFX_REQUESTED; tailored for use with AngelScript thru GameScript...
Definition GfxData.h:292
std::string fbr_material_name
Definition GfxData.h:301
double fbr_diameter
meters
Definition GfxData.h:302
int64_t fbr_freeforce_primary
Required.
Definition GfxData.h:297
int64_t fbr_id
ID of the freebeam gfx, use GfxScene::GetFreeBeamGfxNextId()
Definition GfxData.h:295
int64_t fbr_freeforce_secondary
Not required for fixed-end beams.
Definition GfxData.h:298
std::string fbr_mesh_name
Definition GfxData.h:300
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:204
bool simbuf_dir_arrow_visible
Definition SimBuffers.h:218
float simbuf_race_time_diff
Definition SimBuffers.h:213
ActorPtr simbuf_player_actor
Definition SimBuffers.h:203
CameraManager::CameraBehaviors simbuf_camera_behavior
Definition SimBuffers.h:208
Ogre::Vector3 simbuf_dir_arrow_target
Definition SimBuffers.h:216
float simbuf_race_best_time
Definition SimBuffers.h:212
bool simbuf_race_in_progress_prev
Definition SimBuffers.h:215
std::string simbuf_dir_arrow_text
Definition SimBuffers.h:217
Ogre::Vector3 AbsPosition
Definition SimBuffers.h:69