Added progress bar
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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];
|
||||
|
||||
Reference in New Issue
Block a user