From f5d12ee2c60a139cbde514d3a398cdbe098f60f3 Mon Sep 17 00:00:00 2001 From: black plastick Date: Mon, 26 Oct 2015 17:46:08 -0400 Subject: [PATCH 01/29] Added AvatarList script events for assigment client scripts: AvatarList.avatarAddedEvent(sessionUUID); AvatarList.avatarRemovedEvent(sessionUUID); --- assignment-client/src/avatars/AvatarMixer.cpp | 4 ++-- libraries/avatars/src/AvatarHashMap.cpp | 4 +++- libraries/avatars/src/AvatarHashMap.h | 4 ++++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/assignment-client/src/avatars/AvatarMixer.cpp b/assignment-client/src/avatars/AvatarMixer.cpp index 833b53b729..ae6a8247c1 100644 --- a/assignment-client/src/avatars/AvatarMixer.cpp +++ b/assignment-client/src/avatars/AvatarMixer.cpp @@ -254,10 +254,10 @@ void AvatarMixer::broadcastAvatarData() { // potentially update the max full rate distance for this frame maxAvatarDistanceThisFrame = std::max(maxAvatarDistanceThisFrame, distanceToAvatar); - if (distanceToAvatar != 0.0f + if (distanceToAvatar != 0.0f && distribution(generator) > (nodeData->getFullRateDistance() / distanceToAvatar)) { return; - } + } AvatarDataSequenceNumber lastSeqToReceiver = nodeData->getLastBroadcastSequenceNumber(otherNode->getUUID()); AvatarDataSequenceNumber lastSeqFromSender = otherNodeData->getLastReceivedSequenceNumber(); diff --git a/libraries/avatars/src/AvatarHashMap.cpp b/libraries/avatars/src/AvatarHashMap.cpp index 520bb34887..c02fe98b19 100644 --- a/libraries/avatars/src/AvatarHashMap.cpp +++ b/libraries/avatars/src/AvatarHashMap.cpp @@ -44,7 +44,7 @@ AvatarSharedPointer AvatarHashMap::addAvatar(const QUuid& sessionUUID, const QWe avatar->setSessionUUID(sessionUUID); avatar->setOwningAvatarMixer(mixerWeakPointer); _avatarHash.insert(sessionUUID, avatar); - + emit avatarAddedEvent(sessionUUID); return avatar; } @@ -131,10 +131,12 @@ void AvatarHashMap::processKillAvatar(QSharedPointer packet, SharedNod // read the node id QUuid sessionUUID = QUuid::fromRfc4122(packet->readWithoutCopy(NUM_BYTES_RFC4122_UUID)); removeAvatar(sessionUUID); + } void AvatarHashMap::removeAvatar(const QUuid& sessionUUID) { _avatarHash.remove(sessionUUID); + emit avatarRemovedEvent(sessionUUID); } void AvatarHashMap::sessionUUIDChanged(const QUuid& sessionUUID, const QUuid& oldUUID) { diff --git a/libraries/avatars/src/AvatarHashMap.h b/libraries/avatars/src/AvatarHashMap.h index 804233b76a..f90c61ec4d 100644 --- a/libraries/avatars/src/AvatarHashMap.h +++ b/libraries/avatars/src/AvatarHashMap.h @@ -33,6 +33,10 @@ public: const AvatarHash& getAvatarHash() { return _avatarHash; } int size() { return _avatarHash.size(); } +signals: + void avatarAddedEvent(const QUuid& sessionUUID); + void avatarRemovedEvent(const QUuid& sessionUUID); + public slots: bool isAvatarInRange(const glm::vec3 & position, const float range); From d34fc35544fa38715d1990f0e09f3201c1f68679 Mon Sep 17 00:00:00 2001 From: black plastick Date: Tue, 27 Oct 2015 08:11:20 -0400 Subject: [PATCH 02/29] added AvatarList.avatarSessionChanged(sessionUUID, oldUUID) for AC scripts. --- assignment-client/src/avatars/AvatarMixer.cpp | 6 +++--- libraries/avatars/src/AvatarHashMap.cpp | 1 + libraries/avatars/src/AvatarHashMap.h | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/assignment-client/src/avatars/AvatarMixer.cpp b/assignment-client/src/avatars/AvatarMixer.cpp index ae6a8247c1..0a455891f9 100644 --- a/assignment-client/src/avatars/AvatarMixer.cpp +++ b/assignment-client/src/avatars/AvatarMixer.cpp @@ -254,10 +254,10 @@ void AvatarMixer::broadcastAvatarData() { // potentially update the max full rate distance for this frame maxAvatarDistanceThisFrame = std::max(maxAvatarDistanceThisFrame, distanceToAvatar); - if (distanceToAvatar != 0.0f + if (distanceToAvatar != 0.0f && distribution(generator) > (nodeData->getFullRateDistance() / distanceToAvatar)) { - return; - } + return; + } AvatarDataSequenceNumber lastSeqToReceiver = nodeData->getLastBroadcastSequenceNumber(otherNode->getUUID()); AvatarDataSequenceNumber lastSeqFromSender = otherNodeData->getLastReceivedSequenceNumber(); diff --git a/libraries/avatars/src/AvatarHashMap.cpp b/libraries/avatars/src/AvatarHashMap.cpp index c02fe98b19..ddc9160041 100644 --- a/libraries/avatars/src/AvatarHashMap.cpp +++ b/libraries/avatars/src/AvatarHashMap.cpp @@ -141,4 +141,5 @@ void AvatarHashMap::removeAvatar(const QUuid& sessionUUID) { void AvatarHashMap::sessionUUIDChanged(const QUuid& sessionUUID, const QUuid& oldUUID) { _lastOwnerSessionUUID = oldUUID; + emit avatarSessionChangedEvent(sessionUUID, oldUUID); } diff --git a/libraries/avatars/src/AvatarHashMap.h b/libraries/avatars/src/AvatarHashMap.h index f90c61ec4d..c0c511bc3a 100644 --- a/libraries/avatars/src/AvatarHashMap.h +++ b/libraries/avatars/src/AvatarHashMap.h @@ -36,6 +36,7 @@ public: signals: void avatarAddedEvent(const QUuid& sessionUUID); void avatarRemovedEvent(const QUuid& sessionUUID); + void avatarSessionChangedEvent(const QUuid& sessionUUID,const QUuid& oldUUID); public slots: bool isAvatarInRange(const glm::vec3 & position, const float range); From 8a85468254d5cdbbc79a38528ed4e78cf25453eb Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Tue, 27 Oct 2015 10:39:44 -0700 Subject: [PATCH 03/29] changing model, repositioning --- .../whiteboard/whiteboardEntityScript.js | 2 +- .../painting/whiteboard/whiteboardSpawner.js | 241 ++++++++---------- 2 files changed, 107 insertions(+), 136 deletions(-) diff --git a/examples/painting/whiteboard/whiteboardEntityScript.js b/examples/painting/whiteboard/whiteboardEntityScript.js index f38073f389..2d34fc8c40 100644 --- a/examples/painting/whiteboard/whiteboardEntityScript.js +++ b/examples/painting/whiteboard/whiteboardEntityScript.js @@ -239,7 +239,7 @@ unload: function() { Overlays.deleteOverlay(this.laserPointer); - // this.eraseBoard(); + this.eraseBoard(); } }; diff --git a/examples/painting/whiteboard/whiteboardSpawner.js b/examples/painting/whiteboard/whiteboardSpawner.js index cbc26da670..0804b992c7 100644 --- a/examples/painting/whiteboard/whiteboardSpawner.js +++ b/examples/painting/whiteboard/whiteboardSpawner.js @@ -16,13 +16,16 @@ Script.include("../../libraries/utils.js"); var scriptURL = Script.resolvePath("whiteboardEntityScript.js"); +//var modelURL = "https://hifi-public.s3.amazonaws.com/ozan/support/for_eric/whiteboard/whiteboard.fbx"; +var modelURL = "http://localhost:8080/whiteboard.fbx?v1" + Math.random(); var rotation = Quat.safeEulerAngles(Camera.getOrientation()); rotation = Quat.fromPitchYawRollDegrees(0, rotation.y, 0); var center = Vec3.sum(MyAvatar.position, Vec3.multiply(3, Quat.getFront(rotation))); -center.y += 0.4; + +var whiteboardDimensions, colorIndicator, eraseAllText +var colorBoxes = []; var colors = [ - hexToRgb("#2F8E84"), hexToRgb("#66CCB3"), hexToRgb("#A43C37"), hexToRgb("#491849"), @@ -30,21 +33,13 @@ var colors = [ hexToRgb("#993369"), hexToRgb("#9B47C2") ]; - -//WHITEBOARD -var whiteboardDimensions = { - x: 2, - y: 1.5, - z: 0.08 -}; var whiteboard = Entities.addEntity({ type: "Model", - modelURL: "https://hifi-public.s3.amazonaws.com/ozan/support/for_eric/whiteboard/whiteboard.fbx", + modelURL: modelURL, name: "whiteboard", position: center, rotation: rotation, script: scriptURL, - dimensions: whiteboardDimensions, color: { red: 255, green: 255, @@ -52,144 +47,119 @@ var whiteboard = Entities.addEntity({ } }); +Script.setTimeout(function() { + whiteboardDimensions = Entities.getEntityProperties(whiteboard, "naturalDimensions").naturalDimensions; + setUp(); +}, 500) -// COLOR INDICATOR BOX -var colorIndicatorDimensions = { - x: whiteboardDimensions.x, - y: 0.05, - z: 0.02 -}; -scriptURL = Script.resolvePath("colorIndicatorEntityScript.js"); -var colorIndicatorPosition = Vec3.sum(center, { - x: 0, - y: whiteboardDimensions.y / 2 + colorIndicatorDimensions.y / 2, - z: 0 -}); -var colorIndicatorBox = Entities.addEntity({ - type: "Box", - name: "Color Indicator", - color: colors[0], - rotation: rotation, - position: colorIndicatorPosition, - dimensions: colorIndicatorDimensions, - script: scriptURL, - userData: JSON.stringify({ - whiteboard: whiteboard - }) -}); -Entities.editEntity(whiteboard, { - userData: JSON.stringify({ - color: { - currentColor: colors[0] - }, - colorIndicator: colorIndicatorBox - }) -}); - -//COLOR BOXES -var direction = Quat.getRight(rotation); -var colorBoxPosition = Vec3.subtract(center, Vec3.multiply(direction, whiteboardDimensions.x / 2)); -var colorBoxes = []; -var colorSquareDimensions = { - x: (whiteboardDimensions.x / 2) / (colors.length - 1), - y: 0.1, - z: 0.05 -}; -colorBoxPosition.y += whiteboardDimensions.y / 2 + colorIndicatorDimensions.y + colorSquareDimensions.y / 2; -var spaceBetweenColorBoxes = Vec3.multiply(direction, colorSquareDimensions.x * 2); -var scriptURL = Script.resolvePath("colorSelectorEntityScript.js"); -for (var i = 0; i < colors.length; i++) { - var colorBox = Entities.addEntity({ +function setUp() { + // COLOR INDICATOR BOX + var colorIndicatorDimensions = { + x: whiteboardDimensions.x, + y: 0.05, + z: 0.02 + }; + scriptURL = Script.resolvePath("colorIndicatorEntityScript.js"); + var colorIndicatorPosition = Vec3.sum(center, { + x: 0, + y: whiteboardDimensions.y / 2 + colorIndicatorDimensions.y / 2, + z: 0 + }); + colorIndicatorBox = Entities.addEntity({ type: "Box", - name: "Color Selector", - position: colorBoxPosition, - dimensions: colorSquareDimensions, + name: "Color Indicator", + color: colors[0], rotation: rotation, - color: colors[i], + position: colorIndicatorPosition, + dimensions: colorIndicatorDimensions, script: scriptURL, userData: JSON.stringify({ - whiteboard: whiteboard, + whiteboard: whiteboard + }) + }); + + Entities.editEntity(whiteboard, { + userData: JSON.stringify({ + color: { + currentColor: colors[0] + }, colorIndicator: colorIndicatorBox }) }); - colorBoxes.push(colorBox); - colorBoxPosition = Vec3.sum(colorBoxPosition, spaceBetweenColorBoxes); + + //COLOR BOXES + var direction = Quat.getRight(rotation); + var colorBoxPosition = Vec3.subtract(center, Vec3.multiply(direction, whiteboardDimensions.x / 2)); + var colorSquareDimensions = { + x: 0.1, + y: 0.1, + z: 0.002 + }; + colorBoxPosition.y += whiteboardDimensions.y / 2 + colorIndicatorDimensions.y + colorSquareDimensions.y / 2; + var spaceBetweenColorBoxes = Vec3.multiply(direction, colorSquareDimensions.x * 2); + var scriptURL = Script.resolvePath("colorSelectorEntityScript.js"); + for (var i = 0; i < colors.length; i++) { + var colorBox = Entities.addEntity({ + type: "Box", + name: "Color Selector", + position: colorBoxPosition, + dimensions: colorSquareDimensions, + rotation: rotation, + color: colors[i], + script: scriptURL, + userData: JSON.stringify({ + whiteboard: whiteboard, + colorIndicator: colorIndicatorBox + }) + }); + colorBoxes.push(colorBox); + colorBoxPosition = Vec3.sum(colorBoxPosition, spaceBetweenColorBoxes); + } + + + + var eraseBoxDimensions = { + x: 0.5, + y: 0.1, + z: 0.01 + }; + + + var eraseBoxPosition = Vec3.sum(center, Vec3.multiply(direction, whiteboardDimensions.x / 2 + eraseBoxDimensions.x / 2 + 0.01)); + eraseBoxPosition.y += 0.3; + scriptURL = Script.resolvePath("eraseBoardEntityScript.js"); + eraseAllText = Entities.addEntity({ + type: "Text", + position: eraseBoxPosition, + name: "Eraser", + script: scriptURL, + rotation: rotation, + dimensions: eraseBoxDimensions, + backgroundColor: { + red: 0, + green: 60, + blue: 0 + }, + textColor: { + red: 255, + green: 10, + blue: 10 + }, + text: "ERASE BOARD", + lineHeight: 0.07, + userData: JSON.stringify({ + whiteboard: whiteboard + }) + }); + + + } - -// BLACK BOX -var blackBoxDimensions = { - x: 0.3, - y: 0.3, - z: 0.01 -}; - -colorBoxPosition = Vec3.subtract(center, Vec3.multiply(direction, whiteboardDimensions.x / 2 + blackBoxDimensions.x / 2 - 0.01)); -colorBoxPosition.y += 0.3; -var fragShaderURL = Script.resolvePath('blackInk.fs?v1' + Math.random()); -var blackBox = Entities.addEntity({ - type: 'Box', - name: "Black Color", - position: colorBoxPosition, - dimensions: blackBoxDimensions, - rotation: rotation, - color: { - red: 0, - green: 0, - blue: 0 - }, - script: scriptURL, - userData: JSON.stringify({ - whiteboard: whiteboard, - version: 2, - ProceduralEntity: { - shaderUrl: fragShaderURL - } - }) -}); - - -var eraseBoxDimensions = { - x: 0.5, - y: 0.1, - z: 0.01 -}; - - -var eraseBoxPosition = Vec3.sum(center, Vec3.multiply(direction, whiteboardDimensions.x / 2 + eraseBoxDimensions.x / 2 + 0.01)); -eraseBoxPosition.y += 0.3; -scriptURL = Script.resolvePath("eraseBoardEntityScript.js"); -var eraseAllText = Entities.addEntity({ - type: "Text", - position: eraseBoxPosition, - name: "Eraser", - script: scriptURL, - rotation: rotation, - dimensions: eraseBoxDimensions, - backgroundColor: { - red: 0, - green: 60, - blue: 0 - }, - textColor: { - red: 255, - green: 10, - blue: 10 - }, - text: "ERASE BOARD", - lineHeight: 0.07, - userData: JSON.stringify({ - whiteboard: whiteboard - }) -}); - - - function cleanup() { Entities.deleteEntity(whiteboard); Entities.deleteEntity(eraseAllText); - Entities.deleteEntity(blackBox); Entities.deleteEntity(colorIndicatorBox); colorBoxes.forEach(function(colorBox) { Entities.deleteEntity(colorBox); @@ -197,5 +167,6 @@ function cleanup() { } + // Uncomment this line to delete whiteboard and all associated entity on script close Script.scriptEnding.connect(cleanup); \ No newline at end of file From fa22249f7a25a822791a20ae186829ef11630713 Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Tue, 27 Oct 2015 12:03:30 -0700 Subject: [PATCH 04/29] Improving model --- .../painting/whiteboard/whiteboardSpawner.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/examples/painting/whiteboard/whiteboardSpawner.js b/examples/painting/whiteboard/whiteboardSpawner.js index 0804b992c7..2de9821810 100644 --- a/examples/painting/whiteboard/whiteboardSpawner.js +++ b/examples/painting/whiteboard/whiteboardSpawner.js @@ -31,7 +31,7 @@ var colors = [ hexToRgb("#491849"), hexToRgb("#6AB03B"), hexToRgb("#993369"), - hexToRgb("#9B47C2") + hexToRgb("#000000") ]; var whiteboard = Entities.addEntity({ type: "Model", @@ -92,12 +92,19 @@ function setUp() { var direction = Quat.getRight(rotation); var colorBoxPosition = Vec3.subtract(center, Vec3.multiply(direction, whiteboardDimensions.x / 2)); var colorSquareDimensions = { - x: 0.1, - y: 0.1, + x: 0.13, + y: 0.13, z: 0.002 }; - colorBoxPosition.y += whiteboardDimensions.y / 2 + colorIndicatorDimensions.y + colorSquareDimensions.y / 2; - var spaceBetweenColorBoxes = Vec3.multiply(direction, colorSquareDimensions.x * 2); + + var palleteDepthOffset = -0.06; + var palleteHeightOffset = -0.28; + + colorBoxPosition = Vec3.sum(colorBoxPosition, Vec3.multiply(palleteDepthOffset, Quat.getFront(rotation))); + colorBoxPosition.y += palleteHeightOffset; + var spaceBetweenColorBoxes = Vec3.multiply(direction, colorSquareDimensions.x * 1.76); + var palleteXOffset = Vec3.multiply(direction, 0.43); + colorBoxPosition = Vec3.sum(colorBoxPosition, palleteXOffset); var scriptURL = Script.resolvePath("colorSelectorEntityScript.js"); for (var i = 0; i < colors.length; i++) { var colorBox = Entities.addEntity({ From f0a1335957aa0a80d61ecca1ddf98f03c4b03c4d Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Tue, 27 Oct 2015 12:09:07 -0700 Subject: [PATCH 05/29] fixed paint initially showing up white --- examples/painting/whiteboard/whiteboardSpawner.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/examples/painting/whiteboard/whiteboardSpawner.js b/examples/painting/whiteboard/whiteboardSpawner.js index 2de9821810..6a4f800441 100644 --- a/examples/painting/whiteboard/whiteboardSpawner.js +++ b/examples/painting/whiteboard/whiteboardSpawner.js @@ -44,7 +44,12 @@ var whiteboard = Entities.addEntity({ red: 255, green: 255, blue: 255 - } + }, + userData: JSON.stringify({ + color: { + currentColor: colors[0] + } + }) }); Script.setTimeout(function() { From 8fcc07102699807e6eee5392c6765df9076e3ade Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Tue, 27 Oct 2015 12:24:29 -0700 Subject: [PATCH 06/29] only can draw on whiteboard --- .../painting/whiteboard/whiteboardSpawner.js | 33 ++++++++++++------- 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/examples/painting/whiteboard/whiteboardSpawner.js b/examples/painting/whiteboard/whiteboardSpawner.js index 6a4f800441..366aa2b73d 100644 --- a/examples/painting/whiteboard/whiteboardSpawner.js +++ b/examples/painting/whiteboard/whiteboardSpawner.js @@ -33,24 +33,32 @@ var colors = [ hexToRgb("#993369"), hexToRgb("#000000") ]; + var whiteboard = Entities.addEntity({ type: "Model", modelURL: modelURL, - name: "whiteboard", + name: "whiteboard base", position: center, rotation: rotation, +}); + +var surfaceCenter = Vec3.sum(center, Vec3.multiply(-0.1, Quat.getFront(rotation))); +surfaceCenter.y += 0.55; +var drawingSurface = Entities.addEntity({ + type: "Box", + color: {red: 255, green: 255, blue: 255}, + name: "whiteboard surface", + position: surfaceCenter, + dimensions: {x: 1.8, y: 1.4, z: 0.01}, script: scriptURL, - color: { - red: 255, - green: 255, - blue: 255 - }, - userData: JSON.stringify({ + rotation: rotation, + userData: JSON.stringify({ color: { currentColor: colors[0] } }) -}); + +}) Script.setTimeout(function() { whiteboardDimensions = Entities.getEntityProperties(whiteboard, "naturalDimensions").naturalDimensions; @@ -80,11 +88,11 @@ function setUp() { dimensions: colorIndicatorDimensions, script: scriptURL, userData: JSON.stringify({ - whiteboard: whiteboard + whiteboard: drawingSurface }) }); - Entities.editEntity(whiteboard, { + Entities.editEntity(drawingSurface, { userData: JSON.stringify({ color: { currentColor: colors[0] @@ -121,7 +129,7 @@ function setUp() { color: colors[i], script: scriptURL, userData: JSON.stringify({ - whiteboard: whiteboard, + whiteboard: drawingSurface, colorIndicator: colorIndicatorBox }) }); @@ -161,7 +169,7 @@ function setUp() { text: "ERASE BOARD", lineHeight: 0.07, userData: JSON.stringify({ - whiteboard: whiteboard + whiteboard: drawingSurface }) }); @@ -171,6 +179,7 @@ function setUp() { function cleanup() { Entities.deleteEntity(whiteboard); + Entities.deleteEntity(drawingSurface); Entities.deleteEntity(eraseAllText); Entities.deleteEntity(colorIndicatorBox); colorBoxes.forEach(function(colorBox) { From 25ded2bd9212f5c26a5285c64a79e8195fd18e16 Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Tue, 27 Oct 2015 13:03:44 -0700 Subject: [PATCH 07/29] added shapetype --- examples/painting/whiteboard/whiteboardSpawner.js | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/painting/whiteboard/whiteboardSpawner.js b/examples/painting/whiteboard/whiteboardSpawner.js index 366aa2b73d..a7cfc0719a 100644 --- a/examples/painting/whiteboard/whiteboardSpawner.js +++ b/examples/painting/whiteboard/whiteboardSpawner.js @@ -36,6 +36,7 @@ var colors = [ var whiteboard = Entities.addEntity({ type: "Model", + shapeType: "box", modelURL: modelURL, name: "whiteboard base", position: center, From 0512da0e3971c21c57cb5c8e1233e3ba801004b2 Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Tue, 27 Oct 2015 13:07:11 -0700 Subject: [PATCH 08/29] updated url --- examples/painting/whiteboard/whiteboardSpawner.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/painting/whiteboard/whiteboardSpawner.js b/examples/painting/whiteboard/whiteboardSpawner.js index a7cfc0719a..16953129af 100644 --- a/examples/painting/whiteboard/whiteboardSpawner.js +++ b/examples/painting/whiteboard/whiteboardSpawner.js @@ -17,7 +17,8 @@ Script.include("../../libraries/utils.js"); var scriptURL = Script.resolvePath("whiteboardEntityScript.js"); //var modelURL = "https://hifi-public.s3.amazonaws.com/ozan/support/for_eric/whiteboard/whiteboard.fbx"; -var modelURL = "http://localhost:8080/whiteboard.fbx?v1" + Math.random(); +//var modelURL = "http://localhost:8080/whiteboard.fbx?v1" + Math.random(); +var modelURL = "https://s3.amazonaws.com/hifi-public/eric/models/whiteboard.fbx"; var rotation = Quat.safeEulerAngles(Camera.getOrientation()); rotation = Quat.fromPitchYawRollDegrees(0, rotation.y, 0); var center = Vec3.sum(MyAvatar.position, Vec3.multiply(3, Quat.getFront(rotation))); From ed6a866ff9dddc7b6cf1aee39bdaf9b3f52e1eda Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Tue, 27 Oct 2015 13:43:13 -0700 Subject: [PATCH 09/29] ready for demo --- examples/painting/whiteboard/whiteboardEntityScript.js | 2 +- examples/painting/whiteboard/whiteboardSpawner.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/painting/whiteboard/whiteboardEntityScript.js b/examples/painting/whiteboard/whiteboardEntityScript.js index 2d34fc8c40..f38073f389 100644 --- a/examples/painting/whiteboard/whiteboardEntityScript.js +++ b/examples/painting/whiteboard/whiteboardEntityScript.js @@ -239,7 +239,7 @@ unload: function() { Overlays.deleteOverlay(this.laserPointer); - this.eraseBoard(); + // this.eraseBoard(); } }; diff --git a/examples/painting/whiteboard/whiteboardSpawner.js b/examples/painting/whiteboard/whiteboardSpawner.js index 16953129af..82d7f63239 100644 --- a/examples/painting/whiteboard/whiteboardSpawner.js +++ b/examples/painting/whiteboard/whiteboardSpawner.js @@ -17,7 +17,7 @@ Script.include("../../libraries/utils.js"); var scriptURL = Script.resolvePath("whiteboardEntityScript.js"); //var modelURL = "https://hifi-public.s3.amazonaws.com/ozan/support/for_eric/whiteboard/whiteboard.fbx"; -//var modelURL = "http://localhost:8080/whiteboard.fbx?v1" + Math.random(); +// var modelURL = "http://localhost:8080/whiteboard.fbx?v1" + Math.random(); var modelURL = "https://s3.amazonaws.com/hifi-public/eric/models/whiteboard.fbx"; var rotation = Quat.safeEulerAngles(Camera.getOrientation()); rotation = Quat.fromPitchYawRollDegrees(0, rotation.y, 0); @@ -192,4 +192,4 @@ function cleanup() { // Uncomment this line to delete whiteboard and all associated entity on script close -Script.scriptEnding.connect(cleanup); \ No newline at end of file +// Script.scriptEnding.connect(cleanup); \ No newline at end of file From d67f4958cdab2d60d2b7e08654e5b62667fbcb20 Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Tue, 27 Oct 2015 13:44:29 -0700 Subject: [PATCH 10/29] wait longer for dimensions --- examples/painting/whiteboard/whiteboardSpawner.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/painting/whiteboard/whiteboardSpawner.js b/examples/painting/whiteboard/whiteboardSpawner.js index 82d7f63239..4303803266 100644 --- a/examples/painting/whiteboard/whiteboardSpawner.js +++ b/examples/painting/whiteboard/whiteboardSpawner.js @@ -65,7 +65,7 @@ var drawingSurface = Entities.addEntity({ Script.setTimeout(function() { whiteboardDimensions = Entities.getEntityProperties(whiteboard, "naturalDimensions").naturalDimensions; setUp(); -}, 500) +}, 1000) function setUp() { From 2f835b19fa1c181513412293964ebce6c1f5f30f Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Tue, 27 Oct 2015 17:17:19 -0700 Subject: [PATCH 11/29] surface is now a model --- .../painting/whiteboard/whiteboardSpawner.js | 42 +++++++++++++------ 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/examples/painting/whiteboard/whiteboardSpawner.js b/examples/painting/whiteboard/whiteboardSpawner.js index 4303803266..037be61459 100644 --- a/examples/painting/whiteboard/whiteboardSpawner.js +++ b/examples/painting/whiteboard/whiteboardSpawner.js @@ -17,13 +17,17 @@ Script.include("../../libraries/utils.js"); var scriptURL = Script.resolvePath("whiteboardEntityScript.js"); //var modelURL = "https://hifi-public.s3.amazonaws.com/ozan/support/for_eric/whiteboard/whiteboard.fbx"; -// var modelURL = "http://localhost:8080/whiteboard.fbx?v1" + Math.random(); -var modelURL = "https://s3.amazonaws.com/hifi-public/eric/models/whiteboard.fbx"; +var modelURL = "http://localhost:8080/whiteboard.fbx?v1" + Math.random(); +// var modelURL = "https://s3.amazonaws.com/hifi-public/eric/models/whiteboard.fbx"; + +var colorIndicatorBorderModelURL = "http://localhost:8080/colorIndicatorBorder.fbx?v1" + Math.random(); + +var surfaceModelURL = "http://localhost:8080/boardSurface.fbx?v1" + Math.random(); var rotation = Quat.safeEulerAngles(Camera.getOrientation()); rotation = Quat.fromPitchYawRollDegrees(0, rotation.y, 0); var center = Vec3.sum(MyAvatar.position, Vec3.multiply(3, Quat.getFront(rotation))); -var whiteboardDimensions, colorIndicator, eraseAllText +var whiteboardDimensions, colorIndicatorBoxDimensions, colorIndicatorBox, eraseAllText var colorBoxes = []; var colors = [ @@ -44,14 +48,26 @@ var whiteboard = Entities.addEntity({ rotation: rotation, }); +var colorIndicatorPosition = {x: center.x, y: center.y, z: center.z}; +colorIndicatorPosition.y += 1.55; +colorIndicatorPosition = Vec3.sum(colorIndicatorPosition, Vec3.multiply(-0.1, Quat.getFront(rotation))); +var colorIndicatorBorder = Entities.addEntity({ + type: "Model", + position: colorIndicatorPosition, + modelURL: colorIndicatorBorderModelURL, + rotation: rotation, + shapeType: "box" +}); + var surfaceCenter = Vec3.sum(center, Vec3.multiply(-0.1, Quat.getFront(rotation))); -surfaceCenter.y += 0.55; +surfaceCenter.y += 0.6; var drawingSurface = Entities.addEntity({ - type: "Box", - color: {red: 255, green: 255, blue: 255}, + type: "Model", + modelURL: surfaceModelURL, + shapeType: "box", name: "whiteboard surface", position: surfaceCenter, - dimensions: {x: 1.8, y: 1.4, z: 0.01}, + // dimensions: {x: 1.7, y: 1.3, z: 0.01}, script: scriptURL, rotation: rotation, userData: JSON.stringify({ @@ -64,15 +80,18 @@ var drawingSurface = Entities.addEntity({ Script.setTimeout(function() { whiteboardDimensions = Entities.getEntityProperties(whiteboard, "naturalDimensions").naturalDimensions; + colorIndicatorDimensions = Entities.getEntityProperties(colorIndicatorBorder, "naturalDimensions").naturalDimensions; setUp(); }, 1000) function setUp() { // COLOR INDICATOR BOX + + var colorIndicatorDimensions = { x: whiteboardDimensions.x, - y: 0.05, + y: 0.5, z: 0.02 }; scriptURL = Script.resolvePath("colorIndicatorEntityScript.js"); @@ -112,7 +131,7 @@ function setUp() { z: 0.002 }; - var palleteDepthOffset = -0.06; + var palleteDepthOffset = -0.07; var palleteHeightOffset = -0.28; colorBoxPosition = Vec3.sum(colorBoxPosition, Vec3.multiply(palleteDepthOffset, Quat.getFront(rotation))); @@ -139,8 +158,6 @@ function setUp() { colorBoxPosition = Vec3.sum(colorBoxPosition, spaceBetweenColorBoxes); } - - var eraseBoxDimensions = { x: 0.5, y: 0.1, @@ -182,6 +199,7 @@ function setUp() { function cleanup() { Entities.deleteEntity(whiteboard); Entities.deleteEntity(drawingSurface); + Entities.deleteEntity(colorIndicatorBorder); Entities.deleteEntity(eraseAllText); Entities.deleteEntity(colorIndicatorBox); colorBoxes.forEach(function(colorBox) { @@ -192,4 +210,4 @@ function cleanup() { // Uncomment this line to delete whiteboard and all associated entity on script close -// Script.scriptEnding.connect(cleanup); \ No newline at end of file +Script.scriptEnding.connect(cleanup); \ No newline at end of file From 06897aa474535c49453fb66db832f256eef49a6a Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 21 Oct 2015 11:53:38 -0700 Subject: [PATCH 12/29] don't force parenting of AssetRequest/AssetUpload --- libraries/networking/src/AssetClient.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/libraries/networking/src/AssetClient.cpp b/libraries/networking/src/AssetClient.cpp index b7f1205847..6a1b46340c 100644 --- a/libraries/networking/src/AssetClient.cpp +++ b/libraries/networking/src/AssetClient.cpp @@ -89,7 +89,6 @@ AssetRequest* AssetClient::createRequest(const QString& hash, const QString& ext // Move to the AssetClient thread in case we are not currently on that thread (which will usually be the case) request->moveToThread(thread()); - request->setParent(this); return request; } else { @@ -105,7 +104,6 @@ AssetUpload* AssetClient::createUpload(const QString& filename) { auto upload = new AssetUpload(filename); upload->moveToThread(thread()); - upload->setParent(this); return upload; } else { @@ -118,7 +116,6 @@ AssetUpload* AssetClient::createUpload(const QByteArray& data, const QString& ex auto upload = new AssetUpload(data, extension); upload->moveToThread(thread()); - upload->setParent(this); return upload; } else { From 40277823354d9ecd526628d799982356959d7e00 Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Wed, 28 Oct 2015 13:18:57 -0700 Subject: [PATCH 13/29] Fixed issue with overlays disapearing on release grab --- .../whiteboard/whiteboardEntityScript.js | 4 + .../painting/whiteboard/whiteboardSpawner.js | 88 ++++++++----------- 2 files changed, 40 insertions(+), 52 deletions(-) diff --git a/examples/painting/whiteboard/whiteboardEntityScript.js b/examples/painting/whiteboard/whiteboardEntityScript.js index f38073f389..fffaa78a8c 100644 --- a/examples/painting/whiteboard/whiteboardEntityScript.js +++ b/examples/painting/whiteboard/whiteboardEntityScript.js @@ -47,6 +47,7 @@ if (this.painting) { return; } + this.whichHand = this.hand; if (this.hand === RIGHT_HAND) { this.getHandPosition = MyAvatar.getRightPalmPosition; this.getHandRotation = MyAvatar.getRightPalmRotation; @@ -183,6 +184,9 @@ }, releaseGrab: function() { + if(this.hand !== this.whichHand) { + return; + } this.stopPainting(); }, diff --git a/examples/painting/whiteboard/whiteboardSpawner.js b/examples/painting/whiteboard/whiteboardSpawner.js index 037be61459..c40a763bf6 100644 --- a/examples/painting/whiteboard/whiteboardSpawner.js +++ b/examples/painting/whiteboard/whiteboardSpawner.js @@ -22,12 +22,14 @@ var modelURL = "http://localhost:8080/whiteboard.fbx?v1" + Math.random(); var colorIndicatorBorderModelURL = "http://localhost:8080/colorIndicatorBorder.fbx?v1" + Math.random(); +var eraseModelURL = "http://localhost:8080/eraser.fbx?v1" + Math.random(); + var surfaceModelURL = "http://localhost:8080/boardSurface.fbx?v1" + Math.random(); var rotation = Quat.safeEulerAngles(Camera.getOrientation()); rotation = Quat.fromPitchYawRollDegrees(0, rotation.y, 0); var center = Vec3.sum(MyAvatar.position, Vec3.multiply(3, Quat.getFront(rotation))); -var whiteboardDimensions, colorIndicatorBoxDimensions, colorIndicatorBox, eraseAllText +var whiteboardDimensions, colorIndicatorBoxDimensions, colorIndicatorBox, eraser; var colorBoxes = []; var colors = [ @@ -48,7 +50,11 @@ var whiteboard = Entities.addEntity({ rotation: rotation, }); -var colorIndicatorPosition = {x: center.x, y: center.y, z: center.z}; +var colorIndicatorPosition = { + x: center.x, + y: center.y, + z: center.z +}; colorIndicatorPosition.y += 1.55; colorIndicatorPosition = Vec3.sum(colorIndicatorPosition, Vec3.multiply(-0.1, Quat.getFront(rotation))); var colorIndicatorBorder = Entities.addEntity({ @@ -60,27 +66,40 @@ var colorIndicatorBorder = Entities.addEntity({ }); var surfaceCenter = Vec3.sum(center, Vec3.multiply(-0.1, Quat.getFront(rotation))); -surfaceCenter.y += 0.6; +surfaceCenter.y += 0.6; var drawingSurface = Entities.addEntity({ type: "Model", modelURL: surfaceModelURL, shapeType: "box", name: "whiteboard surface", position: surfaceCenter, - // dimensions: {x: 1.7, y: 1.3, z: 0.01}, script: scriptURL, - rotation: rotation, - userData: JSON.stringify({ + rotation: rotation, + userData: JSON.stringify({ color: { currentColor: colors[0] } }) -}) +}); + +var eraseModelPosition = Vec3.sum(center, {x: 0, y: 2, z: 0 }); +scriptURL = Script.resolvePath("eraseBoardEntityScript.js"); +var eraser = Entities.addEntity({ + type: "Model", + modelURL: eraseModelURL, + position: eraseModelPosition, + name: "Eraser", + script: scriptURL, + rotation: rotation, + userData: JSON.stringify({ + whiteboard: drawingSurface + }) +}); Script.setTimeout(function() { whiteboardDimensions = Entities.getEntityProperties(whiteboard, "naturalDimensions").naturalDimensions; - colorIndicatorDimensions = Entities.getEntityProperties(colorIndicatorBorder, "naturalDimensions").naturalDimensions; + colorIndicatorBorderDimensions = Entities.getEntityProperties(colorIndicatorBorder, "naturalDimensions").naturalDimensions; setUp(); }, 1000) @@ -89,24 +108,25 @@ function setUp() { // COLOR INDICATOR BOX - var colorIndicatorDimensions = { - x: whiteboardDimensions.x, - y: 0.5, - z: 0.02 - }; + var eraseModelDimensions = Entities.getEntityProperties(eraser, "naturalDimensions").naturalDimensions; + Entities.editEntity(eraser, {dimensions: eraseModelDimensions}); + Entities.editEntity(colorIndicatorBorder, {dimensions: colorIndicatorBorderDimensions}); + scriptURL = Script.resolvePath("colorIndicatorEntityScript.js"); var colorIndicatorPosition = Vec3.sum(center, { x: 0, - y: whiteboardDimensions.y / 2 + colorIndicatorDimensions.y / 2, + y: whiteboardDimensions.y / 2 + colorIndicatorBorderDimensions.y / 2, z: 0 }); + colorIndicatorPosition = Vec3.sum(colorIndicatorPosition, Vec3.multiply(-.1, Quat.getFront(rotation))); + var colorIndicatorBoxDimensions = Vec3.multiply(colorIndicatorBorderDimensions, 0.9); colorIndicatorBox = Entities.addEntity({ type: "Box", name: "Color Indicator", color: colors[0], rotation: rotation, position: colorIndicatorPosition, - dimensions: colorIndicatorDimensions, + dimensions: colorIndicatorBoxDimensions, script: scriptURL, userData: JSON.stringify({ whiteboard: drawingSurface @@ -158,49 +178,13 @@ function setUp() { colorBoxPosition = Vec3.sum(colorBoxPosition, spaceBetweenColorBoxes); } - var eraseBoxDimensions = { - x: 0.5, - y: 0.1, - z: 0.01 - }; - - - var eraseBoxPosition = Vec3.sum(center, Vec3.multiply(direction, whiteboardDimensions.x / 2 + eraseBoxDimensions.x / 2 + 0.01)); - eraseBoxPosition.y += 0.3; - scriptURL = Script.resolvePath("eraseBoardEntityScript.js"); - eraseAllText = Entities.addEntity({ - type: "Text", - position: eraseBoxPosition, - name: "Eraser", - script: scriptURL, - rotation: rotation, - dimensions: eraseBoxDimensions, - backgroundColor: { - red: 0, - green: 60, - blue: 0 - }, - textColor: { - red: 255, - green: 10, - blue: 10 - }, - text: "ERASE BOARD", - lineHeight: 0.07, - userData: JSON.stringify({ - whiteboard: drawingSurface - }) - }); - - - } function cleanup() { Entities.deleteEntity(whiteboard); Entities.deleteEntity(drawingSurface); Entities.deleteEntity(colorIndicatorBorder); - Entities.deleteEntity(eraseAllText); + Entities.deleteEntity(eraser); Entities.deleteEntity(colorIndicatorBox); colorBoxes.forEach(function(colorBox) { Entities.deleteEntity(colorBox); From ac2effb33cce4e55c9c91e0b3263cd0177da4979 Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Wed, 28 Oct 2015 13:32:10 -0700 Subject: [PATCH 14/29] Not erasing board, models hosted on s3 --- .../whiteboard/whiteboardEntityScript.js | 4 +--- .../painting/whiteboard/whiteboardSpawner.js | 21 +++++++------------ 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/examples/painting/whiteboard/whiteboardEntityScript.js b/examples/painting/whiteboard/whiteboardEntityScript.js index fffaa78a8c..ce0e8a82b1 100644 --- a/examples/painting/whiteboard/whiteboardEntityScript.js +++ b/examples/painting/whiteboard/whiteboardEntityScript.js @@ -243,12 +243,10 @@ unload: function() { Overlays.deleteOverlay(this.laserPointer); - // this.eraseBoard(); + this.eraseBoard(); } - }; - // entity scripts always need to return a newly constructed object of our type return new Whiteboard(); }); \ No newline at end of file diff --git a/examples/painting/whiteboard/whiteboardSpawner.js b/examples/painting/whiteboard/whiteboardSpawner.js index c40a763bf6..573432b77a 100644 --- a/examples/painting/whiteboard/whiteboardSpawner.js +++ b/examples/painting/whiteboard/whiteboardSpawner.js @@ -16,15 +16,11 @@ Script.include("../../libraries/utils.js"); var scriptURL = Script.resolvePath("whiteboardEntityScript.js"); -//var modelURL = "https://hifi-public.s3.amazonaws.com/ozan/support/for_eric/whiteboard/whiteboard.fbx"; -var modelURL = "http://localhost:8080/whiteboard.fbx?v1" + Math.random(); -// var modelURL = "https://s3.amazonaws.com/hifi-public/eric/models/whiteboard.fbx"; +var modelURL = "https://s3.amazonaws.com/hifi-public/eric/models/whiteboard.fbx"; -var colorIndicatorBorderModelURL = "http://localhost:8080/colorIndicatorBorder.fbx?v1" + Math.random(); - -var eraseModelURL = "http://localhost:8080/eraser.fbx?v1" + Math.random(); - -var surfaceModelURL = "http://localhost:8080/boardSurface.fbx?v1" + Math.random(); +var colorIndicatorBorderModelURL = "https://s3.amazonaws.com/hifi-public/eric/models/colorIndicatorBorder.fbx"; +var eraserModelURL = "https://s3.amazonaws.com/hifi-public/eric/models/eraser.fbx"; +var surfaceModelURL = "https://s3.amazonaws.com/hifi-public/eric/models/boardSurface.fbx"; var rotation = Quat.safeEulerAngles(Camera.getOrientation()); rotation = Quat.fromPitchYawRollDegrees(0, rotation.y, 0); var center = Vec3.sum(MyAvatar.position, Vec3.multiply(3, Quat.getFront(rotation))); @@ -87,7 +83,7 @@ var eraseModelPosition = Vec3.sum(center, {x: 0, y: 2, z: 0 }); scriptURL = Script.resolvePath("eraseBoardEntityScript.js"); var eraser = Entities.addEntity({ type: "Model", - modelURL: eraseModelURL, + modelURL: eraserModelURL, position: eraseModelPosition, name: "Eraser", script: scriptURL, @@ -101,13 +97,10 @@ Script.setTimeout(function() { whiteboardDimensions = Entities.getEntityProperties(whiteboard, "naturalDimensions").naturalDimensions; colorIndicatorBorderDimensions = Entities.getEntityProperties(colorIndicatorBorder, "naturalDimensions").naturalDimensions; setUp(); -}, 1000) +}, 2000) function setUp() { - // COLOR INDICATOR BOX - - var eraseModelDimensions = Entities.getEntityProperties(eraser, "naturalDimensions").naturalDimensions; Entities.editEntity(eraser, {dimensions: eraseModelDimensions}); Entities.editEntity(colorIndicatorBorder, {dimensions: colorIndicatorBorderDimensions}); @@ -194,4 +187,4 @@ function cleanup() { // Uncomment this line to delete whiteboard and all associated entity on script close -Script.scriptEnding.connect(cleanup); \ No newline at end of file +// Script.scriptEnding.connect(cleanup); \ No newline at end of file From e9bdb872bdd8d3c78a6c0f6e3f28b2b407c64bc7 Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Wed, 28 Oct 2015 15:25:11 -0700 Subject: [PATCH 15/29] added light to whiteboard --- examples/painting/whiteboard/whiteboardSpawner.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/examples/painting/whiteboard/whiteboardSpawner.js b/examples/painting/whiteboard/whiteboardSpawner.js index 573432b77a..b08c9bd624 100644 --- a/examples/painting/whiteboard/whiteboardSpawner.js +++ b/examples/painting/whiteboard/whiteboardSpawner.js @@ -79,6 +79,14 @@ var drawingSurface = Entities.addEntity({ }); +var lightPosition = Vec3.sum(center, Vec3.multiply(-2, Quat.getFront(rotation))); +var light = Entities.addEntity({ + type: 'Light', + position: lightPosition, + dimensions: {x: 5, y: 5, z: 5}, + color: {red: 255, green: 255, blue: 255} +}); + var eraseModelPosition = Vec3.sum(center, {x: 0, y: 2, z: 0 }); scriptURL = Script.resolvePath("eraseBoardEntityScript.js"); var eraser = Entities.addEntity({ @@ -179,6 +187,7 @@ function cleanup() { Entities.deleteEntity(colorIndicatorBorder); Entities.deleteEntity(eraser); Entities.deleteEntity(colorIndicatorBox); + Entities.deleteEntity(light); colorBoxes.forEach(function(colorBox) { Entities.deleteEntity(colorBox); }); From 1b1490bb75403a6f31040d234035c5af67092c76 Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Wed, 28 Oct 2015 16:02:15 -0700 Subject: [PATCH 16/29] added blocker so user cant get so close to whiteboard --- .../painting/whiteboard/whiteboardSpawner.js | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/examples/painting/whiteboard/whiteboardSpawner.js b/examples/painting/whiteboard/whiteboardSpawner.js index b08c9bd624..29183dcc76 100644 --- a/examples/painting/whiteboard/whiteboardSpawner.js +++ b/examples/painting/whiteboard/whiteboardSpawner.js @@ -25,7 +25,7 @@ var rotation = Quat.safeEulerAngles(Camera.getOrientation()); rotation = Quat.fromPitchYawRollDegrees(0, rotation.y, 0); var center = Vec3.sum(MyAvatar.position, Vec3.multiply(3, Quat.getFront(rotation))); -var whiteboardDimensions, colorIndicatorBoxDimensions, colorIndicatorBox, eraser; +var whiteboardDimensions, colorIndicatorBoxDimensions, colorIndicatorBox, eraser, blocker; var colorBoxes = []; var colors = [ @@ -87,12 +87,13 @@ var light = Entities.addEntity({ color: {red: 255, green: 255, blue: 255} }); -var eraseModelPosition = Vec3.sum(center, {x: 0, y: 2, z: 0 }); +var eraserPosition = Vec3.sum(center, {x: 0, y: 2.05, z: 0 }); +eraserPosition = Vec3.sum(eraserPosition, Vec3.multiply(-0.1, rotation)); scriptURL = Script.resolvePath("eraseBoardEntityScript.js"); var eraser = Entities.addEntity({ type: "Model", modelURL: eraserModelURL, - position: eraseModelPosition, + position: eraserPosition, name: "Eraser", script: scriptURL, rotation: rotation, @@ -109,6 +110,17 @@ Script.setTimeout(function() { function setUp() { + var blockerPosition = Vec3.sum(center, {x: 0, y: -1, z: 0 }); + blockerPosition = Vec3.sum(blockerPosition, Vec3.multiply(-1, Quat.getFront(rotation))); + blocker = Entities.addEntity({ + type: "Box", + rotation: rotation, + position: blockerPosition, + dimensions: {x: whiteboardDimensions.x, y: 1, z: 0.1}, + shapeType: "box", + visible: false + }); + var eraseModelDimensions = Entities.getEntityProperties(eraser, "naturalDimensions").naturalDimensions; Entities.editEntity(eraser, {dimensions: eraseModelDimensions}); Entities.editEntity(colorIndicatorBorder, {dimensions: colorIndicatorBorderDimensions}); @@ -187,6 +199,7 @@ function cleanup() { Entities.deleteEntity(colorIndicatorBorder); Entities.deleteEntity(eraser); Entities.deleteEntity(colorIndicatorBox); + Entities.deleteEntity(blocker); Entities.deleteEntity(light); colorBoxes.forEach(function(colorBox) { Entities.deleteEntity(colorBox); @@ -196,4 +209,4 @@ function cleanup() { // Uncomment this line to delete whiteboard and all associated entity on script close -// Script.scriptEnding.connect(cleanup); \ No newline at end of file +Script.scriptEnding.connect(cleanup); \ No newline at end of file From 020566b76a996c931aece545e98782124f329397 Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Thu, 29 Oct 2015 14:14:15 -0700 Subject: [PATCH 17/29] no deleting --- examples/painting/whiteboard/whiteboardEntityScript.js | 2 +- examples/painting/whiteboard/whiteboardSpawner.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/painting/whiteboard/whiteboardEntityScript.js b/examples/painting/whiteboard/whiteboardEntityScript.js index ce0e8a82b1..c10a8c23fe 100644 --- a/examples/painting/whiteboard/whiteboardEntityScript.js +++ b/examples/painting/whiteboard/whiteboardEntityScript.js @@ -243,7 +243,7 @@ unload: function() { Overlays.deleteOverlay(this.laserPointer); - this.eraseBoard(); + // this.eraseBoard(); } }; diff --git a/examples/painting/whiteboard/whiteboardSpawner.js b/examples/painting/whiteboard/whiteboardSpawner.js index 29183dcc76..b2156dc898 100644 --- a/examples/painting/whiteboard/whiteboardSpawner.js +++ b/examples/painting/whiteboard/whiteboardSpawner.js @@ -209,4 +209,4 @@ function cleanup() { // Uncomment this line to delete whiteboard and all associated entity on script close -Script.scriptEnding.connect(cleanup); \ No newline at end of file +// Script.scriptEnding.connect(cleanup); \ No newline at end of file From 047614b2eb70fc7e60faef1486de3b515078344b Mon Sep 17 00:00:00 2001 From: "Anthony J. Thibault" Date: Thu, 29 Oct 2015 16:18:15 -0700 Subject: [PATCH 18/29] New left and right grab animations. --- .../defaultAvatar_full/avatar-animation.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/interface/resources/meshes/defaultAvatar_full/avatar-animation.json b/interface/resources/meshes/defaultAvatar_full/avatar-animation.json index 682e0be1bf..515f6e96fe 100644 --- a/interface/resources/meshes/defaultAvatar_full/avatar-animation.json +++ b/interface/resources/meshes/defaultAvatar_full/avatar-animation.json @@ -197,7 +197,7 @@ "id": "rightHandOpen", "type": "clip", "data": { - "url": "http://hifi-public.s3.amazonaws.com/ozan/anim/hand_anims/point_right_hand.fbx", + "url": "https://hifi-public.s3.amazonaws.com/ozan/anim/grab/grab_right.fbx", "startFrame": 0.0, "endFrame": 0.0, "timeScale": 1.0, @@ -209,9 +209,9 @@ "id": "rightHandClose", "type": "clip", "data": { - "url": "http://hifi-public.s3.amazonaws.com/ozan/anim/squeeze_hands/right_hand_anim.fbx", - "startFrame": 15.0, - "endFrame": 15.0, + "url": "https://hifi-public.s3.amazonaws.com/ozan/anim/grab/grab_right.fbx", + "startFrame": 10.0, + "endFrame": 10.0, "timeScale": 1.0, "loopFlag": true }, @@ -346,7 +346,7 @@ "id": "leftHandOpen", "type": "clip", "data": { - "url": "http://hifi-public.s3.amazonaws.com/ozan/anim/hand_anims/point_left_hand.fbx", + "url": "https://hifi-public.s3.amazonaws.com/ozan/anim/grab/grab_left.fbx", "startFrame": 0.0, "endFrame": 0.0, "timeScale": 1.0, @@ -358,9 +358,9 @@ "id": "leftHandClose", "type": "clip", "data": { - "url": "http://hifi-public.s3.amazonaws.com/ozan/anim/squeeze_hands/left_hand_anim.fbx", - "startFrame": 15.0, - "endFrame": 15.0, + "url": "https://hifi-public.s3.amazonaws.com/ozan/anim/grab/grab_left.fbx", + "startFrame": 10.0, + "endFrame": 10.0, "timeScale": 1.0, "loopFlag": true }, From b6b71e7e7693aa92962ff080f562909e82238dec Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Thu, 29 Oct 2015 16:40:50 -0700 Subject: [PATCH 19/29] increased range and intensity of light --- examples/painting/whiteboard/whiteboardSpawner.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/painting/whiteboard/whiteboardSpawner.js b/examples/painting/whiteboard/whiteboardSpawner.js index b2156dc898..fa5040ed4b 100644 --- a/examples/painting/whiteboard/whiteboardSpawner.js +++ b/examples/painting/whiteboard/whiteboardSpawner.js @@ -79,11 +79,13 @@ var drawingSurface = Entities.addEntity({ }); -var lightPosition = Vec3.sum(center, Vec3.multiply(-2, Quat.getFront(rotation))); +var lightPosition = Vec3.sum(center, Vec3.multiply(-4, Quat.getFront(rotation))); var light = Entities.addEntity({ type: 'Light', + name: 'whiteboard light', position: lightPosition, - dimensions: {x: 5, y: 5, z: 5}, + dimensions: {x: 10, y: 10, z: 10}, + intensity: 2, color: {red: 255, green: 255, blue: 255} }); From 8b46ed7dff4e54bf9817bf0ee3df69ba62997bb2 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Thu, 29 Oct 2015 16:42:48 -0700 Subject: [PATCH 20/29] Check keyLight is defined --- examples/edit.js | 4 ++-- examples/html/entityProperties.html | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/edit.js b/examples/edit.js index 447455e999..7a16030afc 100644 --- a/examples/edit.js +++ b/examples/edit.js @@ -1510,7 +1510,7 @@ PropertiesTool = function(opts) { if (entity.properties.rotation !== undefined) { entity.properties.rotation = Quat.safeEulerAngles(entity.properties.rotation); } - if (entity.properties.type === "Zone" && entity.properties.keyLight.direction !== undefined) { + if (entity.properties.keyLight !== undefined && entity.properties.keyLight.direction !== undefined) { entity.properties.keyLight.direction = Vec3.multiply(RADIANS_TO_DEGREES, Vec3.toPolar(entity.properties.keyLight.direction)); entity.properties.keyLight.direction.z = 0.0; } @@ -1541,7 +1541,7 @@ PropertiesTool = function(opts) { var rotation = data.properties.rotation; data.properties.rotation = Quat.fromPitchYawRollDegrees(rotation.x, rotation.y, rotation.z); } - if (entity.properties.type === "Zone" && data.properties.keyLight.direction !== undefined) { + if (data.properties.keyLight !== undefined && data.properties.keyLight.direction !== undefined) { data.properties.keyLight.direction = Vec3.fromPolar( data.properties.keyLight.direction.x * DEGREES_TO_RADIANS, data.properties.keyLight.direction.y * DEGREES_TO_RADIANS); } diff --git a/examples/html/entityProperties.html b/examples/html/entityProperties.html index fe40311b5f..412b413b2b 100644 --- a/examples/html/entityProperties.html +++ b/examples/html/entityProperties.html @@ -830,7 +830,7 @@ elZoneKeyLightColorRed.addEventListener('change', zoneKeyLightColorChangeFunction); elZoneKeyLightColorGreen.addEventListener('change', zoneKeyLightColorChangeFunction); elZoneKeyLightColorBlue.addEventListener('change', zoneKeyLightColorChangeFunction); - elZoneKeyLightIntensity.addEventListener('change', createEmitGroupNumberPropertyUpdateFunction('intensity','keyLight')); + elZoneKeyLightIntensity.addEventListener('change', createEmitGroupNumberPropertyUpdateFunction('keyLight','intensity')); elZoneKeyLightAmbientIntensity.addEventListener('change', createEmitGroupNumberPropertyUpdateFunction('keyLight','ambientIntensity')); var zoneKeyLightDirectionChangeFunction = createEmitGroupVec3PropertyUpdateFunction('keyLight','direction', elZoneKeyLightDirectionX, elZoneKeyLightDirectionY, elZoneKeyLightDirectionZ); elZoneKeyLightDirectionX.addEventListener('change', zoneKeyLightDirectionChangeFunction); From 6bdf66534f323d1710878bcc5f6d48f32e9a1992 Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Thu, 29 Oct 2015 16:53:03 -0700 Subject: [PATCH 21/29] light tweak --- examples/painting/whiteboard/whiteboardSpawner.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/painting/whiteboard/whiteboardSpawner.js b/examples/painting/whiteboard/whiteboardSpawner.js index fa5040ed4b..701112e1a8 100644 --- a/examples/painting/whiteboard/whiteboardSpawner.js +++ b/examples/painting/whiteboard/whiteboardSpawner.js @@ -79,7 +79,7 @@ var drawingSurface = Entities.addEntity({ }); -var lightPosition = Vec3.sum(center, Vec3.multiply(-4, Quat.getFront(rotation))); +var lightPosition = Vec3.sum(center, Vec3.multiply(-3, Quat.getFront(rotation))); var light = Entities.addEntity({ type: 'Light', name: 'whiteboard light', From 35e03d662d392af02b95969138b3d5cc84cdba37 Mon Sep 17 00:00:00 2001 From: Thijs Wenker Date: Fri, 30 Oct 2015 00:58:32 +0100 Subject: [PATCH 22/29] fix the constants of Vec3 , const glm::vec3& UNIT_***() weren't accessible in javascript. Solved it by making them properties that are CONSTANT. Also added function to multiply a vec3 by a vec3 called multiplyVbyV since overloading it over multiply gave me some problems --- libraries/script-engine/src/Vec3.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/libraries/script-engine/src/Vec3.h b/libraries/script-engine/src/Vec3.h index b05e729a49..17a5afd09a 100644 --- a/libraries/script-engine/src/Vec3.h +++ b/libraries/script-engine/src/Vec3.h @@ -23,6 +23,25 @@ /// Scriptable interface a Vec3ernion helper class object. Used exclusively in the JavaScript API class Vec3 : public QObject { Q_OBJECT + Q_PROPERTY(glm::vec3 UNIT_X READ UNIT_X CONSTANT) + Q_PROPERTY(glm::vec3 UNIT_Y READ UNIT_Y CONSTANT) + Q_PROPERTY(glm::vec3 UNIT_Z READ UNIT_Z CONSTANT) + Q_PROPERTY(glm::vec3 UNIT_NEG_X READ UNIT_NEG_X CONSTANT) + Q_PROPERTY(glm::vec3 UNIT_NEG_Y READ UNIT_NEG_Y CONSTANT) + Q_PROPERTY(glm::vec3 UNIT_NEG_Z READ UNIT_NEG_Z CONSTANT) + Q_PROPERTY(glm::vec3 UNIT_XY READ UNIT_XY CONSTANT) + Q_PROPERTY(glm::vec3 UNIT_XZ READ UNIT_XZ CONSTANT) + Q_PROPERTY(glm::vec3 UNIT_YZ READ UNIT_YZ CONSTANT) + Q_PROPERTY(glm::vec3 UNIT_XYZ READ UNIT_XYZ CONSTANT) + Q_PROPERTY(glm::vec3 FLOAT_MAX READ FLOAT_MAX CONSTANT) + Q_PROPERTY(glm::vec3 FLOAT_MIN READ FLOAT_MIN CONSTANT) + Q_PROPERTY(glm::vec3 ZERO READ ZERO CONSTANT) + Q_PROPERTY(glm::vec3 ONE READ ONE CONSTANT) + Q_PROPERTY(glm::vec3 TWO READ TWO CONSTANT) + Q_PROPERTY(glm::vec3 HALF READ HALF CONSTANT) + Q_PROPERTY(glm::vec3 RIGHT READ RIGHT CONSTANT) + Q_PROPERTY(glm::vec3 UP READ UP CONSTANT) + Q_PROPERTY(glm::vec3 FRONT READ FRONT CONSTANT) public slots: glm::vec3 reflect(const glm::vec3& v1, const glm::vec3& v2) { return glm::reflect(v1, v2); } @@ -30,6 +49,7 @@ public slots: float dot(const glm::vec3& v1, const glm::vec3& v2) { return glm::dot(v1, v2); } glm::vec3 multiply(const glm::vec3& v1, float f) { return v1 * f; } glm::vec3 multiply(float f, const glm::vec3& v1) { return v1 * f; } + glm::vec3 multiplyVbyV(const glm::vec3& v1, const glm::vec3& v2) { return v1 * v2; } glm::vec3 multiplyQbyV(const glm::quat& q, const glm::vec3& v) { return q * v; } glm::vec3 sum(const glm::vec3& v1, const glm::vec3& v2) { return v1 + v2; } glm::vec3 subtract(const glm::vec3& v1, const glm::vec3& v2) { return v1 - v2; } @@ -45,6 +65,8 @@ public slots: glm::vec3 toPolar(const glm::vec3& v); glm::vec3 fromPolar(const glm::vec3& polar); glm::vec3 fromPolar(float elevation, float azimuth); + +private: const glm::vec3& UNIT_X() { return Vectors::UNIT_X; } const glm::vec3& UNIT_Y() { return Vectors::UNIT_Y; } const glm::vec3& UNIT_Z() { return Vectors::UNIT_Z; } From a149a2dd60bcf1abfeb85f80ee02dea3d220c635 Mon Sep 17 00:00:00 2001 From: Brad Hefta-Gaub Date: Fri, 30 Oct 2015 00:19:14 -0700 Subject: [PATCH 23/29] fix some warnings --- libraries/gl/src/gl/GlWindow.cpp | 3 +-- libraries/physics/src/CharacterController.cpp | 4 ++-- libraries/ui/src/VrMenu.cpp | 4 ++++ 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/libraries/gl/src/gl/GlWindow.cpp b/libraries/gl/src/gl/GlWindow.cpp index 7e43b29e73..40a5bedf7e 100644 --- a/libraries/gl/src/gl/GlWindow.cpp +++ b/libraries/gl/src/gl/GlWindow.cpp @@ -44,8 +44,7 @@ bool GlWindow::makeCurrent() { qDebug() << "GL Renderer: " << QString((const char*) glGetString(GL_RENDERER)); }); - QOpenGLContext * currentContext = QOpenGLContext::currentContext(); - Q_ASSERT(_context == currentContext); + Q_ASSERT(_context == QOpenGLContext::currentContext()); return makeCurrentResult; } diff --git a/libraries/physics/src/CharacterController.cpp b/libraries/physics/src/CharacterController.cpp index aadf9b16ea..8da9541387 100644 --- a/libraries/physics/src/CharacterController.cpp +++ b/libraries/physics/src/CharacterController.cpp @@ -14,11 +14,11 @@ #include "PhysicsCollisionGroups.h" bool CharacterController::needsRemoval() const { - return (bool)(_pendingFlags & PENDING_FLAG_REMOVE_FROM_SIMULATION); + return ((_pendingFlags & PENDING_FLAG_REMOVE_FROM_SIMULATION) == PENDING_FLAG_REMOVE_FROM_SIMULATION); } bool CharacterController::needsAddition() const { - return (bool)(_pendingFlags & PENDING_FLAG_ADD_TO_SIMULATION); + return ((_pendingFlags & PENDING_FLAG_ADD_TO_SIMULATION) == PENDING_FLAG_ADD_TO_SIMULATION); } void CharacterController::setDynamicsWorld(btDynamicsWorld* world) { diff --git a/libraries/ui/src/VrMenu.cpp b/libraries/ui/src/VrMenu.cpp index 57df4d5306..211e0e0f72 100644 --- a/libraries/ui/src/VrMenu.cpp +++ b/libraries/ui/src/VrMenu.cpp @@ -113,6 +113,7 @@ void VrMenu::addMenu(QMenu* menu) { Q_ARG(QVariant, QVariant::fromValue(qmlParent)), Q_ARG(QVariant, QVariant::fromValue(menu->title()))); Q_ASSERT(invokeResult); + Q_UNUSED(invokeResult); // FIXME - apparently we haven't upgraded the Qt on our unix Jenkins environments to 5.5.x QObject* result = returnedValue.value(); Q_ASSERT(result); @@ -153,6 +154,7 @@ void VrMenu::addAction(QMenu* menu, QAction* action) { Q_ARG(QVariant, QVariant::fromValue(menuQml)), Q_ARG(QVariant, QVariant::fromValue(action->text()))); Q_ASSERT(invokeResult); + Q_UNUSED(invokeResult); // FIXME - apparently we haven't upgraded the Qt on our unix Jenkins environments to 5.5.x QObject* result = returnedValue.value(); Q_ASSERT(result); // Bind the QML and Widget together @@ -174,6 +176,7 @@ void VrMenu::insertAction(QAction* before, QAction* action) { Q_ARG(QVariant, QVariant::fromValue(beforeQml)), Q_ARG(QVariant, QVariant::fromValue(action->text()))); Q_ASSERT(invokeResult); + Q_UNUSED(invokeResult); // FIXME - apparently we haven't upgraded the Qt on our unix Jenkins environments to 5.5.x QObject* result = returnedValue.value(); Q_ASSERT(result); bindActionToQmlAction(result, action); @@ -192,4 +195,5 @@ void VrMenu::removeAction(QAction* action) { Q_ARG(QVariant, QVariant::fromValue(menu)), Q_ARG(QVariant, QVariant::fromValue(item))); Q_ASSERT(invokeResult); + Q_UNUSED(invokeResult); // FIXME - apparently we haven't upgraded the Qt on our unix Jenkins environments to 5.5.x } From fcfab0fc513a96ae166318f613581cf083916e6e Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Thu, 29 Oct 2015 12:31:34 -0700 Subject: [PATCH 24/29] Moving SDL2, Sixense and Faceshift to external projects --- CMakeLists.txt | 25 ++++----- cmake/externals/faceshift/CMakeLists.txt | 30 +++++++++++ cmake/externals/sdl2/CMakeLists.txt | 30 ++++------- cmake/externals/sixense/CMakeLists.txt | 36 ++++--------- .../AddDependencyExternalProjects.cmake | 2 +- cmake/macros/TargetFaceshift.cmake | 14 +++++ cmake/macros/TargetSDL2.cmake | 14 +++++ cmake/macros/TargetSixense.cmake | 14 +++++ cmake/modules/FindFaceshift.cmake | 23 -------- cmake/modules/FindSixense.cmake | 45 +--------------- interface/CMakeLists.txt | 13 +++-- interface/external/faceshift/readme.txt | 26 --------- interface/external/sdl2/readme.txt | 13 ----- interface/external/sixense/readme.txt | 10 ---- libraries/input-plugins/CMakeLists.txt | 54 +------------------ 15 files changed, 119 insertions(+), 230 deletions(-) create mode 100644 cmake/externals/faceshift/CMakeLists.txt create mode 100644 cmake/macros/TargetFaceshift.cmake create mode 100644 cmake/macros/TargetSDL2.cmake create mode 100644 cmake/macros/TargetSixense.cmake delete mode 100644 interface/external/faceshift/readme.txt delete mode 100644 interface/external/sdl2/readme.txt delete mode 100644 interface/external/sixense/readme.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 79d8a0c0e0..d69b8c4c77 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -186,21 +186,22 @@ set_property(DIRECTORY PROPERTY EP_PREFIX ${EXTERNAL_PROJECT_PREFIX}) setup_externals_binary_dir() # setup options to grab external project dependencies -option(GET_BULLET "Get Bullet library automatically as external project" 1) -option(GET_GLM "Get GLM library automatically as external project" 1) -option(GET_GVERB "Get Gverb library automatically as external project" 1) -option(GET_TBB "Get Threading Building Blocks library automatically as external project" 1) -option(GET_LIBOVR "Get LibOVR library automatically as external project" 1) -option(GET_VHACD "Get V-HACD library automatically as external project" 1) -option(GET_POLYVOX "Get polyvox library automatically as external project" 1) -option(GET_OPENVR "Get OpenVR library automatically as external project" 1) -option(GET_BOOSTCONFIG "Get Boost-config library automatically as external project" 1) -option(GET_OGLPLUS "Get OGLplus library automatically as external project" 1) -option(GET_GLEW "Get GLEW library automatically as external project" 1) +#option(GET_BULLET "Get Bullet library automatically as external project" 1) +#option(GET_GLM "Get GLM library automatically as external project" 1) +#option(GET_GVERB "Get Gverb library automatically as external project" 1) +#option(GET_TBB "Get Threading Building Blocks library automatically as external project" 1) +#option(GET_LIBOVR "Get LibOVR library automatically as external project" 1) +#option(GET_VHACD "Get V-HACD library automatically as external project" 1) +#option(GET_POLYVOX "Get polyvox library automatically as external project" 1) +#option(GET_OPENVR "Get OpenVR library automatically as external project" 1) +#option(GET_BOOSTCONFIG "Get Boost-config library automatically as external project" 1) +#option(GET_OGLPLUS "Get OGLplus library automatically as external project" 1) +#option(GET_GLEW "Get GLEW library automatically as external project" 1) +#option(GET_SDL2 "Get SDL2 library automatically as external project" 1) +#option(GET_SIXENSE "Get Sixense library automatically as external project" 1) option(USE_NSIGHT "Attempt to find the nSight libraries" 1) -option(GET_SDL2 "Get SDL2 library automatically as external project" 0) if (WIN32) add_paths_to_fixup_libs("${QT_DIR}/bin") diff --git a/cmake/externals/faceshift/CMakeLists.txt b/cmake/externals/faceshift/CMakeLists.txt new file mode 100644 index 0000000000..b18b861912 --- /dev/null +++ b/cmake/externals/faceshift/CMakeLists.txt @@ -0,0 +1,30 @@ +set(EXTERNAL_NAME faceshift) + +include(ExternalProject) +ExternalProject_Add( + ${EXTERNAL_NAME} + URL https://hifi-public.s3.amazonaws.com/dependencies/faceshift.zip + CMAKE_ARGS ${ANDROID_CMAKE_ARGS} -DCMAKE_INSTALL_PREFIX:PATH= + BINARY_DIR ${EXTERNAL_PROJECT_PREFIX}/build + LOG_DOWNLOAD 1 + LOG_CONFIGURE 1 + LOG_BUILD 1 +) + +# URL_MD5 1bdcb8a0b8d5b1ede434cc41efade41d + +# Hide this external target (for ide users) +set_target_properties(${EXTERNAL_NAME} PROPERTIES FOLDER "hidden/externals") + +ExternalProject_Get_Property(${EXTERNAL_NAME} INSTALL_DIR) + +string(TOUPPER ${EXTERNAL_NAME} EXTERNAL_NAME_UPPER) +set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${INSTALL_DIR}/include CACHE FILEPATH "Path to Faceshift include directory") + +if (WIN32) + set(${EXTERNAL_NAME_UPPER}_LIBRARY_DEBUG ${INSTALL_DIR}/lib/Debug/faceshift.lib CACHE FILEPATH "Faceshift libraries") + set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${INSTALL_DIR}/lib/Release/faceshift.lib CACHE FILEPATH "Faceshift libraries") +elseif (APPLE) + set(${EXTERNAL_NAME_UPPER}_LIBRARY_DEBUG ${INSTALL_DIR}/lib/Debug/libfaceshift.a CACHE FILEPATH "Faceshift libraries") + set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${INSTALL_DIR}/lib/Release/libfaceshift.a CACHE FILEPATH "Faceshift libraries") +endif() diff --git a/cmake/externals/sdl2/CMakeLists.txt b/cmake/externals/sdl2/CMakeLists.txt index e6c80cf6ef..0f44f28610 100644 --- a/cmake/externals/sdl2/CMakeLists.txt +++ b/cmake/externals/sdl2/CMakeLists.txt @@ -47,25 +47,13 @@ if (APPLE) ExternalProject_Get_Property(${EXTERNAL_NAME} SOURCE_DIR) set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIR ${SOURCE_DIR}/SDL2.framework/Headers CACHE PATH "Location of SDL2 include directory") set(${EXTERNAL_NAME_UPPER}_LIBRARY_TEMP ${SOURCE_DIR}/SDL2.framework/SDL2 CACHE STRING "Path to SDL2 library") +elseif (WIN32) + ExternalProject_Get_Property(${EXTERNAL_NAME} SOURCE_DIR) + set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIR ${SOURCE_DIR}/include CACHE PATH "Location of SDL2 include directory") + set(${EXTERNAL_NAME_UPPER}_LIBRARY_TEMP ${SOURCE_DIR}/lib/x86/SDL2.lib CACHE FILEPATH "Path to SDL2 library") + set(${EXTERNAL_NAME_UPPER}_DLL_PATH ${SOURCE_DIR}/lib/x86 CACHE PATH "Location of SDL2 DLL") else () - if (WIN32) - ExternalProject_Get_Property(${EXTERNAL_NAME} SOURCE_DIR) - set(_ROOT_DIR ${SOURCE_DIR}) - set(_INCLUDE_DIR ${_ROOT_DIR}/include) - set(_LIB_DIR "${SOURCE_DIR}/lib/x86") - set(_LIB_EXT "lib") - - set(${EXTERNAL_NAME_UPPER}_DLL_PATH ${_LIB_DIR} CACHE PATH "Location of SDL2 DLL") - else () - ExternalProject_Get_Property(${EXTERNAL_NAME} INSTALL_DIR) - set(_ROOT_DIR ${INSTALL_DIR}) - set(_INCLUDE_DIR ${_ROOT_DIR}/include/SDL2) - - set(_LIB_DIR ${INSTALL_DIR}/lib) - set(_LIB_EXT "so") - set(_LIB_PREFIX "lib") - endif () - - set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIR ${_INCLUDE_DIR} CACHE PATH "Location of SDL2 include directory") - set(${EXTERNAL_NAME_UPPER}_LIBRARY_TEMP ${_LIB_DIR}/${_LIB_PREFIX}SDL2.${_LIB_EXT} CACHE FILEPATH "Path to SDL2 library") -endif () \ No newline at end of file + ExternalProject_Get_Property(${EXTERNAL_NAME} INSTALL_DIR) + set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIR ${INSTALL_DIR}/include/SDL2 CACHE PATH "Location of SDL2 include directory") + set(${EXTERNAL_NAME_UPPER}_LIBRARY_TEMP ${INSTALL_DIR}/lib/libSDL2.so CACHE FILEPATH "Path to SDL2 library") +endif () diff --git a/cmake/externals/sixense/CMakeLists.txt b/cmake/externals/sixense/CMakeLists.txt index f6646e2272..72de4a7e15 100644 --- a/cmake/externals/sixense/CMakeLists.txt +++ b/cmake/externals/sixense/CMakeLists.txt @@ -1,30 +1,20 @@ include(ExternalProject) -include(SelectLibraryConfigurations) -set(EXTERNAL_NAME Sixense) +set(EXTERNAL_NAME sixense) string(TOUPPER ${EXTERNAL_NAME} EXTERNAL_NAME_UPPER) ExternalProject_Add( ${EXTERNAL_NAME} - URL ./SixenseSDK_062612.zip - URL_MD5 10cc8dc470d2ac1244a88cf04bc549cc + URL http://hifi-public.s3.amazonaws.com/dependencies/SixenseSDK_071615.zip + URL_MD5 752a3901f334124e9cffc2ba4136ef7d CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "" LOG_DOWNLOAD 1 ) -if (APPLE) - find_library(SIXENSE_LIBRARY_RELEASE lib/osx_x64/release_dll/libsixense_x64.dylib HINTS ${SIXENSE_SEARCH_DIRS}) - find_library(SIXENSE_LIBRARY_DEBUG lib/osx_x64/debug_dll/libsixensed_x64.dylib HINTS ${SIXENSE_SEARCH_DIRS}) -elseif (UNIX) - find_library(SIXENSE_LIBRARY_RELEASE lib/linux_x64/release/libsixense_x64.so HINTS ${SIXENSE_SEARCH_DIRS}) - # find_library(SIXENSE_LIBRARY_DEBUG lib/linux_x64/debug/libsixensed_x64.so HINTS ${SIXENSE_SEARCH_DIRS}) -elseif (WIN32) -endif () - - +set_target_properties(${EXTERNAL_NAME} PROPERTIES FOLDER "hidden/externals") ExternalProject_Get_Property(${EXTERNAL_NAME} SOURCE_DIR) @@ -39,22 +29,18 @@ if (WIN32) set(ARCH_DIR "Win32") set(ARCH_SUFFIX "") endif() - - # FIXME need to account for different architectures - set(${EXTERNAL_NAME_UPPER}_LIBRARIES "${SOURCE_DIR}/lib/${ARCH_DIR}/release_dll/sixense${ARCH_SUFFIX}.lib" CACHE TYPE INTERNAL) - add_paths_to_fixup_libs(${SOURCE_DIR}/bin/win32) + + set(${EXTERNAL_NAME_UPPER}_LIBRARIES "${SOURCE_DIR}/lib/${ARCH_DIR}/VS2013/release_dll/sixense${ARCH_SUFFIX}.lib" CACHE TYPE INTERNAL) + add_paths_to_fixup_libs("${SOURCE_DIR}/bin/${ARCH_DIR}/VS2013/release_dll") elseif(APPLE) - # FIXME need to account for different architectures - set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${SOURCE_DIR}/lib/osx_x64/release_dll/libsixense_x64.dylib CACHE TYPE INTERNAL) - add_paths_to_fixup_libs(${SOURCE_DIR}/bin/osx32) + set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${SOURCE_DIR}/lib/osx_x64/release_dll/libsixense_x64.dylib CACHE TYPE INTERNAL) elseif(NOT ANDROID) - # FIXME need to account for different architectures - set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${SOURCE_DIR}/lib/linux_x64/release/libsixense_x64.so CACHE TYPE INTERNAL) - add_paths_to_fixup_libs(${SOURCE_DIR}/bin/linux32) - + # FIXME need to account for different architectures + set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${SOURCE_DIR}/lib/linux_x64/release/libsixense_x64.so CACHE TYPE INTERNAL) + endif() diff --git a/cmake/macros/AddDependencyExternalProjects.cmake b/cmake/macros/AddDependencyExternalProjects.cmake index e859ef2db5..e8292c3198 100644 --- a/cmake/macros/AddDependencyExternalProjects.cmake +++ b/cmake/macros/AddDependencyExternalProjects.cmake @@ -16,7 +16,7 @@ macro(ADD_DEPENDENCY_EXTERNAL_PROJECTS) string(TOUPPER ${_PROJ_NAME} _PROJ_NAME_UPPER) # has the user told us they specific don't want this as an external project? - if (GET_${_PROJ_NAME_UPPER}) + if (NOT DISABLE_${_PROJ_NAME_UPPER}) # have we already detected we can't have this as external project on this OS? if (NOT DEFINED ${_PROJ_NAME_UPPER}_EXTERNAL_PROJECT OR ${_PROJ_NAME_UPPER}_EXTERNAL_PROJECT) # have we already setup the target? diff --git a/cmake/macros/TargetFaceshift.cmake b/cmake/macros/TargetFaceshift.cmake new file mode 100644 index 0000000000..99f65d942a --- /dev/null +++ b/cmake/macros/TargetFaceshift.cmake @@ -0,0 +1,14 @@ +# +# Copyright 2015 High Fidelity, Inc. +# Created by Bradley Austin Davis on 2015/10/10 +# +# Distributed under the Apache License, Version 2.0. +# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +# +macro(TARGET_FACESHIFT) + add_dependency_external_projects(faceshift) + find_package(Faceshift REQUIRED) + target_include_directories(${TARGET_NAME} PRIVATE ${FACESHIFT_INCLUDE_DIRS}) + target_link_libraries(${TARGET_NAME} ${FACESHIFT_LIBRARIES}) + add_definitions(-DHAVE_FACESHIFT) +endmacro() \ No newline at end of file diff --git a/cmake/macros/TargetSDL2.cmake b/cmake/macros/TargetSDL2.cmake new file mode 100644 index 0000000000..ee2328dfff --- /dev/null +++ b/cmake/macros/TargetSDL2.cmake @@ -0,0 +1,14 @@ +# +# Copyright 2015 High Fidelity, Inc. +# Created by Bradley Austin Davis on 2015/10/10 +# +# Distributed under the Apache License, Version 2.0. +# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +# +macro(TARGET_SDL2) + add_dependency_external_projects(sdl2) + find_package(SDL2 REQUIRED) + target_include_directories(${TARGET_NAME} SYSTEM PRIVATE ${SDL2_INCLUDE_DIR}) + target_link_libraries(${TARGET_NAME} ${SDL2_LIBRARY}) + add_definitions(-DHAVE_SDL2) +endmacro() \ No newline at end of file diff --git a/cmake/macros/TargetSixense.cmake b/cmake/macros/TargetSixense.cmake new file mode 100644 index 0000000000..b52af9cdd2 --- /dev/null +++ b/cmake/macros/TargetSixense.cmake @@ -0,0 +1,14 @@ +# +# Copyright 2015 High Fidelity, Inc. +# Created by Bradley Austin Davis on 2015/10/10 +# +# Distributed under the Apache License, Version 2.0. +# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +# +macro(TARGET_SIXENSE) + add_dependency_external_projects(sixense) + find_package(Sixense REQUIRED) + target_include_directories(${TARGET_NAME} PRIVATE ${SIXENSE_INCLUDE_DIRS}) + target_link_libraries(${TARGET_NAME} ${SIXENSE_LIBRARIES}) + add_definitions(-DHAVE_SIXENSE) +endmacro() \ No newline at end of file diff --git a/cmake/modules/FindFaceshift.cmake b/cmake/modules/FindFaceshift.cmake index 1f8b7b19fe..bd77951273 100644 --- a/cmake/modules/FindFaceshift.cmake +++ b/cmake/modules/FindFaceshift.cmake @@ -18,32 +18,9 @@ # See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html # -include("${MACRO_DIR}/HifiLibrarySearchHints.cmake") -hifi_library_search_hints("faceshift") - -find_path(FACESHIFT_INCLUDE_DIRS fsbinarystream.h PATH_SUFFIXES include HINTS ${FACESHIFT_SEARCH_DIRS}) - -if (APPLE) - set(ARCH_DIR "MacOS") -elseif (UNIX) - set(ARCH_DIR "UNIX") -elseif (WIN32) - if ("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") - set(ARCH_DIR "x64") - else() - set(ARCH_DIR "Win32") - endif() -endif () - -find_library(FACESHIFT_LIBRARY_RELEASE NAME faceshift PATH_SUFFIXES lib/${ARCH_DIR} HINTS ${FACESHIFT_SEARCH_DIRS}) -find_library(FACESHIFT_LIBRARY_DEBUG NAME faceshiftd PATH_SUFFIXES lib/${ARCH_DIR} HINTS ${FACESHIFT_SEARCH_DIRS}) - include(SelectLibraryConfigurations) select_library_configurations(FACESHIFT) -set(FACESHIFT_LIBRARIES ${FACESHIFT_LIBRARY}) - include(FindPackageHandleStandardArgs) find_package_handle_standard_args(Faceshift DEFAULT_MSG FACESHIFT_INCLUDE_DIRS FACESHIFT_LIBRARIES) - mark_as_advanced(FACESHIFT_INCLUDE_DIRS FACESHIFT_LIBRARIES FACESHIFT_SEARCH_DIRS) \ No newline at end of file diff --git a/cmake/modules/FindSixense.cmake b/cmake/modules/FindSixense.cmake index 98b37d5410..9abacac136 100644 --- a/cmake/modules/FindSixense.cmake +++ b/cmake/modules/FindSixense.cmake @@ -18,49 +18,6 @@ # See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html # -include("${MACRO_DIR}/HifiLibrarySearchHints.cmake") -hifi_library_search_hints("sixense") - -find_path(SIXENSE_INCLUDE_DIRS sixense.h PATH_SUFFIXES include HINTS ${SIXENSE_SEARCH_DIRS}) - -if (APPLE) - find_library(SIXENSE_LIBRARY_RELEASE lib/osx_x64/release_dll/libsixense_x64.dylib HINTS ${SIXENSE_SEARCH_DIRS}) - find_library(SIXENSE_LIBRARY_DEBUG lib/osx_x64/debug_dll/libsixensed_x64.dylib HINTS ${SIXENSE_SEARCH_DIRS}) -elseif (UNIX) - find_library(SIXENSE_LIBRARY_RELEASE lib/linux_x64/release/libsixense_x64.so HINTS ${SIXENSE_SEARCH_DIRS}) - # find_library(SIXENSE_LIBRARY_DEBUG lib/linux_x64/debug/libsixensed_x64.so HINTS ${SIXENSE_SEARCH_DIRS}) -elseif (WIN32) - if ("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") - set(ARCH_DIR "x64") - set(ARCH_SUFFIX "_x64") - else() - set(ARCH_DIR "Win32") - set(ARCH_SUFFIX "") - endif() - - find_library(SIXENSE_LIBRARY_RELEASE "lib/${ARCH_DIR}/release_dll/sixense${ARCH_SUFFIX}.lib" HINTS ${SIXENSE_SEARCH_DIRS}) - find_library(SIXENSE_LIBRARY_DEBUG "lib/${ARCH_DIR}/debug_dll/sixensed.lib" HINTS ${SIXENSE_SEARCH_DIRS}) - - find_path(SIXENSE_DEBUG_DLL_PATH "sixensed${ARCH_SUFFIX}.dll" PATH_SUFFIXES bin/${ARCH_DIR}/debug_dll HINTS ${SIXENSE_SEARCH_DIRS}) - find_path(SIXENSE_RELEASE_DLL_PATH "sixense${ARCH_SUFFIX}.dll" PATH_SUFFIXES bin/${ARCH_DIR}/release_dll HINTS ${SIXENSE_SEARCH_DIRS}) - find_path(SIXENSE_DEVICE_DLL_PATH DeviceDLL.dll PATH_SUFFIXES samples/${ARCH_DIR}/sixense_simple3d HINTS ${SIXENSE_SEARCH_DIRS}) -endif () - -include(SelectLibraryConfigurations) -select_library_configurations(SIXENSE) - -set(SIXENSE_REQUIREMENTS SIXENSE_INCLUDE_DIRS SIXENSE_LIBRARIES) -if (WIN32) - list(APPEND SIXENSE_REQUIREMENTS SIXENSE_DEBUG_DLL_PATH SIXENSE_RELEASE_DLL_PATH SIXENSE_DEVICE_DLL_PATH) -endif () - -set(SIXENSE_LIBRARIES "${SIXENSE_LIBRARY}") - include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Sixense DEFAULT_MSG ${SIXENSE_REQUIREMENTS}) - -if (WIN32) - add_paths_to_fixup_libs(${SIXENSE_DEBUG_DLL_PATH} ${SIXENSE_RELEASE_DLL_PATH} ${SIXENSE_DEVICE_DLL_PATH}) -endif () - +find_package_handle_standard_args(Sixense DEFAULT_MSG SIXENSE_INCLUDE_DIRS SIXENSE_LIBRARIES) mark_as_advanced(SIXENSE_LIBRARIES SIXENSE_INCLUDE_DIRS SIXENSE_SEARCH_DIRS) diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index f9c92c59e7..f04fa88910 100644 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -2,7 +2,12 @@ set(TARGET_NAME interface) project(${TARGET_NAME}) # set a default root dir for each of our optional externals if it was not passed -set(OPTIONAL_EXTERNALS "Faceshift" "LeapMotion" "RtMidi" "RSSDK" "3DConnexionClient" "iViewHMD") +set(OPTIONAL_EXTERNALS "LeapMotion" "RtMidi" "RSSDK" "iViewHMD") + +if(WIN32) + list(APPEND OPTIONAL_EXTERNALS "3DConnexionClient") +endif() + foreach(EXTERNAL ${OPTIONAL_EXTERNALS}) string(TOUPPER ${EXTERNAL} ${EXTERNAL}_UPPERCASE) if (NOT ${${EXTERNAL}_UPPERCASE}_ROOT_DIR) @@ -102,12 +107,14 @@ link_hifi_libraries(shared octree environment gpu gl procedural model render render-utils entities-renderer ui auto-updater plugins display-plugins input-plugins) +#fixme find a way to express faceshift as a plugin target_bullet() target_glew() target_opengl() - -add_dependency_external_projects(sdl2) +if (WIN32 OR APPLE) + target_faceshift() +endif() # perform standard include and linking for found externals foreach(EXTERNAL ${OPTIONAL_EXTERNALS}) diff --git a/interface/external/faceshift/readme.txt b/interface/external/faceshift/readme.txt deleted file mode 100644 index 4208711632..0000000000 --- a/interface/external/faceshift/readme.txt +++ /dev/null @@ -1,26 +0,0 @@ - -Instructions for adding the Faceshift library to Interface -Stephen Birarda, July 18th, 2014 - -OS X users: You can also use homebrew to get the Faceshift library by tapping our repo - highfidelity/homebrew-formulas -and then calling 'brew install highfidelity/formulas/faceshift'. - -You can download the Faceshift SDK from http://download.faceshift.com/faceshift-network.zip. - -Create a ‘faceshift’ folder under interface/externals. - -You may optionally choose to place this folder in a location outside the repository (so you can re-use with different checkouts and different projects). - -If so our CMake find module expects you to set the ENV variable 'HIFI_LIB_DIR' to a directory containing a subfolder ‘faceshift’ that contains the lib and include folders. - -1. Build a Faceshift static library from the fsbinarystream.cpp file. - Windows: Win32 console application; no precompiled header or SDL checks; no ATL or MFC headers; Project Properties, Configuration Type = Static Library (.lib). - -2. Copy the library files to the ‘lib’ folder in your Faceshift folder. - OSX: If you build a release version call it libfaceshift.a. The debug version should be called libfaceshiftd.a. - Windows: The release and debug versions should be called faceshift.lib and faceshiftd.lib, respectively. Copy them into a ‘Win32’ folder in your ‘lib’ folder. - -3. Copy the fsbinarystream.h header file from the Faceshift SDK into the ‘include’ folder in your Faceshift folder. - -4. Clear your build directory, run cmake and build, and you should be all set. - diff --git a/interface/external/sdl2/readme.txt b/interface/external/sdl2/readme.txt deleted file mode 100644 index 9f3bd40e15..0000000000 --- a/interface/external/sdl2/readme.txt +++ /dev/null @@ -1,13 +0,0 @@ - -Instructions for adding the SDL library (SDL2) to Interface -David Rowe, 11 Jan 2015 - -You can download the SDL development library from https://www.libsdl.org/. Interface has been tested with version 2.0.3. - -1. Copy the include and lib folders into the interface/externals/sdl2 folder. - This readme.txt should be there as well. - - You may optionally choose to copy the SDK folders to a location outside the repository (so you can re-use with different checkouts and different projects). - If so our CMake find module expects you to set the ENV variable 'HIFI_LIB_DIR' to a directory containing a subfolder 'sdl2' that contains the two folders mentioned above. - -2. Clear your build directory, run cmake and build, and you should be all set. diff --git a/interface/external/sixense/readme.txt b/interface/external/sixense/readme.txt deleted file mode 100644 index a4790caa5e..0000000000 --- a/interface/external/sixense/readme.txt +++ /dev/null @@ -1,10 +0,0 @@ - -Instructions for adding the Sixense driver to Interface -Andrzej Kapolka, November 18, 2013 - -1. Copy the Sixense sdk folders (bin, include, lib, and samples) into the interface/external/Sixense folder. This readme.txt should be there as well. - - You may optionally choose to copy the SDK folders to a location outside the repository (so you can re-use with different checkouts and different projects). - If so our CMake find module expects you to set the ENV variable 'HIFI_LIB_DIR' to a directory containing a subfolder 'sixense' that contains the folders mentioned above. - -3. Delete your build directory, run cmake and build, and you should be all set. diff --git a/libraries/input-plugins/CMakeLists.txt b/libraries/input-plugins/CMakeLists.txt index 094a697012..c26e14e756 100644 --- a/libraries/input-plugins/CMakeLists.txt +++ b/libraries/input-plugins/CMakeLists.txt @@ -11,55 +11,5 @@ if (WIN32) target_link_libraries(${TARGET_NAME} ${OPENVR_LIBRARIES}) endif() -#add_dependency_external_projects(Sixense) -#find_package(Sixense REQUIRED) -#target_include_directories(${TARGET_NAME} PRIVATE ${SIXENSE_INCLUDE_DIRS}) -#target_link_libraries(${TARGET_NAME} ${SIXENSE_LIBRARIES}) - -# set a default root dir for each of our optional externals if it was not passed -set(OPTIONAL_EXTERNALS "SDL2" "Sixense") -foreach(EXTERNAL ${OPTIONAL_EXTERNALS}) - string(TOUPPER ${EXTERNAL} ${EXTERNAL}_UPPERCASE) - if (NOT ${${EXTERNAL}_UPPERCASE}_ROOT_DIR) - string(TOLOWER ${EXTERNAL} ${EXTERNAL}_LOWERCASE) - set(${${EXTERNAL}_UPPERCASE}_ROOT_DIR "${CMAKE_SOURCE_DIR}/interface/external/${${EXTERNAL}_LOWERCASE}") - endif () -endforeach() - -# perform standard include and linking for found externals -foreach(EXTERNAL ${OPTIONAL_EXTERNALS}) - - if (${${EXTERNAL}_UPPERCASE}_REQUIRED) - find_package(${EXTERNAL} REQUIRED) - else () - find_package(${EXTERNAL}) - endif () - - if (${${EXTERNAL}_UPPERCASE}_FOUND AND NOT DISABLE_${${EXTERNAL}_UPPERCASE}) - add_definitions(-DHAVE_${${EXTERNAL}_UPPERCASE}) - - # include the library directories (ignoring warnings) - if (NOT ${${EXTERNAL}_UPPERCASE}_INCLUDE_DIRS) - set(${${EXTERNAL}_UPPERCASE}_INCLUDE_DIRS ${${${EXTERNAL}_UPPERCASE}_INCLUDE_DIR}) - endif () - - include_directories(SYSTEM ${${${EXTERNAL}_UPPERCASE}_INCLUDE_DIRS}) - - # perform the system include hack for OS X to ignore warnings - if (APPLE) - foreach(EXTERNAL_INCLUDE_DIR ${${${EXTERNAL}_UPPERCASE}_INCLUDE_DIRS}) - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -isystem ${EXTERNAL_INCLUDE_DIR}") - endforeach() - endif () - - if (NOT ${${EXTERNAL}_UPPERCASE}_LIBRARIES) - set(${${EXTERNAL}_UPPERCASE}_LIBRARIES ${${${EXTERNAL}_UPPERCASE}_LIBRARY}) - endif () - - if (NOT APPLE OR NOT ${${EXTERNAL}_UPPERCASE} MATCHES "SIXENSE") - target_link_libraries(${TARGET_NAME} ${${${EXTERNAL}_UPPERCASE}_LIBRARIES}) - elseif (APPLE AND NOT INSTALLER_BUILD) - add_definitions(-DSIXENSE_LIB_FILENAME=\"${${${EXTERNAL}_UPPERCASE}_LIBRARY_RELEASE}\") - endif () - endif () -endforeach() +target_sdl2() +target_sixense() From e12ddf86f6b3fb90c3f51f3e63b322760ac5af84 Mon Sep 17 00:00:00 2001 From: Brad Hefta-Gaub Date: Fri, 30 Oct 2015 08:33:29 -0700 Subject: [PATCH 25/29] add back optional externals --- CMakeLists.txt | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d69b8c4c77..11ef4752f5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -186,19 +186,19 @@ set_property(DIRECTORY PROPERTY EP_PREFIX ${EXTERNAL_PROJECT_PREFIX}) setup_externals_binary_dir() # setup options to grab external project dependencies -#option(GET_BULLET "Get Bullet library automatically as external project" 1) -#option(GET_GLM "Get GLM library automatically as external project" 1) -#option(GET_GVERB "Get Gverb library automatically as external project" 1) -#option(GET_TBB "Get Threading Building Blocks library automatically as external project" 1) -#option(GET_LIBOVR "Get LibOVR library automatically as external project" 1) -#option(GET_VHACD "Get V-HACD library automatically as external project" 1) -#option(GET_POLYVOX "Get polyvox library automatically as external project" 1) -#option(GET_OPENVR "Get OpenVR library automatically as external project" 1) -#option(GET_BOOSTCONFIG "Get Boost-config library automatically as external project" 1) -#option(GET_OGLPLUS "Get OGLplus library automatically as external project" 1) -#option(GET_GLEW "Get GLEW library automatically as external project" 1) -#option(GET_SDL2 "Get SDL2 library automatically as external project" 1) -#option(GET_SIXENSE "Get Sixense library automatically as external project" 1) +option(GET_BULLET "Get Bullet library automatically as external project" 1) +option(GET_GLM "Get GLM library automatically as external project" 1) +option(GET_GVERB "Get Gverb library automatically as external project" 1) +option(GET_TBB "Get Threading Building Blocks library automatically as external project" 1) +option(GET_LIBOVR "Get LibOVR library automatically as external project" 1) +option(GET_VHACD "Get V-HACD library automatically as external project" 1) +option(GET_POLYVOX "Get polyvox library automatically as external project" 1) +option(GET_OPENVR "Get OpenVR library automatically as external project" 1) +option(GET_BOOSTCONFIG "Get Boost-config library automatically as external project" 1) +option(GET_OGLPLUS "Get OGLplus library automatically as external project" 1) +option(GET_GLEW "Get GLEW library automatically as external project" 1) +option(GET_SDL2 "Get SDL2 library automatically as external project" 1) +option(GET_SIXENSE "Get Sixense library automatically as external project" 1) option(USE_NSIGHT "Attempt to find the nSight libraries" 1) From fb3bf163913a2fa7cb79a8c85354c22950cf0274 Mon Sep 17 00:00:00 2001 From: Brad Hefta-Gaub Date: Fri, 30 Oct 2015 09:01:42 -0700 Subject: [PATCH 26/29] improvement to cmake to explicitly use local external dependency --- CMakeLists.txt | 15 --------------- cmake/macros/AddDependencyExternalProjects.cmake | 2 +- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 11ef4752f5..efe99b550b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -185,21 +185,6 @@ set(EXTERNAL_PROJECT_PREFIX "project") set_property(DIRECTORY PROPERTY EP_PREFIX ${EXTERNAL_PROJECT_PREFIX}) setup_externals_binary_dir() -# setup options to grab external project dependencies -option(GET_BULLET "Get Bullet library automatically as external project" 1) -option(GET_GLM "Get GLM library automatically as external project" 1) -option(GET_GVERB "Get Gverb library automatically as external project" 1) -option(GET_TBB "Get Threading Building Blocks library automatically as external project" 1) -option(GET_LIBOVR "Get LibOVR library automatically as external project" 1) -option(GET_VHACD "Get V-HACD library automatically as external project" 1) -option(GET_POLYVOX "Get polyvox library automatically as external project" 1) -option(GET_OPENVR "Get OpenVR library automatically as external project" 1) -option(GET_BOOSTCONFIG "Get Boost-config library automatically as external project" 1) -option(GET_OGLPLUS "Get OGLplus library automatically as external project" 1) -option(GET_GLEW "Get GLEW library automatically as external project" 1) -option(GET_SDL2 "Get SDL2 library automatically as external project" 1) -option(GET_SIXENSE "Get Sixense library automatically as external project" 1) - option(USE_NSIGHT "Attempt to find the nSight libraries" 1) diff --git a/cmake/macros/AddDependencyExternalProjects.cmake b/cmake/macros/AddDependencyExternalProjects.cmake index e8292c3198..e35ca98959 100644 --- a/cmake/macros/AddDependencyExternalProjects.cmake +++ b/cmake/macros/AddDependencyExternalProjects.cmake @@ -16,7 +16,7 @@ macro(ADD_DEPENDENCY_EXTERNAL_PROJECTS) string(TOUPPER ${_PROJ_NAME} _PROJ_NAME_UPPER) # has the user told us they specific don't want this as an external project? - if (NOT DISABLE_${_PROJ_NAME_UPPER}) + if (NOT USE_LOCAL_${_PROJ_NAME_UPPER}) # have we already detected we can't have this as external project on this OS? if (NOT DEFINED ${_PROJ_NAME_UPPER}_EXTERNAL_PROJECT OR ${_PROJ_NAME_UPPER}_EXTERNAL_PROJECT) # have we already setup the target? From 7a4787a79cec2d33471ae86ebbb27f511705e2d8 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Fri, 30 Oct 2015 09:21:13 -0700 Subject: [PATCH 27/29] Rename stepSimulation to stepSimulationWithSubstepCallback to fix warning --- libraries/physics/src/PhysicsEngine.cpp | 7 ++++--- libraries/physics/src/ThreadSafeDynamicsWorld.cpp | 5 +++-- libraries/physics/src/ThreadSafeDynamicsWorld.h | 5 +++-- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/libraries/physics/src/PhysicsEngine.cpp b/libraries/physics/src/PhysicsEngine.cpp index 6773cecb14..2abe4317d7 100644 --- a/libraries/physics/src/PhysicsEngine.cpp +++ b/libraries/physics/src/PhysicsEngine.cpp @@ -228,7 +228,7 @@ void PhysicsEngine::removeContacts(ObjectMotionState* motionState) { void PhysicsEngine::stepSimulation() { CProfileManager::Reset(); - BT_PROFILE("stepSimulation"); + BT_PROFILE("stepSimulationWithSubstepCallback"); // NOTE: the grand order of operations is: // (1) pull incoming changes // (2) step simulation @@ -241,7 +241,7 @@ void PhysicsEngine::stepSimulation() { float timeStep = btMin(dt, MAX_TIMESTEP); if (_myAvatarController) { - // ADEBUG TODO: move this stuff outside and in front of stepSimulation, because + // ADEBUG TODO: move this stuff outside and in front of stepSimulationWithSubstepCallback, because // the updateShapeIfNecessary() call needs info from MyAvatar and should // be done on the main thread during the pre-simulation stuff if (_myAvatarController->needsRemoval()) { @@ -263,7 +263,8 @@ void PhysicsEngine::stepSimulation() { updateContactMap(); }; - int numSubsteps = _dynamicsWorld->stepSimulation(timeStep, PHYSICS_ENGINE_MAX_NUM_SUBSTEPS, PHYSICS_ENGINE_FIXED_SUBSTEP, onSubStep); + int numSubsteps = _dynamicsWorld->stepSimulationWithSubstepCallback(timeStep, PHYSICS_ENGINE_MAX_NUM_SUBSTEPS, + PHYSICS_ENGINE_FIXED_SUBSTEP, onSubStep); if (numSubsteps > 0) { BT_PROFILE("postSimulation"); _numSubsteps += (uint32_t)numSubsteps; diff --git a/libraries/physics/src/ThreadSafeDynamicsWorld.cpp b/libraries/physics/src/ThreadSafeDynamicsWorld.cpp index 8bf7cdab20..94d6315705 100644 --- a/libraries/physics/src/ThreadSafeDynamicsWorld.cpp +++ b/libraries/physics/src/ThreadSafeDynamicsWorld.cpp @@ -27,8 +27,9 @@ ThreadSafeDynamicsWorld::ThreadSafeDynamicsWorld( : btDiscreteDynamicsWorld(dispatcher, pairCache, constraintSolver, collisionConfiguration) { } -int ThreadSafeDynamicsWorld::stepSimulation( btScalar timeStep, int maxSubSteps, btScalar fixedTimeStep, SubStepCallback onSubStep) { - BT_PROFILE("stepSimulation"); +int ThreadSafeDynamicsWorld::stepSimulationWithSubstepCallback(btScalar timeStep, int maxSubSteps, + btScalar fixedTimeStep, SubStepCallback onSubStep) { + BT_PROFILE("stepSimulationWithSubstepCallback"); int subSteps = 0; if (maxSubSteps) { //fixed timestep with interpolation diff --git a/libraries/physics/src/ThreadSafeDynamicsWorld.h b/libraries/physics/src/ThreadSafeDynamicsWorld.h index 1f6ce09d0c..26954832cf 100644 --- a/libraries/physics/src/ThreadSafeDynamicsWorld.h +++ b/libraries/physics/src/ThreadSafeDynamicsWorld.h @@ -37,8 +37,9 @@ public: btConstraintSolver* constraintSolver, btCollisionConfiguration* collisionConfiguration); - // virtual overrides from btDiscreteDynamicsWorld - int stepSimulation( btScalar timeStep, int maxSubSteps=1, btScalar fixedTimeStep=btScalar(1.)/btScalar(60.), SubStepCallback onSubStep = []() { }); + int stepSimulationWithSubstepCallback(btScalar timeStep, int maxSubSteps = 1, + btScalar fixedTimeStep = btScalar(1.)/btScalar(60.), + SubStepCallback onSubStep = []() { }); void synchronizeMotionStates(); // btDiscreteDynamicsWorld::m_localTime is the portion of real-time that has not yet been simulated From 84869c512b44ac1ca27b2e6cadd2616ac0ea865c Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Fri, 30 Oct 2015 09:30:22 -0700 Subject: [PATCH 28/29] Fix mis-renamed method names --- libraries/physics/src/PhysicsEngine.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/physics/src/PhysicsEngine.cpp b/libraries/physics/src/PhysicsEngine.cpp index 2abe4317d7..1e652b75c4 100644 --- a/libraries/physics/src/PhysicsEngine.cpp +++ b/libraries/physics/src/PhysicsEngine.cpp @@ -228,7 +228,7 @@ void PhysicsEngine::removeContacts(ObjectMotionState* motionState) { void PhysicsEngine::stepSimulation() { CProfileManager::Reset(); - BT_PROFILE("stepSimulationWithSubstepCallback"); + BT_PROFILE("stepSimulation"); // NOTE: the grand order of operations is: // (1) pull incoming changes // (2) step simulation @@ -241,7 +241,7 @@ void PhysicsEngine::stepSimulation() { float timeStep = btMin(dt, MAX_TIMESTEP); if (_myAvatarController) { - // ADEBUG TODO: move this stuff outside and in front of stepSimulationWithSubstepCallback, because + // ADEBUG TODO: move this stuff outside and in front of stepSimulation, because // the updateShapeIfNecessary() call needs info from MyAvatar and should // be done on the main thread during the pre-simulation stuff if (_myAvatarController->needsRemoval()) { From 93503d0a216019cff88a2b08441f88539881932f Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Fri, 30 Oct 2015 11:03:13 -0700 Subject: [PATCH 29/29] make kinematic grab set entities kinematic in bullet and update entity position --- examples/controllers/handControllerGrab.js | 24 ++++++++++++++++------ interface/src/avatar/AvatarActionHold.cpp | 5 +++++ libraries/physics/src/ObjectAction.cpp | 15 +++++++++++++- libraries/physics/src/ObjectMotionState.h | 9 ++++++++ 4 files changed, 46 insertions(+), 7 deletions(-) diff --git a/examples/controllers/handControllerGrab.js b/examples/controllers/handControllerGrab.js index cb445a0960..9ee9ed1e04 100644 --- a/examples/controllers/handControllerGrab.js +++ b/examples/controllers/handControllerGrab.js @@ -55,6 +55,7 @@ var NEAR_GRABBING_VELOCITY_SMOOTH_RATIO = 1.0; // adjust time-averaging of held var NEAR_PICK_MAX_DISTANCE = 0.3; // max length of pick-ray for close grabbing to be selected var RELEASE_VELOCITY_MULTIPLIER = 1.5; // affects throwing things var PICK_BACKOFF_DISTANCE = 0.2; // helps when hand is intersecting the grabble object +var NEAR_GRABBING_KINEMATIC = true; // force objects to be kinematic when near-grabbed ///////////////////////////////////////////////////////////////// // @@ -404,8 +405,9 @@ function MyController(hand, triggerAction) { var handControllerPosition = Controller.getSpatialControlPosition(this.palm); var handRotation = Quat.multiply(MyAvatar.orientation, Controller.getSpatialControlRawRotation(this.palm)); - var grabbedProperties = Entities.getEntityProperties(this.grabbedEntity, ["position", "rotation", - "gravity", "ignoreForCollisions"]); + var grabbedProperties = Entities.getEntityProperties(this.grabbedEntity, ["position", "rotation", "gravity", + "ignoreForCollisions", + "collisionsWillMove"]); var now = Date.now(); // add the action and initialize some variables @@ -549,8 +551,14 @@ function MyController(hand, triggerAction) { this.lineOff(); var grabbedProperties = Entities.getEntityProperties(this.grabbedEntity, - ["position", "rotation", "gravity", "ignoreForCollisions"]); + ["position", "rotation", "gravity", + "ignoreForCollisions", "collisionsWillMove"]); this.activateEntity(this.grabbedEntity, grabbedProperties); + if (grabbedProperties.collisionsWillMove && NEAR_GRABBING_KINEMATIC) { + Entities.editEntity(this.grabbedEntity, { + collisionsWillMove: false + }); + } var handRotation = this.getHandRotation(); var handPosition = this.getHandPosition(); @@ -579,7 +587,8 @@ function MyController(hand, triggerAction) { timeScale: NEAR_GRABBING_ACTION_TIMEFRAME, relativePosition: this.offsetPosition, relativeRotation: this.offsetRotation, - ttl: ACTION_TTL + ttl: ACTION_TTL, + kinematic: NEAR_GRABBING_KINEMATIC }); if (this.actionID === NULL_ACTION_ID) { this.actionID = null; @@ -631,7 +640,8 @@ function MyController(hand, triggerAction) { timeScale: NEAR_GRABBING_ACTION_TIMEFRAME, relativePosition: this.offsetPosition, relativeRotation: this.offsetRotation, - ttl: ACTION_TTL + ttl: ACTION_TTL, + kinematic: NEAR_GRABBING_KINEMATIC }); this.actionTimeout = now + (ACTION_TTL * MSEC_PER_SEC); } @@ -828,6 +838,7 @@ function MyController(hand, triggerAction) { if (data["refCount"] == 1) { data["gravity"] = grabbedProperties.gravity; data["ignoreForCollisions"] = grabbedProperties.ignoreForCollisions; + data["collisionsWillMove"] = grabbedProperties.collisionsWillMove; var whileHeldProperties = {gravity: {x:0, y:0, z:0}}; if (invertSolidWhileHeld) { whileHeldProperties["ignoreForCollisions"] = ! grabbedProperties.ignoreForCollisions; @@ -845,7 +856,8 @@ function MyController(hand, triggerAction) { if (data["refCount"] < 1) { Entities.editEntity(entityID, { gravity: data["gravity"], - ignoreForCollisions: data["ignoreForCollisions"] + ignoreForCollisions: data["ignoreForCollisions"], + collisionsWillMove: data["collisionsWillMove"] }); data = null; } diff --git a/interface/src/avatar/AvatarActionHold.cpp b/interface/src/avatar/AvatarActionHold.cpp index 238e48d2fd..59bfd88be6 100644 --- a/interface/src/avatar/AvatarActionHold.cpp +++ b/interface/src/avatar/AvatarActionHold.cpp @@ -119,6 +119,9 @@ void AvatarActionHold::doKinematicUpdate(float deltaTimeStep) { worldTrans.setRotation(glmToBullet(_rotationalTarget)); rigidBody->setWorldTransform(worldTrans); + ownerEntity->setPosition(_positionalTarget); + ownerEntity->setRotation(_rotationalTarget); + _previousPositionalTarget = _positionalTarget; _previousRotationalTarget = _rotationalTarget; _previousSet = true; @@ -224,6 +227,8 @@ QVariantMap AvatarActionHold::getArguments() { arguments["relativeRotation"] = glmToQMap(_relativeRotation); arguments["timeScale"] = _linearTimeScale; arguments["hand"] = _hand; + arguments["kinematic"] = _kinematic; + arguments["kinematicSetVelocity"] = _kinematicSetVelocity; }); return arguments; } diff --git a/libraries/physics/src/ObjectAction.cpp b/libraries/physics/src/ObjectAction.cpp index ff8382a143..d44ebc30b1 100644 --- a/libraries/physics/src/ObjectAction.cpp +++ b/libraries/physics/src/ObjectAction.cpp @@ -35,7 +35,9 @@ void ObjectAction::updateAction(btCollisionWorld* collisionWorld, btScalar delta if (ownerEntityExpired) { qDebug() << "warning -- action with no entity removing self from btCollisionWorld."; btDynamicsWorld* dynamicsWorld = static_cast(collisionWorld); - dynamicsWorld->removeAction(this); + if (dynamicsWorld) { + dynamicsWorld->removeAction(this); + } return; } @@ -120,6 +122,17 @@ QVariantMap ObjectAction::getArguments() { arguments["ttl"] = (float)(_expires - now) / (float)USECS_PER_SECOND; } arguments["tag"] = _tag; + + EntityItemPointer entity = _ownerEntity.lock(); + if (entity) { + ObjectMotionState* motionState = static_cast(entity->getPhysicsInfo()); + if (motionState) { + arguments["::active"] = motionState->isActive(); + arguments["::motion-type"] = motionTypeToString(motionState->getMotionType()); + } else { + arguments["::no-motion-state"] = true; + } + } }); return arguments; } diff --git a/libraries/physics/src/ObjectMotionState.h b/libraries/physics/src/ObjectMotionState.h index 450ac34a90..22f0e9dcb0 100644 --- a/libraries/physics/src/ObjectMotionState.h +++ b/libraries/physics/src/ObjectMotionState.h @@ -29,6 +29,15 @@ enum MotionType { MOTION_TYPE_KINEMATIC // keyframed motion }; +inline QString motionTypeToString(MotionType motionType) { + switch(motionType) { + case MOTION_TYPE_STATIC: return QString("static"); + case MOTION_TYPE_DYNAMIC: return QString("dynamic"); + case MOTION_TYPE_KINEMATIC: return QString("kinematic"); + } + return QString("unknown"); +} + enum MotionStateType { MOTIONSTATE_TYPE_INVALID, MOTIONSTATE_TYPE_ENTITY,