Cleaning, and removed logs
This commit is contained in:
parent
dce45d8257
commit
ae620e2cfc
|
@ -4,7 +4,7 @@ var CameraContainer = function () {
|
|||
}
|
||||
|
||||
CameraContainer.prototype.mainCamera = function(id) {
|
||||
if (typeof id === 'undefined') {
|
||||
if (id === undefined) {
|
||||
return this.cameras[this.current_camera];
|
||||
}
|
||||
if (id >= cameras.length || id < 0) {
|
||||
|
@ -37,7 +37,7 @@ CameraContainer.prototype.get = function(i) {
|
|||
|
||||
CameraContainer.prototype.getById = function(id) {
|
||||
for (var i in this.cameras) {
|
||||
if (typeof this.cameras[i].mesh !== 'undefined') {
|
||||
if (this.cameras[i].mesh !== undefined) {
|
||||
if (this.cameras[i].mesh.id == id) {
|
||||
return i;
|
||||
}
|
||||
|
|
|
@ -15,8 +15,8 @@ var Cube = function(size, style) {
|
|||
// Super constructor call
|
||||
Displayable.call(this);
|
||||
|
||||
if (typeof size === 'undefined') size = 100;
|
||||
if (typeof style === 'undefined') style = {};
|
||||
if (size === undefined) size = 100;
|
||||
if (style === undefined) style = {};
|
||||
|
||||
this.geometry = new THREE.BoxGeometry(size, size, size);
|
||||
// this.geometry.computeVertexNormals();
|
||||
|
@ -33,7 +33,7 @@ Cube.prototype.constructor = Cube;
|
|||
var Plane = function(size1, size2, style) {
|
||||
Displayable.call(this);
|
||||
|
||||
if (typeof style === 'undefined') style = {};
|
||||
if (style === undefined) style = {};
|
||||
|
||||
this.geometry = new THREE.PlaneBufferGeometry(size1, size2);
|
||||
this.material = new THREE.MeshLambertMaterial(style);
|
||||
|
|
|
@ -5,19 +5,17 @@ var FixedCamera = function(arg1, arg2, arg3, arg4, position, target) {
|
|||
THREE.PerspectiveCamera.apply(this, arguments);
|
||||
|
||||
// Set Position
|
||||
if (typeof position === 'undefined')
|
||||
{
|
||||
if (position === undefined) {
|
||||
this.position = new THREE.Vector3(0,0,5);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
this.position.x = position.x;
|
||||
this.position.y = position.y;
|
||||
this.position.z = position.z;
|
||||
}
|
||||
|
||||
|
||||
if (typeof target === 'undefined') target = new THREE.Vector3(0,0,0);
|
||||
if (target === undefined)
|
||||
target = new THREE.Vector3(0,0,0);
|
||||
|
||||
var direction = target.clone();
|
||||
direction.sub(this.position);
|
||||
|
|
|
@ -6,7 +6,7 @@ var PointerCamera = function() {
|
|||
this.theta = Math.PI;
|
||||
this.phi = Math.PI;
|
||||
|
||||
this.keyboard = 'undefined';
|
||||
// this.keyboard = undefined;
|
||||
|
||||
this.dragging = false;
|
||||
|
||||
|
@ -146,8 +146,6 @@ PointerCamera.prototype.onMouseMove = function(event) {
|
|||
|
||||
this.move.x = this.mouse.x - mouse.x;
|
||||
this.move.y = this.mouse.y - mouse.y;
|
||||
|
||||
console.log(this.move.x, this.move.y);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,9 +9,7 @@ var visible = 0;
|
|||
|
||||
var loader;
|
||||
|
||||
var container_size = new Object();
|
||||
container_size.width = 1067;
|
||||
container_size.height = 600;
|
||||
var container_size = {width: 1067, height: 600};
|
||||
|
||||
init();
|
||||
animate();
|
||||
|
@ -180,9 +178,10 @@ function show(object) {
|
|||
|
||||
function click(event) {
|
||||
if (cameras.mainCamera() == cameras.get(0)) {
|
||||
var mouse = Object();
|
||||
mouse.x = ( ( event.clientX - renderer.domElement.offsetLeft ) / renderer.domElement.width ) * 2 - 1;
|
||||
mouse.y = - ( ( event.clientY - renderer.domElement.offsetTop ) / renderer.domElement.height ) * 2 + 1;
|
||||
var mouse = {
|
||||
x: ((event.clientX - renderer.domElement.offsetLeft) / renderer.domElement.width ) * 2 - 1,
|
||||
y: - ((event.clientY - renderer.domElement.offsetTop) / renderer.domElement.height) * 2 + 1
|
||||
}
|
||||
|
||||
var camera = cameras.mainCamera();
|
||||
var vector = new THREE.Vector3(mouse.x, mouse.y, 0.5);
|
||||
|
@ -198,7 +197,7 @@ function click(event) {
|
|||
|
||||
// Looking for cameras
|
||||
for (i in intersects) {
|
||||
if (typeof minDistance == 'undefined' || intersects[i].distance < minDistance) {
|
||||
if (minDistance === undefined || intersects[i].distance < minDistance) {
|
||||
// We will not consider a line as clickable
|
||||
if (! (intersects[i].object instanceof THREE.Line)) {
|
||||
minDistance = intersects[i].distance;
|
||||
|
@ -206,8 +205,7 @@ function click(event) {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (typeof bestIndex!= 'undefined') {
|
||||
console.log(intersects[bestIndex]);
|
||||
if (bestIndex !== undefined) {
|
||||
cameras.setById(intersects[bestIndex].object.id);
|
||||
}
|
||||
|
||||
|
@ -218,9 +216,7 @@ function click(event) {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
cameras.mainCamera(0);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue