mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 14:03:55 +02:00
pass avatar parent information through avatar-mixer
This commit is contained in:
parent
778dc8dc15
commit
f6fe503c51
4 changed files with 24 additions and 13 deletions
|
@ -151,7 +151,7 @@ void AvatarManager::simulateAvatarFades(float deltaTime) {
|
|||
while (fadingIterator != _avatarFades.end()) {
|
||||
auto avatar = std::static_pointer_cast<Avatar>(*fadingIterator);
|
||||
avatar->withWriteLock([&] {
|
||||
avatar->setTargetScale(avatar->getAvatarScale() * SHRINK_RATE, true);
|
||||
avatar->setTargetScale(avatar->getAvatarScale() * SHRINK_RATE);
|
||||
if (avatar->getTargetScale() < MIN_FADE_SCALE) {
|
||||
avatar->removeFromScene(*fadingIterator, scene, pendingChanges);
|
||||
fadingIterator = _avatarFades.erase(fadingIterator);
|
||||
|
|
|
@ -135,15 +135,15 @@ float AvatarData::getTargetScale() const {
|
|||
return _targetScale;
|
||||
}
|
||||
|
||||
void AvatarData::setTargetScale(float targetScale, bool overideReferential) {
|
||||
void AvatarData::setTargetScale(float targetScale) {
|
||||
_targetScale = targetScale;
|
||||
}
|
||||
|
||||
void AvatarData::setClampedTargetScale(float targetScale, bool overideReferential) {
|
||||
void AvatarData::setClampedTargetScale(float targetScale) {
|
||||
|
||||
targetScale = glm::clamp(targetScale, MIN_AVATAR_SCALE, MAX_AVATAR_SCALE);
|
||||
|
||||
setTargetScale(targetScale, overideReferential);
|
||||
setTargetScale(targetScale);
|
||||
qCDebug(avatars) << "Changed scale to " << _targetScale;
|
||||
}
|
||||
|
||||
|
@ -214,14 +214,18 @@ QByteArray AvatarData::toByteArray(bool cullSmallChanges, bool sendAll) {
|
|||
setAtBit(bitItems, IS_EYE_TRACKER_CONNECTED);
|
||||
}
|
||||
// referential state
|
||||
if (false) {
|
||||
setAtBit(bitItems, HAS_REFERENTIAL); // XXX leaving this for later use
|
||||
SpatiallyNestablePointer parent = getParentPointer();
|
||||
if (parent) {
|
||||
setAtBit(bitItems, HAS_REFERENTIAL);
|
||||
}
|
||||
*destinationBuffer++ = bitItems;
|
||||
|
||||
// XXX leaving this for later use
|
||||
if (false) {
|
||||
// destinationBuffer += _referential->packReferential(destinationBuffer);
|
||||
if (parent) {
|
||||
QByteArray referentialAsBytes = parent->getID().toRfc4122();
|
||||
memcpy(destinationBuffer, referentialAsBytes.data(), referentialAsBytes.size());
|
||||
destinationBuffer += referentialAsBytes.size();
|
||||
memcpy(destinationBuffer, &_parentJointIndex, sizeof(_parentJointIndex));
|
||||
destinationBuffer += sizeof(_parentJointIndex);
|
||||
}
|
||||
|
||||
// If it is connected, pack up the data
|
||||
|
@ -541,8 +545,15 @@ int AvatarData::parseDataFromBuffer(const QByteArray& buffer) {
|
|||
_headData->_isEyeTrackerConnected = oneAtBit(bitItems, IS_EYE_TRACKER_CONNECTED);
|
||||
bool hasReferential = oneAtBit(bitItems, HAS_REFERENTIAL);
|
||||
|
||||
// XXX leaving this for later use Referential
|
||||
if (hasReferential) {
|
||||
const int sizeOfPackedUuid = 16;
|
||||
QByteArray referentialAsBytes((const char*)sourceBuffer, sizeOfPackedUuid);
|
||||
_parentID = QUuid::fromRfc4122(referentialAsBytes);
|
||||
sourceBuffer += sizeOfPackedUuid;
|
||||
memcpy(&_parentJointIndex, sourceBuffer, sizeof(_parentJointIndex));
|
||||
sourceBuffer += sizeof(_parentJointIndex);
|
||||
} else {
|
||||
_parentID = QUuid();
|
||||
}
|
||||
|
||||
if (_headData->_isFaceTrackerConnected) {
|
||||
|
|
|
@ -223,8 +223,8 @@ public:
|
|||
|
||||
// Scale
|
||||
float getTargetScale() const;
|
||||
void setTargetScale(float targetScale, bool overideReferential = false);
|
||||
void setClampedTargetScale(float targetScale, bool overideReferential = false);
|
||||
void setTargetScale(float targetScale);
|
||||
void setClampedTargetScale(float targetScale);
|
||||
|
||||
// Hand State
|
||||
Q_INVOKABLE void setHandState(char s) { _handState = s; }
|
||||
|
|
|
@ -70,13 +70,13 @@ protected:
|
|||
QUuid _id;
|
||||
QUuid _parentID; // what is this thing's transform relative to?
|
||||
quint16 _parentJointIndex; // which joint of the parent is this relative to?
|
||||
SpatiallyNestablePointer getParentPointer() const;
|
||||
|
||||
mutable SpatiallyNestableWeakPointer _parent;
|
||||
QVector<SpatiallyNestableWeakPointer> _children;
|
||||
|
||||
private:
|
||||
Transform _transform; // this is to be combined with parent's world-transform to produce this' world-transform.
|
||||
SpatiallyNestablePointer getParentPointer() const;
|
||||
|
||||
// these are so we can return by reference
|
||||
mutable glm::vec3 _absolutePositionCache;
|
||||
|
|
Loading…
Reference in a new issue