RigsofRods
Soft-body Physics Simulation
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
TerrainObjectManager.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 "TerrainObjectManager.h"
23 
24 #include "Actor.h"
25 #include "Application.h"
26 #include "AutoPilot.h"
27 #include "CacheSystem.h"
28 #include "Collisions.h"
29 #include "Console.h"
30 #include "ErrorUtils.h"
31 #include "Language.h"
32 #include "GameContext.h"
33 #include "GfxScene.h"
34 #include "GUIManager.h"
35 #include "GUI_LoadingWindow.h"
36 #include "MeshObject.h"
37 #include "ODefFileFormat.h"
38 #include "PlatformUtils.h"
39 #include "ProceduralRoad.h"
40 #include "ScriptEngine.h"
41 #include "SoundScriptManager.h"
42 #include "TerrainGeometryManager.h"
43 #include "Terrain.h"
44 #include "Terrn2FileFormat.h"
45 #include "TObjFileFormat.h"
46 #include "Utils.h"
47 #include "WriteTextToTexture.h"
48 
49 #include <RTShaderSystem/OgreRTShaderSystem.h>
50 #include <Overlay/OgreFontManager.h>
51 
52 #ifdef USE_ANGELSCRIPT
54 #endif // USE_ANGELSCRIPT
55 
56 using namespace Ogre;
57 using namespace RoR;
58 #ifdef USE_PAGED
59 using namespace Forests;
60 #endif //USE_PAGED
61 
62 //workaround for pagedgeometry
63 inline float getTerrainHeight(Real x, Real z, void* unused = 0)
64 {
66 }
67 
68 TerrainObjectManager::TerrainObjectManager(Terrain* terrainManager) :
69  terrainManager(terrainManager)
70 {
71  m_terrn2_grouping_node = App::GetGfxScene()->GetSceneManager()->getRootSceneNode()->createChildSceneNode(fmt::format("Terrain: {}", terrainManager->GetDef()->name));
72 
73  m_procedural_manager = new ProceduralManager(m_terrn2_grouping_node->createChildSceneNode("Procedural Roads"));
74 }
75 
77 {
78  for (MeshObject* mo : m_mesh_objects)
79  {
80  if (mo)
81  delete mo;
82  }
83 #ifdef USE_PAGED
84  for (auto geom : m_paged_geometry)
85  {
86  delete geom->getPageLoader();
87  delete geom;
88  }
89 #endif //USE_PAGED
90 
91  App::GetGfxScene()->GetSceneManager()->destroyAllEntities();
92 
94 }
95 
96 void GenerateGridAndPutToScene(Ogre::Vector3 position)
97 {
98  Ogre::ColourValue background_color(Ogre::ColourValue::White);
99  Ogre::ColourValue grid_color(0.2f, 0.2f, 0.2f, 1.0f);
100 
101  Ogre::ManualObject* mo = new Ogre::ManualObject("ReferenceGrid");
102 
103  mo->begin("BaseWhiteNoLighting", Ogre::RenderOperation::OT_LINE_LIST);
104 
105  const float step = 1.0f;
106  const size_t count = 50;
107  unsigned int halfCount = count / 2;
108  const float half = (step * count) / 2;
109  const float y = 0;
110  Ogre::ColourValue c;
111  for (size_t i=0; i < count+1; i++)
112  {
113  if (i == halfCount)
114  c = Ogre::ColourValue(1.f, 0.f, 0.f, 1.f);
115  else
116  c = grid_color;
117 
118  mo->position(-half, y, -half+(step*i));
119  mo->colour(background_color);
120  mo->position(0, y, -half+(step*i));
121  mo->colour(c);
122  mo->position(0, y, -half+(step*i));
123  mo->colour(c);
124  mo->position(half, y, -half+(step*i));
125  mo->colour(background_color);
126 
127  if (i == halfCount)
128  c = Ogre::ColourValue(0,0,1,1.0f);
129  else
130  c = grid_color;
131 
132  mo->position(-half+(step*i), y, -half);
133  mo->colour(background_color);
134  mo->position(-half+(step*i), y, 0);
135  mo->colour(c);
136  mo->position(-half+(step*i), y, 0);
137  mo->colour(c);
138  mo->position(-half+(step*i), y, half);
139  mo->colour(background_color);
140  }
141 
142  mo->end();
143  mo->setCastShadows(false);
144  Ogre::SceneNode *n = App::GetGameContext()->GetTerrain()->getObjectManager()->getGroupingSceneNode()->createChildSceneNode();
145  n->setPosition(position);
146  n->attachObject(mo);
147  n->setVisible(true);
148 }
149 
150 void TerrainObjectManager::LoadTObjFile(Ogre::String tobj_name)
151 {
152  ROR_ASSERT(this->terrainManager);
155 
156  TObjDocumentPtr tobj;
157  try
158  {
159  DataStreamPtr stream_ptr = ResourceGroupManager::getSingleton().openResource(
160  tobj_name, this->terrainManager->getCacheEntry()->resource_group);
161  TObjParser parser;
162  parser.Prepare();
163  parser.ProcessOgreStream(stream_ptr.get());
164  tobj = parser.Finalize();
165  m_tobj_cache.push_back(tobj);
166  }
167  catch (...)
168  {
169  HandleGenericException(fmt::format("Loading TObj file '{}'", tobj_name), HANDLEGENERICEXCEPTION_CONSOLE);
170  return;
171  }
172 
174  m_tobj_grouping_node = m_terrn2_grouping_node->createChildSceneNode(tobj_name);
175 
176  int mapsizex = terrainManager->getGeometryManager()->getMaxTerrainSize().x;
177  int mapsizez = terrainManager->getGeometryManager()->getMaxTerrainSize().z;
178 
179  // Section 'grid'
180  if (tobj->grid_enabled)
181  {
182  GenerateGridAndPutToScene(tobj->grid_position);
183  }
184 
185  // Section 'trees'
186  if (App::gfx_vegetation_mode->getEnum<GfxVegetation>() != GfxVegetation::NONE)
187  {
188  for (TObjTree tree : tobj->trees)
189  {
190  try
191  {
192  this->ProcessTree(
193  tree.yaw_from, tree.yaw_to,
194  tree.scale_from, tree.scale_to,
195  tree.color_map, tree.density_map, tree.tree_mesh, tree.collision_mesh,
196  tree.grid_spacing, tree.high_density,
197  tree.min_distance, tree.max_distance, mapsizex, mapsizez);
198  }
199  catch (...)
200  {
201  RoR::HandleGenericException(fmt::format("Error processing 'trees' line (mesh: {}) from TOBJ file {}", tree.tree_mesh, tobj_name));
202  }
203  }
204  }
205 
206  // Section 'grass' / 'grass2'
207  if (App::gfx_vegetation_mode->getEnum<GfxVegetation>() != GfxVegetation::NONE)
208  {
209  for (TObjGrass grass : tobj->grass)
210  {
211  try
212  {
213  this->ProcessGrass(
214  grass.sway_speed, grass.sway_length, grass.sway_distrib, grass.density,
215  grass.min_x, grass.min_y, grass.min_h,
216  grass.max_x, grass.max_y, grass.max_h,
218  grass.grow_techniq, grass.technique, grass.range, mapsizex, mapsizez);
219  }
220  catch (...)
221  {
222  RoR::HandleGenericException(fmt::format("Error processing 'grass' line (material: {}) from TOBJ file {}", grass.material_name, tobj_name));
223  }
224  }
225  }
226 
227  // Procedural roads
228  for (ProceduralObjectPtr& po : tobj->proc_objects)
229  {
230  try
231  {
233  }
234  catch (...)
235  {
236  RoR::HandleGenericException(fmt::format("Error processing procedural road {} from TOBJ file {}", po->name, tobj_name));
237  }
238  }
239 
240  // Vehicles
241  for (TObjVehicle const& veh : tobj->vehicles)
242  {
243  int tobj_cache_id = (int)m_tobj_cache.size() - 1;
244  this->ProcessPredefinedActor(tobj_cache_id, veh.name, veh.position, veh.tobj_rotation, veh.type);
245  }
246 
247  // Entries
248  for (TObjEntry entry : tobj->objects)
249  {
250  try
251  {
252  m_tobj_cache_active_id = (int)m_tobj_cache.size() - 1;
253  size_t num_editor_objects = m_editor_objects.size();
254  this->LoadTerrainObject(entry.odef_name, entry.position, entry.rotation, entry.instance_name, entry.type, entry.rendering_distance);
256  if (m_editor_objects.size() > num_editor_objects)
257  {
258  m_editor_objects.back()->tobj_comments = entry.comments;
259  }
260  }
261  catch (...)
262  {
263  RoR::HandleGenericException(fmt::format("Error processing object line (ODEF: {}) from TOBJ file {}", entry.odef_name, tobj_name));
264  }
265  }
266 
267  if (App::diag_terrn_log_roads->getBool())
268  {
270  }
271 
272  m_tobj_grouping_node = nullptr;
273 }
274 
276  float yawfrom, float yawto,
277  float scalefrom, float scaleto,
278  char* ColorMap, char* DensityMap, char* treemesh, char* treeCollmesh,
279  float gridspacing, float highdens,
280  int minDist, int maxDist, int mapsizex, int mapsizez)
281 {
282 #ifdef USE_PAGED
283  if (strnlen(ColorMap, 3) == 0)
284  {
285  LOG("tree ColorMap map zero!");
286  return;
287  }
288  if (strnlen(DensityMap, 3) == 0)
289  {
290  LOG("tree DensityMap zero!");
291  return;
292  }
293  Forests::DensityMap *densityMap = Forests::DensityMap::load(DensityMap, Forests::CHANNEL_COLOR);
294  if (!densityMap)
295  {
296  LOG("could not load densityMap: "+String(DensityMap));
297  return;
298  }
299  densityMap->setFilter(Forests::MAPFILTER_BILINEAR);
300  //densityMap->setMapBounds(TRect(0, 0, mapsizex, mapsizez));
301 
302  PagedGeometry* geom = new PagedGeometry();
303  geom->setTempDir(App::sys_cache_dir->getStr() + PATH_SLASH);
304  geom->setCamera(App::GetCameraManager()->GetCamera());
305  geom->setPageSize(50);
306  geom->setInfinite();
307  Ogre::TRect<Ogre::Real> bounds = TBounds(0, 0, mapsizex, mapsizez);
308  geom->setBounds(bounds);
309 
310  //Set up LODs
311  //trees->addDetailLevel<EntityPage>(50);
312  float min = minDist * terrainManager->getPagedDetailFactor();
313  if (min < 10)
314  min = 10;
315  geom->addDetailLevel<BatchPage>(min, min / 2);
316  float max = maxDist * terrainManager->getPagedDetailFactor();
317  if (max < 10)
318  max = 10;
319 
320  // Check if farther details level is greater than closer
321  if (max / 10 > min / 2)
322  {
323  geom->addDetailLevel<ImpostorPage>(max, max / 10);
324  }
325 
326  TreeLoader2D *treeLoader = new TreeLoader2D(geom, TBounds(0, 0, mapsizex, mapsizez));
327  treeLoader->setMinimumScale(scalefrom);
328  treeLoader->setMaximumScale(scaleto);
329  geom->setPageLoader(treeLoader);
330  treeLoader->setHeightFunction(&getTerrainHeight);
331  if (String(ColorMap) != "none")
332  {
333  treeLoader->setColorMap(ColorMap);
334  }
335 
336  Entity* curTree = App::GetGfxScene()->GetSceneManager()->createEntity(String("paged_") + treemesh + TOSTRING(m_paged_geometry.size()), treemesh);
337 
338  if (gridspacing > 0)
339  {
340  // grid style
341  for (float x=0; x < mapsizex; x += gridspacing)
342  {
343  for (float z=0; z < mapsizez; z += gridspacing)
344  {
345  float density = densityMap->_getDensityAt_Unfiltered(x, z, bounds);
346  if (density < 0.8f) continue;
347  float nx = x + gridspacing * 0.5f;
348  float nz = z + gridspacing * 0.5f;
349  float yaw = Math::RangeRandom(yawfrom, yawto);
350  float scale = Math::RangeRandom(scalefrom, scaleto);
351  Vector3 pos = Vector3(nx, 0, nz);
352  treeLoader->addTree(curTree, pos, Degree(yaw), (Ogre::Real)scale);
353  if (strlen(treeCollmesh))
354  {
355  pos.y = terrainManager->getHeightAt(pos.x, pos.z);
356  scale *= 0.1f;
357  terrainManager->GetCollisions()->addCollisionMesh(curTree->getName(), String(treeCollmesh), pos, Quaternion(Degree(yaw), Vector3::UNIT_Y), Vector3(scale, scale, scale));
358  }
359  }
360  }
361  }
362  else
363  {
364  float gridsize = 10;
365  if (gridspacing < 0 && gridspacing != 0)
366  {
367  gridsize = -gridspacing;
368  }
369  float hd = highdens;
370  // normal style, random
371  for (float x=0; x < mapsizex; x += gridsize)
372  {
373  for (float z=0; z < mapsizez; z += gridsize)
374  {
375  if (highdens < 0) hd = Math::RangeRandom(0, -highdens);
376  float density = densityMap->_getDensityAt_Unfiltered(x, z, bounds);
377  int numTreesToPlace = (int)((float)(hd) * density * terrainManager->getPagedDetailFactor());
378  float nx=0, nz=0;
379  while(numTreesToPlace-->0)
380  {
381  nx = Math::RangeRandom(x, x + gridsize);
382  nz = Math::RangeRandom(z, z + gridsize);
383  float yaw = Math::RangeRandom(yawfrom, yawto);
384  float scale = Math::RangeRandom(scalefrom, scaleto);
385  Vector3 pos = Vector3(nx, 0, nz);
386  treeLoader->addTree(curTree, pos, Degree(yaw), (Ogre::Real)scale);
387  if (strlen(treeCollmesh))
388  {
389  pos.y = terrainManager->getHeightAt(pos.x, pos.z);
390  terrainManager->GetCollisions()->addCollisionMesh(treemesh, String(treeCollmesh),pos, Quaternion(Degree(yaw), Vector3::UNIT_Y), Vector3(scale, scale, scale));
391  }
392  }
393  }
394  }
395  }
396  m_paged_geometry.push_back(geom);
397 #endif //USE_PAGED
398 }
399 
401  float SwaySpeed, float SwayLength, float SwayDistribution, float Density,
402  float minx, float miny, float minH, float maxx, float maxy, float maxH,
403  char* grassmat, char* colorMapFilename, char* densityMapFilename,
404  int growtechnique, int techn, int range,
405  int mapsizex, int mapsizez)
406 {
407 #ifdef USE_PAGED
408  //Initialize the PagedGeometry engine
409  try
410  {
411  PagedGeometry *grass = new PagedGeometry(App::GetCameraManager()->GetCamera(), 30);
412  //Set up LODs
413 
414  grass->addDetailLevel<GrassPage>(range * terrainManager->getPagedDetailFactor()); // original value: 80
415 
416  //Set up a GrassLoader for easy use
417  GrassLoader *grassLoader = new GrassLoader(grass);
418  grass->setPageLoader(grassLoader);
419  grassLoader->setHeightFunction(&getTerrainHeight);
420 
421  // render grass at first
422  grassLoader->setRenderQueueGroup(RENDER_QUEUE_MAIN-1);
423 
424  GrassLayer* grassLayer = grassLoader->addLayer(grassmat);
425  grassLayer->setHeightRange(minH, maxH);
426  grassLayer->setLightingEnabled(true);
427 
428  grassLayer->setAnimationEnabled((SwaySpeed>0));
429  grassLayer->setSwaySpeed(SwaySpeed);
430  grassLayer->setSwayLength(SwayLength);
431  grassLayer->setSwayDistribution(SwayDistribution);
432 
433  grassLayer->setDensity(Density * terrainManager->getPagedDetailFactor());
434  if (techn>10)
435  grassLayer->setRenderTechnique(static_cast<GrassTechnique>(techn-10), true);
436  else
437  grassLayer->setRenderTechnique(static_cast<GrassTechnique>(techn), false);
438 
439  grassLayer->setMapBounds(TBounds(0, 0, mapsizex, mapsizez));
440 
441  if (strcmp(colorMapFilename,"none") != 0)
442  {
443  grassLayer->setColorMap(colorMapFilename);
444  grassLayer->setColorMapFilter(MAPFILTER_BILINEAR);
445  }
446 
447  if (strcmp(densityMapFilename,"none") != 0)
448  {
449  grassLayer->setDensityMap(densityMapFilename);
450  grassLayer->setDensityMapFilter(MAPFILTER_BILINEAR);
451  }
452 
453  grassLayer->setMinimumSize(minx, miny);
454  grassLayer->setMaximumSize(maxx, maxy);
455 
456  // growtechnique
457  if (growtechnique == 0)
458  grassLayer->setFadeTechnique(FADETECH_GROW);
459  else if (growtechnique == 1)
460  grassLayer->setFadeTechnique(FADETECH_ALPHAGROW);
461  else if (growtechnique == 2)
462  grassLayer->setFadeTechnique(FADETECH_ALPHA);
463 
464  m_paged_geometry.push_back(grass);
465  }
466  catch(...)
467  {
468  LOG("error loading grass!");
469  }
470 #endif //USE_PAGED
471 }
472 
473 void TerrainObjectManager::ProcessPredefinedActor(int tobj_cache_id, const std::string& name, const Ogre::Vector3 position, const Ogre::Vector3 rotation, const TObjSpecialObject type)
474 {
475  // Transform TOBJ actor records to EditorObject-s (to be spawned later, if conditions are met).
476  // NOTE: The filename may be in "Bundle-qualified" format, i.e. "mybundle.zip:myactor.truck"
477  // -----------------------------------------------------------------------------------------
478 
480  dst->position = position;
481  dst->rotation = rotation;
482  dst->special_object_type = type;
483  dst->name = name;
484  dst->tobj_cache_id = tobj_cache_id;
485  m_editor_objects.push_back(dst);
487 }
488 
489 void TerrainObjectManager::moveObjectVisuals(const String& instancename, const Ogre::Vector3& pos)
490 {
491  // Obsolete function kept for backwards-compatibility; does the same as `TerrainEditorObject::setPosition()`
492  // -------------------------------------------------------------------------------------------------------
493 
496  {
497  LOG(fmt::format("[RoR] `moveObjectVisuals()`: instance name '{}' not found!", instancename));
498  return;
499  }
500 
501  m_editor_objects[id]->setPosition(pos);
502 }
503 
504 void TerrainObjectManager::destroyObject(const String& instancename)
505 {
507  if (id == -1)
508  {
509  LOG(fmt::format("[RoR] `destroyObject()`: instance name '{}' not found!", instancename));
510  return;
511  }
512 
514 
515  if (object->getSpecialObjectType() != TObjSpecialObject::NONE)
516  {
517  // Preloaded actor: despawn it.
518  ROR_ASSERT(!object->static_object_node);
519  ROR_ASSERT(!object->static_collision_tris.size());
520  ROR_ASSERT(!object->static_collision_boxes.size());
521  ActorPtr actor = App::GetGameContext()->GetActorManager()->GetActorById(object->actor_instance_id);
522  if (actor)
523  {
525  }
526  }
527  else
528  {
529  // Static object: Destroy the scene node and everything attached to it.
530  ROR_ASSERT(object->static_object_node);
531  for (Ogre::MovableObject* mova : object->static_object_node->getAttachedObjects())
532  {
533  App::GetGfxScene()->GetSceneManager()->destroyMovableObject(mova);
534  }
535  App::GetGfxScene()->GetSceneManager()->destroySceneNode(object->static_object_node);
536 
537  // Undo static collisions
538  for (int tri : object->static_collision_tris)
539  {
541  }
542  for (int box : object->static_collision_boxes)
543  {
545  }
546  }
547 
548  // Release the object from editor, if active.
549  if (id == App::GetGameContext()->GetTerrain()->GetTerrainEditor()->GetSelectedObjectID())
550  {
552  }
553 
554  // Forget the object ever existed.
555  m_editor_objects.erase(m_editor_objects.begin() + id);
556 }
557 
558 ODefDocument* TerrainObjectManager::FetchODef(std::string const & odef_name)
559 {
560  // Consult cache first
561  auto search_res = m_odef_cache.find(odef_name);
562  if (search_res != m_odef_cache.end())
563  {
564  return search_res->second.get();
565  }
566 
567  // Search for the file
568  const std::string filename = odef_name + ".odef";
569  std::string group_name;
570  try
571  {
572  group_name = Ogre::ResourceGroupManager::getSingleton().findGroupContainingResource(filename);
573  }
574  catch (...) // This means "not found"
575  {
576  LOG(fmt::format("[ODEF] Could not find {} in any resource group", filename));
577  return nullptr;
578  }
579 
580  try
581  {
582  // Load and parse the file
583  Ogre::DataStreamPtr ds = ResourceGroupManager::getSingleton().openResource(filename, group_name);
584  ODefParser parser;
585  parser.Prepare();
586  parser.ProcessOgreStream(ds.get());
587  std::shared_ptr<ODefDocument> odef = parser.Finalize();
588 
589  // Add to cache and return
590  m_odef_cache.insert(std::make_pair(odef_name, odef));
591  return odef.get();
592  }
593  catch (...)
594  {
595  LOG(fmt::format("[ODEF] An exception occurred when loading or parsing {}", filename));
596  return nullptr;
597  }
598 }
599 
600 bool TerrainObjectManager::LoadTerrainObject(const Ogre::String& name, const Ogre::Vector3& pos, const Ogre::Vector3& rot, const Ogre::String& instancename, const Ogre::String& type, float rendering_distance /* = 0 */, bool enable_collisions /* = true */, int scripthandler /* = -1 */, bool uniquifyMaterial /* = false */)
601 {
602  if (type == "grid")
603  {
604  // some fast grid object hacks :)
605  for (int x = 0; x < 500; x += 50)
606  {
607  for (int z = 0; z < 500; z += 50)
608  {
609  const String notype = "";
610  LoadTerrainObject(name, pos + Vector3(x, 0.0f, z), rot, name, notype, /*rendering_distance:*/0, enable_collisions, scripthandler, uniquifyMaterial);
611  }
612  }
613  return true;
614  }
615 
616  const std::string odefname = name + ".odef"; // for logging
617  ODefDocument* odef = this->FetchODef(name);
618  if (odef == nullptr)
619  {
620  // Only log to console if requested from Console UI or script (debug message to RoR.log is written anyway).
621  if (App::app_state->getEnum<AppState>() == AppState::SIMULATION)
622  {
624  fmt::format(_L("Could not load file '{}'"), odefname));
625  }
626  return false;
627  }
628 
629  SceneNode* tenode = this->getGroupingSceneNode()->createChildSceneNode();
630 
631  MeshObject* mo = nullptr;
632  if (odef->header.mesh_name != "none")
633  {
634  Str<100> ebuf; ebuf << m_entity_counter++ << "-" << odef->header.mesh_name;
635  mo = new MeshObject(odef->header.mesh_name, terrainManager->getTerrainFileResourceGroup(), ebuf.ToCStr(), tenode);
636  if (mo->getEntity())
637  {
638  mo->getEntity()->setCastShadows(odef->header.cast_shadows);
639  mo->getEntity()->setRenderingDistance(rendering_distance);
640  m_mesh_objects.push_back(mo);
641  }
642  else
643  {
644  delete mo;
645  // Only log to console if requested from Console UI or script (debug message to RoR.log is written anyway).
646  if (App::app_state->getEnum<AppState>() == AppState::SIMULATION)
647  {
649  fmt::format(_L("Could not load mesh '{}' (used by object '{}')"), odef->header.mesh_name, odefname));
650  }
651  }
652  }
653 
654  tenode->setScale(odef->header.scale);
655  tenode->setPosition(pos);
656  Quaternion rotation = Quaternion(Degree(rot.x), Vector3::UNIT_X) * Quaternion(Degree(rot.y), Vector3::UNIT_Y) * Quaternion(Degree(rot.z), Vector3::UNIT_Z);
657  tenode->rotate(rotation);
658  tenode->pitch(Degree(-90));
659  tenode->setVisible(true);
660 
662  object->name = name;
663  object->instance_name = instancename;
664  object->type = type;
665  object->position = pos;
666  object->rotation = rot;
667  object->initial_position = pos;
668  object->initial_rotation = rot;
669  object->static_object_node = tenode;
670  object->enable_collisions = enable_collisions;
671  object->script_handler = scripthandler;
672  object->tobj_cache_id = m_tobj_cache_active_id;
673  m_editor_objects.push_back(object);
674 
675  if (mo && uniquifyMaterial && !instancename.empty())
676  {
677  for (unsigned int i = 0; i < mo->getEntity()->getNumSubEntities(); i++)
678  {
679  SubEntity* se = mo->getEntity()->getSubEntity(i);
680  String matname = se->getMaterialName();
681  String newmatname = matname + "/" + instancename;
682  se->getMaterial()->clone(newmatname);
683  se->setMaterialName(newmatname);
684  }
685  }
686 
687  for (LocalizerType type : odef->localizers)
688  {
689  Localizer loc;
690  loc.position = Vector3(pos.x, pos.y, pos.z);
691  loc.rotation = rotation;
692  loc.type = type;
693  m_localizers.push_back(loc);
694  }
695 
696  if (odef->mode_standard)
697  {
698  tenode->pitch(Degree(90));
699  }
700 
701 #ifdef USE_OPENAL
702  if (!App::GetSoundScriptManager()->isDisabled())
703  {
704  for (std::string& snd_name : odef->sounds)
705  {
707  sound->setPosition(tenode->getPosition());
708  sound->start();
709  }
710  }
711 #endif //USE_OPENAL
712 
713  for (std::string& gmodel_file: odef->groundmodel_files)
714  {
716  }
717 
718  bool race_event = !object->instance_name.compare(0, 10, "checkpoint") ||
719  !object->instance_name.compare(0, 4, "race");
720 
721  if (race_event)
722  {
723  String type = "checkpoint";
724  auto res = StringUtil::split(object->instance_name, "|");
725  if ((res.size() == 4 && res[2] == "0") || !object->instance_name.compare(0, 4, "race"))
726  {
727  type = "racestart";
728  }
729  int race_id = res.size() > 1 ? StringConverter::parseInt(res[1], -1) : -1;
730  m_map_entities.push_back(SurveyMapEntity(type, /*caption:*/type, fmt::format("icon_{}.dds", type), /*resource_group:*/"", object->position, Ogre::Radian(0), race_id));
731  }
732  else if (object->type != "" && object->type != "-")
733  {
734  String caption = "";
735  if (object->type == "station" || object->type == "hotel" || object->type == "village" ||
736  object->type == "observatory" || object->type == "farm" || object->type == "ship" || object->type == "sign")
737  {
738  caption = object->instance_name + " " + object->type;
739  }
740  m_map_entities.push_back(SurveyMapEntity(object->type, caption, fmt::format("icon_{}.dds", object->type), /*resource_group:*/"", object->position, Ogre::Radian(0), -1));
741  }
742 
743  this->ProcessODefCollisionBoxes(object, odef, object, race_event);
744 
745  for (ODefCollisionMesh& cmesh : odef->collision_meshes)
746  {
747  if (cmesh.mesh_name == "")
748  {
749  LOG("[ODEF] Skipping collision mesh with empty name. Object: " + odefname);
750  continue;
751  }
752 
755  odefname,
756  cmesh.mesh_name, pos, tenode->getOrientation(),
757  cmesh.scale, gm, &(object->static_collision_tris));
758  }
759 
760  for (ODefParticleSys& psys : odef->particle_systems)
761  {
762 
763  // hacky: prevent duplicates
764  String paname = String(psys.instance_name);
765  while (App::GetGfxScene()->GetSceneManager()->hasParticleSystem(paname))
766  paname += "_";
767 
768  // create particle system
769  ParticleSystem* pParticleSys = App::GetGfxScene()->GetSceneManager()->createParticleSystem(paname, String(psys.template_name));
770  pParticleSys->setCastShadows(false);
771  pParticleSys->setVisibilityFlags(DEPTHMAP_DISABLED); // disable particles in depthmap
772 
773  // Some affectors may need its instance name (e.g. for script feedback purposes)
774 #ifdef USE_ANGELSCRIPT
775  unsigned short affCount = pParticleSys->getNumAffectors();
776  ParticleAffector* pAff;
777  for (unsigned short i = 0; i < affCount; ++i)
778  {
779  pAff = pParticleSys->getAffector(i);
780  if (pAff->getType() == "ExtinguishableFire")
781  {
782  ((ExtinguishableFireAffector*)pAff)->setInstanceName(object->instance_name);
783  }
784  }
785 #endif // USE_ANGELSCRIPT
786 
787  SceneNode* sn = tenode->createChildSceneNode();
788  sn->attachObject(pParticleSys);
789  sn->pitch(Degree(90));
790 
792  peo.node = sn;
793  peo.psys = pParticleSys;
794  m_particle_effect_objects.push_back(peo);
795  }
796 
797  if (!odef->mat_name.empty())
798  {
799  if (mo->getEntity())
800  {
801  mo->getEntity()->setMaterialName(odef->mat_name);
802  }
803  }
804 
805  if (odef->mat_name_generate != "")
806  {
807  Ogre::MaterialPtr mat = Ogre::MaterialManager::getSingleton().create(odef->mat_name_generate,"generatedMaterialShaders");
808  Ogre::RTShader::ShaderGenerator::getSingleton().createShaderBasedTechnique(*mat, Ogre::MaterialManager::DEFAULT_SCHEME_NAME, Ogre::RTShader::ShaderGenerator::DEFAULT_SCHEME_NAME);
809  Ogre::RTShader::ShaderGenerator::getSingleton().invalidateMaterial(RTShader::ShaderGenerator::DEFAULT_SCHEME_NAME, String(odef->mat_name_generate));
810  }
811 
812  for (ODefAnimation& anim : odef->animations)
813  {
814  if (tenode && mo->getEntity())
815  {
816  AnimationStateSet *s = mo->getEntity()->getAllAnimationStates();
817  String anim_name_str(anim.name);
818  if (!s->hasAnimationState(anim_name_str))
819  {
820  LOG("[ODEF] animation '" + anim_name_str + "' for mesh: '" + odef->header.mesh_name + "' in odef file '" + name + ".odef' not found!");
821  //continue;
822  }
823  AnimatedObject ao;
824  ao.node = tenode;
825  ao.ent = mo->getEntity();
826  ao.speedfactor = anim.speed_min;
827  if (anim.speed_min != anim.speed_max)
828  ao.speedfactor = Math::RangeRandom(anim.speed_min, anim.speed_max);
829  ao.anim = 0;
830  try
831  {
832  ao.anim = mo->getEntity()->getAnimationState(anim_name_str);
833  } catch (...)
834  {
835  ao.anim = 0;
836  }
837  if (!ao.anim)
838  {
839  LOG("[ODEF] animation '" + anim_name_str + "' for mesh: '" + odef->header.mesh_name + "' in odef file '" + name + ".odef' not found!");
840  continue;
841  }
842  ao.anim->setEnabled(true);
843  m_animated_objects.push_back(ao);
844  }
845  }
846 
847  for (ODefTexPrint& tex_print : odef->texture_prints)
848  {
849  if (!mo->getEntity())
850  continue;
851  String matName = mo->getEntity()->getSubEntity(0)->getMaterialName();
852  MaterialPtr m = MaterialManager::getSingleton().getByName(matName);
853  if (m.get() == 0)
854  {
855  LOG("[ODEF] problem with drawTextOnMeshTexture command: mesh material not found: "+odefname+" : "+matName);
856  continue;
857  }
858  String texName = m->getTechnique(0)->getPass(0)->getTextureUnitState(0)->getTextureName();
859  Texture* background = (Texture *)TextureManager::getSingleton().getByName(texName).get();
860  if (!background)
861  {
862  LOG("[ODEF] problem with drawTextOnMeshTexture command: mesh texture not found: "+odefname+" : "+texName);
863  continue;
864  }
865 
866  static int textureNumber = 0;
867  textureNumber++;
868  char tmpTextName[256] = "", tmpMatName[256] = "";
869  sprintf(tmpTextName, "TextOnTexture_%d_Texture", textureNumber);
870  sprintf(tmpMatName, "TextOnTexture_%d_Material", textureNumber); // Make sure the texture is not WRITE_ONLY, we need to read the buffer to do the blending with the font (get the alpha for example)
871  TexturePtr texture = TextureManager::getSingleton().createManual(tmpTextName, ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, TEX_TYPE_2D, (Ogre::uint)background->getWidth(), (Ogre::uint)background->getHeight(), MIP_UNLIMITED, PF_X8R8G8B8, Ogre::TU_STATIC | Ogre::TU_AUTOMIPMAP);
872  if (texture.get() == 0)
873  {
874  LOG("[ODEF] problem with drawTextOnMeshTexture command: could not create texture: "+odefname+" : "+tmpTextName);
875  continue;
876  }
877 
878  Str<200> text_buf; text_buf << tex_print.text;
879 
880  // check if we got a template argument
881  if (!strncmp(text_buf.GetBuffer(), "{{argument1}}", 13))
882  {
883  text_buf.Clear();
884  text_buf << instancename;
885  }
886 
887  // replace '_' with ' '
888  char *text_pointer = text_buf.GetBuffer();
889  while (*text_pointer!=0) {if (*text_pointer=='_') *text_pointer=' ';text_pointer++;};
890 
891  String font_name_str(tex_print.font_name);
892  Ogre::Font* font = (Ogre::Font *)FontManager::getSingleton().getByName(font_name_str).get();
893  if (!font)
894  {
895  LOG("[ODEF] problem with drawTextOnMeshTexture command: font not found: "+odefname+" : "+font_name_str);
896  continue;
897  }
898 
899  //Draw the background to the new texture
900  texture->getBuffer()->blit(background->getBuffer());
901 
902  float x = background->getWidth() * tex_print.x;
903  float y = background->getHeight() * tex_print.y;
904  float w = background->getWidth() * tex_print.w;
905  float h = background->getHeight() * tex_print.h;
906 
907  ColourValue color(tex_print.r, tex_print.g, tex_print.b, tex_print.a);
908  Ogre::Box box = Ogre::Box((size_t)x, (size_t)y, (size_t)(x+w), (size_t)(y+h));
909  WriteToTexture(text_buf.ToCStr(), texture, box, font, color, tex_print.font_size, tex_print.font_dpi, tex_print.option);
910 
911  // we can save it to disc for debug purposes:
912  //SaveImage(texture, "test.png");
913 
914  m->clone(tmpMatName);
915  MaterialPtr mNew = MaterialManager::getSingleton().getByName(tmpMatName);
916  mNew->getTechnique(0)->getPass(0)->getTextureUnitState(0)->setTextureName(tmpTextName);
917 
918  mo->getEntity()->setMaterialName(String(tmpMatName));
919  }
920 
921  for (ODefSpotlight& spotl: odef->spotlights)
922  {
923  Light* spotLight = App::GetGfxScene()->GetSceneManager()->createLight();
924 
925  spotLight->setType(Light::LT_SPOTLIGHT);
926  spotLight->setPosition(spotl.pos);
927  spotLight->setDirection(spotl.dir);
928  spotLight->setAttenuation(spotl.range, 1.0, 0.3, 0.0);
929  spotLight->setDiffuseColour(spotl.color);
930  spotLight->setSpecularColour(spotl.color);
931  spotLight->setSpotlightRange(Degree(spotl.angle_inner), Degree(spotl.angle_outer));
932 
933  BillboardSet* lflare = App::GetGfxScene()->GetSceneManager()->createBillboardSet(1);
934  lflare->createBillboard(spotl.pos, spotl.color);
935  lflare->setMaterialName("tracks/flare");
936  lflare->setVisibilityFlags(DEPTHMAP_DISABLED);
937 
938  float fsize = Math::Clamp(spotl.range / 10, 0.2f, 2.0f);
939  lflare->setDefaultDimensions(fsize, fsize);
940 
941  SceneNode *sn = tenode->createChildSceneNode();
942  sn->attachObject(spotLight);
943  sn->attachObject(lflare);
944  }
945 
946  for (ODefPointLight& plight : odef->point_lights)
947  {
948  Light* pointlight = App::GetGfxScene()->GetSceneManager()->createLight();
949 
950  pointlight->setType(Light::LT_POINT);
951  pointlight->setPosition(plight.pos);
952  pointlight->setDirection(plight.dir);
953  pointlight->setAttenuation(plight.range, 1.0, 0.3, 0.0);
954  pointlight->setDiffuseColour(plight.color);
955  pointlight->setSpecularColour(plight.color);
956 
957  BillboardSet* lflare = App::GetGfxScene()->GetSceneManager()->createBillboardSet(1);
958  lflare->createBillboard(plight.pos, plight.color);
959  lflare->setMaterialName("tracks/flare");
960  lflare->setVisibilityFlags(DEPTHMAP_DISABLED);
961 
962  float fsize = Math::Clamp(plight.range / 10, 0.2f, 2.0f);
963  lflare->setDefaultDimensions(fsize, fsize);
964 
965  SceneNode *sn = tenode->createChildSceneNode();
966  sn->attachObject(pointlight);
967  sn->attachObject(lflare);
968  }
969 
970  return true;
971 }
972 
973 bool TerrainObjectManager::LoadTerrainScript(const Ogre::String& filename)
974 {
976 
977  m_angelscript_grouping_node = m_terrn2_grouping_node->createChildSceneNode(filename);
978  ScriptUnitID_t result = App::GetScriptEngine()->loadScript(filename);
979  m_angelscript_grouping_node = nullptr;
980 
981  return result != SCRIPTUNITID_INVALID;
982 }
983 
985 {
986  if (m_animated_objects.size() == 0)
987  return;
988 
989  std::vector<AnimatedObject>::iterator it;
990 
991  for (it = m_animated_objects.begin(); it != m_animated_objects.end(); it++)
992  {
993  if (it->anim && it->speedfactor != 0)
994  {
995  Real time = dt * it->speedfactor;
996  it->anim->addTime(time);
997  }
998  }
999 }
1000 
1002 {
1004  {
1005  if (peo.psys)
1006  {
1008  }
1009  }
1010 }
1011 
1013 {
1014  for (Terrn2Telepoint& telepoint: terrainManager->GetDef()->telepoints)
1015  {
1016  m_map_entities.push_back(SurveyMapEntity("telepoint", telepoint.name, "icon_telepoint.dds", /*resource_group:*/"", telepoint.position, Ogre::Radian(0), -1));
1017  }
1018 }
1019 
1021 {
1022  // We need the 'rot_yxz' flag - look up the TOBJ document in cache
1023  if (object->tobj_cache_id == -1 || object->tobj_cache_id >= (int)m_tobj_cache.size())
1024  {
1026  fmt::format("Assuming no 'rot_yxz' when spawning preselected actor '{}' - TOBJ document not found", object->getName()));
1027  return false;
1028  }
1029  else
1030  {
1031  return m_tobj_cache[object->tobj_cache_id]->rot_yxz;
1032  }
1033 }
1034 
1035 
1037 {
1038  // For terrain editor to work, all preloaded actors must be spawned.
1039  // Most will spawn with terrain, however, some may be excluded for reasons.
1040  // -----------------------------------------------------------------------
1041 
1042  const bool rot_yxz = GetEditorObjectFlagRotYXZ(object);
1043 
1044  // Check if already spawned.
1045  if (object->actor_instance_id == ACTORINSTANCEID_INVALID)
1046  {
1047  // Not spawned yet - assign custom ID so that Terrain Editor can reset and move the actor.
1048  object->actor_instance_id = App::GetGameContext()->GetActorManager()->GetActorNextInstanceId();
1049  }
1050  else
1051  {
1052  // Spawned before; check if still existing and respawn if not.
1054  object->actor_instance_id);
1055  if (actor != ActorManager::ACTORPTR_NULL)
1056  {
1057  return; // We're done.
1058  }
1059  }
1060 
1062  rq->asr_instance_id = object->actor_instance_id;
1063  rq->asr_position = object->position;
1064  rq->asr_filename = object->name;
1065  rq->asr_rotation = TObjParser::CalcRotation(object->rotation, rot_yxz);
1067  rq->asr_free_position = (object->special_object_type == TObjSpecialObject::TRUCK2);
1068  rq->asr_terrn_machine = (object->special_object_type == TObjSpecialObject::MACHINE);
1070 }
1071 
1073 {
1074  // in netmode, don't load other actors!
1075  if (RoR::App::mp_state->getEnum<MpState>() == RoR::MpState::CONNECTED)
1076  {
1077  return;
1078  }
1079 
1081  {
1082  if (object->special_object_type == TObjSpecialObject::NONE)
1083  {
1084  continue; // Skip static objects
1085  }
1086 
1087  if ((object->special_object_type == TObjSpecialObject::BOAT) && (terrainManager->getWater() == nullptr))
1088  {
1089  continue; // Don't spawn boats if there's no water.
1090  }
1091 
1092  this->SpawnSinglePredefinedActor(object);
1093  }
1094 }
1095 
1097 {
1098 #ifdef USE_PAGED
1099  for (auto geom : m_paged_geometry)
1100  {
1101  geom->update();
1102  }
1103 #endif //USE_PAGED
1104  this->UpdateAnimatedObjects(dt);
1106 
1107  return true;
1108 }
1109 
1111 {
1112  for (ODefCollisionBox& cbox : odef->collision_boxes)
1113  {
1114  if (params->enable_collisions && (App::sim_races_enabled->getBool() || !race_event))
1115  {
1116  // Validate AABB (minimum corners must be less or equal to maximum corners)
1117  if (cbox.aabb_min.x > cbox.aabb_max.x || cbox.aabb_min.y > cbox.aabb_max.y || cbox.aabb_min.z > cbox.aabb_max.z)
1118  {
1119  // Only log to console if invoked from Console UI or script.
1120  std::string msg = "Skipping invalid collision box, min: " + TOSTRING(cbox.aabb_min) + ", max: " + TOSTRING(cbox.aabb_max);
1121  if (App::app_state->getEnum<AppState>() == AppState::SIMULATION)
1122  {
1124  }
1125  else
1126  {
1127  LOG(fmt::format("[ODEF] {}", msg));
1128  }
1129  continue;
1130  }
1131 
1132  int boxnum = terrainManager->GetCollisions()->addCollisionBox(
1133  cbox.is_rotating, cbox.is_virtual, params->position, params->rotation,
1134  cbox.aabb_min, cbox.aabb_max, cbox.box_rot, cbox.event_name,
1135  params->instance_name, cbox.force_cam_pos, cbox.cam_pos,
1136  cbox.scale, cbox.direction, cbox.event_filter, params->script_handler);
1137 
1138  obj->static_collision_boxes.push_back(boxnum);
1139  }
1140  }
1141 }
1142 
1144 {
1145  // This has no effect on rendering, it just helps users to diagnose the scene graph.
1146  // --------------------------------------------------------------------------------
1147 
1150  else if (m_tobj_grouping_node)
1151  return m_tobj_grouping_node;
1152  else if (m_terrn2_grouping_node)
1153  return m_terrn2_grouping_node;
1154  else
1155  return App::GetGfxScene()->GetSceneManager()->getRootSceneNode();
1156 }
1157 
1159 {
1160  // Is this the right 'ModernC++' approach? :/
1161  auto itor = std::find_if(m_editor_objects.begin(), m_editor_objects.end(),
1162  [needle_instance_name](TerrainEditorObjectPtr& obj) { return obj->instance_name == needle_instance_name; });
1163  if (itor != m_editor_objects.end())
1164  {
1165  return static_cast<int>(std::distance(m_editor_objects.begin(), itor));
1166  }
1167  else
1168  {
1170  }
1171 }
1172 
ROR_ASSERT
#define ROR_ASSERT(_EXPR)
Definition: Application.h:40
GameContext.h
Game state manager and message-queue provider.
RoR::ODefSpotlight::range
float range
Definition: ODefFileFormat.h:104
RoR::ProceduralManager::addObject
void addObject(ProceduralObjectPtr po)
Generates road mesh and adds to internal list.
Definition: ProceduralManager.cpp:173
RoR::TObjVehicle::type
TObjSpecialObject type
Definition: TObjFileFormat.h:115
RoR::App::GetSoundScriptManager
SoundScriptManager * GetSoundScriptManager()
Definition: Application.cpp:281
RoR::Terrain::GetDef
Terrn2DocumentPtr GetDef()
Definition: Terrain.cpp:577
RoR::SoundScriptInstance::start
void start()
Definition: SoundScriptManager.cpp:1386
RoR::ODefTexPrint::option
char option
Definition: ODefFileFormat.h:94
RoR::TerrainObjectManager::ProcessPredefinedActor
void ProcessPredefinedActor(int tobj_cache_id, const std::string &name, const Ogre::Vector3 position, const Ogre::Vector3 rotation, const TObjSpecialObject type)
Definition: TerrainObjectManager.cpp:473
RoR::ActorSpawnRequest::asr_free_position
bool asr_free_position
Disables the automatic spawn position adjustment.
Definition: SimData.h:845
RoR::ODefAnimation::name
std::string name
Definition: ODefFileFormat.h:85
y
float y
Definition: (ValueTypes) quaternion.h:6
RoR::ODefTexPrint::y
float y
Definition: ODefFileFormat.h:96
RoR::ODefDocument::spotlights
std::list< ODefSpotlight > spotlights
Definition: ODefFileFormat.h:136
RoR::TObjGrass::density
float density
Definition: TObjFileFormat.h:98
RoR::ODefTexPrint
Definition: ODefFileFormat.h:88
RoR::MACHINE
@ MACHINE
its a machine
Definition: SimData.h:95
RoR::TerrainObjectManager::m_has_predefined_actors
bool m_has_predefined_actors
Definition: TerrainObjectManager.h:137
RoR::Terrain::getPagedDetailFactor
float getPagedDetailFactor() const
Definition: Terrain.h:93
RoR::ODefSpotlight::dir
Ogre::Vector3 dir
Definition: ODefFileFormat.h:103
RoR::ODefParser::ProcessOgreStream
void ProcessOgreStream(Ogre::DataStream *stream)
Definition: ODefFileFormat.cpp:30
RoR::MpState::CONNECTED
@ CONNECTED
RoR::TObjGrass::min_y
float min_y
Definition: TObjFileFormat.h:100
RoR::TObjParser
Definition: TObjFileFormat.h:160
RoR::Console::CONSOLE_MSGTYPE_TERRN
@ CONSOLE_MSGTYPE_TERRN
Parsing/spawn/simulation messages for terrain.
Definition: Console.h:64
RoR::TerrainObjectManager::UpdateParticleEffectObjects
void UpdateParticleEffectObjects()
Definition: TerrainObjectManager.cpp:1001
RoR::TerrainObjectManager::m_tobj_cache
std::vector< TObjDocumentPtr > m_tobj_cache
Definition: TerrainObjectManager.h:134
RoR::TObjGrass::range
int range
Definition: TObjFileFormat.h:92
RoR::Str::GetBuffer
char * GetBuffer()
Definition: Str.h:48
RoR::TerrainObjectManager::LoadTelepoints
void LoadTelepoints()
Definition: TerrainObjectManager.cpp:1012
RoR::ActorManager::ACTORPTR_NULL
static const ActorPtr ACTORPTR_NULL
Definition: ActorManager.h:126
RoR::SCRIPTUNITID_INVALID
static const ScriptUnitID_t SCRIPTUNITID_INVALID
Definition: ForwardDeclarations.h:42
RoR::TObjEntry::comments
std::string comments
Comment line(s) preceding the object-line in the .TOBJ file.
Definition: TObjFileFormat.h:137
RoR::App::GetCameraManager
CameraManager * GetCameraManager()
Definition: Application.cpp:279
RoR::ActorSpawnRequest::asr_origin
Origin asr_origin
Definition: SimData.h:838
RoR::TObjGrass::max_y
float max_y
Definition: TObjFileFormat.h:101
RoR::Collisions::addCollisionBox
int addCollisionBox(bool rotating, bool virt, Ogre::Vector3 pos, Ogre::Vector3 rot, Ogre::Vector3 l, Ogre::Vector3 h, Ogre::Vector3 sr, const Ogre::String &eventname, const Ogre::String &instancename, bool forcecam, Ogre::Vector3 campos, Ogre::Vector3 sc=Ogre::Vector3::UNIT_SCALE, Ogre::Vector3 dr=Ogre::Vector3::ZERO, CollisionEventFilter event_filter=EVENT_ALL, int scripthandler=-1)
Definition: Collisions.cpp:401
RoR::SoundScriptInstance::ACTOR_ID_TERRAIN_OBJECT
static const int ACTOR_ID_TERRAIN_OBJECT
Definition: SoundScriptManager.h:270
RoR::ODefTexPrint::r
float r
Definition: ODefFileFormat.h:97
RoR::ODefDocument::mat_name
std::string mat_name
Section 'setMeshMaterial'.
Definition: ODefFileFormat.h:138
RoR::TerrainObjectManager::m_map_entities
SurveyMapEntityVec m_map_entities
Definition: TerrainObjectManager.h:141
z
float z
Definition: (ValueTypes) quaternion.h:7
RoR::TObjGrass::sway_distrib
float sway_distrib
Definition: TObjFileFormat.h:97
RoR::TObjParser::Prepare
void Prepare()
Definition: TObjFileFormat.cpp:58
RoR::TERRAINEDITOROBJECTID_INVALID
static const TerrainEditorObjectID_t TERRAINEDITOROBJECTID_INVALID
Definition: ForwardDeclarations.h:91
RoR::TerrainObjectManager::LoadTObjFile
void LoadTObjFile(Ogre::String filename)
Definition: TerrainObjectManager.cpp:150
MeshObject::getEntity
Ogre::Entity * getEntity()
Definition: MeshObject.h:43
RoR::TObjTree::yaw_to
float yaw_to
Definition: TObjFileFormat.h:60
RoR::Terrain::getTerrainFileResourceGroup
std::string getTerrainFileResourceGroup()
Definition: Terrain.cpp:557
format
Truck file format(technical spec)
RoR::ODefCollisionBox::cam_pos
Ogre::Vector3 cam_pos
Definition: ODefFileFormat.h:51
RoR::Terrain::getObjectManager
TerrainObjectManager * getObjectManager()
Definition: Terrain.h:79
RoR::TObjGrass::min_x
float min_x
Definition: TObjFileFormat.h:100
AutoPilot.h
RoR::TObjSpecialObject
TObjSpecialObject
Definition: Application.h:351
RoR::ODefCollisionBox::is_virtual
bool is_virtual
Definition: ODefFileFormat.h:59
GenerateGridAndPutToScene
void GenerateGridAndPutToScene(Ogre::Vector3 position)
Definition: TerrainObjectManager.cpp:96
RoR::ODefTexPrint::a
float a
Definition: ODefFileFormat.h:97
ExtinguishableFireAffector.h
RoR::HandleGenericException
void HandleGenericException(const std::string &from, BitMask_t flags)
Definition: Application.cpp:373
TerrainGeometryManager.h
Terrn2FileFormat.h
RoR::TObjEntry::rendering_distance
float rendering_distance
Definition: TObjFileFormat.h:136
RoR::CVar::getBool
bool getBool() const
Definition: CVar.h:98
TObjFileFormat.h
Parser and data structures for TOBJ (Terrain Objects) file format.
RoR::ODefParticleSys::template_name
std::string template_name
Definition: ODefFileFormat.h:77
RoR::Terrain::GetTerrainEditor
TerrainEditor * GetTerrainEditor()
Definition: Terrain.h:84
RoR::TObjEntry::instance_name
char instance_name[TObj::STR_LEN]
Definition: TObjFileFormat.h:134
RoR::ODefPointLight
Definition: ODefFileFormat.h:110
MeshObject.h
RoR::TerrainObjectManager::terrainManager
Terrain * terrainManager
Definition: TerrainObjectManager.h:142
Console.h
RoR::Console::putMessage
void putMessage(MessageArea area, MessageType type, std::string const &msg, std::string icon="")
Definition: Console.cpp:103
RoR::TerrainObjectManager::ParticleEffectObject::psys
Ogre::ParticleSystem * psys
Definition: TerrainObjectManager.h:112
RoR::TerrainObjectManager::getGroupingSceneNode
Ogre::SceneNode * getGroupingSceneNode()
Definition: TerrainObjectManager.cpp:1143
RoR::ODefDocument::groundmodel_files
std::list< std::string > groundmodel_files
Definition: ODefFileFormat.h:130
RoR::CacheEntry::resource_group
Ogre::String resource_group
Resource group of the loaded bundle. Empty if not loaded yet.
Definition: CacheSystem.h:89
RoR::TerrainObjectManager::m_localizers
LocalizerVec m_localizers
Definition: TerrainObjectManager.h:132
RoR::Collisions::addCollisionMesh
void addCollisionMesh(Ogre::String const &srcname, Ogre::String const &meshname, Ogre::Vector3 const &pos, Ogre::Quaternion const &q, Ogre::Vector3 const &scale, ground_model_t *gm=0, std::vector< int > *collTris=0)
generate collision tris from existing mesh resource
Definition: Collisions.cpp:1408
RoR::ODefTexPrint::x
float x
Definition: ODefFileFormat.h:96
RoR::ODefCollisionBox::scale
Ogre::Vector3 scale
Definition: ODefFileFormat.h:53
RoR::ODefTexPrint::font_dpi
int font_dpi
Definition: ODefFileFormat.h:92
RoR::ODefCollisionBox::is_rotating
bool is_rotating
Definition: ODefFileFormat.h:58
RoR::TerrainObjectManager::destroyObject
void destroyObject(const Ogre::String &instancename)
Definition: TerrainObjectManager.cpp:504
RoR::TObjTree::min_distance
float min_distance
Definition: TObjFileFormat.h:62
RoR::TerrainObjectManager::LoadTerrainObject
bool LoadTerrainObject(const Ogre::String &name, const Ogre::Vector3 &pos, const Ogre::Vector3 &rot, const Ogre::String &instancename, const Ogre::String &type, float rendering_distance=0, bool enable_collisions=true, int scripthandler=-1, bool uniquifyMaterial=false)
Definition: TerrainObjectManager.cpp:600
RoR::TObjEntry::odef_name
char odef_name[TObj::STR_LEN]
Definition: TObjFileFormat.h:135
RoR::TerrainObjectManager::AnimatedObject
Definition: TerrainObjectManager.h:102
Utils.h
RoR::TerrainObjectManager::LoadTerrainScript
bool LoadTerrainScript(const Ogre::String &filename)
Definition: TerrainObjectManager.cpp:973
RoR::ActorSpawnRequest::asr_filename
std::string asr_filename
Can be in "Bundle-qualified" format, i.e. "mybundle.zip:myactor.truck".
Definition: SimData.h:830
RoR::ODefCollisionMesh::groundmodel_name
std::string groundmodel_name
Definition: ODefFileFormat.h:71
RoR::TerrainObjectManager::m_mesh_objects
std::vector< MeshObject * > m_mesh_objects
Definition: TerrainObjectManager.h:140
Language.h
RoR::ODefCollisionBox::aabb_max
Ogre::Vector3 aabb_max
Definition: ODefFileFormat.h:49
RoR::TObjGrass::material_name
char material_name[TObj::STR_LEN]
Definition: TObjFileFormat.h:103
TerrainObjectManager.h
RefCountingObjectPtr< ProceduralObject >
RoR::TerrainObjectManager::LoadPredefinedActors
void LoadPredefinedActors()
Definition: TerrainObjectManager.cpp:1072
RoR::Console::CONSOLE_SYSTEM_ERROR
@ CONSOLE_SYSTEM_ERROR
Definition: Console.h:52
GUIManager.h
RoR::Collisions::removeCollisionTri
void removeCollisionTri(int number)
Definition: Collisions.cpp:356
RoR::Terrn2Telepoint
< Teleport drop location
Definition: Terrn2FileFormat.h:43
Actor.h
RoR::ProceduralManager
Definition: ProceduralManager.h:82
RoR::App::GetScriptEngine
ScriptEngine * GetScriptEngine()
Definition: Application.cpp:283
RoR::TerrainObjectManager::m_odef_cache
std::unordered_map< std::string, std::shared_ptr< RoR::ODefDocument > > m_odef_cache
Definition: TerrainObjectManager.h:133
RoR::GfxScene::GetSceneManager
Ogre::SceneManager * GetSceneManager()
Definition: GfxScene.h:69
w
float w
Definition: (ValueTypes) quaternion.h:4
RoR::ActorSpawnRequest
Definition: SimData.h:812
RoR::TObjGrass::max_h
float max_h
Definition: TObjFileFormat.h:101
RoR::TerrainObjectManager::AnimatedObject::ent
Ogre::Entity * ent
Definition: TerrainObjectManager.h:104
RoR::ODefParticleSys::instance_name
std::string instance_name
Definition: ODefFileFormat.h:76
RoR::TObjParser::Finalize
TObjDocumentPtr Finalize()
Passes ownership.
Definition: TObjFileFormat.cpp:211
RoR::App::mp_state
CVar * mp_state
Definition: Application.cpp:115
RoR::TObjTree::density_map
char density_map[TObj::STR_LEN]
Definition: TObjFileFormat.h:68
RoR::ODefDocument::animations
std::list< ODefAnimation > animations
Definition: ODefFileFormat.h:134
RoR::TObjEntry
Definition: TObjFileFormat.h:120
RoR::ODefDocument::collision_boxes
std::list< ODefCollisionBox > collision_boxes
Definition: ODefFileFormat.h:131
RoR::Collisions::loadGroundModelsConfigFile
int loadGroundModelsConfigFile(Ogre::String filename)
Definition: Collisions.cpp:150
ProceduralRoad.h
TOSTRING
#define TOSTRING(x)
Definition: Application.h:56
RoR::TObjGrass::sway_length
float sway_length
Definition: TObjFileFormat.h:96
RoR::PATH_SLASH
char PATH_SLASH
Definition: PlatformUtils.cpp:161
RoR::TObjEntry::rotation
Ogre::Vector3 rotation
Definition: TObjFileFormat.h:131
RoR::TerrainObjectManager::m_entity_counter
int m_entity_counter
Definition: TerrainObjectManager.h:144
RoR::ODefTexPrint::g
float g
Definition: ODefFileFormat.h:97
RoR::TerrainGeometryManager::getMaxTerrainSize
Ogre::Vector3 getMaxTerrainSize()
Definition: TerrainGeometryManager.cpp:690
RoR::ODefCollisionMesh
Definition: ODefFileFormat.h:63
RoR::TerrainEditor::ClearSelectedObject
void ClearSelectedObject()
Definition: TerrainEditor.cpp:306
RoR::ODefDocument::collision_meshes
std::list< ODefCollisionMesh > collision_meshes
Definition: ODefFileFormat.h:132
RoR::Str
Wrapper for classic c-string (local buffer) Refresher: strlen() excludes '\0' terminator; strncat() A...
Definition: Str.h:35
RoR::Collisions::removeCollisionBox
void removeCollisionBox(int number)
Definition: Collisions.cpp:343
RoR::Collisions::getGroundModelByString
ground_model_t * getGroundModelByString(const Ogre::String name)
Definition: Collisions.cpp:365
RoR::Terrain::getHeightAt
float getHeightAt(float x, float z)
Definition: Terrain.cpp:505
RoR::ODefSpotlight::angle_outer
float angle_outer
Degrees.
Definition: ODefFileFormat.h:106
RoR::TerrainObjectManager::ProcessGrass
void ProcessGrass(float SwaySpeed, float SwayLength, float SwayDistribution, float Density, float minx, float miny, float minH, float maxx, float maxy, float maxH, char *grassmat, char *colorMapFilename, char *densityMapFilename, int growtechnique, int techn, int range, int mapsizex, int mapsizez)
Definition: TerrainObjectManager.cpp:400
GUI_LoadingWindow.h
CacheSystem.h
A database of user-installed content alias 'mods' (vehicles, terrains...)
RoR::TObjDocumentPtr
std::shared_ptr< TObjDocument > TObjDocumentPtr
Definition: ForwardDeclarations.h:222
RoR::TerrainObjectManager::FetchODef
RoR::ODefDocument * FetchODef(std::string const &odef_name)
Definition: TerrainObjectManager.cpp:558
RoR::TObjVehicle::tobj_rotation
Ogre::Vector3 tobj_rotation
Original rotation specified in .TOBJ file.
Definition: TObjFileFormat.h:113
RoR::TObjGrass::technique
int technique
Definition: TObjFileFormat.h:93
ErrorUtils.h
RoR::ACTORINSTANCEID_INVALID
static const ActorInstanceID_t ACTORINSTANCEID_INVALID
Definition: ForwardDeclarations.h:39
RoR::GfxVegetation::NONE
@ NONE
ScriptEngine.h
RoR::TerrainObjectManager::AnimatedObject::node
Ogre::SceneNode * node
Definition: TerrainObjectManager.h:105
RoR::TObjGrass::density_map_filename
char density_map_filename[TObj::STR_LEN]
Definition: TObjFileFormat.h:105
RoR::TerrainObjectManager::m_terrn2_grouping_node
Ogre::SceneNode * m_terrn2_grouping_node
For a readable scene graph (via inspector script)
Definition: TerrainObjectManager.h:145
RoR::GameContext::PushMessage
void PushMessage(Message m)
Doesn't guarantee order! Use ChainMessage() if order matters.
Definition: GameContext.cpp:66
strnlen
#define strnlen(str, len)
Definition: InputEngine.cpp:400
RoR::TerrainObjectManager::GetEditorObjectFlagRotYXZ
bool GetEditorObjectFlagRotYXZ(TerrainEditorObjectPtr const &object)
Definition: TerrainObjectManager.cpp:1020
RoR::App::app_state
CVar * app_state
Definition: Application.cpp:79
RoR::Terrain::getGeometryManager
TerrainGeometryManager * getGeometryManager()
Definition: Terrain.h:78
RoR::Str::ToCStr
const char * ToCStr() const
Definition: Str.h:46
RoR::TerrainObjectManager::UpdateAnimatedObjects
void UpdateAnimatedObjects(float dt)
Definition: TerrainObjectManager.cpp:984
ODefFileFormat.h
RoR::ODefDocument::sounds
std::list< std::string > sounds
Definition: ODefFileFormat.h:129
RoR::Terrain::GetCollisions
Collisions * GetCollisions()
Definition: Terrain.h:85
RoR::App::sys_cache_dir
CVar * sys_cache_dir
Definition: Application.cpp:165
RoR::TerrainObjectManager::ParticleEffectObject
Definition: TerrainObjectManager.h:110
RoR::ODefParticleSys
Definition: ODefFileFormat.h:74
GfxScene.h
PlatformUtils.h
Platform-specific utilities. We use narrow UTF-8 encoded strings as paths. Inspired by http://utf8eve...
RoR::SoundScriptManager::createInstance
SoundScriptInstancePtr createInstance(Ogre::String templatename, int actor_id, int soundLinkType=SL_DEFAULT, int soundLinkItemId=-1)
Definition: SoundScriptManager.cpp:356
RoR::ODefParser::Finalize
std::shared_ptr< ODefDocument > Finalize()
Passes ownership.
Definition: ODefFileFormat.cpp:61
RoR::App::sim_races_enabled
CVar * sim_races_enabled
Definition: Application.cpp:105
MeshObject
Definition: MeshObject.h:35
RoR::TObjVehicle::position
Ogre::Vector3 position
Definition: TObjFileFormat.h:111
Application.h
Central state/object manager and communications hub.
RoR::TerrainObjectManager::m_procedural_manager
ProceduralManagerPtr m_procedural_manager
Definition: TerrainObjectManager.h:143
RoR::App::GetConsole
Console * GetConsole()
Definition: Application.cpp:274
RoR::TerrainObjectManager::m_animated_objects
std::vector< AnimatedObject > m_animated_objects
Definition: TerrainObjectManager.h:138
RoR::ODefDocument::mat_name_generate
std::string mat_name_generate
Section 'generateMaterialShaders'.
Definition: ODefFileFormat.h:139
SoundScriptManager.h
RoR::App::GetGameContext
GameContext * GetGameContext()
Definition: Application.cpp:284
RoR::ODefCollisionBox::box_rot
Ogre::Vector3 box_rot
Definition: ODefFileFormat.h:50
RoR::AppState::SIMULATION
@ SIMULATION
RoR::ODefCollisionBox::force_cam_pos
bool force_cam_pos
Definition: ODefFileFormat.h:60
RoR::TObjTree::tree_mesh
char tree_mesh[TObj::STR_LEN]
Definition: TObjFileFormat.h:66
RoR::TerrainObjectManager::m_editor_objects
TerrainEditorObjectPtrVec m_editor_objects
Definition: TerrainObjectManager.h:136
RoR::ActorSpawnRequest::Origin::TERRN_DEF
@ TERRN_DEF
Preloaded with terrain.
getTerrainHeight
float getTerrainHeight(Real x, Real z, void *unused=0)
Definition: TerrainObjectManager.cpp:63
RoR::ActorSpawnRequest::asr_terrn_machine
bool asr_terrn_machine
This is a fixed machinery.
Definition: SimData.h:847
RoR::TObjGrass::sway_speed
float sway_speed
Definition: TObjFileFormat.h:95
RoR::TObjEntry::type
char type[TObj::STR_LEN]
Definition: TObjFileFormat.h:133
RoR::TerrainObjectManager::AnimatedObject::anim
Ogre::AnimationState * anim
Definition: TerrainObjectManager.h:106
RoR::ODefPointLight::pos
Ogre::Vector3 pos
Definition: ODefFileFormat.h:112
RoR::ODefDocument
Definition: ODefFileFormat.h:118
Ogre::ExtinguishableFireAffector
This class defines a ParticleAffector which deflects particles.
Definition: ExtinguishableFireAffector.h:45
RoR::TObjTree::scale_from
float scale_from
Definition: TObjFileFormat.h:61
RoR::TObjTree::max_distance
float max_distance
Definition: TObjFileFormat.h:62
RoR::ODefPointLight::dir
Ogre::Vector3 dir
Definition: ODefFileFormat.h:113
RoR::TObjParser::CalcRotation
static Ogre::Quaternion CalcRotation(Ogre::Vector3 const &rot, bool rot_yxz)
Definition: TObjFileFormat.cpp:396
RoR::ODefPointLight::range
float range
Definition: ODefFileFormat.h:114
RoR::Terrain
Definition: Terrain.h:40
RoR::ODefDocument::point_lights
std::list< ODefPointLight > point_lights
Definition: ODefFileFormat.h:137
RoR::ODefDocument::localizers
std::vector< LocalizerType > localizers
Definition: ODefFileFormat.h:128
RoR::ODefDocument::ODefDocumentHeader::cast_shadows
bool cast_shadows
Definition: ODefFileFormat.h:124
RoR::ODefCollisionBox
Definition: ODefFileFormat.h:37
RoR::ODefTexPrint::font_name
std::string font_name
Definition: ODefFileFormat.h:90
RoR::TerrainEditorObjectID_t
int TerrainEditorObjectID_t
Offset into RoR::TerrainObjectManager::m_editor_objects, use RoR::TERRAINEDITOROBJECTID_INVALID as em...
Definition: ForwardDeclarations.h:90
RoR::TObjParser::ProcessOgreStream
void ProcessOgreStream(Ogre::DataStream *stream)
Definition: TObjFileFormat.cpp:231
RoR::TObjTree::grid_spacing
float grid_spacing
Definition: TObjFileFormat.h:64
RoR::ODefDocument::ODefDocumentHeader::scale
Ogre::Vector3 scale
Definition: ODefFileFormat.h:123
RoR::ODefSpotlight::color
Ogre::ColourValue color
Definition: ODefFileFormat.h:107
RoR::ODefSpotlight::pos
Ogre::Vector3 pos
Definition: ODefFileFormat.h:102
WriteToTexture
void WriteToTexture(const String &str, TexturePtr destTexture, Ogre::Box destRectangle, Ogre::Font *Reffont, const ColourValue &color, int fontSize, int fontDPI, char justify, bool wordwrap)
Definition: WriteTextToTexture.cpp:52
RoR::TerrainObjectManager::UpdateTerrainObjects
bool UpdateTerrainObjects(float dt)
Definition: TerrainObjectManager.cpp:1096
RoR::TerrainObjectManager::ProcessTree
void ProcessTree(float yawfrom, float yawto, float scalefrom, float scaleto, char *ColorMap, char *DensityMap, char *treemesh, char *treeCollmesh, float gridspacing, float highdens, int minDist, int maxDist, int mapsizex, int mapsizez)
Definition: TerrainObjectManager.cpp:275
RoR::ODefCollisionBox::direction
Ogre::Vector3 direction
Definition: ODefFileFormat.h:52
RoR::Message
Unified game event system - all requests and state changes are reported using a message.
Definition: GameContext.h:51
_L
#define _L
Definition: ErrorUtils.cpp:35
RoR::Localizer
Definition: TerrainObjectManager.h:50
RoR::ODefPointLight::color
Ogre::ColourValue color
Definition: ODefFileFormat.h:115
RoR::TObjGrass::color_map_filename
char color_map_filename[TObj::STR_LEN]
Definition: TObjFileFormat.h:104
RoR::TObjTree::high_density
float high_density
Definition: TObjFileFormat.h:63
RoR::ODefParser::Prepare
void Prepare()
Definition: ODefFileFormat.cpp:53
RoR::TObjVehicle::name
char name[TObj::STR_LEN]
Definition: TObjFileFormat.h:114
RoR::TerrainObjectManager::ProcessODefCollisionBoxes
void ProcessODefCollisionBoxes(TerrainEditorObjectPtr obj, ODefDocument *odef, const TerrainEditorObjectPtr &params, bool race_event)
Definition: TerrainObjectManager.cpp:1110
RoR::TObjGrass::max_x
float max_x
Definition: TObjFileFormat.h:101
RoR::TerrainObjectManager::moveObjectVisuals
void moveObjectVisuals(const Ogre::String &instancename, const Ogre::Vector3 &pos)
Definition: TerrainObjectManager.cpp:489
RoR::ODefTexPrint::b
float b
Definition: ODefFileFormat.h:97
RoR::ODefAnimation::speed_min
float speed_min
Definition: ODefFileFormat.h:84
RoR::Terrain::getCacheEntry
CacheEntryPtr getCacheEntry()
Definition: Terrain.cpp:585
RoR::TObjGrass
Unified 'grass' and 'grass2'.
Definition: TObjFileFormat.h:74
RoR::MSG_SIM_SPAWN_ACTOR_REQUESTED
@ MSG_SIM_SPAWN_ACTOR_REQUESTED
Payload = RoR::ActorSpawnRequest* (owner)
Definition: Application.h:121
RoR::LocalizerType
LocalizerType
Definition: SimData.h:250
RoR::TerrainObjectManager::~TerrainObjectManager
~TerrainObjectManager()
Definition: TerrainObjectManager.cpp:76
RoR::ODefCollisionMesh::scale
Ogre::Vector3 scale
Definition: ODefFileFormat.h:70
RoR::TObjGrass::grow_techniq
int grow_techniq
Definition: TObjFileFormat.h:94
RoR::ActorPtr
RefCountingObjectPtr< Actor > ActorPtr
Definition: ForwardDeclarations.h:225
RoR::ProceduralManager::logDiagnostics
void logDiagnostics()
Definition: ProceduralManager.cpp:179
RoR::MSG_SIM_DELETE_ACTOR_REQUESTED
@ MSG_SIM_DELETE_ACTOR_REQUESTED
Payload = RoR::ActorPtr* (owner)
Definition: Application.h:123
RoR::TObjTree::color_map
char color_map[TObj::STR_LEN]
Definition: TObjFileFormat.h:67
RoR::TObjTree
Definition: TObjFileFormat.h:45
RoR::ODefCollisionBox::aabb_min
Ogre::Vector3 aabb_min
Definition: ODefFileFormat.h:48
RoR::TerrainObjectManager::m_particle_effect_objects
std::vector< ParticleEffectObject > m_particle_effect_objects
Definition: TerrainObjectManager.h:139
Terrain.h
RoR::ODefCollisionMesh::mesh_name
std::string mesh_name
Definition: ODefFileFormat.h:69
RoR::ProceduralObject::name
std::string name
Definition: ProceduralManager.h:75
Ogre
Definition: ExtinguishableFireAffector.cpp:35
WriteTextToTexture.h
RoR::ODefDocument::ODefDocumentHeader::mesh_name
std::string mesh_name
Definition: ODefFileFormat.h:122
RoR::TObjTree::scale_to
float scale_to
Definition: TObjFileFormat.h:61
RoR::Localizer::type
LocalizerType type
Definition: TerrainObjectManager.h:52
RoR::TerrainObjectManager::m_angelscript_grouping_node
Ogre::SceneNode * m_angelscript_grouping_node
For even more readable scene graph (via inspector script)
Definition: TerrainObjectManager.h:147
RoR::Console::CONSOLE_SYSTEM_WARNING
@ CONSOLE_SYSTEM_WARNING
Definition: Console.h:53
RoR::ODefTexPrint::font_size
int font_size
Definition: ODefFileFormat.h:91
RoR::TObjSpecialObject::NONE
@ NONE
RoR::TObjEntry::position
Ogre::Vector3 position
Definition: TObjFileFormat.h:130
RoR::ScriptEngine::loadScript
ScriptUnitID_t loadScript(Ogre::String filename, ScriptCategory category=ScriptCategory::TERRAIN, ActorPtr associatedActor=nullptr, std::string buffer="")
Loads a script.
Definition: ScriptEngine.cpp:828
RoR::ScriptUnitID_t
int ScriptUnitID_t
Unique sequentially generated ID of a loaded and running scriptin session. Use ScriptEngine::getScrip...
Definition: ForwardDeclarations.h:41
RoR::ODefParser
Definition: ODefFileFormat.h:143
RoR::ODefAnimation::speed_max
float speed_max
Definition: ODefFileFormat.h:84
RoR::ODefDocument::texture_prints
std::list< ODefTexPrint > texture_prints
Section 'drawTextOnMeshTexture'.
Definition: ODefFileFormat.h:135
RoR::App::gfx_vegetation_mode
CVar * gfx_vegetation_mode
Definition: Application.cpp:223
RoR::TObjVehicle
Definition: TObjFileFormat.h:109
RoR::ActorSpawnRequest::asr_position
Ogre::Vector3 asr_position
Definition: SimData.h:832
RoR::ODefTexPrint::w
float w
Definition: ODefFileFormat.h:96
Collisions.h
RoR::App::diag_terrn_log_roads
CVar * diag_terrn_log_roads
Definition: Application.cpp:157
RoR::TerrainObjectManager::ParticleEffectObject::node
Ogre::SceneNode * node
Definition: TerrainObjectManager.h:113
RoR::BOAT
@ BOAT
its a boat
Definition: SimData.h:94
RoR::ODefDocument::mode_standard
bool mode_standard
Definition: ODefFileFormat.h:127
RoR::DEPTHMAP_DISABLED
@ DEPTHMAP_DISABLED
Definition: Application.h:302
RoR::GfxScene::AdjustParticleSystemTimeFactor
void AdjustParticleSystemTimeFactor(Ogre::ParticleSystem *psys)
Definition: GfxScene.cpp:428
RoR::ODefDocument::header
struct RoR::ODefDocument::ODefDocumentHeader header
RoR::ODefDocument::particle_systems
std::list< ODefParticleSys > particle_systems
Definition: ODefFileFormat.h:133
RoR::SurveyMapEntity
Definition: SurveyMapEntity.h:35
RoR::TObjGrass::min_h
float min_h
Definition: TObjFileFormat.h:100
RoR::ODefTexPrint::text
std::string text
Definition: ODefFileFormat.h:93
RoR::TerrainObjectManager::AnimatedObject::speedfactor
float speedfactor
Definition: TerrainObjectManager.h:107
RoR::ActorSpawnRequest::asr_instance_id
ActorInstanceID_t asr_instance_id
Optional; see ActorManager::GetActorNextInstanceID();.
Definition: SimData.h:828
Forests
Definition: RandomTreeLoader.h:32
RoR::ActorSpawnRequest::asr_rotation
Ogre::Quaternion asr_rotation
Definition: SimData.h:833
RoR::TerrainEditorObject
Represents an instance of static terrain object (.ODEF file format)
Definition: TerrainEditor.h:35
RoR
Definition: AppContext.h:36
RoR::ActorManager::GetActorById
const ActorPtr & GetActorById(ActorInstanceID_t actor_id)
Definition: ActorManager.cpp:1132
RoR::Str::Clear
Str & Clear()
Definition: Str.h:54
RoR::TerrainObjectManager::m_tobj_grouping_node
Ogre::SceneNode * m_tobj_grouping_node
For even more readable scene graph (via inspector script)
Definition: TerrainObjectManager.h:146
x
float x
Definition: (ValueTypes) quaternion.h:5
RoR::SoundScriptInstance::setPosition
void setPosition(Ogre::Vector3 pos)
Definition: SoundScriptManager.cpp:1310
RoR::TObjSpecialObject::TRUCK2
@ TRUCK2
Free position (not auto-adjusted to fit terrain or water surface)
RoR::ODefAnimation
Definition: ODefFileFormat.h:82
RoR::Localizer::rotation
Ogre::Quaternion rotation
Definition: TerrainObjectManager.h:54
RoR::App::GetGfxScene
GfxScene * GetGfxScene()
Definition: Application.cpp:280
RoR::GameContext::GetActorManager
ActorManager * GetActorManager()
Definition: GameContext.h:127
RoR::ODefSpotlight
Definition: ODefFileFormat.h:100
RoR::Terrain::getWater
IWater * getWater()
Definition: Terrain.h:86
RoR::HANDLEGENERICEXCEPTION_CONSOLE
@ HANDLEGENERICEXCEPTION_CONSOLE
Definition: Application.h:638
RoR::ODefCollisionBox::event_name
std::string event_name
Definition: ODefFileFormat.h:54
RoR::ODefCollisionBox::event_filter
CollisionEventFilter event_filter
Definition: ODefFileFormat.h:55
RoR::TerrainObjectManager::SpawnSinglePredefinedActor
void SpawnSinglePredefinedActor(TerrainEditorObjectPtr const &object)
Definition: TerrainObjectManager.cpp:1036
RoR::TObjTree::collision_mesh
char collision_mesh[TObj::STR_LEN]
Definition: TObjFileFormat.h:69
RoR::Localizer::position
Ogre::Vector3 position
Definition: TerrainObjectManager.h:53
RoR::TerrainObjectManager::m_tobj_cache_active_id
int m_tobj_cache_active_id
Definition: TerrainObjectManager.h:135
RoR::TObjTree::yaw_from
float yaw_from
Definition: TObjFileFormat.h:60
RoR::ODefTexPrint::h
float h
Definition: ODefFileFormat.h:96
RoR::GameContext::GetTerrain
const TerrainPtr & GetTerrain()
Definition: GameContext.h:117
RoR::TerrainObjectManager::FindEditorObjectByInstanceName
TerrainEditorObjectID_t FindEditorObjectByInstanceName(std::string const &instance_name)
Returns offset to m_editor_objects or -1 if not found.
Definition: TerrainObjectManager.cpp:1158
RoR::ODefSpotlight::angle_inner
float angle_inner
Degrees.
Definition: ODefFileFormat.h:105