Ver código fonte

Added gimbal

master
Pete Shadbolt 8 anos atrás
pai
commit
6254467bce
3 arquivos alterados com 12 adições e 8 exclusões
  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 Ver arquivo

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

<body>
<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=server_info class=hidden> </div>



+ 9
- 7
static/scripts/materials.js Ver arquivo

@@ -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


+ 2
- 1
static/scripts/mouse.js Ver arquivo

@@ -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) {


Carregando…
Cancelar
Salvar