diff --git a/controllers/prototype/views/tutorial.jade b/controllers/prototype/views/tutorial.jade index f6400f5..cfe5250 100644 --- a/controllers/prototype/views/tutorial.jade +++ b/controllers/prototype/views/tutorial.jade @@ -9,7 +9,3 @@ block title block configjs script Recommendation = L3D.ArrowRecommendation; script(src="/static/js/tutorial.min.js") - -block fullscreen - button#full.btn.btn-primary(style={display:"none"}) Fullscreen - diff --git a/js/l3d/apps/prototype/Coin.js b/js/l3d/apps/prototype/Coin.js index 1405600..2aac92e 100644 --- a/js/l3d/apps/prototype/Coin.js +++ b/js/l3d/apps/prototype/Coin.js @@ -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; diff --git a/js/l3d/apps/prototype/GlobalFunctions.js b/js/l3d/apps/prototype/GlobalFunctions.js index 32e9540..91dbf0e 100644 --- a/js/l3d/apps/prototype/GlobalFunctions.js +++ b/js/l3d/apps/prototype/GlobalFunctions.js @@ -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); } diff --git a/js/l3d/apps/prototype/tutorial/TutoCamera.js b/js/l3d/apps/prototype/tutorial/TutoCamera.js index 83f71c4..8d8b4f4 100644 --- a/js/l3d/apps/prototype/tutorial/TutoCamera.js +++ b/js/l3d/apps/prototype/tutorial/TutoCamera.js @@ -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; diff --git a/js/l3d/apps/prototype/tutorial/main.js b/js/l3d/apps/prototype/tutorial/main.js index 683c4cc..fd428ff 100644 --- a/js/l3d/apps/prototype/tutorial/main.js +++ b/js/l3d/apps/prototype/tutorial/main.js @@ -40,7 +40,7 @@ function main() { tutorial.setCameras(recommendations); tutorial.nextStep(); - startCanvas.render(L3D.StartCanvas.Black); + startCanvas.render(); // Start rendering setInterval(render, 20); diff --git a/js/l3d/src/cameras/PointerCamera.js b/js/l3d/src/cameras/PointerCamera.js index b940e00..7c51d06 100644 --- a/js/l3d/src/cameras/PointerCamera.js +++ b/js/l3d/src/cameras/PointerCamera.js @@ -440,7 +440,9 @@ L3D.PointerCamera.prototype.move = function(recommendation, toSave) { var otherCamera = recommendation.camera || recommendation; + this.movingHermite = false; this.moving = true; + this.new_target = otherCamera.target.clone(); this.new_position = otherCamera.position.clone(); var t = [0,1]; @@ -469,6 +471,7 @@ L3D.PointerCamera.prototype.moveHermite = function(recommendation, toSave) { var otherCamera = recommendation.camera || recommendation; + this.moving = false; this.movingHermite = true; this.t = 0; diff --git a/js/l3d/src/canvases/MousePointer.js b/js/l3d/src/canvases/MousePointer.js index 913db98..8622010 100644 --- a/js/l3d/src/canvases/MousePointer.js +++ b/js/l3d/src/canvases/MousePointer.js @@ -179,3 +179,18 @@ L3D.MousePointer.prototype.clear = function(force) { this.render(L3D.MousePointer.NONE, force); }; + +/** + * Sets the size of the canvas + * @param {Number} width the new width of the canvas + * @param {Number} height the new height of the canvas + */ + +L3D.MousePointer.prototype.setSize = function(width, height) { + + this.domElement.width = width; + this.domElement.height = height; + + this.render(this.style, true); + +}; diff --git a/js/l3d/src/canvases/Previewer.js b/js/l3d/src/canvases/Previewer.js index f2eb077..0f6c7b9 100644 --- a/js/l3d/src/canvases/Previewer.js +++ b/js/l3d/src/canvases/Previewer.js @@ -173,3 +173,8 @@ L3D.Previewer.prototype.setPosition = function(x, y) { this.mouse.x = x; this.mouse.y = y; } + +L3D.Previewer.prototype.setSize = function(width, height) { + this.domElement.width = width; + this.domElement.height = height; +} diff --git a/js/l3d/src/canvases/StartCanvas.js b/js/l3d/src/canvases/StartCanvas.js index e301812..207088f 100644 --- a/js/l3d/src/canvases/StartCanvas.js +++ b/js/l3d/src/canvases/StartCanvas.js @@ -30,11 +30,12 @@ L3D.StartCanvas = function(camera) { }; /** - * Shows the canvas with a string in the middle of it + * Shows the canvas with a string in the middle of it (not done if already shown) + * @param {Boolean} force force the rendering */ -L3D.StartCanvas.prototype.render = function() { +L3D.StartCanvas.prototype.render = function(force) { - if (!this.shown) { + if (!this.shown || force) { this.ctx.fillStyle = 'white'; this.ctx.globalAlpha = 0.7; @@ -67,3 +68,19 @@ L3D.StartCanvas.prototype.clear = function() { } }; + +/** + * Sets the size of the canvas + * @param {Number} width new width of the canvas + * @param {Number} height new height of the canvas + */ +L3D.StartCanvas.prototype.setSize = function(width, height) { + + this.domElement.width = width; + this.domElement.height = height; + + // If the canvas was shown, redraw it + if (this.shown) + this.render(true); + +} diff --git a/js/l3d/src/recommendations/BaseRecommendation.js b/js/l3d/src/recommendations/BaseRecommendation.js index 13d619e..6f31533 100644 --- a/js/l3d/src/recommendations/BaseRecommendation.js +++ b/js/l3d/src/recommendations/BaseRecommendation.js @@ -91,8 +91,6 @@ L3D.BaseRecommendation.prototype.check = function() { */ L3D.BaseRecommendation.prototype.initExtremity = function() { - console.log("Init"); - var geometry = new THREE.Geometry(); var direction = this.camera.target.clone(); diff --git a/js/three/stats.min.js b/js/three/stats.min.js index 4840dd7..05be500 100644 --- a/js/three/stats.min.js +++ b/js/three/stats.min.js @@ -1,4 +1,4 @@ 'use strict';var Stats=function(){function f(a,e,b){a=document.createElement(a);a.id=e;a.style.cssText=b;return a}function l(a,e,b){var d=f("div",a,"padding:0 0 3px 3px;text-align:left;background:"+b),c=f("div",a+"Text","font-family:Helvetica,Arial,sans-serif;font-size:9px;font-weight:bold;line-height:15px;color:"+e);c.innerHTML=a.toUpperCase();d.appendChild(c);a=f("div",a+"Graph","width:74px;height:30px;background:"+e);d.appendChild(a);for(e=0;74>e;e++)a.appendChild(f("span","","width:1px;height:30px;float:left;opacity:0.9;background:"+ b));return d}function m(a){for(var b=d.children,c=0;cr+1E3&&(c=Math.round(1E3*t/(a-r)),u=Math.min(u,c),v=Math.max(v,c),A.textContent=c+" FPS ("+u+"-"+v+")",p(B,c/100),r=a,t=0,void 0!==h)){var b=performance.memory.usedJSHeapSize,d=performance.memory.jsHeapSizeLimit;h=Math.round(9.54E-7*b);y=Math.min(y,h);z=Math.max(z,h);E.textContent=h+" MB ("+y+"-"+z+")";p(F,b/d)}return a},update:function(){k=this.end()}}};"object"===typeof module&&(module.exports=Stats); +g/200);t++;if(a>r+1E3&&(c=Math.round(1E3*t/(a-r)),u=Math.min(u,c),v=Math.max(v,c),A.textContent=c+" FPS ("+u+"-"+v+")",p(B,c/100),r=a,t=0,void 0!==h)){var b=performance.memory.usedJSHeapSize,d=performance.memory.jsHeapSizeLimit;h=Math.round(9.54E-7*b);y=Math.min(y,h);z=Math.max(z,h);E.textContent=h+" MB ("+y+"-"+z+")";p(F,b/d)}return a},update:function(){k=this.end()},setSize:function(){}}};"object"===typeof module&&(module.exports=Stats);