metaforce/DataSpec/DNAMP1/ScriptObjects/DoorArea.cpp

26 lines
851 B
C++
Raw Normal View History

2017-12-29 08:08:12 +00:00
#include "DoorArea.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 DoorArea::getVISIAABB(hecl::blender::Token& btok) const {
hecl::blender::Connection& conn = btok.getBlenderConnection();
zeus::CAABox aabbOut;
2017-12-29 08:08:12 +00:00
2019-07-20 04:27:21 +00:00
if (animationParameters.animationCharacterSet.isValid()) {
2018-12-08 05:30:43 +00:00
hecl::ProjectPath path = UniqueIDBridge::TranslatePakIdToPath(animationParameters.animationCharacterSet);
conn.openBlend(path.getWithExtension(".blend", true));
2018-12-08 05:30:43 +00:00
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