RigsofRods
Soft-body Physics Simulation
GUI_FlexbodyDebug.h
Go to the documentation of this file.
1 /*
2  This source file is part of Rigs of Rods
3  Copyright 2022 Petr Ohlidal
4 
5  For more information, see http://www.rigsofrods.org/
6 
7  Rigs of Rods is free software: you can redistribute it and/or modify
8  it under the terms of the GNU General Public License version 3, as
9  published by the Free Software Foundation.
10 
11  Rigs of Rods is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with Rigs of Rods. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
21 
22 #pragma once
23 
24 #include "Application.h"
25 
26 #include "SimData.h"
27 
28 namespace RoR {
29 namespace GUI {
30 
33 {
34 public:
35  bool IsVisible() const { return m_is_visible; }
36  bool IsHovered() const { return m_is_hovered; }
37  void SetVisible(bool value) { m_is_visible = value; m_is_hovered = false; }
38  void Draw();
40 
41  void AnalyzeFlexbodies();
42  void DrawDebugView(FlexBody* flexbody, Prop* prop, NodeNum_t node_ref, NodeNum_t node_x, NodeNum_t node_y);
43 
44 private:
45 
46  void UpdateVisibility();
47  void DrawMemoryOrderGraph(FlexBody* flexbody);
48  void DrawLocatorsTable(FlexBody* flexbody, bool& locators_visible);
49  void DrawMeshInfo(FlexBody* flexbody);
50  void DrawMeshInfo(Prop* prop);
51 
52  // Display options
53  bool draw_mesh_wireframe = false;
54  bool show_base_nodes = false;
55  bool show_forset_nodes = false;
56  bool show_vertices = false;
57  bool hide_other_elements = false;
58  std::vector<bool> show_locator;
59 
60  // Flexbody and prop selection combobox
61  std::string m_combo_items;
64 
65  // Window state
66  bool m_is_visible = false;
67  bool m_is_hovered = false;
68 };
69 
70 } // namespace GUI
71 } // namespace RoR
RoR::GUI::FlexbodyDebug::UpdateVisibility
void UpdateVisibility()
Definition: GUI_FlexbodyDebug.cpp:439
RoR::GUI::FlexbodyDebug::show_vertices
bool show_vertices
Definition: GUI_FlexbodyDebug.h:56
RoR::GUI::FlexbodyDebug::m_is_visible
bool m_is_visible
Definition: GUI_FlexbodyDebug.h:66
RoR::GUI::FlexbodyDebug::IsHovered
bool IsHovered() const
Definition: GUI_FlexbodyDebug.h:36
RoR::GUI::FlexbodyDebug::show_locator
std::vector< bool > show_locator
Definition: GUI_FlexbodyDebug.h:58
RoR::GUI::FlexbodyDebug::m_combo_selection
int m_combo_selection
Definition: GUI_FlexbodyDebug.h:63
RoR::GUI::FlexbodyDebug::hide_other_elements
bool hide_other_elements
Definition: GUI_FlexbodyDebug.h:57
RoR::NodeNum_t
uint16_t NodeNum_t
Node position within Actor::ar_nodes; use RoR::NODENUM_INVALID as empty value.
Definition: ForwardDeclarations.h:52
RoR::GUI::FlexbodyDebug
Flexbody and prop diagnostic.
Definition: GUI_FlexbodyDebug.h:32
SimData.h
Core data structures for simulation; Everything affected by by either physics, network or user intera...
RoR::GUI::FlexbodyDebug::IsVisible
bool IsVisible() const
Definition: GUI_FlexbodyDebug.h:35
RoR::GUI::FlexbodyDebug::m_is_hovered
bool m_is_hovered
Definition: GUI_FlexbodyDebug.h:67
RoR::Prop
A mesh attached to vehicle frame via 3 nodes.
Definition: GfxData.h:160
RoR::GUI::FlexbodyDebug::Draw
void Draw()
Definition: GUI_FlexbodyDebug.cpp:40
Application.h
Central state/object manager and communications hub.
RoR::GUI::FlexbodyDebug::m_combo_items
std::string m_combo_items
Flexbodies come first, props second.
Definition: GUI_FlexbodyDebug.h:61
RoR::GUI::FlexbodyDebug::m_combo_props_start
int m_combo_props_start
Index of first prop in the combobox. -1 means no props.
Definition: GUI_FlexbodyDebug.h:62
RoR::GUI::FlexbodyDebug::SetVisible
void SetVisible(bool value)
Definition: GUI_FlexbodyDebug.h:37
RoR::GUI::FlexbodyDebug::AnalyzeFlexbodies
void AnalyzeFlexbodies()
populates the combobox
Definition: GUI_FlexbodyDebug.cpp:174
RoR::GUI::FlexbodyDebug::DrawLocatorsTable
void DrawLocatorsTable(FlexBody *flexbody, bool &locators_visible)
Definition: GUI_FlexbodyDebug.cpp:503
RoR::GUI::FlexbodyDebug::show_forset_nodes
bool show_forset_nodes
Definition: GUI_FlexbodyDebug.h:55
RoR::GUI::FlexbodyDebug::DrawMeshInfo
void DrawMeshInfo(FlexBody *flexbody)
Definition: GUI_FlexbodyDebug.cpp:637
RoR::GUI::FlexbodyDebug::IsHideOtherElementsModeActive
bool IsHideOtherElementsModeActive() const
Definition: GUI_FlexbodyDebug.h:39
RoR::GUI::FlexbodyDebug::show_base_nodes
bool show_base_nodes
Definition: GUI_FlexbodyDebug.h:54
RoR::FlexBody
Flexbody = A deformable mesh; updated on CPU every frame, then uploaded to video memory.
Definition: FlexBody.h:43
RoR
Definition: AppContext.h:36
RoR::GUI::FlexbodyDebug::DrawMemoryOrderGraph
void DrawMemoryOrderGraph(FlexBody *flexbody)
Definition: GUI_FlexbodyDebug.cpp:556
RoR::GUI::FlexbodyDebug::DrawDebugView
void DrawDebugView(FlexBody *flexbody, Prop *prop, NodeNum_t node_ref, NodeNum_t node_x, NodeNum_t node_y)
Definition: GUI_FlexbodyDebug.cpp:280
RoR::GUI::FlexbodyDebug::draw_mesh_wireframe
bool draw_mesh_wireframe
Definition: GUI_FlexbodyDebug.h:53