worked on mapview 3d stuff

This commit is contained in:
2018-07-24 10:26:27 +02:00
parent 423fbfc545
commit 4938987063
7 changed files with 24 additions and 22 deletions

View File

@@ -2,7 +2,7 @@
#include "MapViewElementHelper.h"
#include <Indoor/floorplan/v2/Floorplan.h>
#include <Indoor/wifi/estimate/ray3/OBJPool.h>
#include <Indoor/floorplan/3D/objects/OBJPool.h>
#include "../../UIHelper.h"
@@ -70,7 +70,7 @@ void MV2DElementFloorObstacleObject::paint(Painter& p) {
// for (const Cache::Line& l : e.lines) {
// p.drawLine(l.p1, l.p2);
// }
const Ray3D::Obstacle3D obs = Ray3D::OBJPool::get().getObject(fo->file).rotated_deg(fo->rot).translated(fo->pos);
const Floorplan3D::Obstacle3D obs = Floorplan3D::OBJPool::get().getObject(fo->file).rotated_deg(fo->rot).translated(fo->pos);
for (const Triangle3& tria : obs.triangles) {
if (tria.p1.xy() != tria.p2.xy()) {
p.drawLine( tria.p1.xy(), tria.p2.xy() );

View File

@@ -84,6 +84,7 @@ MapView3D::MapView3D(QWidget *parent) : QOpenGLWidget(parent) {
floorplanRendererModel->getMesh().exportOBJsimple("/tmp/map.obj");
floorplanRendererModel->getMesh().exportOBJcomplex("/tmp/map_complex", "map_complex");
floorplanRendererModel->getMesh().exportPLY("/tmp/map.ply");
QMessageBox::information(this, "Export", "3D Model exported to /tmp/* as .obj and .ply");
});

View File

@@ -13,7 +13,7 @@
#include "../misc/Shader.h"
#include "../misc/TriangleData.h"
#include <Indoor/wifi/estimate/ray3/ModelFactory.h>
#include <Indoor/floorplan/3D/Builder.h>
#include "RenderTriangle.h"

View File

@@ -4,7 +4,7 @@
#include <Indoor/navMesh/NavMesh.h>
#include <Indoor/navMesh/NavMeshFactory.h>
#include <Indoor/navMesh/NavMeshFactoryListener.h>
#include <Indoor/wifi/estimate/ray3/ModelFactory.h>
#include <Indoor/floorplan/3D/Builder.h>
#include "RenderTriangle.h"
@@ -37,18 +37,18 @@ const std::vector<Material> mats = {
};
int FloorplanRendererModel::getMaterial(const Ray3D::Obstacle3D& o) const {
int FloorplanRendererModel::getMaterial(const Floorplan3D::Obstacle3D& o) const {
if (o.type == Ray3D::Obstacle3D::Type::ERROR) {return 0;}
if (o.type == Floorplan3D::Obstacle3D::Type::ERROR) {return 0;}
if (o.type == Ray3D::Obstacle3D::Type::GROUND_OUTDOOR) {return 1;}
if (o.type == Ray3D::Obstacle3D::Type::GROUND_INDOOR) {return 2;}
if (o.type == Ray3D::Obstacle3D::Type::STAIR) {return 3;}
if (o.type == Ray3D::Obstacle3D::Type::HANDRAIL) {return 4;}
if (o.type == Ray3D::Obstacle3D::Type::OBJECT) {return 12;}
if (o.type == Floorplan3D::Obstacle3D::Type::GROUND_OUTDOOR) {return 1;}
if (o.type == Floorplan3D::Obstacle3D::Type::GROUND_INDOOR) {return 2;}
if (o.type == Floorplan3D::Obstacle3D::Type::STAIR) {return 3;}
if (o.type == Floorplan3D::Obstacle3D::Type::HANDRAIL) {return 4;}
if (o.type == Floorplan3D::Obstacle3D::Type::OBJECT) {return 12;}
if (o.type == Ray3D::Obstacle3D::Type::DOOR && o.mat == Floorplan::Material::GLASS) {return 5;}
if (o.type == Ray3D::Obstacle3D::Type::DOOR) {return 6;}
if (o.type == Floorplan3D::Obstacle3D::Type::DOOR && o.mat == Floorplan::Material::GLASS) {return 5;}
if (o.type == Floorplan3D::Obstacle3D::Type::DOOR) {return 6;}
if (o.mat == Floorplan::Material::CONCRETE) {return 7;}
if (o.mat == Floorplan::Material::GLASS) {return 8;}
@@ -66,7 +66,7 @@ FloorplanRendererModel::FloorplanRendererModel() {
;
}
Ray3D::FloorplanMesh& FloorplanRendererModel::getMesh() {
Floorplan3D::FloorplanMesh& FloorplanRendererModel::getMesh() {
return mesh;
}
@@ -91,10 +91,10 @@ void FloorplanRendererModel::rebuild(Floorplan::IndoorMap* im) {
// rebuild the mesh
try {
Ray3D::ModelFactory fac(im);
Floorplan3D::Builder fac(im);
fac.exportDoors = showDoors;
mesh = fac.getMesh();
for (const Ray3D::Obstacle3D& obs : mesh.elements) {
for (const Floorplan3D::Obstacle3D& obs : mesh.elements) {
const int matID = getMaterial(obs);
const Material& mat = mats[matID];
for (const Triangle3& tria : obs.triangles) {

View File

@@ -2,7 +2,7 @@
#define FLOORPLANRENDERERMODEL_H
#include <Indoor/floorplan/v2/Floorplan.h>
#include <Indoor/wifi/estimate/ray3/FloorplanMesh.h>
#include <Indoor/floorplan/3D/FloorplanMesh.h>
#include "RenderTriangle.h"
@@ -14,12 +14,12 @@ class FloorplanRendererModel {
private:
Floorplan::IndoorMap* im;
Ray3D::FloorplanMesh mesh;
Floorplan3D::FloorplanMesh mesh;
RenderTriangle triaSolid;
RenderTriangle triaTransp;
int getMaterial(const Ray3D::Obstacle3D& o) const;
int getMaterial(const Floorplan3D::Obstacle3D& o) const;
public:
@@ -29,7 +29,7 @@ public:
/** ctor */
FloorplanRendererModel();
Ray3D::FloorplanMesh& getMesh();
Floorplan3D::FloorplanMesh& getMesh();
const RenderTriangle& getTriaSolid();