mirror of
https://github.com/overte-org/overte.git
synced 2025-04-08 19:14:59 +02:00
cleaned up code and changed the forward offset for the default eyes when there is no neck bone
This commit is contained in:
parent
a3f2fd1f23
commit
f26d6b8c3d
3 changed files with 4 additions and 15 deletions
|
@ -1992,7 +1992,7 @@ void MyAvatar::initHeadBones() {
|
|||
if (neckJointIndex == -1) {
|
||||
neckJointIndex = (_skeletonModel->getFBXGeometry().headJointIndex - 1);
|
||||
if (neckJointIndex < 0) {
|
||||
//return if the head is not even there. can't cauterize!!
|
||||
// return if the head is not even there. can't cauterize!!
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -71,23 +71,14 @@ void SkeletonModel::initJointStates() {
|
|||
qCWarning(avatars_renderer) << "Bad head joint! Got:" << headJointIndex << "jointCount:" << _rig.getJointStateCount();
|
||||
}
|
||||
glm::vec3 leftEyePosition, rightEyePosition;
|
||||
qCDebug(avatars_renderer) << "initial left and right eyes " << leftEyePosition << " " << rightEyePosition;
|
||||
getEyeModelPositions(leftEyePosition, rightEyePosition);
|
||||
qCDebug(avatars_renderer) << "after setting the left and right eyes " << leftEyePosition << " " << rightEyePosition;
|
||||
glm::vec3 midEyePosition = (leftEyePosition + rightEyePosition) / 2.0f;
|
||||
|
||||
int rootJointIndex = geometry.rootJointIndex;
|
||||
glm::vec3 rootModelPosition;
|
||||
getJointPosition(rootJointIndex, rootModelPosition);
|
||||
qCDebug(avatars_renderer) << "root joint index " << rootJointIndex << " root position: " << rootModelPosition;
|
||||
|
||||
_defaultEyeModelPosition = midEyePosition - rootModelPosition;
|
||||
if (headJointIndex > -1) {
|
||||
glm::vec3 headModelPosition;
|
||||
getJointPosition(headJointIndex, headModelPosition);
|
||||
qCDebug(avatars_renderer) << "we have a head joint " << headJointIndex << " and " << headModelPosition;
|
||||
}
|
||||
qCDebug(avatars_renderer) << "the default eye pos " << _defaultEyeModelPosition << " and scale " << _scale;
|
||||
|
||||
// Skeleton may have already been scaled so unscale it
|
||||
_defaultEyeModelPosition = _defaultEyeModelPosition / _scale;
|
||||
|
@ -307,11 +298,11 @@ bool SkeletonModel::getEyeModelPositions(glm::vec3& firstEyePosition, glm::vec3&
|
|||
glm::vec3 baseEyePosition = headPosition;
|
||||
glm::quat headRotation;
|
||||
getJointRotation(geometry.headJointIndex, headRotation);
|
||||
const float EYES_FORWARD = 0.25f;
|
||||
const float EYES_FORWARD_HEAD_ONLY = 0.30f;
|
||||
const float EYE_SEPARATION = 0.1f;
|
||||
float headHeight = glm::distance(neckPosition, headPosition);
|
||||
firstEyePosition = baseEyePosition + headRotation * glm::vec3(EYE_SEPARATION, 0.0f, EYES_FORWARD);
|
||||
secondEyePosition = baseEyePosition + headRotation * glm::vec3(-EYE_SEPARATION, 0.0f, EYES_FORWARD);
|
||||
firstEyePosition = baseEyePosition + headRotation * glm::vec3(EYE_SEPARATION, 0.0f, EYES_FORWARD_HEAD_ONLY);
|
||||
secondEyePosition = baseEyePosition + headRotation * glm::vec3(-EYE_SEPARATION, 0.0f, EYES_FORWARD_HEAD_ONLY);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -139,8 +139,6 @@ void CauterizedModel::updateClusterMatrices() {
|
|||
glm::vec4(0.0f, 0.0f, 0.0f, 1.0f));
|
||||
auto cauterizeMatrix = _rig.getJointTransform(geometry.neckJointIndex) * zeroScale;
|
||||
|
||||
// qCDebug(renderutils) << "cauterize matrix: " << cauterizeMatrix;
|
||||
|
||||
for (int i = 0; i < _cauterizeMeshStates.size(); i++) {
|
||||
Model::MeshState& state = _cauterizeMeshStates[i];
|
||||
const FBXMesh& mesh = geometry.meshes.at(i);
|
||||
|
|
Loading…
Reference in a new issue