mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-06-02 08:51:12 +02:00
Merge pull request #12302 from druiz17/fix-another-bootstrapping
Fix another bootstrapping and rename entityItem _dirtyFlags
This commit is contained in:
commit
a5e968867e
6 changed files with 115 additions and 67 deletions
|
@ -99,7 +99,7 @@ const float MARCHING_CUBE_COLLISION_HULL_OFFSET = 0.5;
|
||||||
|
|
||||||
In RenderablePolyVoxEntityItem::render, these flags are checked and changes are propagated along the chain.
|
In RenderablePolyVoxEntityItem::render, these flags are checked and changes are propagated along the chain.
|
||||||
decompressVolumeData() is called to decompress _voxelData into _volData. recomputeMesh() is called to invoke the
|
decompressVolumeData() is called to decompress _voxelData into _volData. recomputeMesh() is called to invoke the
|
||||||
polyVox surface extractor to create _mesh (as well as set Simulation _dirtyFlags). Because Simulation::DIRTY_SHAPE
|
polyVox surface extractor to create _mesh (as well as set Simulation _flags). Because Simulation::DIRTY_SHAPE
|
||||||
is set, isReadyToComputeShape() gets called and _shape is created either from _volData or _shape, depending on
|
is set, isReadyToComputeShape() gets called and _shape is created either from _volData or _shape, depending on
|
||||||
the surface style.
|
the surface style.
|
||||||
|
|
||||||
|
@ -1138,7 +1138,7 @@ void RenderablePolyVoxEntityItem::setMesh(graphics::MeshPointer mesh) {
|
||||||
bool neighborsNeedUpdate;
|
bool neighborsNeedUpdate;
|
||||||
withWriteLock([&] {
|
withWriteLock([&] {
|
||||||
if (!_collisionless) {
|
if (!_collisionless) {
|
||||||
_dirtyFlags |= Simulation::DIRTY_SHAPE | Simulation::DIRTY_MASS;
|
_flags |= Simulation::DIRTY_SHAPE | Simulation::DIRTY_MASS;
|
||||||
}
|
}
|
||||||
_mesh = mesh;
|
_mesh = mesh;
|
||||||
_meshDirty = true;
|
_meshDirty = true;
|
||||||
|
|
|
@ -933,7 +933,7 @@ void EntityItem::setDensity(float density) {
|
||||||
withWriteLock([&] {
|
withWriteLock([&] {
|
||||||
if (_density != clampedDensity) {
|
if (_density != clampedDensity) {
|
||||||
_density = clampedDensity;
|
_density = clampedDensity;
|
||||||
_dirtyFlags |= Simulation::DIRTY_MASS;
|
_flags |= Simulation::DIRTY_MASS;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -958,7 +958,7 @@ void EntityItem::setMass(float mass) {
|
||||||
withWriteLock([&] {
|
withWriteLock([&] {
|
||||||
if (_density != newDensity) {
|
if (_density != newDensity) {
|
||||||
_density = newDensity;
|
_density = newDensity;
|
||||||
_dirtyFlags |= Simulation::DIRTY_MASS;
|
_flags |= Simulation::DIRTY_MASS;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1623,41 +1623,42 @@ void EntityItem::setParentID(const QUuid& value) {
|
||||||
if (!value.isNull() && tree) {
|
if (!value.isNull() && tree) {
|
||||||
EntityItemPointer entity = tree->findEntityByEntityItemID(value);
|
EntityItemPointer entity = tree->findEntityByEntityItemID(value);
|
||||||
if (entity) {
|
if (entity) {
|
||||||
newParentNoBootstrapping = entity->getDirtyFlags() & Simulation::NO_BOOTSTRAPPING;
|
newParentNoBootstrapping = entity->getSpecialFlags() & Simulation::SPECIAL_FLAGS_NO_BOOTSTRAPPING;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!oldParentID.isNull() && tree) {
|
if (!oldParentID.isNull() && tree) {
|
||||||
EntityItemPointer entity = tree->findEntityByEntityItemID(oldParentID);
|
EntityItemPointer entity = tree->findEntityByEntityItemID(oldParentID);
|
||||||
if (entity) {
|
if (entity) {
|
||||||
oldParentNoBootstrapping = entity->getDirtyFlags() & Simulation::NO_BOOTSTRAPPING;
|
oldParentNoBootstrapping = entity->getDirtyFlags() & Simulation::SPECIAL_FLAGS_NO_BOOTSTRAPPING;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!value.isNull() && (value == Physics::getSessionUUID() || value == AVATAR_SELF_ID)) {
|
if (!value.isNull() && (value == Physics::getSessionUUID() || value == AVATAR_SELF_ID)) {
|
||||||
newParentNoBootstrapping |= Simulation::NO_BOOTSTRAPPING;
|
newParentNoBootstrapping |= Simulation::SPECIAL_FLAGS_NO_BOOTSTRAPPING;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!oldParentID.isNull() && (oldParentID == Physics::getSessionUUID() || oldParentID == AVATAR_SELF_ID)) {
|
if (!oldParentID.isNull() && (oldParentID == Physics::getSessionUUID() || oldParentID == AVATAR_SELF_ID)) {
|
||||||
oldParentNoBootstrapping |= Simulation::NO_BOOTSTRAPPING;
|
oldParentNoBootstrapping |= Simulation::SPECIAL_FLAGS_NO_BOOTSTRAPPING;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((bool)(oldParentNoBootstrapping ^ newParentNoBootstrapping)) {
|
if ((bool)(oldParentNoBootstrapping ^ newParentNoBootstrapping)) {
|
||||||
if ((bool)(newParentNoBootstrapping & Simulation::NO_BOOTSTRAPPING)) {
|
if ((bool)(newParentNoBootstrapping & Simulation::SPECIAL_FLAGS_NO_BOOTSTRAPPING)) {
|
||||||
markDirtyFlags(Simulation::NO_BOOTSTRAPPING);
|
markSpecialFlags(Simulation::SPECIAL_FLAGS_NO_BOOTSTRAPPING);
|
||||||
forEachDescendant([&](SpatiallyNestablePointer object) {
|
|
||||||
if (object->getNestableType() == NestableType::Entity) {
|
|
||||||
EntityItemPointer entity = std::static_pointer_cast<EntityItem>(object);
|
|
||||||
entity->markDirtyFlags(Simulation::DIRTY_COLLISION_GROUP | Simulation::NO_BOOTSTRAPPING);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
clearDirtyFlags(Simulation::NO_BOOTSTRAPPING);
|
|
||||||
forEachDescendant([&](SpatiallyNestablePointer object) {
|
forEachDescendant([&](SpatiallyNestablePointer object) {
|
||||||
if (object->getNestableType() == NestableType::Entity) {
|
if (object->getNestableType() == NestableType::Entity) {
|
||||||
EntityItemPointer entity = std::static_pointer_cast<EntityItem>(object);
|
EntityItemPointer entity = std::static_pointer_cast<EntityItem>(object);
|
||||||
entity->markDirtyFlags(Simulation::DIRTY_COLLISION_GROUP);
|
entity->markDirtyFlags(Simulation::DIRTY_COLLISION_GROUP);
|
||||||
entity->clearDirtyFlags(Simulation::NO_BOOTSTRAPPING);
|
entity->markSpecialFlags(Simulation::SPECIAL_FLAGS_NO_BOOTSTRAPPING);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
clearSpecialFlags(Simulation::SPECIAL_FLAGS_NO_BOOTSTRAPPING);
|
||||||
|
forEachDescendant([&](SpatiallyNestablePointer object) {
|
||||||
|
if (object->getNestableType() == NestableType::Entity) {
|
||||||
|
EntityItemPointer entity = std::static_pointer_cast<EntityItem>(object);
|
||||||
|
entity->markDirtyFlags(Simulation::DIRTY_COLLISION_GROUP);
|
||||||
|
entity->clearSpecialFlags(Simulation::SPECIAL_FLAGS_NO_BOOTSTRAPPING);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1694,7 +1695,7 @@ void EntityItem::setUnscaledDimensions(const glm::vec3& value) {
|
||||||
locationChanged();
|
locationChanged();
|
||||||
dimensionsChanged();
|
dimensionsChanged();
|
||||||
withWriteLock([&] {
|
withWriteLock([&] {
|
||||||
_dirtyFlags |= (Simulation::DIRTY_SHAPE | Simulation::DIRTY_MASS);
|
_flags |= (Simulation::DIRTY_SHAPE | Simulation::DIRTY_MASS);
|
||||||
_queryAACubeSet = false;
|
_queryAACubeSet = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1703,7 +1704,7 @@ void EntityItem::setUnscaledDimensions(const glm::vec3& value) {
|
||||||
void EntityItem::setRotation(glm::quat rotation) {
|
void EntityItem::setRotation(glm::quat rotation) {
|
||||||
if (getLocalOrientation() != rotation) {
|
if (getLocalOrientation() != rotation) {
|
||||||
setLocalOrientation(rotation);
|
setLocalOrientation(rotation);
|
||||||
_dirtyFlags |= Simulation::DIRTY_ROTATION;
|
_flags |= Simulation::DIRTY_ROTATION;
|
||||||
forEachDescendant([&](SpatiallyNestablePointer object) {
|
forEachDescendant([&](SpatiallyNestablePointer object) {
|
||||||
if (object->getNestableType() == NestableType::Entity) {
|
if (object->getNestableType() == NestableType::Entity) {
|
||||||
EntityItemPointer entity = std::static_pointer_cast<EntityItem>(object);
|
EntityItemPointer entity = std::static_pointer_cast<EntityItem>(object);
|
||||||
|
@ -1733,7 +1734,7 @@ void EntityItem::setVelocity(const glm::vec3& value) {
|
||||||
velocity = value;
|
velocity = value;
|
||||||
}
|
}
|
||||||
setLocalVelocity(velocity);
|
setLocalVelocity(velocity);
|
||||||
_dirtyFlags |= Simulation::DIRTY_LINEAR_VELOCITY;
|
_flags |= Simulation::DIRTY_LINEAR_VELOCITY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1744,7 +1745,7 @@ void EntityItem::setDamping(float value) {
|
||||||
withWriteLock([&] {
|
withWriteLock([&] {
|
||||||
if (_damping != clampedDamping) {
|
if (_damping != clampedDamping) {
|
||||||
_damping = clampedDamping;
|
_damping = clampedDamping;
|
||||||
_dirtyFlags |= Simulation::DIRTY_MATERIAL;
|
_flags |= Simulation::DIRTY_MATERIAL;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1763,7 +1764,7 @@ void EntityItem::setGravity(const glm::vec3& value) {
|
||||||
} else {
|
} else {
|
||||||
_gravity = value;
|
_gravity = value;
|
||||||
}
|
}
|
||||||
_dirtyFlags |= Simulation::DIRTY_LINEAR_VELOCITY;
|
_flags |= Simulation::DIRTY_LINEAR_VELOCITY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1788,7 +1789,7 @@ void EntityItem::setAngularVelocity(const glm::vec3& value) {
|
||||||
angularVelocity = value;
|
angularVelocity = value;
|
||||||
}
|
}
|
||||||
setLocalAngularVelocity(angularVelocity);
|
setLocalAngularVelocity(angularVelocity);
|
||||||
_dirtyFlags |= Simulation::DIRTY_ANGULAR_VELOCITY;
|
_flags |= Simulation::DIRTY_ANGULAR_VELOCITY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1799,7 +1800,7 @@ void EntityItem::setAngularDamping(float value) {
|
||||||
withWriteLock([&] {
|
withWriteLock([&] {
|
||||||
if (_angularDamping != clampedDamping) {
|
if (_angularDamping != clampedDamping) {
|
||||||
_angularDamping = clampedDamping;
|
_angularDamping = clampedDamping;
|
||||||
_dirtyFlags |= Simulation::DIRTY_MATERIAL;
|
_flags |= Simulation::DIRTY_MATERIAL;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1808,7 +1809,7 @@ void EntityItem::setCollisionless(bool value) {
|
||||||
withWriteLock([&] {
|
withWriteLock([&] {
|
||||||
if (_collisionless != value) {
|
if (_collisionless != value) {
|
||||||
_collisionless = value;
|
_collisionless = value;
|
||||||
_dirtyFlags |= Simulation::DIRTY_COLLISION_GROUP;
|
_flags |= Simulation::DIRTY_COLLISION_GROUP;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1817,7 +1818,7 @@ void EntityItem::setCollisionMask(uint8_t value) {
|
||||||
withWriteLock([&] {
|
withWriteLock([&] {
|
||||||
if ((_collisionMask & ENTITY_COLLISION_MASK_DEFAULT) != (value & ENTITY_COLLISION_MASK_DEFAULT)) {
|
if ((_collisionMask & ENTITY_COLLISION_MASK_DEFAULT) != (value & ENTITY_COLLISION_MASK_DEFAULT)) {
|
||||||
_collisionMask = (value & ENTITY_COLLISION_MASK_DEFAULT);
|
_collisionMask = (value & ENTITY_COLLISION_MASK_DEFAULT);
|
||||||
_dirtyFlags |= Simulation::DIRTY_COLLISION_GROUP;
|
_flags |= Simulation::DIRTY_COLLISION_GROUP;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1829,11 +1830,11 @@ void EntityItem::setDynamic(bool value) {
|
||||||
if (value && getShapeType() == SHAPE_TYPE_STATIC_MESH) {
|
if (value && getShapeType() == SHAPE_TYPE_STATIC_MESH) {
|
||||||
if (_dynamic) {
|
if (_dynamic) {
|
||||||
_dynamic = false;
|
_dynamic = false;
|
||||||
_dirtyFlags |= Simulation::DIRTY_MOTION_TYPE;
|
_flags |= Simulation::DIRTY_MOTION_TYPE;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
_dynamic = value;
|
_dynamic = value;
|
||||||
_dirtyFlags |= Simulation::DIRTY_MOTION_TYPE;
|
_flags |= Simulation::DIRTY_MOTION_TYPE;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1844,7 +1845,7 @@ void EntityItem::setRestitution(float value) {
|
||||||
withWriteLock([&] {
|
withWriteLock([&] {
|
||||||
if (_restitution != clampedValue) {
|
if (_restitution != clampedValue) {
|
||||||
_restitution = clampedValue;
|
_restitution = clampedValue;
|
||||||
_dirtyFlags |= Simulation::DIRTY_MATERIAL;
|
_flags |= Simulation::DIRTY_MATERIAL;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1855,7 +1856,7 @@ void EntityItem::setFriction(float value) {
|
||||||
withWriteLock([&] {
|
withWriteLock([&] {
|
||||||
if (_friction != clampedValue) {
|
if (_friction != clampedValue) {
|
||||||
_friction = clampedValue;
|
_friction = clampedValue;
|
||||||
_dirtyFlags |= Simulation::DIRTY_MATERIAL;
|
_flags |= Simulation::DIRTY_MATERIAL;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1864,7 +1865,7 @@ void EntityItem::setLifetime(float value) {
|
||||||
withWriteLock([&] {
|
withWriteLock([&] {
|
||||||
if (_lifetime != value) {
|
if (_lifetime != value) {
|
||||||
_lifetime = value;
|
_lifetime = value;
|
||||||
_dirtyFlags |= Simulation::DIRTY_LIFETIME;
|
_flags |= Simulation::DIRTY_LIFETIME;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1873,7 +1874,7 @@ void EntityItem::setCreated(quint64 value) {
|
||||||
withWriteLock([&] {
|
withWriteLock([&] {
|
||||||
if (_created != value) {
|
if (_created != value) {
|
||||||
_created = value;
|
_created = value;
|
||||||
_dirtyFlags |= Simulation::DIRTY_LIFETIME;
|
_flags |= Simulation::DIRTY_LIFETIME;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1902,7 +1903,7 @@ void EntityItem::computeCollisionGroupAndFinalMask(int16_t& group, int16_t& mask
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((bool)(_dirtyFlags & Simulation::NO_BOOTSTRAPPING)) {
|
if ((bool)(_flags & Simulation::SPECIAL_FLAGS_NO_BOOTSTRAPPING)) {
|
||||||
userMask &= ~USER_COLLISION_GROUP_MY_AVATAR;
|
userMask &= ~USER_COLLISION_GROUP_MY_AVATAR;
|
||||||
}
|
}
|
||||||
mask = Physics::getDefaultCollisionMask(group) & (int16_t)(userMask);
|
mask = Physics::getDefaultCollisionMask(group) & (int16_t)(userMask);
|
||||||
|
@ -1997,17 +1998,18 @@ bool EntityItem::addActionInternal(EntitySimulationPointer simulation, EntityDyn
|
||||||
serializeActions(success, newDataCache);
|
serializeActions(success, newDataCache);
|
||||||
if (success) {
|
if (success) {
|
||||||
_allActionsDataCache = newDataCache;
|
_allActionsDataCache = newDataCache;
|
||||||
_dirtyFlags |= Simulation::DIRTY_PHYSICS_ACTIVATION;
|
_flags |= Simulation::DIRTY_PHYSICS_ACTIVATION;
|
||||||
|
|
||||||
auto actionType = action->getType();
|
auto actionType = action->getType();
|
||||||
if (actionType == DYNAMIC_TYPE_HOLD || actionType == DYNAMIC_TYPE_FAR_GRAB) {
|
if (actionType == DYNAMIC_TYPE_HOLD || actionType == DYNAMIC_TYPE_FAR_GRAB) {
|
||||||
if (!(bool)(_dirtyFlags & Simulation::NO_BOOTSTRAPPING)) {
|
if (!(bool)(_flags & Simulation::SPECIAL_FLAGS_NO_BOOTSTRAPPING)) {
|
||||||
_dirtyFlags |= Simulation::NO_BOOTSTRAPPING;
|
_flags |= Simulation::SPECIAL_FLAGS_NO_BOOTSTRAPPING;
|
||||||
_dirtyFlags |= Simulation::DIRTY_COLLISION_GROUP; // may need to not collide with own avatar
|
_flags |= Simulation::DIRTY_COLLISION_GROUP; // may need to not collide with own avatar
|
||||||
forEachDescendant([&](SpatiallyNestablePointer child) {
|
forEachDescendant([&](SpatiallyNestablePointer child) {
|
||||||
if (child->getNestableType() == NestableType::Entity) {
|
if (child->getNestableType() == NestableType::Entity) {
|
||||||
EntityItemPointer entity = std::static_pointer_cast<EntityItem>(child);
|
EntityItemPointer entity = std::static_pointer_cast<EntityItem>(child);
|
||||||
entity->markDirtyFlags(Simulation::NO_BOOTSTRAPPING | Simulation::DIRTY_COLLISION_GROUP);
|
entity->markDirtyFlags(Simulation::DIRTY_COLLISION_GROUP);
|
||||||
|
entity->markSpecialFlags(Simulation::SPECIAL_FLAGS_NO_BOOTSTRAPPING);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -2033,7 +2035,7 @@ bool EntityItem::updateAction(EntitySimulationPointer simulation, const QUuid& a
|
||||||
if (success) {
|
if (success) {
|
||||||
action->setIsMine(true);
|
action->setIsMine(true);
|
||||||
serializeActions(success, _allActionsDataCache);
|
serializeActions(success, _allActionsDataCache);
|
||||||
_dirtyFlags |= Simulation::DIRTY_PHYSICS_ACTIVATION;
|
_flags |= Simulation::DIRTY_PHYSICS_ACTIVATION;
|
||||||
} else {
|
} else {
|
||||||
qCDebug(entities) << "EntityItem::updateAction failed";
|
qCDebug(entities) << "EntityItem::updateAction failed";
|
||||||
}
|
}
|
||||||
|
@ -2091,17 +2093,17 @@ bool EntityItem::removeActionInternal(const QUuid& actionID, EntitySimulationPoi
|
||||||
_objectActions.remove(actionID);
|
_objectActions.remove(actionID);
|
||||||
|
|
||||||
if ((removedActionType == DYNAMIC_TYPE_HOLD || removedActionType == DYNAMIC_TYPE_FAR_GRAB) && !stillHasGrabActions()) {
|
if ((removedActionType == DYNAMIC_TYPE_HOLD || removedActionType == DYNAMIC_TYPE_FAR_GRAB) && !stillHasGrabActions()) {
|
||||||
_dirtyFlags &= ~Simulation::NO_BOOTSTRAPPING;
|
_flags &= ~Simulation::SPECIAL_FLAGS_NO_BOOTSTRAPPING;
|
||||||
_dirtyFlags |= Simulation::DIRTY_COLLISION_GROUP; // may need to not collide with own avatar
|
_flags |= Simulation::DIRTY_COLLISION_GROUP; // may need to not collide with own avatar
|
||||||
forEachDescendant([&](SpatiallyNestablePointer child) {
|
forEachDescendant([&](SpatiallyNestablePointer child) {
|
||||||
if (child->getNestableType() == NestableType::Entity) {
|
if (child->getNestableType() == NestableType::Entity) {
|
||||||
EntityItemPointer entity = std::static_pointer_cast<EntityItem>(child);
|
EntityItemPointer entity = std::static_pointer_cast<EntityItem>(child);
|
||||||
entity->markDirtyFlags(Simulation::DIRTY_COLLISION_GROUP);
|
entity->markDirtyFlags(Simulation::DIRTY_COLLISION_GROUP);
|
||||||
entity->clearDirtyFlags(Simulation::NO_BOOTSTRAPPING);
|
entity->clearSpecialFlags(Simulation::SPECIAL_FLAGS_NO_BOOTSTRAPPING);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// NO-OP: we assume NO_BOOTSTRAPPING bits and collision group are correct
|
// NO-OP: we assume SPECIAL_FLAGS_NO_BOOTSTRAPPING bits and collision group are correct
|
||||||
// because they should have been set correctly when the action was added
|
// because they should have been set correctly when the action was added
|
||||||
// and/or when children were linked
|
// and/or when children were linked
|
||||||
}
|
}
|
||||||
|
@ -2112,7 +2114,7 @@ bool EntityItem::removeActionInternal(const QUuid& actionID, EntitySimulationPoi
|
||||||
|
|
||||||
bool success = true;
|
bool success = true;
|
||||||
serializeActions(success, _allActionsDataCache);
|
serializeActions(success, _allActionsDataCache);
|
||||||
_dirtyFlags |= Simulation::DIRTY_PHYSICS_ACTIVATION;
|
_flags |= Simulation::DIRTY_PHYSICS_ACTIVATION;
|
||||||
setDynamicDataNeedsTransmit(true);
|
setDynamicDataNeedsTransmit(true);
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
@ -2132,8 +2134,8 @@ bool EntityItem::clearActions(EntitySimulationPointer simulation) {
|
||||||
// empty _serializedActions means no actions for the EntityItem
|
// empty _serializedActions means no actions for the EntityItem
|
||||||
_actionsToRemove.clear();
|
_actionsToRemove.clear();
|
||||||
_allActionsDataCache.clear();
|
_allActionsDataCache.clear();
|
||||||
_dirtyFlags |= Simulation::DIRTY_PHYSICS_ACTIVATION;
|
_flags |= Simulation::DIRTY_PHYSICS_ACTIVATION;
|
||||||
_dirtyFlags |= Simulation::DIRTY_COLLISION_GROUP; // may need to not collide with own avatar
|
_flags |= Simulation::DIRTY_COLLISION_GROUP; // may need to not collide with own avatar
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -2364,7 +2366,7 @@ QList<EntityDynamicPointer> EntityItem::getActionsOfType(EntityDynamicType typeT
|
||||||
void EntityItem::locationChanged(bool tellPhysics) {
|
void EntityItem::locationChanged(bool tellPhysics) {
|
||||||
requiresRecalcBoxes();
|
requiresRecalcBoxes();
|
||||||
if (tellPhysics) {
|
if (tellPhysics) {
|
||||||
_dirtyFlags |= Simulation::DIRTY_TRANSFORM;
|
_flags |= Simulation::DIRTY_TRANSFORM;
|
||||||
EntityTreePointer tree = getTree();
|
EntityTreePointer tree = getTree();
|
||||||
if (tree) {
|
if (tree) {
|
||||||
tree->entityChanged(getThisPointer());
|
tree->entityChanged(getThisPointer());
|
||||||
|
@ -2832,7 +2834,7 @@ DEFINE_PROPERTY_ACCESSOR(quint32, StaticCertificateVersion, staticCertificateVer
|
||||||
uint32_t EntityItem::getDirtyFlags() const {
|
uint32_t EntityItem::getDirtyFlags() const {
|
||||||
uint32_t result;
|
uint32_t result;
|
||||||
withReadLock([&] {
|
withReadLock([&] {
|
||||||
result = _dirtyFlags;
|
result = _flags & Simulation::DIRTY_FLAGS;
|
||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -2840,13 +2842,37 @@ uint32_t EntityItem::getDirtyFlags() const {
|
||||||
|
|
||||||
void EntityItem::markDirtyFlags(uint32_t mask) {
|
void EntityItem::markDirtyFlags(uint32_t mask) {
|
||||||
withWriteLock([&] {
|
withWriteLock([&] {
|
||||||
_dirtyFlags |= mask;
|
mask &= Simulation::DIRTY_FLAGS;
|
||||||
|
_flags |= mask;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityItem::clearDirtyFlags(uint32_t mask) {
|
void EntityItem::clearDirtyFlags(uint32_t mask) {
|
||||||
withWriteLock([&] {
|
withWriteLock([&] {
|
||||||
_dirtyFlags &= ~mask;
|
mask &= Simulation::DIRTY_FLAGS;
|
||||||
|
_flags &= ~mask;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t EntityItem::getSpecialFlags() const {
|
||||||
|
uint32_t result;
|
||||||
|
withReadLock([&] {
|
||||||
|
result = _flags & Simulation::SPECIAL_FLAGS;
|
||||||
|
});
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
void EntityItem::markSpecialFlags(uint32_t mask) {
|
||||||
|
withWriteLock([&] {
|
||||||
|
mask &= Simulation::SPECIAL_FLAGS;
|
||||||
|
_flags |= mask;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void EntityItem::clearSpecialFlags(uint32_t mask) {
|
||||||
|
withWriteLock([&] {
|
||||||
|
mask &= Simulation::SPECIAL_FLAGS;
|
||||||
|
_flags &= ~mask;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -358,7 +358,11 @@ public:
|
||||||
|
|
||||||
uint32_t getDirtyFlags() const;
|
uint32_t getDirtyFlags() const;
|
||||||
void markDirtyFlags(uint32_t mask);
|
void markDirtyFlags(uint32_t mask);
|
||||||
void clearDirtyFlags(uint32_t mask = 0xffffffff);
|
void clearDirtyFlags(uint32_t mask = 0x0000ffff);
|
||||||
|
|
||||||
|
uint32_t getSpecialFlags() const;
|
||||||
|
void markSpecialFlags(uint32_t mask);
|
||||||
|
void clearSpecialFlags(uint32_t mask = 0xffff0000);
|
||||||
|
|
||||||
bool isMoving() const;
|
bool isMoving() const;
|
||||||
bool isMovingRelativeToParent() const;
|
bool isMovingRelativeToParent() const;
|
||||||
|
@ -385,7 +389,7 @@ public:
|
||||||
void getAllTerseUpdateProperties(EntityItemProperties& properties) const;
|
void getAllTerseUpdateProperties(EntityItemProperties& properties) const;
|
||||||
|
|
||||||
void flagForOwnershipBid(uint8_t priority);
|
void flagForOwnershipBid(uint8_t priority);
|
||||||
void flagForMotionStateChange() { _dirtyFlags |= Simulation::DIRTY_MOTION_TYPE; }
|
void flagForMotionStateChange() { _flags |= Simulation::DIRTY_MOTION_TYPE; }
|
||||||
|
|
||||||
QString actionsToDebugString();
|
QString actionsToDebugString();
|
||||||
bool addAction(EntitySimulationPointer simulation, EntityDynamicPointer action);
|
bool addAction(EntitySimulationPointer simulation, EntityDynamicPointer action);
|
||||||
|
@ -575,7 +579,7 @@ protected:
|
||||||
//
|
//
|
||||||
|
|
||||||
// DirtyFlags are set whenever a property changes that the EntitySimulation needs to know about.
|
// DirtyFlags are set whenever a property changes that the EntitySimulation needs to know about.
|
||||||
uint32_t _dirtyFlags { 0 }; // things that have changed from EXTERNAL changes (via script or packet) but NOT from simulation
|
uint32_t _flags { 0 }; // things that have changed from EXTERNAL changes (via script or packet) but NOT from simulation
|
||||||
|
|
||||||
// these backpointers are only ever set/cleared by friends:
|
// these backpointers are only ever set/cleared by friends:
|
||||||
EntityTreeElementPointer _element; // set by EntityTreeElement
|
EntityTreeElementPointer _element; // set by EntityTreeElement
|
||||||
|
|
|
@ -85,7 +85,7 @@ bool ModelEntityItem::setProperties(const EntityItemProperties& properties) {
|
||||||
bool somethingChangedInAnimations = _animationProperties.setProperties(properties);
|
bool somethingChangedInAnimations = _animationProperties.setProperties(properties);
|
||||||
|
|
||||||
if (somethingChangedInAnimations) {
|
if (somethingChangedInAnimations) {
|
||||||
_dirtyFlags |= Simulation::DIRTY_UPDATEABLE;
|
_flags |= Simulation::DIRTY_UPDATEABLE;
|
||||||
}
|
}
|
||||||
somethingChanged = somethingChanged || somethingChangedInAnimations;
|
somethingChanged = somethingChanged || somethingChangedInAnimations;
|
||||||
|
|
||||||
|
@ -132,7 +132,7 @@ int ModelEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data,
|
||||||
READ_ENTITY_PROPERTY(PROP_SHAPE_TYPE, ShapeType, setShapeType);
|
READ_ENTITY_PROPERTY(PROP_SHAPE_TYPE, ShapeType, setShapeType);
|
||||||
|
|
||||||
if (animationPropertiesChanged) {
|
if (animationPropertiesChanged) {
|
||||||
_dirtyFlags |= Simulation::DIRTY_UPDATEABLE;
|
_flags |= Simulation::DIRTY_UPDATEABLE;
|
||||||
somethingChanged = true;
|
somethingChanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -305,10 +305,10 @@ void ModelEntityItem::setShapeType(ShapeType type) {
|
||||||
// dynamic and STATIC_MESH are incompatible
|
// dynamic and STATIC_MESH are incompatible
|
||||||
// since the shape is being set here we clear the dynamic bit
|
// since the shape is being set here we clear the dynamic bit
|
||||||
_dynamic = false;
|
_dynamic = false;
|
||||||
_dirtyFlags |= Simulation::DIRTY_MOTION_TYPE;
|
_flags |= Simulation::DIRTY_MOTION_TYPE;
|
||||||
}
|
}
|
||||||
_shapeType = type;
|
_shapeType = type;
|
||||||
_dirtyFlags |= Simulation::DIRTY_SHAPE | Simulation::DIRTY_MASS;
|
_flags |= Simulation::DIRTY_SHAPE | Simulation::DIRTY_MASS;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -336,7 +336,7 @@ void ModelEntityItem::setModelURL(const QString& url) {
|
||||||
if (_modelURL != url) {
|
if (_modelURL != url) {
|
||||||
_modelURL = url;
|
_modelURL = url;
|
||||||
if (_shapeType == SHAPE_TYPE_STATIC_MESH) {
|
if (_shapeType == SHAPE_TYPE_STATIC_MESH) {
|
||||||
_dirtyFlags |= Simulation::DIRTY_SHAPE | Simulation::DIRTY_MASS;
|
_flags |= Simulation::DIRTY_SHAPE | Simulation::DIRTY_MASS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -348,14 +348,14 @@ void ModelEntityItem::setCompoundShapeURL(const QString& url) {
|
||||||
ShapeType oldType = computeTrueShapeType();
|
ShapeType oldType = computeTrueShapeType();
|
||||||
_compoundShapeURL.set(url);
|
_compoundShapeURL.set(url);
|
||||||
if (oldType != computeTrueShapeType()) {
|
if (oldType != computeTrueShapeType()) {
|
||||||
_dirtyFlags |= Simulation::DIRTY_SHAPE | Simulation::DIRTY_MASS;
|
_flags |= Simulation::DIRTY_SHAPE | Simulation::DIRTY_MASS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModelEntityItem::setAnimationURL(const QString& url) {
|
void ModelEntityItem::setAnimationURL(const QString& url) {
|
||||||
_dirtyFlags |= Simulation::DIRTY_UPDATEABLE;
|
_flags |= Simulation::DIRTY_UPDATEABLE;
|
||||||
withWriteLock([&] {
|
withWriteLock([&] {
|
||||||
_animationProperties.setURL(url);
|
_animationProperties.setURL(url);
|
||||||
});
|
});
|
||||||
|
@ -422,16 +422,16 @@ void ModelEntityItem::setAnimationSettings(const QString& value) {
|
||||||
bool allowTranslation = settingsMap["allowTranslation"].toBool();
|
bool allowTranslation = settingsMap["allowTranslation"].toBool();
|
||||||
setAnimationAllowTranslation(allowTranslation);
|
setAnimationAllowTranslation(allowTranslation);
|
||||||
}
|
}
|
||||||
_dirtyFlags |= Simulation::DIRTY_UPDATEABLE;
|
_flags |= Simulation::DIRTY_UPDATEABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModelEntityItem::setAnimationIsPlaying(bool value) {
|
void ModelEntityItem::setAnimationIsPlaying(bool value) {
|
||||||
_dirtyFlags |= Simulation::DIRTY_UPDATEABLE;
|
_flags |= Simulation::DIRTY_UPDATEABLE;
|
||||||
_animationProperties.setRunning(value);
|
_animationProperties.setRunning(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModelEntityItem::setAnimationFPS(float value) {
|
void ModelEntityItem::setAnimationFPS(float value) {
|
||||||
_dirtyFlags |= Simulation::DIRTY_UPDATEABLE;
|
_flags |= Simulation::DIRTY_UPDATEABLE;
|
||||||
_animationProperties.setFPS(value);
|
_animationProperties.setFPS(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -601,7 +601,7 @@ void ParticleEffectEntityItem::setShapeType(ShapeType type) {
|
||||||
withWriteLock([&] {
|
withWriteLock([&] {
|
||||||
if (type != _shapeType) {
|
if (type != _shapeType) {
|
||||||
_shapeType = type;
|
_shapeType = type;
|
||||||
_dirtyFlags |= Simulation::DIRTY_SHAPE | Simulation::DIRTY_MASS;
|
_flags |= Simulation::DIRTY_SHAPE | Simulation::DIRTY_MASS;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,10 +27,28 @@ namespace Simulation {
|
||||||
const uint32_t DIRTY_PHYSICS_ACTIVATION = 0x0800; // should activate object in physics engine
|
const uint32_t DIRTY_PHYSICS_ACTIVATION = 0x0800; // should activate object in physics engine
|
||||||
const uint32_t DIRTY_SIMULATOR_ID = 0x1000; // the simulatorID has changed
|
const uint32_t DIRTY_SIMULATOR_ID = 0x1000; // the simulatorID has changed
|
||||||
const uint32_t DIRTY_SIMULATION_OWNERSHIP_PRIORITY = 0x2000; // our own bid priority has changed
|
const uint32_t DIRTY_SIMULATION_OWNERSHIP_PRIORITY = 0x2000; // our own bid priority has changed
|
||||||
const uint32_t NO_BOOTSTRAPPING = 0x4000;
|
|
||||||
|
// bits 17-32 are reservied for special flags
|
||||||
|
const uint32_t SPECIAL_FLAGS_NO_BOOTSTRAPPING = 0x10000;
|
||||||
|
|
||||||
const uint32_t DIRTY_TRANSFORM = DIRTY_POSITION | DIRTY_ROTATION;
|
const uint32_t DIRTY_TRANSFORM = DIRTY_POSITION | DIRTY_ROTATION;
|
||||||
const uint32_t DIRTY_VELOCITIES = DIRTY_LINEAR_VELOCITY | DIRTY_ANGULAR_VELOCITY;
|
const uint32_t DIRTY_VELOCITIES = DIRTY_LINEAR_VELOCITY | DIRTY_ANGULAR_VELOCITY;
|
||||||
|
const uint32_t SPECIAL_FLAGS = SPECIAL_FLAGS_NO_BOOTSTRAPPING;
|
||||||
|
|
||||||
|
const uint32_t DIRTY_FLAGS = DIRTY_POSITION |
|
||||||
|
DIRTY_ROTATION |
|
||||||
|
DIRTY_LINEAR_VELOCITY |
|
||||||
|
DIRTY_ANGULAR_VELOCITY |
|
||||||
|
DIRTY_MASS |
|
||||||
|
DIRTY_COLLISION_GROUP |
|
||||||
|
DIRTY_MOTION_TYPE |
|
||||||
|
DIRTY_SHAPE |
|
||||||
|
DIRTY_LIFETIME |
|
||||||
|
DIRTY_UPDATEABLE |
|
||||||
|
DIRTY_MATERIAL |
|
||||||
|
DIRTY_PHYSICS_ACTIVATION |
|
||||||
|
DIRTY_SIMULATOR_ID |
|
||||||
|
DIRTY_SIMULATION_OWNERSHIP_PRIORITY;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_SimulationFlags_h
|
#endif // hifi_SimulationFlags_h
|
||||||
|
|
Loading…
Reference in a new issue