added floorplan support for object-sizing
added floorplan support for different wall-heights minor fixes/changes
This commit is contained in:
@@ -282,7 +282,7 @@ namespace Ray3D {
|
||||
|
||||
// attributes
|
||||
const float r = foc->radius;
|
||||
const float h = (foc->height > 0) ? (foc->height) : (fpos.height);
|
||||
const float h = (foc->height > 0) ? (foc->height) : (fpos.height); // use either floor's height or user height
|
||||
const Point3 pos(foc->center.x, foc->center.y, fpos.z1 + h/2);
|
||||
|
||||
// build
|
||||
@@ -310,7 +310,8 @@ namespace Ray3D {
|
||||
const float deg = rad * 180 / M_PI;
|
||||
|
||||
// cube's destination center
|
||||
const double height = (!aboveDoor) ? (fpos.height) : (fpos.height - aboveDoor->height);
|
||||
const float _height = (fol->height_m > 0) ? (fol->height_m) : (fpos.height); // use either floor's height or user height
|
||||
const double height = (!aboveDoor) ? (_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);
|
||||
|
||||
@@ -338,6 +339,7 @@ namespace Ray3D {
|
||||
|
||||
const std::string& name = foo->file;
|
||||
Obstacle3D obs = OBJPool::get().getObject(name);
|
||||
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;
|
||||
|
||||
@@ -38,6 +38,14 @@ namespace Ray3D {
|
||||
/** ctor */
|
||||
Obstacle3D(Type type, Floorplan::Material mat) : type(type), mat(mat) {;}
|
||||
|
||||
/** scaled copy */
|
||||
Obstacle3D scaled(const Point3 scale) const {
|
||||
Obstacle3D copy = *this;
|
||||
for (Triangle3& tria : copy.triangles) {
|
||||
tria *= scale;
|
||||
}
|
||||
return copy;
|
||||
}
|
||||
|
||||
/** translated copy */
|
||||
Obstacle3D translated(const Point3 pos) const {
|
||||
|
||||
Reference in New Issue
Block a user