Frustrum octree should only get AABBs derived from Model now.

This commit is contained in:
William Moberg
2016-02-10 16:10:41 +01:00
parent b2d35c80f7
commit 27cdccac75
3 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -79,7 +79,7 @@ bool AABBVsAABB(const AABB& a, const AABB& b);
bool AABBVsAABB(const AABB& a, const AABB& b, glm::vec3& minimumTranslation);
// Calculates an absolute AABB from an entity AABB component
boost::optional<EntityAABB> EntityAbsoluteAABB(EntityWrapper& entity);
boost::optional<EntityAABB> EntityAbsoluteAABB(EntityWrapper& entity, bool takeModelBox = false);
boost::optional<EntityAABB> AbsoluteAABBExplosionEffect(EntityWrapper& entity);
}
+3 -3
View File
@@ -565,10 +565,10 @@ bool AABBvsTriangles(const AABB& box,
return hit;
}
boost::optional<EntityAABB> EntityAbsoluteAABB(EntityWrapper& entity)
boost::optional<EntityAABB> EntityAbsoluteAABB(EntityWrapper& entity, bool takeModelBox)
{
AABB modelSpaceBox;
if (entity.HasComponent("AABB")) {
if (entity.HasComponent("AABB") && !takeModelBox) {
ComponentWrapper& cAABB = entity["AABB"];
modelSpaceBox = EntityAABB::FromOriginSize((glm::vec3)cAABB["Origin"], (glm::vec3)cAABB["Size"]);
} else if (entity.HasComponent("Model")) {
@@ -614,7 +614,7 @@ boost::optional<EntityAABB> EntityAbsoluteAABB(EntityWrapper& entity)
boost::optional<EntityAABB> AbsoluteAABBExplosionEffect(EntityWrapper& entity)
{
boost::optional<EntityAABB> modelBox = EntityAbsoluteAABB(entity);
boost::optional<EntityAABB> modelBox = EntityAbsoluteAABB(entity, true);
if (!modelBox) {
return boost::none;
}
@@ -11,7 +11,7 @@ void FillFrustumOctreeSystem::UpdateComponent(EntityWrapper& entity, ComponentWr
if (entity.HasComponent("ExplosionEffect")) {
absoluteAABB = Collision::AbsoluteAABBExplosionEffect(entity);
} else {
absoluteAABB = Collision::EntityAbsoluteAABB(entity);
absoluteAABB = Collision::EntityAbsoluteAABB(entity, true);
}
if (absoluteAABB) {
m_Octree->AddDynamicObject(*absoluteAABB);