RigsofRods
Soft-body Physics Simulation
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
GfxScene.h
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 
25 
26 #pragma once
27 
28 #include "CameraManager.h"
29 #include "ForwardDeclarations.h"
30 #include "EnvironmentMap.h" // RoR::GfxEnvmap
31 #include "GfxData.h"
32 #include "SimBuffers.h"
33 #include "Skidmark.h"
34 
35 #include <map>
36 #include <string>
37 #include <memory>
38 
39 namespace RoR {
40 
43 
46 class GfxScene
47 {
48 public:
49 
50  void Init();
51 
54  void CreateDustPools();
55  DustPool* GetDustPool(const char* name);
56  void AdjustParticleSystemTimeFactor(Ogre::ParticleSystem* psys);
57  void SetParticlesVisible(bool visible);
59 
66  void UpdateFreeBeamGfx(float dt);
70 
71  void DrawNetLabel(Ogre::Vector3 pos, float cam_dist, std::string const& nick, int colornum);
72  void UpdateScene(float dt);
73  void ClearScene();
74  void RegisterGfxActor(RoR::GfxActor* gfx_actor);
75  void RemoveGfxActor(RoR::GfxActor* gfx_actor);
77  void RegisterGfxCharacter(RoR::GfxCharacter* gfx_character);
78  void RemoveGfxCharacter(RoR::GfxCharacter* gfx_character);
79  void BufferSimulationData();
81  GfxEnvmap& GetEnvMap() { return m_envmap; }
83  Ogre::SceneManager* GetSceneManager() { return m_scene_manager; }
84  std::vector<GfxActor*>& GetGfxActors() { return m_all_gfx_actors; }
85  std::vector<GfxCharacter*>& GetGfxCharacters() { return m_all_gfx_characters; }
86 
87  static Ogre::Quaternion SpecialGetRotationTo(const Ogre::Vector3& src, const Ogre::Vector3& dest);
88 
89 private:
90 
91  std::map<std::string, DustPool *> m_dustpools;
92  Ogre::SceneManager* m_scene_manager = nullptr;
93  std::vector<GfxActor*> m_all_gfx_actors;
94  std::vector<GfxActor*> m_live_gfx_actors;
95  std::vector<GfxCharacter*> m_all_gfx_characters;
99 
100  // Free beams GFX:
101  std::vector<FreeBeamGfx> m_gfx_freebeams;
103  Ogre::SceneNode* m_gfx_freebeams_grouping_node = nullptr;
104 };
105 
107 
108 } // namespace RoR
RoR::SkidmarkConfig
< Skidmark config file parser and data container
Definition: Skidmark.h:32
RoR::GfxScene::OnFreeForceRemoved
void OnFreeForceRemoved(FreeForceID_t id)
Definition: GfxScene.cpp:548
RoR::GfxScene::DrawNetLabel
void DrawNetLabel(Ogre::Vector3 pos, float cam_dist, std::string const &nick, int colornum)
Definition: GfxScene.cpp:373
RoR::GfxScene::RegisterGfxCharacter
void RegisterGfxCharacter(RoR::GfxCharacter *gfx_character)
Definition: GfxScene.cpp:359
ForwardDeclarations.h
Global forward declarations.
RoR::GfxScene::GetGfxActors
std::vector< GfxActor * > & GetGfxActors()
Definition: GfxScene.h:84
RoR::GfxScene::GetEnvMap
GfxEnvmap & GetEnvMap()
Definition: GfxScene.h:81
RoR::DustPool
Definition: DustPool.h:33
RoR::GfxScene::GetSimDataBuffer
GameContextSB & GetSimDataBuffer()
Definition: GfxScene.h:80
RoR::GameContextSB
Definition: SimBuffers.h:198
RoR::FreeBeamGfxID_t
int FreeBeamGfxID_t
Index into GfxScene::m_gfx_freebeams, use RoR::FREEBEAMGFXID_INVALID as empty value.
Definition: ForwardDeclarations.h:93
RoR::GfxScene::BufferSimulationData
void BufferSimulationData()
Run this when simulation is halted.
Definition: GfxScene.cpp:294
RoR::GfxScene::OnFreeForceBroken
void OnFreeForceBroken(FreeForceID_t id)
Definition: GfxScene.cpp:569
EnvironmentMap.h
RoR::GfxScene::RemoveGfxActor
void RemoveGfxActor(RoR::GfxActor *gfx_actor)
Definition: GfxScene.cpp:329
RoR::GfxScene::GetGfxCharacters
std::vector< GfxCharacter * > & GetGfxCharacters()
Definition: GfxScene.h:85
RoR::GfxScene::SetParticlesVisible
void SetParticlesVisible(bool visible)
Definition: GfxScene.cpp:268
CameraManager.h
RoR::GfxScene::ClearScene
void ClearScene()
Definition: GfxScene.cpp:61
RoR::GfxScene::CreateDustPools
void CreateDustPools()
Definition: GfxScene.cpp:50
RoR::FreeBeamGfxRequest
Used by MSG_EDI_[ADD/MODIFY]_FREEBEAMGFX_REQUESTED; tailored for use with AngelScript thru GameScript...
Definition: GfxData.h:284
RoR::GfxScene::m_gfx_freebeam_next_id
FreeBeamGfxID_t m_gfx_freebeam_next_id
Definition: GfxScene.h:102
RoR::GfxScene::m_all_gfx_characters
std::vector< GfxCharacter * > m_all_gfx_characters
Definition: GfxScene.h:95
RoR::GfxScene::m_gfx_freebeams_grouping_node
Ogre::SceneNode * m_gfx_freebeams_grouping_node
Only for nicer scenegraph when viewing through Inspector gadget.
Definition: GfxScene.h:103
RoR::GfxScene::GetSceneManager
Ogre::SceneManager * GetSceneManager()
Definition: GfxScene.h:83
RoR::GfxScene
Provides a 3D graphical representation of the simulation Idea: simulation runs at it's own constant r...
Definition: GfxScene.h:46
RoR::GfxScene::ModifyFreeBeamGfx
void ModifyFreeBeamGfx(FreeBeamGfxRequest *rq)
Definition: GfxScene.cpp:472
RoR::GfxScene::m_simbuf
GameContextSB m_simbuf
Definition: GfxScene.h:97
RoR::GfxScene::m_gfx_freebeams
std::vector< FreeBeamGfx > m_gfx_freebeams
Definition: GfxScene.h:101
RoR::GfxScene::m_live_gfx_actors
std::vector< GfxActor * > m_live_gfx_actors
Definition: GfxScene.h:94
RoR::GfxScene::UpdateScene
void UpdateScene(float dt)
Definition: GfxScene.cpp:94
RoR::GfxScene::RegisterGfxActor
void RegisterGfxActor(RoR::GfxActor *gfx_actor)
Definition: GfxScene.cpp:289
RoR::GfxScene::AddFreeBeamGfx
void AddFreeBeamGfx(FreeBeamGfxRequest *rq)
Definition: GfxScene.cpp:445
RoR::GfxScene::m_dustpools
std::map< std::string, DustPool * > m_dustpools
Definition: GfxScene.h:91
RoR::GfxCharacter
Definition: Character.h:98
RoR::FreeForceID_t
int FreeForceID_t
Unique sequentially generated ID of FreeForce; use ActorManager::GetFreeForceNextId().
Definition: ForwardDeclarations.h:67
RoR::GfxScene::SpecialGetRotationTo
static Ogre::Quaternion SpecialGetRotationTo(const Ogre::Vector3 &src, const Ogre::Vector3 &dest)
Definition: GfxScene.cpp:580
RoR::GfxScene::GetSkidmarkConf
RoR::SkidmarkConfig * GetSkidmarkConf()
Definition: GfxScene.h:82
RoR::GfxScene::GetDustPool
DustPool * GetDustPool(const char *name)
Definition: GfxScene.cpp:276
RoR::GfxScene::m_skidmark_conf
SkidmarkConfig m_skidmark_conf
Definition: GfxScene.h:98
RoR::GfxScene::m_scene_manager
Ogre::SceneManager * m_scene_manager
Definition: GfxScene.h:92
RoR::GfxScene::GetFreeBeamGfxNextId
FreeBeamGfxID_t GetFreeBeamGfxNextId()
Definition: GfxScene.h:65
Skidmark.h
RoR::GfxEnvmap
A dynamic environment probe; Creates a cubemap with realtime reflections around specified point.
Definition: EnvironmentMap.h:33
RoR::GfxScene::RemoveGfxCharacter
void RemoveGfxCharacter(RoR::GfxCharacter *gfx_character)
Definition: GfxScene.cpp:364
GfxData.h
RoR::GfxScene::UpdateFreeBeamGfx
void UpdateFreeBeamGfx(float dt)
Definition: GfxScene.cpp:505
RoR::GfxActor
Definition: GfxActor.h:52
RoR::GfxScene::m_envmap
RoR::GfxEnvmap m_envmap
Definition: GfxScene.h:96
RoR::GfxScene::m_all_gfx_actors
std::vector< GfxActor * > m_all_gfx_actors
Definition: GfxScene.h:93
SimBuffers.h
RoR::GfxScene::AdjustParticleSystemTimeFactor
void AdjustParticleSystemTimeFactor(Ogre::ParticleSystem *psys)
Definition: GfxScene.cpp:434
RoR::GfxScene::Init
void Init()
Definition: GfxScene.cpp:85
RoR::GfxScene::ForceUpdateSingleGfxActor
void ForceUpdateSingleGfxActor(RoR::GfxActor *gfx_actor)
Definition: GfxScene.cpp:338
RoR
Definition: AppContext.h:36
RoR::GfxScene::RemoveFreeBeamGfx
void RemoveFreeBeamGfx(FreeBeamGfxID_t id)
Definition: GfxScene.cpp:488