refactoring/cleanups

This commit is contained in:
2018-07-30 20:56:17 +02:00
parent 9a07790ec6
commit a9fcb77675
23 changed files with 276 additions and 247 deletions

View File

@@ -331,6 +331,8 @@ void MapView3D::draw() {
static RenderSettings rs = RenderSettings(new Shader(), this);
const Point3 c = center - floorplanRendererModel->getBBox().getCenter();
// view
QMatrix4x4 V;
@@ -339,7 +341,7 @@ void MapView3D::draw() {
V.rotate(rot.x, 1.0, 0.0, 0.0);
V.rotate(rot.y, 0.0, 1.0, 0.0);
V.rotate(rot.z, 0.0, 0.0, 1.0);
V.translate(center.x, center.y, center.z);
V.translate(c.x, c.y, c.z);
float farPlane = 200; // TODO

View File

@@ -70,6 +70,10 @@ Floorplan3D::FloorplanMesh& FloorplanRendererModel::getMesh() {
return mesh;
}
BBox3 FloorplanRendererModel::getBBox() const {
return bbox;
}
const RenderTriangle& FloorplanRendererModel::getTriaSolid() {
return triaSolid;
}
@@ -106,6 +110,10 @@ void FloorplanRendererModel::rebuild(Floorplan::IndoorMap* im) {
}
}
}
// update bbox
bbox = mesh.getBBox();
}
catch(const std::exception& e) {
std::cout << "Can't create 3D view. Failed to get mesh from model factory with error: '" << e.what() << "'" << std::endl;

View File

@@ -19,6 +19,8 @@ private:
RenderTriangle triaSolid;
RenderTriangle triaTransp;
BBox3 bbox;
int getMaterial(const Floorplan3D::Obstacle3D& o) const;
@@ -31,6 +33,8 @@ public:
Floorplan3D::FloorplanMesh& getMesh();
BBox3 getBBox() const;
const RenderTriangle& getTriaSolid();
const RenderTriangle& getTriaTransp();