mirror of
https://github.com/lubosz/overte.git
synced 2025-08-07 19:41:20 +02:00
Merge branch 'master' of github.com:highfidelity/hifi into blackProp
This commit is contained in:
commit
92c1fd69c1
2 changed files with 29 additions and 25 deletions
|
@ -128,7 +128,7 @@ const AnimPoseVec& AnimTwoBoneIK::evaluate(const AnimVariantMap& animVars, const
|
||||||
|
|
||||||
if (triggersOut.hasKey(endEffectorPositionVar)) {
|
if (triggersOut.hasKey(endEffectorPositionVar)) {
|
||||||
targetPose.trans() = triggersOut.lookupRigToGeometry(endEffectorPositionVar, tipPose.trans());
|
targetPose.trans() = triggersOut.lookupRigToGeometry(endEffectorPositionVar, tipPose.trans());
|
||||||
} else if (animVars.hasKey(endEffectorRotationVar)) {
|
} else if (animVars.hasKey(endEffectorPositionVar)) {
|
||||||
targetPose.trans() = animVars.lookupRigToGeometry(endEffectorPositionVar, tipPose.trans());
|
targetPose.trans() = animVars.lookupRigToGeometry(endEffectorPositionVar, tipPose.trans());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,9 +147,11 @@ const AnimPoseVec& AnimTwoBoneIK::evaluate(const AnimVariantMap& animVars, const
|
||||||
|
|
||||||
// http://mathworld.wolfram.com/Circle-CircleIntersection.html
|
// http://mathworld.wolfram.com/Circle-CircleIntersection.html
|
||||||
float midAngle = 0.0f;
|
float midAngle = 0.0f;
|
||||||
if (d < r0 + r1) {
|
if ((d < r0 + r1) && (d > 0.0f) && (r0 > 0.0f) && (r1 > 0.0f)) {
|
||||||
float y = sqrtf((-d + r1 - r0) * (-d - r1 + r0) * (-d + r1 + r0) * (d + r1 + r0)) / (2.0f * d);
|
float y = sqrtf((-d + r1 - r0) * (-d - r1 + r0) * (-d + r1 + r0) * (d + r1 + r0)) / (2.0f * d);
|
||||||
midAngle = PI - (acosf(y / r0) + acosf(y / r1));
|
float yR0Quotient = glm::clamp(y / r0, -1.0f, 1.0f);
|
||||||
|
float yR1Quotient = glm::clamp(y / r1, -1.0f, 1.0f);
|
||||||
|
midAngle = PI - (acosf(yR0Quotient) + acosf(yR1Quotient));
|
||||||
}
|
}
|
||||||
|
|
||||||
// compute midJoint rotation
|
// compute midJoint rotation
|
||||||
|
|
|
@ -2129,9 +2129,32 @@ var DELETED_ENTITY_MAP = {};
|
||||||
|
|
||||||
function applyEntityProperties(data) {
|
function applyEntityProperties(data) {
|
||||||
var editEntities = data.editEntities;
|
var editEntities = data.editEntities;
|
||||||
|
var createEntities = data.createEntities;
|
||||||
|
var deleteEntities = data.deleteEntities;
|
||||||
var selectedEntityIDs = [];
|
var selectedEntityIDs = [];
|
||||||
var selectEdits = data.createEntities.length === 0 || !data.selectCreated;
|
var selectEdits = createEntities.length === 0 || !data.selectCreated;
|
||||||
var i, entityID, entityProperties;
|
var i, entityID, entityProperties;
|
||||||
|
for (i = 0; i < createEntities.length; i++) {
|
||||||
|
entityID = createEntities[i].entityID;
|
||||||
|
entityProperties = createEntities[i].properties;
|
||||||
|
var newEntityID = Entities.addEntity(entityProperties);
|
||||||
|
recursiveAdd(newEntityID, createEntities[i]);
|
||||||
|
DELETED_ENTITY_MAP[entityID] = newEntityID;
|
||||||
|
if (data.selectCreated) {
|
||||||
|
selectedEntityIDs.push(newEntityID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (i = 0; i < deleteEntities.length; i++) {
|
||||||
|
entityID = deleteEntities[i].entityID;
|
||||||
|
if (DELETED_ENTITY_MAP[entityID] !== undefined) {
|
||||||
|
entityID = DELETED_ENTITY_MAP[entityID];
|
||||||
|
}
|
||||||
|
Entities.deleteEntity(entityID);
|
||||||
|
var index = selectedEntityIDs.indexOf(entityID);
|
||||||
|
if (index >= 0) {
|
||||||
|
selectedEntityIDs.splice(index, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
for (i = 0; i < editEntities.length; i++) {
|
for (i = 0; i < editEntities.length; i++) {
|
||||||
entityID = editEntities[i].entityID;
|
entityID = editEntities[i].entityID;
|
||||||
if (DELETED_ENTITY_MAP[entityID] !== undefined) {
|
if (DELETED_ENTITY_MAP[entityID] !== undefined) {
|
||||||
|
@ -2145,27 +2168,6 @@ function applyEntityProperties(data) {
|
||||||
selectedEntityIDs.push(entityID);
|
selectedEntityIDs.push(entityID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (i = 0; i < data.createEntities.length; i++) {
|
|
||||||
entityID = data.createEntities[i].entityID;
|
|
||||||
entityProperties = data.createEntities[i].properties;
|
|
||||||
var newEntityID = Entities.addEntity(entityProperties);
|
|
||||||
recursiveAdd(newEntityID, data.createEntities[i]);
|
|
||||||
DELETED_ENTITY_MAP[entityID] = newEntityID;
|
|
||||||
if (data.selectCreated) {
|
|
||||||
selectedEntityIDs.push(newEntityID);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (i = 0; i < data.deleteEntities.length; i++) {
|
|
||||||
entityID = data.deleteEntities[i].entityID;
|
|
||||||
if (DELETED_ENTITY_MAP[entityID] !== undefined) {
|
|
||||||
entityID = DELETED_ENTITY_MAP[entityID];
|
|
||||||
}
|
|
||||||
Entities.deleteEntity(entityID);
|
|
||||||
var index = selectedEntityIDs.indexOf(entityID);
|
|
||||||
if (index >= 0) {
|
|
||||||
selectedEntityIDs.splice(index, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// We might be getting an undo while edit.js is disabled. If that is the case, don't set
|
// We might be getting an undo while edit.js is disabled. If that is the case, don't set
|
||||||
// our selections, causing the edit widgets to display.
|
// our selections, causing the edit widgets to display.
|
||||||
|
|
Loading…
Reference in a new issue