mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 15:59:49 +02:00
Merge pull request #3436 from ey6es/master
Fix for shirts on avatars created with new version of Fuse.
This commit is contained in:
commit
cf135c300c
2 changed files with 23 additions and 3 deletions
|
@ -184,8 +184,8 @@ void Head::relaxLean(float deltaTime) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Head::render(float alpha, Model::RenderMode mode) {
|
void Head::render(float alpha, Model::RenderMode mode) {
|
||||||
if (_faceModel.render(alpha, mode, Menu::getInstance()->isOptionChecked(MenuOption::AvatarsReceiveShadows)) &&
|
_faceModel.render(alpha, mode, Menu::getInstance()->isOptionChecked(MenuOption::AvatarsReceiveShadows));
|
||||||
_renderLookatVectors && mode != Model::SHADOW_RENDER_MODE) {
|
if (_renderLookatVectors && mode != Model::SHADOW_RENDER_MODE) {
|
||||||
renderLookatVectors(_leftEyePosition, _rightEyePosition, _lookAtPosition);
|
renderLookatVectors(_leftEyePosition, _rightEyePosition, _lookAtPosition);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1755,12 +1755,24 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping)
|
||||||
|
|
||||||
// look for an unused slot in the weights vector
|
// look for an unused slot in the weights vector
|
||||||
glm::vec4& weights = extracted.mesh.clusterWeights[it.value()];
|
glm::vec4& weights = extracted.mesh.clusterWeights[it.value()];
|
||||||
for (int k = 0; k < 4; k++) {
|
int lowestIndex = -1;
|
||||||
|
float lowestWeight = FLT_MAX;
|
||||||
|
int k = 0;
|
||||||
|
for (; k < 4; k++) {
|
||||||
if (weights[k] == 0.0f) {
|
if (weights[k] == 0.0f) {
|
||||||
extracted.mesh.clusterIndices[it.value()][k] = i;
|
extracted.mesh.clusterIndices[it.value()][k] = i;
|
||||||
weights[k] = weight;
|
weights[k] = weight;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (weights[k] < lowestWeight) {
|
||||||
|
lowestIndex = k;
|
||||||
|
lowestWeight = weights[k];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (k == 4) {
|
||||||
|
// no space for an additional weight; we must replace the lowest
|
||||||
|
weights[lowestIndex] = weight;
|
||||||
|
extracted.mesh.clusterIndices[it.value()][lowestIndex] = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1769,6 +1781,14 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping)
|
||||||
maxJointIndex = jointIndex;
|
maxJointIndex = jointIndex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// normalize the weights if they don't add up to one
|
||||||
|
for (int i = 0; i < extracted.mesh.clusterWeights.size(); i++) {
|
||||||
|
glm::vec4& weights = extracted.mesh.clusterWeights[i];
|
||||||
|
float total = weights.x + weights.y + weights.z + weights.w;
|
||||||
|
if (total != 1.0f && total != 0.0f) {
|
||||||
|
weights /= total;
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
int jointIndex = maxJointIndex;
|
int jointIndex = maxJointIndex;
|
||||||
FBXJoint& joint = geometry.joints[jointIndex];
|
FBXJoint& joint = geometry.joints[jointIndex];
|
||||||
|
|
Loading…
Reference in a new issue