Custom Animations should now work. We also save color values if there's no texture.

This commit is contained in:
antc13
2016-01-24 13:28:40 +01:00
parent 3baa988ad4
commit b5b1140f5c
11 changed files with 341 additions and 28 deletions
+12 -2
View File
@@ -309,12 +309,22 @@ Mesh MeshClass::GetMeshData(MObjectArray object)
if (hasSkin) {
float totalWeight = 0.0f;
unsigned int totalBones = 0;
MIntArray jointIDs /* ??? */;
weights.selectAncestorLogicalIndex(vertexIndex, weightListObject);
weights.getExistingArrayAttributeIndices(jointIDs);
for (unsigned int i = 0; i < jointIDs.length() && i < 4; i++) {
thisVertex.BoneIndices[i] = jointIDs[i];
thisVertex.BoneWeights[i] = weights[i].asFloat();
if (weights[i].asFloat() > 0.001f) {
thisVertex.BoneIndices[totalBones] = jointIDs[i];
thisVertex.BoneWeights[totalBones] = weights[i].asFloat();
totalWeight = totalWeight + weights[i].asFloat();
totalBones++;
}
}
for (unsigned int i = 0; i < 4; i++) {
thisVertex.BoneWeights[i] = thisVertex.BoneWeights[i] / totalWeight;
}
}