added support for .obj objects within the floorplan
include objects within navmesh calculation include objects within 3d mesh generation minor changes/fixes
This commit is contained in:
@@ -34,6 +34,18 @@ public:
|
||||
Triangle3 operator - (const Point3 o) const {
|
||||
return Triangle3(p1-o, p2-o, p3-o);
|
||||
}
|
||||
Triangle3& operator += (const Point3 o) {
|
||||
p1 += o;
|
||||
p2 += o;
|
||||
p3 += o;
|
||||
return *this;
|
||||
}
|
||||
Triangle3& operator -= (const Point3 o) {
|
||||
p1 -= o;
|
||||
p2 -= o;
|
||||
p3 -= o;
|
||||
return *this;
|
||||
}
|
||||
|
||||
Point3 getNormal() const {
|
||||
return cross( p2-p1, p3-p1 ).normalized();
|
||||
@@ -47,22 +59,22 @@ public:
|
||||
const Point3 e2 = p3-p1;
|
||||
|
||||
const Point3 h = cross(ray.dir, e2);
|
||||
const float a = dot(e1, h);
|
||||
const double a = dot(e1, h);
|
||||
|
||||
if (a > -0.00001 && a < 0.00001) {return false;}
|
||||
|
||||
const float f = 1/a;
|
||||
const double f = 1/a;
|
||||
|
||||
const Point3 s = ray.start - p1;
|
||||
const float u = f * dot(s,h);
|
||||
const double u = f * dot(s,h);
|
||||
|
||||
if (u < 0.0 || u > 1.0) {return false;}
|
||||
|
||||
const Point3 q = cross(s, e1);
|
||||
const float v = f * dot(ray.dir, q);
|
||||
const double v = f * dot(ray.dir, q);
|
||||
|
||||
if (v < 0.0 || u + v > 1.0) {return false;}
|
||||
const float t = f * dot(e2,q);
|
||||
const double t = f * dot(e2,q);
|
||||
|
||||
|
||||
if (t > 0.00001) {
|
||||
|
||||
Reference in New Issue
Block a user