Browse Source

Added gimbal

master
Pete Shadbolt 8 years ago
parent
commit
6254467bce
3 changed files with 12 additions and 8 deletions
  1. +1
    -0
      static/index.html
  2. +9
    -7
      static/scripts/materials.js
  3. +2
    -1
      static/scripts/mouse.js

+ 1
- 0
static/index.html View File

@@ -21,6 +21,7 @@


<body> <body>
<img id="ball" src="img/ball.png" style=display:none;> <img id="ball" src="img/ball.png" style=display:none;>
<img id="tip" src="img/tip.png" style=display:none;>
<div id=node_info class=hidden> nothing </div> <div id=node_info class=hidden> nothing </div>
<div id=server_info class=hidden> </div> <div id=server_info class=hidden> </div>




+ 9
- 7
static/scripts/materials.js View File

@@ -6,23 +6,25 @@ var curveProperties = {
}; };


materials.prepare = function() { 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({ materials.edge = new THREE.LineBasicMaterial({
color: "gray", color: "gray",
transparent: false, transparent: false,
linewidth: 1 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, alphaTest: 0.5,
transparent: true, transparent: true,
vertexColors: THREE.VertexColors
color: "red"
}); });
materials.qubit = new THREE.PointsMaterial({ materials.qubit = new THREE.PointsMaterial({
size: 0.3, size: 0.3,
map: sprite,
map: ballSprite,
alphaTest: 0.5, alphaTest: 0.5,
transparent: true, transparent: true,
vertexColors: THREE.VertexColors vertexColors: THREE.VertexColors


+ 2
- 1
static/scripts/mouse.js View File

@@ -1,5 +1,6 @@
var mouse = {}; var mouse = {};
mouse.wasClick = true; mouse.wasClick = true;
mouse.pressed = false;


mouse.raycaster = new THREE.Raycaster(); mouse.raycaster = new THREE.Raycaster();


@@ -32,10 +33,10 @@ mouse.onDown = function(event) {
}; };


mouse.onUp = function(event) { mouse.onUp = function(event) {
mouse.pressed = false;
if (!mouse.wasClick) { if (!mouse.wasClick) {
return; return;
} }
mouse.pressed = false;
if (event.ctrlKey) { if (event.ctrlKey) {
mouse.onCtrlClick(); mouse.onCtrlClick();
} else if (event.shiftKey) { } else if (event.shiftKey) {


Loading…
Cancel
Save