From 922452f5c3d8096c6752efead6643fd8676cb003 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Mon, 13 Apr 2015 09:21:17 -0700 Subject: [PATCH 01/26] use output filename as base-name when splitting files --- tools/vhacd/src/VHACDUtilApp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/vhacd/src/VHACDUtilApp.cpp b/tools/vhacd/src/VHACDUtilApp.cpp index 242e69c363..46e1898979 100644 --- a/tools/vhacd/src/VHACDUtilApp.cpp +++ b/tools/vhacd/src/VHACDUtilApp.cpp @@ -315,7 +315,7 @@ VHACDUtilApp::VHACDUtilApp(int argc, char* argv[]) : if (splitModel) { QVector infileExtensions = {"fbx", "obj"}; - QString baseFileName = fileNameWithoutExtension(inputFilename, infileExtensions); + QString baseFileName = fileNameWithoutExtension(outputFilename, infileExtensions); int count = 0; foreach (const FBXMesh& mesh, fbx.meshes) { foreach (const FBXMeshPart &meshPart, mesh.parts) { From 95b4c75f9f417c9210bb2b91d3e4c9f95b705d2a Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Fri, 1 May 2015 00:21:29 +0200 Subject: [PATCH 02/26] Add missing DM::set<>() calls --- assignment-client/src/AssignmentClient.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/assignment-client/src/AssignmentClient.cpp b/assignment-client/src/AssignmentClient.cpp index 594805c7c2..39dcf4b29c 100644 --- a/assignment-client/src/AssignmentClient.cpp +++ b/assignment-client/src/AssignmentClient.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -53,7 +54,10 @@ AssignmentClient::AssignmentClient(int ppid, Assignment::Type requestAssignmentT // create a NodeList as an unassigned client DependencyManager::registerInheritance(); auto addressManager = DependencyManager::set(); - auto nodeList = DependencyManager::set(NodeType::Unassigned); + auto nodeList = DependencyManager::set(NodeType::Unassigned); // Order is important + + auto animationCache = DependencyManager::set(); + auto avatarHashMap = DependencyManager::set(); auto entityScriptingInterface = DependencyManager::set(); // make up a uuid for this child so the parent can tell us apart. This id will be changed From 762e6255d63996861dc361b18cd117dd9c0ea238 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Fri, 1 May 2015 00:34:24 +0200 Subject: [PATCH 03/26] Fix botProcedural include --- examples/acScripts/bot_procedural.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/acScripts/bot_procedural.js b/examples/acScripts/bot_procedural.js index 518ef8cc22..8386662dba 100644 --- a/examples/acScripts/bot_procedural.js +++ b/examples/acScripts/bot_procedural.js @@ -12,7 +12,7 @@ //For procedural walk animation HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/"; -Script.include("proceduralAnimationAPI.js"); +Script.include(HIFI_PUBLIC_BUCKET + "scripts/acScripts/proceduralAnimationAPI.js"); var procAnimAPI = new ProcAnimAPI(); From 57b7be3abec3b13533cdc1a7ac415fa7f39eb48d Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Thu, 30 Apr 2015 17:43:16 -0700 Subject: [PATCH 04/26] Prevent the menu from coming up when alt is applied as a modifier to touch or mouse events --- interface/src/Application.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 3f37067c75..cc012eb353 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -1467,6 +1467,9 @@ void Application::mouseMoveEvent(QMouseEvent* event, unsigned int deviceID) { } void Application::mousePressEvent(QMouseEvent* event, unsigned int deviceID) { + // Inhibit the menu if the user is using alt-mouse dragging + _altPressed = false; + if (!_aboutToQuit) { _entities.mousePressEvent(event, deviceID); } @@ -1541,6 +1544,7 @@ void Application::mouseReleaseEvent(QMouseEvent* event, unsigned int deviceID) { } void Application::touchUpdateEvent(QTouchEvent* event) { + _altPressed = false; if (event->type() == QEvent::TouchUpdate) { TouchEvent thisEvent(*event, _lastTouchEvent); _controllerScriptingInterface.emitTouchUpdateEvent(thisEvent); // send events to any registered scripts @@ -1576,6 +1580,7 @@ void Application::touchUpdateEvent(QTouchEvent* event) { } void Application::touchBeginEvent(QTouchEvent* event) { + _altPressed = false; TouchEvent thisEvent(*event); // on touch begin, we don't compare to last event _controllerScriptingInterface.emitTouchBeginEvent(thisEvent); // send events to any registered scripts @@ -1590,6 +1595,7 @@ void Application::touchBeginEvent(QTouchEvent* event) { } void Application::touchEndEvent(QTouchEvent* event) { + _altPressed = false; TouchEvent thisEvent(*event, _lastTouchEvent); _controllerScriptingInterface.emitTouchEndEvent(thisEvent); // send events to any registered scripts _lastTouchEvent = thisEvent; @@ -1606,7 +1612,7 @@ void Application::touchEndEvent(QTouchEvent* event) { } void Application::wheelEvent(QWheelEvent* event) { - + _altPressed = false; _controllerScriptingInterface.emitWheelEvent(event); // send events to any registered scripts // if one of our scripts have asked to capture this event, then stop processing it From 3765ace7ef228a356daf79f55647be5d0b5fa2e6 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Fri, 1 May 2015 11:17:46 -0700 Subject: [PATCH 05/26] move common debugging rendering into a new class --- .../src/RenderableBoxEntityItem.cpp | 7 ++- .../src/RenderableBoxEntityItem.h | 7 ++- .../src/RenderableDebugableEntityItem.cpp | 61 +++++++++++++++++++ .../src/RenderableDebugableEntityItem.h | 26 ++++++++ .../src/RenderableModelEntityItem.cpp | 35 ++--------- .../src/RenderableModelEntityItem.h | 4 +- libraries/entities/src/EntityItem.h | 4 +- 7 files changed, 106 insertions(+), 38 deletions(-) create mode 100644 libraries/entities-renderer/src/RenderableDebugableEntityItem.cpp create mode 100644 libraries/entities-renderer/src/RenderableDebugableEntityItem.h diff --git a/libraries/entities-renderer/src/RenderableBoxEntityItem.cpp b/libraries/entities-renderer/src/RenderableBoxEntityItem.cpp index 2f40b6ce6b..6700a35c7b 100644 --- a/libraries/entities-renderer/src/RenderableBoxEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableBoxEntityItem.cpp @@ -1,6 +1,6 @@ // // RenderableBoxEntityItem.cpp -// interface/src +// libraries/entities-renderer/src/ // // Created by Brad Hefta-Gaub on 8/6/14. // Copyright 2014 High Fidelity, Inc. @@ -36,8 +36,9 @@ void RenderableBoxEntityItem::render(RenderArgs* args) { getColor()[BLUE_INDEX] / MAX_COLOR, getLocalRenderAlpha()); + bool debugSimulationOwnership = args->_debugFlags & RenderArgs::RENDER_DEBUG_SIMULATION_OWNERSHIP; bool highlightSimulationOwnership = false; - if (args->_debugFlags & RenderArgs::RENDER_DEBUG_SIMULATION_OWNERSHIP) { + if (debugSimulationOwnership) { auto nodeList = DependencyManager::get(); const QUuid& myNodeID = nodeList->getSessionUUID(); highlightSimulationOwnership = (getSimulatorID() == myNodeID); @@ -58,4 +59,6 @@ void RenderableBoxEntityItem::render(RenderArgs* args) { } glPopMatrix(); glPopMatrix(); + + RenderableDebugableEntityItem::render(args); }; diff --git a/libraries/entities-renderer/src/RenderableBoxEntityItem.h b/libraries/entities-renderer/src/RenderableBoxEntityItem.h index c4495d2328..811eb8c4e4 100644 --- a/libraries/entities-renderer/src/RenderableBoxEntityItem.h +++ b/libraries/entities-renderer/src/RenderableBoxEntityItem.h @@ -1,6 +1,6 @@ // -// RenderableBoxEntityItem.h -// interface/src/entities +// RenderableDebugableEntityItem.h +// libraries/entities-renderer/src/ // // Created by Brad Hefta-Gaub on 8/6/14. // Copyright 2014 High Fidelity, Inc. @@ -13,8 +13,9 @@ #define hifi_RenderableBoxEntityItem_h #include +#include "RenderableDebugableEntityItem.h" -class RenderableBoxEntityItem : public BoxEntityItem { +class RenderableBoxEntityItem : public BoxEntityItem, public RenderableDebugableEntityItem { public: static EntityItem* factory(const EntityItemID& entityID, const EntityItemProperties& properties); diff --git a/libraries/entities-renderer/src/RenderableDebugableEntityItem.cpp b/libraries/entities-renderer/src/RenderableDebugableEntityItem.cpp new file mode 100644 index 0000000000..4f637f0082 --- /dev/null +++ b/libraries/entities-renderer/src/RenderableDebugableEntityItem.cpp @@ -0,0 +1,61 @@ +// +// RenderableDebugableEntityItem.cpp +// libraries/entities-renderer/src/ +// +// Created by Brad Hefta-Gaub on 8/6/14. +// Copyright 2014 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + + + +#include +#include +#include + +#include "RenderableDebugableEntityItem.h" + + +void RenderableDebugableEntityItem::renderBoundingBox(RenderArgs* args, bool puffedOut) { + + EntityItem* entity = dynamic_cast(this); + + glm::vec3 position = entity->getPosition(); + glm::vec3 center = entity->getCenter(); + glm::vec3 dimensions = entity->getDimensions(); + glm::quat rotation = entity->getRotation(); + // float size = glm::length(dimensions) / 2.0f; + + glm::vec4 greenColor(0.0f, 1.0f, 0.0f, 1.0f); + + glPushMatrix(); + glTranslatef(position.x, position.y, position.z); + glm::vec3 axis = glm::axis(rotation); + glRotatef(glm::degrees(glm::angle(rotation)), axis.x, axis.y, axis.z); + glPushMatrix(); + glm::vec3 positionToCenter = center - position; + glTranslatef(positionToCenter.x, positionToCenter.y, positionToCenter.z); + glScalef(dimensions.x, dimensions.y, dimensions.z); + if (puffedOut) { + DependencyManager::get()->renderWireCube(1.2f, greenColor); + } else { + DependencyManager::get()->renderWireCube(1.0f, greenColor); + } + glPopMatrix(); + glPopMatrix(); +} + + +void RenderableDebugableEntityItem::render(RenderArgs* args) { + EntityItem* entity = dynamic_cast(this); + bool debugSimulationOwnership = args->_debugFlags & RenderArgs::RENDER_DEBUG_SIMULATION_OWNERSHIP; + + if (debugSimulationOwnership) { + quint64 now = usecTimestampNow(); + if (now - entity->getLastEditedFromRemote() < 0.1f * USECS_PER_SECOND) { + renderBoundingBox(args, true); + } + } +} diff --git a/libraries/entities-renderer/src/RenderableDebugableEntityItem.h b/libraries/entities-renderer/src/RenderableDebugableEntityItem.h new file mode 100644 index 0000000000..77357b9437 --- /dev/null +++ b/libraries/entities-renderer/src/RenderableDebugableEntityItem.h @@ -0,0 +1,26 @@ +// +// RenderableBoxEntityItem.h +// interface/src/entities +// +// Created by Seth Alves on 5/1/15. +// Copyright 2014 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + +#ifndef hifi_RenderableDebugableEntityItem_h +#define hifi_RenderableDebugableEntityItem_h + +#include + +class RenderableDebugableEntityItem { +public: + RenderableDebugableEntityItem() {} + virtual ~RenderableDebugableEntityItem() {} + + void renderBoundingBox(RenderArgs* args, bool puffedOut); + virtual void render(RenderArgs* args); +}; + +#endif // hifi_RenderableBoxEntityItem_h diff --git a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp index cedb5b9924..b5cf130672 100644 --- a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp @@ -108,34 +108,6 @@ void RenderableModelEntityItem::remapTextures() { _currentTextures = _textures; } - -void RenderableModelEntityItem::renderBoundingBox(RenderArgs* args) { - glm::vec3 position = getPosition(); - glm::vec3 center = getCenter(); - glm::vec3 dimensions = getDimensions(); - glm::quat rotation = getRotation(); - // float size = glm::length(dimensions) / 2.0f; - - const float MAX_COLOR = 255.0f; - glm::vec4 cubeColor(getColor()[RED_INDEX] / MAX_COLOR, - getColor()[GREEN_INDEX] / MAX_COLOR, - getColor()[BLUE_INDEX] / MAX_COLOR, - getLocalRenderAlpha()); - - glPushMatrix(); - glTranslatef(position.x, position.y, position.z); - glm::vec3 axis = glm::axis(rotation); - glRotatef(glm::degrees(glm::angle(rotation)), axis.x, axis.y, axis.z); - glPushMatrix(); - glm::vec3 positionToCenter = center - position; - glTranslatef(positionToCenter.x, positionToCenter.y, positionToCenter.z); - glScalef(dimensions.x, dimensions.y, dimensions.z); - DependencyManager::get()->renderWireCube(1.0f, cubeColor); - glPopMatrix(); - glPopMatrix(); -} - - void RenderableModelEntityItem::render(RenderArgs* args) { PerformanceTimer perfTimer("RMEIrender"); assert(getType() == EntityTypes::Model); @@ -145,8 +117,9 @@ void RenderableModelEntityItem::render(RenderArgs* args) { glm::vec3 position = getPosition(); glm::vec3 dimensions = getDimensions(); + bool debugSimulationOwnership = args->_debugFlags & RenderArgs::RENDER_DEBUG_SIMULATION_OWNERSHIP; bool highlightSimulationOwnership = false; - if (args->_debugFlags & RenderArgs::RENDER_DEBUG_SIMULATION_OWNERSHIP) { + if (debugSimulationOwnership) { auto nodeList = DependencyManager::get(); const QUuid& myNodeID = nodeList->getSessionUUID(); highlightSimulationOwnership = (getSimulatorID() == myNodeID); @@ -219,8 +192,10 @@ void RenderableModelEntityItem::render(RenderArgs* args) { } if (!didDraw) { - renderBoundingBox(args); + renderBoundingBox(args, false); } + + RenderableDebugableEntityItem::render(args); } Model* RenderableModelEntityItem::getModel(EntityTreeRenderer* renderer) { diff --git a/libraries/entities-renderer/src/RenderableModelEntityItem.h b/libraries/entities-renderer/src/RenderableModelEntityItem.h index ec0e30985c..d6a4c81952 100644 --- a/libraries/entities-renderer/src/RenderableModelEntityItem.h +++ b/libraries/entities-renderer/src/RenderableModelEntityItem.h @@ -16,11 +16,12 @@ #include #include +#include "RenderableDebugableEntityItem.h" class Model; class EntityTreeRenderer; -class RenderableModelEntityItem : public ModelEntityItem { +class RenderableModelEntityItem : public ModelEntityItem, public RenderableDebugableEntityItem { public: static EntityItem* factory(const EntityItemID& entityID, const EntityItemProperties& properties); @@ -42,7 +43,6 @@ public: virtual void somethingChangedNotification() { _needsInitialSimulation = true; } - void renderBoundingBox(RenderArgs* args); virtual void render(RenderArgs* args); virtual bool supportsDetailedRayIntersection() const { return true; } virtual bool findDetailedRayIntersection(const glm::vec3& origin, const glm::vec3& direction, diff --git a/libraries/entities/src/EntityItem.h b/libraries/entities/src/EntityItem.h index e71f88d723..62e87efcac 100644 --- a/libraries/entities/src/EntityItem.h +++ b/libraries/entities/src/EntityItem.h @@ -304,7 +304,9 @@ public: glm::mat4 getWorldToEntityMatrix() const; glm::vec3 worldToEntity(const glm::vec3& point) const; glm::vec3 entityToWorld(const glm::vec3& point) const; - + + quint64 getLastEditedFromRemote() { return _lastEditedFromRemote; } + protected: static bool _sendPhysicsUpdates; From a31e2dc309dae0cf58fcb224d8dbcc3bc4f32a8b Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Fri, 1 May 2015 11:18:56 -0700 Subject: [PATCH 06/26] oops --- libraries/entities-renderer/src/RenderableBoxEntityItem.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/entities-renderer/src/RenderableBoxEntityItem.h b/libraries/entities-renderer/src/RenderableBoxEntityItem.h index 811eb8c4e4..58f5e72b35 100644 --- a/libraries/entities-renderer/src/RenderableBoxEntityItem.h +++ b/libraries/entities-renderer/src/RenderableBoxEntityItem.h @@ -1,5 +1,5 @@ // -// RenderableDebugableEntityItem.h +// RenderableBoxEntityItem.h // libraries/entities-renderer/src/ // // Created by Brad Hefta-Gaub on 8/6/14. From b443ce5d3ea955cce4563dc4ab2e50eb57282719 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Fri, 1 May 2015 11:20:34 -0700 Subject: [PATCH 07/26] oops --- .../entities-renderer/src/RenderableDebugableEntityItem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/entities-renderer/src/RenderableDebugableEntityItem.cpp b/libraries/entities-renderer/src/RenderableDebugableEntityItem.cpp index 4f637f0082..ddba216744 100644 --- a/libraries/entities-renderer/src/RenderableDebugableEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableDebugableEntityItem.cpp @@ -2,7 +2,7 @@ // RenderableDebugableEntityItem.cpp // libraries/entities-renderer/src/ // -// Created by Brad Hefta-Gaub on 8/6/14. +// Created by Seth Alves on 5/1/15. // Copyright 2014 High Fidelity, Inc. // // Distributed under the Apache License, Version 2.0. From 452d78805e9673681df20367cf996a150247b25e Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Fri, 1 May 2015 11:20:50 -0700 Subject: [PATCH 08/26] oops --- libraries/entities-renderer/src/RenderableDebugableEntityItem.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/entities-renderer/src/RenderableDebugableEntityItem.h b/libraries/entities-renderer/src/RenderableDebugableEntityItem.h index 77357b9437..0db26419b9 100644 --- a/libraries/entities-renderer/src/RenderableDebugableEntityItem.h +++ b/libraries/entities-renderer/src/RenderableDebugableEntityItem.h @@ -1,5 +1,5 @@ // -// RenderableBoxEntityItem.h +// RenderableDebugableEntityItem.h // interface/src/entities // // Created by Seth Alves on 5/1/15. From b47184de7825180dfc214018f867de4ba11c6348 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Fri, 1 May 2015 11:21:27 -0700 Subject: [PATCH 09/26] oops --- libraries/entities-renderer/src/RenderableDebugableEntityItem.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/entities-renderer/src/RenderableDebugableEntityItem.h b/libraries/entities-renderer/src/RenderableDebugableEntityItem.h index 0db26419b9..30d17c3d0b 100644 --- a/libraries/entities-renderer/src/RenderableDebugableEntityItem.h +++ b/libraries/entities-renderer/src/RenderableDebugableEntityItem.h @@ -23,4 +23,4 @@ public: virtual void render(RenderArgs* args); }; -#endif // hifi_RenderableBoxEntityItem_h +#endif // hifi_RenderableDebugableEntityItem_h From ea1ec0186e13a17cc23d0bc3c36f51b0903da64b Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Fri, 1 May 2015 11:31:58 -0700 Subject: [PATCH 10/26] stop doing useless multiple inheritance --- .../entities-renderer/src/RenderableBoxEntityItem.cpp | 2 +- .../entities-renderer/src/RenderableBoxEntityItem.h | 2 +- .../src/RenderableDebugableEntityItem.cpp | 10 +++------- .../src/RenderableDebugableEntityItem.h | 7 ++----- .../src/RenderableModelEntityItem.cpp | 4 ++-- .../entities-renderer/src/RenderableModelEntityItem.h | 2 +- 6 files changed, 10 insertions(+), 17 deletions(-) diff --git a/libraries/entities-renderer/src/RenderableBoxEntityItem.cpp b/libraries/entities-renderer/src/RenderableBoxEntityItem.cpp index 6700a35c7b..13df04e2e7 100644 --- a/libraries/entities-renderer/src/RenderableBoxEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableBoxEntityItem.cpp @@ -60,5 +60,5 @@ void RenderableBoxEntityItem::render(RenderArgs* args) { glPopMatrix(); glPopMatrix(); - RenderableDebugableEntityItem::render(args); + RenderableDebugableEntityItem::render(this, args); }; diff --git a/libraries/entities-renderer/src/RenderableBoxEntityItem.h b/libraries/entities-renderer/src/RenderableBoxEntityItem.h index 58f5e72b35..cda725056c 100644 --- a/libraries/entities-renderer/src/RenderableBoxEntityItem.h +++ b/libraries/entities-renderer/src/RenderableBoxEntityItem.h @@ -15,7 +15,7 @@ #include #include "RenderableDebugableEntityItem.h" -class RenderableBoxEntityItem : public BoxEntityItem, public RenderableDebugableEntityItem { +class RenderableBoxEntityItem : public BoxEntityItem { public: static EntityItem* factory(const EntityItemID& entityID, const EntityItemProperties& properties); diff --git a/libraries/entities-renderer/src/RenderableDebugableEntityItem.cpp b/libraries/entities-renderer/src/RenderableDebugableEntityItem.cpp index ddba216744..f0ed75d0eb 100644 --- a/libraries/entities-renderer/src/RenderableDebugableEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableDebugableEntityItem.cpp @@ -18,10 +18,7 @@ #include "RenderableDebugableEntityItem.h" -void RenderableDebugableEntityItem::renderBoundingBox(RenderArgs* args, bool puffedOut) { - - EntityItem* entity = dynamic_cast(this); - +void RenderableDebugableEntityItem::renderBoundingBox(EntityItem* entity, RenderArgs* args, bool puffedOut) { glm::vec3 position = entity->getPosition(); glm::vec3 center = entity->getCenter(); glm::vec3 dimensions = entity->getDimensions(); @@ -48,14 +45,13 @@ void RenderableDebugableEntityItem::renderBoundingBox(RenderArgs* args, bool puf } -void RenderableDebugableEntityItem::render(RenderArgs* args) { - EntityItem* entity = dynamic_cast(this); +void RenderableDebugableEntityItem::render(EntityItem* entity, RenderArgs* args) { bool debugSimulationOwnership = args->_debugFlags & RenderArgs::RENDER_DEBUG_SIMULATION_OWNERSHIP; if (debugSimulationOwnership) { quint64 now = usecTimestampNow(); if (now - entity->getLastEditedFromRemote() < 0.1f * USECS_PER_SECOND) { - renderBoundingBox(args, true); + renderBoundingBox(entity, args, true); } } } diff --git a/libraries/entities-renderer/src/RenderableDebugableEntityItem.h b/libraries/entities-renderer/src/RenderableDebugableEntityItem.h index 30d17c3d0b..514979ec95 100644 --- a/libraries/entities-renderer/src/RenderableDebugableEntityItem.h +++ b/libraries/entities-renderer/src/RenderableDebugableEntityItem.h @@ -16,11 +16,8 @@ class RenderableDebugableEntityItem { public: - RenderableDebugableEntityItem() {} - virtual ~RenderableDebugableEntityItem() {} - - void renderBoundingBox(RenderArgs* args, bool puffedOut); - virtual void render(RenderArgs* args); + static void renderBoundingBox(EntityItem* entity, RenderArgs* args, bool puffedOut); + static void render(EntityItem* entity, RenderArgs* args); }; #endif // hifi_RenderableDebugableEntityItem_h diff --git a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp index b5cf130672..b3232bcb57 100644 --- a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp @@ -192,10 +192,10 @@ void RenderableModelEntityItem::render(RenderArgs* args) { } if (!didDraw) { - renderBoundingBox(args, false); + RenderableDebugableEntityItem::renderBoundingBox(this, args, false); } - RenderableDebugableEntityItem::render(args); + RenderableDebugableEntityItem::render(this, args); } Model* RenderableModelEntityItem::getModel(EntityTreeRenderer* renderer) { diff --git a/libraries/entities-renderer/src/RenderableModelEntityItem.h b/libraries/entities-renderer/src/RenderableModelEntityItem.h index d6a4c81952..efd60faedc 100644 --- a/libraries/entities-renderer/src/RenderableModelEntityItem.h +++ b/libraries/entities-renderer/src/RenderableModelEntityItem.h @@ -21,7 +21,7 @@ class Model; class EntityTreeRenderer; -class RenderableModelEntityItem : public ModelEntityItem, public RenderableDebugableEntityItem { +class RenderableModelEntityItem : public ModelEntityItem { public: static EntityItem* factory(const EntityItemID& entityID, const EntityItemProperties& properties); From bd1f77b8f36897f5afaee5ec19222c5fcc447247 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Fri, 1 May 2015 11:35:14 -0700 Subject: [PATCH 11/26] cleanups --- .../entities-renderer/src/RenderableDebugableEntityItem.cpp | 2 -- libraries/entities-renderer/src/RenderableDebugableEntityItem.h | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/libraries/entities-renderer/src/RenderableDebugableEntityItem.cpp b/libraries/entities-renderer/src/RenderableDebugableEntityItem.cpp index f0ed75d0eb..94b554b96a 100644 --- a/libraries/entities-renderer/src/RenderableDebugableEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableDebugableEntityItem.cpp @@ -23,8 +23,6 @@ void RenderableDebugableEntityItem::renderBoundingBox(EntityItem* entity, Render glm::vec3 center = entity->getCenter(); glm::vec3 dimensions = entity->getDimensions(); glm::quat rotation = entity->getRotation(); - // float size = glm::length(dimensions) / 2.0f; - glm::vec4 greenColor(0.0f, 1.0f, 0.0f, 1.0f); glPushMatrix(); diff --git a/libraries/entities-renderer/src/RenderableDebugableEntityItem.h b/libraries/entities-renderer/src/RenderableDebugableEntityItem.h index 514979ec95..9a8344c96d 100644 --- a/libraries/entities-renderer/src/RenderableDebugableEntityItem.h +++ b/libraries/entities-renderer/src/RenderableDebugableEntityItem.h @@ -1,6 +1,6 @@ // // RenderableDebugableEntityItem.h -// interface/src/entities +// libraries/entities-renderer/src/ // // Created by Seth Alves on 5/1/15. // Copyright 2014 High Fidelity, Inc. From c8e5b35de94f21b5b02616f0278f951a3c7a96d7 Mon Sep 17 00:00:00 2001 From: samcake Date: Fri, 1 May 2015 12:04:15 -0700 Subject: [PATCH 12/26] Fixing typo --- libraries/gpu/src/gpu/GLBackendOutput.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/gpu/src/gpu/GLBackendOutput.cpp b/libraries/gpu/src/gpu/GLBackendOutput.cpp index dd8e9c68b6..7b2deb64d2 100755 --- a/libraries/gpu/src/gpu/GLBackendOutput.cpp +++ b/libraries/gpu/src/gpu/GLBackendOutput.cpp @@ -75,7 +75,7 @@ GLBackend::GLFramebuffer* GLBackend::syncGPUObject(const Framebuffer& framebuffe } } #if (GPU_FEATURE_PROFILE == GPU_LEGACY) - // for reasons that i don;t understand yet, it seems that on mac gl, a fbo must have a color buffer... + // for reasons that i don't understand yet, it seems that on mac gl, a fbo must have a color buffer... else { GLuint renderBuffer = 0; glGenRenderbuffers(1, &renderBuffer); From 51c2a8273e8f5421cf664556f81f702d65b80edf Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Fri, 1 May 2015 12:52:40 -0700 Subject: [PATCH 13/26] Add drawZoneBoundaries --- .../entities-renderer/src/RenderableZoneEntityItem.cpp | 8 +++++++- .../entities-renderer/src/RenderableZoneEntityItem.h | 3 ++- libraries/entities/src/ZoneEntityItem.cpp | 1 + libraries/entities/src/ZoneEntityItem.h | 4 ++++ 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/libraries/entities-renderer/src/RenderableZoneEntityItem.cpp b/libraries/entities-renderer/src/RenderableZoneEntityItem.cpp index d61e3c02f7..0b51cf75f2 100644 --- a/libraries/entities-renderer/src/RenderableZoneEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableZoneEntityItem.cpp @@ -74,6 +74,12 @@ void RenderableZoneEntityItem::initialSimulation() { _needsInitialSimulation = false; } +void RenderableZoneEntityItem::render(RenderArgs* args) { + if (_drawZoneBoundaries) { + // TODO: Draw the zone boundaries... + } +} + bool RenderableZoneEntityItem::contains(const glm::vec3& point) const { if (getShapeType() != SHAPE_TYPE_COMPOUND) { return EntityItem::contains(point); @@ -92,4 +98,4 @@ bool RenderableZoneEntityItem::contains(const glm::vec3& point) const { } return false; -} \ No newline at end of file +} diff --git a/libraries/entities-renderer/src/RenderableZoneEntityItem.h b/libraries/entities-renderer/src/RenderableZoneEntityItem.h index 8a75a048d1..18840e274b 100644 --- a/libraries/entities-renderer/src/RenderableZoneEntityItem.h +++ b/libraries/entities-renderer/src/RenderableZoneEntityItem.h @@ -32,6 +32,7 @@ public: ReadBitstreamToTreeParams& args, EntityPropertyFlags& propertyFlags, bool overwriteLocalData); + virtual void render(RenderArgs* args); virtual bool contains(const glm::vec3& point) const; private: @@ -45,4 +46,4 @@ private: bool _needsInitialSimulation; }; -#endif // hifi_RenderableZoneEntityItem_h \ No newline at end of file +#endif // hifi_RenderableZoneEntityItem_h diff --git a/libraries/entities/src/ZoneEntityItem.cpp b/libraries/entities/src/ZoneEntityItem.cpp index 9ccb2697a0..4a8b60a28e 100644 --- a/libraries/entities/src/ZoneEntityItem.cpp +++ b/libraries/entities/src/ZoneEntityItem.cpp @@ -20,6 +20,7 @@ #include "EntityTreeElement.h" bool ZoneEntityItem::_zonesArePickable = false; +bool ZoneEntityItem::_drawZoneBoundaries = false; const xColor ZoneEntityItem::DEFAULT_KEYLIGHT_COLOR = { 255, 255, 255 }; const float ZoneEntityItem::DEFAULT_KEYLIGHT_INTENSITY = 1.0f; diff --git a/libraries/entities/src/ZoneEntityItem.h b/libraries/entities/src/ZoneEntityItem.h index 4f081969ad..0744abf475 100644 --- a/libraries/entities/src/ZoneEntityItem.h +++ b/libraries/entities/src/ZoneEntityItem.h @@ -91,6 +91,9 @@ public: static bool getZonesArePickable() { return _zonesArePickable; } static void setZonesArePickable(bool value) { _zonesArePickable = value; } + + static bool getDrawZoneBoundaries() { return _drawZoneBoundaries; } + static void setDrawZoneBoundaries(bool value) { _drawZoneBoundaries = value; } virtual bool isReadyToComputeShape() { return false; } void updateShapeType(ShapeType type) { _shapeType = type; } @@ -136,6 +139,7 @@ protected: ShapeType _shapeType = SHAPE_TYPE_NONE; QString _compoundShapeURL; + static bool _drawZoneBoundaries; static bool _zonesArePickable; }; From 8ed5284dfaffd119a056d9f82c26cc521c6ee6dc Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Fri, 1 May 2015 12:52:59 -0700 Subject: [PATCH 14/26] Add drawZoneBoundaries get/set to EntitiesScriptingInterface --- libraries/entities/src/EntityScriptingInterface.cpp | 8 ++++++++ libraries/entities/src/EntityScriptingInterface.h | 3 +++ 2 files changed, 11 insertions(+) diff --git a/libraries/entities/src/EntityScriptingInterface.cpp b/libraries/entities/src/EntityScriptingInterface.cpp index 1dbd67f3b2..6632574db8 100644 --- a/libraries/entities/src/EntityScriptingInterface.cpp +++ b/libraries/entities/src/EntityScriptingInterface.cpp @@ -324,6 +324,14 @@ bool EntityScriptingInterface::getZonesArePickable() const { return ZoneEntityItem::getZonesArePickable(); } +void EntityScriptingInterface::setDrawZoneBoundaries(bool value) { + ZoneEntityItem::setDrawZoneBoundaries(value); +} + +bool EntityScriptingInterface::getDrawZoneBoundaries() const { + return ZoneEntityItem::getDrawZoneBoundaries(); +} + void EntityScriptingInterface::setSendPhysicsUpdates(bool value) { EntityItem::setSendPhysicsUpdates(value); } diff --git a/libraries/entities/src/EntityScriptingInterface.h b/libraries/entities/src/EntityScriptingInterface.h index 151036e926..bde369eaf2 100644 --- a/libraries/entities/src/EntityScriptingInterface.h +++ b/libraries/entities/src/EntityScriptingInterface.h @@ -114,6 +114,9 @@ public slots: Q_INVOKABLE void setZonesArePickable(bool value); Q_INVOKABLE bool getZonesArePickable() const; + Q_INVOKABLE void setDrawZoneBoundaries(bool value); + Q_INVOKABLE bool getDrawZoneBoundaries() const; + Q_INVOKABLE void setSendPhysicsUpdates(bool value); Q_INVOKABLE bool getSendPhysicsUpdates() const; From 1b558e7390bb9e15f3a313864478038a5d6cee1c Mon Sep 17 00:00:00 2001 From: Sam Gateau Date: Fri, 1 May 2015 13:37:04 -0700 Subject: [PATCH 15/26] investigating the semi transparent textured bug --- libraries/fbx/src/FBXReader.cpp | 8 ++++++-- libraries/render-utils/src/model.slf | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/libraries/fbx/src/FBXReader.cpp b/libraries/fbx/src/FBXReader.cpp index ca4ccc294f..396859f3f8 100644 --- a/libraries/fbx/src/FBXReader.cpp +++ b/libraries/fbx/src/FBXReader.cpp @@ -1746,8 +1746,12 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping, material.id = getID(object.properties); material._material = model::MaterialPointer(new model::Material()); - material._material->setEmissive(material.emissive); - material._material->setDiffuse(material.diffuse); + material._material->setEmissive(material.emissive); + if (glm::all(glm::equal(material.diffuse, glm::vec3(0.0f)))) { + material._material->setDiffuse(material.diffuse); + } else { + material._material->setDiffuse(material.diffuse); + } material._material->setSpecular(material.specular); material._material->setShininess(material.shininess); diff --git a/libraries/render-utils/src/model.slf b/libraries/render-utils/src/model.slf index 7648cac429..61c1319783 100755 --- a/libraries/render-utils/src/model.slf +++ b/libraries/render-utils/src/model.slf @@ -33,7 +33,7 @@ void main(void) { packDeferredFragment( normalize(interpolatedNormal.xyz), evalOpaqueFinalAlpha(getMaterialOpacity(mat), diffuse.a), - getMaterialDiffuse(mat) * diffuse.rgb * color, + /*getMaterialDiffuse(mat) **/ diffuse.rgb /** color*/, getMaterialSpecular(mat), getMaterialShininess(mat)); } From 560d89b38adfb8842eca2a827716e0ac2d085510 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Fri, 1 May 2015 14:56:03 -0700 Subject: [PATCH 16/26] session id can be null. don't crash --- libraries/physics/src/PhysicsEngine.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libraries/physics/src/PhysicsEngine.cpp b/libraries/physics/src/PhysicsEngine.cpp index 603aef731c..6f60fea013 100644 --- a/libraries/physics/src/PhysicsEngine.cpp +++ b/libraries/physics/src/PhysicsEngine.cpp @@ -376,11 +376,14 @@ void PhysicsEngine::doOwnershipInfection(const btCollisionObject* objectA, const auto nodeList = DependencyManager::get(); QUuid myNodeID = nodeList->getSessionUUID(); + + if (myNodeID.isNull()) { + return; + } + const btCollisionObject* characterCollisionObject = _characterController ? _characterController->getCollisionObject() : NULL; - assert(!myNodeID.isNull()); - ObjectMotionState* a = static_cast(objectA->getUserPointer()); ObjectMotionState* b = static_cast(objectB->getUserPointer()); EntityItem* entityA = a ? a->getEntity() : NULL; From ddec6943932d2eaa96d19b0b230a4fbbdc52e94b Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Fri, 1 May 2015 15:38:06 -0700 Subject: [PATCH 17/26] Update add-zone icon in edit.js --- examples/edit.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/edit.js b/examples/edit.js index 93c06c38f2..585b45f3f9 100644 --- a/examples/edit.js +++ b/examples/edit.js @@ -208,8 +208,8 @@ var toolBar = (function () { visible: false }); newZoneButton = toolBar.addTool({ - imageURL: toolIconUrl + "zonecube3.svg", - subImage: { x: 0, y: Tool.IMAGE_WIDTH + 208, width: 256, height: 256 }, + imageURL: toolIconUrl + "zonecube_text.svg", + subImage: { x: 0, y: 128, width: 128, height: 128 }, width: toolWidth, height: toolHeight, alpha: 0.9, From 2382183075a00ced40971df000be778d5b9de174 Mon Sep 17 00:00:00 2001 From: Sam Gateau Date: Fri, 1 May 2015 16:09:41 -0700 Subject: [PATCH 18/26] FIxed the bug about the tga not loading by recognizing the file format type from the filename extension and passing the info to the QImage::fromData() --- libraries/render-utils/src/TextureCache.cpp | 56 +++++++++++++-------- libraries/render-utils/src/model.slf | 2 +- 2 files changed, 35 insertions(+), 23 deletions(-) diff --git a/libraries/render-utils/src/TextureCache.cpp b/libraries/render-utils/src/TextureCache.cpp index 63ca43725b..cf4ba00893 100644 --- a/libraries/render-utils/src/TextureCache.cpp +++ b/libraries/render-utils/src/TextureCache.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -28,6 +29,8 @@ #include "gpu/GLBackend.h" +#include + TextureCache::TextureCache() : _permutationNormalTexture(0), _whiteTexture(0), @@ -344,27 +347,7 @@ NetworkTexture::NetworkTexture(const QUrl& url, TextureType type, const QByteArr _loaded = true; } - // default to white/blue/black - /* glBindTexture(GL_TEXTURE_2D, getID()); - switch (type) { - case NORMAL_TEXTURE: - loadSingleColorTexture(OPAQUE_BLUE); - break; - - case SPECULAR_TEXTURE: - loadSingleColorTexture(OPAQUE_BLACK); - break; - - case SPLAT_TEXTURE: - loadSingleColorTexture(TRANSPARENT_WHITE); - break; - - default: - loadSingleColorTexture(OPAQUE_WHITE); - break; - } - glBindTexture(GL_TEXTURE_2D, 0); - */ + std::string theName = url.toString().toStdString(); // if we have content, load it after we have our self pointer if (!content.isEmpty()) { _startedLoading = true; @@ -396,6 +379,17 @@ ImageReader::ImageReader(const QWeakPointer& texture, QNetworkReply* r _content(content) { } +std::once_flag onceListSuppoertedFormatsflag; +void listSupportedImageFormats() { + std::call_once(onceListSuppoertedFormatsflag, [](){ + auto supportedFormats = QImageReader::supportedImageFormats(); + qCDebug(renderutils) << "ImageReader:: List of supported formats:"; + foreach(const QByteArray& f, supportedFormats) { + qCDebug(renderutils) << "format = " << f; + } + }); +} + void ImageReader::run() { QSharedPointer texture = _texture.toStrongRef(); if (texture.isNull()) { @@ -409,11 +403,29 @@ void ImageReader::run() { _content = _reply->readAll(); _reply->deleteLater(); } - QImage image = QImage::fromData(_content); + listSupportedImageFormats(); + + // try to help the QImage loader by extracting the image file format from the url filename ext + // Some tga are not created properly for example without it + auto filename = _url.fileName().toStdString(); + auto filenameExtension = filename.substr(filename.find_last_of('.') + 1); + QImage image = QImage::fromData(_content, filenameExtension.c_str()); + + // Note that QImage.format is the pixel format which is different from the "format" of the image file... + auto imageFormat = image.format(); int originalWidth = image.width(); int originalHeight = image.height(); + if (originalWidth == 0 || originalHeight == 0 || imageFormat == QImage::Format_Invalid) { + if (filenameExtension.empty()) { + qCDebug(renderutils) << "QImage failed to create from content, no file extension:" << _url; + } else { + qCDebug(renderutils) << "QImage failed to create from content" << _url; + } + return; + } + // enforce a fixed maximum area (1024 * 2048) const int MAXIMUM_AREA_SIZE = 2097152; int imageArea = image.width() * image.height(); diff --git a/libraries/render-utils/src/model.slf b/libraries/render-utils/src/model.slf index 61c1319783..7648cac429 100755 --- a/libraries/render-utils/src/model.slf +++ b/libraries/render-utils/src/model.slf @@ -33,7 +33,7 @@ void main(void) { packDeferredFragment( normalize(interpolatedNormal.xyz), evalOpaqueFinalAlpha(getMaterialOpacity(mat), diffuse.a), - /*getMaterialDiffuse(mat) **/ diffuse.rgb /** color*/, + getMaterialDiffuse(mat) * diffuse.rgb * color, getMaterialSpecular(mat), getMaterialShininess(mat)); } From 4eac60b463a9645f606015263599e79aa2593814 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Fri, 1 May 2015 16:34:44 -0700 Subject: [PATCH 19/26] try harder to make sure all the assignment-client children stop --- .../src/AssignmentClientMonitor.cpp | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/assignment-client/src/AssignmentClientMonitor.cpp b/assignment-client/src/AssignmentClientMonitor.cpp index df77e33ef0..7392a47160 100644 --- a/assignment-client/src/AssignmentClientMonitor.cpp +++ b/assignment-client/src/AssignmentClientMonitor.cpp @@ -91,7 +91,26 @@ void AssignmentClientMonitor::stopChildProcesses() { }); // try to give all the children time to shutdown - waitOnChildren(15000); + waitOnChildren(200); + + // ask more firmly + QMutableListIterator i(_childProcesses); + while (i.hasNext()) { + QProcess* childProcess = i.next(); + childProcess->kill(); + } + + // try to give all the children time to shutdown + waitOnChildren(200); + + // ask even more firmly + QMutableListIterator j(_childProcesses); + while (j.hasNext()) { + QProcess* childProcess = j.next(); + childProcess->terminate(); + } + + waitOnChildren(200); } void AssignmentClientMonitor::aboutToQuit() { From f9802a1072e5a284c11385d2fc36d2c327cbfb38 Mon Sep 17 00:00:00 2001 From: Sam Gateau Date: Fri, 1 May 2015 16:39:25 -0700 Subject: [PATCH 20/26] IMprove the message --- libraries/render-utils/src/TextureCache.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libraries/render-utils/src/TextureCache.cpp b/libraries/render-utils/src/TextureCache.cpp index cf4ba00893..616ff13dce 100644 --- a/libraries/render-utils/src/TextureCache.cpp +++ b/libraries/render-utils/src/TextureCache.cpp @@ -383,10 +383,11 @@ std::once_flag onceListSuppoertedFormatsflag; void listSupportedImageFormats() { std::call_once(onceListSuppoertedFormatsflag, [](){ auto supportedFormats = QImageReader::supportedImageFormats(); - qCDebug(renderutils) << "ImageReader:: List of supported formats:"; + QString formats; foreach(const QByteArray& f, supportedFormats) { - qCDebug(renderutils) << "format = " << f; - } + formats += QString(f) + ","; + } + qCDebug(renderutils) << "List of supported Image formats:" << formats; }); } From 23c44500d8f338ffaea00658146dc8e17b5be9e9 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Fri, 1 May 2015 16:45:04 -0700 Subject: [PATCH 21/26] no magic numbers --- assignment-client/src/AssignmentClientMonitor.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/assignment-client/src/AssignmentClientMonitor.cpp b/assignment-client/src/AssignmentClientMonitor.cpp index 7392a47160..873a79a414 100644 --- a/assignment-client/src/AssignmentClientMonitor.cpp +++ b/assignment-client/src/AssignmentClientMonitor.cpp @@ -22,6 +22,7 @@ const QString ASSIGNMENT_CLIENT_MONITOR_TARGET_NAME = "assignment-client-monitor"; +const int WAIT_FOR_CHILD_MSECS = 500; AssignmentClientMonitor::AssignmentClientMonitor(const unsigned int numAssignmentClientForks, const unsigned int minAssignmentClientForks, @@ -91,7 +92,7 @@ void AssignmentClientMonitor::stopChildProcesses() { }); // try to give all the children time to shutdown - waitOnChildren(200); + waitOnChildren(WAIT_FOR_CHILD_MSECS); // ask more firmly QMutableListIterator i(_childProcesses); @@ -101,7 +102,7 @@ void AssignmentClientMonitor::stopChildProcesses() { } // try to give all the children time to shutdown - waitOnChildren(200); + waitOnChildren(WAIT_FOR_CHILD_MSECS); // ask even more firmly QMutableListIterator j(_childProcesses); @@ -110,7 +111,7 @@ void AssignmentClientMonitor::stopChildProcesses() { childProcess->terminate(); } - waitOnChildren(200); + waitOnChildren(WAIT_FOR_CHILD_MSECS); } void AssignmentClientMonitor::aboutToQuit() { From 9f1cb2a4e54a17c8a8eb9e600495f220bc444c66 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Fri, 1 May 2015 16:56:39 -0700 Subject: [PATCH 22/26] fix kill/terminate order --- assignment-client/src/AssignmentClientMonitor.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/assignment-client/src/AssignmentClientMonitor.cpp b/assignment-client/src/AssignmentClientMonitor.cpp index 873a79a414..6414f33644 100644 --- a/assignment-client/src/AssignmentClientMonitor.cpp +++ b/assignment-client/src/AssignmentClientMonitor.cpp @@ -98,7 +98,7 @@ void AssignmentClientMonitor::stopChildProcesses() { QMutableListIterator i(_childProcesses); while (i.hasNext()) { QProcess* childProcess = i.next(); - childProcess->kill(); + childProcess->terminate(); } // try to give all the children time to shutdown @@ -108,7 +108,7 @@ void AssignmentClientMonitor::stopChildProcesses() { QMutableListIterator j(_childProcesses); while (j.hasNext()) { QProcess* childProcess = j.next(); - childProcess->terminate(); + childProcess->kill(); } waitOnChildren(WAIT_FOR_CHILD_MSECS); From 0341caad9572a0ffbc95f6ff257776cdb0298ed1 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Sun, 3 May 2015 11:10:52 -0700 Subject: [PATCH 23/26] quiet compiler --- interface/src/Application.cpp | 9 +++++---- interface/src/avatar/Avatar.cpp | 3 --- libraries/gpu/src/gpu/GLBackendOutput.cpp | 2 +- libraries/ui/src/VrMenu.cpp | 17 +++++++++++------ 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index bfda9629a0..fe92972f48 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -989,11 +989,12 @@ bool Application::importSVOFromURL(const QString& urlString) { } bool Application::event(QEvent* event) { - switch (event->type()) { - case Lambda: - ((LambdaEvent*)event)->call(); - return true; + if ((int)event->type() == (int)Lambda) { + ((LambdaEvent*)event)->call(); + return true; + } + switch (event->type()) { case QEvent::MouseMove: mouseMoveEvent((QMouseEvent*)event); return true; diff --git a/interface/src/avatar/Avatar.cpp b/interface/src/avatar/Avatar.cpp index 05f834255c..8083e153fe 100644 --- a/interface/src/avatar/Avatar.cpp +++ b/interface/src/avatar/Avatar.cpp @@ -723,9 +723,6 @@ void Avatar::renderDisplayName() { .arg(getReceiveRate()); } - QByteArray ba = _displayName.toLocal8Bit(); - const char* text = ba.data(); - glDisable(GL_POLYGON_OFFSET_FILL); textRenderer(DISPLAYNAME)->draw(text_x, text_y, renderedDisplayName, color); diff --git a/libraries/gpu/src/gpu/GLBackendOutput.cpp b/libraries/gpu/src/gpu/GLBackendOutput.cpp index 7b2deb64d2..b0dee550d9 100755 --- a/libraries/gpu/src/gpu/GLBackendOutput.cpp +++ b/libraries/gpu/src/gpu/GLBackendOutput.cpp @@ -83,7 +83,7 @@ GLBackend::GLFramebuffer* GLBackend::syncGPUObject(const Framebuffer& framebuffe glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA, framebuffer.getWidth(), framebuffer.getHeight()); glBindRenderbuffer(GL_RENDERBUFFER, 0); glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, renderBuffer); - CHECK_GL_ERROR(); + (void) CHECK_GL_ERROR(); } #endif diff --git a/libraries/ui/src/VrMenu.cpp b/libraries/ui/src/VrMenu.cpp index 5c0f8fb732..b6cb0b136b 100644 --- a/libraries/ui/src/VrMenu.cpp +++ b/libraries/ui/src/VrMenu.cpp @@ -102,9 +102,12 @@ class QQuickMenuItem; QObject* addItem(QObject* parent, const QString& text) { // FIXME add more checking here to ensure no name conflicts QQuickMenuItem* returnedValue{ nullptr }; - bool invokeResult = QMetaObject::invokeMethod(parent, "addItem", Qt::DirectConnection, - Q_RETURN_ARG(QQuickMenuItem*, returnedValue), - Q_ARG(QString, text)); + #ifndef QT_NO_DEBUG + bool invokeResult = + #endif + QMetaObject::invokeMethod(parent, "addItem", Qt::DirectConnection, Q_RETURN_ARG(QQuickMenuItem*, returnedValue), + Q_ARG(QString, text)); + Q_ASSERT(invokeResult); QObject* result = reinterpret_cast(returnedValue); return result; @@ -203,9 +206,11 @@ void VrMenu::insertAction(QAction* before, QAction* action) { result = ::addItem(menu, action->text()); } else { QQuickMenuItem* returnedValue{ nullptr }; - bool invokeResult = QMetaObject::invokeMethod(menu, "insertItem", Qt::DirectConnection, - Q_RETURN_ARG(QQuickMenuItem*, returnedValue), - Q_ARG(int, index), Q_ARG(QString, action->text())); + #ifndef QT_NO_DEBUG + bool invokeResult = + #endif + QMetaObject::invokeMethod(menu, "insertItem", Qt::DirectConnection, Q_RETURN_ARG(QQuickMenuItem*, returnedValue), + Q_ARG(int, index), Q_ARG(QString, action->text())); Q_ASSERT(invokeResult); result = reinterpret_cast(returnedValue); } From 1dcc2f7988dd8bf394a40ac7369239fb9bf73799 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Mon, 4 May 2015 15:26:43 +0200 Subject: [PATCH 24/26] Fix local injector modifying system volume --- libraries/audio-client/src/AudioClient.cpp | 4 +--- libraries/audio-client/src/AudioClient.h | 2 +- libraries/audio/src/AbstractAudioInterface.h | 2 +- libraries/audio/src/AudioInjector.cpp | 3 ++- .../audio/src/AudioInjectorLocalBuffer.cpp | 19 ++++++++++++++++--- .../audio/src/AudioInjectorLocalBuffer.h | 8 ++++++-- 6 files changed, 27 insertions(+), 11 deletions(-) diff --git a/libraries/audio-client/src/AudioClient.cpp b/libraries/audio-client/src/AudioClient.cpp index 331e62ec70..36308f6576 100644 --- a/libraries/audio-client/src/AudioClient.cpp +++ b/libraries/audio-client/src/AudioClient.cpp @@ -981,7 +981,7 @@ void AudioClient::selectAudioSourceSine440() { _noiseSourceEnabled = false; } -bool AudioClient::outputLocalInjector(bool isStereo, qreal volume, AudioInjector* injector) { +bool AudioClient::outputLocalInjector(bool isStereo, AudioInjector* injector) { if (injector->getLocalBuffer()) { QAudioFormat localFormat = _desiredOutputFormat; localFormat.setChannelCount(isStereo ? 2 : 1); @@ -990,8 +990,6 @@ bool AudioClient::outputLocalInjector(bool isStereo, qreal volume, AudioInjector localFormat, injector->getLocalBuffer()); - localOutput->setVolume(volume); - // move the localOutput to the same thread as the local injector buffer localOutput->moveToThread(injector->getLocalBuffer()->thread()); diff --git a/libraries/audio-client/src/AudioClient.h b/libraries/audio-client/src/AudioClient.h index 9d10184d13..f9392c6a10 100644 --- a/libraries/audio-client/src/AudioClient.h +++ b/libraries/audio-client/src/AudioClient.h @@ -157,7 +157,7 @@ public slots: void setOutputBufferSize(int numFrames); - virtual bool outputLocalInjector(bool isStereo, qreal volume, AudioInjector* injector); + virtual bool outputLocalInjector(bool isStereo, AudioInjector* injector); bool switchInputToAudioDevice(const QString& inputDeviceName); bool switchOutputToAudioDevice(const QString& outputDeviceName); diff --git a/libraries/audio/src/AbstractAudioInterface.h b/libraries/audio/src/AbstractAudioInterface.h index a5855d75d1..4961e9b58c 100644 --- a/libraries/audio/src/AbstractAudioInterface.h +++ b/libraries/audio/src/AbstractAudioInterface.h @@ -26,7 +26,7 @@ public: AbstractAudioInterface(QObject* parent = 0) : QObject(parent) {}; public slots: - virtual bool outputLocalInjector(bool isStereo, qreal volume, AudioInjector* injector) = 0; + virtual bool outputLocalInjector(bool isStereo, AudioInjector* injector) = 0; virtual void enableAudioSourceInject(bool enable) = 0; virtual void selectAudioSourcePinkNoise() = 0; diff --git a/libraries/audio/src/AudioInjector.cpp b/libraries/audio/src/AudioInjector.cpp index 95db7e6d0b..26140b82c8 100644 --- a/libraries/audio/src/AudioInjector.cpp +++ b/libraries/audio/src/AudioInjector.cpp @@ -105,11 +105,12 @@ void AudioInjector::injectLocally() { _localBuffer->open(QIODevice::ReadOnly); _localBuffer->setShouldLoop(_options.loop); + _localBuffer->setVolume(_options.volume); // give our current send position to the local buffer _localBuffer->setCurrentOffset(_currentSendPosition); - success = _localAudioInterface->outputLocalInjector(_options.stereo, _options.volume, this); + success = _localAudioInterface->outputLocalInjector(_options.stereo, this); // if we're not looping and the buffer tells us it is empty then emit finished connect(_localBuffer, &AudioInjectorLocalBuffer::bufferEmpty, this, &AudioInjector::stop); diff --git a/libraries/audio/src/AudioInjectorLocalBuffer.cpp b/libraries/audio/src/AudioInjectorLocalBuffer.cpp index 1b2d44fe24..f40e613437 100644 --- a/libraries/audio/src/AudioInjectorLocalBuffer.cpp +++ b/libraries/audio/src/AudioInjectorLocalBuffer.cpp @@ -16,7 +16,8 @@ AudioInjectorLocalBuffer::AudioInjectorLocalBuffer(const QByteArray& rawAudioArr _rawAudioArray(rawAudioArray), _shouldLoop(false), _isStopped(false), - _currentOffset(0) + _currentOffset(0), + _volume(1.0f) { } @@ -35,6 +36,18 @@ bool AudioInjectorLocalBuffer::seek(qint64 pos) { } } +void copy(char* to, char* from, int size, qreal factor) { + int16_t* toArray = (int16_t*) to; + int16_t* fromArray = (int16_t*) from; + int sampleSize = size / sizeof(int16_t); + + for (int i = 0; i < sampleSize; i++) { + *toArray = factor * (*fromArray); + toArray++; + fromArray++; + } +} + qint64 AudioInjectorLocalBuffer::readData(char* data, qint64 maxSize) { if (!_isStopped) { @@ -47,7 +60,7 @@ qint64 AudioInjectorLocalBuffer::readData(char* data, qint64 maxSize) { bytesRead = bytesToEnd; } - memcpy(data, _rawAudioArray.data() + _currentOffset, bytesRead); + copy(data, _rawAudioArray.data() + _currentOffset, bytesRead, _volume); // now check if we are supposed to loop and if we can copy more from the beginning if (_shouldLoop && maxSize != bytesRead) { @@ -78,7 +91,7 @@ qint64 AudioInjectorLocalBuffer::recursiveReadFromFront(char* data, qint64 maxSi } // copy that amount - memcpy(data, _rawAudioArray.data(), bytesRead); + copy(data, _rawAudioArray.data(), bytesRead, _volume); // check if we need to call ourselves again and pull from the front again if (bytesRead < maxSize) { diff --git a/libraries/audio/src/AudioInjectorLocalBuffer.h b/libraries/audio/src/AudioInjectorLocalBuffer.h index ce41052730..9753cbbd83 100644 --- a/libraries/audio/src/AudioInjectorLocalBuffer.h +++ b/libraries/audio/src/AudioInjectorLocalBuffer.h @@ -14,6 +14,8 @@ #include +#include + class AudioInjectorLocalBuffer : public QIODevice { Q_OBJECT public: @@ -27,12 +29,13 @@ public: qint64 writeData(const char* data, qint64 maxSize) { return 0; } void setShouldLoop(bool shouldLoop) { _shouldLoop = shouldLoop; } - void setCurrentOffset(int currentOffset) { _currentOffset = currentOffset; } + void setVolume(float volume) { _volume = glm::clamp(volume, 0.0f, 1.0f); } + signals: void bufferEmpty(); -private: +private: qint64 recursiveReadFromFront(char* data, qint64 maxSize); QByteArray _rawAudioArray; @@ -40,6 +43,7 @@ private: bool _isStopped; int _currentOffset; + float _volume; }; #endif // hifi_AudioInjectorLocalBuffer_h \ No newline at end of file From fc1519c078213017854b848bfe6f635818e5e53d Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Mon, 4 May 2015 16:49:33 +0200 Subject: [PATCH 25/26] Quiet compiler --- interface/src/devices/DdeFaceTracker.cpp | 3 --- interface/src/devices/OculusManager.cpp | 2 +- libraries/octree/src/OctreeHeadlessViewer.h | 3 ++- libraries/physics/src/ObjectMotionState.cpp | 5 ----- libraries/render-utils/src/FboCache.cpp | 2 +- 5 files changed, 4 insertions(+), 11 deletions(-) diff --git a/interface/src/devices/DdeFaceTracker.cpp b/interface/src/devices/DdeFaceTracker.cpp index b6525ffb52..1ba623ca20 100644 --- a/interface/src/devices/DdeFaceTracker.cpp +++ b/interface/src/devices/DdeFaceTracker.cpp @@ -136,9 +136,6 @@ struct Packet { const float STARTING_DDE_MESSAGE_TIME = 0.033f; -const int FPS_TIMER_DELAY = 2000; // ms -const int FPS_TIMER_DURATION = 2000; // ms - #ifdef WIN32 // warning C4351: new behavior: elements of array 'DdeFaceTracker::_lastEyeBlinks' will be default initialized // warning C4351: new behavior: elements of array 'DdeFaceTracker::_filteredEyeBlinks' will be default initialized diff --git a/interface/src/devices/OculusManager.cpp b/interface/src/devices/OculusManager.cpp index 7d719873f4..5405c76b65 100644 --- a/interface/src/devices/OculusManager.cpp +++ b/interface/src/devices/OculusManager.cpp @@ -461,7 +461,7 @@ void OculusManager::display(const glm::quat &bodyOrientation, const glm::vec3 &p #ifdef DEBUG // Ensure the frame counter always increments by exactly 1 static int oldFrameIndex = -1; - assert(oldFrameIndex == -1 || oldFrameIndex == _frameIndex - 1); + assert(oldFrameIndex == -1 || (unsigned int)oldFrameIndex == _frameIndex - 1); oldFrameIndex = _frameIndex; #endif diff --git a/libraries/octree/src/OctreeHeadlessViewer.h b/libraries/octree/src/OctreeHeadlessViewer.h index 9a6a5c7102..2adb33d3bf 100644 --- a/libraries/octree/src/OctreeHeadlessViewer.h +++ b/libraries/octree/src/OctreeHeadlessViewer.h @@ -34,7 +34,8 @@ public: virtual void init(); virtual void render(RenderArgs::RenderMode renderMode = RenderArgs::DEFAULT_RENDER_MODE, - RenderArgs::RenderSide renderSide = RenderArgs::MONO) { /* swallow these */ } + RenderArgs::RenderSide renderSide = RenderArgs::MONO, + RenderArgs::DebugFlags renderDebugFlags = RenderArgs::RENDER_DEBUG_NONE) { /* swallow these */ } void setJurisdictionListener(JurisdictionListener* jurisdictionListener) { _jurisdictionListener = jurisdictionListener; } diff --git a/libraries/physics/src/ObjectMotionState.cpp b/libraries/physics/src/ObjectMotionState.cpp index d8eb86f0b4..350556b3a8 100644 --- a/libraries/physics/src/ObjectMotionState.cpp +++ b/libraries/physics/src/ObjectMotionState.cpp @@ -17,11 +17,6 @@ #include "PhysicsHelpers.h" #include "PhysicsLogging.h" -const float DEFAULT_FRICTION = 0.5f; -const float MAX_FRICTION = 10.0f; - -const float DEFAULT_RESTITUTION = 0.5f; - // origin of physics simulation in world-frame glm::vec3 _worldOffset(0.0f); diff --git a/libraries/render-utils/src/FboCache.cpp b/libraries/render-utils/src/FboCache.cpp index 2ca3d47bdf..de2b483573 100644 --- a/libraries/render-utils/src/FboCache.cpp +++ b/libraries/render-utils/src/FboCache.cpp @@ -24,7 +24,7 @@ void FboCache::lockTexture(int texture) { withLock(_lock, [&] { Q_ASSERT(_fboMap.count(texture)); if (!_fboLocks.count(texture)) { - Q_ASSERT(_readyFboQueue.front()->texture() == texture); + Q_ASSERT(_readyFboQueue.front()->texture() == (GLuint)texture); _readyFboQueue.pop_front(); _fboLocks[texture] = 1; } else { From 9a6e442b25f3f17820ba74eda1ea254fbe228d83 Mon Sep 17 00:00:00 2001 From: Thijs Wenker Date: Mon, 4 May 2015 18:07:48 +0200 Subject: [PATCH 26/26] Fix for RealSense menu item This was missed while moving to the new MenuWrapper class. --- interface/src/Menu.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/src/Menu.cpp b/interface/src/Menu.cpp index 90a9d3b22c..8070bd5555 100644 --- a/interface/src/Menu.cpp +++ b/interface/src/Menu.cpp @@ -439,7 +439,7 @@ Menu::Menu() { addCheckableActionToQMenuAndActionHash(leapOptionsMenu, MenuOption::LeapMotionOnHMD, 0, false); #ifdef HAVE_RSSDK - QMenu* realSenseOptionsMenu = handOptionsMenu->addMenu("RealSense"); + MenuWrapper* realSenseOptionsMenu = handOptionsMenu->addMenu("RealSense"); addActionToQMenuAndActionHash(realSenseOptionsMenu, MenuOption::LoadRSSDKFile, 0, RealSense::getInstance(), SLOT(loadRSSDKFile())); #endif