fixed issue with grid-generation

fixed issue with grid-drawing
added z-offset/scaler
This commit is contained in:
k-a-z-u
2018-01-24 15:39:44 +01:00
parent c975d49dd2
commit 3b9c80b194
3 changed files with 9 additions and 6 deletions

View File

@@ -113,7 +113,9 @@ void MapView3D::paintGL() {
// // 1) translate into center // // 1) translate into center
// glTranslatef(tra.x, tra.y, tra.z); // glTranslatef(tra.x, tra.y, tra.z);
draw(); if (gridModel) {
draw();
}
} }

View File

@@ -21,7 +21,7 @@ class GridModel {
private: private:
const int gridSize_cm = 40; // TODO const int gridSize_cm = 30; // TODO
Grid<MyNode> grid; Grid<MyNode> grid;
Floorplan::IndoorMap* im; Floorplan::IndoorMap* im;

View File

@@ -52,7 +52,8 @@ public:
glDisable(GL_LIGHTING); glDisable(GL_LIGHTING);
const float s = 2; const float sz = 1.0f; // scale-z: more/less z-spacing
const float oz = 0.1f; // z-offset
if (showEdges) { if (showEdges) {
std::unordered_set<uint64_t> used; std::unordered_set<uint64_t> used;
@@ -64,8 +65,8 @@ public:
uint64_t max = std::max(n1.getIdx(), n2.getIdx()); uint64_t max = std::max(n1.getIdx(), n2.getIdx());
uint64_t idx = max << 32 | min; uint64_t idx = max << 32 | min;
if (used.find(idx) == used.end()) { if (used.find(idx) == used.end()) {
glVertex3f(n1.x_cm/100.0f, n1.z_cm/100.0f*s, n1.y_cm/100.0f); glVertex3f(n1.x_cm/100.0f, n1.z_cm/100.0f*sz+oz, n1.y_cm/100.0f);
glVertex3f(n2.x_cm/100.0f, n2.z_cm/100.0f*s, n2.y_cm/100.0f); glVertex3f(n2.x_cm/100.0f, n2.z_cm/100.0f*sz+oz, n2.y_cm/100.0f);
used.insert(idx); used.insert(idx);
} }
} }
@@ -94,7 +95,7 @@ public:
} }
glVertex3f(n.x_cm/100.0f, n.z_cm/100.0f*s, n.y_cm/100.0f); glVertex3f(n.x_cm/100.0f, n.z_cm/100.0f*sz+oz, n.y_cm/100.0f);
} }
glEnd(); glEnd();