mirror of
https://github.com/lubosz/overte.git
synced 2025-04-14 14:46:55 +02:00
Merge pull request #6611 from Atlante45/attachments
Fix Attachments jitter
This commit is contained in:
commit
8ca6c7acc3
9 changed files with 16 additions and 26 deletions
|
@ -2944,6 +2944,7 @@ void Application::update(float deltaTime) {
|
|||
}
|
||||
|
||||
myAvatar->harvestResultsFromPhysicsSimulation();
|
||||
myAvatar->simulateAttachments(deltaTime);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -200,7 +200,6 @@ void Avatar::simulate(float deltaTime) {
|
|||
PerformanceTimer perfTimer("skeleton");
|
||||
_skeletonModel.getRig()->copyJointsFromJointData(_jointData);
|
||||
_skeletonModel.simulate(deltaTime, _hasNewJointRotations || _hasNewJointTranslations);
|
||||
simulateAttachments(deltaTime);
|
||||
locationChanged(); // joints changed, so if there are any children, update them.
|
||||
_hasNewJointRotations = false;
|
||||
_hasNewJointTranslations = false;
|
||||
|
|
|
@ -69,6 +69,7 @@ public:
|
|||
|
||||
void init();
|
||||
void simulate(float deltaTime);
|
||||
void simulateAttachments(float deltaTime);
|
||||
|
||||
virtual void render(RenderArgs* renderArgs, const glm::vec3& cameraPosition);
|
||||
|
||||
|
@ -87,7 +88,6 @@ public:
|
|||
bool isInitialized() const { return _initialized; }
|
||||
SkeletonModel& getSkeletonModel() { return _skeletonModel; }
|
||||
const SkeletonModel& getSkeletonModel() const { return _skeletonModel; }
|
||||
const QVector<Model*>& getAttachmentModels() const { return _attachmentModels; }
|
||||
glm::vec3 getChestPosition() const;
|
||||
float getAvatarScale() const { return getScale().y; }
|
||||
const Head* getHead() const { return static_cast<const Head*>(_headData); }
|
||||
|
@ -217,8 +217,6 @@ protected:
|
|||
virtual bool shouldRenderHead(const RenderArgs* renderArgs) const;
|
||||
virtual void fixupModelsInScene();
|
||||
|
||||
void simulateAttachments(float deltaTime);
|
||||
|
||||
virtual void updateJointMappings();
|
||||
|
||||
render::ItemID _renderItemID;
|
||||
|
|
|
@ -323,11 +323,6 @@ void MyAvatar::simulate(float deltaTime) {
|
|||
return;
|
||||
}
|
||||
|
||||
{
|
||||
PerformanceTimer perfTimer("attachments");
|
||||
simulateAttachments(deltaTime);
|
||||
}
|
||||
|
||||
{
|
||||
PerformanceTimer perfTimer("joints");
|
||||
// copy out the skeleton joints from the model
|
||||
|
|
|
@ -47,7 +47,7 @@ const QString AvatarData::FRAME_NAME = "com.highfidelity.recording.AvatarData";
|
|||
static std::once_flag frameTypeRegistration;
|
||||
|
||||
AvatarData::AvatarData() :
|
||||
SpatiallyNestable(NestableTypes::Avatar, QUuid()),
|
||||
SpatiallyNestable(NestableType::Avatar, QUuid()),
|
||||
_handPosition(0.0f),
|
||||
_targetScale(1.0f),
|
||||
_handState(0),
|
||||
|
|
|
@ -36,7 +36,7 @@ int EntityItem::_maxActionsDataSize = 800;
|
|||
quint64 EntityItem::_rememberDeletedActionTime = 20 * USECS_PER_SECOND;
|
||||
|
||||
EntityItem::EntityItem(const EntityItemID& entityItemID) :
|
||||
SpatiallyNestable(NestableTypes::Entity, entityItemID),
|
||||
SpatiallyNestable(NestableType::Entity, entityItemID),
|
||||
_type(EntityTypes::Unknown),
|
||||
_lastSimulated(0),
|
||||
_lastUpdated(0),
|
||||
|
@ -1294,7 +1294,7 @@ void EntityItem::updatePosition(const glm::vec3& value) {
|
|||
setLocalPosition(value);
|
||||
_dirtyFlags |= Simulation::DIRTY_POSITION;
|
||||
forEachDescendant([&](SpatiallyNestablePointer object) {
|
||||
if (object->getNestableType() == NestableTypes::Entity) {
|
||||
if (object->getNestableType() == NestableType::Entity) {
|
||||
EntityItemPointer entity = std::static_pointer_cast<EntityItem>(object);
|
||||
entity->_dirtyFlags |= Simulation::DIRTY_POSITION;
|
||||
}
|
||||
|
@ -1317,7 +1317,7 @@ void EntityItem::updateRotation(const glm::quat& rotation) {
|
|||
setLocalOrientation(rotation);
|
||||
_dirtyFlags |= Simulation::DIRTY_ROTATION;
|
||||
forEachDescendant([&](SpatiallyNestablePointer object) {
|
||||
if (object->getNestableType() == NestableTypes::Entity) {
|
||||
if (object->getNestableType() == NestableType::Entity) {
|
||||
EntityItemPointer entity = std::static_pointer_cast<EntityItem>(object);
|
||||
entity->_dirtyFlags |= Simulation::DIRTY_ROTATION;
|
||||
entity->_dirtyFlags |= Simulation::DIRTY_POSITION;
|
||||
|
|
|
@ -219,7 +219,7 @@ bool EntityTree::updateEntityWithElement(EntityItemPointer entity, const EntityI
|
|||
// if the entity has children, run UpdateEntityOperator on them. If the children have children, recurse
|
||||
QQueue<SpatiallyNestablePointer> toProcess;
|
||||
foreach (SpatiallyNestablePointer child, entity->getChildren()) {
|
||||
if (child && child->getNestableType() == NestableTypes::Entity) {
|
||||
if (child && child->getNestableType() == NestableType::Entity) {
|
||||
toProcess.enqueue(child);
|
||||
}
|
||||
}
|
||||
|
@ -232,7 +232,7 @@ bool EntityTree::updateEntityWithElement(EntityItemPointer entity, const EntityI
|
|||
childEntity, newChildBBRelProperties);
|
||||
recurseTreeWithOperator(&theChildOperator);
|
||||
foreach (SpatiallyNestablePointer childChild, childEntity->getChildren()) {
|
||||
if (childChild && childChild->getNestableType() == NestableTypes::Entity) {
|
||||
if (childChild && childChild->getNestableType() == NestableType::Entity) {
|
||||
toProcess.enqueue(childChild);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#include "SpatiallyNestable.h"
|
||||
|
||||
|
||||
SpatiallyNestable::SpatiallyNestable(NestableTypes::NestableType nestableType, QUuid id) :
|
||||
SpatiallyNestable::SpatiallyNestable(NestableType nestableType, QUuid id) :
|
||||
_nestableType(nestableType),
|
||||
_id(id),
|
||||
_transform() {
|
||||
|
|
|
@ -25,17 +25,14 @@ using SpatiallyNestableWeakConstPointer = std::weak_ptr<const SpatiallyNestable>
|
|||
using SpatiallyNestablePointer = std::shared_ptr<SpatiallyNestable>;
|
||||
using SpatiallyNestableConstPointer = std::shared_ptr<const SpatiallyNestable>;
|
||||
|
||||
class NestableTypes {
|
||||
public:
|
||||
using NestableType = enum NestableType_t {
|
||||
Entity,
|
||||
Avatar
|
||||
};
|
||||
enum class NestableType {
|
||||
Entity,
|
||||
Avatar
|
||||
};
|
||||
|
||||
class SpatiallyNestable : public std::enable_shared_from_this<SpatiallyNestable> {
|
||||
public:
|
||||
SpatiallyNestable(NestableTypes::NestableType nestableType, QUuid id);
|
||||
SpatiallyNestable(NestableType nestableType, QUuid id);
|
||||
virtual ~SpatiallyNestable() { }
|
||||
|
||||
virtual const QUuid& getID() const { return _id; }
|
||||
|
@ -88,17 +85,17 @@ public:
|
|||
virtual void setLocalScale(const glm::vec3& scale);
|
||||
|
||||
QList<SpatiallyNestablePointer> getChildren() const;
|
||||
NestableTypes::NestableType getNestableType() const { return _nestableType; }
|
||||
NestableType getNestableType() const { return _nestableType; }
|
||||
|
||||
// this object's frame
|
||||
virtual const Transform getAbsoluteJointTransformInObjectFrame(int jointIndex) const;
|
||||
virtual glm::quat getAbsoluteJointRotationInObjectFrame(int index) const { assert(false); return glm::quat(); }
|
||||
virtual glm::vec3 getAbsoluteJointTranslationInObjectFrame(int index) const { assert(false); return glm::vec3(); }
|
||||
|
||||
|
||||
SpatiallyNestablePointer getThisPointer() const;
|
||||
|
||||
protected:
|
||||
NestableTypes::NestableType _nestableType; // EntityItem or an AvatarData
|
||||
const NestableType _nestableType; // EntityItem or an AvatarData
|
||||
QUuid _id;
|
||||
QUuid _parentID; // what is this thing's transform relative to?
|
||||
quint16 _parentJointIndex { 0 }; // which joint of the parent is this relative to?
|
||||
|
|
Loading…
Reference in a new issue