- fbx: further work and bugfixes on deformer conversion.

pull/14/head
Alexander Gessler 2012-07-26 23:45:07 +02:00
parent d194c83ed8
commit f230ac2f60
4 changed files with 14 additions and 4 deletions

View File

@ -594,6 +594,11 @@ private:
}
ConvertMaterialForMesh(out_mesh,model,mesh,index);
if(doc.Settings().readWeights && mesh.DeformerSkin() != NULL) {
ConvertWeights(out_mesh, model, mesh, index);
}
return static_cast<unsigned int>(meshes.size() - 1);
}
@ -654,6 +659,7 @@ private:
if (index_out_indices.back() == no_index_sentinel) {
index_out_indices.back() = out_indices.size();
count_out_indices.push_back(0);
}
out_indices.push_back(out_idx[i]);
@ -699,6 +705,8 @@ private:
bones.push_back(bone);
bone->mName = FixNodeName(cl.TargetNode()->Name());
bone->mOffsetMatrix = cl.TransformLink();
bone->mOffsetMatrix.Inverse();
bone->mNumWeights = static_cast<unsigned int>(out_indices.size());
aiVertexWeight* cursor = bone->mWeights = new aiVertexWeight[out_indices.size()];

View File

@ -388,7 +388,7 @@ aiMatrix4x4 ReadMatrix(const Element& element)
aiMatrix4x4 result;
// XXX transposed or not, this is the question :-)
result.a1 = values[0];
result.a2 = values[1];
result.a3 = values[2];
@ -409,6 +409,7 @@ aiMatrix4x4 ReadMatrix(const Element& element)
result.d3 = values[14];
result.d4 = values[15];
result.Transpose();
return result;
}

View File

@ -484,9 +484,10 @@ public:
// in the current conversion pattern this will only be needed if
// weights are present, so no need to always pre-compute this table
if (facesVertexStartIndices.empty()) {
facesVertexStartIndices.resize(faces.size());
facesVertexStartIndices.resize(faces.size() + 1, 0);
std::partial_sum(faces.begin(), faces.end(), facesVertexStartIndices.begin());
std::partial_sum(faces.begin(), faces.end(), facesVertexStartIndices.begin() + 1);
facesVertexStartIndices.pop_back();
}
ai_assert(facesVertexStartIndices.size() == faces.size());

View File

@ -154,7 +154,7 @@ MeshGeometry::MeshGeometry(uint64_t id, const Element& element, const std::strin
cursor = 0;
BOOST_FOREACH(int index, tempFaces) {
const int absi = index < 0 ? (-index - 1) : index;
mappings[mapping_offsets[absi] + mapping_counts[absi]++] = cursor;
mappings[mapping_offsets[absi] + mapping_counts[absi]++] = cursor++;
}
// if settings.readAllLayers is true: