improved 3d rendering, minor changes

added support for thick 3d walls
This commit is contained in:
2017-08-02 14:30:01 +02:00
parent 6f06984c4e
commit 29d5ce19ff
10 changed files with 234 additions and 18 deletions

View File

@@ -4,8 +4,9 @@
#include <Indoor/floorplan/v2/Floorplan.h>
#include <Indoor/math/Math.h>
#include "misc/Cube.h"
#include "MV3DElement.h"
#include "misc/Plane.h"
//#include "misc/Plane.h"
@@ -24,12 +25,43 @@ public:
/** repaint me */
void paintGL() override {
glColor3f(0.4, 0.4, 0.4);
Plane p(fo->from, fo->to, f->atHeight, fo->height);
p.paintGL();
const Point2 from = fo->from;
const Point2 to = fo->to;
const float atHeight = f->atHeight;
const float height = fo->height;
const float thickness_m = 0.05; // 5cm door
const float rad = std::atan2(to.y - from.y, to.x - from.x);
const float deg = rad * 180 / M_PI;
const Point2 cen2 = (from+to)/2;
const Point3 pos(cen2.x, cen2.y, atHeight + height/2);
// div by 2.01 to prevent overlapps and z-fi
const float sx = from.getDistance(to) / 2.01f;
const float sy = thickness_m / 2.01f;
const float sz = height / 2.01f; // prevent overlaps
const Point3 size(sx, sy, sz);
const Point3 rot(0,0,deg);
// fill color
glColor3f(0.395, 0.263, 0.129);
// build
Cube cube(pos, size, rot);
cube.paintGL();
//glColor3f(0.4, 0.4, 0.4);
//Plane p(fo->from, fo->to, f->atHeight, fo->height);
//p.paintGL();
}
bool isTransparent() const override {
return false;
}
};
#endif // MV3DELEMENTFLOOROBSTACLEDOOR_H