From 6254467bce8fcf18eedea2052c734bb20ceefe9d Mon Sep 17 00:00:00 2001 From: Pete Shadbolt Date: Wed, 18 May 2016 23:21:58 +0100 Subject: [PATCH] Added gimbal --- static/index.html | 1 + static/scripts/materials.js | 16 +++++++++------- static/scripts/mouse.js | 3 ++- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/static/index.html b/static/index.html index 95a9b3b..46999cb 100644 --- a/static/index.html +++ b/static/index.html @@ -21,6 +21,7 @@ + diff --git a/static/scripts/materials.js b/static/scripts/materials.js index f6102f4..2b1a285 100644 --- a/static/scripts/materials.js +++ b/static/scripts/materials.js @@ -6,23 +6,25 @@ var curveProperties = { }; materials.prepare = function() { - var sprite = new THREE.Texture(document.getElementById("ball")); - sprite.needsUpdate = true; + var ballSprite = new THREE.Texture(document.getElementById("ball")); + var tipSprite = new THREE.Texture(document.getElementById("tip")); + ballSprite.needsUpdate = true; + tipSprite.needsUpdate = true; materials.edge = new THREE.LineBasicMaterial({ color: "gray", transparent: false, linewidth: 1 }); - materials.point = new THREE.PointsMaterial({ - size: 0.1, - map: sprite, + materials.tip = new THREE.PointsMaterial({ + size: 0.4, + map: tipSprite, alphaTest: 0.5, transparent: true, - vertexColors: THREE.VertexColors + color: "red" }); materials.qubit = new THREE.PointsMaterial({ size: 0.3, - map: sprite, + map: ballSprite, alphaTest: 0.5, transparent: true, vertexColors: THREE.VertexColors diff --git a/static/scripts/mouse.js b/static/scripts/mouse.js index 7b87ed2..a22c6a9 100644 --- a/static/scripts/mouse.js +++ b/static/scripts/mouse.js @@ -1,5 +1,6 @@ var mouse = {}; mouse.wasClick = true; +mouse.pressed = false; mouse.raycaster = new THREE.Raycaster(); @@ -32,10 +33,10 @@ mouse.onDown = function(event) { }; mouse.onUp = function(event) { + mouse.pressed = false; if (!mouse.wasClick) { return; } - mouse.pressed = false; if (event.ctrlKey) { mouse.onCtrlClick(); } else if (event.shiftKey) {