worked on 3d models within map

adjusted grid factory
adjusted nav mesh factory
minoor changes/fixes
new helper classes
refactoring
This commit is contained in:
2018-04-03 14:55:59 +02:00
parent f3b6155157
commit 1c2081d406
25 changed files with 620 additions and 93 deletions

View File

@@ -18,7 +18,7 @@ namespace Ray3D {
*/
class ModelFactory {
private:
public:
bool exportCeilings = true;
bool exportObstacles = true;
@@ -26,9 +26,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 */
@@ -233,7 +236,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));
}
}
}
@@ -274,8 +279,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
@@ -286,7 +291,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);
@@ -359,7 +364,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();