undo commit

This commit is contained in:
Irlan 2018-04-12 15:05:16 -03:00
parent fd27a98876
commit e5f49c53dd
2 changed files with 24 additions and 48 deletions

View File

@ -399,28 +399,33 @@ void Draw::DrawAABB(const b3AABB3& aabb, const b3Color& color)
b3Vec3 lower = aabb.m_lower;
b3Vec3 upper = aabb.m_upper;
b3Vec3 vs[b3AABB3Vertex::e_aabb3VertexCount];
aabb.GetVertices(vs);
b3Vec3 vs[8];
// Back
DrawSegment(vs[b3AABB3Vertex::e_leftDownBackVertex], vs[b3AABB3Vertex::e_rightDownBackVertex], color);
DrawSegment(vs[b3AABB3Vertex::e_rightDownBackVertex], vs[b3AABB3Vertex::e_rightUpBackVertex], color);
DrawSegment(vs[b3AABB3Vertex::e_rightUpBackVertex], vs[b3AABB3Vertex::e_leftUpBackVertex], color);
DrawSegment(vs[b3AABB3Vertex::e_leftUpBackVertex], vs[e_leftDownBackVertex], color);
vs[0] = lower;
vs[1] = b3Vec3(lower.x, upper.y, lower.z);
vs[2] = b3Vec3(upper.x, upper.y, lower.z);
vs[3] = b3Vec3(upper.x, lower.y, lower.z);
// Front
DrawSegment(vs[b3AABB3Vertex::e_leftDownFrontVertex], vs[b3AABB3Vertex::e_rightDownFrontVertex], color);
DrawSegment(vs[b3AABB3Vertex::e_rightDownFrontVertex], vs[b3AABB3Vertex::e_rightUpFrontVertex], color);
DrawSegment(vs[b3AABB3Vertex::e_rightUpFrontVertex], vs[b3AABB3Vertex::e_leftUpFrontVertex], color);
DrawSegment(vs[b3AABB3Vertex::e_leftUpFrontVertex], vs[e_leftDownFrontVertex], color);
vs[4] = upper;
vs[5] = b3Vec3(upper.x, lower.y, upper.z);
vs[6] = b3Vec3(lower.x, lower.y, upper.z);
vs[7] = b3Vec3(lower.x, upper.y, upper.z);
// Upper Edges
DrawSegment(vs[b3AABB3Vertex::e_leftUpBackVertex], vs[b3AABB3Vertex::e_leftUpFrontVertex], color);
DrawSegment(vs[b3AABB3Vertex::e_rightUpBackVertex], vs[b3AABB3Vertex::e_rightUpFrontVertex], color);
DrawSegment(vs[0], vs[1], color);
DrawSegment(vs[1], vs[2], color);
DrawSegment(vs[2], vs[3], color);
DrawSegment(vs[3], vs[0], color);
// Lower Edges
DrawSegment(vs[b3AABB3Vertex::e_leftDownBackVertex], vs[b3AABB3Vertex::e_leftDownFrontVertex], color);
DrawSegment(vs[b3AABB3Vertex::e_rightDownBackVertex], vs[b3AABB3Vertex::e_rightDownFrontVertex], color);
DrawSegment(vs[4], vs[5], color);
DrawSegment(vs[5], vs[6], color);
DrawSegment(vs[6], vs[7], color);
DrawSegment(vs[7], vs[4], color);
DrawSegment(vs[2], vs[4], color);
DrawSegment(vs[5], vs[3], color);
DrawSegment(vs[6], vs[0], color);
DrawSegment(vs[1], vs[7], color);
}
void Draw::DrawString(const b3Color& color, const b3Vec2& ps, const char* text, ...)

View File

@ -21,41 +21,12 @@
#include <bounce/common/math/transform.h>
enum b3AABB3Vertex
{
e_leftDownBackVertex,
e_rightDownBackVertex,
e_rightUpBackVertex,
e_leftUpBackVertex,
e_leftDownFrontVertex,
e_rightDownFrontVertex,
e_rightUpFrontVertex,
e_leftUpFrontVertex,
e_aabb3VertexCount
};
// A min-max representation of a three-dimensional AABB.
struct b3AABB3
struct b3AABB3
{
b3Vec3 m_lower; // lower vertex
b3Vec3 m_upper; // upper vertex
// Get the AABB corners enumerated using b3AABB3Vertex.
void GetVertices(b3Vec3 out[e_aabb3VertexCount]) const
{
out[e_leftDownBackVertex].Set(m_lower.x, m_lower.y, m_lower.z);
out[e_rightDownBackVertex].Set(m_upper.x, m_lower.y, m_lower.z);
out[e_rightUpBackVertex].Set(m_upper.x, m_upper.y, m_lower.z);
out[e_leftUpBackVertex].Set(m_lower.x, m_upper.y, m_lower.z);
out[e_leftDownFrontVertex].Set(m_lower.x, m_lower.y, m_upper.z);
out[e_rightDownFrontVertex].Set(m_upper.x, m_lower.y, m_upper.z);
out[e_rightUpFrontVertex].Set(m_upper.x, m_upper.y, m_upper.z);
out[e_leftUpFrontVertex].Set(m_lower.x, m_upper.y, m_upper.z);
}
// Get the support vertex in a given direction.
b3Vec3 GetSupportVertex(const b3Vec3& direction) const
{