Преглед изворни кода

update b3dm loader base to slice table buffer

Garrett Johnson пре 4 година
родитељ
комит
0d4c8da6d1
1 измењених фајлова са 21 додато и 2 уклоњено
  1. 21 2
      src/base/B3DMLoaderBase.js

+ 21 - 2
src/base/B3DMLoaderBase.js

@@ -68,11 +68,30 @@ export class B3DMLoaderBase {
 
 		// Feature Table
 		const featureTableStart = 28;
-		const featureTable = new FeatureTable( buffer, featureTableStart, featureTableJSONByteLength, featureTableBinaryByteLength );
+		const featureTableBuffer = buffer.slice(
+			featureTableStart,
+			featureTableStart + featureTableBinaryByteLength + featureTableJSONByteLength,
+		);
+		const featureTable = new FeatureTable(
+			featureTableBuffer,
+			0,
+			featureTableJSONByteLength,
+			featureTableBinaryByteLength,
+		);
 
 		// Batch Table
 		const batchTableStart = featureTableStart + featureTableJSONByteLength + featureTableBinaryByteLength;
-		const batchTable = new BatchTable( buffer, featureTable.getData( 'BATCH_LENGTH' ), batchTableStart, batchTableJSONByteLength, batchTableBinaryByteLength );
+		const batchTableBuffer = buffer.slice(
+			batchTableStart,
+			batchTableStart + batchTableBinaryByteLength + batchTableJSONByteLength,
+		);
+		const batchTable = new BatchTable(
+			batchTableBuffer,
+			featureTable.getData( 'BATCH_LENGTH' ),
+			0,
+			batchTableJSONByteLength,
+			batchTableBinaryByteLength,
+		);
 
 		const glbStart = batchTableStart + batchTableJSONByteLength + batchTableBinaryByteLength;
 		const glbBytes = new Uint8Array( buffer, glbStart, byteLength - glbStart );