mirror of
https://github.com/overte-org/overte.git
synced 2025-04-16 16:26:17 +02:00
Merge branch 'RC63' of github.com:highfidelity/hifi into backtrace-for-rc-63
This commit is contained in:
commit
7d1eb5fef8
10 changed files with 117 additions and 31 deletions
|
@ -20,7 +20,7 @@
|
|||
#include <render/Args.h>
|
||||
|
||||
const float DEFAULT_DESKTOP_LOD_DOWN_FPS = 30.0f;
|
||||
const float DEFAULT_HMD_LOD_DOWN_FPS = 45.0f;
|
||||
const float DEFAULT_HMD_LOD_DOWN_FPS = 34.0f;
|
||||
const float DEFAULT_DESKTOP_MAX_RENDER_TIME = (float)MSECS_PER_SECOND / DEFAULT_DESKTOP_LOD_DOWN_FPS; // msec
|
||||
const float DEFAULT_HMD_MAX_RENDER_TIME = (float)MSECS_PER_SECOND / DEFAULT_HMD_LOD_DOWN_FPS; // msec
|
||||
const float MAX_LIKELY_DESKTOP_FPS = 59.0f; // this is essentially, V-synch - 1 fps
|
||||
|
|
|
@ -561,6 +561,12 @@ void MyAvatar::simulate(float deltaTime) {
|
|||
if (!_skeletonModel->getHeadPosition(headPosition)) {
|
||||
headPosition = getWorldPosition();
|
||||
}
|
||||
|
||||
if (isNaN(headPosition)) {
|
||||
qCDebug(interfaceapp) << "MyAvatar::simulate headPosition is NaN";
|
||||
headPosition = glm::vec3(0.0f);
|
||||
}
|
||||
|
||||
head->setPosition(headPosition);
|
||||
head->setScale(getModelScale());
|
||||
head->simulate(deltaTime);
|
||||
|
@ -2700,27 +2706,48 @@ void MyAvatar::setWalkSpeed(float value) {
|
|||
}
|
||||
|
||||
glm::vec3 MyAvatar::getPositionForAudio() {
|
||||
glm::vec3 result;
|
||||
switch (_audioListenerMode) {
|
||||
case AudioListenerMode::FROM_HEAD:
|
||||
return getHead()->getPosition();
|
||||
result = getHead()->getPosition();
|
||||
break;
|
||||
case AudioListenerMode::FROM_CAMERA:
|
||||
return qApp->getCamera().getPosition();
|
||||
result = qApp->getCamera().getPosition();
|
||||
break;
|
||||
case AudioListenerMode::CUSTOM:
|
||||
return _customListenPosition;
|
||||
result = _customListenPosition;
|
||||
break;
|
||||
}
|
||||
return vec3();
|
||||
|
||||
if (isNaN(result)) {
|
||||
qCDebug(interfaceapp) << "MyAvatar::getPositionForAudio produced NaN" << _audioListenerMode;
|
||||
result = glm::vec3(0.0f);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
glm::quat MyAvatar::getOrientationForAudio() {
|
||||
glm::quat result;
|
||||
|
||||
switch (_audioListenerMode) {
|
||||
case AudioListenerMode::FROM_HEAD:
|
||||
return getHead()->getFinalOrientationInWorldFrame();
|
||||
result = getHead()->getFinalOrientationInWorldFrame();
|
||||
break;
|
||||
case AudioListenerMode::FROM_CAMERA:
|
||||
return qApp->getCamera().getOrientation();
|
||||
result = qApp->getCamera().getOrientation();
|
||||
break;
|
||||
case AudioListenerMode::CUSTOM:
|
||||
return _customListenOrientation;
|
||||
result = _customListenOrientation;
|
||||
break;
|
||||
}
|
||||
return quat();
|
||||
|
||||
if (isNaN(result)) {
|
||||
qCDebug(interfaceapp) << "MyAvatar::getOrientationForAudio produced NaN" << _audioListenerMode;
|
||||
result = glm::quat();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void MyAvatar::setAudioListenerMode(AudioListenerMode audioListenerMode) {
|
||||
|
|
|
@ -445,22 +445,31 @@ void Rig::setJointRotation(int index, bool valid, const glm::quat& rotation, flo
|
|||
}
|
||||
|
||||
bool Rig::getJointPositionInWorldFrame(int jointIndex, glm::vec3& position, glm::vec3 translation, glm::quat rotation) const {
|
||||
bool success { false };
|
||||
if (QThread::currentThread() == thread()) {
|
||||
if (isIndexValid(jointIndex)) {
|
||||
position = (rotation * _internalPoseSet._absolutePoses[jointIndex].trans()) + translation;
|
||||
return true;
|
||||
success = true;
|
||||
} else {
|
||||
return false;
|
||||
success = false;
|
||||
}
|
||||
} else {
|
||||
QReadLocker readLock(&_externalPoseSetLock);
|
||||
if (jointIndex >= 0 && jointIndex < (int)_externalPoseSet._absolutePoses.size()) {
|
||||
position = (rotation * _externalPoseSet._absolutePoses[jointIndex].trans()) + translation;
|
||||
success = true;
|
||||
} else {
|
||||
success = false;
|
||||
}
|
||||
}
|
||||
|
||||
QReadLocker readLock(&_externalPoseSetLock);
|
||||
if (jointIndex >= 0 && jointIndex < (int)_externalPoseSet._absolutePoses.size()) {
|
||||
position = (rotation * _externalPoseSet._absolutePoses[jointIndex].trans()) + translation;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
if (isNaN(position)) {
|
||||
qCWarning(animation) << "Rig::getJointPositionInWorldFrame produces NaN";
|
||||
success = false;
|
||||
position = glm::vec3(0.0f);
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
bool Rig::getJointPosition(int jointIndex, glm::vec3& position) const {
|
||||
|
|
|
@ -115,6 +115,7 @@ void CauterizedModel::updateClusterMatrices() {
|
|||
Transform clusterTransform;
|
||||
Transform::mult(clusterTransform, jointTransform, cluster.inverseBindTransform);
|
||||
state.clusterTransforms[j] = Model::TransformDualQuaternion(clusterTransform);
|
||||
state.clusterTransforms[j].setCauterizationParameters(0.0f, jointPose.trans());
|
||||
#else
|
||||
auto jointMatrix = _rig.getJointTransform(cluster.jointIndex);
|
||||
glm_mat4u_mul(jointMatrix, cluster.inverseBindMatrix, state.clusterTransforms[j]);
|
||||
|
@ -151,6 +152,7 @@ void CauterizedModel::updateClusterMatrices() {
|
|||
Transform clusterTransform;
|
||||
Transform::mult(clusterTransform, jointTransform, cluster.inverseBindTransform);
|
||||
state.clusterTransforms[j] = Model::TransformDualQuaternion(clusterTransform);
|
||||
state.clusterTransforms[j].setCauterizationParameters(1.0f, cauterizePose.trans());
|
||||
#else
|
||||
glm_mat4u_mul(cauterizeMatrix, cluster.inverseBindMatrix, state.clusterTransforms[j]);
|
||||
#endif
|
||||
|
|
|
@ -99,7 +99,6 @@ void evalLightingAmbient(out vec3 diffuse, out vec3 specular, LightAmbient ambie
|
|||
|
||||
// Diffuse from ambient
|
||||
diffuse = sphericalHarmonics_evalSphericalLight(getLightAmbientSphere(ambient), lowNormalCurvature.xyz).xyz;
|
||||
diffuse /= 3.1415926;
|
||||
specular = vec3(0.0);
|
||||
}
|
||||
<@endif@>
|
||||
|
|
|
@ -263,26 +263,34 @@ public:
|
|||
_scale.x = p.scale().x;
|
||||
_scale.y = p.scale().y;
|
||||
_scale.z = p.scale().z;
|
||||
_scale.w = 0.0f;
|
||||
_dq = DualQuaternion(p.rot(), p.trans());
|
||||
}
|
||||
TransformDualQuaternion(const glm::vec3& scale, const glm::quat& rot, const glm::vec3& trans) {
|
||||
_scale.x = scale.x;
|
||||
_scale.y = scale.y;
|
||||
_scale.z = scale.z;
|
||||
_scale.w = 0.0f;
|
||||
_dq = DualQuaternion(rot, trans);
|
||||
}
|
||||
TransformDualQuaternion(const Transform& transform) {
|
||||
_scale = glm::vec4(transform.getScale(), 0.0f);
|
||||
_scale.w = 0.0f;
|
||||
_dq = DualQuaternion(transform.getRotation(), transform.getTranslation());
|
||||
}
|
||||
glm::vec3 getScale() const { return glm::vec3(_scale); }
|
||||
glm::quat getRotation() const { return _dq.getRotation(); }
|
||||
glm::vec3 getTranslation() const { return _dq.getTranslation(); }
|
||||
glm::mat4 getMatrix() const { return createMatFromScaleQuatAndPos(getScale(), getRotation(), getTranslation()); };
|
||||
|
||||
void setCauterizationParameters(float cauterizationAmount, const glm::vec3& cauterizedPosition) {
|
||||
_scale.w = cauterizationAmount;
|
||||
_cauterizedPosition = glm::vec4(cauterizedPosition, 1.0f);
|
||||
}
|
||||
protected:
|
||||
glm::vec4 _scale { 1.0f, 1.0f, 1.0f, 0.0f };
|
||||
DualQuaternion _dq;
|
||||
glm::vec4 _padding;
|
||||
glm::vec4 _cauterizedPosition { 0.0f, 0.0f, 0.0f, 1.0f };
|
||||
};
|
||||
#endif
|
||||
|
||||
|
|
|
@ -58,17 +58,19 @@ mat4 dualQuatToMat4(vec4 real, vec4 dual) {
|
|||
void skinPosition(ivec4 skinClusterIndex, vec4 skinClusterWeight, vec4 inPosition, out vec4 skinnedPosition) {
|
||||
|
||||
// linearly blend scale and dual quaternion components
|
||||
vec3 sAccum = vec3(0.0, 0.0, 0.0);
|
||||
vec4 sAccum = vec4(0.0, 0.0, 0.0, 0.0);
|
||||
vec4 rAccum = vec4(0.0, 0.0, 0.0, 0.0);
|
||||
vec4 dAccum = vec4(0.0, 0.0, 0.0, 0.0);
|
||||
vec4 cAccum = vec4(0.0, 0.0, 0.0, 0.0);
|
||||
vec4 polarityReference = clusterMatrices[skinClusterIndex[0]][1];
|
||||
for (int i = 0; i < INDICES_PER_VERTEX; i++) {
|
||||
mat4 clusterMatrix = clusterMatrices[(skinClusterIndex[i])];
|
||||
float clusterWeight = skinClusterWeight[i];
|
||||
|
||||
vec3 scale = vec3(clusterMatrix[0]);
|
||||
vec4 scale = clusterMatrix[0];
|
||||
vec4 real = clusterMatrix[1];
|
||||
vec4 dual = clusterMatrix[2];
|
||||
vec4 cauterizedPos = clusterMatrix[3];
|
||||
|
||||
// to ensure that we rotate along the shortest arc, reverse dual quaternions with negative polarity.
|
||||
float dqClusterWeight = clusterWeight;
|
||||
|
@ -79,6 +81,7 @@ void skinPosition(ivec4 skinClusterIndex, vec4 skinClusterWeight, vec4 inPositio
|
|||
sAccum += scale * clusterWeight;
|
||||
rAccum += real * dqClusterWeight;
|
||||
dAccum += dual * dqClusterWeight;
|
||||
cAccum += cauterizedPos * clusterWeight;
|
||||
}
|
||||
|
||||
// normalize dual quaternion
|
||||
|
@ -88,25 +91,37 @@ void skinPosition(ivec4 skinClusterIndex, vec4 skinClusterWeight, vec4 inPositio
|
|||
|
||||
// conversion from dual quaternion to 4x4 matrix.
|
||||
mat4 m = dualQuatToMat4(rAccum, dAccum);
|
||||
skinnedPosition = m * (vec4(sAccum, 1) * inPosition);
|
||||
|
||||
// sAccum.w indicates the amount of cauterization for this vertex.
|
||||
// 0 indicates no cauterization and 1 indicates full cauterization.
|
||||
// TODO: make this cauterization smoother or implement full dual-quaternion scale support.
|
||||
const float CAUTERIZATION_THRESHOLD = 0.1;
|
||||
if (sAccum.w > CAUTERIZATION_THRESHOLD) {
|
||||
skinnedPosition = cAccum;
|
||||
} else {
|
||||
sAccum.w = 1.0;
|
||||
skinnedPosition = m * (sAccum * inPosition);
|
||||
}
|
||||
}
|
||||
|
||||
void skinPositionNormal(ivec4 skinClusterIndex, vec4 skinClusterWeight, vec4 inPosition, vec3 inNormal,
|
||||
out vec4 skinnedPosition, out vec3 skinnedNormal) {
|
||||
|
||||
// linearly blend scale and dual quaternion components
|
||||
vec3 sAccum = vec3(0.0, 0.0, 0.0);
|
||||
vec4 sAccum = vec4(0.0, 0.0, 0.0, 0.0);
|
||||
vec4 rAccum = vec4(0.0, 0.0, 0.0, 0.0);
|
||||
vec4 dAccum = vec4(0.0, 0.0, 0.0, 0.0);
|
||||
vec4 cAccum = vec4(0.0, 0.0, 0.0, 0.0);
|
||||
vec4 polarityReference = clusterMatrices[skinClusterIndex[0]][1];
|
||||
|
||||
for (int i = 0; i < INDICES_PER_VERTEX; i++) {
|
||||
mat4 clusterMatrix = clusterMatrices[(skinClusterIndex[i])];
|
||||
float clusterWeight = skinClusterWeight[i];
|
||||
|
||||
vec3 scale = vec3(clusterMatrix[0]);
|
||||
vec4 scale = clusterMatrix[0];
|
||||
vec4 real = clusterMatrix[1];
|
||||
vec4 dual = clusterMatrix[2];
|
||||
vec4 cauterizedPos = clusterMatrix[3];
|
||||
|
||||
// to ensure that we rotate along the shortest arc, reverse dual quaternions with negative polarity.
|
||||
float dqClusterWeight = clusterWeight;
|
||||
|
@ -117,6 +132,7 @@ void skinPositionNormal(ivec4 skinClusterIndex, vec4 skinClusterWeight, vec4 inP
|
|||
sAccum += scale * clusterWeight;
|
||||
rAccum += real * dqClusterWeight;
|
||||
dAccum += dual * dqClusterWeight;
|
||||
cAccum += cauterizedPos * clusterWeight;
|
||||
}
|
||||
|
||||
// normalize dual quaternion
|
||||
|
@ -126,7 +142,18 @@ void skinPositionNormal(ivec4 skinClusterIndex, vec4 skinClusterWeight, vec4 inP
|
|||
|
||||
// conversion from dual quaternion to 4x4 matrix.
|
||||
mat4 m = dualQuatToMat4(rAccum, dAccum);
|
||||
skinnedPosition = m * (vec4(sAccum, 1) * inPosition);
|
||||
|
||||
// sAccum.w indicates the amount of cauterization for this vertex.
|
||||
// 0 indicates no cauterization and 1 indicates full cauterization.
|
||||
// TODO: make this cauterization smoother or implement full dual-quaternion scale support.
|
||||
const float CAUTERIZATION_THRESHOLD = 0.1;
|
||||
if (sAccum.w > CAUTERIZATION_THRESHOLD) {
|
||||
skinnedPosition = cAccum;
|
||||
} else {
|
||||
sAccum.w = 1.0;
|
||||
skinnedPosition = m * (sAccum * inPosition);
|
||||
}
|
||||
|
||||
skinnedNormal = vec3(m * vec4(inNormal, 0));
|
||||
}
|
||||
|
||||
|
@ -134,18 +161,20 @@ void skinPositionNormalTangent(ivec4 skinClusterIndex, vec4 skinClusterWeight, v
|
|||
out vec4 skinnedPosition, out vec3 skinnedNormal, out vec3 skinnedTangent) {
|
||||
|
||||
// linearly blend scale and dual quaternion components
|
||||
vec3 sAccum = vec3(0.0, 0.0, 0.0);
|
||||
vec4 sAccum = vec4(0.0, 0.0, 0.0, 0.0);
|
||||
vec4 rAccum = vec4(0.0, 0.0, 0.0, 0.0);
|
||||
vec4 dAccum = vec4(0.0, 0.0, 0.0, 0.0);
|
||||
vec4 cAccum = vec4(0.0, 0.0, 0.0, 0.0);
|
||||
vec4 polarityReference = clusterMatrices[skinClusterIndex[0]][1];
|
||||
|
||||
for (int i = 0; i < INDICES_PER_VERTEX; i++) {
|
||||
mat4 clusterMatrix = clusterMatrices[(skinClusterIndex[i])];
|
||||
float clusterWeight = skinClusterWeight[i];
|
||||
|
||||
vec3 scale = vec3(clusterMatrix[0]);
|
||||
vec4 scale = clusterMatrix[0];
|
||||
vec4 real = clusterMatrix[1];
|
||||
vec4 dual = clusterMatrix[2];
|
||||
vec4 cauterizedPos = clusterMatrix[3];
|
||||
|
||||
// to ensure that we rotate along the shortest arc, reverse dual quaternions with negative polarity.
|
||||
float dqClusterWeight = clusterWeight;
|
||||
|
@ -156,6 +185,7 @@ void skinPositionNormalTangent(ivec4 skinClusterIndex, vec4 skinClusterWeight, v
|
|||
sAccum += scale * clusterWeight;
|
||||
rAccum += real * dqClusterWeight;
|
||||
dAccum += dual * dqClusterWeight;
|
||||
cAccum += cauterizedPos * clusterWeight;
|
||||
}
|
||||
|
||||
// normalize dual quaternion
|
||||
|
@ -165,7 +195,18 @@ void skinPositionNormalTangent(ivec4 skinClusterIndex, vec4 skinClusterWeight, v
|
|||
|
||||
// conversion from dual quaternion to 4x4 matrix.
|
||||
mat4 m = dualQuatToMat4(rAccum, dAccum);
|
||||
skinnedPosition = m * (vec4(sAccum, 1) * inPosition);
|
||||
|
||||
// sAccum.w indicates the amount of cauterization for this vertex.
|
||||
// 0 indicates no cauterization and 1 indicates full cauterization.
|
||||
// TODO: make this cauterization smoother or implement full dual-quaternion scale support.
|
||||
const float CAUTERIZATION_THRESHOLD = 0.1;
|
||||
if (sAccum.w > CAUTERIZATION_THRESHOLD) {
|
||||
skinnedPosition = cAccum;
|
||||
} else {
|
||||
sAccum.w = 1.0;
|
||||
skinnedPosition = m * (sAccum * inPosition);
|
||||
}
|
||||
|
||||
skinnedNormal = vec3(m * vec4(inNormal, 0));
|
||||
skinnedTangent = vec3(m * vec4(inTangent, 0));
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@
|
|||
});
|
||||
}
|
||||
function getAvailableConnections(domain, callback) { // callback([{usename, location}...]) if successful. (Logs otherwise)
|
||||
url = METAVERSE_BASE + '/api/v1/users?'
|
||||
url = METAVERSE_BASE + '/api/v1/users?per_page=400&'
|
||||
if (domain) {
|
||||
url += 'status=' + domain.slice(1, -1); // without curly braces
|
||||
} else {
|
||||
|
|
|
@ -469,7 +469,7 @@ var toolBar = (function () {
|
|||
|
||||
// tablet version of new-model dialog
|
||||
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
||||
tablet.pushOntoStack("NewModelDialog.qml");
|
||||
tablet.pushOntoStack("hifi/tablet/NewModelDialog.qml");
|
||||
});
|
||||
|
||||
addButton("newCubeButton", "cube-01.svg", function () {
|
||||
|
|
|
@ -361,7 +361,7 @@ function getProfilePicture(username, callback) { // callback(url) if successfull
|
|||
});
|
||||
}
|
||||
function getAvailableConnections(domain, callback) { // callback([{usename, location}...]) if successfull. (Logs otherwise)
|
||||
url = METAVERSE_BASE + '/api/v1/users?'
|
||||
url = METAVERSE_BASE + '/api/v1/users?per_page=400&'
|
||||
if (domain) {
|
||||
url += 'status=' + domain.slice(1, -1); // without curly braces
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue