moved from ray3 to floorplan/3D

worked on new wall models
refactoring
This commit is contained in:
2018-07-24 08:13:16 +02:00
parent 083a1c2cf2
commit 8dd1ba0be6
25 changed files with 703 additions and 92 deletions

52
floorplan/3D/Objects.h Normal file
View File

@@ -0,0 +1,52 @@
#ifndef FLOORPLAN_3D_OBJECTS_H
#define FLOORPLAN_3D_OBJECTS_H
#include "Obstacle3.h"
#include "misc.h"
#include "objects/OBJPool.h"
namespace Floorplan3D {
class Objects {
public:
std::vector<Obstacle3D> getObjects(const Floorplan::Floor* f) {
std::vector<Obstacle3D> res;
for (const Floorplan::FloorObstacle* o: f->obstacles) {
const Floorplan::FloorObstacleObject* obj = dynamic_cast<const Floorplan::FloorObstacleObject*>(o);
if (obj) {
res.push_back(getObject(f, obj));
}
}
return res;
}
/** 3D Obstacle from .obj 3D mesh */
Obstacle3D getObject(const Floorplan::Floor* f, const Floorplan::FloorObstacleObject* foo) const {
FloorPos fpos(f);
const std::string& name = foo->file;
Obstacle3D obs = OBJPool::get().getObject(name);
// perform sanity checks
if (!obs.isValid()) {
throw std::runtime_error("invalid obstacle-data detected");
}
// apply scaling/rotation/translation
obs = obs.scaled(foo->scale);
obs = obs.rotated_deg( Point3(foo->rot.x, foo->rot.y, foo->rot.z) );
obs = obs.translated(foo->pos + Point3(0,0,fpos.z1));
obs.type = Obstacle3D::Type::OBJECT;
return obs;
}
};
}
#endif // FLOORPLAN_3D_OBJECTS_H