mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-08 12:24:56 +00:00
DCLN OBB transform fix
This commit is contained in:
@@ -49,15 +49,17 @@ static FittedOBB BuildFromCovarianceMatrix(gmm::dense_matrix<float>& C, const Co
|
||||
|
||||
// find the right, up and forward vectors from the eigenvectors
|
||||
zeus::CVector3f r(eigvec(0, 0), eigvec(1, 0), eigvec(2, 0));
|
||||
zeus::CVector3f u(eigvec(0, 1), eigvec(1, 1), eigvec(2, 1));
|
||||
zeus::CVector3f f(eigvec(0, 2), eigvec(1, 2), eigvec(2, 2));
|
||||
zeus::CVector3f f(eigvec(0, 1), eigvec(1, 1), eigvec(2, 1));
|
||||
zeus::CVector3f u(eigvec(0, 2), eigvec(1, 2), eigvec(2, 2));
|
||||
r.normalize();
|
||||
u.normalize(), f.normalize();
|
||||
f.normalize();
|
||||
u.normalize();
|
||||
|
||||
// set the rotation matrix using the eigvenvectors
|
||||
ret.xf.basis[0] = r;
|
||||
ret.xf.basis[1] = u;
|
||||
ret.xf.basis[2] = f;
|
||||
ret.xf.basis[1] = f;
|
||||
ret.xf.basis[2] = u;
|
||||
ret.xf.orthonormalize();
|
||||
|
||||
// now build the bounding box extents in the rotated frame
|
||||
zeus::CVector3f minim(1e10f, 1e10f, 1e10f), maxim(-1e10f, -1e10f, -1e10f);
|
||||
@@ -65,7 +67,7 @@ static FittedOBB BuildFromCovarianceMatrix(gmm::dense_matrix<float>& C, const Co
|
||||
std::unordered_set<uint32_t> verts = GetTriangleVerts(mesh, triIdx);
|
||||
for (uint32_t v : verts) {
|
||||
const zeus::CVector3f& p = mesh.verts[v].val;
|
||||
zeus::CVector3f p_prime(r.dot(p), u.dot(p), f.dot(p));
|
||||
zeus::CVector3f p_prime(ret.xf.basis[0].dot(p), ret.xf.basis[1].dot(p), ret.xf.basis[2].dot(p));
|
||||
minim = zeus::min(minim, p_prime);
|
||||
maxim = zeus::max(maxim, p_prime);
|
||||
}
|
||||
|
||||
@@ -15,9 +15,9 @@ void DCLN::Collision::Node::sendToBlender(hecl::blender::PyOutStream& os) const
|
||||
"obj.location = mtxd[0]\n"
|
||||
"obj.rotation_quaternion = mtxd[1]\n"
|
||||
"obj.scale = (%f,%f,%f)\n",
|
||||
isLeaf ? "leaf" : "branch", xf[0].vec[0], xf[0].vec[1], xf[0].vec[2], xf[0].vec[3], xf[1].vec[0], xf[1].vec[1],
|
||||
xf[1].vec[2], xf[1].vec[3], xf[2].vec[0], xf[2].vec[1], xf[2].vec[2], xf[2].vec[3], halfExtent.vec[0],
|
||||
halfExtent.vec[1], halfExtent.vec[2]);
|
||||
isLeaf ? "leaf" : "branch", xf[0].simd[0], xf[0].simd[1], xf[0].simd[2], xf[0].simd[3], xf[1].simd[0],
|
||||
xf[1].simd[1], xf[1].simd[2], xf[1].simd[3], xf[2].simd[0], xf[2].simd[1], xf[2].simd[2], xf[2].simd[3],
|
||||
halfExtent.simd[0], halfExtent.simd[1], halfExtent.simd[2]);
|
||||
if (isLeaf)
|
||||
os << "obj.show_name = True\n";
|
||||
if (!isLeaf) {
|
||||
|
||||
@@ -21,7 +21,7 @@ struct Actor : IScriptObject {
|
||||
AnimationParameters animationParameters;
|
||||
ActorParameters actorParameters;
|
||||
Value<bool> looping;
|
||||
Value<bool> snow;
|
||||
Value<bool> immovable;
|
||||
Value<bool> solid;
|
||||
Value<bool> cameraPassthrough;
|
||||
Value<bool> active;
|
||||
|
||||
Reference in New Issue
Block a user