Improved collision system use of BVH
This commit is contained in:
parent
f74298d21d
commit
f75a5133d5
5 changed files with 38 additions and 8 deletions
|
|
@ -176,7 +176,7 @@ bool DrawComponent::collides_with_cam_coords(const CoordSpaceHelper& camCoords,
|
|||
bool DrawComponent::collides_with(const CoordSpaceHelper& camCoords, const SCollision::ColliderCollection<WorldScalar>& checkAgainstWorld, const SCollision::ColliderCollection<float>& checkAgainstCam, bool colliderAllocated) {
|
||||
if((camCoords.inverseScale << DRAWCOMP_MAX_SHIFT_BEFORE_DISAPPEAR) < coords.inverseScale) // Object is too large, just dismiss the collision
|
||||
return false;
|
||||
else if((camCoords.inverseScale >> DRAWCOMP_MIN_SHIFT_BEFORE_DISAPPEAR) >= coords.inverseScale) {
|
||||
else if((camCoords.inverseScale >> DRAWCOMP_COLLIDE_MIN_SHIFT_TINY) >= coords.inverseScale) {
|
||||
if(!worldAABB)
|
||||
return false;
|
||||
return SCollision::collide(checkAgainstCam, camCoords.to_space(worldAABB->min));
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
#define DRAWCOMP_MAX_SHIFT_BEFORE_DISAPPEAR 20
|
||||
#define DRAWCOMP_MIN_SHIFT_BEFORE_DISAPPEAR 11
|
||||
#define DRAWCOMP_COLLIDE_MIN_SHIFT_TINY 9
|
||||
#define DRAWCOMP_MIPMAP_LEVEL_ONE 2
|
||||
#define DRAWCOMP_MIPMAP_LEVEL_TWO 5
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue