瀏覽代碼

Fix PNTS and I3DM tables

Garrett Johnson 4 年之前
父節點
當前提交
e6eb672031
共有 2 個文件被更改,包括 42 次插入6 次删除
  1. 21 3
      src/base/I3DMLoaderBase.js
  2. 21 3
      src/base/PNTSLoaderBase.js

+ 21 - 3
src/base/I3DMLoaderBase.js

@@ -71,12 +71,30 @@ export class I3DMLoaderBase {
 
 		// Feature Table
 		const featureTableStart = 32;
-		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 batchLength = featureTable.getData( 'INSTANCES_LENGTH' );
 		const batchTableStart = featureTableStart + featureTableJSONByteLength + featureTableBinaryByteLength;
-		const batchTable = new BatchTable( buffer, batchLength, batchTableStart, batchTableJSONByteLength, batchTableBinaryByteLength );
+		const batchTableBuffer = buffer.slice(
+			batchTableStart,
+			batchTableStart + batchTableBinaryByteLength + batchTableJSONByteLength,
+		);
+		const batchTable = new BatchTable(
+			batchTableBuffer,
+			featureTable.getData( 'INSTANCES_LENGTH' ),
+			0,
+			batchTableJSONByteLength,
+			batchTableBinaryByteLength,
+		);
 
 		const glbStart = batchTableStart + batchTableJSONByteLength + batchTableBinaryByteLength;
 		const bodyBytes = new Uint8Array( buffer, glbStart, byteLength - glbStart );

+ 21 - 3
src/base/PNTSLoaderBase.js

@@ -67,12 +67,30 @@ export class PNTSLoaderBase {
 
 		// 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 batchLength = featureTable.getData( 'BATCH_LENGTH' ) || featureTable.getData( 'POINTS_LENGTH' );
 		const batchTableStart = featureTableStart + featureTableJSONByteLength + featureTableBinaryByteLength;
-		const batchTable = new BatchTable( buffer, batchLength, batchTableStart, batchTableJSONByteLength, batchTableBinaryByteLength );
+		const batchTableBuffer = buffer.slice(
+			batchTableStart,
+			batchTableStart + batchTableBinaryByteLength + batchTableJSONByteLength,
+		);
+		const batchTable = new BatchTable(
+			batchTableBuffer,
+			featureTable.getData( 'BATCH_LENGTH' ) || featureTable.getData( 'POINTS_LENGTH' ),
+			0,
+			batchTableJSONByteLength,
+			batchTableBinaryByteLength,
+		);
 
 		return {
 			version,