cleanups + call updateQueryAACube when parent changes or action is deleted

This commit is contained in:
Seth Alves 2017-10-13 15:40:08 -07:00
parent c1e8d5144c
commit e8ca455547
2 changed files with 7 additions and 30 deletions

View file

@ -739,7 +739,7 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef
// reasons and the contract is that the client handles them in an idempotent manner. // reasons and the contract is that the client handles them in an idempotent manner.
auto customUpdatePositionFromNetwork = [this, shouldUpdate, lastEdited](glm::vec3 value){ auto customUpdatePositionFromNetwork = [this, shouldUpdate, lastEdited](glm::vec3 value){
if (shouldUpdate(_lastUpdatedPositionTimestamp, value != _lastUpdatedPositionValue)) { if (shouldUpdate(_lastUpdatedPositionTimestamp, value != _lastUpdatedPositionValue)) {
updatePositionFromNetwork(value); updatePosition(value);
_lastUpdatedPositionTimestamp = lastEdited; _lastUpdatedPositionTimestamp = lastEdited;
_lastUpdatedPositionValue = value; _lastUpdatedPositionValue = value;
} }
@ -747,7 +747,7 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef
auto customUpdateRotationFromNetwork = [this, shouldUpdate, lastEdited](glm::quat value){ auto customUpdateRotationFromNetwork = [this, shouldUpdate, lastEdited](glm::quat value){
if (shouldUpdate(_lastUpdatedRotationTimestamp, value != _lastUpdatedRotationValue)) { if (shouldUpdate(_lastUpdatedRotationTimestamp, value != _lastUpdatedRotationValue)) {
updateRotationFromNetwork(value); updateRotation(value);
_lastUpdatedRotationTimestamp = lastEdited; _lastUpdatedRotationTimestamp = lastEdited;
_lastUpdatedRotationValue = value; _lastUpdatedRotationValue = value;
} }
@ -755,7 +755,7 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef
auto customUpdateVelocityFromNetwork = [this, shouldUpdate, lastEdited](glm::vec3 value){ auto customUpdateVelocityFromNetwork = [this, shouldUpdate, lastEdited](glm::vec3 value){
if (shouldUpdate(_lastUpdatedVelocityTimestamp, value != _lastUpdatedVelocityValue)) { if (shouldUpdate(_lastUpdatedVelocityTimestamp, value != _lastUpdatedVelocityValue)) {
updateVelocityFromNetwork(value); updateVelocity(value);
_lastUpdatedVelocityTimestamp = lastEdited; _lastUpdatedVelocityTimestamp = lastEdited;
_lastUpdatedVelocityValue = value; _lastUpdatedVelocityValue = value;
} }
@ -763,7 +763,7 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef
auto customUpdateAngularVelocityFromNetwork = [this, shouldUpdate, lastEdited](glm::vec3 value){ auto customUpdateAngularVelocityFromNetwork = [this, shouldUpdate, lastEdited](glm::vec3 value){
if (shouldUpdate(_lastUpdatedAngularVelocityTimestamp, value != _lastUpdatedAngularVelocityValue)) { if (shouldUpdate(_lastUpdatedAngularVelocityTimestamp, value != _lastUpdatedAngularVelocityValue)) {
updateAngularVelocityFromNetwork(value); updateAngularVelocity(value);
_lastUpdatedAngularVelocityTimestamp = lastEdited; _lastUpdatedAngularVelocityTimestamp = lastEdited;
_lastUpdatedAngularVelocityValue = value; _lastUpdatedAngularVelocityValue = value;
} }
@ -850,7 +850,7 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef
{ {
auto customUpdateQueryAACubeFromNetwork = [this, shouldUpdate, lastEdited](AACube value){ auto customUpdateQueryAACubeFromNetwork = [this, shouldUpdate, lastEdited](AACube value){
if (shouldUpdate(_lastUpdatedQueryAACubeTimestamp, value != _lastUpdatedQueryAACubeValue)) { if (shouldUpdate(_lastUpdatedQueryAACubeTimestamp, value != _lastUpdatedQueryAACubeValue)) {
updateQueryAACubeFromNetwork(value); setQueryAACube(value);
_lastUpdatedQueryAACubeTimestamp = lastEdited; _lastUpdatedQueryAACubeTimestamp = lastEdited;
_lastUpdatedQueryAACubeValue = value; _lastUpdatedQueryAACubeValue = value;
} }
@ -1763,13 +1763,10 @@ void EntityItem::updateParentID(const QUuid& value) {
if (tree) { if (tree) {
tree->addToNeedsParentFixupList(getThisPointer()); tree->addToNeedsParentFixupList(getThisPointer());
} }
updateQueryAACube();
} }
} }
void EntityItem::updatePositionFromNetwork(const glm::vec3& value) {
updatePosition(value);
}
void EntityItem::updateDimensions(const glm::vec3& value) { void EntityItem::updateDimensions(const glm::vec3& value) {
if (getDimensions() != value) { if (getDimensions() != value) {
setDimensions(value); setDimensions(value);
@ -1792,10 +1789,6 @@ void EntityItem::updateRotation(const glm::quat& rotation) {
} }
} }
void EntityItem::updateRotationFromNetwork(const glm::quat& rotation) {
updateRotation(rotation);
}
void EntityItem::updateMass(float mass) { void EntityItem::updateMass(float mass) {
// Setting the mass actually changes the _density (at fixed volume), however // Setting the mass actually changes the _density (at fixed volume), however
// we must protect the density range to help maintain stability of physics simulation // we must protect the density range to help maintain stability of physics simulation
@ -1846,14 +1839,6 @@ void EntityItem::updateVelocity(const glm::vec3& value) {
} }
} }
void EntityItem::updateVelocityFromNetwork(const glm::vec3& value) {
updateVelocity(value);
}
void EntityItem::updateQueryAACubeFromNetwork(const AACube& value) {
setQueryAACube(value);
}
void EntityItem::updateDamping(float value) { void EntityItem::updateDamping(float value) {
auto clampedDamping = glm::clamp(value, 0.0f, 1.0f); auto clampedDamping = glm::clamp(value, 0.0f, 1.0f);
if (_damping != clampedDamping) { if (_damping != clampedDamping) {
@ -1905,10 +1890,6 @@ void EntityItem::updateAngularVelocity(const glm::vec3& value) {
} }
} }
void EntityItem::updateAngularVelocityFromNetwork(const glm::vec3& value) {
updateAngularVelocity(value);
}
void EntityItem::updateAngularDamping(float value) { void EntityItem::updateAngularDamping(float value) {
auto clampedDamping = glm::clamp(value, 0.0f, 1.0f); auto clampedDamping = glm::clamp(value, 0.0f, 1.0f);
if (_angularDamping != clampedDamping) { if (_angularDamping != clampedDamping) {
@ -2213,6 +2194,7 @@ bool EntityItem::removeActionInternal(const QUuid& actionID, EntitySimulationPoi
_dirtyFlags |= Simulation::DIRTY_PHYSICS_ACTIVATION; _dirtyFlags |= Simulation::DIRTY_PHYSICS_ACTIVATION;
_dirtyFlags |= Simulation::DIRTY_COLLISION_GROUP; // may need to not collide with own avatar _dirtyFlags |= Simulation::DIRTY_COLLISION_GROUP; // may need to not collide with own avatar
setDynamicDataNeedsTransmit(true); setDynamicDataNeedsTransmit(true);
updateQueryAACube();
return success; return success;
} }
return false; return false;

View file

@ -357,21 +357,16 @@ public:
virtual void updateRegistrationPoint(const glm::vec3& value); virtual void updateRegistrationPoint(const glm::vec3& value);
void updatePosition(const glm::vec3& value); void updatePosition(const glm::vec3& value);
void updateParentID(const QUuid& value); void updateParentID(const QUuid& value);
void updatePositionFromNetwork(const glm::vec3& value);
void updateDimensions(const glm::vec3& value); void updateDimensions(const glm::vec3& value);
void updateRotation(const glm::quat& rotation); void updateRotation(const glm::quat& rotation);
void updateRotationFromNetwork(const glm::quat& rotation);
void updateDensity(float value); void updateDensity(float value);
void updateMass(float value); void updateMass(float value);
void updateVelocity(const glm::vec3& value); void updateVelocity(const glm::vec3& value);
void updateVelocityFromNetwork(const glm::vec3& value);
void updateQueryAACubeFromNetwork(const AACube& value);
void updateDamping(float value); void updateDamping(float value);
void updateRestitution(float value); void updateRestitution(float value);
void updateFriction(float value); void updateFriction(float value);
void updateGravity(const glm::vec3& value); void updateGravity(const glm::vec3& value);
void updateAngularVelocity(const glm::vec3& value); void updateAngularVelocity(const glm::vec3& value);
void updateAngularVelocityFromNetwork(const glm::vec3& value);
void updateAngularDamping(float value); void updateAngularDamping(float value);
void updateCollisionless(bool value); void updateCollisionless(bool value);
void updateCollisionMask(uint8_t value); void updateCollisionMask(uint8_t value);