Skip to content
Snippets Groups Projects
Commit 2c18cf30 authored by Pascal Engeler's avatar Pascal Engeler
Browse files

generate opengl handles, renormalize z data

parent 923ad47b
No related branches found
No related tags found
No related merge requests found
......@@ -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 {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment