This commit is contained in:
2018-04-04 09:45:49 +02:00
25 changed files with 620 additions and 93 deletions

View File

@@ -19,7 +19,7 @@ namespace Ray3D {
*/
class ModelFactory {
private:
public:
bool exportCeilings = true;
bool exportObstacles = true;
@@ -27,9 +27,12 @@ namespace Ray3D {
bool fancyStairs = true;
bool exportHandrails = true;
bool exportDoors = true;
bool doorsOpen = true;
bool exportAboveDoors = true;
bool doorsOpen = false;
bool exportObjects = true;
bool exportWallTops = false;
Cube::Part cubeParts = (Cube::Part) 63; // leftright,topbottom,rearfront
std::vector<Floorplan::Floor*> exportFloors;
/** the to-be-exported map */
@@ -234,7 +237,9 @@ namespace Ray3D {
}
//std::vector<Obstacle3D> tmp = getDoorAbove(f, door);
//res.insert(res.end(), tmp.begin(), tmp.end());
res.push_back(getDoorAbove(f, door));
if (exportAboveDoors) {
res.push_back(getDoorAbove(f, door));
}
}
}
@@ -275,8 +280,8 @@ namespace Ray3D {
const float deg = rad * 180 / M_PI;
// cube's destination center
const float cenZ = (!aboveDoor) ? (fpos.z1 + fpos.height/2) : (fpos.z2 - (fpos.height - aboveDoor->height) / 2);
const float height = (!aboveDoor) ? (fpos.height) : (fpos.height - aboveDoor->height);
const double height = (!aboveDoor) ? (fpos.height) : (fpos.height - aboveDoor->height);
const double cenZ = (!aboveDoor) ? (fpos.z1 + height/2) : (fpos.z1 + aboveDoor->height + height/2);// (fpos.z2 - (fpos.height - aboveDoor->height) / 2);
const Point3 pos(cen2.x, cen2.y, cenZ);
// div by 2.01 to prevent overlapps and z-fighting
@@ -287,7 +292,7 @@ namespace Ray3D {
const Point3 rot(0,0,deg);
// build
Cube cube(pos, size, rot);
Cube cube(pos, size, rot, cubeParts);
// done
Obstacle3D res(getType(fol), fol->material);
@@ -360,7 +365,7 @@ namespace Ray3D {
const float sz = door->height / 2.01f; // prevent overlaps
const Point3 size(sx, sy, sz);
Cube cube = Cube::unit();
Cube cube = Cube::unit(cubeParts);
cube.transform(mat);
cube.transform(pos, size, rot);
res.triangles = cube.getTriangles();