Bugs, cleaning, and tutorial improved

This commit is contained in:
Thomas FORGIONE
2015-07-09 11:44:54 +02:00
parent 9158ec36bc
commit 7d449db916
11 changed files with 58 additions and 22 deletions

View File

@@ -19,6 +19,12 @@ Coin.domElement.style.cssFloat = 'top-left';
Coin.domElement.style.top = "0px";
Coin.domElement.style.left = "0px";
Coin.setSize = function(width,height) {
this.domElement.width = width;
this.domElement.height = height;
this.update();
}
Coin.image = new Image();
Coin.image.src = '/static/img/redcoin.png';
@@ -69,6 +75,7 @@ Coin.update();
Coin.prototype.init = function(x,y,z) {
if (Coin.BASIC_MESH !== null) {
this.mesh = Coin.BASIC_MESH.clone();
this.mesh.material = this.mesh.material.clone();
this.mesh.position.x = x;
this.mesh.position.y = y;
this.mesh.position.z = z;
@@ -122,6 +129,7 @@ Coin.prototype.update = function() {
} else {
this.mesh.visible = false;
this.raycastable = false;
}
@@ -136,7 +144,6 @@ Coin.prototype.get = function() {
if (this.callback)
this.callback();
this.mesh.material = this.mesh.material.clone();
this.mesh.material.transparent = true;
this.mesh.material.opacity = 1;

View File

@@ -143,17 +143,9 @@ function resizeElements() {
continue;
}
if (obj instanceof THREE.WebGLRenderer) {
obj.setSize(width, height);
}
if (obj.domElement) {
obj.domElement.width = width;
obj.domElement.height = height;
continue;
obj.setSize(width, height);
}

View File

@@ -118,7 +118,7 @@ TutoCamera.prototype.onPointerLockChange = function() {
// The pointer is locked : adapt the state of the camera
this.pointerLocked = true;
this.mousePointer.render();
this.mousePointer.render(L3D.MousePointer.BLACK);
this.mouse.x = this.renderer.domElement.width/2;
this.mouse.y = this.renderer.domElement.height/2;
@@ -311,6 +311,8 @@ TutoCamera.prototype.move = function(recommendation, toSave) {
var otherCamera = recommendation.camera || recommendation;
this.moving = true;
this.movingHermite = false;
this.new_target = otherCamera.target.clone();
this.new_position = otherCamera.position.clone();
var t = [0,1];
@@ -338,6 +340,7 @@ TutoCamera.prototype.moveHermite = function(recommendation, toSave) {
var otherCamera = recommendation.camera;
this.moving = false;
this.movingHermite = true;
this.t = 0;

View File

@@ -40,7 +40,7 @@ function main() {
tutorial.setCameras(recommendations);
tutorial.nextStep();
startCanvas.render(L3D.StartCanvas.Black);
startCanvas.render();
// Start rendering
setInterval(render, 20);