This commit is contained in:
Thomas FORGIONE
2015-11-27 10:20:13 +01:00
parent adbd3c95f1
commit df876748c1
7 changed files with 237 additions and 68 deletions
+12 -3
View File
@@ -26,6 +26,8 @@ L3D.ReplayCamera = function() {
this.recommendationClicked = null;
this.isArrow = false;
};
L3D.ReplayCamera.prototype = Object.create(THREE.PerspectiveCamera.prototype);
L3D.ReplayCamera.prototype.constructor = L3D.ReplayCamera;
@@ -107,6 +109,11 @@ L3D.ReplayCamera.prototype.nextEvent = function() {
var self = this;
if (self.isArrow) {
self.isArrow = false;
process.stderr.write('\033[31mArrowclicked finished !\033[0m\n');
}
this.counter++;
// Finished
@@ -139,6 +146,8 @@ L3D.ReplayCamera.prototype.nextEvent = function() {
// },500);
// })(this);
} else if (this.event.type == 'arrow') {
self.isArrow = true;
process.stderr.write('\033[33mArrowclicked ! ' + JSON.stringify(self.cameras[self.event.id].camera.position) + '\033[0m\n');
if (this.shouldRecover) {
(function(self, tmp) {
self.event.type = 'camera';
@@ -252,7 +261,7 @@ L3D.ReplayCamera.prototype.moveHermite = function(recommendation) {
L3D.ReplayCamera.prototype.moveReco = function(recommendationId) {
this.recommendationClicked = this.cameras[recommendationId].camera;
this.recommendationClicked = recommendationId;
this.moveHermite(this.cameras[recommendationId]);
@@ -270,7 +279,7 @@ L3D.ReplayCamera.prototype.save = function() {};
*/
L3D.ReplayCamera.prototype.toList = function() {
var camera = (this.recommendationClicked === null ? this : this.recommendationClicked);
var camera = this; // (this.recommendationClicked === null ? this : this.cameras[this.recommendationClicked].camera);
camera.updateMatrix();
camera.updateMatrixWorld();
@@ -284,7 +293,7 @@ L3D.ReplayCamera.prototype.toList = function() {
var ret =
[[camera.position.x, camera.position.y, camera.position.z],
[camera.target.x, camera.target.y, camera.target.z],
this.recommendationClicked !== null
this.recommendationClicked
];
for (var i = 0; i < frustum.planes.length; i++) {
+15 -7
View File
@@ -301,7 +301,7 @@ ProgressiveLoader.prototype.initIOCallbacks = function() {
this.socket.on('elements', function(arr) {
process.stderr.write('Received ' + arr.length + '\n');
// process.stderr.write('Received ' + arr.length + '\n');
for (var i = 0; i < arr.length; i++) {
@@ -431,15 +431,23 @@ ProgressiveLoader.prototype.initIOCallbacks = function() {
}
var param;
if (typeof self.onBeforeEmit === 'function') {
self.onBeforeEmit();
}
// Ask for next elements
if (!self.laggy) {
self.socket.emit('next', self.getCamera());
for (var m of self.meshes) {
m.geometry.computeBoundingSphere();
}
param = self.onBeforeEmit();
setTimeout(function() { self.socket.emit('next', self.getCamera(), param);}, 100);
} else {
setTimeout(function() { self.socket.emit('next', self.getCamera());}, 100);
// Ask for next elements
if (!self.laggy) {
self.socket.emit('next', self.getCamera(), param);
} else {
setTimeout(function() { self.socket.emit('next', self.getCamera());}, 100);
}
}
});
+3 -3
View File
@@ -25,7 +25,7 @@ L3D.initPeachCastle = function(scene, collidableObjects, recommendation, clickab
var loader = new L3D.ProgressiveLoader(
'/static/data/castle/princess peaches castle (outside).obj',
scene,
null,
recommendation,
function(object) {
if (clickable !== undefined)
clickable.push(object);
@@ -356,7 +356,7 @@ L3D.initWhompScene = function(scene, collidableObjects, recommendation, clickabl
var loader = new L3D.ProgressiveLoader(
'/static/data/whomp/Whomps Fortress.obj',
scene,
null,
recommendation,
function(object) {
if (clickable !== undefined)
clickable.push(object);
@@ -512,7 +512,7 @@ L3D.initMountainScene = function(scene, collidableObjects, recommendation, click
var loader = new L3D.ProgressiveLoader(
'/static/data/mountain/coocoolmountain.obj',
scene,
null,
recommendation,
function(object) {
// object.rotation.x = -Math.PI/2;
// object.rotation.z = Math.PI/2;