Corrected bugs of time in old files
Provoked by the fact that Camera.update needs a time
This commit is contained in:
parent
0391f62732
commit
be99ba00e6
|
@ -2,6 +2,7 @@ var renderer, scene, camera, controls, cube, container, plane, mouse= {x:0, y:0}
|
||||||
var raycaster;
|
var raycaster;
|
||||||
var objects = [];
|
var objects = [];
|
||||||
var container_size = new Object();
|
var container_size = new Object();
|
||||||
|
var previousTime;
|
||||||
container_size.width = 1067;
|
container_size.width = 1067;
|
||||||
container_size.height = 600;
|
container_size.height = 600;
|
||||||
|
|
||||||
|
@ -57,7 +58,9 @@ function animate() {
|
||||||
|
|
||||||
cube.update();
|
cube.update();
|
||||||
|
|
||||||
camera.update();
|
var currentTime = Date.now() - previousTime;
|
||||||
|
camera.update(isNaN(currentTime) ? 20 : currentTime);
|
||||||
|
previousTime = Date.now();
|
||||||
camera.look();
|
camera.look();
|
||||||
|
|
||||||
renderer.render(scene, camera);
|
renderer.render(scene, camera);
|
||||||
|
|
|
@ -5,7 +5,7 @@ var objects = [];
|
||||||
var spheres = new Array(mesh_number);
|
var spheres = new Array(mesh_number);
|
||||||
var visible = 0;
|
var visible = 0;
|
||||||
|
|
||||||
var loader;
|
var loader, previousTime;
|
||||||
|
|
||||||
var container_size = new Object();
|
var container_size = new Object();
|
||||||
container_size.width = 1067;
|
container_size.width = 1067;
|
||||||
|
@ -79,7 +79,10 @@ function animate() {
|
||||||
// on appelle la fonction animate() récursivement à chaque frame
|
// on appelle la fonction animate() récursivement à chaque frame
|
||||||
requestAnimationFrame(animate);
|
requestAnimationFrame(animate);
|
||||||
|
|
||||||
camera.update();
|
var currentTime = Date.now() - previousTime;
|
||||||
|
camera.update(isNaN(currentTime) ? 20 : currentTime);
|
||||||
|
previousTime = Date.now();
|
||||||
|
|
||||||
camera.look();
|
camera.look();
|
||||||
|
|
||||||
renderer.render(scene, camera);
|
renderer.render(scene, camera);
|
||||||
|
|
Loading…
Reference in New Issue