From fe8fe816f4aa0b83e76d4f967e58fcb16798e83b Mon Sep 17 00:00:00 2001 From: howard-stearns Date: Mon, 30 Jan 2017 16:14:40 -0800 Subject: [PATCH 01/28] accept forced physics results from entity server (e.g., when filtered) --- libraries/entities/src/EntityItem.cpp | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/libraries/entities/src/EntityItem.cpp b/libraries/entities/src/EntityItem.cpp index 64bc9fbd5a..cd5558823f 100644 --- a/libraries/entities/src/EntityItem.cpp +++ b/libraries/entities/src/EntityItem.cpp @@ -651,6 +651,7 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef // NOTE: the server is authoritative for changes to simOwnerID so we always unpack ownership data // even when we would otherwise ignore the rest of the packet. + bool filterRejection = false; if (propertyFlags.getHasProperty(PROP_SIMULATION_OWNER)) { QByteArray simOwnerData; @@ -663,6 +664,7 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef if (wantTerseEditLogging() && _simulationOwner != newSimOwner) { qCDebug(entities) << "sim ownership for" << getDebugName() << "is now" << newSimOwner; } + filterRejection = newSimOwner.getID().isNull(); if (weOwnSimulation) { if (newSimOwner.getID().isNull() && !_simulationOwner.pendingRelease(lastEditedFromBufferAdjusted)) { // entity-server is trying to clear our ownership (probably at our own request) @@ -708,10 +710,10 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef // Note: duplicate packets are expected and not wrong. They may be sent for any number of // reasons and the contract is that the client handles them in an idempotent manner. auto lastEdited = lastEditedFromBufferAdjusted; - auto customUpdatePositionFromNetwork = [this, lastEdited, overwriteLocalData, weOwnSimulation](glm::vec3 value){ + auto customUpdatePositionFromNetwork = [this, lastEdited, overwriteLocalData, weOwnSimulation, filterRejection](glm::vec3 value){ bool simulationChanged = lastEdited > _lastUpdatedPositionTimestamp; bool valueChanged = value != _lastUpdatedPositionValue; - bool shouldUpdate = overwriteLocalData && !weOwnSimulation && simulationChanged && valueChanged; + bool shouldUpdate = overwriteLocalData && !weOwnSimulation && simulationChanged && (valueChanged || filterRejection); if (shouldUpdate) { updatePositionFromNetwork(value); _lastUpdatedPositionTimestamp = lastEdited; @@ -719,10 +721,10 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef } }; - auto customUpdateRotationFromNetwork = [this, lastEdited, overwriteLocalData, weOwnSimulation](glm::quat value){ + auto customUpdateRotationFromNetwork = [this, lastEdited, overwriteLocalData, weOwnSimulation, filterRejection](glm::quat value){ bool simulationChanged = lastEdited > _lastUpdatedRotationTimestamp; bool valueChanged = value != _lastUpdatedRotationValue; - bool shouldUpdate = overwriteLocalData && !weOwnSimulation && simulationChanged && valueChanged; + bool shouldUpdate = overwriteLocalData && !weOwnSimulation && simulationChanged && (valueChanged || filterRejection); if (shouldUpdate) { updateRotationFromNetwork(value); _lastUpdatedRotationTimestamp = lastEdited; @@ -730,10 +732,10 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef } }; - auto customUpdateVelocityFromNetwork = [this, lastEdited, overwriteLocalData, weOwnSimulation](glm::vec3 value){ + auto customUpdateVelocityFromNetwork = [this, lastEdited, overwriteLocalData, weOwnSimulation, filterRejection](glm::vec3 value){ bool simulationChanged = lastEdited > _lastUpdatedVelocityTimestamp; bool valueChanged = value != _lastUpdatedVelocityValue; - bool shouldUpdate = overwriteLocalData && !weOwnSimulation && simulationChanged && valueChanged; + bool shouldUpdate = overwriteLocalData && !weOwnSimulation && simulationChanged && (valueChanged || filterRejection); if (shouldUpdate) { updateVelocityFromNetwork(value); _lastUpdatedVelocityTimestamp = lastEdited; @@ -741,10 +743,10 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef } }; - auto customUpdateAngularVelocityFromNetwork = [this, lastEdited, overwriteLocalData, weOwnSimulation](glm::vec3 value){ + auto customUpdateAngularVelocityFromNetwork = [this, lastEdited, overwriteLocalData, weOwnSimulation, filterRejection](glm::vec3 value){ bool simulationChanged = lastEdited > _lastUpdatedAngularVelocityTimestamp; bool valueChanged = value != _lastUpdatedAngularVelocityValue; - bool shouldUpdate = overwriteLocalData && !weOwnSimulation && simulationChanged && valueChanged; + bool shouldUpdate = overwriteLocalData && !weOwnSimulation && simulationChanged && (valueChanged || filterRejection); if (shouldUpdate) { updateAngularVelocityFromNetwork(value); _lastUpdatedAngularVelocityTimestamp = lastEdited; @@ -752,10 +754,10 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef } }; - auto customSetAcceleration = [this, lastEdited, overwriteLocalData, weOwnSimulation](glm::vec3 value){ + auto customSetAcceleration = [this, lastEdited, overwriteLocalData, weOwnSimulation, filterRejection](glm::vec3 value){ bool simulationChanged = lastEdited > _lastUpdatedAccelerationTimestamp; bool valueChanged = value != _lastUpdatedAccelerationValue; - bool shouldUpdate = overwriteLocalData && !weOwnSimulation && simulationChanged && valueChanged; + bool shouldUpdate = overwriteLocalData && !weOwnSimulation && simulationChanged && (valueChanged || filterRejection); if (shouldUpdate) { setAcceleration(value); _lastUpdatedAccelerationTimestamp = lastEdited; From 0b139c906ca27ff81434152c1d5b8225ebdabde5 Mon Sep 17 00:00:00 2001 From: samcake Date: Tue, 31 Jan 2017 10:56:30 -0800 Subject: [PATCH 02/28] Assigniing default textures that make sense --- libraries/render-utils/src/MeshPartPayload.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libraries/render-utils/src/MeshPartPayload.cpp b/libraries/render-utils/src/MeshPartPayload.cpp index 5e47ed8b0f..1bce710d3a 100644 --- a/libraries/render-utils/src/MeshPartPayload.cpp +++ b/libraries/render-utils/src/MeshPartPayload.cpp @@ -150,11 +150,11 @@ void MeshPartPayload::bindMaterial(gpu::Batch& batch, const ShapePipeline::Locat if (!enableTextures) { batch.setResourceTexture(ShapePipeline::Slot::ALBEDO, textureCache->getWhiteTexture()); batch.setResourceTexture(ShapePipeline::Slot::MAP::ROUGHNESS, textureCache->getWhiteTexture()); - batch.setResourceTexture(ShapePipeline::Slot::MAP::NORMAL, nullptr); - batch.setResourceTexture(ShapePipeline::Slot::MAP::METALLIC, nullptr); - batch.setResourceTexture(ShapePipeline::Slot::MAP::OCCLUSION, nullptr); - batch.setResourceTexture(ShapePipeline::Slot::MAP::SCATTERING, nullptr); - batch.setResourceTexture(ShapePipeline::Slot::MAP::EMISSIVE_LIGHTMAP, nullptr); + batch.setResourceTexture(ShapePipeline::Slot::MAP::NORMAL, textureCache->getBlueTexture()); + batch.setResourceTexture(ShapePipeline::Slot::MAP::METALLIC, textureCache->getBlackTexture()); + batch.setResourceTexture(ShapePipeline::Slot::MAP::OCCLUSION, textureCache->getWhiteTexture()); + batch.setResourceTexture(ShapePipeline::Slot::MAP::SCATTERING, textureCache->getWhiteTexture()); + batch.setResourceTexture(ShapePipeline::Slot::MAP::EMISSIVE_LIGHTMAP, textureCache->getBlackTexture()); return; } From 8d8b338c66b0634befe5a03c3d8c5e80474fcafb Mon Sep 17 00:00:00 2001 From: howard-stearns Date: Tue, 31 Jan 2017 12:07:48 -0800 Subject: [PATCH 03/28] dry up custom setters, per code review --- libraries/entities/src/EntityItem.cpp | 40 ++++++++++----------------- 1 file changed, 15 insertions(+), 25 deletions(-) diff --git a/libraries/entities/src/EntityItem.cpp b/libraries/entities/src/EntityItem.cpp index f5d883eb92..a73420c587 100644 --- a/libraries/entities/src/EntityItem.cpp +++ b/libraries/entities/src/EntityItem.cpp @@ -710,55 +710,45 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef // Note: duplicate packets are expected and not wrong. They may be sent for any number of // reasons and the contract is that the client handles them in an idempotent manner. auto lastEdited = lastEditedFromBufferAdjusted; - auto customUpdatePositionFromNetwork = [this, lastEdited, overwriteLocalData, weOwnSimulation, filterRejection](glm::vec3 value){ - bool simulationChanged = lastEdited > _lastUpdatedPositionTimestamp; - bool valueChanged = value != _lastUpdatedPositionValue; - bool shouldUpdate = overwriteLocalData && !weOwnSimulation && simulationChanged && (valueChanged || filterRejection); - if (shouldUpdate) { + bool otherOverwrites = overwriteLocalData && !weOwnSimulation; + auto shouldUpdate = [lastEdited, otherOverwrites, filterRejection](quint64 updatedTimestamp, bool valueChanged) { + bool simulationChanged = lastEdited > updatedTimestamp; + return otherOverwrites && simulationChanged && (valueChanged || filterRejection); + }; + auto customUpdatePositionFromNetwork = [this, shouldUpdate, lastEdited](glm::vec3 value){ + if (shouldUpdate(_lastUpdatedPositionTimestamp, value != _lastUpdatedPositionValue)) { updatePositionFromNetwork(value); _lastUpdatedPositionTimestamp = lastEdited; _lastUpdatedPositionValue = value; } }; - auto customUpdateRotationFromNetwork = [this, lastEdited, overwriteLocalData, weOwnSimulation, filterRejection](glm::quat value){ - bool simulationChanged = lastEdited > _lastUpdatedRotationTimestamp; - bool valueChanged = value != _lastUpdatedRotationValue; - bool shouldUpdate = overwriteLocalData && !weOwnSimulation && simulationChanged && (valueChanged || filterRejection); - if (shouldUpdate) { + auto customUpdateRotationFromNetwork = [this, shouldUpdate, lastEdited](glm::quat value){ + if (shouldUpdate(_lastUpdatedRotationTimestamp, value != _lastUpdatedRotationValue)) { updateRotationFromNetwork(value); _lastUpdatedRotationTimestamp = lastEdited; _lastUpdatedRotationValue = value; } }; - auto customUpdateVelocityFromNetwork = [this, lastEdited, overwriteLocalData, weOwnSimulation, filterRejection](glm::vec3 value){ - bool simulationChanged = lastEdited > _lastUpdatedVelocityTimestamp; - bool valueChanged = value != _lastUpdatedVelocityValue; - bool shouldUpdate = overwriteLocalData && !weOwnSimulation && simulationChanged && (valueChanged || filterRejection); - if (shouldUpdate) { + auto customUpdateVelocityFromNetwork = [this, shouldUpdate, lastEdited](glm::vec3 value){ + if (shouldUpdate(_lastUpdatedVelocityTimestamp, value != _lastUpdatedVelocityValue)) { updateVelocityFromNetwork(value); _lastUpdatedVelocityTimestamp = lastEdited; _lastUpdatedVelocityValue = value; } }; - auto customUpdateAngularVelocityFromNetwork = [this, lastEdited, overwriteLocalData, weOwnSimulation, filterRejection](glm::vec3 value){ - bool simulationChanged = lastEdited > _lastUpdatedAngularVelocityTimestamp; - bool valueChanged = value != _lastUpdatedAngularVelocityValue; - bool shouldUpdate = overwriteLocalData && !weOwnSimulation && simulationChanged && (valueChanged || filterRejection); - if (shouldUpdate) { + auto customUpdateAngularVelocityFromNetwork = [this, shouldUpdate, lastEdited](glm::vec3 value){ + if (shouldUpdate(_lastUpdatedAngularVelocityTimestamp, value != _lastUpdatedAngularVelocityValue)) { updateAngularVelocityFromNetwork(value); _lastUpdatedAngularVelocityTimestamp = lastEdited; _lastUpdatedAngularVelocityValue = value; } }; - auto customSetAcceleration = [this, lastEdited, overwriteLocalData, weOwnSimulation, filterRejection](glm::vec3 value){ - bool simulationChanged = lastEdited > _lastUpdatedAccelerationTimestamp; - bool valueChanged = value != _lastUpdatedAccelerationValue; - bool shouldUpdate = overwriteLocalData && !weOwnSimulation && simulationChanged && (valueChanged || filterRejection); - if (shouldUpdate) { + auto customSetAcceleration = [this, shouldUpdate, lastEdited](glm::vec3 value){ + if (shouldUpdate(_lastUpdatedAccelerationTimestamp, value != _lastUpdatedAccelerationValue)) { setAcceleration(value); _lastUpdatedAccelerationTimestamp = lastEdited; _lastUpdatedAccelerationValue = value; From 18f8c2b866e3aaa4d640cd450f7ac67967d2d7f8 Mon Sep 17 00:00:00 2001 From: howard-stearns Date: Tue, 31 Jan 2017 13:31:33 -0800 Subject: [PATCH 04/28] comment --- libraries/entities/src/EntityItem.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libraries/entities/src/EntityItem.cpp b/libraries/entities/src/EntityItem.cpp index a73420c587..7f3c273772 100644 --- a/libraries/entities/src/EntityItem.cpp +++ b/libraries/entities/src/EntityItem.cpp @@ -664,6 +664,9 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef if (wantTerseEditLogging() && _simulationOwner != newSimOwner) { qCDebug(entities) << "sim ownership for" << getDebugName() << "is now" << newSimOwner; } + // This is used in the custom physics setters, below. When an entity-server filter alters + // or rejects a set of properties, it clears this. In such cases, we don't want those custom + // setters to ignore what the server says. filterRejection = newSimOwner.getID().isNull(); if (weOwnSimulation) { if (newSimOwner.getID().isNull() && !_simulationOwner.pendingRelease(lastEditedFromBufferAdjusted)) { From 06d797bb3b04217452cf13d8ed12b9544a0a527c Mon Sep 17 00:00:00 2001 From: Faye Li Date: Tue, 31 Jan 2017 14:27:17 -0800 Subject: [PATCH 05/28] load bootstrao --- scripts/system/html/users.html | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/scripts/system/html/users.html b/scripts/system/html/users.html index 23de9cf0b0..dd52af0620 100644 --- a/scripts/system/html/users.html +++ b/scripts/system/html/users.html @@ -13,6 +13,7 @@ +
-
+
Users Online
- +
  • Everyone (0)
  • Friends (0)
  • @@ -157,6 +203,26 @@
+ + + +