Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RBComb Sample Visualizer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Pascal Engeler
RBComb Sample Visualizer
Commits
bfaeadff
Commit
bfaeadff
authored
1 year ago
by
Pascal Engeler
Browse files
Options
Downloads
Patches
Plain Diff
Added GUI windows, included metadata management, metadata path
parent
1cc91cc5
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
gui/src/main.cpp
+58
-18
58 additions, 18 deletions
gui/src/main.cpp
with
58 additions
and
18 deletions
gui/src/main.cpp
+
58
−
18
View file @
bfaeadff
...
...
@@ -6,9 +6,12 @@
#include
<imgui_bundle.hpp>
#include
<input_state.hpp>
#include
<selection_manager.hpp>
#include
<metadata_manager.hpp>
#include
<screendefs.hpp>
#define METADATA_PATH "C:\\Users\\Pascal\\repos\\rbcomb-sample-visualizer\\gui\\resources\\metadata\\"
int
main
(
int
argc
,
char
**
argv
)
{
/*Init Window and OpenGL Context*/
Infrastructure
infra
;
...
...
@@ -33,6 +36,7 @@ int main(int argc, char** argv) {
//Load layers
Layer
bottom_metal
(
"Bottom Metal"
,
"C:
\\
Users
\\
Pascal
\\
repos
\\
rbcomb-sample-visualizer
\\
data_generation
\\
python
\\
models
\\
bottom_metal_single
\\
bottom_metal.obj"
,
0.
f
);
MetadataManager
::
addLayer
(
bottom_metal
);
std
::
cout
<<
"Error Code: "
<<
glGetError
()
<<
std
::
endl
;
std
::
cout
<<
"GL_NO_ERROR: "
<<
GL_NO_ERROR
<<
std
::
endl
;
...
...
@@ -47,6 +51,8 @@ int main(int argc, char** argv) {
glm
::
mat4
view
=
camera
.
GetViewMatrix
();
glm
::
mat4
model
=
glm
::
mat4
(
1.0
f
);
int
draw_mode
=
0
;
size_t
count
=
0
;
auto
start
=
std
::
chrono
::
high_resolution_clock
::
now
();
while
(
!
InputState
::
should_quit
)
{
...
...
@@ -97,33 +103,68 @@ int main(int argc, char** argv) {
ImGui
::
Text
(
text
.
c_str
());
text
=
"Selected Object: "
+
std
::
to_string
(
SelectionManager
::
selectedIndex
);
ImGui
::
Text
(
text
.
c_str
());
int
object_status
;
text
=
"Status: "
;
ImGui
::
Text
(
text
.
c_str
());
ImGui
::
SameLine
();
ImGui
::
RadioButton
(
"Good"
,
&
object_status
,
0
);
ImGui
::
SameLine
();
ImGui
::
RadioButton
(
"Sketch"
,
&
object_status
,
1
);
ImGui
::
SameLine
();
ImGui
::
RadioButton
(
"Broken"
,
&
object_status
,
2
);
if
(
SelectionManager
::
selectedIndex
!=
-
1
)
{
int
object_status
=
MetadataManager
::
getData
(
SelectionManager
::
selectedLayerName
,
SelectionManager
::
selectedIndex
).
status
;
text
=
"Status: "
;
ImGui
::
Text
(
text
.
c_str
());
ImGui
::
SameLine
();
ImGui
::
RadioButton
(
"Good"
,
&
object_status
,
0
);
ImGui
::
SameLine
();
ImGui
::
RadioButton
(
"Sketch"
,
&
object_status
,
1
);
ImGui
::
SameLine
();
ImGui
::
RadioButton
(
"Broken"
,
&
object_status
,
2
);
if
(
object_status
!=
MetadataManager
::
getData
(
SelectionManager
::
selectedLayerName
,
SelectionManager
::
selectedIndex
).
status
)
{
MetadataManager
::
getData
(
SelectionManager
::
selectedLayerName
,
SelectionManager
::
selectedIndex
).
status
=
object_status
;
//Update layer data here, and push to GPU
if
(
SelectionManager
::
selectedLayerName
==
bottom_metal
.
name
())
{
bottom_metal
.
setObjectState
(
SelectionManager
::
selectedIndex
,
object_status
);
}
}
}
ImGui
::
End
();
//Data Window
ImGui
::
Begin
(
"Data"
);
//Layer Window
ImGui
::
Begin
(
"Layers"
);
text
=
"Layer: "
+
bottom_metal
.
name
();
ImGui
::
Text
(
text
.
c_str
());
text
=
"Objects: "
+
std
::
to_string
(
bottom_metal
.
numObjects
());
ImGui
::
Text
(
text
.
c_str
());
char
input_text
[
256
];
ImGui
::
InputText
(
"Metadata File"
,
input_text
,
IM_ARRAYSIZE
(
input_text
));
if
(
ImGui
::
Button
(
"Save"
))
{
std
::
string
path
=
METADATA_PATH
+
std
::
string
(
input_text
);
MetadataManager
::
save
(
path
,
bottom_metal
.
name
());
}
ImGui
::
SameLine
();
if
(
ImGui
::
Button
(
"Load"
))
{
std
::
string
path
=
METADATA_PATH
+
std
::
string
(
input_text
);
//load data
MetadataManager
::
load
(
path
,
bottom_metal
.
name
());
//push data to GPU
bottom_metal
.
setAllObjectStates
(
MetadataManager
::
getLayerData
(
bottom_metal
.
name
()));
}
/*
ImGui::Separator();
text = "Layer: " + bottom_drums.name();
ImGui::Text(text.c_str());
text = "Objects: " + std::to_string(bottom_drums.numObjects());
ImGui::Text(text.c_str());
char input_text[256];
ImGui
::
InputText
(
"
Filenam
e"
,
input_text
,
IM_ARRAYSIZE
(
input_text
));
ImGui::InputText("
Metadata Fil
e", input_text, IM_ARRAYSIZE(input_text));
if (ImGui::Button("Save")) {
//save file here
std::string path = METADATA_PATH + std::string(input_text);
MetadataManager::save(path, bottom_metal.name());
}
ImGui::SameLine();
if (ImGui::Button("Load")) {
//load file here
std::string path = METADATA_PATH + std::string(input_text);
MetadataManager::load(path, bottom_metal.name());
}
*/
ImGui
::
End
();
//Draw Window
ImGui
::
Begin
(
"Draw"
);
int
draw_mode
;
ImGui
::
RadioButton
(
"Realistic"
,
&
draw_mode
,
0
);
ImGui
::
RadioButton
(
"Identification"
,
&
draw_mode
,
1
);
ImGui
::
RadioButton
(
"Good"
,
&
draw_mode
,
2
);
...
...
@@ -142,8 +183,7 @@ int main(int argc, char** argv) {
/*Draw here*/
int
drawing_mode
=
0
;
//layer 0
//Metal layer
int
selected_index
=
-
1
;
if
(
SelectionManager
::
selectedLayerName
==
bottom_metal
.
name
())
{
selected_index
=
SelectionManager
::
selectedIndex
;
...
...
@@ -153,7 +193,7 @@ int main(int argc, char** argv) {
bottom_metal
.
draw
(
projection
,
view
,
model
,
tempDrawingMode
,
selected_index
);
}
else
{
bottom_metal
.
draw
(
projection
,
view
,
model
,
draw
ing
_mode
,
selected_index
);
bottom_metal
.
draw
(
projection
,
view
,
model
,
draw_mode
,
selected_index
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment