diff --git a/js/main.js b/js/main.js index c28e12a..aeda580 100644 --- a/js/main.js +++ b/js/main.js @@ -5,7 +5,7 @@ animate(); function init() { - let url = (document.URL.split('?')[1] || "exemple/suzanne.obja"); + let url = (document.URL.split('?')[1] || "example/suzanne.obja"); loader = new Loader(url, 1024, 20); loader.start(function(elements) { diff --git a/js/obja.js b/js/obja.js index 3216fbc..73d7919 100644 --- a/js/obja.js +++ b/js/obja.js @@ -196,6 +196,9 @@ class Loader { let upperBound = Math.min(this.currentByte + this.chunkSize, this.dataLength); if (upperBound <= this.currentByte) { + if (this.remainder !== "") { + callback([parseLine(this.remainder, 0)]); + } return; } diff --git a/src/Loader.js b/src/Loader.js index d1b2096..05c2c43 100644 --- a/src/Loader.js +++ b/src/Loader.js @@ -196,6 +196,9 @@ class Loader { let upperBound = Math.min(this.currentByte + this.chunkSize, this.dataLength); if (upperBound <= this.currentByte) { + if (this.remainder !== "") { + callback([parseLine(this.remainder, 0)]); + } return; }