|
@@ -4,8 +4,6 @@
|
|
|
|
|
|
|
|
|
THREE.glTFLoader = function (showStatus) {
|
|
|
- this.useBufferGeometry = (THREE.glTFLoader.useBufferGeometry !== undefined ) ?
|
|
|
- THREE.glTFLoader.useBufferGeometry : true;
|
|
|
this.meshesRequested = 0;
|
|
|
this.meshesLoaded = 0;
|
|
|
this.pendingMeshes = [];
|
|
@@ -86,12 +84,8 @@ THREE.glTFLoader.prototype.load = function( url, callback ) {
|
|
|
|
|
|
var ClassicGeometry = function() {
|
|
|
|
|
|
- if (theLoader.useBufferGeometry) {
|
|
|
- this.geometry = new THREE.BufferGeometry;
|
|
|
- }
|
|
|
- else {
|
|
|
- this.geometry = new THREE.Geometry;
|
|
|
- }
|
|
|
+ this.geometry = new THREE.BufferGeometry;
|
|
|
+
|
|
|
this.totalAttributes = 0;
|
|
|
this.loadedAttributes = 0;
|
|
|
this.indicesLoaded = false;
|
|
@@ -105,41 +99,6 @@ THREE.glTFLoader.prototype.load = function( url, callback ) {
|
|
|
|
|
|
ClassicGeometry.prototype.constructor = ClassicGeometry;
|
|
|
|
|
|
- ClassicGeometry.prototype.buildArrayGeometry = function() {
|
|
|
-
|
|
|
- // Build indexed mesh
|
|
|
- var geometry = this.geometry;
|
|
|
- var normals = geometry.normals;
|
|
|
- var indexArray = this.indexArray;
|
|
|
- var uvs = this.uvs;
|
|
|
- var a, b, c;
|
|
|
- var i, l;
|
|
|
- var faceNormals = null;
|
|
|
- var faceTexcoords = null;
|
|
|
-
|
|
|
- for(i = 0, l = this.indexArray.length; i < l; i += 3) {
|
|
|
- a = indexArray[i];
|
|
|
- b = indexArray[i+1];
|
|
|
- c = indexArray[i+2];
|
|
|
- if(normals) {
|
|
|
- faceNormals = [normals[a], normals[b], normals[c]];
|
|
|
- }
|
|
|
- geometry.faces.push( new THREE.Face3( a, b, c, faceNormals, null, null ) );
|
|
|
- if(uvs) {
|
|
|
- geometry.faceVertexUvs[0].push([ uvs[a], uvs[b], uvs[c] ]);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // Allow Three.js to calculate some values for us
|
|
|
- geometry.computeBoundingBox();
|
|
|
- geometry.computeBoundingSphere();
|
|
|
- geometry.computeFaceNormals();
|
|
|
- if(!normals) {
|
|
|
- geometry.computeVertexNormals();
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
ClassicGeometry.prototype.buildBufferGeometry = function() {
|
|
|
// Build indexed mesh
|
|
|
var geometry = this.geometry;
|
|
@@ -162,12 +121,7 @@ THREE.glTFLoader.prototype.load = function( url, callback ) {
|
|
|
ClassicGeometry.prototype.checkFinished = function() {
|
|
|
if(this.indexArray && this.loadedAttributes === this.totalAttributes) {
|
|
|
|
|
|
- if (theLoader.useBufferGeometry) {
|
|
|
- this.buildBufferGeometry();
|
|
|
- }
|
|
|
- else {
|
|
|
- this.buildArrayGeometry();
|
|
|
- }
|
|
|
+ this.buildBufferGeometry();
|
|
|
|
|
|
this.finished = true;
|
|
|
|
|
@@ -314,12 +268,8 @@ THREE.glTFLoader.prototype.load = function( url, callback ) {
|
|
|
}
|
|
|
|
|
|
VertexAttributeDelegate.prototype.resourceAvailable = function(glResource, ctx) {
|
|
|
- if (theLoader.useBufferGeometry) {
|
|
|
- this.bufferResourceAvailable(glResource, ctx);
|
|
|
- }
|
|
|
- else {
|
|
|
- this.arrayResourceAvailable(glResource, ctx);
|
|
|
- }
|
|
|
+
|
|
|
+ this.bufferResourceAvailable(glResource, ctx);
|
|
|
|
|
|
var geom = ctx.geometry;
|
|
|
geom.loadedAttributes++;
|