mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 13:40:02 +02:00
make SpatiallyNestable setters take values by reference
This commit is contained in:
parent
a948ae5f19
commit
fff4e3e831
6 changed files with 26 additions and 26 deletions
|
@ -1157,12 +1157,12 @@ glm::quat Avatar::getRightPalmRotation() {
|
||||||
return rightRotation;
|
return rightRotation;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Avatar::setPosition(const glm::vec3 position) {
|
void Avatar::setPosition(const glm::vec3& position) {
|
||||||
AvatarData::setPosition(position);
|
AvatarData::setPosition(position);
|
||||||
updateAttitude();
|
updateAttitude();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Avatar::setOrientation(const glm::quat orientation) {
|
void Avatar::setOrientation(const glm::quat& orientation) {
|
||||||
AvatarData::setOrientation(orientation);
|
AvatarData::setOrientation(orientation);
|
||||||
updateAttitude();
|
updateAttitude();
|
||||||
}
|
}
|
||||||
|
|
|
@ -158,8 +158,8 @@ public:
|
||||||
void setMotionState(AvatarMotionState* motionState) { _motionState = motionState; }
|
void setMotionState(AvatarMotionState* motionState) { _motionState = motionState; }
|
||||||
AvatarMotionState* getMotionState() { return _motionState; }
|
AvatarMotionState* getMotionState() { return _motionState; }
|
||||||
|
|
||||||
virtual void setPosition(glm::vec3 position);
|
virtual void setPosition(const glm::vec3& position);
|
||||||
virtual void setOrientation(glm::quat orientation);
|
virtual void setOrientation(const glm::quat& orientation);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
|
|
|
@ -1626,10 +1626,10 @@ void AvatarData::setBodyRoll(float bodyRoll) {
|
||||||
setOrientation(glm::quat(glm::radians(eulerAngles)));
|
setOrientation(glm::quat(glm::radians(eulerAngles)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void AvatarData::setPosition(const glm::vec3 position) {
|
void AvatarData::setPosition(const glm::vec3& position) {
|
||||||
SpatiallyNestable::setPosition(position);
|
SpatiallyNestable::setPosition(position);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AvatarData::setOrientation(const glm::quat orientation) {
|
void AvatarData::setOrientation(const glm::quat& orientation) {
|
||||||
SpatiallyNestable::setOrientation(orientation);
|
SpatiallyNestable::setOrientation(orientation);
|
||||||
}
|
}
|
||||||
|
|
|
@ -201,8 +201,8 @@ public:
|
||||||
float getBodyRoll() const;
|
float getBodyRoll() const;
|
||||||
void setBodyRoll(float bodyRoll);
|
void setBodyRoll(float bodyRoll);
|
||||||
|
|
||||||
virtual void setPosition(glm::vec3 position);
|
virtual void setPosition(const glm::vec3& position);
|
||||||
virtual void setOrientation(glm::quat orientation);
|
virtual void setOrientation(const glm::quat& orientation);
|
||||||
|
|
||||||
void nextAttitude(glm::vec3 position, glm::quat orientation); // Can be safely called at any time.
|
void nextAttitude(glm::vec3 position, glm::quat orientation); // Can be safely called at any time.
|
||||||
void startCapture(); // start/end of the period in which the latest values are about to be captured for camera, etc.
|
void startCapture(); // start/end of the period in which the latest values are about to be captured for camera, etc.
|
||||||
|
|
|
@ -91,7 +91,7 @@ void SpatiallyNestable::forgetChild(SpatiallyNestablePointer newChild) const {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpatiallyNestable::setParentID(const QUuid parentID) {
|
void SpatiallyNestable::setParentID(const QUuid& parentID) {
|
||||||
if (_parentID != parentID) {
|
if (_parentID != parentID) {
|
||||||
_parentID = parentID;
|
_parentID = parentID;
|
||||||
_parentKnowsMe = false;
|
_parentKnowsMe = false;
|
||||||
|
@ -188,7 +188,7 @@ glm::vec3 SpatiallyNestable::getPosition(int jointIndex) const {
|
||||||
return getTransform(jointIndex).getTranslation();
|
return getTransform(jointIndex).getTranslation();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpatiallyNestable::setPosition(glm::vec3 position) {
|
void SpatiallyNestable::setPosition(const glm::vec3& position) {
|
||||||
Transform parentTransform = getParentTransform();
|
Transform parentTransform = getParentTransform();
|
||||||
Transform myWorldTransform;
|
Transform myWorldTransform;
|
||||||
_transformLock.withWriteLock([&] {
|
_transformLock.withWriteLock([&] {
|
||||||
|
@ -207,7 +207,7 @@ glm::quat SpatiallyNestable::getOrientation(int jointIndex) const {
|
||||||
return getTransform(jointIndex).getRotation();
|
return getTransform(jointIndex).getRotation();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpatiallyNestable::setOrientation(glm::quat orientation) {
|
void SpatiallyNestable::setOrientation(const glm::quat& orientation) {
|
||||||
Transform parentTransform = getParentTransform();
|
Transform parentTransform = getParentTransform();
|
||||||
Transform myWorldTransform;
|
Transform myWorldTransform;
|
||||||
_transformLock.withWriteLock([&] {
|
_transformLock.withWriteLock([&] {
|
||||||
|
@ -238,7 +238,7 @@ const Transform SpatiallyNestable::getTransform(int jointIndex) const {
|
||||||
return jointInWorldFrame;
|
return jointInWorldFrame;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpatiallyNestable::setTransform(const Transform transform) {
|
void SpatiallyNestable::setTransform(const Transform& transform) {
|
||||||
Transform parentTransform = getParentTransform();
|
Transform parentTransform = getParentTransform();
|
||||||
_transformLock.withWriteLock([&] {
|
_transformLock.withWriteLock([&] {
|
||||||
Transform::inverseMult(_transform, parentTransform, transform);
|
Transform::inverseMult(_transform, parentTransform, transform);
|
||||||
|
@ -259,7 +259,7 @@ glm::vec3 SpatiallyNestable::getScale(int jointIndex) const {
|
||||||
return getScale();
|
return getScale();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpatiallyNestable::setScale(glm::vec3 scale) {
|
void SpatiallyNestable::setScale(const glm::vec3& scale) {
|
||||||
_transformLock.withWriteLock([&] {
|
_transformLock.withWriteLock([&] {
|
||||||
_transform.setScale(scale);
|
_transform.setScale(scale);
|
||||||
});
|
});
|
||||||
|
@ -274,7 +274,7 @@ const Transform SpatiallyNestable::getLocalTransform() const {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpatiallyNestable::setLocalTransform(const Transform transform) {
|
void SpatiallyNestable::setLocalTransform(const Transform& transform) {
|
||||||
_transformLock.withWriteLock([&] {
|
_transformLock.withWriteLock([&] {
|
||||||
_transform = transform;
|
_transform = transform;
|
||||||
});
|
});
|
||||||
|
@ -289,7 +289,7 @@ glm::vec3 SpatiallyNestable::getLocalPosition() const {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpatiallyNestable::setLocalPosition(glm::vec3 position) {
|
void SpatiallyNestable::setLocalPosition(const glm::vec3& position) {
|
||||||
_transformLock.withWriteLock([&] {
|
_transformLock.withWriteLock([&] {
|
||||||
_transform.setTranslation(position);
|
_transform.setTranslation(position);
|
||||||
});
|
});
|
||||||
|
@ -304,7 +304,7 @@ glm::quat SpatiallyNestable::getLocalOrientation() const {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpatiallyNestable::setLocalOrientation(glm::quat orientation) {
|
void SpatiallyNestable::setLocalOrientation(const glm::quat& orientation) {
|
||||||
_transformLock.withWriteLock([&] {
|
_transformLock.withWriteLock([&] {
|
||||||
_transform.setRotation(orientation);
|
_transform.setRotation(orientation);
|
||||||
});
|
});
|
||||||
|
@ -319,7 +319,7 @@ glm::vec3 SpatiallyNestable::getLocalScale() const {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpatiallyNestable::setLocalScale(glm::vec3 scale) {
|
void SpatiallyNestable::setLocalScale(const glm::vec3& scale) {
|
||||||
_transformLock.withWriteLock([&] {
|
_transformLock.withWriteLock([&] {
|
||||||
_transform.setScale(scale);
|
_transform.setScale(scale);
|
||||||
});
|
});
|
||||||
|
|
|
@ -42,7 +42,7 @@ public:
|
||||||
virtual void setID(const QUuid& id) { _id = id; }
|
virtual void setID(const QUuid& id) { _id = id; }
|
||||||
|
|
||||||
virtual const QUuid getParentID() const { return _parentID; }
|
virtual const QUuid getParentID() const { return _parentID; }
|
||||||
virtual void setParentID(const QUuid parentID);
|
virtual void setParentID(const QUuid& parentID);
|
||||||
|
|
||||||
virtual quint16 getParentJointIndex() const { return _parentJointIndex; }
|
virtual quint16 getParentJointIndex() const { return _parentJointIndex; }
|
||||||
virtual void setParentJointIndex(quint16 parentJointIndex) { _parentJointIndex = parentJointIndex; }
|
virtual void setParentJointIndex(quint16 parentJointIndex) { _parentJointIndex = parentJointIndex; }
|
||||||
|
@ -55,19 +55,19 @@ public:
|
||||||
|
|
||||||
// world frame
|
// world frame
|
||||||
virtual const Transform getTransform() const;
|
virtual const Transform getTransform() const;
|
||||||
virtual void setTransform(const Transform transform);
|
virtual void setTransform(const Transform& transform);
|
||||||
|
|
||||||
virtual Transform getParentTransform() const;
|
virtual Transform getParentTransform() const;
|
||||||
|
|
||||||
virtual glm::vec3 getPosition() const;
|
virtual glm::vec3 getPosition() const;
|
||||||
virtual void setPosition(glm::vec3 position);
|
virtual void setPosition(const glm::vec3& position);
|
||||||
|
|
||||||
virtual glm::quat getOrientation() const;
|
virtual glm::quat getOrientation() const;
|
||||||
virtual glm::quat getOrientation(int jointIndex) const;
|
virtual glm::quat getOrientation(int jointIndex) const;
|
||||||
virtual void setOrientation(glm::quat orientation);
|
virtual void setOrientation(const glm::quat& orientation);
|
||||||
|
|
||||||
virtual glm::vec3 getScale() const;
|
virtual glm::vec3 getScale() const;
|
||||||
virtual void setScale(glm::vec3 scale);
|
virtual void setScale(const glm::vec3& scale);
|
||||||
|
|
||||||
// get world-frame values for a specific joint
|
// get world-frame values for a specific joint
|
||||||
virtual const Transform getTransform(int jointIndex) const;
|
virtual const Transform getTransform(int jointIndex) const;
|
||||||
|
@ -76,16 +76,16 @@ public:
|
||||||
|
|
||||||
// object's parent's frame
|
// object's parent's frame
|
||||||
virtual const Transform getLocalTransform() const;
|
virtual const Transform getLocalTransform() const;
|
||||||
virtual void setLocalTransform(const Transform transform);
|
virtual void setLocalTransform(const Transform& transform);
|
||||||
|
|
||||||
virtual glm::vec3 getLocalPosition() const;
|
virtual glm::vec3 getLocalPosition() const;
|
||||||
virtual void setLocalPosition(glm::vec3 position);
|
virtual void setLocalPosition(const glm::vec3& position);
|
||||||
|
|
||||||
virtual glm::quat getLocalOrientation() const;
|
virtual glm::quat getLocalOrientation() const;
|
||||||
virtual void setLocalOrientation(glm::quat orientation);
|
virtual void setLocalOrientation(const glm::quat& orientation);
|
||||||
|
|
||||||
virtual glm::vec3 getLocalScale() const;
|
virtual glm::vec3 getLocalScale() const;
|
||||||
virtual void setLocalScale(glm::vec3 scale);
|
virtual void setLocalScale(const glm::vec3& scale);
|
||||||
|
|
||||||
QList<SpatiallyNestablePointer> getChildren() const;
|
QList<SpatiallyNestablePointer> getChildren() const;
|
||||||
NestableTypes::NestableType getNestableType() const { return _nestableType; }
|
NestableTypes::NestableType getNestableType() const { return _nestableType; }
|
||||||
|
|
Loading…
Reference in a new issue