2017-12-29 08:08:12 +00:00
|
|
|
#include "Actor.hpp"
|
|
|
|
#include "hecl/Blender/Connection.hpp"
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
namespace DataSpec::DNAMP1 {
|
2017-12-29 08:08:12 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
zeus::CAABox Actor::getVISIAABB(hecl::blender::Token& btok) const {
|
|
|
|
hecl::blender::Connection& conn = btok.getBlenderConnection();
|
|
|
|
zeus::CAABox aabbOut;
|
2017-12-29 08:08:12 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
if (model) {
|
|
|
|
hecl::ProjectPath path = UniqueIDBridge::TranslatePakIdToPath(model);
|
|
|
|
conn.openBlend(path);
|
|
|
|
hecl::blender::DataStream ds = conn.beginData();
|
|
|
|
auto aabb = ds.getMeshAABB();
|
|
|
|
aabbOut = zeus::CAABox(aabb.first, aabb.second);
|
|
|
|
} else if (animationParameters.animationCharacterSet) {
|
|
|
|
hecl::ProjectPath path = UniqueIDBridge::TranslatePakIdToPath(animationParameters.animationCharacterSet);
|
|
|
|
conn.openBlend(path.getWithExtension(_SYS_STR(".blend"), true));
|
|
|
|
hecl::blender::DataStream ds = conn.beginData();
|
|
|
|
auto aabb = ds.getMeshAABB();
|
|
|
|
aabbOut = zeus::CAABox(aabb.first, aabb.second);
|
|
|
|
}
|
2017-12-29 08:08:12 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
if (aabbOut.min.x() > aabbOut.max.x())
|
|
|
|
return {};
|
2017-12-29 08:08:12 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
zeus::CTransform xf = ConvertEditorEulerToTransform4f(scale, orientation, location);
|
|
|
|
return aabbOut.getTransformedAABox(xf);
|
2017-12-29 08:08:12 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
} // namespace DataSpec::DNAMP1
|