mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-15 08:34:40 +00:00
Merge pull request #1339 from marauder2k9-torque/assimp-cleanup
final cleanup
This commit is contained in:
commit
ad9da79e91
3 changed files with 0 additions and 55 deletions
|
|
@ -71,8 +71,6 @@ MatrixF AssimpAppNode::getTransform(F32 time)
|
||||||
// no parent (ie. root level) => scale by global shape <unit>
|
// no parent (ie. root level) => scale by global shape <unit>
|
||||||
mLastTransform.identity();
|
mLastTransform.identity();
|
||||||
mLastTransform.scale(ColladaUtils::getOptions().unit * ColladaUtils::getOptions().formatScaleFactor);
|
mLastTransform.scale(ColladaUtils::getOptions().unit * ColladaUtils::getOptions().formatScaleFactor);
|
||||||
/*if (!isBounds())
|
|
||||||
convertMat(mLastTransform);*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If this node is animated in the active sequence, fetch the animated transform
|
// If this node is animated in the active sequence, fetch the animated transform
|
||||||
|
|
@ -254,41 +252,6 @@ void AssimpAppNode::assimpToTorqueMat(const aiMatrix4x4& inAssimpMat, MatrixF& o
|
||||||
(F32)inAssimpMat.d3, (F32)inAssimpMat.d4));
|
(F32)inAssimpMat.d3, (F32)inAssimpMat.d4));
|
||||||
}
|
}
|
||||||
|
|
||||||
void AssimpAppNode::convertMat(MatrixF& outMat)
|
|
||||||
{
|
|
||||||
MatrixF rot(true);
|
|
||||||
|
|
||||||
switch (ColladaUtils::getOptions().upAxis)
|
|
||||||
{
|
|
||||||
case UPAXISTYPE_X_UP:
|
|
||||||
// rotate 90 around Y-axis, then 90 around Z-axis
|
|
||||||
rot(0, 0) = 0.0f; rot(1, 0) = 1.0f;
|
|
||||||
rot(1, 1) = 0.0f; rot(2, 1) = 1.0f;
|
|
||||||
rot(0, 2) = 1.0f; rot(2, 2) = 0.0f;
|
|
||||||
|
|
||||||
// pre-multiply the transform by the rotation matrix
|
|
||||||
outMat.mulL(rot);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case UPAXISTYPE_Y_UP:
|
|
||||||
// rotate 180 around Y-axis, then 90 around X-axis
|
|
||||||
rot(0, 0) = 1.0f;
|
|
||||||
rot(1, 1) = 0.0f;
|
|
||||||
rot(1, 2) = -1.0f;
|
|
||||||
rot(2, 1) = 1.0f;
|
|
||||||
rot(2, 2) = 0.0f;
|
|
||||||
|
|
||||||
// pre-multiply the transform by the rotation matrix
|
|
||||||
outMat.mulL(rot);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case UPAXISTYPE_Z_UP:
|
|
||||||
default:
|
|
||||||
// nothing to do
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
aiNode* AssimpAppNode::findChildNodeByName(const char* nodeName, aiNode* rootNode)
|
aiNode* AssimpAppNode::findChildNodeByName(const char* nodeName, aiNode* rootNode)
|
||||||
{
|
{
|
||||||
aiNode* retNode = NULL;
|
aiNode* retNode = NULL;
|
||||||
|
|
|
||||||
|
|
@ -114,7 +114,6 @@ public:
|
||||||
bool isParentRoot() override { return (appParent == NULL); }
|
bool isParentRoot() override { return (appParent == NULL); }
|
||||||
|
|
||||||
static void assimpToTorqueMat(const aiMatrix4x4& inAssimpMat, MatrixF& outMat);
|
static void assimpToTorqueMat(const aiMatrix4x4& inAssimpMat, MatrixF& outMat);
|
||||||
static void convertMat(MatrixF& outMat);
|
|
||||||
static aiNode* findChildNodeByName(const char* nodeName, aiNode* rootNode);
|
static aiNode* findChildNodeByName(const char* nodeName, aiNode* rootNode);
|
||||||
|
|
||||||
void addChild(AssimpAppNode* child);
|
void addChild(AssimpAppNode* child);
|
||||||
|
|
|
||||||
|
|
@ -128,15 +128,6 @@ void applyTransformation(aiNode* node, const aiMatrix4x4& transform) {
|
||||||
node->mTransformation = transform * node->mTransformation; // Apply transformation to the node
|
node->mTransformation = transform * node->mTransformation; // Apply transformation to the node
|
||||||
}
|
}
|
||||||
|
|
||||||
void applyRootTransformation(aiNode* node, const aiMatrix4x4& transform) {
|
|
||||||
node->mTransformation = transform * node->mTransformation; // Apply transformation to the node
|
|
||||||
|
|
||||||
// Recursively apply to all child nodes
|
|
||||||
for (unsigned int i = 0; i < node->mNumChildren; ++i) {
|
|
||||||
applyRootTransformation(node->mChildren[i], transform);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void scaleScene(const aiScene* scene, F32 scaleFactor) {
|
void scaleScene(const aiScene* scene, F32 scaleFactor) {
|
||||||
aiMatrix4x4 scaleMatrix;
|
aiMatrix4x4 scaleMatrix;
|
||||||
scaleMatrix = aiMatrix4x4::Scaling(aiVector3D(scaleFactor, scaleFactor, scaleFactor), scaleMatrix);
|
scaleMatrix = aiMatrix4x4::Scaling(aiVector3D(scaleFactor, scaleFactor, scaleFactor), scaleMatrix);
|
||||||
|
|
@ -263,9 +254,6 @@ void AssimpShapeLoader::enumerateScene()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fileExt == String::ToString("glb"))
|
|
||||||
ColladaUtils::getOptions().upAxis = UPAXISTYPE_X_UP;
|
|
||||||
|
|
||||||
for (U32 i = 0; i < mScene->mNumTextures; ++i) {
|
for (U32 i = 0; i < mScene->mNumTextures; ++i) {
|
||||||
extractTexture(i, mScene->mTextures[i]);
|
extractTexture(i, mScene->mTextures[i]);
|
||||||
}
|
}
|
||||||
|
|
@ -330,11 +318,6 @@ void AssimpShapeLoader::configureImportUnits() {
|
||||||
}
|
}
|
||||||
options.unit = static_cast<F32>(unitScaleFactor);
|
options.unit = static_cast<F32>(unitScaleFactor);
|
||||||
}
|
}
|
||||||
|
|
||||||
int upAxis = UPAXISTYPE_Z_UP;
|
|
||||||
if (getMetaInt("UpAxis", upAxis)) {
|
|
||||||
options.upAxis = static_cast<domUpAxisType>(upAxis);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AssimpShapeLoader::processAssimpNode(const aiNode* node, const aiScene* scene, AssimpAppNode* parentNode)
|
void AssimpShapeLoader::processAssimpNode(const aiNode* node, const aiScene* scene, AssimpAppNode* parentNode)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue