Bugs, cleaning, and tutorial improved
This commit is contained in:
parent
9158ec36bc
commit
7d449db916
|
@ -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
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ function main() {
|
|||
tutorial.setCameras(recommendations);
|
||||
tutorial.nextStep();
|
||||
|
||||
startCanvas.render(L3D.StartCanvas.Black);
|
||||
startCanvas.render();
|
||||
|
||||
// Start rendering
|
||||
setInterval(render, 20);
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
};
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;c<b.length;c++)b[c].style.display=c===a?"block":"none";n=a}function p(a,b){a.appendChild(a.firstChild).style.height=Math.min(30,30-30*b)+"px"}var q=self.performance&&self.performance.now?self.performance.now.bind(performance):Date.now,k=q(),r=k,t=0,n=0,d=f("div","stats","width:80px;opacity:0.9;cursor:pointer");d.addEventListener("mousedown",function(a){a.preventDefault();m(++n%d.children.length)},!1);var c=0,u=Infinity,v=0,b=l("fps","#0ff","#002"),
|
||||
A=b.children[0],B=b.children[1];d.appendChild(b);var g=0,w=Infinity,x=0,b=l("ms","#0f0","#020"),C=b.children[0],D=b.children[1];d.appendChild(b);if(self.performance&&self.performance.memory){var h=0,y=Infinity,z=0,b=l("mb","#f08","#201"),E=b.children[0],F=b.children[1];d.appendChild(b)}m(n);return{REVISION:14,domElement:d,setMode:m,getFps:function(){return c},begin:function(){k=q()},end:function(){var a=q();g=a-k;w=Math.min(w,g);x=Math.max(x,g);C.textContent=(g|0)+" MS ("+(w|0)+"-"+(x|0)+")";p(D,
|
||||
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()}}};"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);
|
||||
|
|
Loading…
Reference in New Issue