Cleaned stuff, improved progress bar
This commit is contained in:
2
js/l3d/apps/prototype/interactive/main.js
vendored
2
js/l3d/apps/prototype/interactive/main.js
vendored
@@ -15,7 +15,7 @@ var main_section = document.getElementById('main-section');
|
||||
// }
|
||||
// };
|
||||
var container_size = {
|
||||
width: function() { return 1024; },
|
||||
width: function() { return 1134; },
|
||||
height: function() { return 768; }
|
||||
};
|
||||
|
||||
|
||||
2
js/l3d/apps/prototype/replay/main.js
vendored
2
js/l3d/apps/prototype/replay/main.js
vendored
@@ -15,7 +15,7 @@ var main_section = document.getElementById('main-section');
|
||||
// };
|
||||
|
||||
var container_size = {
|
||||
width: function() { return 1024; },
|
||||
width: function() { return 1134; },
|
||||
height: function() { return 768; }
|
||||
};
|
||||
|
||||
|
||||
2
js/l3d/apps/prototype/tutorial/main.js
vendored
2
js/l3d/apps/prototype/tutorial/main.js
vendored
@@ -4,7 +4,7 @@ var isFullscreen = false;
|
||||
var main_section = document.getElementById('main-section');
|
||||
|
||||
var container_size = {
|
||||
width: function() { return 1024; },
|
||||
width: function() { return 1134; },
|
||||
height: function() { return 768; }
|
||||
};
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ var _parseList = function(arr) {
|
||||
|
||||
ret.type = "global";
|
||||
ret.index = null;
|
||||
ret.numberOfElements = arr[1];
|
||||
ret.numberOfFaces = arr[1];
|
||||
|
||||
}
|
||||
|
||||
@@ -189,13 +189,13 @@ var ProgressiveLoader = function(path, scene, camera, callback, log) {
|
||||
* Number of total elements for loading
|
||||
* @type{Number}
|
||||
*/
|
||||
this.numberOfElements = -1;
|
||||
this.numberOfFaces = -1;
|
||||
|
||||
/**
|
||||
* Number of elements received
|
||||
* @type {Number}
|
||||
*/
|
||||
this.numberOfElementsReceived = -1;
|
||||
this.numberOfFacesReceived = 0;
|
||||
|
||||
/**
|
||||
* Modulus indicator (not to log too often)
|
||||
@@ -205,6 +205,8 @@ var ProgressiveLoader = function(path, scene, camera, callback, log) {
|
||||
|
||||
this.log = log;
|
||||
|
||||
r = this;
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -250,10 +252,8 @@ ProgressiveLoader.prototype.initIOCallbacks = function() {
|
||||
|
||||
for (var i = 0; i < arr.length; i++) {
|
||||
|
||||
self.numberOfElementsReceived++;
|
||||
|
||||
if (typeof self.log === 'function' && self.numberOfElementsReceived % self.modulus === 0) {
|
||||
self.log(self.numberOfElementsReceived, self.numberOfElements);
|
||||
if (typeof self.log === 'function' && self.numberOfFacesReceived % self.modulus === 0) {
|
||||
self.log(self.numberOfFacesReceived, self.numberOfFaces);
|
||||
}
|
||||
|
||||
var elt = _parseList(arr[i]);
|
||||
@@ -286,8 +286,6 @@ ProgressiveLoader.prototype.initIOCallbacks = function() {
|
||||
|
||||
} else if (elt.type === 'usemtl') {
|
||||
|
||||
// Must create new mesh
|
||||
|
||||
// Create mesh material
|
||||
var material;
|
||||
|
||||
@@ -333,6 +331,8 @@ ProgressiveLoader.prototype.initIOCallbacks = function() {
|
||||
|
||||
} else if (elt.type === 'face') {
|
||||
|
||||
self.numberOfFacesReceived++;
|
||||
|
||||
if (!self.meshes[elt.mesh].added) {
|
||||
|
||||
self.meshes[elt.mesh].added = true;
|
||||
@@ -368,8 +368,8 @@ ProgressiveLoader.prototype.initIOCallbacks = function() {
|
||||
|
||||
} else if (elt.type === 'global') {
|
||||
|
||||
self.numberOfElements = elt.numberOfElements;
|
||||
self.modulus = Math.floor(self.numberOfElements / 200);
|
||||
self.numberOfFaces = elt.numberOfFaces;
|
||||
self.modulus = Math.floor(self.numberOfFaces / 200);
|
||||
|
||||
}
|
||||
|
||||
@@ -381,7 +381,8 @@ ProgressiveLoader.prototype.initIOCallbacks = function() {
|
||||
|
||||
this.socket.on('disconnect', function() {
|
||||
console.log('Finished !');
|
||||
self.log(self.numberOfElements, self.numberOfElements);
|
||||
if (typeof self.log === 'function')
|
||||
self.log(self.numberOfFacesReceived, self.numberOfFaces);
|
||||
self.finished = true;
|
||||
});
|
||||
};
|
||||
|
||||
@@ -2,7 +2,10 @@ L3D.LogFunction = function(a,b) {
|
||||
var val = 100*a/b;
|
||||
$('.progress-bar').css('width', val+'%').attr('aria-valuenow', val);
|
||||
$('#percentage').html(Math.floor(10*val)/10 + '%');
|
||||
}
|
||||
if (a === b) {
|
||||
setTimeout(function() {$('.progress').hide(1000);}, 1000);
|
||||
}
|
||||
};
|
||||
|
||||
L3D.addLight = function(scene) {
|
||||
var directional_light = new THREE.DirectionalLight(0xdddddd);
|
||||
|
||||
Reference in New Issue
Block a user