Rigs of Rods 2023.09
Soft-body Physics Simulation
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Loading...
Searching...
No Matches
GUI_CollisionsDebug.h
Go to the documentation of this file.
1/*
2 This source file is part of Rigs of Rods
3 Copyright 2005-2012 Pierre-Michel Ricordel
4 Copyright 2007-2012 Thomas Fischer
5 Copyright 2013-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
24
25#pragma once
26
27#include "Collisions.h"
28#include "ForwardDeclarations.h"
29
30#include <Ogre.h>
31#include <vector>
32#include "imgui.h"
33
34namespace RoR {
35namespace GUI {
36
39{
40public:
41 const ImVec4 COLOR_EVENTBOX = ImVec4(181/255.f, 51/255.f, 64/255.f, 1.f);
42 const ImVec4 COLOR_COLLMESH = ImVec4(209/255.f, 109/255.f, 44/255.f, 1.f);
43 const float WIDTH_DRAWDIST = 75.f;
44 const float DEFAULT_DRAWDIST = 200.f;
45
46 void SetVisible(bool v);
47 bool IsVisible() const { return m_is_visible; }
48 bool IsHovered() const { return IsVisible() && m_is_hovered; }
49
50 void Draw();
51 void CleanUp();
52
53 // EVENTBOX
54 void SetDrawEventBoxes(bool val);
55 void AddCollisionBoxDebugMesh(collision_box_t const& coll_box);
56 void DrawCollisionBoxDebugText(collision_box_t const& coll_box);
57 Ogre::Vector3 GetCollBoxWorldPos(collision_box_t const& coll_box);
59
60 // COLLMESH
61 void SetDrawCollisionMeshes(bool val);
62 void AddCollisionMeshDebugMesh(collision_mesh_t const& coll_mesh);
63 void DrawCollisionMeshDebugText(collision_mesh_t const& coll_mesh);
65
66 // CELL
67 void SetDrawCollisionCells(bool val);
69
70private:
71
72 void DrawLabelAtWorldPos(std::string const& caption, Ogre::Vector3 const& world_pos, ImVec4 const& text_color);
74
75 // EVENTBOX
76 std::vector<Ogre::SceneNode*> m_collision_boxes;
79
80 // COLLMESH
81 std::vector<Ogre::SceneNode*> m_collision_meshes;
84
85 // CELL
86 std::vector<Ogre::SceneNode*> m_collision_cells;
87 Ogre::SceneNode* m_collision_grid_root = nullptr;
90 int m_cell_generator_distance_limit = 50; // meters from character, to reduce memory load.
91
92 bool m_draw_labels = true;
95 bool m_is_visible = false;
96 bool m_is_hovered = false;
97};
98
99} // namespace GUI
100} // namespace RoR
Global forward declarations.
Diagnostic view for static terrain collisions and script event-boxes.
void DrawCollisionMeshDebugText(collision_mesh_t const &coll_mesh)
void AddCollisionMeshDebugMesh(collision_mesh_t const &coll_mesh)
std::vector< Ogre::SceneNode * > m_collision_cells
void DrawLabelAtWorldPos(std::string const &caption, Ogre::Vector3 const &world_pos, ImVec4 const &text_color)
Ogre::SceneNode * m_collision_grid_root
std::vector< Ogre::SceneNode * > m_collision_boxes
void AddCollisionBoxDebugMesh(collision_box_t const &coll_box)
Ogre::Vector3 GetCollBoxWorldPos(collision_box_t const &coll_box)
std::vector< Ogre::SceneNode * > m_collision_meshes
void DrawCollisionBoxDebugText(collision_box_t const &coll_box)
Records which collision triangles belong to which mesh.
Definition Collisions.h:65