Parcourir la source

Merge pull request #17436 from Mugen87/dev29

DracoLoader: Clean up.
Michael Herzog il y a 5 ans
Parent
commit
3b4bebce2e
2 fichiers modifiés avec 18 ajouts et 19 suppressions
  1. 8 11
      examples/js/loaders/DRACOLoader.js
  2. 10 8
      examples/jsm/loaders/DRACOLoader.js

+ 8 - 11
examples/js/loaders/DRACOLoader.js

@@ -189,7 +189,7 @@ THREE.DRACOLoader.prototype = Object.assign( Object.create( THREE.Loader.prototy
 
 		}
 
-		for ( var i = 0; i < geometryData.attributes.length; i++ ) {
+		for ( var i = 0; i < geometryData.attributes.length; i ++ ) {
 
 			var attribute = geometryData.attributes[ i ];
 			var name = attribute.name;
@@ -366,7 +366,7 @@ THREE.DRACOLoader.DRACOWorker = function () {
 
 			case 'init':
 				decoderConfig = message.decoderConfig;
-				decoderPending = new Promise( function ( resolve, reject ) {
+				decoderPending = new Promise( function ( resolve/*, reject*/ ) {
 
 					decoderConfig.onModuleLoaded = function ( draco ) {
 
@@ -454,11 +454,8 @@ THREE.DRACOLoader.DRACOWorker = function () {
 
 		var geometry = { index: null, attributes: [] };
 
-		var numPoints = dracoGeometry.num_points();
-		var numAttributes = dracoGeometry.num_attributes();
-
 		// Add attributes of user specified unique id.
-		for (var attributeName in attributeIDs) {
+		for ( var attributeName in attributeIDs ) {
 
 			var attributeType = self[ attributeTypes[ attributeName ] ];
 			var attributeId = attributeIDs[ attributeName ];
@@ -499,9 +496,9 @@ THREE.DRACOLoader.DRACOWorker = function () {
 
 		return geometry;
 
-	};
+	}
 
-	function decodeAttribute ( draco, decoder, dracoGeometry, attributeName, attributeType, attribute ) {
+	function decodeAttribute( draco, decoder, dracoGeometry, attributeName, attributeType, attribute ) {
 
 		var numComponents = attribute.num_components();
 		var numPoints = dracoGeometry.num_points();
@@ -520,7 +517,7 @@ THREE.DRACOLoader.DRACOWorker = function () {
 
 			case Int8Array:
 				dracoArray = new draco.DracoInt8Array();
-				decoder.GetAttributeInt8ForAllPoints( dracoGeometry, attribute, dracoArray  );
+				decoder.GetAttributeInt8ForAllPoints( dracoGeometry, attribute, dracoArray );
 				array = new Int8Array( numValues );
 				break;
 
@@ -559,7 +556,7 @@ THREE.DRACOLoader.DRACOWorker = function () {
 
 		}
 
-		for ( var i = 0; i < numValues; i++ ) {
+		for ( var i = 0; i < numValues; i ++ ) {
 
 			array[ i ] = dracoArray.GetValue( i );
 
@@ -573,7 +570,7 @@ THREE.DRACOLoader.DRACOWorker = function () {
 			itemSize: numComponents
 		};
 
-	};
+	}
 
 };
 

+ 10 - 8
examples/jsm/loaders/DRACOLoader.js

@@ -196,7 +196,7 @@ DRACOLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 		}
 
-		for ( var i = 0; i < geometryData.attributes.length; i++ ) {
+		for ( var i = 0; i < geometryData.attributes.length; i ++ ) {
 
 			var attribute = geometryData.attributes[ i ];
 			var name = attribute.name;
@@ -373,7 +373,7 @@ DRACOLoader.DRACOWorker = function () {
 
 			case 'init':
 				decoderConfig = message.decoderConfig;
-				decoderPending = new Promise( function ( resolve, reject ) {
+				decoderPending = new Promise( function ( resolve/*, reject*/ ) {
 
 					decoderConfig.onModuleLoaded = function ( draco ) {
 
@@ -464,8 +464,10 @@ DRACOLoader.DRACOWorker = function () {
 		var numPoints = dracoGeometry.num_points();
 		var numAttributes = dracoGeometry.num_attributes();
 
+		console.log( numPoints, numAttributes );
+
 		// Add attributes of user specified unique id.
-		for (var attributeName in attributeIDs) {
+		for ( var attributeName in attributeIDs ) {
 
 			var attributeType = self[ attributeTypes[ attributeName ] ];
 			var attributeId = attributeIDs[ attributeName ];
@@ -506,9 +508,9 @@ DRACOLoader.DRACOWorker = function () {
 
 		return geometry;
 
-	};
+	}
 
-	function decodeAttribute ( draco, decoder, dracoGeometry, attributeName, attributeType, attribute ) {
+	function decodeAttribute( draco, decoder, dracoGeometry, attributeName, attributeType, attribute ) {
 
 		var numComponents = attribute.num_components();
 		var numPoints = dracoGeometry.num_points();
@@ -527,7 +529,7 @@ DRACOLoader.DRACOWorker = function () {
 
 			case Int8Array:
 				dracoArray = new draco.DracoInt8Array();
-				decoder.GetAttributeInt8ForAllPoints( dracoGeometry, attribute, dracoArray  );
+				decoder.GetAttributeInt8ForAllPoints( dracoGeometry, attribute, dracoArray );
 				array = new Int8Array( numValues );
 				break;
 
@@ -566,7 +568,7 @@ DRACOLoader.DRACOWorker = function () {
 
 		}
 
-		for ( var i = 0; i < numValues; i++ ) {
+		for ( var i = 0; i < numValues; i ++ ) {
 
 			array[ i ] = dracoArray.GetValue( i );
 
@@ -580,7 +582,7 @@ DRACOLoader.DRACOWorker = function () {
 			itemSize: numComponents
 		};
 
-	};
+	}
 
 };