RigsofRods
Soft-body Physics Simulation
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 "SimBuffers.h"
32 #include "Skidmark.h"
33 
34 #include <map>
35 #include <string>
36 #include <memory>
37 
38 namespace RoR {
39 
42 
45 class GfxScene
46 {
47 public:
48 
49  void Init();
50 
51  // Particles:
52  void CreateDustPools();
53  DustPool* GetDustPool(const char* name);
54  void AdjustParticleSystemTimeFactor(Ogre::ParticleSystem* psys);
55 
56  void SetParticlesVisible(bool visible);
57  void DrawNetLabel(Ogre::Vector3 pos, float cam_dist, std::string const& nick, int colornum);
58  void UpdateScene(float dt);
59  void ClearScene();
60  void RegisterGfxActor(RoR::GfxActor* gfx_actor);
61  void RemoveGfxActor(RoR::GfxActor* gfx_actor);
63  void RegisterGfxCharacter(RoR::GfxCharacter* gfx_character);
64  void RemoveGfxCharacter(RoR::GfxCharacter* gfx_character);
65  void BufferSimulationData();
67  GfxEnvmap& GetEnvMap() { return m_envmap; }
69  Ogre::SceneManager* GetSceneManager() { return m_scene_manager; }
70  std::vector<GfxActor*>& GetGfxActors() { return m_all_gfx_actors; }
71  std::vector<GfxCharacter*>& GetGfxCharacters() { return m_all_gfx_characters; }
72 
73 private:
74 
75  std::map<std::string, DustPool *> m_dustpools;
76  Ogre::SceneManager* m_scene_manager = nullptr;
77  std::vector<GfxActor*> m_all_gfx_actors;
78  std::vector<GfxActor*> m_live_gfx_actors;
79  std::vector<GfxCharacter*> m_all_gfx_characters;
83 };
84 
86 
87 } // namespace RoR
RoR::SkidmarkConfig
< Skidmark config file parser and data container
Definition: Skidmark.h:32
RoR::GfxScene::DrawNetLabel
void DrawNetLabel(Ogre::Vector3 pos, float cam_dist, std::string const &nick, int colornum)
Definition: GfxScene.cpp:367
RoR::GfxScene::RegisterGfxCharacter
void RegisterGfxCharacter(RoR::GfxCharacter *gfx_character)
Definition: GfxScene.cpp:353
ForwardDeclarations.h
Global forward declarations.
RoR::GfxScene::GetGfxActors
std::vector< GfxActor * > & GetGfxActors()
Definition: GfxScene.h:70
RoR::GfxScene::GetEnvMap
GfxEnvmap & GetEnvMap()
Definition: GfxScene.h:67
RoR::DustPool
Definition: DustPool.h:33
RoR::GfxScene::GetSimDataBuffer
GameContextSB & GetSimDataBuffer()
Definition: GfxScene.h:66
RoR::GameContextSB
Definition: SimBuffers.h:198
RoR::GfxScene::BufferSimulationData
void BufferSimulationData()
Run this when simulation is halted.
Definition: GfxScene.cpp:288
EnvironmentMap.h
RoR::GfxScene::RemoveGfxActor
void RemoveGfxActor(RoR::GfxActor *gfx_actor)
Definition: GfxScene.cpp:323
RoR::GfxScene::GetGfxCharacters
std::vector< GfxCharacter * > & GetGfxCharacters()
Definition: GfxScene.h:71
RoR::GfxScene::SetParticlesVisible
void SetParticlesVisible(bool visible)
Definition: GfxScene.cpp:262
CameraManager.h
RoR::GfxScene::ClearScene
void ClearScene()
Definition: GfxScene.cpp:60
RoR::GfxScene::CreateDustPools
void CreateDustPools()
Definition: GfxScene.cpp:49
RoR::GfxScene::m_all_gfx_characters
std::vector< GfxCharacter * > m_all_gfx_characters
Definition: GfxScene.h:79
RoR::GfxScene::GetSceneManager
Ogre::SceneManager * GetSceneManager()
Definition: GfxScene.h:69
RoR::GfxScene
Provides a 3D graphical representation of the simulation Idea: simulation runs at it's own constant r...
Definition: GfxScene.h:45
RoR::GfxScene::m_simbuf
GameContextSB m_simbuf
Definition: GfxScene.h:81
RoR::GfxScene::m_live_gfx_actors
std::vector< GfxActor * > m_live_gfx_actors
Definition: GfxScene.h:78
RoR::GfxScene::UpdateScene
void UpdateScene(float dt)
Definition: GfxScene.cpp:90
RoR::GfxScene::RegisterGfxActor
void RegisterGfxActor(RoR::GfxActor *gfx_actor)
Definition: GfxScene.cpp:283
RoR::GfxScene::m_dustpools
std::map< std::string, DustPool * > m_dustpools
Definition: GfxScene.h:75
RoR::GfxCharacter
Definition: Character.h:99
RoR::GfxScene::GetSkidmarkConf
RoR::SkidmarkConfig * GetSkidmarkConf()
Definition: GfxScene.h:68
RoR::GfxScene::GetDustPool
DustPool * GetDustPool(const char *name)
Definition: GfxScene.cpp:270
RoR::GfxScene::m_skidmark_conf
SkidmarkConfig m_skidmark_conf
Definition: GfxScene.h:82
RoR::GfxScene::m_scene_manager
Ogre::SceneManager * m_scene_manager
Definition: GfxScene.h:76
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:358
RoR::GfxActor
Definition: GfxActor.h:52
RoR::GfxScene::m_envmap
RoR::GfxEnvmap m_envmap
Definition: GfxScene.h:80
RoR::GfxScene::m_all_gfx_actors
std::vector< GfxActor * > m_all_gfx_actors
Definition: GfxScene.h:77
SimBuffers.h
RoR::GfxScene::AdjustParticleSystemTimeFactor
void AdjustParticleSystemTimeFactor(Ogre::ParticleSystem *psys)
Definition: GfxScene.cpp:428
RoR::GfxScene::Init
void Init()
Definition: GfxScene.cpp:82
RoR::GfxScene::ForceUpdateSingleGfxActor
void ForceUpdateSingleGfxActor(RoR::GfxActor *gfx_actor)
Definition: GfxScene.cpp:332
RoR
Definition: AppContext.h:36