From 52397bf87af1ca5d2431f108cf55dfadb207a5fe Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Fri, 8 May 2015 15:59:39 +0200 Subject: [PATCH 1/8] Fix wireframe render for meshes with special properties --- libraries/render-utils/src/Model.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libraries/render-utils/src/Model.cpp b/libraries/render-utils/src/Model.cpp index eb010f874d..db95005a09 100644 --- a/libraries/render-utils/src/Model.cpp +++ b/libraries/render-utils/src/Model.cpp @@ -2068,6 +2068,12 @@ void Model::segregateMeshGroups() { bool hasSpecular = mesh.hasSpecularTexture(); bool hasLightmap = mesh.hasEmissiveTexture(); bool isSkinned = state.clusterMatrices.size() > 1; + bool isWireframe = this->isWireframe(); + + if (isWireframe) { + translucentMesh = hasTangents = hasSpecular = hasLightmap = isSkinned = false; + } + QString materialID; // create a material name from all the parts. If there's one part, this will be a single material and its @@ -2085,7 +2091,7 @@ void Model::segregateMeshGroups() { qCDebug(renderutils) << "materialID:" << materialID << "parts:" << mesh.parts.size(); } - RenderKey key(translucentMesh, hasLightmap, hasTangents, hasSpecular, isSkinned, isWireframe()); + RenderKey key(translucentMesh, hasLightmap, hasTangents, hasSpecular, isSkinned, isWireframe); // reuse or create the bucket corresponding to that key and insert the mesh as unsorted _renderBuckets[key.getRaw()]._unsortedMeshes.insertMulti(materialID, i); From 34deba7fffc294d27995002bc6e1821a1e95498d Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Sat, 9 May 2015 17:59:45 -0700 Subject: [PATCH 2/8] undo mistaken change of setting name --- libraries/octree/src/OctreeQuery.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/octree/src/OctreeQuery.cpp b/libraries/octree/src/OctreeQuery.cpp index 5f62318338..6ca55fc4cc 100644 --- a/libraries/octree/src/OctreeQuery.cpp +++ b/libraries/octree/src/OctreeQuery.cpp @@ -16,7 +16,7 @@ #include "OctreeConstants.h" #include "OctreeQuery.h" -Setting::Handle maxOctreePacketsPerSecond("maxOctreePPSSpin", DEFAULT_MAX_OCTREE_PPS); +Setting::Handle maxOctreePacketsPerSecond("maxOctreePPS", DEFAULT_MAX_OCTREE_PPS); OctreeQuery::OctreeQuery() { _maxOctreePPS = maxOctreePacketsPerSecond.get(); From 8da3490a4cea5ac2c7ad101b57dc1f2540a22fb9 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Sun, 10 May 2015 09:32:03 -0700 Subject: [PATCH 3/8] when grabbing an entity, zero out its gravity. --- examples/grab.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/examples/grab.js b/examples/grab.js index df2042350e..efacc26612 100644 --- a/examples/grab.js +++ b/examples/grab.js @@ -27,6 +27,7 @@ var ANGULAR_DAMPING_RATE = 0.40; var SCREEN_TO_METERS = 0.001; var currentPosition, currentVelocity, cameraEntityDistance, currentRotation; var velocityTowardTarget, desiredVelocity, addedVelocity, newVelocity, dPosition, camYaw, distanceToTarget, targetPosition; +var originalGravity; var shouldRotate = false; var dQ, theta, axisAngle, dT; var angularVelocity = { @@ -65,6 +66,7 @@ function mousePressEvent(event) { grabbedEntity = intersection.entityID; var props = Entities.getEntityProperties(grabbedEntity) isGrabbing = true; + originalGravity = props.gravity; targetPosition = props.position; currentPosition = props.position; currentVelocity = props.velocity; @@ -96,6 +98,11 @@ function updateDropLine(position) { function mouseReleaseEvent() { if (isGrabbing) { isGrabbing = false; + + Entities.editEntity(grabbedEntity, { + gravity: originalGravity + }); + Overlays.editOverlay(dropLine, { visible: false }); @@ -194,7 +201,7 @@ function update(deltaTime) { newVelocity = Vec3.subtract(newVelocity, Vec3.multiply(newVelocity, DAMPING_RATE)); // Update entity } else { - newVelocity = entityProps.velocity; + newVelocity = {x: 0, y: 0, z: 0}; } if (shouldRotate) { angularVelocity = Vec3.subtract(angularVelocity, Vec3.multiply(angularVelocity, ANGULAR_DAMPING_RATE)); @@ -204,7 +211,8 @@ function update(deltaTime) { Entities.editEntity(grabbedEntity, { velocity: newVelocity, - angularVelocity: angularVelocity + angularVelocity: angularVelocity, + gravity: {x: 0, y: 0, z: 0} }) updateDropLine(targetPosition); } @@ -215,4 +223,4 @@ Controller.mousePressEvent.connect(mousePressEvent); Controller.mouseReleaseEvent.connect(mouseReleaseEvent); Controller.keyPressEvent.connect(keyPressEvent); Controller.keyReleaseEvent.connect(keyReleaseEvent); -Script.update.connect(update); \ No newline at end of file +Script.update.connect(update); From 68e01d2bd9f17f7b26585cc09f9b630d9c8e0d43 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Sun, 10 May 2015 17:03:42 -0700 Subject: [PATCH 4/8] quiet compiler --- libraries/gpu/src/gpu/Texture.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libraries/gpu/src/gpu/Texture.h b/libraries/gpu/src/gpu/Texture.h index 19add9a47e..1cd9d0b29b 100755 --- a/libraries/gpu/src/gpu/Texture.h +++ b/libraries/gpu/src/gpu/Texture.h @@ -56,12 +56,12 @@ public: glm::vec4 _borderColor{ 1.0f }; uint32 _maxAnisotropy = 16; + uint8 _filter = FILTER_MIN_MAG_POINT; + uint8 _comparisonFunc = ALWAYS; + uint8 _wrapModeU = WRAP_REPEAT; uint8 _wrapModeV = WRAP_REPEAT; uint8 _wrapModeW = WRAP_REPEAT; - - uint8 _filter = FILTER_MIN_MAG_POINT; - uint8 _comparisonFunc = ALWAYS; uint8 _mipOffset = 0; uint8 _minMip = 0; From e6023c59c18083ebd43a5573aa9fb2cb949f50f6 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Sun, 10 May 2015 17:15:48 -0700 Subject: [PATCH 5/8] if _reply is NULL, it doesn't make sense to worry about if it's finished loading or not. --- libraries/networking/src/ResourceCache.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libraries/networking/src/ResourceCache.cpp b/libraries/networking/src/ResourceCache.cpp index 54afa98505..c66ae4ce1d 100644 --- a/libraries/networking/src/ResourceCache.cpp +++ b/libraries/networking/src/ResourceCache.cpp @@ -241,7 +241,7 @@ float Resource::getLoadPriority() { } void Resource::refresh() { - if (_reply == nullptr && !(_loaded || _failedToLoad)) { + if (_reply && !(_loaded || _failedToLoad)) { return; } if (_reply) { @@ -351,6 +351,7 @@ void Resource::maybeRefresh() { QDateTime lastModifiedOld = metaData.lastModified(); if (lastModified.isValid() && lastModifiedOld.isValid() && lastModifiedOld == lastModified) { + qCDebug(networking) << "Using cached version of" << _url.fileName(); // We don't need to update, return return; } From e51040db5302a2d752d71ed70581a733b250613c Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Mon, 11 May 2015 14:31:22 +0200 Subject: [PATCH 6/8] CR --- libraries/render-utils/src/Model.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libraries/render-utils/src/Model.cpp b/libraries/render-utils/src/Model.cpp index db95005a09..080b63370a 100644 --- a/libraries/render-utils/src/Model.cpp +++ b/libraries/render-utils/src/Model.cpp @@ -2068,9 +2068,9 @@ void Model::segregateMeshGroups() { bool hasSpecular = mesh.hasSpecularTexture(); bool hasLightmap = mesh.hasEmissiveTexture(); bool isSkinned = state.clusterMatrices.size() > 1; - bool isWireframe = this->isWireframe(); + bool wireframe = isWireframe(); - if (isWireframe) { + if (wireframe) { translucentMesh = hasTangents = hasSpecular = hasLightmap = isSkinned = false; } @@ -2091,7 +2091,7 @@ void Model::segregateMeshGroups() { qCDebug(renderutils) << "materialID:" << materialID << "parts:" << mesh.parts.size(); } - RenderKey key(translucentMesh, hasLightmap, hasTangents, hasSpecular, isSkinned, isWireframe); + RenderKey key(translucentMesh, hasLightmap, hasTangents, hasSpecular, isSkinned, wireframe); // reuse or create the bucket corresponding to that key and insert the mesh as unsorted _renderBuckets[key.getRaw()]._unsortedMeshes.insertMulti(materialID, i); From 94765f0c531326e8de4ef4242285ca2df39fca40 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Mon, 11 May 2015 15:54:14 +0200 Subject: [PATCH 7/8] Add print type --- examples/edit.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/examples/edit.js b/examples/edit.js index 585b45f3f9..64050d92aa 100644 --- a/examples/edit.js +++ b/examples/edit.js @@ -1197,7 +1197,11 @@ PropertiesTool = function(opts) { webView.eventBridge.webEventReceived.connect(function(data) { data = JSON.parse(data); - if (data.type == "update") { + if (data.type == "print") { + if (data.message) { + print(data.message); + } + } else if (data.type == "update") { selectionManager.saveProperties(); if (selectionManager.selections.length > 1) { properties = { From beba293d9683c9a277b5d4c74149892df1f0e03b Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Mon, 11 May 2015 15:54:30 +0200 Subject: [PATCH 8/8] Hide Skybox/Atmosphere prps when not needed --- examples/html/entityProperties.html | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/examples/html/entityProperties.html b/examples/html/entityProperties.html index 26bcc63f15..561f39edd2 100644 --- a/examples/html/entityProperties.html +++ b/examples/html/entityProperties.html @@ -18,6 +18,12 @@ els[i].setAttribute('disabled', 'disabled'); } } + + function showElements(els, show) { + for (var i = 0; i < els.length; i++) { + els[i].style.display = (show) ? 'block' : 'none'; + } + } function createEmitCheckedPropertyUpdateFunction(propertyName) { return function() { @@ -504,6 +510,8 @@ elZoneAtmosphereScatteringWavelengthsZ.value = properties.atmosphere.scatteringWavelengths.z; elZoneAtmosphereHasStars.checked = properties.atmosphere.hasStars; + showElements(document.getElementsByClassName('skybox-section'), elZoneBackgroundMode.value == 'skybox'); + showElements(document.getElementsByClassName('atmosphere-section'), elZoneBackgroundMode.value == 'atmosphere'); } if (selected) { @@ -1117,7 +1125,7 @@ -
+
Skybox Color
R
@@ -1125,13 +1133,13 @@
B
-
+
Skybox URL
-
+
Atmosphere Center
X
@@ -1139,31 +1147,31 @@
Z
-
+
Atmosphere Inner Radius
-
+
Atmosphere Outer Radius
-
+
Atmosphere Mie Scattering
-
+
Atmosphere Rayleigh Scattering
-
+
Atmosphere Scattering Wavelenghts
X
@@ -1171,7 +1179,7 @@
Z
-
+