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
2c18cf30
Commit
2c18cf30
authored
2 years ago
by
Pascal Engeler
Browse files
Options
Downloads
Patches
Plain Diff
generate opengl handles, renormalize z data
parent
923ad47b
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/heightmap.cpp
+15
-0
15 additions, 0 deletions
src/heightmap.cpp
with
15 additions
and
0 deletions
src/heightmap.cpp
+
15
−
0
View file @
2c18cf30
...
...
@@ -52,9 +52,24 @@ Heightmap::Heightmap(std::string filename): _filename(filename) {
_maxY
=
max
(
_data
,
1
,
3
);
_minZ
=
min
(
_data
,
2
,
3
);
_maxZ
=
max
(
_data
,
2
,
3
);
_zRangeUm
=
(
_maxZ
-
_minZ
)
/
10.
;
//in um
/*Throw if _zRange is less than 1 A (i.e. it's probably 0)*/
if
(
_zRange
<
1e-4
)
{
throw
Nt1100_exception
(
"Heightmap: z range is too close to zero ("
+
std
::
to_string
(
_zRange
)
+
")"
);
}
/*TODO: Renormalize model coordinates sensible here*/
//For now, I just renormalize the z range to [0,1]
double
zRangeInverse
=
1.
/
(
_maxZ
-
_minZ
);
for
(
auto
it
=
_data
.
begin
()
+
2
;
it
<
_data
.
end
();
it
+=
3
)
{
*
it
-=
_minZ
;
*
it
*=
zRangeInverse
;
}
/*Initialize Renderer Infrastructure*/
glGenBuffers
(
1
,
&
_vbo
);
glGenBuffers
(
1
,
&
_ebo
);
glGenVertexArrays
(
1
,
&
_vao
);
/*TODO: Generate shader, I may want to use a Factory here*/
}
else
{
...
...
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