From c462b8c387559f14150d4d9416eab2d8c3d89e15 Mon Sep 17 00:00:00 2001 From: Brad Davis <bdavis@saintandreas.org> Date: Fri, 15 Jul 2016 13:51:14 -0700 Subject: [PATCH 1/4] Make search line termination a circle, like 2D UI --- .../system/controllers/handControllerGrab.js | 31 +++++++++++++++---- 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/scripts/system/controllers/handControllerGrab.js b/scripts/system/controllers/handControllerGrab.js index 13d71dca1c..e1c4c9e757 100644 --- a/scripts/system/controllers/handControllerGrab.js +++ b/scripts/system/controllers/handControllerGrab.js @@ -229,6 +229,14 @@ function getTag() { return "grab-" + MyAvatar.sessionUUID; } +function colorPow(color, power) { + return { + red: Math.pow(color.red / 255.0, power) * 255, + green: Math.pow(color.green / 255.0, power) * 255, + blue: Math.pow(color.blue / 255.0, power) * 255, + }; +} + function entityHasActions(entityID) { return Entities.getActionIDs(entityID).length > 0; } @@ -547,23 +555,34 @@ function MyController(hand) { var SEARCH_SPHERE_ALPHA = 0.5; this.searchSphereOn = function (location, size, color) { + + var rotation = Quat.lookAt(location, Camera.getPosition(), Vec3.UP); + var brightColor = colorPow(color, 0.1); + print("bright color " + brightColor.red + " " + brightColor.green + " " + brightColor.blue); if (this.searchSphere === null) { var sphereProperties = { position: location, - size: size, - color: color, - alpha: SEARCH_SPHERE_ALPHA, + rotation: rotation, + outerRadius: size * 3.0, + innerColor: brightColor, + outerColor: color, + innerAlpha: 0.9, + outerAlpha: 0.0, solid: true, ignoreRayIntersection: true, drawInFront: true, // Even when burried inside of something, show it. visible: true }; - this.searchSphere = Overlays.addOverlay("sphere", sphereProperties); + this.searchSphere = Overlays.addOverlay("circle3d", sphereProperties); } else { Overlays.editOverlay(this.searchSphere, { position: location, - size: size, - color: color, + rotation: rotation, + innerColor: brightColor, + outerColor: color, + innerAlpha: 1.0, + outerAlpha: 0.0, + outerRadius: size * 3.0, visible: true }); } From 0d811c489aa3464f9a75761581078ad5c0a50b29 Mon Sep 17 00:00:00 2001 From: Brad Davis <bdavis@saintandreas.org> Date: Fri, 15 Jul 2016 14:05:16 -0700 Subject: [PATCH 2/4] Removing debug logging --- scripts/system/controllers/handControllerGrab.js | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/system/controllers/handControllerGrab.js b/scripts/system/controllers/handControllerGrab.js index e1c4c9e757..4f0578369f 100644 --- a/scripts/system/controllers/handControllerGrab.js +++ b/scripts/system/controllers/handControllerGrab.js @@ -558,7 +558,6 @@ function MyController(hand) { var rotation = Quat.lookAt(location, Camera.getPosition(), Vec3.UP); var brightColor = colorPow(color, 0.1); - print("bright color " + brightColor.red + " " + brightColor.green + " " + brightColor.blue); if (this.searchSphere === null) { var sphereProperties = { position: location, From b31300406a63fd39c34c570cc554f4ceadc87161 Mon Sep 17 00:00:00 2001 From: Brad Davis <bdavis@saintandreas.org> Date: Fri, 15 Jul 2016 16:19:19 -0700 Subject: [PATCH 3/4] Don't extend glow line length --- libraries/render-utils/src/glowLine.slg | 4 ---- 1 file changed, 4 deletions(-) diff --git a/libraries/render-utils/src/glowLine.slg b/libraries/render-utils/src/glowLine.slg index 429cb8ee37..9af8eaa4d0 100644 --- a/libraries/render-utils/src/glowLine.slg +++ b/libraries/render-utils/src/glowLine.slg @@ -71,28 +71,24 @@ void main() { lineOrthogonal *= 0.02; gl_Position = gl_PositionIn[0]; - gl_Position.xy -= lineNormal; gl_Position.xy -= lineOrthogonal; outColor = inColor[0]; outLineDistance = vec3(-1.02, -1, gl_Position.z); EmitVertex(); gl_Position = gl_PositionIn[0]; - gl_Position.xy -= lineNormal; gl_Position.xy += lineOrthogonal; outColor = inColor[0]; outLineDistance = vec3(-1.02, 1, gl_Position.z); EmitVertex(); gl_Position = gl_PositionIn[1]; - gl_Position.xy += lineNormal; gl_Position.xy -= lineOrthogonal; outColor = inColor[1]; outLineDistance = vec3(1.02, -1, gl_Position.z); EmitVertex(); gl_Position = gl_PositionIn[1]; - gl_Position.xy += lineNormal; gl_Position.xy += lineOrthogonal; outColor = inColor[1]; outLineDistance = vec3(1.02, 1, gl_Position.z); From 1145c3b59006e2bf3378f80a8d85e5f48b9858dc Mon Sep 17 00:00:00 2001 From: Brad Davis <bdavis@saintandreas.org> Date: Fri, 15 Jul 2016 17:45:16 -0700 Subject: [PATCH 4/4] Smaller and hotter circle, per Philip --- scripts/system/controllers/handControllerGrab.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/system/controllers/handControllerGrab.js b/scripts/system/controllers/handControllerGrab.js index 4f0578369f..8020163d32 100644 --- a/scripts/system/controllers/handControllerGrab.js +++ b/scripts/system/controllers/handControllerGrab.js @@ -557,12 +557,12 @@ function MyController(hand) { this.searchSphereOn = function (location, size, color) { var rotation = Quat.lookAt(location, Camera.getPosition(), Vec3.UP); - var brightColor = colorPow(color, 0.1); + var brightColor = colorPow(color, 0.06); if (this.searchSphere === null) { var sphereProperties = { position: location, rotation: rotation, - outerRadius: size * 3.0, + outerRadius: size * 1.2, innerColor: brightColor, outerColor: color, innerAlpha: 0.9, @@ -581,7 +581,7 @@ function MyController(hand) { outerColor: color, innerAlpha: 1.0, outerAlpha: 0.0, - outerRadius: size * 3.0, + outerRadius: size * 1.2, visible: true }); }