RigsofRods
Soft-body Physics Simulation
GUI_CollisionsDebug.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-2022 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 "GUI_CollisionsDebug.h"
23 
24 #include "Application.h"
25 #include "Collisions.h"
26 #include "GameContext.h"
27 #include "GfxScene.h"
28 #include "GUIManager.h"
29 #include "GUIUtils.h"
30 #include "Language.h"
31 #include "RoRVersion.h"
32 #include "Terrain.h"
33 #include "Utils.h"
34 #include "RoRnet.h"
35 
36 #include "imgui_internal.h"
37 
38 using namespace RoR;
39 using namespace GUI;
40 using namespace Ogre;
41 
43 {
45 
46  ImGui::SetNextWindowPosCenter(ImGuiCond_FirstUseEver);
47  ImGuiWindowFlags win_flags = ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_AlwaysAutoResize;
48  bool keep_open = true;
49  ImGui::Begin(_LC("About", "Static collision debug"), &keep_open, win_flags);
50 
51  ImGui::Text("Terrain name: %s", App::GetGameContext()->GetTerrain()->getTerrainName().c_str());
52  ImGui::Text("Terrain size: %.2fx%.2f meters", App::GetGameContext()->GetTerrain()->getMaxTerrainSize().x, App::GetGameContext()->GetTerrain()->getMaxTerrainSize().z);
53  ImGui::Checkbox("Draw labels", &m_draw_labels);
54  ImGui::Checkbox("Draw label types", &m_labels_draw_types);
55  ImGui::Checkbox("Sources on labels", &m_labels_draw_sources);
56  ImGui::Separator();
57 
58  // EVENTBOX
59  ImGui::PushID("EVENTBOX");
60  ImGui::TextColored(COLOR_EVENTBOX, "EVENTBOX");
61  ImGui::Text("Num event boxes: %d", (int)App::GetGameContext()->GetTerrain()->GetCollisions()->getCollisionBoxes().size());
62  if (ImGui::Checkbox("Show event boxes", &m_draw_collision_boxes))
63  {
64  this->SetDrawEventBoxes(m_draw_collision_boxes);
65  }
66  ImGui::SetNextItemWidth(WIDTH_DRAWDIST);
67  if (ImGui::InputFloat("Draw distance (meters, 0=unlimited)", &m_collision_box_draw_distance))
68  {
69  for (Ogre::SceneNode* snode : m_collision_boxes)
70  {
71  snode->getAttachedObject(0)->setRenderingDistance(m_collision_box_draw_distance);
72  }
73  }
74  if (m_collision_boxes.size() > 0)
75  {
76  if (ImGui::Button("Dump debug meshes (performance)."))
77  {
78  this->ClearEventBoxVisuals();
79  }
80  }
81  ImGui::Separator();
82  ImGui::PopID(); // EVENTBOX
83 
84  // COLLMESH
85  ImGui::PushID("COLLMESH");
86  ImGui::TextColored(COLOR_COLLMESH, "COLLMESH");
87  ImGui::Text("Num collision meshes: %d (%d tris)",
88  (int)App::GetGameContext()->GetTerrain()->GetCollisions()->getCollisionMeshes().size(),
89  (int)App::GetGameContext()->GetTerrain()->GetCollisions()->getCollisionTriangles().size());
90  if (ImGui::Checkbox("Show collision meshes", &m_draw_collision_meshes))
91  {
92  this->SetDrawCollisionMeshes(m_draw_collision_meshes);
93  }
94  ImGui::SetNextItemWidth(WIDTH_DRAWDIST);
95  if (ImGui::InputFloat("Draw distance (meters, 0=unlimited)", &m_collision_mesh_draw_distance))
96  {
97  for (Ogre::SceneNode* snode : m_collision_meshes)
98  {
99  snode->getAttachedObject(0)->setRenderingDistance(m_collision_mesh_draw_distance);
100  }
101  }
102  if (m_collision_meshes.size() > 0)
103  {
104  if (ImGui::Button("Dump debug meshes (performance)."))
105  {
106  this->ClearCollisionMeshVisuals();
107  }
108  }
109  ImGui::Separator();
110  ImGui::PopID(); // COLLMESH
111 
112  // CELL
113  ImGui::PushID("CELL");
114  ImGui::Text("CELL");
115  ImGui::Text("Occupancy: ");
116  for (int i = 0; i <= 10; i+=1)
117  {
118  ImGui::SameLine();
119  float f = i / 10.f;
120  ImVec4 color(f * 2.0, 2.0 * (1.0 - f), 0.2, 0.7);
121  int tris = static_cast<int>(f*Collisions::CELL_BLOCKSIZE);
122  ImGui::TextColored(color, "%d ", tris);
123  }
124  ImGui::SetNextItemWidth(WIDTH_DRAWDIST);
125  if (ImGui::InputInt("Debug area extent (around character)", &m_cell_generator_distance_limit));
126  ImGui::SameLine();
127  ImGui::TextDisabled("(?)");
128  if (ImGui::IsItemHovered())
129  {
130  ImGui::BeginTooltip();
131  ImGui::Text("To save memory and FPS, only cells around the characters will be visualized");
132  ImGui::EndTooltip();
133  }
134  if (ImGui::Checkbox("Show lookup cells (warning: slow!)", &m_draw_collision_cells))
135  {
136  this->SetDrawCollisionCells(m_draw_collision_cells);
137  }
138  ImGui::SetNextItemWidth(WIDTH_DRAWDIST);
139  if (ImGui::InputFloat("Draw distance (meters, 0=unlimited)", &m_collision_cell_draw_distance))
140  {
141  for (Ogre::SceneNode* snode : m_collision_cells)
142  {
143  snode->getAttachedObject(0)->setRenderingDistance(m_collision_cell_draw_distance);
144  }
145  }
146  if (m_collision_grid_root)
147  {
148  if (ImGui::Button("Dump debug meshes (performance)."))
149  {
150  this->ClearCollisionCellVisuals();
151  }
152  }
153  ImGui::PopID(); // CELL
154 
155  m_is_hovered = ImGui::IsWindowHovered(ImGuiHoveredFlags_RootAndChildWindows);
157 
158  ImGui::End();
159 
160  if (!keep_open)
161  {
162  this->SetVisible(false);
163  }
164 
165  // only draw reasonably close labels
166  const Ogre::Vector3 cam_pos = App::GetCameraManager()->GetCameraNode()->getPosition();
167 
168  if (m_draw_labels && m_draw_collision_boxes)
169  {
170  for (const collision_box_t& cbox : App::GetGameContext()->GetTerrain()->GetCollisions()->getCollisionBoxes())
171  {
172  if (IsDistanceWithin(cam_pos, this->GetCollBoxWorldPos(cbox), m_collision_box_draw_distance))
173  {
174  this->DrawCollisionBoxDebugText(cbox);
175  }
176  }
177  }
178 
179  if (m_draw_labels && m_draw_collision_meshes)
180  {
181  for (const collision_mesh_t& cmesh : App::GetGameContext()->GetTerrain()->GetCollisions()->getCollisionMeshes())
182  {
183  if (IsDistanceWithin(cam_pos, cmesh.position, m_collision_mesh_draw_distance))
184  {
185  this->DrawCollisionMeshDebugText(cmesh);
186  }
187  }
188  }
189 }
190 
192 {
193  // Gather data
195 
196  // Create mesh
197  Ogre::ManualObject* debugmo = App::GetGfxScene()->GetSceneManager()->createManualObject();
198  debugmo->begin("tracks/debug/collision/triangle", RenderOperation::OT_TRIANGLE_LIST);
199  for (int i = 0; i < coll_mesh.collision_tri_count; i++)
200  {
201  collision_tri_t const& ctri = ctris[i + coll_mesh.collision_tri_start];
202  // The collision triangle vertices are in world coords, we want local coords.
203  debugmo->position(ctri.a - coll_mesh.position);
204  debugmo->position(ctri.b - coll_mesh.position);
205  debugmo->position(ctri.c - coll_mesh.position);
206  }
207  debugmo->end();
208  debugmo->setRenderingDistance(m_collision_mesh_draw_distance);
209  debugmo->setBoundingBox(AxisAlignedBox::BOX_INFINITE); // make infinite
210 
211  // Display mesh
212  SceneNode* debugsn = App::GetGfxScene()->GetSceneManager()->getRootSceneNode()->createChildSceneNode();
213  debugsn->setPosition(coll_mesh.position);
214  // NOTE: orientation and scale are already "baked" to the collision triangle positions, do not re-apply it here.
215  debugsn->attachObject(debugmo);
216 
217  // Submit mesh
218  m_collision_meshes.push_back(debugsn);
219 }
220 
222 {
223  int scripthandler = -1;
224  if (coll_box.eventsourcenum != -1)
226 
227  SceneNode* debugsn = App::GetGfxScene()->GetSceneManager()->getRootSceneNode()->createChildSceneNode();
228 
229  debugsn->setPosition(coll_box.center);
230  // box content
231  ManualObject* mo = App::GetGfxScene()->GetSceneManager()->createManualObject();
232  String matName = "tracks/debug/collision/box";
233  if (coll_box.virt && scripthandler == -1)
234  matName = "tracks/debug/eventbox/unused";
235  else if (coll_box.virt)
236  matName = "tracks/debug/eventbox/used";
237  AxisAlignedBox aa;
238  for (int i = 0; i < 8; i++)
239  {
240  aa.merge(coll_box.debug_verts[i]);
241  }
242  mo->begin(matName, Ogre::RenderOperation::OT_TRIANGLE_LIST);
243  mo->position(coll_box.debug_verts[0]);
244  mo->position(coll_box.debug_verts[1]);
245  mo->position(coll_box.debug_verts[2]);
246  mo->position(coll_box.debug_verts[3]);
247  mo->position(coll_box.debug_verts[4]);
248  mo->position(coll_box.debug_verts[5]);
249  mo->position(coll_box.debug_verts[6]);
250  mo->position(coll_box.debug_verts[7]);
251 
252  // front
253  mo->triangle(0, 1, 2);
254  mo->triangle(1, 3, 2);
255  // right side
256  mo->triangle(3, 1, 5);
257  mo->triangle(5, 7, 3);
258  // left side
259  mo->triangle(6, 4, 0);
260  mo->triangle(0, 2, 6);
261  // back side
262  mo->triangle(7, 5, 4);
263  mo->triangle(4, 6, 7);
264  // bottom
265  mo->triangle(5, 4, 1);
266  mo->triangle(4, 0, 1);
267  // top
268  mo->triangle(2, 3, 6);
269  mo->triangle(3, 7, 6);
270 
271  mo->end();
272  mo->setBoundingBox(aa);
273  mo->setRenderingDistance(200);
274  debugsn->attachObject(mo);
275 
276  // the border
277  mo = App::GetGfxScene()->GetSceneManager()->createManualObject();
278  mo->begin(matName, Ogre::RenderOperation::OT_LINE_LIST);
279  mo->position(coll_box.debug_verts[0]);
280  mo->position(coll_box.debug_verts[1]);
281  mo->position(coll_box.debug_verts[2]);
282  mo->position(coll_box.debug_verts[3]);
283  mo->position(coll_box.debug_verts[4]);
284  mo->position(coll_box.debug_verts[5]);
285  mo->position(coll_box.debug_verts[6]);
286  mo->position(coll_box.debug_verts[7]);
287  //front
288  mo->index(0); mo->index(1); mo->index(1); mo->index(3); mo->index(3); mo->index(2); mo->index(2); mo->index(0);
289  // right side
290  mo->index(1); mo->index(5); mo->index(5); mo->index(7); mo->index(7); mo->index(3); mo->index(3); mo->index(1);
291  // left side
292  mo->index(0); mo->index(2); mo->index(2); mo->index(6); mo->index(6); mo->index(4); mo->index(4); mo->index(0);
293  // back side
294  mo->index(5); mo->index(4); mo->index(4); mo->index(6); mo->index(6); mo->index(7); mo->index(7); mo->index(5);
295  // bottom and top not needed
296  mo->end();
297  mo->setBoundingBox(aa);
298  debugsn->attachObject(mo);
299  mo->setRenderingDistance(200);
300 
301  m_collision_boxes.push_back(debugsn);
302 }
303 
305 {
306  return Vector3(coll_box.lo + (coll_box.hi - coll_box.lo) * 0.5f);
307 }
308 
310 {
311  const char* label_type_str = (m_labels_draw_types) ? "COLLMESH\n" : "";
312  const char* ground_model_str = (coll_mesh.ground_model) ? coll_mesh.ground_model->name : "(multiple)";
313 
314  std::string caption = fmt::format("{}meshname:{}\ngroundmodel:{}",
315  label_type_str, coll_mesh.mesh_name, ground_model_str);
316  if (m_labels_draw_sources)
317  {
318  caption += fmt::format("\nsource:{}", coll_mesh.source_name);
319  }
320 
321  this->DrawLabelAtWorldPos(caption, coll_mesh.position, COLOR_COLLMESH);
322 }
323 
325 {
326  if (!coll_box.virt || coll_box.eventsourcenum == -1)
327  return;
328 
330  const char* type_str = (m_labels_draw_types) ? "EVENTBOX\n" : "";
331 
332  std::string label = fmt::format("{}event: {}\ninstance: {}\nhandler: {}", type_str,
333  eventsource.es_box_name, eventsource.es_instance_name, eventsource.es_script_handler);
334 
335  switch (coll_box.event_filter)
336  {
338  label += "\nfilter: avatar";
339  break;
341  label += "\nfilter: truck";
342  break;
344  label += "\nfilter: truck_wheels";
345  break;
347  label += "\nfilter: airplane";
348  break;
350  label += "\nfilter: boat";
351  break;
352  default:;
353  }
354 
355  this->DrawLabelAtWorldPos(label, this->GetCollBoxWorldPos(coll_box), COLOR_EVENTBOX);
356 }
357 
358 void CollisionsDebug::DrawLabelAtWorldPos(std::string const& caption, Ogre::Vector3 const& world_pos, ImVec4 const& text_color)
359 {
360  // ----- BEGIN COPYPASTE FROM GfxScene::DrawNetLabel ----
361 
362  ImVec2 screen_size = ImGui::GetIO().DisplaySize;
363  World2ScreenConverter world2screen(
364  App::GetCameraManager()->GetCamera()->getViewMatrix(true), App::GetCameraManager()->GetCamera()->getProjectionMatrix(), Ogre::Vector2(screen_size.x, screen_size.y));
365 
366  Ogre::Vector3 pos_xyz = world2screen.Convert(world_pos);
367 
368  // only draw when in front of camera
369  if (pos_xyz.z < 0.f)
370  {
371  // Align position to whole pixels, to minimize jitter.
372  ImVec2 pos((int)pos_xyz.x + 0.5, (int)pos_xyz.y + 0.5);
373 
374  ImVec2 text_size = ImGui::CalcTextSize(caption.c_str());
376 
377  ImDrawList* drawlist = GetImDummyFullscreenWindow();
378  ImGuiContext* g = ImGui::GetCurrentContext();
379 
380  ImVec2 text_pos(pos.x - ((text_size.x / 2)), pos.y - ((text_size.y / 2)));
381 
382  // Draw background rectangle
383  const float PADDING = 4.f;
384  drawlist->AddRectFilled(
385  text_pos - ImVec2(PADDING, PADDING),
386  text_pos + text_size + ImVec2(PADDING, PADDING),
387  ImColor(theme.semitransparent_window_bg),
388  ImGui::GetStyle().WindowRounding);
389 
390  // draw colored text
391  drawlist->AddText(g->Font, g->FontSize, text_pos, ImColor(text_color), caption.c_str());
392  }
393  // ---- END COPYPASTE ----
394 }
395 
397 {
398  // EVENTBOX
399  this->ClearEventBoxVisuals();
400 
401  // COLLMESH
402  this->ClearCollisionMeshVisuals();
403 
404  // CELLS
405  this->ClearCollisionCellVisuals();
406 }
407 
409 {
410  if (MaterialManager::getSingleton().getByName("mat-coll-dbg-0", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME))
411  {
412  return; // already generated before
413  }
414 
415  // create materials
416  int i = 0;
417  char bname[256];
418  for (i = 0; i <= 100; i++)
419  {
420  // register a material for skeleton view
421  sprintf(bname, "mat-coll-dbg-%d", i);
422  MaterialPtr mat = (MaterialPtr)(MaterialManager::getSingleton().create(bname, ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME));
423  float f = fabs(((float)i) / 100);
424  Pass* p = mat->getTechnique(0)->getPass(0); //
425  p->createTextureUnitState()->setColourOperationEx(LBX_MODULATE, LBS_MANUAL, LBS_CURRENT, ColourValue(f * 2.0, 2.0 * (1.0 - f), 0.2, 0.7));
426  p->setSceneBlending(Ogre::SBT_TRANSPARENT_ALPHA);
427  p->setLightingEnabled(false);
428  p->setDepthWriteEnabled(false);
429  p->setDepthBias(3, 3);
430  p->setCullingMode(Ogre::CULL_NONE);
431 
432  Pass* p2 = mat->getTechnique(0)->createPass();
433  p2->setSceneBlending(Ogre::SBT_TRANSPARENT_ALPHA);
434  p2->setLightingEnabled(false);
435  p2->setDepthWriteEnabled(false);
436  p2->setDepthBias(3, 3);
437  p2->setCullingMode(Ogre::CULL_NONE);
438  p2->setSceneBlending(Ogre::SBT_TRANSPARENT_ALPHA);
439  TextureUnitState* tus2 = p2->createTextureUnitState();
440  tus2->setTextureName("tile.png");
441 
442 
443  mat->setLightingEnabled(false);
444  mat->setReceiveShadows(false);
445  }
446 }
447 
449 {
450  m_draw_collision_boxes = val;
451 
452  // Initial fill
453  if (m_draw_collision_boxes && m_collision_boxes.size() == 0)
454  {
455  for (const collision_box_t& cbox : App::GetGameContext()->GetTerrain()->GetCollisions()->getCollisionBoxes())
456  {
457  this->AddCollisionBoxDebugMesh(cbox);
458  }
459  }
460  // Update visibility
461  for (Ogre::SceneNode* snode : m_collision_boxes)
462  {
463  snode->setVisible(m_draw_collision_boxes);
464  }
465 }
466 
468 {
469  m_draw_collision_meshes = val;
470 
471  // Initial setup
472  if (m_draw_collision_meshes && m_collision_meshes.size() == 0)
473  {
474  for (const collision_mesh_t& cmesh : App::GetGameContext()->GetTerrain()->GetCollisions()->getCollisionMeshes())
475  {
476  this->AddCollisionMeshDebugMesh(cmesh);
477  }
478  }
479  // Update visibility
480  for (Ogre::SceneNode* snode : m_collision_meshes)
481  {
482  snode->setVisible(m_draw_collision_meshes);
483  }
484 }
485 
487 {
488  m_draw_collision_cells = val;
489 
490  // Initial setup
491  if (m_draw_collision_cells && !m_collision_grid_root)
492  {
493  this->GenerateCellDebugMaterials();
494  m_collision_grid_root = App::GetGfxScene()->GetSceneManager()->getRootSceneNode()->createChildSceneNode();
495  // For memory (including VRAM) and performance reasons, only generate meshes up to a certain distance from the character.
496  AxisAlignedBox aabb;
497  aabb.setMinimum(App::GetGameContext()->GetPlayerCharacter()->getPosition() + Ogre::Vector3(-m_cell_generator_distance_limit, 0, -m_cell_generator_distance_limit));
498  aabb.getMinimum().y = -FLT_MAX; // vertical axis
499  aabb.setMaximum(App::GetGameContext()->GetPlayerCharacter()->getPosition() + Ogre::Vector3(m_cell_generator_distance_limit, 0, m_cell_generator_distance_limit));
500  aabb.getMaximum().y = FLT_MAX; // vertical axis
501  try
502  {
503  App::GetGameContext()->GetTerrain()->GetCollisions()->createCollisionDebugVisualization(m_collision_grid_root, aabb, m_collision_cells);
504  }
505  catch (std::bad_alloc const& allocex)
506  {
508  fmt::format("Could not create debug view, error: {}", allocex.what()));
509  this->ClearCollisionCellVisuals();
510  }
511  }
512  // Update visibility
513  if (m_collision_grid_root)
514  {
515  m_collision_grid_root->setVisible(m_draw_collision_cells);
516  }
517 }
518 
520 {
521  for (Ogre::SceneNode* snode : m_collision_meshes)
522  {
523  Entity* ent = static_cast<Entity*>(snode->getAttachedObject(0));
524  App::GetGfxScene()->GetSceneManager()->destroyEntity(ent);
525  App::GetGfxScene()->GetSceneManager()->destroySceneNode(snode);
526  }
527  m_collision_meshes.clear();
528  m_draw_collision_meshes = false;
529  m_collision_mesh_draw_distance = DEFAULT_DRAWDIST;
530 }
531 
533 {
534  for (Ogre::SceneNode* snode : m_collision_boxes)
535  {
536  Entity* ent = static_cast<Entity*>(snode->getAttachedObject(0));
537  App::GetGfxScene()->GetSceneManager()->destroyEntity(ent);
538  App::GetGfxScene()->GetSceneManager()->destroySceneNode(snode);
539  }
540  m_collision_boxes.clear();
541  m_draw_collision_boxes = false;
542  m_collision_box_draw_distance = DEFAULT_DRAWDIST;
543 }
544 
546 {
547  for (Ogre::SceneNode* snode : m_collision_cells)
548  {
549  ManualObject* mo = static_cast<ManualObject*>(snode->getAttachedObject(0));
550  App::GetGfxScene()->GetSceneManager()->destroyManualObject(mo);
551  }
552  m_collision_cells.clear();
553  m_draw_collision_cells = false;
554  m_collision_cell_draw_distance = DEFAULT_DRAWDIST;
555 
556  if (m_collision_grid_root)
557  {
558  m_collision_grid_root->removeAndDestroyAllChildren();
559  App::GetGfxScene()->GetSceneManager()->destroySceneNode(m_collision_grid_root);
560  m_collision_grid_root = nullptr;
561  }
562 }
563 
565 {
566  if (!v)
567  {
568  this->SetDrawEventBoxes(false);
569  this->SetDrawCollisionMeshes(false);
570  this->SetDrawCollisionCells(false);
571  }
572  m_is_visible = v;
573 }
GameContext.h
Game state manager and message-queue provider.
RoR::GUI::CollisionsDebug::GenerateCellDebugMaterials
void GenerateCellDebugMaterials()
Definition: GUI_CollisionsDebug.cpp:408
RoR::GUIManager::GuiTheme
Definition: GUIManager.h:68
RoR::EVENT_AIRPLANE
@ EVENT_AIRPLANE
'airplane' ~ Triggered by any node of airplane (ActorType::AIRPLANE)
Definition: SimData.h:53
RoR::App::GetCameraManager
CameraManager * GetCameraManager()
Definition: Application.cpp:275
RoR::GUI::CollisionsDebug::ClearEventBoxVisuals
void ClearEventBoxVisuals()
Definition: GUI_CollisionsDebug.cpp:532
RoR::collision_tri_t
Definition: Collisions.h:50
RoR::App::GetGuiManager
GUIManager * GetGuiManager()
Definition: Application.cpp:269
RoR::EVENT_TRUCK_WHEELS
@ EVENT_TRUCK_WHEELS
'truck_wheels' ~ Triggered only by wheel nodes of land vehicle (ActorType::TRUCK)
Definition: SimData.h:52
RoR::collision_box_t::virt
bool virt
Definition: SimData.h:716
RoR::eventsource_t::es_instance_name
std::string es_instance_name
Specified by user when calling "GameScript::spawnObject()".
Definition: Collisions.h:42
z
float z
Definition: (ValueTypes) quaternion.h:7
RoR::collision_mesh_t
Records which collision triangles belong to which mesh.
Definition: Collisions.h:64
RoR::GUI::CollisionsDebug::SetDrawEventBoxes
void SetDrawEventBoxes(bool val)
Definition: GUI_CollisionsDebug.cpp:448
RoR::eventsource_t
< Scripting
Definition: Collisions.h:40
format
Truck file format(technical spec)
RoR::collision_box_t::lo
Ogre::Vector3 lo
absolute collision box
Definition: SimData.h:723
GUIUtils.h
RoR::collision_box_t::eventsourcenum
short eventsourcenum
Definition: SimData.h:722
RoR::collision_box_t::hi
Ogre::Vector3 hi
absolute collision box
Definition: SimData.h:724
RoR::Collisions::CELL_BLOCKSIZE
static const int CELL_BLOCKSIZE
Definition: Collisions.h:170
RoR::Collisions::getCollisionTriangles
CollisionTriVec const & getCollisionTriangles() const
Definition: Collisions.h:220
RoR::EVENT_BOAT
@ EVENT_BOAT
'boat' ~ Triggered by any node of boats (ActorType::BOAT)
Definition: SimData.h:54
RoR::Console::putMessage
void putMessage(MessageArea area, MessageType type, std::string const &msg, std::string icon="")
Definition: Console.cpp:97
RoR::EVENT_AVATAR
@ EVENT_AVATAR
'avatar' ~ Triggered by the character only
Definition: SimData.h:50
RoR::CameraManager::GetCameraNode
Ogre::SceneNode * GetCameraNode()
Definition: CameraManager.h:63
Utils.h
Language.h
RoR::GUIManager::GuiTheme::semitransparent_window_bg
ImVec4 semitransparent_window_bg
Definition: GUIManager.h:81
RoR::collision_box_t
Definition: SimData.h:714
RoR::World2ScreenConverter::Convert
Ogre::Vector3 Convert(Ogre::Vector3 world_pos)
Definition: Utils.h:89
RoR::Console::CONSOLE_SYSTEM_ERROR
@ CONSOLE_SYSTEM_ERROR
Definition: Console.h:52
GUIManager.h
RoR::EVENT_TRUCK
@ EVENT_TRUCK
'truck' ~ Triggered by any node of land vehicle (ActorType::TRUCK)
Definition: SimData.h:51
RoR::GUI::CollisionsDebug::DrawCollisionBoxDebugText
void DrawCollisionBoxDebugText(collision_box_t const &coll_box)
Definition: GUI_CollisionsDebug.cpp:324
RoR::collision_box_t::center
Ogre::Vector3 center
center of rotation
Definition: SimData.h:725
RoR::GfxScene::GetSceneManager
Ogre::SceneManager * GetSceneManager()
Definition: GfxScene.h:64
RoR::GUI::CollisionsDebug::ClearCollisionMeshVisuals
void ClearCollisionMeshVisuals()
Definition: GUI_CollisionsDebug.cpp:519
RoR::collision_tri_t::a
Ogre::Vector3 a
Definition: Collisions.h:52
RoR::GetImDummyFullscreenWindow
ImDrawList * GetImDummyFullscreenWindow(const std::string &name="RoR_TransparentFullscreenWindow")
Definition: GUIUtils.cpp:356
RoR::collision_box_t::event_filter
CollisionEventFilter event_filter
Definition: SimData.h:721
RoR::collision_mesh_t::collision_tri_count
int collision_tri_count
Definition: Collisions.h:74
RoR::GUIManager::GetTheme
GuiTheme & GetTheme()
Definition: GUIManager.h:154
RoR::GUI::CollisionsDebug::AddCollisionBoxDebugMesh
void AddCollisionBoxDebugMesh(collision_box_t const &coll_box)
Definition: GUI_CollisionsDebug.cpp:221
RoR::collision_mesh_t::collision_tri_start
int collision_tri_start
Definition: Collisions.h:73
RoR::GUI::CollisionsDebug::DrawCollisionMeshDebugText
void DrawCollisionMeshDebugText(collision_mesh_t const &coll_mesh)
Definition: GUI_CollisionsDebug.cpp:309
RoR::GUI::CollisionsDebug::AddCollisionMeshDebugMesh
void AddCollisionMeshDebugMesh(collision_mesh_t const &coll_mesh)
Definition: GUI_CollisionsDebug.cpp:191
RoR::GUI::CollisionsDebug::ClearCollisionCellVisuals
void ClearCollisionCellVisuals()
Definition: GUI_CollisionsDebug.cpp:545
RoR::eventsource_t::es_box_name
std::string es_box_name
Specified in ODEF file as "event".
Definition: Collisions.h:43
RoR::World2ScreenConverter
< Keeps data close for faster access.
Definition: Utils.h:81
RoR::collision_mesh_t::ground_model
ground_model_t * ground_model
Definition: Collisions.h:72
RoR::Terrain::GetCollisions
Collisions * GetCollisions()
Definition: Terrain.h:83
GfxScene.h
Application.h
Central state/object manager and communications hub.
RoR::App::GetConsole
Console * GetConsole()
Definition: Application.cpp:270
RoR::GUI::CollisionsDebug::Draw
void Draw()
Definition: GUI_CollisionsDebug.cpp:42
RoR::App::GetGameContext
GameContext * GetGameContext()
Definition: Application.cpp:280
RoR::ground_model_t::name
char name[256]
Definition: SimData.h:763
RoR::GUI::CollisionsDebug::DrawLabelAtWorldPos
void DrawLabelAtWorldPos(std::string const &caption, Ogre::Vector3 const &world_pos, ImVec4 const &text_color)
Definition: GUI_CollisionsDebug.cpp:358
RoRVersion.h
RoR::eventsource_t::es_script_handler
int es_script_handler
AngelScript function ID.
Definition: Collisions.h:45
RoR::CollisionTriVec
std::vector< collision_tri_t > CollisionTriVec
Definition: Collisions.h:61
_LC
#define _LC(ctx, str)
Definition: Language.h:42
RoR::Collisions::createCollisionDebugVisualization
void createCollisionDebugVisualization(Ogre::SceneNode *root_node, Ogre::AxisAlignedBox const &area_limit, std::vector< Ogre::SceneNode * > &out_nodes)
Definition: Collisions.cpp:1314
RoR::GUI::CollisionsDebug::SetVisible
void SetVisible(bool v)
Definition: GUI_CollisionsDebug.cpp:564
RoR::GUI::CollisionsDebug::CleanUp
void CleanUp()
Definition: GUI_CollisionsDebug.cpp:396
RoR::Collisions::getEventSource
eventsource_t & getEventSource(int pos)
Definition: Collisions.h:217
RoR::GUI::CollisionsDebug::SetDrawCollisionMeshes
void SetDrawCollisionMeshes(bool val)
Definition: GUI_CollisionsDebug.cpp:467
Terrain.h
RoR::collision_tri_t::b
Ogre::Vector3 b
Definition: Collisions.h:53
RoR::collision_box_t::debug_verts
Ogre::Vector3 debug_verts[8]
box corners in absolute world position
Definition: SimData.h:734
Ogre
Definition: ExtinguishableFireAffector.cpp:35
RoR::Console::CONSOLE_MSGTYPE_INFO
@ CONSOLE_MSGTYPE_INFO
Generic message.
Definition: Console.h:60
RoR::GUI::CollisionsDebug::GetCollBoxWorldPos
Ogre::Vector3 GetCollBoxWorldPos(collision_box_t const &coll_box)
Definition: GUI_CollisionsDebug.cpp:304
Collisions.h
RoR::collision_mesh_t::source_name
std::string source_name
Definition: Collisions.h:67
RoR::GUI::CollisionsDebug::SetDrawCollisionCells
void SetDrawCollisionCells(bool val)
Definition: GUI_CollisionsDebug.cpp:486
RoR::collision_tri_t::c
Ogre::Vector3 c
Definition: Collisions.h:54
RoR::GUIManager::RequestGuiCaptureKeyboard
void RequestGuiCaptureKeyboard(bool val)
Pass true during frame to prevent input passing to application.
Definition: GUIManager.cpp:439
RoR
Definition: AppContext.h:36
x
float x
Definition: (ValueTypes) quaternion.h:5
RoR::App::GetGfxScene
GfxScene * GetGfxScene()
Definition: Application.cpp:276
RoR::collision_mesh_t::position
Ogre::Vector3 position
Definition: Collisions.h:68
GUI_CollisionsDebug.h
RoR::IsDistanceWithin
bool IsDistanceWithin(Ogre::Vector3 const &a, Ogre::Vector3 const &b, float max)
Definition: Utils.cpp:158
RoR::collision_mesh_t::mesh_name
std::string mesh_name
Definition: Collisions.h:66
RoR::GameContext::GetTerrain
const TerrainPtr & GetTerrain()
Definition: GameContext.h:117