mirror of
https://github.com/overte-org/overte.git
synced 2025-07-22 22:34:12 +02:00
Merge branch 'master' of github.com:highfidelity/hifi
This commit is contained in:
commit
a79e9964d2
11 changed files with 47 additions and 28 deletions
|
@ -3551,6 +3551,7 @@ void MyAvatar::FollowHelper::prePhysicsUpdate(MyAvatar& myAvatar, const glm::mat
|
||||||
qApp->getCamera().getMode() != CAMERA_MODE_MIRROR) {
|
qApp->getCamera().getMode() != CAMERA_MODE_MIRROR) {
|
||||||
if (!isActive(Rotation) && (shouldActivateRotation(myAvatar, desiredBodyMatrix, currentBodyMatrix) || hasDriveInput)) {
|
if (!isActive(Rotation) && (shouldActivateRotation(myAvatar, desiredBodyMatrix, currentBodyMatrix) || hasDriveInput)) {
|
||||||
activate(Rotation);
|
activate(Rotation);
|
||||||
|
myAvatar.setHeadControllerFacingMovingAverage(myAvatar._headControllerFacing);
|
||||||
}
|
}
|
||||||
if (myAvatar.getCenterOfGravityModelEnabled()) {
|
if (myAvatar.getCenterOfGravityModelEnabled()) {
|
||||||
if (!isActive(Horizontal) && (shouldActivateHorizontalCG(myAvatar) || hasDriveInput)) {
|
if (!isActive(Horizontal) && (shouldActivateHorizontalCG(myAvatar) || hasDriveInput)) {
|
||||||
|
@ -3568,6 +3569,7 @@ void MyAvatar::FollowHelper::prePhysicsUpdate(MyAvatar& myAvatar, const glm::mat
|
||||||
} else {
|
} else {
|
||||||
if (!isActive(Rotation) && getForceActivateRotation()) {
|
if (!isActive(Rotation) && getForceActivateRotation()) {
|
||||||
activate(Rotation);
|
activate(Rotation);
|
||||||
|
myAvatar.setHeadControllerFacingMovingAverage(myAvatar._headControllerFacing);
|
||||||
setForceActivateRotation(false);
|
setForceActivateRotation(false);
|
||||||
}
|
}
|
||||||
if (!isActive(Horizontal) && getForceActivateHorizontal()) {
|
if (!isActive(Horizontal) && getForceActivateHorizontal()) {
|
||||||
|
|
|
@ -883,6 +883,7 @@ public:
|
||||||
virtual void rebuildCollisionShape() override;
|
virtual void rebuildCollisionShape() override;
|
||||||
|
|
||||||
const glm::vec2& getHeadControllerFacingMovingAverage() const { return _headControllerFacingMovingAverage; }
|
const glm::vec2& getHeadControllerFacingMovingAverage() const { return _headControllerFacingMovingAverage; }
|
||||||
|
void setHeadControllerFacingMovingAverage(glm::vec2 currentHeadControllerFacing) { _headControllerFacingMovingAverage = currentHeadControllerFacing; }
|
||||||
float getCurrentStandingHeight() const { return _currentStandingHeight; }
|
float getCurrentStandingHeight() const { return _currentStandingHeight; }
|
||||||
void setCurrentStandingHeight(float newMode) { _currentStandingHeight = newMode; }
|
void setCurrentStandingHeight(float newMode) { _currentStandingHeight = newMode; }
|
||||||
const glm::quat getAverageHeadRotation() const { return _averageHeadRotation; }
|
const glm::quat getAverageHeadRotation() const { return _averageHeadRotation; }
|
||||||
|
|
|
@ -363,12 +363,18 @@ bool EntityRenderer::needsRenderUpdateFromEntity(const EntityItemPointer& entity
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityRenderer::updateModelTransform() {
|
void EntityRenderer::updateModelTransformAndBound() {
|
||||||
bool success = false;
|
bool success = false;
|
||||||
auto newModelTransform = _entity->getTransformToCenter(success);
|
auto newModelTransform = _entity->getTransformToCenter(success);
|
||||||
if (success) {
|
if (success) {
|
||||||
_modelTransform = newModelTransform;
|
_modelTransform = newModelTransform;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
success = false;
|
||||||
|
auto bound = _entity->getAABox(success);
|
||||||
|
if (success) {
|
||||||
|
_bound = bound;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityRenderer::doRenderUpdateSynchronous(const ScenePointer& scene, Transaction& transaction, const EntityItemPointer& entity) {
|
void EntityRenderer::doRenderUpdateSynchronous(const ScenePointer& scene, Transaction& transaction, const EntityItemPointer& entity) {
|
||||||
|
@ -380,15 +386,7 @@ void EntityRenderer::doRenderUpdateSynchronous(const ScenePointer& scene, Transa
|
||||||
}
|
}
|
||||||
_prevIsTransparent = transparent;
|
_prevIsTransparent = transparent;
|
||||||
|
|
||||||
bool success = false;
|
updateModelTransformAndBound();
|
||||||
auto bound = entity->getAABox(success);
|
|
||||||
if (success) {
|
|
||||||
_bound = bound;
|
|
||||||
}
|
|
||||||
auto newModelTransform = entity->getTransformToCenter(success);
|
|
||||||
if (success) {
|
|
||||||
_modelTransform = newModelTransform;
|
|
||||||
}
|
|
||||||
|
|
||||||
_moving = entity->isMovingRelativeToParent();
|
_moving = entity->isMovingRelativeToParent();
|
||||||
_visible = entity->getVisible();
|
_visible = entity->getVisible();
|
||||||
|
|
|
@ -97,7 +97,7 @@ protected:
|
||||||
virtual void doRender(RenderArgs* args) = 0;
|
virtual void doRender(RenderArgs* args) = 0;
|
||||||
|
|
||||||
bool isFading() const { return _isFading; }
|
bool isFading() const { return _isFading; }
|
||||||
void updateModelTransform();
|
void updateModelTransformAndBound();
|
||||||
virtual bool isTransparent() const { return _isFading ? Interpolate::calculateFadeRatio(_fadeStartTime) < 1.0f : false; }
|
virtual bool isTransparent() const { return _isFading ? Interpolate::calculateFadeRatio(_fadeStartTime) < 1.0f : false; }
|
||||||
inline bool isValidRenderItem() const { return _renderItemID != Item::INVALID_ITEM_ID; }
|
inline bool isValidRenderItem() const { return _renderItemID != Item::INVALID_ITEM_ID; }
|
||||||
|
|
||||||
|
|
|
@ -126,7 +126,7 @@ void ParticleEffectEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePoi
|
||||||
void* key = (void*)this;
|
void* key = (void*)this;
|
||||||
AbstractViewStateInterface::instance()->pushPostUpdateLambda(key, [this] () {
|
AbstractViewStateInterface::instance()->pushPostUpdateLambda(key, [this] () {
|
||||||
withWriteLock([&] {
|
withWriteLock([&] {
|
||||||
updateModelTransform();
|
updateModelTransformAndBound();
|
||||||
_renderTransform = getModelTransform();
|
_renderTransform = getModelTransform();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -106,10 +106,8 @@ void ShapeEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& sce
|
||||||
_position = entity->getWorldPosition();
|
_position = entity->getWorldPosition();
|
||||||
_dimensions = entity->getScaledDimensions();
|
_dimensions = entity->getScaledDimensions();
|
||||||
_orientation = entity->getWorldOrientation();
|
_orientation = entity->getWorldOrientation();
|
||||||
bool success = false;
|
updateModelTransformAndBound();
|
||||||
auto newModelTransform = entity->getTransformToCenter(success);
|
_renderTransform = getModelTransform();
|
||||||
_renderTransform = success ? newModelTransform : getModelTransform();
|
|
||||||
|
|
||||||
if (_shape == entity::Sphere) {
|
if (_shape == entity::Sphere) {
|
||||||
_renderTransform.postScale(SPHERE_ENTITY_SCALE);
|
_renderTransform.postScale(SPHERE_ENTITY_SCALE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,7 +70,7 @@ void TextEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& scen
|
||||||
AbstractViewStateInterface::instance()->pushPostUpdateLambda(key, [this, entity] () {
|
AbstractViewStateInterface::instance()->pushPostUpdateLambda(key, [this, entity] () {
|
||||||
withWriteLock([&] {
|
withWriteLock([&] {
|
||||||
_dimensions = entity->getScaledDimensions();
|
_dimensions = entity->getScaledDimensions();
|
||||||
updateModelTransform();
|
updateModelTransformAndBound();
|
||||||
_renderTransform = getModelTransform();
|
_renderTransform = getModelTransform();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -206,7 +206,7 @@ void WebEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& scene
|
||||||
|
|
||||||
glm::vec2 windowSize = getWindowSize(entity);
|
glm::vec2 windowSize = getWindowSize(entity);
|
||||||
_webSurface->resize(QSize(windowSize.x, windowSize.y));
|
_webSurface->resize(QSize(windowSize.x, windowSize.y));
|
||||||
updateModelTransform();
|
updateModelTransformAndBound();
|
||||||
_renderTransform = getModelTransform();
|
_renderTransform = getModelTransform();
|
||||||
_renderTransform.postScale(entity->getScaledDimensions());
|
_renderTransform.postScale(entity->getScaledDimensions());
|
||||||
});
|
});
|
||||||
|
|
|
@ -11,7 +11,8 @@
|
||||||
TRIGGER_OFF_VALUE, makeDispatcherModuleParameters, entityIsGrabbable, makeRunningValues, NEAR_GRAB_RADIUS,
|
TRIGGER_OFF_VALUE, makeDispatcherModuleParameters, entityIsGrabbable, makeRunningValues, NEAR_GRAB_RADIUS,
|
||||||
findGroupParent, Vec3, cloneEntity, entityIsCloneable, propsAreCloneDynamic, HAPTIC_PULSE_STRENGTH,
|
findGroupParent, Vec3, cloneEntity, entityIsCloneable, propsAreCloneDynamic, HAPTIC_PULSE_STRENGTH,
|
||||||
HAPTIC_PULSE_DURATION, BUMPER_ON_VALUE, findHandChildEntities, TEAR_AWAY_DISTANCE, MSECS_PER_SEC, TEAR_AWAY_CHECK_TIME,
|
HAPTIC_PULSE_DURATION, BUMPER_ON_VALUE, findHandChildEntities, TEAR_AWAY_DISTANCE, MSECS_PER_SEC, TEAR_AWAY_CHECK_TIME,
|
||||||
TEAR_AWAY_COUNT, distanceBetweenPointAndEntityBoundingBox, print, Uuid, highlightTargetEntity, unhighlightTargetEntity
|
TEAR_AWAY_COUNT, distanceBetweenPointAndEntityBoundingBox, print, Uuid, highlightTargetEntity, unhighlightTargetEntity,
|
||||||
|
distanceBetweenEntityLocalPositionAndBoundingBox
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
||||||
|
@ -172,12 +173,9 @@ Script.include("/~/system/libraries/cloneEntityUtils.js");
|
||||||
if (now - this.lastUnequipCheckTime > MSECS_PER_SEC * TEAR_AWAY_CHECK_TIME) {
|
if (now - this.lastUnequipCheckTime > MSECS_PER_SEC * TEAR_AWAY_CHECK_TIME) {
|
||||||
this.lastUnequipCheckTime = now;
|
this.lastUnequipCheckTime = now;
|
||||||
if (props.parentID === MyAvatar.SELF_ID) {
|
if (props.parentID === MyAvatar.SELF_ID) {
|
||||||
var sensorScaleFactor = MyAvatar.sensorToWorldScale;
|
var tearAwayDistance = TEAR_AWAY_DISTANCE * MyAvatar.sensorToWorldScale;
|
||||||
var handPosition = controllerData.controllerLocations[this.hand].position;
|
var distance = distanceBetweenEntityLocalPositionAndBoundingBox(props);
|
||||||
var dist = distanceBetweenPointAndEntityBoundingBox(handPosition, props);
|
if (distance > tearAwayDistance) {
|
||||||
var distance = Vec3.distance(props.position, handPosition);
|
|
||||||
if ((dist > TEAR_AWAY_DISTANCE) ||
|
|
||||||
(distance > NEAR_GRAB_RADIUS * sensorScaleFactor)) {
|
|
||||||
this.autoUnequipCounter++;
|
this.autoUnequipCounter++;
|
||||||
} else {
|
} else {
|
||||||
this.autoUnequipCounter = 0;
|
this.autoUnequipCounter = 0;
|
||||||
|
|
|
@ -59,6 +59,7 @@
|
||||||
highlightTargetEntity:true,
|
highlightTargetEntity:true,
|
||||||
clearHighlightedEntities:true,
|
clearHighlightedEntities:true,
|
||||||
unhighlightTargetEntity:true
|
unhighlightTargetEntity:true
|
||||||
|
distanceBetweenEntityLocalPositionAndBoundingBox: true
|
||||||
*/
|
*/
|
||||||
|
|
||||||
MSECS_PER_SEC = 1000.0;
|
MSECS_PER_SEC = 1000.0;
|
||||||
|
@ -130,7 +131,9 @@ DISPATCHER_PROPERTIES = [
|
||||||
"type",
|
"type",
|
||||||
"href",
|
"href",
|
||||||
"cloneable",
|
"cloneable",
|
||||||
"cloneDynamic"
|
"cloneDynamic",
|
||||||
|
"localPosition",
|
||||||
|
"localRotation"
|
||||||
];
|
];
|
||||||
|
|
||||||
// priority -- a lower priority means the module will be asked sooner than one with a higher priority in a given update step
|
// priority -- a lower priority means the module will be asked sooner than one with a higher priority in a given update step
|
||||||
|
@ -413,6 +416,25 @@ findHandChildEntities = function(hand) {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
distanceBetweenEntityLocalPositionAndBoundingBox = function(entityProps) {
|
||||||
|
var localPoint = entityProps.localPosition;
|
||||||
|
var entityXform = new Xform(entityProps.rotation, entityProps.position);
|
||||||
|
var minOffset = Vec3.multiplyVbyV(entityProps.registrationPoint, entityProps.dimensions);
|
||||||
|
var maxOffset = Vec3.multiplyVbyV(Vec3.subtract(ONE_VEC, entityProps.registrationPoint), entityProps.dimensions);
|
||||||
|
var localMin = Vec3.subtract(entityXform.trans, minOffset);
|
||||||
|
var localMax = Vec3.sum(entityXform.trans, maxOffset);
|
||||||
|
|
||||||
|
var v = {x: localPoint.x, y: localPoint.y, z: localPoint.z};
|
||||||
|
v.x = Math.max(v.x, localMin.x);
|
||||||
|
v.x = Math.min(v.x, localMax.x);
|
||||||
|
v.y = Math.max(v.y, localMin.y);
|
||||||
|
v.y = Math.min(v.y, localMax.y);
|
||||||
|
v.z = Math.max(v.z, localMin.z);
|
||||||
|
v.z = Math.min(v.z, localMax.z);
|
||||||
|
|
||||||
|
return Vec3.distance(v, localPoint);
|
||||||
|
};
|
||||||
|
|
||||||
distanceBetweenPointAndEntityBoundingBox = function(point, entityProps) {
|
distanceBetweenPointAndEntityBoundingBox = function(point, entityProps) {
|
||||||
var entityXform = new Xform(entityProps.rotation, entityProps.position);
|
var entityXform = new Xform(entityProps.rotation, entityProps.position);
|
||||||
var localPoint = entityXform.inv().xformPoint(point);
|
var localPoint = entityXform.inv().xformPoint(point);
|
||||||
|
|
|
@ -31,8 +31,8 @@ BakerCLI::BakerCLI(OvenCLIApplication* parent) : QObject(parent) {
|
||||||
void BakerCLI::bakeFile(QUrl inputUrl, const QString& outputPath, const QString& type) {
|
void BakerCLI::bakeFile(QUrl inputUrl, const QString& outputPath, const QString& type) {
|
||||||
|
|
||||||
// if the URL doesn't have a scheme, assume it is a local file
|
// if the URL doesn't have a scheme, assume it is a local file
|
||||||
if (inputUrl.scheme() != "http" && inputUrl.scheme() != "https" && inputUrl.scheme() != "ftp") {
|
if (inputUrl.scheme() != "http" && inputUrl.scheme() != "https" && inputUrl.scheme() != "ftp" && inputUrl.scheme() != "file") {
|
||||||
inputUrl.setScheme("file");
|
inputUrl = QUrl::fromLocalFile(inputUrl.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug() << "Baking file type: " << type;
|
qDebug() << "Baking file type: " << type;
|
||||||
|
|
Loading…
Reference in a new issue