- fbx: further work and bugfixes on deformer conversion.
parent
d194c83ed8
commit
f230ac2f60
|
@ -594,6 +594,11 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
ConvertMaterialForMesh(out_mesh,model,mesh,index);
|
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);
|
return static_cast<unsigned int>(meshes.size() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -654,6 +659,7 @@ private:
|
||||||
|
|
||||||
if (index_out_indices.back() == no_index_sentinel) {
|
if (index_out_indices.back() == no_index_sentinel) {
|
||||||
index_out_indices.back() = out_indices.size();
|
index_out_indices.back() = out_indices.size();
|
||||||
|
count_out_indices.push_back(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
out_indices.push_back(out_idx[i]);
|
out_indices.push_back(out_idx[i]);
|
||||||
|
@ -699,6 +705,8 @@ private:
|
||||||
bones.push_back(bone);
|
bones.push_back(bone);
|
||||||
|
|
||||||
bone->mName = FixNodeName(cl.TargetNode()->Name());
|
bone->mName = FixNodeName(cl.TargetNode()->Name());
|
||||||
|
bone->mOffsetMatrix = cl.TransformLink();
|
||||||
|
bone->mOffsetMatrix.Inverse();
|
||||||
|
|
||||||
bone->mNumWeights = static_cast<unsigned int>(out_indices.size());
|
bone->mNumWeights = static_cast<unsigned int>(out_indices.size());
|
||||||
aiVertexWeight* cursor = bone->mWeights = new aiVertexWeight[out_indices.size()];
|
aiVertexWeight* cursor = bone->mWeights = new aiVertexWeight[out_indices.size()];
|
||||||
|
|
|
@ -388,7 +388,7 @@ aiMatrix4x4 ReadMatrix(const Element& element)
|
||||||
|
|
||||||
aiMatrix4x4 result;
|
aiMatrix4x4 result;
|
||||||
|
|
||||||
// XXX transposed or not, this is the question :-)
|
|
||||||
result.a1 = values[0];
|
result.a1 = values[0];
|
||||||
result.a2 = values[1];
|
result.a2 = values[1];
|
||||||
result.a3 = values[2];
|
result.a3 = values[2];
|
||||||
|
@ -409,6 +409,7 @@ aiMatrix4x4 ReadMatrix(const Element& element)
|
||||||
result.d3 = values[14];
|
result.d3 = values[14];
|
||||||
result.d4 = values[15];
|
result.d4 = values[15];
|
||||||
|
|
||||||
|
result.Transpose();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -484,9 +484,10 @@ public:
|
||||||
// in the current conversion pattern this will only be needed if
|
// in the current conversion pattern this will only be needed if
|
||||||
// weights are present, so no need to always pre-compute this table
|
// weights are present, so no need to always pre-compute this table
|
||||||
if (facesVertexStartIndices.empty()) {
|
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());
|
ai_assert(facesVertexStartIndices.size() == faces.size());
|
||||||
|
|
|
@ -154,7 +154,7 @@ MeshGeometry::MeshGeometry(uint64_t id, const Element& element, const std::strin
|
||||||
cursor = 0;
|
cursor = 0;
|
||||||
BOOST_FOREACH(int index, tempFaces) {
|
BOOST_FOREACH(int index, tempFaces) {
|
||||||
const int absi = index < 0 ? (-index - 1) : index;
|
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:
|
// if settings.readAllLayers is true:
|
||||||
|
|
Loading…
Reference in New Issue