Frustrum octree should only get AABBs derived from Model now.
This commit is contained in:
@@ -79,7 +79,7 @@ bool AABBVsAABB(const AABB& a, const AABB& b);
|
|||||||
bool AABBVsAABB(const AABB& a, const AABB& b, glm::vec3& minimumTranslation);
|
bool AABBVsAABB(const AABB& a, const AABB& b, glm::vec3& minimumTranslation);
|
||||||
|
|
||||||
// Calculates an absolute AABB from an entity AABB component
|
// 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);
|
boost::optional<EntityAABB> AbsoluteAABBExplosionEffect(EntityWrapper& entity);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -565,10 +565,10 @@ bool AABBvsTriangles(const AABB& box,
|
|||||||
return hit;
|
return hit;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::optional<EntityAABB> EntityAbsoluteAABB(EntityWrapper& entity)
|
boost::optional<EntityAABB> EntityAbsoluteAABB(EntityWrapper& entity, bool takeModelBox)
|
||||||
{
|
{
|
||||||
AABB modelSpaceBox;
|
AABB modelSpaceBox;
|
||||||
if (entity.HasComponent("AABB")) {
|
if (entity.HasComponent("AABB") && !takeModelBox) {
|
||||||
ComponentWrapper& cAABB = entity["AABB"];
|
ComponentWrapper& cAABB = entity["AABB"];
|
||||||
modelSpaceBox = EntityAABB::FromOriginSize((glm::vec3)cAABB["Origin"], (glm::vec3)cAABB["Size"]);
|
modelSpaceBox = EntityAABB::FromOriginSize((glm::vec3)cAABB["Origin"], (glm::vec3)cAABB["Size"]);
|
||||||
} else if (entity.HasComponent("Model")) {
|
} else if (entity.HasComponent("Model")) {
|
||||||
@@ -614,7 +614,7 @@ boost::optional<EntityAABB> EntityAbsoluteAABB(EntityWrapper& entity)
|
|||||||
|
|
||||||
boost::optional<EntityAABB> AbsoluteAABBExplosionEffect(EntityWrapper& entity)
|
boost::optional<EntityAABB> AbsoluteAABBExplosionEffect(EntityWrapper& entity)
|
||||||
{
|
{
|
||||||
boost::optional<EntityAABB> modelBox = EntityAbsoluteAABB(entity);
|
boost::optional<EntityAABB> modelBox = EntityAbsoluteAABB(entity, true);
|
||||||
if (!modelBox) {
|
if (!modelBox) {
|
||||||
return boost::none;
|
return boost::none;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ void FillFrustumOctreeSystem::UpdateComponent(EntityWrapper& entity, ComponentWr
|
|||||||
if (entity.HasComponent("ExplosionEffect")) {
|
if (entity.HasComponent("ExplosionEffect")) {
|
||||||
absoluteAABB = Collision::AbsoluteAABBExplosionEffect(entity);
|
absoluteAABB = Collision::AbsoluteAABBExplosionEffect(entity);
|
||||||
} else {
|
} else {
|
||||||
absoluteAABB = Collision::EntityAbsoluteAABB(entity);
|
absoluteAABB = Collision::EntityAbsoluteAABB(entity, true);
|
||||||
}
|
}
|
||||||
if (absoluteAABB) {
|
if (absoluteAABB) {
|
||||||
m_Octree->AddDynamicObject(*absoluteAABB);
|
m_Octree->AddDynamicObject(*absoluteAABB);
|
||||||
|
|||||||
Reference in New Issue
Block a user