RigsofRods
Soft-body Physics Simulation
Terrain.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-2016 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 "Terrain.h"
23 
24 #include "Actor.h"
25 #include "ActorManager.h"
26 #include "CacheSystem.h"
27 #include "Collisions.h"
28 #include "ContentManager.h"
29 #include "Renderdash.h"
30 #include "GfxScene.h"
31 #include "GUIManager.h"
32 #include "GUI_LoadingWindow.h"
33 #include "GUI_SurveyMap.h"
34 #include "HydraxWater.h"
35 #include "Language.h"
36 #include "ScriptEngine.h"
37 #include "ShadowManager.h"
38 #include "SkyManager.h"
39 #include "SkyXManager.h"
40 #include "TerrainGeometryManager.h"
41 #include "TerrainObjectManager.h"
42 #include "Utils.h"
43 #include "Water.h"
44 
45 #include <Terrain/OgreTerrainPaging.h>
46 #include <Terrain/OgreTerrainGroup.h>
47 #include <OgreRectangle2D.h>
48 
49 #include <algorithm>
50 
51 using namespace RoR;
52 using namespace Ogre;
53 
55  : m_collisions(0)
56  , m_geometry_manager(0)
57  , m_object_manager(0)
58  , m_shadow_manager(0)
59  , m_sky_manager(0)
60  , SkyX_manager(0)
61  , m_sight_range(1000)
62  , m_main_light(0)
63  , m_paged_detail_factor(0.0f)
64  , m_cur_gravity(DEFAULT_GRAVITY)
65  , m_hydrax_water(nullptr)
66  , m_cache_entry(entry)
67  , m_def(def)
68 {
69 }
70 
72 {
73  if (!m_disposed)
74  {
75  this->dispose();
76  }
77 }
78 
80 {
81  if (App::app_state->getEnum<AppState>() == AppState::SHUTDOWN)
82  {
83  // Rush to exit
84  return;
85  }
86 
87  //I think that the order is important
88 
89 #ifdef USE_CAELUM
90  if (m_sky_manager != nullptr)
91  {
92  delete(m_sky_manager);
93  m_sky_manager = nullptr;
94  }
95 #endif // USE_CAELUM
96 
97  if (SkyX_manager != nullptr)
98  {
99  delete(SkyX_manager);
100  SkyX_manager = nullptr;
101  }
102 
103  if (m_main_light != nullptr)
104  {
105  App::GetGfxScene()->GetSceneManager()->destroyAllLights();
106  m_main_light = nullptr;
107  }
108 
109  if (m_hydrax_water != nullptr)
110  {
111  m_water.reset(); // TODO: Currently needed - research and get rid of this ~ only_a_ptr, 08/2018
112  }
113 
114  if (m_object_manager != nullptr)
115  {
116  delete(m_object_manager);
117  m_object_manager = nullptr;
118  }
119 
120  if (m_geometry_manager != nullptr)
121  {
122  delete(m_geometry_manager);
123  m_geometry_manager = nullptr;
124  }
125 
126  if (m_shadow_manager != nullptr)
127  {
128  delete(m_shadow_manager);
129  m_shadow_manager = nullptr;
130  }
131 
132  if (m_collisions != nullptr)
133  {
134  delete(m_collisions);
135  m_collisions = nullptr;
136  }
137 
138  if (App::GetScriptEngine()->getTerrainScriptUnit() != SCRIPTUNITID_INVALID)
139  {
140  App::GetScriptEngine()->unloadScript(App::GetScriptEngine()->getTerrainScriptUnit());
141  }
142 
143  m_disposed = true;
144 }
145 
147 {
148  auto* loading_window = &App::GetGuiManager()->LoadingWindow;
149 
150  this->setGravity(this->m_def.gravity);
151 
152  loading_window->SetProgress(10, _L("Initializing Object Subsystem"));
153  this->initObjects(); // *.odef files
154 
155  loading_window->SetProgress(14, _L("Initializing Shadow Subsystem"));
156  this->initShadows();
157 
158  loading_window->SetProgress(17, _L("Initializing Geometry Subsystem"));
159  this->m_geometry_manager = new TerrainGeometryManager(this);
160 
161  loading_window->SetProgress(23, _L("Initializing Camera Subsystem"));
162  this->initCamera();
163 
164  // sky, must come after camera due to m_sight_range
165  loading_window->SetProgress(25, _L("Initializing Sky Subsystem"));
166  this->initSkySubSystem();
167 
168  loading_window->SetProgress(27, _L("Initializing Light Subsystem"));
169  this->initLight();
170 
171  if (App::gfx_sky_mode->getEnum<GfxSkyMode>() != GfxSkyMode::CAELUM) //Caelum has its own fog management
172  {
173  loading_window->SetProgress(29, _L("Initializing Fog Subsystem"));
174  this->initFog();
175  }
176 
177  loading_window->SetProgress(31, _L("Initializing Vegetation Subsystem"));
178  this->initVegetation();
179 
180  this->fixCompositorClearColor();
181 
182  loading_window->SetProgress(40, _L("Loading Terrain Geometry"));
183  if (!this->m_geometry_manager->InitTerrain(this->m_def.ogre_ter_conf_filename))
184  {
185  return false; // Error already reported
186  }
187 
188  loading_window->SetProgress(60, _L("Initializing Collision Subsystem"));
189  this->m_collisions = new Collisions(this->getMaxTerrainSize());
190 
191  loading_window->SetProgress(75, _L("Initializing Script Subsystem"));
192  this->initScripting();
193  this->initAiPresets();
194 
195  loading_window->SetProgress(77, _L("Initializing Water Subsystem"));
196  this->initWater();
197 
198  loading_window->SetProgress(80, _L("Loading Terrain Objects"));
199  this->loadTerrainObjects(); // *.tobj files
200 
201  // init things after loading the terrain
202  this->initTerrainCollisions();
203 
204  loading_window->SetProgress(90, _L("Initializing terrain light properties"));
205  this->m_geometry_manager->UpdateMainLightPosition(); // Initial update takes a while
206  this->m_collisions->finishLoadingTerrain();
207 
208  this->LoadTelepoints(); // *.terrn2 file feature
209 
210  App::GetGfxScene()->CreateDustPools(); // Particle effects
211 
212  loading_window->SetProgress(92, _L("Initializing Overview Map Subsystem"));
213  App::GetGuiManager()->SurveyMap.CreateTerrainTextures(); // Should be done before actors are loaded, otherwise they'd show up in the static texture
214 
215  LOG(" ===== LOADING TERRAIN ACTORS " + m_cache_entry->fname);
216  loading_window->SetProgress(95, _L("Loading Terrain Actors"));
217  this->LoadPredefinedActors();
218 
219  LOG(" ===== TERRAIN LOADING DONE " + m_cache_entry->fname);
220 
221  App::sim_terrain_name->setStr(m_cache_entry->fname);
222  App::sim_terrain_gui_name->setStr(this->m_def.name);
223 
224  return this;
225 }
226 
228 {
229  App::GetCameraManager()->GetCamera()->getViewport()->setBackgroundColour(m_def.ambient_color);
230  App::GetCameraManager()->GetCameraNode()->setPosition(m_def.start_position);
231 
232  if (App::gfx_sky_mode->getEnum<GfxSkyMode>() == GfxSkyMode::SKYX)
233  {
234  m_sight_range = 5000; //Force unlimited for SkyX, lower settings are glitchy
235  }
236  else
237  {
238  m_sight_range = App::gfx_sight_range->getInt();
239  }
240 
241  if (m_sight_range < UNLIMITED_SIGHTRANGE && App::gfx_sky_mode->getEnum<GfxSkyMode>() != GfxSkyMode::SKYX)
242  {
243  App::GetCameraManager()->GetCamera()->setFarClipDistance(m_sight_range);
244  }
245  else
246  {
247  // disabled in global config
248  if (App::gfx_water_mode->getEnum<GfxWaterMode>() != GfxWaterMode::HYDRAX)
249  App::GetCameraManager()->GetCamera()->setFarClipDistance(0); //Unlimited
250  else
251  App::GetCameraManager()->GetCamera()->setFarClipDistance(9999 * 6); //Unlimited for hydrax and stuff
252  }
253 }
254 
256 {
257 #ifdef USE_CAELUM
258  // Caelum skies
259  if (App::gfx_sky_mode->getEnum<GfxSkyMode>() == GfxSkyMode::CAELUM)
260  {
261  m_sky_manager = new SkyManager();
262 
263  // try to load caelum config
264  if (!m_def.caelum_config.empty() && ResourceGroupManager::getSingleton().resourceExistsInAnyGroup(m_def.caelum_config))
265  {
266  // config provided and existing, use it :)
267  m_sky_manager->LoadCaelumScript(m_def.caelum_config, m_def.caelum_fog_start, m_def.caelum_fog_end);
268  }
269  else
270  {
271  // no config provided, fall back to the default one
272  m_sky_manager->LoadCaelumScript("ror_default_sky");
273  }
274  }
275  else
276 #endif //USE_CAELUM
277  // SkyX skies
278  if (App::gfx_sky_mode->getEnum<GfxSkyMode>() == GfxSkyMode::SKYX)
279  {
280  // try to load SkyX config
281  if (!m_def.skyx_config.empty() && ResourceGroupManager::getSingleton().resourceExistsInAnyGroup(m_def.skyx_config))
282  SkyX_manager = new SkyXManager(m_def.skyx_config);
283  else
284  SkyX_manager = new SkyXManager("SkyXDefault.skx");
285  }
286  else
287  {
288  // Create background rectangle covering the whole screen
289  Rectangle2D* rect = new Rectangle2D(true);
290  rect->setCorners(-1.0, 1.0, 1.0, -1.0);
291 
292  Ogre::MaterialPtr ptr = Ogre::MaterialManager::getSingleton().getByName("tracks/skyboxcol");
293  rect->setMaterial(ptr);
294 
295  // Render the background before everything else
296  rect->setRenderQueueGroup(RENDER_QUEUE_BACKGROUND);
297 
298  // Use infinite AAB to always stay visible
299  AxisAlignedBox aabInf;
300  aabInf.setInfinite();
301  rect->setBoundingBox(aabInf);
302 
303  // Attach background to the scene
304  SceneNode* node = App::GetGfxScene()->GetSceneManager()->getRootSceneNode()->createChildSceneNode("Background");
305  node->attachObject(rect);
306  }
307 }
308 
310 {
311  if (App::gfx_sky_mode->getEnum<GfxSkyMode>() == GfxSkyMode::CAELUM)
312  {
313 #ifdef USE_CAELUM
314  m_main_light = m_sky_manager->GetSkyMainLight();
315 #endif
316  }
317  else if (App::gfx_sky_mode->getEnum<GfxSkyMode>() == GfxSkyMode::SKYX)
318  {
319  m_main_light = SkyX_manager->getMainLight();
320  }
321  else
322  {
323  // screw caelum, we will roll our own light
324  App::GetGfxScene()->GetSceneManager()->setAmbientLight(Ogre::ColourValue(0.7f, 0.7f, 0.7f)); // update survey map texture
325 
326  // Create a light
327  m_main_light = App::GetGfxScene()->GetSceneManager()->createLight("MainLight");
328  //directional light for shadow
329  m_main_light->setType(Light::LT_DIRECTIONAL);
330  m_main_light->setDirection(Ogre::Vector3(0.785, -0.423, 0.453).normalisedCopy());
331 
332  m_main_light->setDiffuseColour(m_def.ambient_color);
333  m_main_light->setSpecularColour(m_def.ambient_color);
334  m_main_light->setCastShadows(true);
335  m_main_light->setShadowFarDistance(1000.0f);
336  m_main_light->setShadowNearClipDistance(-1);
337  }
338 }
339 
341 {
342  if (m_sight_range >= UNLIMITED_SIGHTRANGE)
343  App::GetGfxScene()->GetSceneManager()->setFog(FOG_NONE);
344  else
345  App::GetGfxScene()->GetSceneManager()->setFog(FOG_LINEAR, m_def.ambient_color, 0.000f, m_sight_range * 0.65f, m_sight_range*0.9);
346 }
347 
349 {
350  switch (App::gfx_vegetation_mode->getEnum<GfxVegetation>())
351  {
353  m_paged_detail_factor = 0.2f;
354  break;
356  m_paged_detail_factor = 0.5f;
357  break;
358  case GfxVegetation::FULL:
359  m_paged_detail_factor = 1.0f;
360  break;
361  default:
362  m_paged_detail_factor = 0.0f;
363  break;
364  }
365 }
366 
368 {
369  // hack
370  // now with extensive error checking
371  if (CompositorManager::getSingleton().hasCompositorChain(App::GetCameraManager()->GetCamera()->getViewport()))
372  {
373  CompositorInstance* co = CompositorManager::getSingleton().getCompositorChain(App::GetCameraManager()->GetCamera()->getViewport())->_getOriginalSceneCompositor();
374  if (co)
375  {
376  CompositionTechnique* ct = co->getTechnique();
377  if (ct)
378  {
379  CompositionTargetPass* ctp = ct->getOutputTargetPass();
380  if (ctp)
381  {
382  CompositionPass* p = ctp->getPass(0);
383  if (p)
384  {
385  p->setClearColour(Ogre::ColourValue::Black);
386  }
387  }
388  }
389  }
390  }
391 }
392 
394 {
395  // disabled in global config
396  if (App::gfx_water_mode->getEnum<GfxWaterMode>() == GfxWaterMode::NONE)
397  return;
398 
399  // disabled in map config
400  if (!m_def.has_water)
401  {
402  return;
403  }
404 
405  if (App::gfx_water_mode->getEnum<GfxWaterMode>() == GfxWaterMode::HYDRAX)
406  {
407  // try to load hydrax config
408  if (!m_def.hydrax_conf_file.empty() && ResourceGroupManager::getSingleton().resourceExistsInAnyGroup(m_def.hydrax_conf_file))
409  {
410  m_hydrax_water = new HydraxWater(m_def.water_height, m_def.hydrax_conf_file);
411  }
412  else
413  {
414  // no config provided, fall back to the default one
415  m_hydrax_water = new HydraxWater(m_def.water_height);
416  }
417 
418  m_water = std::unique_ptr<IWater>(m_hydrax_water);
419 
420  //Apply depth technique to the terrain
421  TerrainGroup::TerrainIterator ti = m_geometry_manager->getTerrainGroup()->getTerrainIterator();
422  while (ti.hasMoreElements())
423  {
424  Ogre::Terrain* t = ti.getNext()->instance;
425  MaterialPtr ptr = t->getMaterial();
426  m_hydrax_water->GetHydrax()->getMaterialManager()->addDepthTechnique(ptr->createTechnique());
427  }
428  }
429  else
430  {
431  m_water = std::unique_ptr<IWater>(new Water(this->getMaxTerrainSize()));
432  m_water->SetStaticWaterHeight(m_def.water_height);
433  m_water->SetWaterBottomHeight(m_def.water_bottom_height);
434  }
435 }
436 
438 {
439  m_shadow_manager = new ShadowManager();
440  m_shadow_manager->loadConfiguration();
441 }
442 
444 {
445  for (std::string tobj_filename : m_def.tobj_files)
446  {
447  m_object_manager->LoadTObjFile(tobj_filename);
448  }
449 }
450 
452 {
453  if (!m_def.traction_map_file.empty())
454  {
455  m_collisions->setupLandUse(m_def.traction_map_file.c_str());
456  }
457 }
458 
460 {
461 #ifdef USE_ANGELSCRIPT
462  // suspend AS logging, so we dont spam the users screen with initialization messages
464 
465  bool loaded = false;
466 
467  for (std::string as_filename : m_def.as_files)
468  {
469  loaded |= this->getObjectManager()->LoadTerrainScript(as_filename);
470  }
471 
472  if (!loaded)
473  {
474  // load a default script that does the most basic things
475  this->getObjectManager()->LoadTerrainScript(DEFAULT_TERRAIN_SCRIPT);
476  }
477 
478  // finally resume AS logging
480 #endif //USE_ANGELSCRIPT
481 }
482 
484 {
485  // Load 'bundled' AI presets - see section `[AI Presets]` in terrn2 file format
486  // ----------------------------------------------------------------------------
487 
488  for (const std::string& filename: m_def.ai_presets_files)
489  {
490  // assume there's just one file - load directly into the `ai_presets_bundled` variable
491  if (Ogre::ResourceGroupManager::getSingleton().resourceExists(this->getTerrainFileResourceGroup(), filename))
492  {
493  App::GetContentManager()->LoadAndParseJson(filename, this->getTerrainFileResourceGroup(), App::GetGuiManager()->TopMenubar.ai_presets_bundled);
494  }
495  else
496  {
497  LOG(fmt::format("[RoR|Terrain] AI presets file '{}' declared in '{}' not found!", filename, this->getTerrainFileName()));
498  }
499 
500  // Ensure the format is about right
501  if (!App::GetGuiManager()->TopMenubar.ai_presets_bundled.IsArray())
502  {
503  LOG(fmt::format("[RoR|Terrain] AI presets file '{}' declared in '{}' has wrong format - the root element is not an array!",
504  filename, this->getTerrainFileName()));
506  }
507  }
508 
509  // Force refresh - this is needed because the 'extern' AI presets are loaded later.
511 }
512 
513 void RoR::Terrain::setGravity(float value)
514 {
515  m_cur_gravity = value;
516 }
517 
519 {
520  m_object_manager = new TerrainObjectManager(this);
521 }
522 
524 {
525  return m_collisions->getCollisionAAB();
526 }
527 
529 {
530  if (!m_geometry_manager)
531  return Vector3::ZERO;
532  return m_geometry_manager->getMaxTerrainSize();
533 }
534 
535 float RoR::Terrain::GetHeightAt(float x, float z)
536 {
537  return m_geometry_manager->getHeightAt(x, z);
538 }
539 
540 Ogre::Vector3 RoR::Terrain::GetNormalAt(float x, float y, float z)
541 {
542  return m_geometry_manager->getNormalAt(x, y, z);
543 }
544 
546 {
547  return m_sky_manager;
548 }
549 
551 {
552  if (m_disposed)
553  return false;
554  else
555  return m_geometry_manager->isFlat();
556 }
557 
559 {
560  if (m_object_manager)
561  m_object_manager->LoadTelepoints();
562 }
563 
565 {
566  if (m_object_manager)
567  m_object_manager->LoadPredefinedActors();
568 }
569 
571 {
572  if (m_object_manager)
573  return m_object_manager->HasPredefinedActors();
574  return false;
575 }
576 
577 void RoR::Terrain::HandleException(const char* summary)
578 {
579  try
580  {
581  throw; // rethrow
582  }
583  catch (Ogre::Exception& oex)
584  {
585  RoR::LogFormat("[RoR|Terrain] %s, message: '%s', type: <Ogre::Exception>.", summary, oex.getFullDescription().c_str());
586  }
587  catch (std::exception& stex)
588  {
589  RoR::LogFormat("[RoR|Terrain] %s, message: '%s', type: <std::exception>.", summary, stex.what());
590  }
591  catch (...)
592  {
593  RoR::LogFormat("[RoR|Terrain] %s, unknown error occurred.", summary);
594  }
595 }
596 
598 {
599  return m_object_manager->getProceduralManager();
600 }
601 
603 {
604  return m_cache_entry->fname;
605 }
606 
608 {
609  return m_cache_entry->resource_group;
610 }
611 
612 void RoR::Terrain::addSurveyMapEntity(const std::string& type, const std::string& filename, const std::string& resource_group, const std::string& caption, const Ogre::Vector3& pos, float angle, int id)
613 {
614  m_object_manager->m_map_entities.push_back(SurveyMapEntity(type, caption, filename, resource_group, pos, Ogre::Radian(angle), id));
615 }
616 
618 {
619  EraseIf(m_object_manager->m_map_entities, [id](const SurveyMapEntity& e) { return e.id == id; });
620 }
621 
623 {
624  return m_object_manager->m_map_entities;
625 }
626 
627 CacheEntryPtr RoR::Terrain::getCacheEntry() { return m_cache_entry; }
RoR::Terrain::Terrain
Terrain(CacheEntryPtr entry, Terrn2Def def)
Definition: Terrain.cpp:54
RoR::Terrain::initCamera
void initCamera()
Definition: Terrain.cpp:227
RoR::GUIManager::SurveyMap
GUI::SurveyMap SurveyMap
Definition: GUIManager.h:125
RoR::App::GetContentManager
ContentManager * GetContentManager()
Definition: Application.cpp:266
SkyXManager.h
y
float y
Definition: (ValueTypes) quaternion.h:6
RoR::Terrn2Def
Definition: Terrn2FileFormat.h:48
RoR::Terrain::fixCompositorClearColor
void fixCompositorClearColor()
Definition: Terrain.cpp:367
RoR::Terrain::getMaxTerrainSize
Ogre::Vector3 getMaxTerrainSize()
Definition: Terrain.cpp:528
RoR::GUI::TopMenubar::ai_presets_all
rapidjson::Document ai_presets_all
The full list of presets, used for display. Needs to be refreshed when terrain is loaded.
Definition: GUI_TopMenubar.h:101
RoR::App::GetCameraManager
CameraManager * GetCameraManager()
Definition: Application.cpp:274
RoR::App::GetGuiManager
GUIManager * GetGuiManager()
Definition: Application.cpp:268
RoR::Collisions
Definition: Collisions.h:80
RoR::Terrain::initScripting
void initScripting()
Definition: Terrain.cpp:459
RoR::TerrainObjectManager
Definition: TerrainObjectManager.h:49
RoR::Terrain::initShadows
void initShadows()
Definition: Terrain.cpp:437
z
float z
Definition: (ValueTypes) quaternion.h:7
SkyManager.h
Renderdash.h
ContentManager.h
RoR::Terrain::getTerrainFileResourceGroup
std::string getTerrainFileResourceGroup()
Definition: Terrain.cpp:607
format
Truck file format(technical spec)
RoR::Terrain::isFlat
bool isFlat()
Definition: Terrain.cpp:550
RoR::Terrain::getSkyManager
SkyManager * getSkyManager()
Definition: Terrain.cpp:545
TerrainGeometryManager.h
RoR::Terrain::setGravity
void setGravity(float value)
Definition: Terrain.cpp:513
RoR::ShadowManager
Definition: ShadowManager.h:51
RoR::HydraxWater
Definition: HydraxWater.h:34
RoR::Terrain::~Terrain
virtual ~Terrain() override
Definition: Terrain.cpp:71
RoR::LogFormat
void LogFormat(const char *format,...)
Improved logging utility. Uses fixed 2Kb buffer.
Definition: Application.cpp:367
RoR::GfxScene::CreateDustPools
void CreateDustPools()
Definition: GfxScene.cpp:49
RoR::GfxWaterMode::NONE
@ NONE
None.
RoR::ScriptEngine::setForwardScriptLogToConsole
void setForwardScriptLogToConsole(bool doForward)
Definition: ScriptEngine.cpp:1009
DEFAULT_TERRAIN_SCRIPT
#define DEFAULT_TERRAIN_SCRIPT
Definition: ScriptEngine.h:30
RoR::Water
Definition: Water.h:40
RoR::Terrain::initSkySubSystem
void initSkySubSystem()
Definition: Terrain.cpp:255
RoR::CameraManager::GetCameraNode
Ogre::SceneNode * GetCameraNode()
Definition: CameraManager.h:63
RoR::Terrain::getTerrainCollisionAAB
Ogre::AxisAlignedBox getTerrainCollisionAAB()
Definition: Terrain.cpp:523
Utils.h
Language.h
TerrainObjectManager.h
RefCountingObjectPtr< CacheEntry >
GUIManager.h
ActorManager.h
RoR::Terrain::getProceduralManager
ProceduralManagerPtr getProceduralManager()
Definition: Terrain.cpp:597
Actor.h
RoR::App::GetScriptEngine
ScriptEngine * GetScriptEngine()
Definition: Application.cpp:278
RoR::GUIManager::LoadingWindow
GUI::LoadingWindow LoadingWindow
Definition: GUIManager.h:122
RoR::GfxScene::GetSceneManager
Ogre::SceneManager * GetSceneManager()
Definition: GfxScene.h:64
RoR::Terrain::getTerrainFileName
std::string getTerrainFileName()
Definition: Terrain.cpp:602
GUI_SurveyMap.h
RoR::Terrain::GetHeightAt
float GetHeightAt(float x, float z)
Definition: Terrain.cpp:535
RoR::Terrain::GetNormalAt
Ogre::Vector3 GetNormalAt(float x, float y, float z)
Definition: Terrain.cpp:540
RoR::SCRIPTUNITID_INVALID
static const ScriptUnitId_t SCRIPTUNITID_INVALID
Definition: ForwardDeclarations.h:41
RoR::SurveyMapEntityVec
std::vector< SurveyMapEntity > SurveyMapEntityVec
Definition: SurveyMapEntity.h:56
RoR::CameraManager::GetCamera
Ogre::Camera * GetCamera()
Definition: CameraManager.h:64
RoR::GUI::TopMenubar::ai_presets_bundled
rapidjson::Document ai_presets_bundled
Presets bundled with the terrain, see [AI Presets] section in .terrn2 file format.
Definition: GUI_TopMenubar.h:103
RoR::Terrain::addSurveyMapEntity
void addSurveyMapEntity(const std::string &type, const std::string &filename, const std::string &resource_group, const std::string &caption, const Ogre::Vector3 &pos, float angle, int id)
Definition: Terrain.cpp:612
RoR::Terrain::initLight
void initLight()
Definition: Terrain.cpp:309
RoR::GfxSkyMode::CAELUM
@ CAELUM
Caelum (best looking, slower)
RoR::ScriptEngine::unloadScript
void unloadScript(ScriptUnitId_t unique_id)
Unloads a script.
Definition: ScriptEngine.cpp:991
RoR::Terrain::initAiPresets
void initAiPresets()
Definition: Terrain.cpp:483
GUI_LoadingWindow.h
CacheSystem.h
A database of user-installed content alias 'mods' (vehicles, terrains...)
ScriptEngine.h
RoR::Terrain::HandleException
void HandleException(const char *summary)
Definition: Terrain.cpp:577
RoR::App::app_state
CVar * app_state
Definition: Application.cpp:79
RoR::Terrain::getSurveyMapEntities
SurveyMapEntityVec & getSurveyMapEntities()
Definition: Terrain.cpp:622
RoR::App::sim_terrain_name
CVar * sim_terrain_name
Definition: Application.cpp:97
RoR::ContentManager::LoadAndParseJson
bool LoadAndParseJson(std::string const &filename, std::string const &rg_name, rapidjson::Document &j_doc)
Definition: ContentManager.cpp:456
GfxScene.h
RoR::Terrain::initFog
void initFog()
Definition: Terrain.cpp:340
RoR::GfxVegetation::FULL
@ FULL
RoR::Terrain::LoadPredefinedActors
void LoadPredefinedActors()
Definition: Terrain.cpp:564
RoR::Terrain::dispose
void dispose()
Definition: Terrain.cpp:79
RoR::App::gfx_water_mode
CVar * gfx_water_mode
Definition: Application.cpp:223
RoR::AppState::SHUTDOWN
@ SHUTDOWN
RoR::GUI::SurveyMap::CreateTerrainTextures
void CreateTerrainTextures()
Definition: GUI_SurveyMap.cpp:440
RoR::App::gfx_sky_mode
CVar * gfx_sky_mode
Definition: Application.cpp:218
RoR::GUIManager::TopMenubar
GUI::TopMenubar TopMenubar
Definition: GUIManager.h:123
RoR::App::gfx_sight_range
CVar * gfx_sight_range
Definition: Application.cpp:235
ShadowManager.h
RoR::Terrain::initTerrainCollisions
void initTerrainCollisions()
Definition: Terrain.cpp:451
RoR::GfxSkyMode::SKYX
@ SKYX
SkyX (best looking, slower)
RoR::Terrain::initialize
bool initialize()
Definition: Terrain.cpp:146
_L
#define _L
Definition: ErrorUtils.cpp:34
RoR::Terrain::loadTerrainObjects
void loadTerrainObjects()
Definition: Terrain.cpp:443
RoR::Terrain::LoadTelepoints
void LoadTelepoints()
Definition: Terrain.cpp:558
RoR::Terrain::getCacheEntry
CacheEntryPtr getCacheEntry()
Definition: Terrain.cpp:627
RoR::EraseIf
void EraseIf(std::vector< T, A > &c, Predicate pred)
Definition: Utils.h:74
RoR::Terrain::initVegetation
void initVegetation()
Definition: Terrain.cpp:348
Terrain.h
Ogre
Definition: ExtinguishableFireAffector.cpp:35
DEFAULT_GRAVITY
static const float DEFAULT_GRAVITY
earth gravity
Definition: SimConstants.h:50
RoR::CVar::getInt
int getInt() const
Definition: CVar.h:97
RoR::App::sim_terrain_gui_name
CVar * sim_terrain_gui_name
Definition: Application.cpp:98
RoR::App::gfx_vegetation_mode
CVar * gfx_vegetation_mode
Definition: Application.cpp:222
RoR::Terrain::delSurveyMapEntities
void delSurveyMapEntities(int id)
Definition: Terrain.cpp:617
Collisions.h
RoR::Terrain::initWater
void initWater()
Definition: Terrain.cpp:393
RoR::TerrainGeometryManager
this class handles all interactions with the Ogre Terrain system
Definition: TerrainGeometryManager.h:38
RoR::SurveyMapEntity
Definition: SurveyMapEntity.h:35
RoR
Definition: AppContext.h:36
RoR::Terrain::initObjects
void initObjects()
Definition: Terrain.cpp:518
x
float x
Definition: (ValueTypes) quaternion.h:5
Water.h
RoR::App::GetGfxScene
GfxScene * GetGfxScene()
Definition: Application.cpp:275
RoR::CVar::setStr
void setStr(std::string const &str)
Definition: CVar.h:83
RoR::GfxVegetation::x20PERC
@ x20PERC
HydraxWater.h
RoR::SkyXManager
Definition: SkyXManager.h:32
RoR::GfxVegetation::x50PERC
@ x50PERC
RoR::GfxWaterMode::HYDRAX
@ HYDRAX
HydraX.
RoR::Terrain::HasPredefinedActors
bool HasPredefinedActors()
Definition: Terrain.cpp:570