mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 01:24:03 +02:00
removed some print statements and added the code to use the head parent when the neck is missing, this allows for cauterization
This commit is contained in:
parent
c774dd7f5b
commit
a3f2fd1f23
6 changed files with 7 additions and 17 deletions
|
@ -3064,7 +3064,6 @@ void Application::updateCamera(RenderArgs& renderArgs, float deltaTime) {
|
|||
auto myAvatar = getMyAvatar();
|
||||
boomOffset = myAvatar->getModelScale() * myAvatar->getBoomLength() * -IDENTITY_FORWARD;
|
||||
|
||||
//qCDebug(interfaceapp) << "boom offset" << boomOffset;
|
||||
// The render mode is default or mirror if the camera is in mirror mode, assigned further below
|
||||
renderArgs._renderMode = RenderArgs::DEFAULT_RENDER_MODE;
|
||||
|
||||
|
@ -3075,12 +3074,10 @@ void Application::updateCamera(RenderArgs& renderArgs, float deltaTime) {
|
|||
_thirdPersonHMDCameraBoomValid= false;
|
||||
if (isHMDMode()) {
|
||||
mat4 camMat = myAvatar->getSensorToWorldMatrix() * myAvatar->getHMDSensorMatrix();
|
||||
//qCDebug(interfaceapp) << "camera 1rst translation hmd " << extractTranslation(camMat);
|
||||
_myCamera.setPosition(extractTranslation(camMat));
|
||||
_myCamera.setOrientation(glmExtractRotation(camMat));
|
||||
}
|
||||
else {
|
||||
//qCDebug(interfaceapp) << "camera 1rst translation desktop " << myAvatar->getDefaultEyePosition();
|
||||
_myCamera.setPosition(myAvatar->getDefaultEyePosition());
|
||||
_myCamera.setOrientation(myAvatar->getMyHead()->getHeadOrientation());
|
||||
}
|
||||
|
@ -3102,7 +3099,6 @@ void Application::updateCamera(RenderArgs& renderArgs, float deltaTime) {
|
|||
|
||||
_myCamera.setOrientation(glm::normalize(glmExtractRotation(worldCameraMat)));
|
||||
_myCamera.setPosition(extractTranslation(worldCameraMat));
|
||||
//qCDebug(interfaceapp) << "camera translation 3rd hmd " << extractTranslation(worldCameraMat);
|
||||
}
|
||||
else {
|
||||
_thirdPersonHMDCameraBoomValid = false;
|
||||
|
@ -3116,7 +3112,6 @@ void Application::updateCamera(RenderArgs& renderArgs, float deltaTime) {
|
|||
_myCamera.setPosition(myAvatar->getDefaultEyePosition()
|
||||
+ myAvatar->getWorldOrientation() * boomOffset);
|
||||
}
|
||||
qCDebug(interfaceapp) << "camera translation 3rd desktop " << (myAvatar->getDefaultEyePosition() + _myCamera.getOrientation() * boomOffset);
|
||||
}
|
||||
}
|
||||
else if (_myCamera.getMode() == CAMERA_MODE_MIRROR) {
|
||||
|
|
|
@ -1704,10 +1704,8 @@ glm::vec3 MyAvatar::getSkeletonPosition() const {
|
|||
// The avatar is rotated PI about the yAxis, so we have to correct for it
|
||||
// to get the skeleton offset contribution in the world-frame.
|
||||
const glm::quat FLIP = glm::angleAxis(PI, glm::vec3(0.0f, 1.0f, 0.0f));
|
||||
//qCDebug(interfaceapp) << "position third person " << getWorldPosition();
|
||||
return getWorldPosition() + getWorldOrientation() * FLIP * _skeletonOffset;
|
||||
}
|
||||
//qCDebug(interfaceapp) << "position first person " << Avatar::getWorldPosition();
|
||||
return Avatar::getWorldPosition();
|
||||
}
|
||||
|
||||
|
@ -1992,7 +1990,11 @@ void MyAvatar::initHeadBones() {
|
|||
neckJointIndex = _skeletonModel->getFBXGeometry().neckJointIndex;
|
||||
}
|
||||
if (neckJointIndex == -1) {
|
||||
return;
|
||||
neckJointIndex = (_skeletonModel->getFBXGeometry().headJointIndex - 1);
|
||||
if (neckJointIndex < 0) {
|
||||
//return if the head is not even there. can't cauterize!!
|
||||
return;
|
||||
}
|
||||
}
|
||||
_headBoneSet.clear();
|
||||
std::queue<int> q;
|
||||
|
|
|
@ -95,9 +95,7 @@ void MySkeletonModel::updateRig(float deltaTime, glm::mat4 parentTransform) {
|
|||
|
||||
// make sure lookAt is not too close to face (avoid crosseyes)
|
||||
glm::vec3 lookAt = head->getLookAtPosition();
|
||||
//qCDebug(interfaceapp) << "look at " << lookAt;
|
||||
glm::vec3 focusOffset = lookAt - _owningAvatar->getHead()->getEyePosition();
|
||||
//qCDebug(interfaceapp) << "focus offset " << focusOffset;
|
||||
float focusDistance = glm::length(focusOffset);
|
||||
const float MIN_LOOK_AT_FOCUS_DISTANCE = 1.0f;
|
||||
if (focusDistance < MIN_LOOK_AT_FOCUS_DISTANCE && focusDistance > EPSILON) {
|
||||
|
@ -115,8 +113,6 @@ void MySkeletonModel::updateRig(float deltaTime, glm::mat4 parentTransform) {
|
|||
glm::mat4 avatarToWorldMatrix = createMatFromQuatAndPos(myAvatar->getWorldOrientation(), myAvatar->getWorldPosition());
|
||||
glm::mat4 sensorToWorldMatrix = myAvatar->getSensorToWorldMatrix();
|
||||
params.rigToSensorMatrix = glm::inverse(sensorToWorldMatrix) * avatarToWorldMatrix * rigToAvatarMatrix;
|
||||
//qCDebug(interfaceapp) << "AVATAR: " << avatarToWorldMatrix;
|
||||
//qCDebug(interfaceapp) << "SENSOR " << sensorToWorldMatrix;
|
||||
|
||||
// input action is the highest priority source for head orientation.
|
||||
auto avatarHeadPose = myAvatar->getControllerPoseInAvatarFrame(controller::Action::HEAD);
|
||||
|
@ -286,7 +282,6 @@ void MySkeletonModel::updateRig(float deltaTime, glm::mat4 parentTransform) {
|
|||
eyeParams.leftEyeJointIndex = geometry.leftEyeJointIndex;
|
||||
eyeParams.rightEyeJointIndex = geometry.rightEyeJointIndex;
|
||||
|
||||
//qCDebug(interfaceapp) << "right eye index is " << geometry.leftEyeJointIndex;
|
||||
_rig.updateFromEyeParameters(eyeParams);
|
||||
|
||||
updateFingers();
|
||||
|
|
|
@ -169,8 +169,6 @@ AABox Avatar::getBounds() const {
|
|||
// approximately 2m tall, scaled to user request.
|
||||
return AABox(getWorldPosition() - glm::vec3(getModelScale()), getModelScale() * 2.0f);
|
||||
}
|
||||
//float temp = _skeletonModel->getRenderableMeshBound().getLargestDimension();
|
||||
//qCDebug(animation) << " largest bounding box dimension " << temp;
|
||||
return _skeletonModel->getRenderableMeshBound();
|
||||
}
|
||||
|
||||
|
@ -1777,7 +1775,6 @@ void Avatar::buildUnscaledEyeHeightCache() {
|
|||
// Sanity check by looking at the model extents.
|
||||
Extents meshExtents = _skeletonModel->getUnscaledMeshExtents();
|
||||
float meshHeight = meshExtents.size().y;
|
||||
//qCDebug(animation) << "mesh height " << meshHeight << " skeleton height " << skeletonHeight;
|
||||
|
||||
// if we determine the mesh is much larger then the skeleton, then we use the mesh height instead.
|
||||
// This helps prevent absurdly large avatars from exceeding the domain height limit.
|
||||
|
|
|
@ -139,6 +139,8 @@ 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);
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
//
|
||||
|
||||
#include "Camera.h"
|
||||
//#include "../SharedLogging.h"
|
||||
|
||||
/**jsdoc
|
||||
* <p>Camera modes affect the position of the camera and the controls for camera movement. The camera can be in one of the
|
||||
|
|
Loading…
Reference in a new issue