Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
nt1100 analyser
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
nt1100 analyser
Commits
8c158d48
Commit
8c158d48
authored
2 years ago
by
Pascal Engeler
Browse files
Options
Downloads
Patches
Plain Diff
Fixed leveler
parent
baef481f
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
src/main.cpp
+13
-3
13 additions, 3 deletions
src/main.cpp
with
13 additions
and
3 deletions
src/main.cpp
+
13
−
3
View file @
8c158d48
...
...
@@ -44,7 +44,6 @@ int main(int argc, char** argv) {
std
::
cout
<<
"Loading Heightmap"
<<
std
::
endl
<<
std
::
flush
;
heightmaps
.
push_back
(
ResourceManager
::
fetch_heightmap
(
std
::
string
(
HEIGHTMAP_LOC
)
+
"drum1.asc"
));
float
zRangeUmReference
=
heightmaps
.
back
()
->
zRangeUm
();
positions
.
push_back
(
glm
::
vec3
(
-
0.5
,
-
0.5
,
0
));
positions
.
push_back
(
glm
::
vec3
(
0.0
,
0.0
,
0
));
models
.
push_back
(
glm
::
translate
(
scale_z
(
heightmaps
.
back
()
->
minZ
(),
scale
),
positions
.
back
()));
std
::
cout
<<
"Loading complete"
<<
std
::
endl
<<
std
::
flush
;
...
...
@@ -138,7 +137,7 @@ int main(int argc, char** argv) {
}
ImGui
::
BeginTooltip
();
std
::
string
tool_tip_str
=
"Height ("
;
tool_tip_str
+=
(
height_measured
!=
NOT_ON_SURFACE
)
?
std
::
to_string
(
hmap_hovered_index
)
+
"): "
:
"-1"
;
tool_tip_str
+=
(
height_measured
!=
NOT_ON_SURFACE
)
?
std
::
to_string
(
hmap_hovered_index
)
+
"): "
:
"-1
):
"
;
tool_tip_str
+=
(
height_measured
!=
NOT_ON_SURFACE
)
?
std
::
to_string
(
height_measured
)
+
" um"
:
"N/A"
;
ImGui
::
Text
(
tool_tip_str
.
c_str
());
ImGui
::
EndTooltip
();
...
...
@@ -151,7 +150,18 @@ int main(int argc, char** argv) {
//get highlighting point
glm
::
vec2
mowopos
=
camera
.
GetWorldXyFromMouse
(
InputState
::
mpos_x
,
InputState
::
mpos_y
);
if
(
InputState
::
lmb_click
&&
height_measured
!=
NOT_ON_SURFACE
)
{
//Have new point
Leveler
::
place
(
mowopos
);
//transform coordinates from world to model
glm
::
vec4
p_world
(
mowopos
[
0
],
mowopos
[
1
],
0.
f
,
1.
f
);
glm
::
vec4
p_model
=
glm
::
inverse
(
models
[
hmap_hovered_index
])
*
p_world
;
p_model
[
2
]
=
heightmaps
[
hmap_hovered_index
]
->
getAverageSurfaceHeight
(
glm
::
vec2
(
p_model
[
0
],
p_model
[
1
]));
p_world
=
models
[
hmap_hovered_index
]
*
p_model
;
Leveler
::
place
(
glm
::
vec3
(
p_world
[
0
],
p_world
[
1
],
p_world
[
2
]),
glm
::
inverse
(
models
[
hmap_hovered_index
]));
if
(
Leveler
::
transformationValid
)
{
models
[
hmap_hovered_index
]
=
Leveler
::
transformation
*
models
[
hmap_hovered_index
];
heightmaps
[
hmap_hovered_index
]
->
setZRangeUmOffset
(
height_measured
);
heightmaps
[
hmap_hovered_index
]
->
calculateNewZRange
(
Leveler
::
rotation
);
heightmaps
[
hmap_hovered_index
]
->
setModelspaceRot
(
Leveler
::
rotation
);
}
}
for
(
auto
heightmap
:
heightmaps
)
{
//highlight selection
heightmap
->
enableHighlighting
(
mowopos
);
...
...
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