mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 12:04:18 +02:00
Merge branch 'master' of github.com:highfidelity/hifi into punk
This commit is contained in:
commit
f286e3370b
3 changed files with 29 additions and 9 deletions
|
@ -1547,16 +1547,18 @@ bool Rig::calculateElbowPoleVector(int handIndex, int elbowIndex, int armIndex,
|
|||
glm::vec3 backVector = oppositeArmPose.trans() - armPose.trans();
|
||||
glm::vec3 backCenter = armPose.trans() + 0.5f * backVector;
|
||||
|
||||
const float OVER_BACK_HEAD_PERCENTAGE = 0.2f;
|
||||
glm::vec3 frontVector = glm::normalize(glm::cross(backVector, Vectors::UNIT_Y));
|
||||
glm::vec3 topVector = glm::normalize(glm::cross(frontVector, backVector));
|
||||
|
||||
glm::vec3 centerToHand = handPose.trans() - backCenter;
|
||||
glm::vec3 headCenter = backCenter + glm::length(backVector) * topVector;
|
||||
|
||||
glm::vec3 headCenter = backCenter + glm::vec3(0, OVER_BACK_HEAD_PERCENTAGE * backVector.length(), 0);
|
||||
glm::vec3 frontVector = glm::normalize(glm::cross(backVector, glm::vec3(0, 1, 0)));
|
||||
// Make sure is pointing forward
|
||||
frontVector = frontVector.z < 0 ? -frontVector : frontVector;
|
||||
|
||||
float horizontalModule = glm::dot(armToHand, glm::vec3(0, -1, 0));
|
||||
glm::vec3 headForward = headCenter + horizontalModule * frontVector;
|
||||
float horizontalModule = glm::dot(centerToHand, -topVector);
|
||||
|
||||
glm::vec3 headForward = headCenter + glm::max(0.0f, horizontalModule) * frontVector;
|
||||
glm::vec3 armToHead = headForward - armPose.trans();
|
||||
|
||||
float armToHandDistance = glm::length(armToHand);
|
||||
|
@ -1570,8 +1572,10 @@ bool Rig::calculateElbowPoleVector(int handIndex, int elbowIndex, int armIndex,
|
|||
// How much the hand is reaching for the opposite side
|
||||
float oppositeProjection = glm::dot(armToHandDir, glm::normalize(backVector));
|
||||
|
||||
// Don't use pole vector when the hands are behind
|
||||
if (glm::dot(frontVector, armToHand) < 0 && oppositeProjection < 0.5f * armTotalDistance) {
|
||||
bool isCrossed = glm::dot(centerToHand, backVector) > 0;
|
||||
bool isBehind = glm::dot(frontVector, armToHand) < 0;
|
||||
// Don't use pole vector when the hands are behind the back and the arms are not crossed
|
||||
if (isBehind && !isCrossed) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1585,7 +1589,7 @@ bool Rig::calculateElbowPoleVector(int handIndex, int elbowIndex, int armIndex,
|
|||
glm::vec3 correctionVector = glm::vec3(0, 0, 0);
|
||||
|
||||
const float FORWARD_TRIGGER_PERCENTAGE = 0.2f;
|
||||
const float FORWARD_CORRECTOR_WEIGHT = 3.0f;
|
||||
const float FORWARD_CORRECTOR_WEIGHT = 2.3f;
|
||||
|
||||
float elbowForwardTrigger = FORWARD_TRIGGER_PERCENTAGE * armToHandDistance;
|
||||
|
||||
|
|
|
@ -336,6 +336,11 @@ bool EntityRenderer::needsRenderUpdate() const {
|
|||
if (_needsRenderUpdate) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (isFading()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_prevIsTransparent != isTransparent()) {
|
||||
return true;
|
||||
}
|
||||
|
@ -380,6 +385,10 @@ void EntityRenderer::updateModelTransformAndBound() {
|
|||
void EntityRenderer::doRenderUpdateSynchronous(const ScenePointer& scene, Transaction& transaction, const EntityItemPointer& entity) {
|
||||
DETAILED_PROFILE_RANGE(simulation_physics, __FUNCTION__);
|
||||
withWriteLock([&] {
|
||||
if (isFading()) {
|
||||
emit requestRenderUpdate();
|
||||
}
|
||||
|
||||
auto transparent = isTransparent();
|
||||
if (_prevIsTransparent && !transparent) {
|
||||
_isFading = false;
|
||||
|
|
|
@ -211,7 +211,14 @@ ShapeKey ShapeEntityRenderer::getShapeKey() {
|
|||
|
||||
return builder.build();
|
||||
} else {
|
||||
return Parent::getShapeKey();
|
||||
ShapeKey::Builder builder;
|
||||
if (_procedural.isReady()) {
|
||||
builder.withOwnPipeline();
|
||||
}
|
||||
if (isTransparent()) {
|
||||
builder.withTranslucent();
|
||||
}
|
||||
return builder.build();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue