Working on meshes
This commit is contained in:
parent
c479ccb9e2
commit
7b472fe18d
652 changed files with 81120 additions and 852 deletions
|
|
@ -39,6 +39,10 @@ namespace SCollision {
|
|||
min(initMin),
|
||||
max(initMax)
|
||||
{}
|
||||
AABB(const SkRect& r):
|
||||
min(r.TL),
|
||||
max(r.BR)
|
||||
{}
|
||||
Vector<T, 2> min;
|
||||
Vector<T, 2> max;
|
||||
Vector<T, 2> center() const { return (min + max) / T(2); }
|
||||
|
|
@ -548,6 +552,17 @@ namespace SCollision {
|
|||
}
|
||||
}
|
||||
|
||||
template <typename Collider> void is_collide_triangle_bounds_func(const Collider& collider, const std::function<void(const Triangle<T>&)> triangleFunc) const {
|
||||
if(!collide(get_bounds(collider), get_bounds(objects)))
|
||||
return;
|
||||
for(auto& t : objects.triangle) {
|
||||
if(collide(t.bounds, collider))
|
||||
triangleFunc(t);
|
||||
}
|
||||
for(const auto& c : children)
|
||||
c.is_collide_triangle_bounds_func(collider, triangleFunc);
|
||||
}
|
||||
|
||||
template <typename Collider> bool is_collide(const Collider& collider) const {
|
||||
if(!collide(get_bounds(collider), get_bounds(objects)))
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue