Refactored Model to make faces first class objects for use in AABBTree, renamed BoundingBox.intersect to intersect?

This commit is contained in:
2019-02-25 17:59:09 -06:00
parent 0d7210b3f7
commit 8ccd1506f3
7 changed files with 60 additions and 32 deletions

View File

@@ -54,7 +54,7 @@ class IMICFPS
end
broadphase.each do |entity, _collisions|
_collisions.reject! {|ent| !entity.bounding_box.intersect(ent.bounding_box)}
_collisions.reject! {|ent| !entity.bounding_box.intersect?(ent.bounding_box)}
# TODO: mesh aabb tree vs other mesh aabb tree check
# TODO: triangle vs other triangle check
_collisions.each do |ent|

View File

@@ -2,6 +2,7 @@ class IMICFPS
TextureCoordinate = Struct.new(:u, :v, :weight)
Point = Struct.new(:x, :y)
Color = Struct.new(:red, :green, :blue, :alpha)
Face = Struct.new(:vertices, :uvs, :normals, :material, :smoothing)
module EntityManager # Get included into GameState context
def add_entity(entity)