mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 05:48:26 +02:00
Merge branch 'master' of github.com:highfidelity/hifi into punk
This commit is contained in:
commit
9c436bc28c
17 changed files with 88 additions and 226 deletions
|
@ -428,6 +428,10 @@ void Agent::executeScript() {
|
||||||
using namespace recording;
|
using namespace recording;
|
||||||
static const FrameType AUDIO_FRAME_TYPE = Frame::registerFrameType(AudioConstants::getAudioFrameName());
|
static const FrameType AUDIO_FRAME_TYPE = Frame::registerFrameType(AudioConstants::getAudioFrameName());
|
||||||
Frame::registerFrameHandler(AUDIO_FRAME_TYPE, [this, &scriptedAvatar](Frame::ConstPointer frame) {
|
Frame::registerFrameHandler(AUDIO_FRAME_TYPE, [this, &scriptedAvatar](Frame::ConstPointer frame) {
|
||||||
|
if (_shouldMuteRecordingAudio) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
static quint16 audioSequenceNumber{ 0 };
|
static quint16 audioSequenceNumber{ 0 };
|
||||||
|
|
||||||
QByteArray audio(frame->data);
|
QByteArray audio(frame->data);
|
||||||
|
@ -756,6 +760,10 @@ void Agent::processAgentAvatarAudio() {
|
||||||
const int16_t* nextSoundOutput = NULL;
|
const int16_t* nextSoundOutput = NULL;
|
||||||
|
|
||||||
if (_avatarSound && _avatarSound->isReady()) {
|
if (_avatarSound && _avatarSound->isReady()) {
|
||||||
|
if (isPlayingRecording && !_shouldMuteRecordingAudio) {
|
||||||
|
_shouldMuteRecordingAudio = true;
|
||||||
|
}
|
||||||
|
|
||||||
auto audioData = _avatarSound->getAudioData();
|
auto audioData = _avatarSound->getAudioData();
|
||||||
nextSoundOutput = reinterpret_cast<const int16_t*>(audioData->rawData()
|
nextSoundOutput = reinterpret_cast<const int16_t*>(audioData->rawData()
|
||||||
+ _numAvatarSoundSentBytes);
|
+ _numAvatarSoundSentBytes);
|
||||||
|
@ -781,6 +789,10 @@ void Agent::processAgentAvatarAudio() {
|
||||||
_avatarSound.clear();
|
_avatarSound.clear();
|
||||||
_numAvatarSoundSentBytes = 0;
|
_numAvatarSoundSentBytes = 0;
|
||||||
_flushEncoder = true;
|
_flushEncoder = true;
|
||||||
|
|
||||||
|
if (_shouldMuteRecordingAudio) {
|
||||||
|
_shouldMuteRecordingAudio = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -107,6 +107,7 @@ private:
|
||||||
ResourceRequest* _pendingScriptRequest { nullptr };
|
ResourceRequest* _pendingScriptRequest { nullptr };
|
||||||
bool _isListeningToAudioStream = false;
|
bool _isListeningToAudioStream = false;
|
||||||
SharedSoundPointer _avatarSound;
|
SharedSoundPointer _avatarSound;
|
||||||
|
bool _shouldMuteRecordingAudio { false };
|
||||||
int _numAvatarSoundSentBytes = 0;
|
int _numAvatarSoundSentBytes = 0;
|
||||||
bool _isAvatar = false;
|
bool _isAvatar = false;
|
||||||
QTimer* _avatarIdentityTimer = nullptr;
|
QTimer* _avatarIdentityTimer = nullptr;
|
||||||
|
|
|
@ -75,6 +75,10 @@ Rectangle {
|
||||||
if(materialUrlOrJson) {
|
if(materialUrlOrJson) {
|
||||||
wearable.text = 'Material: ' + materialUrlOrJson;
|
wearable.text = 'Material: ' + materialUrlOrJson;
|
||||||
}
|
}
|
||||||
|
} else if (wearable.sourceUrl) {
|
||||||
|
wearable.text = extractTitleFromUrl(wearable.sourceUrl);
|
||||||
|
} else if (wearable.name) {
|
||||||
|
wearable.text = wearable.name;
|
||||||
}
|
}
|
||||||
wearablesCombobox.model.append(wearable);
|
wearablesCombobox.model.append(wearable);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5252,7 +5252,8 @@ void Application::resumeAfterLoginDialogActionTaken() {
|
||||||
// this will force the model the look at the correct directory (weird order of operations issue)
|
// this will force the model the look at the correct directory (weird order of operations issue)
|
||||||
scriptEngines->reloadLocalFiles();
|
scriptEngines->reloadLocalFiles();
|
||||||
|
|
||||||
if (!_defaultScriptsLocation.exists()) {
|
// if the --scripts command-line argument was used.
|
||||||
|
if (!_defaultScriptsLocation.exists() && (arguments().indexOf(QString("--").append(SCRIPTS_SWITCH))) != -1) {
|
||||||
scriptEngines->loadDefaultScripts();
|
scriptEngines->loadDefaultScripts();
|
||||||
scriptEngines->defaultScriptsLocationOverridden(true);
|
scriptEngines->defaultScriptsLocationOverridden(true);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -2418,10 +2418,10 @@ void MyAvatar::attachmentDataToEntityProperties(const AttachmentData& data, Enti
|
||||||
void MyAvatar::initHeadBones() {
|
void MyAvatar::initHeadBones() {
|
||||||
int neckJointIndex = -1;
|
int neckJointIndex = -1;
|
||||||
if (_skeletonModel->isLoaded()) {
|
if (_skeletonModel->isLoaded()) {
|
||||||
neckJointIndex = _skeletonModel->getHFMModel().neckJointIndex;
|
neckJointIndex = getJointIndex("Neck");
|
||||||
}
|
}
|
||||||
if (neckJointIndex == -1) {
|
if (neckJointIndex == -1) {
|
||||||
neckJointIndex = (_skeletonModel->getHFMModel().headJointIndex - 1);
|
neckJointIndex = (getJointIndex("Head") - 1);
|
||||||
if (neckJointIndex < 0) {
|
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;
|
return;
|
||||||
|
|
|
@ -301,8 +301,8 @@ void MySkeletonModel::updateRig(float deltaTime, glm::mat4 parentTransform) {
|
||||||
eyeParams.eyeSaccade = head->getSaccade();
|
eyeParams.eyeSaccade = head->getSaccade();
|
||||||
eyeParams.modelRotation = getRotation();
|
eyeParams.modelRotation = getRotation();
|
||||||
eyeParams.modelTranslation = getTranslation();
|
eyeParams.modelTranslation = getTranslation();
|
||||||
eyeParams.leftEyeJointIndex = hfmModel.leftEyeJointIndex;
|
eyeParams.leftEyeJointIndex = _rig.indexOfJoint("LeftEye");
|
||||||
eyeParams.rightEyeJointIndex = hfmModel.rightEyeJointIndex;
|
eyeParams.rightEyeJointIndex = _rig.indexOfJoint("RightEye");
|
||||||
|
|
||||||
_rig.updateFromEyeParameters(eyeParams);
|
_rig.updateFromEyeParameters(eyeParams);
|
||||||
|
|
||||||
|
|
|
@ -95,7 +95,12 @@ void LoginDialog::toggleAction() {
|
||||||
} else {
|
} else {
|
||||||
// change the menu item to login
|
// change the menu item to login
|
||||||
loginAction->setText("Log In / Sign Up");
|
loginAction->setText("Log In / Sign Up");
|
||||||
connection = connect(loginAction, &QAction::triggered, [] { LoginDialog::showWithSelection(); });
|
connection = connect(loginAction, &QAction::triggered, [] {
|
||||||
|
// if not in login state, show.
|
||||||
|
if (!qApp->getLoginDialogPoppedUp()) {
|
||||||
|
LoginDialog::showWithSelection();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -343,18 +343,18 @@ void Rig::initJointStates(const HFMModel& hfmModel, const glm::mat4& modelOffset
|
||||||
|
|
||||||
buildAbsoluteRigPoses(_animSkeleton->getRelativeDefaultPoses(), _absoluteDefaultPoses);
|
buildAbsoluteRigPoses(_animSkeleton->getRelativeDefaultPoses(), _absoluteDefaultPoses);
|
||||||
|
|
||||||
_rootJointIndex = hfmModel.rootJointIndex;
|
_rootJointIndex = indexOfJoint("Hips");
|
||||||
_leftEyeJointIndex = hfmModel.leftEyeJointIndex;
|
_leftEyeJointIndex = indexOfJoint("LeftEye");
|
||||||
_rightEyeJointIndex = hfmModel.rightEyeJointIndex;
|
_rightEyeJointIndex = indexOfJoint("RightEye");
|
||||||
_leftHandJointIndex = hfmModel.leftHandJointIndex;
|
_leftHandJointIndex = indexOfJoint("LeftHand");
|
||||||
_leftElbowJointIndex = _leftHandJointIndex >= 0 ? hfmModel.joints.at(_leftHandJointIndex).parentIndex : -1;
|
_leftElbowJointIndex = _leftHandJointIndex >= 0 ? hfmModel.joints.at(_leftHandJointIndex).parentIndex : -1;
|
||||||
_leftShoulderJointIndex = _leftElbowJointIndex >= 0 ? hfmModel.joints.at(_leftElbowJointIndex).parentIndex : -1;
|
_leftShoulderJointIndex = _leftElbowJointIndex >= 0 ? hfmModel.joints.at(_leftElbowJointIndex).parentIndex : -1;
|
||||||
_rightHandJointIndex = hfmModel.rightHandJointIndex;
|
_rightHandJointIndex = indexOfJoint("RightHand");
|
||||||
_rightElbowJointIndex = _rightHandJointIndex >= 0 ? hfmModel.joints.at(_rightHandJointIndex).parentIndex : -1;
|
_rightElbowJointIndex = _rightHandJointIndex >= 0 ? hfmModel.joints.at(_rightHandJointIndex).parentIndex : -1;
|
||||||
_rightShoulderJointIndex = _rightElbowJointIndex >= 0 ? hfmModel.joints.at(_rightElbowJointIndex).parentIndex : -1;
|
_rightShoulderJointIndex = _rightElbowJointIndex >= 0 ? hfmModel.joints.at(_rightElbowJointIndex).parentIndex : -1;
|
||||||
|
|
||||||
_leftEyeJointChildren = _animSkeleton->getChildrenOfJoint(hfmModel.leftEyeJointIndex);
|
_leftEyeJointChildren = _animSkeleton->getChildrenOfJoint(indexOfJoint("LeftEye"));
|
||||||
_rightEyeJointChildren = _animSkeleton->getChildrenOfJoint(hfmModel.rightEyeJointIndex);
|
_rightEyeJointChildren = _animSkeleton->getChildrenOfJoint(indexOfJoint("RightEye"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Rig::reset(const HFMModel& hfmModel) {
|
void Rig::reset(const HFMModel& hfmModel) {
|
||||||
|
@ -390,18 +390,18 @@ void Rig::reset(const HFMModel& hfmModel) {
|
||||||
|
|
||||||
buildAbsoluteRigPoses(_animSkeleton->getRelativeDefaultPoses(), _absoluteDefaultPoses);
|
buildAbsoluteRigPoses(_animSkeleton->getRelativeDefaultPoses(), _absoluteDefaultPoses);
|
||||||
|
|
||||||
_rootJointIndex = hfmModel.rootJointIndex;
|
_rootJointIndex = indexOfJoint("Hips");;
|
||||||
_leftEyeJointIndex = hfmModel.leftEyeJointIndex;
|
_leftEyeJointIndex = indexOfJoint("LeftEye");
|
||||||
_rightEyeJointIndex = hfmModel.rightEyeJointIndex;
|
_rightEyeJointIndex = indexOfJoint("RightEye");
|
||||||
_leftHandJointIndex = hfmModel.leftHandJointIndex;
|
_leftHandJointIndex = indexOfJoint("LeftHand");
|
||||||
_leftElbowJointIndex = _leftHandJointIndex >= 0 ? hfmModel.joints.at(_leftHandJointIndex).parentIndex : -1;
|
_leftElbowJointIndex = _leftHandJointIndex >= 0 ? hfmModel.joints.at(_leftHandJointIndex).parentIndex : -1;
|
||||||
_leftShoulderJointIndex = _leftElbowJointIndex >= 0 ? hfmModel.joints.at(_leftElbowJointIndex).parentIndex : -1;
|
_leftShoulderJointIndex = _leftElbowJointIndex >= 0 ? hfmModel.joints.at(_leftElbowJointIndex).parentIndex : -1;
|
||||||
_rightHandJointIndex = hfmModel.rightHandJointIndex;
|
_rightHandJointIndex = indexOfJoint("RightHand");
|
||||||
_rightElbowJointIndex = _rightHandJointIndex >= 0 ? hfmModel.joints.at(_rightHandJointIndex).parentIndex : -1;
|
_rightElbowJointIndex = _rightHandJointIndex >= 0 ? hfmModel.joints.at(_rightHandJointIndex).parentIndex : -1;
|
||||||
_rightShoulderJointIndex = _rightElbowJointIndex >= 0 ? hfmModel.joints.at(_rightElbowJointIndex).parentIndex : -1;
|
_rightShoulderJointIndex = _rightElbowJointIndex >= 0 ? hfmModel.joints.at(_rightElbowJointIndex).parentIndex : -1;
|
||||||
|
|
||||||
_leftEyeJointChildren = _animSkeleton->getChildrenOfJoint(hfmModel.leftEyeJointIndex);
|
_leftEyeJointChildren = _animSkeleton->getChildrenOfJoint(indexOfJoint("LeftEye"));
|
||||||
_rightEyeJointChildren = _animSkeleton->getChildrenOfJoint(hfmModel.rightEyeJointIndex);
|
_rightEyeJointChildren = _animSkeleton->getChildrenOfJoint(indexOfJoint("RightEye"));
|
||||||
|
|
||||||
if (!_animGraphURL.isEmpty()) {
|
if (!_animGraphURL.isEmpty()) {
|
||||||
_animNode.reset();
|
_animNode.reset();
|
||||||
|
|
|
@ -1314,7 +1314,7 @@ glm::quat Avatar::getAbsoluteJointRotationInObjectFrame(int index) const {
|
||||||
case CAMERA_MATRIX_INDEX: {
|
case CAMERA_MATRIX_INDEX: {
|
||||||
glm::quat rotation;
|
glm::quat rotation;
|
||||||
if (_skeletonModel && _skeletonModel->isActive()) {
|
if (_skeletonModel && _skeletonModel->isActive()) {
|
||||||
int headJointIndex = _skeletonModel->getHFMModel().headJointIndex;
|
int headJointIndex = getJointIndex("Head");
|
||||||
if (headJointIndex >= 0) {
|
if (headJointIndex >= 0) {
|
||||||
_skeletonModel->getAbsoluteJointRotationInRigFrame(headJointIndex, rotation);
|
_skeletonModel->getAbsoluteJointRotationInRigFrame(headJointIndex, rotation);
|
||||||
}
|
}
|
||||||
|
@ -1363,7 +1363,7 @@ glm::vec3 Avatar::getAbsoluteJointTranslationInObjectFrame(int index) const {
|
||||||
case CAMERA_MATRIX_INDEX: {
|
case CAMERA_MATRIX_INDEX: {
|
||||||
glm::vec3 translation;
|
glm::vec3 translation;
|
||||||
if (_skeletonModel && _skeletonModel->isActive()) {
|
if (_skeletonModel && _skeletonModel->isActive()) {
|
||||||
int headJointIndex = _skeletonModel->getHFMModel().headJointIndex;
|
int headJointIndex = getJointIndex("Head");
|
||||||
if (headJointIndex >= 0) {
|
if (headJointIndex >= 0) {
|
||||||
_skeletonModel->getAbsoluteJointTranslationInRigFrame(headJointIndex, translation);
|
_skeletonModel->getAbsoluteJointTranslationInRigFrame(headJointIndex, translation);
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,7 @@ void SkeletonModel::initJointStates() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Determine the default eye position for avatar scale = 1.0
|
// Determine the default eye position for avatar scale = 1.0
|
||||||
int headJointIndex = hfmModel.headJointIndex;
|
int headJointIndex = _rig.indexOfJoint("Head");
|
||||||
if (0 > headJointIndex || headJointIndex >= _rig.getJointStateCount()) {
|
if (0 > headJointIndex || headJointIndex >= _rig.getJointStateCount()) {
|
||||||
qCWarning(avatars_renderer) << "Bad head joint! Got:" << headJointIndex << "jointCount:" << _rig.getJointStateCount();
|
qCWarning(avatars_renderer) << "Bad head joint! Got:" << headJointIndex << "jointCount:" << _rig.getJointStateCount();
|
||||||
}
|
}
|
||||||
|
@ -74,7 +74,7 @@ void SkeletonModel::initJointStates() {
|
||||||
getEyeModelPositions(leftEyePosition, rightEyePosition);
|
getEyeModelPositions(leftEyePosition, rightEyePosition);
|
||||||
glm::vec3 midEyePosition = (leftEyePosition + rightEyePosition) / 2.0f;
|
glm::vec3 midEyePosition = (leftEyePosition + rightEyePosition) / 2.0f;
|
||||||
|
|
||||||
int rootJointIndex = hfmModel.rootJointIndex;
|
int rootJointIndex = _rig.indexOfJoint("Hips");
|
||||||
glm::vec3 rootModelPosition;
|
glm::vec3 rootModelPosition;
|
||||||
getJointPosition(rootJointIndex, rootModelPosition);
|
getJointPosition(rootJointIndex, rootModelPosition);
|
||||||
|
|
||||||
|
@ -96,7 +96,6 @@ void SkeletonModel::initJointStates() {
|
||||||
// Called within Model::simulate call, below.
|
// Called within Model::simulate call, below.
|
||||||
void SkeletonModel::updateRig(float deltaTime, glm::mat4 parentTransform) {
|
void SkeletonModel::updateRig(float deltaTime, glm::mat4 parentTransform) {
|
||||||
assert(!_owningAvatar->isMyAvatar());
|
assert(!_owningAvatar->isMyAvatar());
|
||||||
const HFMModel& hfmModel = getHFMModel();
|
|
||||||
|
|
||||||
Head* head = _owningAvatar->getHead();
|
Head* head = _owningAvatar->getHead();
|
||||||
|
|
||||||
|
@ -124,7 +123,7 @@ void SkeletonModel::updateRig(float deltaTime, glm::mat4 parentTransform) {
|
||||||
|
|
||||||
// If the head is not positioned, updateEyeJoints won't get the math right
|
// If the head is not positioned, updateEyeJoints won't get the math right
|
||||||
glm::quat headOrientation;
|
glm::quat headOrientation;
|
||||||
_rig.getJointRotation(hfmModel.headJointIndex, headOrientation);
|
_rig.getJointRotation(_rig.indexOfJoint("Head"), headOrientation);
|
||||||
glm::vec3 eulers = safeEulerAngles(headOrientation);
|
glm::vec3 eulers = safeEulerAngles(headOrientation);
|
||||||
head->setBasePitch(glm::degrees(-eulers.x));
|
head->setBasePitch(glm::degrees(-eulers.x));
|
||||||
head->setBaseYaw(glm::degrees(eulers.y));
|
head->setBaseYaw(glm::degrees(eulers.y));
|
||||||
|
@ -135,8 +134,8 @@ void SkeletonModel::updateRig(float deltaTime, glm::mat4 parentTransform) {
|
||||||
eyeParams.eyeSaccade = glm::vec3(0.0f);
|
eyeParams.eyeSaccade = glm::vec3(0.0f);
|
||||||
eyeParams.modelRotation = getRotation();
|
eyeParams.modelRotation = getRotation();
|
||||||
eyeParams.modelTranslation = getTranslation();
|
eyeParams.modelTranslation = getTranslation();
|
||||||
eyeParams.leftEyeJointIndex = hfmModel.leftEyeJointIndex;
|
eyeParams.leftEyeJointIndex = _rig.indexOfJoint("LeftEye");
|
||||||
eyeParams.rightEyeJointIndex = hfmModel.rightEyeJointIndex;
|
eyeParams.rightEyeJointIndex = _rig.indexOfJoint("RightEye");
|
||||||
|
|
||||||
_rig.updateFromEyeParameters(eyeParams);
|
_rig.updateFromEyeParameters(eyeParams);
|
||||||
}
|
}
|
||||||
|
@ -259,45 +258,44 @@ bool SkeletonModel::getRightShoulderPosition(glm::vec3& position) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SkeletonModel::getHeadPosition(glm::vec3& headPosition) const {
|
bool SkeletonModel::getHeadPosition(glm::vec3& headPosition) const {
|
||||||
return isActive() && getJointPositionInWorldFrame(getHFMModel().headJointIndex, headPosition);
|
return isActive() && getJointPositionInWorldFrame(_rig.indexOfJoint("Head"), headPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SkeletonModel::getNeckPosition(glm::vec3& neckPosition) const {
|
bool SkeletonModel::getNeckPosition(glm::vec3& neckPosition) const {
|
||||||
return isActive() && getJointPositionInWorldFrame(getHFMModel().neckJointIndex, neckPosition);
|
return isActive() && getJointPositionInWorldFrame(_rig.indexOfJoint("Neck"), neckPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SkeletonModel::getLocalNeckPosition(glm::vec3& neckPosition) const {
|
bool SkeletonModel::getLocalNeckPosition(glm::vec3& neckPosition) const {
|
||||||
return isActive() && getJointPosition(getHFMModel().neckJointIndex, neckPosition);
|
return isActive() && getJointPosition(_rig.indexOfJoint("Neck"), neckPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SkeletonModel::getEyeModelPositions(glm::vec3& firstEyePosition, glm::vec3& secondEyePosition) const {
|
bool SkeletonModel::getEyeModelPositions(glm::vec3& firstEyePosition, glm::vec3& secondEyePosition) const {
|
||||||
if (!isActive()) {
|
if (!isActive()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const HFMModel& hfmModel = getHFMModel();
|
|
||||||
|
|
||||||
if (getJointPosition(hfmModel.leftEyeJointIndex, firstEyePosition) &&
|
if (getJointPosition(_rig.indexOfJoint("LeftEye"), firstEyePosition) &&
|
||||||
getJointPosition(hfmModel.rightEyeJointIndex, secondEyePosition)) {
|
getJointPosition(_rig.indexOfJoint("RightEye"), secondEyePosition)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// no eye joints; try to estimate based on head/neck joints
|
// no eye joints; try to estimate based on head/neck joints
|
||||||
glm::vec3 neckPosition, headPosition;
|
glm::vec3 neckPosition, headPosition;
|
||||||
if (getJointPosition(hfmModel.neckJointIndex, neckPosition) &&
|
if (getJointPosition(_rig.indexOfJoint("Neck"), neckPosition) &&
|
||||||
getJointPosition(hfmModel.headJointIndex, headPosition)) {
|
getJointPosition(_rig.indexOfJoint("Head"), headPosition)) {
|
||||||
const float EYE_PROPORTION = 0.6f;
|
const float EYE_PROPORTION = 0.6f;
|
||||||
glm::vec3 baseEyePosition = glm::mix(neckPosition, headPosition, EYE_PROPORTION);
|
glm::vec3 baseEyePosition = glm::mix(neckPosition, headPosition, EYE_PROPORTION);
|
||||||
glm::quat headRotation;
|
glm::quat headRotation;
|
||||||
getJointRotation(hfmModel.headJointIndex, headRotation);
|
getJointRotation(_rig.indexOfJoint("Head"), headRotation);
|
||||||
const float EYES_FORWARD = 0.25f;
|
const float EYES_FORWARD = 0.25f;
|
||||||
const float EYE_SEPARATION = 0.1f;
|
const float EYE_SEPARATION = 0.1f;
|
||||||
float headHeight = glm::distance(neckPosition, headPosition);
|
float headHeight = glm::distance(neckPosition, headPosition);
|
||||||
firstEyePosition = baseEyePosition + headRotation * glm::vec3(EYE_SEPARATION, 0.0f, EYES_FORWARD) * headHeight;
|
firstEyePosition = baseEyePosition + headRotation * glm::vec3(EYE_SEPARATION, 0.0f, EYES_FORWARD) * headHeight;
|
||||||
secondEyePosition = baseEyePosition + headRotation * glm::vec3(-EYE_SEPARATION, 0.0f, EYES_FORWARD) * headHeight;
|
secondEyePosition = baseEyePosition + headRotation * glm::vec3(-EYE_SEPARATION, 0.0f, EYES_FORWARD) * headHeight;
|
||||||
return true;
|
return true;
|
||||||
} else if (getJointPosition(hfmModel.headJointIndex, headPosition)) {
|
} else if (getJointPosition(_rig.indexOfJoint("Head"), headPosition)) {
|
||||||
glm::vec3 baseEyePosition = headPosition;
|
glm::vec3 baseEyePosition = headPosition;
|
||||||
glm::quat headRotation;
|
glm::quat headRotation;
|
||||||
getJointRotation(hfmModel.headJointIndex, headRotation);
|
getJointRotation(_rig.indexOfJoint("Head"), headRotation);
|
||||||
const float EYES_FORWARD_HEAD_ONLY = 0.30f;
|
const float EYES_FORWARD_HEAD_ONLY = 0.30f;
|
||||||
const float EYE_SEPARATION = 0.1f;
|
const float EYE_SEPARATION = 0.1f;
|
||||||
firstEyePosition = baseEyePosition + headRotation * glm::vec3(EYE_SEPARATION, 0.0f, EYES_FORWARD_HEAD_ONLY);
|
firstEyePosition = baseEyePosition + headRotation * glm::vec3(EYE_SEPARATION, 0.0f, EYES_FORWARD_HEAD_ONLY);
|
||||||
|
@ -331,7 +329,7 @@ void SkeletonModel::computeBoundingShape() {
|
||||||
}
|
}
|
||||||
|
|
||||||
const HFMModel& hfmModel = getHFMModel();
|
const HFMModel& hfmModel = getHFMModel();
|
||||||
if (hfmModel.joints.isEmpty() || hfmModel.rootJointIndex == -1) {
|
if (hfmModel.joints.isEmpty() || _rig.indexOfJoint("Hips") == -1) {
|
||||||
// rootJointIndex == -1 if the avatar model has no skeleton
|
// rootJointIndex == -1 if the avatar model has no skeleton
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -369,7 +367,7 @@ void SkeletonModel::renderBoundingCollisionShapes(RenderArgs* args, gpu::Batch&
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SkeletonModel::hasSkeleton() {
|
bool SkeletonModel::hasSkeleton() {
|
||||||
return isActive() ? getHFMModel().rootJointIndex != -1 : false;
|
return isActive() ? _rig.indexOfJoint("Hips") != -1 : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkeletonModel::onInvalidate() {
|
void SkeletonModel::onInvalidate() {
|
||||||
|
|
|
@ -41,10 +41,10 @@ public:
|
||||||
void updateAttitude(const glm::quat& orientation);
|
void updateAttitude(const glm::quat& orientation);
|
||||||
|
|
||||||
/// Returns the index of the left hand joint, or -1 if not found.
|
/// Returns the index of the left hand joint, or -1 if not found.
|
||||||
int getLeftHandJointIndex() const { return isActive() ? getHFMModel().leftHandJointIndex : -1; }
|
int getLeftHandJointIndex() const { return isActive() ? _rig.indexOfJoint("LeftHand") : -1; }
|
||||||
|
|
||||||
/// Returns the index of the right hand joint, or -1 if not found.
|
/// Returns the index of the right hand joint, or -1 if not found.
|
||||||
int getRightHandJointIndex() const { return isActive() ? getHFMModel().rightHandJointIndex : -1; }
|
int getRightHandJointIndex() const { return isActive() ? _rig.indexOfJoint("RightHand") : -1; }
|
||||||
|
|
||||||
bool getLeftGrabPosition(glm::vec3& position) const;
|
bool getLeftGrabPosition(glm::vec3& position) const;
|
||||||
bool getRightGrabPosition(glm::vec3& position) const;
|
bool getRightGrabPosition(glm::vec3& position) const;
|
||||||
|
|
|
@ -61,8 +61,7 @@ EntityTreeRenderer::EntityTreeRenderer(bool wantScripts, AbstractViewStateInterf
|
||||||
_lastPointerEventValid(false),
|
_lastPointerEventValid(false),
|
||||||
_viewState(viewState),
|
_viewState(viewState),
|
||||||
_scriptingServices(scriptingServices),
|
_scriptingServices(scriptingServices),
|
||||||
_displayModelBounds(false),
|
_displayModelBounds(false)
|
||||||
_layeredZones(this)
|
|
||||||
{
|
{
|
||||||
setMouseRayPickResultOperator([](unsigned int rayPickID) {
|
setMouseRayPickResultOperator([](unsigned int rayPickID) {
|
||||||
RayToEntityIntersectionResult entityResult;
|
RayToEntityIntersectionResult entityResult;
|
||||||
|
@ -516,41 +515,36 @@ bool EntityTreeRenderer::findBestZoneAndMaybeContainingEntities(QVector<EntityIt
|
||||||
auto hasScript = !entity->getScript().isEmpty();
|
auto hasScript = !entity->getScript().isEmpty();
|
||||||
|
|
||||||
// only consider entities that are zones or have scripts, all other entities can
|
// only consider entities that are zones or have scripts, all other entities can
|
||||||
// be ignored because they can have events fired on them.
|
// be ignored because they can't have events fired on them.
|
||||||
// FIXME - this could be optimized further by determining if the script is loaded
|
// FIXME - this could be optimized further by determining if the script is loaded
|
||||||
// and if it has either an enterEntity or leaveEntity method
|
// and if it has either an enterEntity or leaveEntity method
|
||||||
//
|
//
|
||||||
// also, don't flag a scripted entity as containing the avatar until the script is loaded,
|
// also, don't flag a scripted entity as containing the avatar until the script is loaded,
|
||||||
// so that the script is awake in time to receive the "entityEntity" call (even if the entity is a zone).
|
// so that the script is awake in time to receive the "entityEntity" call (even if the entity is a zone).
|
||||||
if ((!hasScript && isZone) ||
|
bool contains = false;
|
||||||
(hasScript && entity->isScriptPreloadFinished())) {
|
bool scriptHasLoaded = hasScript && entity->isScriptPreloadFinished();
|
||||||
// now check to see if the point contains our entity, this can be expensive if
|
if (isZone || scriptHasLoaded) {
|
||||||
// the entity has a collision hull
|
contains = entity->contains(_avatarPosition);
|
||||||
if (entity->contains(_avatarPosition)) {
|
}
|
||||||
|
|
||||||
|
if (contains) {
|
||||||
|
// if this entity is a zone and visible, add it to our layered zones
|
||||||
|
if (isZone && entity->getVisible() && renderableForEntity(entity)) {
|
||||||
|
_layeredZones.insert(std::dynamic_pointer_cast<ZoneEntityItem>(entity));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((!hasScript && isZone) || scriptHasLoaded) {
|
||||||
if (entitiesContainingAvatar) {
|
if (entitiesContainingAvatar) {
|
||||||
*entitiesContainingAvatar << entity->getEntityItemID();
|
*entitiesContainingAvatar << entity->getEntityItemID();
|
||||||
}
|
}
|
||||||
|
|
||||||
// if this entity is a zone and visible, determine if it is the bestZone
|
|
||||||
if (isZone && entity->getVisible() && renderableForEntity(entity)) {
|
|
||||||
auto zone = std::dynamic_pointer_cast<ZoneEntityItem>(entity);
|
|
||||||
_layeredZones.insert(zone);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// check if our layered zones have changed
|
// check if our layered zones have changed
|
||||||
if (_layeredZones.empty()) {
|
if ((_layeredZones.empty() && oldLayeredZones.empty()) || (!oldLayeredZones.empty() && _layeredZones.contains(oldLayeredZones))) {
|
||||||
if (oldLayeredZones.empty()) {
|
return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
} else if (!oldLayeredZones.empty()) {
|
|
||||||
if (_layeredZones.contains(oldLayeredZones)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
_layeredZones.apply();
|
|
||||||
|
|
||||||
applyLayeredZones();
|
applyLayeredZones();
|
||||||
|
|
||||||
|
@ -653,8 +647,8 @@ bool EntityTreeRenderer::applyLayeredZones() {
|
||||||
} else {
|
} else {
|
||||||
qCWarning(entitiesrenderer) << "EntityTreeRenderer::applyLayeredZones(), Unexpected null scene, possibly during application shutdown";
|
qCWarning(entitiesrenderer) << "EntityTreeRenderer::applyLayeredZones(), Unexpected null scene, possibly during application shutdown";
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityTreeRenderer::processEraseMessage(ReceivedMessage& message, const SharedNodePointer& sourceNode) {
|
void EntityTreeRenderer::processEraseMessage(ReceivedMessage& message, const SharedNodePointer& sourceNode) {
|
||||||
|
@ -1151,18 +1145,12 @@ std::pair<EntityTreeRenderer::LayeredZones::iterator, bool> EntityTreeRenderer::
|
||||||
return { it, success };
|
return { it, success };
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityTreeRenderer::LayeredZones::apply() {
|
|
||||||
assert(_entityTreeRenderer);
|
|
||||||
}
|
|
||||||
|
|
||||||
void EntityTreeRenderer::LayeredZones::update(std::shared_ptr<ZoneEntityItem> zone) {
|
void EntityTreeRenderer::LayeredZones::update(std::shared_ptr<ZoneEntityItem> zone) {
|
||||||
assert(_entityTreeRenderer);
|
|
||||||
bool isVisible = zone->isVisible();
|
bool isVisible = zone->isVisible();
|
||||||
|
|
||||||
if (empty() && isVisible) {
|
if (empty() && isVisible) {
|
||||||
// there are no zones: set this one
|
// there are no zones: set this one
|
||||||
insert(zone);
|
insert(zone);
|
||||||
apply();
|
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
LayeredZone zoneLayer(zone);
|
LayeredZone zoneLayer(zone);
|
||||||
|
|
|
@ -205,42 +205,28 @@ private:
|
||||||
|
|
||||||
class LayeredZones : public std::set<LayeredZone> {
|
class LayeredZones : public std::set<LayeredZone> {
|
||||||
public:
|
public:
|
||||||
LayeredZones(EntityTreeRenderer* parent) : _entityTreeRenderer(parent) {}
|
LayeredZones() {};
|
||||||
LayeredZones(LayeredZones&& other);
|
LayeredZones(LayeredZones&& other);
|
||||||
|
|
||||||
// avoid accidental misconstruction
|
// avoid accidental misconstruction
|
||||||
LayeredZones() = delete;
|
|
||||||
LayeredZones(const LayeredZones&) = delete;
|
LayeredZones(const LayeredZones&) = delete;
|
||||||
LayeredZones& operator=(const LayeredZones&) = delete;
|
LayeredZones& operator=(const LayeredZones&) = delete;
|
||||||
LayeredZones& operator=(LayeredZones&&) = delete;
|
LayeredZones& operator=(LayeredZones&&) = delete;
|
||||||
|
|
||||||
void clear();
|
void clear();
|
||||||
std::pair<iterator, bool> insert(const LayeredZone& layer);
|
std::pair<iterator, bool> insert(const LayeredZone& layer);
|
||||||
|
|
||||||
void apply();
|
|
||||||
void update(std::shared_ptr<ZoneEntityItem> zone);
|
void update(std::shared_ptr<ZoneEntityItem> zone);
|
||||||
|
|
||||||
bool contains(const LayeredZones& other);
|
bool contains(const LayeredZones& other);
|
||||||
|
|
||||||
std::shared_ptr<ZoneEntityItem> getZone() { return empty() ? nullptr : begin()->zone; }
|
std::shared_ptr<ZoneEntityItem> getZone() { return empty() ? nullptr : begin()->zone; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void applyPartial(iterator layer);
|
|
||||||
|
|
||||||
std::map<QUuid, iterator> _map;
|
std::map<QUuid, iterator> _map;
|
||||||
iterator _skyboxLayer{ end() };
|
iterator _skyboxLayer { end() };
|
||||||
EntityTreeRenderer* _entityTreeRenderer;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
LayeredZones _layeredZones;
|
LayeredZones _layeredZones;
|
||||||
QString _zoneUserData;
|
|
||||||
NetworkTexturePointer _ambientTexture;
|
|
||||||
NetworkTexturePointer _skyboxTexture;
|
|
||||||
QString _ambientTextureURL;
|
|
||||||
QString _skyboxTextureURL;
|
|
||||||
float _avgRenderableUpdateCost { 0.0f };
|
float _avgRenderableUpdateCost { 0.0f };
|
||||||
bool _pendingAmbientTexture { false };
|
|
||||||
bool _pendingSkyboxTexture { false };
|
|
||||||
|
|
||||||
uint64_t _lastZoneCheck { 0 };
|
uint64_t _lastZoneCheck { 0 };
|
||||||
const uint64_t ZONE_CHECK_INTERVAL = USECS_PER_MSEC * 100; // ~10hz
|
const uint64_t ZONE_CHECK_INTERVAL = USECS_PER_MSEC * 100; // ~10hz
|
||||||
|
|
|
@ -126,26 +126,6 @@ QString getID(const QVariantList& properties, int index = 0) {
|
||||||
return processID(properties.at(index).toString());
|
return processID(properties.at(index).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The names of the joints in the Maya HumanIK rig
|
|
||||||
static const std::array<const char*, 16> HUMANIK_JOINTS = {{
|
|
||||||
"RightHand",
|
|
||||||
"RightForeArm",
|
|
||||||
"RightArm",
|
|
||||||
"Head",
|
|
||||||
"LeftArm",
|
|
||||||
"LeftForeArm",
|
|
||||||
"LeftHand",
|
|
||||||
"Neck",
|
|
||||||
"Spine",
|
|
||||||
"Hips",
|
|
||||||
"RightUpLeg",
|
|
||||||
"LeftUpLeg",
|
|
||||||
"RightLeg",
|
|
||||||
"LeftLeg",
|
|
||||||
"RightFoot",
|
|
||||||
"LeftFoot"
|
|
||||||
}};
|
|
||||||
|
|
||||||
class FBXModel {
|
class FBXModel {
|
||||||
public:
|
public:
|
||||||
QString name;
|
QString name;
|
||||||
|
@ -478,32 +458,6 @@ HFMModel* FBXSerializer::extractHFMModel(const QVariantHash& mapping, const QStr
|
||||||
std::map<QString, HFMLight> lights;
|
std::map<QString, HFMLight> lights;
|
||||||
|
|
||||||
QVariantHash joints = mapping.value("joint").toHash();
|
QVariantHash joints = mapping.value("joint").toHash();
|
||||||
QString jointEyeLeftName = "EyeLeft";
|
|
||||||
QString jointEyeRightName = "EyeRight";
|
|
||||||
QString jointNeckName = "Neck";
|
|
||||||
QString jointRootName = "Hips";
|
|
||||||
QString jointLeanName = "Spine";
|
|
||||||
QString jointHeadName = "Head";
|
|
||||||
QString jointLeftHandName = "LeftHand";
|
|
||||||
QString jointRightHandName = "RightHand";
|
|
||||||
QString jointEyeLeftID;
|
|
||||||
QString jointEyeRightID;
|
|
||||||
QString jointNeckID;
|
|
||||||
QString jointRootID;
|
|
||||||
QString jointLeanID;
|
|
||||||
QString jointHeadID;
|
|
||||||
QString jointLeftHandID;
|
|
||||||
QString jointRightHandID;
|
|
||||||
QString jointLeftToeID;
|
|
||||||
QString jointRightToeID;
|
|
||||||
|
|
||||||
|
|
||||||
QVector<QString> humanIKJointNames;
|
|
||||||
for (int i = 0; i < (int) HUMANIK_JOINTS.size(); i++) {
|
|
||||||
QByteArray jointName = HUMANIK_JOINTS[i];
|
|
||||||
humanIKJointNames.append(processID(getString(joints.value(jointName, jointName))));
|
|
||||||
}
|
|
||||||
QVector<QString> humanIKJointIDs(humanIKJointNames.size());
|
|
||||||
|
|
||||||
QVariantHash blendshapeMappings = mapping.value("bs").toHash();
|
QVariantHash blendshapeMappings = mapping.value("bs").toHash();
|
||||||
|
|
||||||
|
@ -602,42 +556,6 @@ HFMModel* FBXSerializer::extractHFMModel(const QVariantHash& mapping, const QStr
|
||||||
hifiGlobalNodeID = id;
|
hifiGlobalNodeID = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (name == jointEyeLeftName || name == "EyeL" || name == "joint_Leye" || (hfmModel.hfmToHifiJointNameMapping.contains(jointEyeLeftName) && (name == hfmModel.hfmToHifiJointNameMapping[jointEyeLeftName]))) {
|
|
||||||
jointEyeLeftID = getID(object.properties);
|
|
||||||
|
|
||||||
} else if (name == jointEyeRightName || name == "EyeR" || name == "joint_Reye" || (hfmModel.hfmToHifiJointNameMapping.contains(jointEyeRightName) && (name == hfmModel.hfmToHifiJointNameMapping[jointEyeRightName]))) {
|
|
||||||
jointEyeRightID = getID(object.properties);
|
|
||||||
|
|
||||||
} else if (name == jointNeckName || name == "NeckRot" || name == "joint_neck" || (hfmModel.hfmToHifiJointNameMapping.contains(jointNeckName) && (name == hfmModel.hfmToHifiJointNameMapping[jointNeckName]))) {
|
|
||||||
jointNeckID = getID(object.properties);
|
|
||||||
|
|
||||||
} else if (name == jointRootName || (hfmModel.hfmToHifiJointNameMapping.contains(jointRootName) && (name == hfmModel.hfmToHifiJointNameMapping[jointRootName]))) {
|
|
||||||
jointRootID = getID(object.properties);
|
|
||||||
|
|
||||||
} else if (name == jointLeanName || (hfmModel.hfmToHifiJointNameMapping.contains(jointLeanName) && (name == hfmModel.hfmToHifiJointNameMapping[jointLeanName]))) {
|
|
||||||
jointLeanID = getID(object.properties);
|
|
||||||
|
|
||||||
} else if ((name == jointHeadName) || (hfmModel.hfmToHifiJointNameMapping.contains(jointHeadName) && (name == hfmModel.hfmToHifiJointNameMapping[jointHeadName]))) {
|
|
||||||
jointHeadID = getID(object.properties);
|
|
||||||
|
|
||||||
} else if (name == jointLeftHandName || name == "LeftHand" || name == "joint_L_hand" || (hfmModel.hfmToHifiJointNameMapping.contains(jointLeftHandName) && (name == hfmModel.hfmToHifiJointNameMapping[jointLeftHandName]))) {
|
|
||||||
jointLeftHandID = getID(object.properties);
|
|
||||||
|
|
||||||
} else if (name == jointRightHandName || name == "RightHand" || name == "joint_R_hand" || (hfmModel.hfmToHifiJointNameMapping.contains(jointRightHandName) && (name == hfmModel.hfmToHifiJointNameMapping[jointRightHandName]))) {
|
|
||||||
jointRightHandID = getID(object.properties);
|
|
||||||
|
|
||||||
} else if (name == "LeftToe" || name == "joint_L_toe" || name == "LeftToe_End" || (hfmModel.hfmToHifiJointNameMapping.contains("LeftToe") && (name == hfmModel.hfmToHifiJointNameMapping["LeftToe"]))) {
|
|
||||||
jointLeftToeID = getID(object.properties);
|
|
||||||
|
|
||||||
} else if (name == "RightToe" || name == "joint_R_toe" || name == "RightToe_End" || (hfmModel.hfmToHifiJointNameMapping.contains("RightToe") && (name == hfmModel.hfmToHifiJointNameMapping["RightToe"]))) {
|
|
||||||
jointRightToeID = getID(object.properties);
|
|
||||||
}
|
|
||||||
|
|
||||||
int humanIKJointIndex = humanIKJointNames.indexOf(name);
|
|
||||||
if (humanIKJointIndex != -1) {
|
|
||||||
humanIKJointIDs[humanIKJointIndex] = getID(object.properties);
|
|
||||||
}
|
|
||||||
|
|
||||||
glm::vec3 translation;
|
glm::vec3 translation;
|
||||||
// NOTE: the euler angles as supplied by the FBX file are in degrees
|
// NOTE: the euler angles as supplied by the FBX file are in degrees
|
||||||
glm::vec3 rotationOffset;
|
glm::vec3 rotationOffset;
|
||||||
|
@ -1449,28 +1367,6 @@ HFMModel* FBXSerializer::extractHFMModel(const QVariantHash& mapping, const QStr
|
||||||
std::vector<ShapeVertices> shapeVertices;
|
std::vector<ShapeVertices> shapeVertices;
|
||||||
shapeVertices.resize(std::max(1, hfmModel.joints.size()) );
|
shapeVertices.resize(std::max(1, hfmModel.joints.size()) );
|
||||||
|
|
||||||
// find our special joints
|
|
||||||
hfmModel.leftEyeJointIndex = modelIDs.indexOf(jointEyeLeftID);
|
|
||||||
hfmModel.rightEyeJointIndex = modelIDs.indexOf(jointEyeRightID);
|
|
||||||
hfmModel.neckJointIndex = modelIDs.indexOf(jointNeckID);
|
|
||||||
hfmModel.rootJointIndex = modelIDs.indexOf(jointRootID);
|
|
||||||
hfmModel.leanJointIndex = modelIDs.indexOf(jointLeanID);
|
|
||||||
hfmModel.headJointIndex = modelIDs.indexOf(jointHeadID);
|
|
||||||
hfmModel.leftHandJointIndex = modelIDs.indexOf(jointLeftHandID);
|
|
||||||
hfmModel.rightHandJointIndex = modelIDs.indexOf(jointRightHandID);
|
|
||||||
hfmModel.leftToeJointIndex = modelIDs.indexOf(jointLeftToeID);
|
|
||||||
hfmModel.rightToeJointIndex = modelIDs.indexOf(jointRightToeID);
|
|
||||||
|
|
||||||
foreach (const QString& id, humanIKJointIDs) {
|
|
||||||
hfmModel.humanIKJointIndices.append(modelIDs.indexOf(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
// extract the translation component of the neck transform
|
|
||||||
if (hfmModel.neckJointIndex != -1) {
|
|
||||||
const glm::mat4& transform = hfmModel.joints.at(hfmModel.neckJointIndex).transform;
|
|
||||||
hfmModel.neckPivot = glm::vec3(transform[3][0], transform[3][1], transform[3][2]);
|
|
||||||
}
|
|
||||||
|
|
||||||
hfmModel.bindExtents.reset();
|
hfmModel.bindExtents.reset();
|
||||||
hfmModel.meshExtents.reset();
|
hfmModel.meshExtents.reset();
|
||||||
|
|
||||||
|
|
|
@ -1188,19 +1188,6 @@ void GLTFSerializer::hfmDebugDump(const HFMModel& hfmModel) {
|
||||||
qCDebug(modelformat) << " hasSkeletonJoints =" << hfmModel.hasSkeletonJoints;
|
qCDebug(modelformat) << " hasSkeletonJoints =" << hfmModel.hasSkeletonJoints;
|
||||||
qCDebug(modelformat) << " offset =" << hfmModel.offset;
|
qCDebug(modelformat) << " offset =" << hfmModel.offset;
|
||||||
|
|
||||||
qCDebug(modelformat) << " leftEyeJointIndex =" << hfmModel.leftEyeJointIndex;
|
|
||||||
qCDebug(modelformat) << " rightEyeJointIndex =" << hfmModel.rightEyeJointIndex;
|
|
||||||
qCDebug(modelformat) << " neckJointIndex =" << hfmModel.neckJointIndex;
|
|
||||||
qCDebug(modelformat) << " rootJointIndex =" << hfmModel.rootJointIndex;
|
|
||||||
qCDebug(modelformat) << " leanJointIndex =" << hfmModel.leanJointIndex;
|
|
||||||
qCDebug(modelformat) << " headJointIndex =" << hfmModel.headJointIndex;
|
|
||||||
qCDebug(modelformat) << " leftHandJointIndex" << hfmModel.leftHandJointIndex;
|
|
||||||
qCDebug(modelformat) << " rightHandJointIndex" << hfmModel.rightHandJointIndex;
|
|
||||||
qCDebug(modelformat) << " leftToeJointIndex" << hfmModel.leftToeJointIndex;
|
|
||||||
qCDebug(modelformat) << " rightToeJointIndex" << hfmModel.rightToeJointIndex;
|
|
||||||
qCDebug(modelformat) << " leftEyeSize = " << hfmModel.leftEyeSize;
|
|
||||||
qCDebug(modelformat) << " rightEyeSize = " << hfmModel.rightEyeSize;
|
|
||||||
|
|
||||||
qCDebug(modelformat) << " palmDirection = " << hfmModel.palmDirection;
|
qCDebug(modelformat) << " palmDirection = " << hfmModel.palmDirection;
|
||||||
|
|
||||||
qCDebug(modelformat) << " neckPivot = " << hfmModel.neckPivot;
|
qCDebug(modelformat) << " neckPivot = " << hfmModel.neckPivot;
|
||||||
|
|
|
@ -270,22 +270,6 @@ public:
|
||||||
|
|
||||||
glm::mat4 offset; // This includes offset, rotation, and scale as specified by the FST file
|
glm::mat4 offset; // This includes offset, rotation, and scale as specified by the FST file
|
||||||
|
|
||||||
int leftEyeJointIndex = -1;
|
|
||||||
int rightEyeJointIndex = -1;
|
|
||||||
int neckJointIndex = -1;
|
|
||||||
int rootJointIndex = -1;
|
|
||||||
int leanJointIndex = -1;
|
|
||||||
int headJointIndex = -1;
|
|
||||||
int leftHandJointIndex = -1;
|
|
||||||
int rightHandJointIndex = -1;
|
|
||||||
int leftToeJointIndex = -1;
|
|
||||||
int rightToeJointIndex = -1;
|
|
||||||
|
|
||||||
float leftEyeSize = 0.0f; // Maximum mesh extents dimension
|
|
||||||
float rightEyeSize = 0.0f;
|
|
||||||
|
|
||||||
QVector<int> humanIKJointIndices;
|
|
||||||
|
|
||||||
glm::vec3 palmDirection;
|
glm::vec3 palmDirection;
|
||||||
|
|
||||||
glm::vec3 neckPivot;
|
glm::vec3 neckPivot;
|
||||||
|
|
|
@ -137,7 +137,7 @@ void CauterizedModel::updateClusterMatrices() {
|
||||||
// as an optimization, don't build cautrizedClusterMatrices if the boneSet is empty.
|
// as an optimization, don't build cautrizedClusterMatrices if the boneSet is empty.
|
||||||
if (!_cauterizeBoneSet.empty()) {
|
if (!_cauterizeBoneSet.empty()) {
|
||||||
|
|
||||||
AnimPose cauterizePose = _rig.getJointPose(hfmModel.neckJointIndex);
|
AnimPose cauterizePose = _rig.getJointPose(_rig.indexOfJoint("Neck"));
|
||||||
cauterizePose.scale() = glm::vec3(0.0001f, 0.0001f, 0.0001f);
|
cauterizePose.scale() = glm::vec3(0.0001f, 0.0001f, 0.0001f);
|
||||||
|
|
||||||
static const glm::mat4 zeroScale(
|
static const glm::mat4 zeroScale(
|
||||||
|
@ -145,7 +145,7 @@ void CauterizedModel::updateClusterMatrices() {
|
||||||
glm::vec4(0.0f, 0.0001f, 0.0f, 0.0f),
|
glm::vec4(0.0f, 0.0001f, 0.0f, 0.0f),
|
||||||
glm::vec4(0.0f, 0.0f, 0.0001f, 0.0f),
|
glm::vec4(0.0f, 0.0f, 0.0001f, 0.0f),
|
||||||
glm::vec4(0.0f, 0.0f, 0.0f, 1.0f));
|
glm::vec4(0.0f, 0.0f, 0.0f, 1.0f));
|
||||||
auto cauterizeMatrix = _rig.getJointTransform(hfmModel.neckJointIndex) * zeroScale;
|
auto cauterizeMatrix = _rig.getJointTransform(_rig.indexOfJoint("Neck")) * zeroScale;
|
||||||
|
|
||||||
for (int i = 0; i < _cauterizeMeshStates.size(); i++) {
|
for (int i = 0; i < _cauterizeMeshStates.size(); i++) {
|
||||||
Model::MeshState& state = _cauterizeMeshStates[i];
|
Model::MeshState& state = _cauterizeMeshStates[i];
|
||||||
|
|
Loading…
Reference in a new issue