|
@@ -232,7 +232,6 @@ void FBXConverter::ConvertNodes(uint64_t id, aiNode *parent, aiNode *root_node)
|
|
|
nodes_chain.clear();
|
|
|
post_nodes_chain.clear();
|
|
|
|
|
|
- aiMatrix4x4 new_abs_transform = parent->mTransformation;
|
|
|
std::string node_name = FixNodeName(model->Name());
|
|
|
// even though there is only a single input node, the design of
|
|
|
// assimp (or rather: the complicated transformation chain that
|
|
@@ -266,12 +265,10 @@ void FBXConverter::ConvertNodes(uint64_t id, aiNode *parent, aiNode *root_node)
|
|
|
|
|
|
child->mParent = last_parent;
|
|
|
last_parent = child.mNode;
|
|
|
-
|
|
|
- new_abs_transform *= child->mTransformation;
|
|
|
}
|
|
|
|
|
|
// attach geometry
|
|
|
- ConvertModel(*model, nodes_chain.back().mNode, root_node, new_abs_transform);
|
|
|
+ ConvertModel(*model, nodes_chain.back().mNode, root_node);
|
|
|
|
|
|
// check if there will be any child nodes
|
|
|
const std::vector<const Connection *> &child_conns = doc.GetConnectionsByDestinationSequenced(model->ID(), "Model");
|
|
@@ -290,8 +287,6 @@ void FBXConverter::ConvertNodes(uint64_t id, aiNode *parent, aiNode *root_node)
|
|
|
|
|
|
postnode->mParent = last_parent;
|
|
|
last_parent = postnode.mNode;
|
|
|
-
|
|
|
- new_abs_transform *= postnode->mTransformation;
|
|
|
}
|
|
|
} else {
|
|
|
// free the nodes we allocated as we don't need them
|
|
@@ -899,8 +894,7 @@ void FBXConverter::SetupNodeMetadata(const Model &model, aiNode &nd) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-void FBXConverter::ConvertModel(const Model &model, aiNode *parent, aiNode *root_node,
|
|
|
- const aiMatrix4x4 &absolute_transform) {
|
|
|
+void FBXConverter::ConvertModel(const Model &model, aiNode *parent, aiNode *root_node) {
|
|
|
const std::vector<const Geometry *> &geos = model.GetGeometry();
|
|
|
|
|
|
std::vector<unsigned int> meshes;
|
|
@@ -911,8 +905,7 @@ void FBXConverter::ConvertModel(const Model &model, aiNode *parent, aiNode *root
|
|
|
const MeshGeometry *const mesh = dynamic_cast<const MeshGeometry *>(geo);
|
|
|
const LineGeometry *const line = dynamic_cast<const LineGeometry *>(geo);
|
|
|
if (mesh) {
|
|
|
- const std::vector<unsigned int> &indices = ConvertMesh(*mesh, model, parent, root_node,
|
|
|
- absolute_transform);
|
|
|
+ const std::vector<unsigned int> &indices = ConvertMesh(*mesh, model, parent, root_node);
|
|
|
std::copy(indices.begin(), indices.end(), std::back_inserter(meshes));
|
|
|
} else if (line) {
|
|
|
const std::vector<unsigned int> &indices = ConvertLine(*line, root_node);
|
|
@@ -933,8 +926,7 @@ void FBXConverter::ConvertModel(const Model &model, aiNode *parent, aiNode *root
|
|
|
}
|
|
|
|
|
|
std::vector<unsigned int>
|
|
|
-FBXConverter::ConvertMesh(const MeshGeometry &mesh, const Model &model, aiNode *parent, aiNode *root_node,
|
|
|
- const aiMatrix4x4 &absolute_transform) {
|
|
|
+FBXConverter::ConvertMesh(const MeshGeometry &mesh, const Model &model, aiNode *parent, aiNode *root_node) {
|
|
|
std::vector<unsigned int> temp;
|
|
|
|
|
|
MeshMap::const_iterator it = meshes_converted.find(&mesh);
|
|
@@ -957,13 +949,13 @@ FBXConverter::ConvertMesh(const MeshGeometry &mesh, const Model &model, aiNode *
|
|
|
const MatIndexArray::value_type base = mindices[0];
|
|
|
for (MatIndexArray::value_type index : mindices) {
|
|
|
if (index != base) {
|
|
|
- return ConvertMeshMultiMaterial(mesh, model, parent, root_node, absolute_transform);
|
|
|
+ return ConvertMeshMultiMaterial(mesh, model, parent, root_node);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// faster code-path, just copy the data
|
|
|
- temp.push_back(ConvertMeshSingleMaterial(mesh, model, absolute_transform, parent, root_node));
|
|
|
+ temp.push_back(ConvertMeshSingleMaterial(mesh, model, parent, root_node));
|
|
|
return temp;
|
|
|
}
|
|
|
|
|
@@ -1032,8 +1024,7 @@ aiMesh *FBXConverter::SetupEmptyMesh(const Geometry &mesh, aiNode *parent) {
|
|
|
}
|
|
|
|
|
|
unsigned int FBXConverter::ConvertMeshSingleMaterial(const MeshGeometry &mesh, const Model &model,
|
|
|
- const aiMatrix4x4 &absolute_transform, aiNode *parent,
|
|
|
- aiNode *) {
|
|
|
+ aiNode *parent, aiNode *) {
|
|
|
const MatIndexArray &mindices = mesh.GetMaterialIndices();
|
|
|
aiMesh *const out_mesh = SetupEmptyMesh(mesh, parent);
|
|
|
|
|
@@ -1152,7 +1143,7 @@ unsigned int FBXConverter::ConvertMeshSingleMaterial(const MeshGeometry &mesh, c
|
|
|
}
|
|
|
|
|
|
if (doc.Settings().readWeights && mesh.DeformerSkin() != nullptr) {
|
|
|
- ConvertWeights(out_mesh, mesh, absolute_transform, parent, NO_MATERIAL_SEPARATION, nullptr);
|
|
|
+ ConvertWeights(out_mesh, mesh, parent, NO_MATERIAL_SEPARATION, nullptr);
|
|
|
}
|
|
|
|
|
|
std::vector<aiAnimMesh *> animMeshes;
|
|
@@ -1200,8 +1191,7 @@ unsigned int FBXConverter::ConvertMeshSingleMaterial(const MeshGeometry &mesh, c
|
|
|
|
|
|
std::vector<unsigned int>
|
|
|
FBXConverter::ConvertMeshMultiMaterial(const MeshGeometry &mesh, const Model &model, aiNode *parent,
|
|
|
- aiNode *root_node,
|
|
|
- const aiMatrix4x4 &absolute_transform) {
|
|
|
+ aiNode *root_node) {
|
|
|
const MatIndexArray &mindices = mesh.GetMaterialIndices();
|
|
|
ai_assert(mindices.size());
|
|
|
|
|
@@ -1211,7 +1201,7 @@ FBXConverter::ConvertMeshMultiMaterial(const MeshGeometry &mesh, const Model &mo
|
|
|
for (MatIndexArray::value_type index : mindices) {
|
|
|
if (had.find(index) == had.end()) {
|
|
|
|
|
|
- indices.push_back(ConvertMeshMultiMaterial(mesh, model, index, parent, root_node, absolute_transform));
|
|
|
+ indices.push_back(ConvertMeshMultiMaterial(mesh, model, index, parent, root_node));
|
|
|
had.insert(index);
|
|
|
}
|
|
|
}
|
|
@@ -1221,8 +1211,7 @@ FBXConverter::ConvertMeshMultiMaterial(const MeshGeometry &mesh, const Model &mo
|
|
|
|
|
|
unsigned int FBXConverter::ConvertMeshMultiMaterial(const MeshGeometry &mesh, const Model &model,
|
|
|
MatIndexArray::value_type index,
|
|
|
- aiNode *parent, aiNode *,
|
|
|
- const aiMatrix4x4 &absolute_transform) {
|
|
|
+ aiNode *parent, aiNode *) {
|
|
|
aiMesh *const out_mesh = SetupEmptyMesh(mesh, parent);
|
|
|
|
|
|
const MatIndexArray &mindices = mesh.GetMaterialIndices();
|
|
@@ -1385,7 +1374,7 @@ unsigned int FBXConverter::ConvertMeshMultiMaterial(const MeshGeometry &mesh, co
|
|
|
ConvertMaterialForMesh(out_mesh, model, mesh, index);
|
|
|
|
|
|
if (process_weights) {
|
|
|
- ConvertWeights(out_mesh, mesh, absolute_transform, parent, index, &reverseMapping);
|
|
|
+ ConvertWeights(out_mesh, mesh, parent, index, &reverseMapping);
|
|
|
}
|
|
|
|
|
|
std::vector<aiAnimMesh *> animMeshes;
|
|
@@ -1436,7 +1425,6 @@ unsigned int FBXConverter::ConvertMeshMultiMaterial(const MeshGeometry &mesh, co
|
|
|
}
|
|
|
|
|
|
void FBXConverter::ConvertWeights(aiMesh *out, const MeshGeometry &geo,
|
|
|
- const aiMatrix4x4 &absolute_transform,
|
|
|
aiNode *parent, unsigned int materialIndex,
|
|
|
std::vector<unsigned int> *outputVertStartIndices) {
|
|
|
ai_assert(geo.DeformerSkin());
|
|
@@ -1508,7 +1496,7 @@ void FBXConverter::ConvertWeights(aiMesh *out, const MeshGeometry &geo,
|
|
|
// XXX this could be heavily simplified by collecting the bone
|
|
|
// data in a single step.
|
|
|
ConvertCluster(bones, cluster, out_indices, index_out_indices,
|
|
|
- count_out_indices, absolute_transform, parent);
|
|
|
+ count_out_indices, parent);
|
|
|
}
|
|
|
|
|
|
bone_map.clear();
|
|
@@ -1537,8 +1525,7 @@ const aiNode *GetNodeByName(aiNode *current_node) {
|
|
|
|
|
|
void FBXConverter::ConvertCluster(std::vector<aiBone *> &local_mesh_bones, const Cluster *cl,
|
|
|
std::vector<size_t> &out_indices, std::vector<size_t> &index_out_indices,
|
|
|
- std::vector<size_t> &count_out_indices, const aiMatrix4x4 &absolute_transform,
|
|
|
- aiNode *) {
|
|
|
+ std::vector<size_t> &count_out_indices, aiNode *) {
|
|
|
ai_assert(cl); // make sure cluster valid
|
|
|
std::string deformer_name = cl->TargetNode()->Name();
|
|
|
aiString bone_name = aiString(FixNodeName(deformer_name));
|
|
@@ -1554,7 +1541,6 @@ void FBXConverter::ConvertCluster(std::vector<aiBone *> &local_mesh_bones, const
|
|
|
bone->mName = bone_name;
|
|
|
|
|
|
bone->mOffsetMatrix = cl->Transform();
|
|
|
- aiMatrix4x4 matrix = (aiMatrix4x4)absolute_transform;
|
|
|
// store local transform link for post processing
|
|
|
/*
|
|
|
bone->mOffsetMatrix = cl->TransformLink();
|