mirror of https://github.com/bkaradzic/bgfx
Adding more bounds overlap tests.
This commit is contained in:
parent
d0146fdfbb
commit
f19491c274
|
@ -1165,6 +1165,50 @@ public:
|
|||
dde.draw(diskB);
|
||||
}
|
||||
|
||||
{
|
||||
Aabb aabbA;
|
||||
toAabb(aabbA, { px+kStepX*6.0f, py, pz+kStepZ*1.0f }, { 0.5f, 0.5f, 0.5f });
|
||||
|
||||
Capsule capsuleB =
|
||||
{
|
||||
{ xx+kStepX*5.9f, yy-1.0f, zz+kStepZ*1.0f+0.1f },
|
||||
{ xx+kStepX*6.0f, yy+1.0f, zz+kStepZ*1.0f },
|
||||
0.2f,
|
||||
};
|
||||
|
||||
olp = overlap(aabbA, capsuleB);
|
||||
|
||||
dde.setColor(olp ? kOverlapA : 0xffffffff);
|
||||
dde.setWireframe(false);
|
||||
dde.draw(aabbA);
|
||||
|
||||
dde.setColor(olp ? kOverlapB : 0xffffffff);
|
||||
dde.setWireframe(true);
|
||||
dde.draw(capsuleB);
|
||||
}
|
||||
|
||||
{
|
||||
Aabb aabbA;
|
||||
toAabb(aabbA, { px+kStepX*8.0f, py, pz+kStepZ*1.0f }, { 0.5f, 0.5f, 0.5f });
|
||||
|
||||
Cone coneB =
|
||||
{
|
||||
{ xx+kStepX*7.9f, yy-1.0f, zz+kStepZ*1.0f+0.1f },
|
||||
{ xx+kStepX*8.0f, yy+1.0f, zz+kStepZ*1.0f },
|
||||
0.25f,
|
||||
};
|
||||
|
||||
olp = overlap(aabbA, coneB);
|
||||
|
||||
dde.setColor(olp ? kOverlapA : 0xffffffff);
|
||||
dde.setWireframe(false);
|
||||
dde.draw(aabbA);
|
||||
|
||||
dde.setColor(olp ? kOverlapB : 0xffffffff);
|
||||
dde.setWireframe(true);
|
||||
dde.draw(coneB);
|
||||
}
|
||||
|
||||
// Triangle ---
|
||||
{
|
||||
Triangle triangleA =
|
||||
|
|
|
@ -1259,14 +1259,15 @@ bool overlap(const Aabb& _aabb, const Cylinder& _cylinder)
|
|||
|
||||
bool overlap(const Aabb& _aabb, const Capsule& _capsule)
|
||||
{
|
||||
BX_UNUSED(_aabb, _capsule);
|
||||
return false;
|
||||
const Vec3 pos = closestPoint(LineSegment{_capsule.pos, _capsule.end}, getCenter(_aabb) );
|
||||
return overlap(_aabb, Sphere{pos, _capsule.radius});
|
||||
}
|
||||
|
||||
bool overlap(const Aabb& _aabb, const Cone& _cone)
|
||||
{
|
||||
BX_UNUSED(_aabb, _cone);
|
||||
return false;
|
||||
float tt;
|
||||
const Vec3 pos = closestPoint(LineSegment{_cone.pos, _cone.end}, getCenter(_aabb), tt);
|
||||
return overlap(_aabb, Sphere{pos, lerp(_cone.radius, 0.0f, tt)});
|
||||
}
|
||||
|
||||
bool overlap(const Aabb& _aabb, const Disk& _disk)
|
||||
|
|
Loading…
Reference in New Issue