Simplify code
This commit is contained in:
parent
111fc297d5
commit
123e667ab4
@ -31,10 +31,8 @@ class ArenaNode3D : public ArenaNode,
|
||||
public:
|
||||
ArenaNode3D(const Vec3 &p0, const Vec3 &p1, const Vec3 &p2, const Vec3 &p3,
|
||||
const Vec3 &normal, unsigned int node_index)
|
||||
: ArenaNode(p0, p1, p2, p3, normal, node_index)
|
||||
{
|
||||
BoundingBox3D::init(p0, p1, p2, p3, normal);
|
||||
}
|
||||
: ArenaNode(p0, p1, p2, p3, normal, node_index),
|
||||
BoundingBox3D(p0, p1, p2, p3, normal) {}
|
||||
// ------------------------------------------------------------------------
|
||||
virtual bool pointInside(const Vec3& p,
|
||||
bool ignore_vertical = false) const OVERRIDE
|
||||
|
@ -33,21 +33,8 @@ private:
|
||||
|
||||
public:
|
||||
// ------------------------------------------------------------------------
|
||||
bool pointInside(const Vec3& p) const
|
||||
{
|
||||
float side = p.sideofPlane(m_box_faces[0][0], m_box_faces[0][1],
|
||||
m_box_faces[0][2]);
|
||||
for (int i = 1; i < 6; i++)
|
||||
{
|
||||
if (side * p.sideofPlane(m_box_faces[i][0], m_box_faces[i][1],
|
||||
m_box_faces[i][2]) < 0)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
// ------------------------------------------------------------------------
|
||||
void init(const Vec3& p0, const Vec3& p1, const Vec3& p2, const Vec3& p3,
|
||||
const Vec3& normal)
|
||||
BoundingBox3D(const Vec3& p0, const Vec3& p1, const Vec3& p2,
|
||||
const Vec3& p3, const Vec3& normal)
|
||||
{
|
||||
// Compute the node bounding box used by pointInside
|
||||
Vec3 box_corners[8];
|
||||
@ -78,6 +65,20 @@ public:
|
||||
m_box_faces[i][j] = box_faces[i][j];
|
||||
}
|
||||
}
|
||||
// ------------------------------------------------------------------------
|
||||
bool pointInside(const Vec3& p, bool ignore_vertical = false) const
|
||||
{
|
||||
float side = p.sideofPlane(m_box_faces[0][0], m_box_faces[0][1],
|
||||
m_box_faces[0][2]);
|
||||
for (int i = 1; i < 6; i++)
|
||||
{
|
||||
if (side * p.sideofPlane(m_box_faces[i][0], m_box_faces[i][1],
|
||||
m_box_faces[i][2]) < 0)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif
|
@ -24,9 +24,8 @@ DriveNode3D::DriveNode3D(const Vec3 &p0, const Vec3 &p1, const Vec3 &p2,
|
||||
unsigned int node_index, bool invisible,
|
||||
bool ai_ignore)
|
||||
: DriveNode(p0, p1, p2, p3, normal, node_index, invisible,
|
||||
ai_ignore)
|
||||
ai_ignore), BoundingBox3D(p0, p1, p2, p3, normal)
|
||||
{
|
||||
BoundingBox3D::init(p0, p1, p2, p3, normal);
|
||||
m_line = core::line3df(m_lower_center.toIrrVector(),
|
||||
m_upper_center.toIrrVector());
|
||||
} // DriveNode3D
|
||||
|
Loading…
Reference in New Issue
Block a user