Added progress bar

This commit is contained in:
Thomas FORGIONE
2015-07-07 11:47:21 +02:00
parent 773abeb817
commit 505e43023a
6 changed files with 79 additions and 23 deletions

View File

@@ -38,6 +38,12 @@ geo.MeshContainer = function(path, callback) {
*/
this.texCoords = [];
/**
* Number of elements to stream in the mesh
* @type {Number}
*/
this.numberOfElements = -1;
this.callback = callback;
if (path !== undefined) {
@@ -69,6 +75,8 @@ geo.MeshContainer.prototype.loadFromFile = function(path) {
if (line[0] === 'v') {
self.numberOfElements++;
if (line[1] === 't') {
// Texture coord
@@ -101,6 +109,8 @@ geo.MeshContainer.prototype.loadFromFile = function(path) {
} else if (line[0] === 'f') {
self.numberOfElements++;
// Create mesh if it doesn't exist
if (currentMesh === undefined) {
currentMesh = new geo.Mesh();
@@ -124,6 +134,8 @@ geo.MeshContainer.prototype.loadFromFile = function(path) {
} else if (line[0] === 'u') {
self.numberOfElements++;
// usemtl
// If a current mesh exists, finish it

View File

@@ -253,6 +253,9 @@ geo.MeshStreamer.prototype.nextMaterials = function() {
var data = [];
data.push(['g', this.mesh.numberOfElements]);
for (var i = 0; i < this.mesh.meshes.length; i++) {
var currentMesh = this.mesh.meshes[i];