@loaders.gl/tile-converter 3.3.0-alpha.7 → 3.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/dist/3d-tiles-attributes-worker.d.ts +2 -2
  2. package/dist/3d-tiles-attributes-worker.d.ts.map +1 -1
  3. package/dist/3d-tiles-attributes-worker.js +2 -2
  4. package/dist/3d-tiles-attributes-worker.js.map +3 -3
  5. package/dist/converter-cli.js +14 -2
  6. package/dist/converter.min.js +22 -22
  7. package/dist/deps-installer/deps-installer.d.ts.map +1 -1
  8. package/dist/deps-installer/deps-installer.js +8 -0
  9. package/dist/dist.min.js +1407 -1242
  10. package/dist/es5/3d-tiles-attributes-worker.js +1 -1
  11. package/dist/es5/3d-tiles-attributes-worker.js.map +1 -1
  12. package/dist/es5/converter-cli.js +14 -2
  13. package/dist/es5/converter-cli.js.map +1 -1
  14. package/dist/es5/deps-installer/deps-installer.js +13 -2
  15. package/dist/es5/deps-installer/deps-installer.js.map +1 -1
  16. package/dist/es5/i3s-attributes-worker.js +1 -1
  17. package/dist/es5/i3s-attributes-worker.js.map +1 -1
  18. package/dist/es5/i3s-converter/helpers/batch-ids-extensions.js.map +1 -1
  19. package/dist/es5/i3s-converter/helpers/geometry-attributes.js +16 -7
  20. package/dist/es5/i3s-converter/helpers/geometry-attributes.js.map +1 -1
  21. package/dist/es5/i3s-converter/helpers/geometry-converter.js +363 -113
  22. package/dist/es5/i3s-converter/helpers/geometry-converter.js.map +1 -1
  23. package/dist/es5/i3s-converter/helpers/gltf-attributes.js +6 -11
  24. package/dist/es5/i3s-converter/helpers/gltf-attributes.js.map +1 -1
  25. package/dist/es5/i3s-converter/helpers/node-index-document.js +517 -0
  26. package/dist/es5/i3s-converter/helpers/node-index-document.js.map +1 -0
  27. package/dist/es5/i3s-converter/helpers/node-pages.js +455 -173
  28. package/dist/es5/i3s-converter/helpers/node-pages.js.map +1 -1
  29. package/dist/es5/i3s-converter/i3s-converter.js +549 -618
  30. package/dist/es5/i3s-converter/i3s-converter.js.map +1 -1
  31. package/dist/es5/i3s-converter/json-templates/geometry-definitions.js +107 -0
  32. package/dist/es5/i3s-converter/json-templates/geometry-definitions.js.map +1 -0
  33. package/dist/es5/i3s-converter/json-templates/layers.js +2 -93
  34. package/dist/es5/i3s-converter/json-templates/layers.js.map +1 -1
  35. package/dist/es5/i3s-converter/json-templates/shared-resources.js +3 -3
  36. package/dist/es5/i3s-converter/json-templates/shared-resources.js.map +1 -1
  37. package/dist/es5/i3s-converter/types.js.map +1 -1
  38. package/dist/es5/lib/utils/file-utils.js +93 -9
  39. package/dist/es5/lib/utils/file-utils.js.map +1 -1
  40. package/dist/es5/lib/utils/write-queue.js +38 -25
  41. package/dist/es5/lib/utils/write-queue.js.map +1 -1
  42. package/dist/es5/pgm-loader.js +1 -1
  43. package/dist/es5/pgm-loader.js.map +1 -1
  44. package/dist/es5/workers/i3s-attributes-worker.js +1 -1
  45. package/dist/es5/workers/i3s-attributes-worker.js.map +1 -1
  46. package/dist/esm/3d-tiles-attributes-worker.js +1 -1
  47. package/dist/esm/3d-tiles-attributes-worker.js.map +1 -1
  48. package/dist/esm/converter-cli.js +14 -2
  49. package/dist/esm/converter-cli.js.map +1 -1
  50. package/dist/esm/deps-installer/deps-installer.js +9 -1
  51. package/dist/esm/deps-installer/deps-installer.js.map +1 -1
  52. package/dist/esm/i3s-attributes-worker.js +1 -1
  53. package/dist/esm/i3s-attributes-worker.js.map +1 -1
  54. package/dist/esm/i3s-converter/helpers/batch-ids-extensions.js.map +1 -1
  55. package/dist/esm/i3s-converter/helpers/geometry-attributes.js +16 -7
  56. package/dist/esm/i3s-converter/helpers/geometry-attributes.js.map +1 -1
  57. package/dist/esm/i3s-converter/helpers/geometry-converter.js +150 -40
  58. package/dist/esm/i3s-converter/helpers/geometry-converter.js.map +1 -1
  59. package/dist/esm/i3s-converter/helpers/gltf-attributes.js +6 -9
  60. package/dist/esm/i3s-converter/helpers/gltf-attributes.js.map +1 -1
  61. package/dist/esm/i3s-converter/helpers/node-index-document.js +202 -0
  62. package/dist/esm/i3s-converter/helpers/node-index-document.js.map +1 -0
  63. package/dist/esm/i3s-converter/helpers/node-pages.js +162 -76
  64. package/dist/esm/i3s-converter/helpers/node-pages.js.map +1 -1
  65. package/dist/esm/i3s-converter/i3s-converter.js +115 -220
  66. package/dist/esm/i3s-converter/i3s-converter.js.map +1 -1
  67. package/dist/esm/i3s-converter/json-templates/geometry-definitions.js +89 -0
  68. package/dist/esm/i3s-converter/json-templates/geometry-definitions.js.map +1 -0
  69. package/dist/esm/i3s-converter/json-templates/layers.js +2 -85
  70. package/dist/esm/i3s-converter/json-templates/layers.js.map +1 -1
  71. package/dist/esm/i3s-converter/json-templates/shared-resources.js +3 -3
  72. package/dist/esm/i3s-converter/json-templates/shared-resources.js.map +1 -1
  73. package/dist/esm/i3s-converter/types.js.map +1 -1
  74. package/dist/esm/lib/utils/file-utils.js +44 -3
  75. package/dist/esm/lib/utils/file-utils.js.map +1 -1
  76. package/dist/esm/lib/utils/write-queue.js +19 -10
  77. package/dist/esm/lib/utils/write-queue.js.map +1 -1
  78. package/dist/esm/pgm-loader.js +1 -1
  79. package/dist/esm/pgm-loader.js.map +1 -1
  80. package/dist/esm/workers/i3s-attributes-worker.js +1 -1
  81. package/dist/esm/workers/i3s-attributes-worker.js.map +1 -1
  82. package/dist/i3s-attributes-worker.d.ts +2 -2
  83. package/dist/i3s-attributes-worker.d.ts.map +1 -1
  84. package/dist/i3s-attributes-worker.js +2 -2
  85. package/dist/i3s-attributes-worker.js.map +2 -2
  86. package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts +3 -3
  87. package/dist/i3s-converter/helpers/batch-ids-extensions.js +3 -3
  88. package/dist/i3s-converter/helpers/geometry-attributes.d.ts.map +1 -1
  89. package/dist/i3s-converter/helpers/geometry-attributes.js +16 -10
  90. package/dist/i3s-converter/helpers/geometry-converter.d.ts +8 -4
  91. package/dist/i3s-converter/helpers/geometry-converter.d.ts.map +1 -1
  92. package/dist/i3s-converter/helpers/geometry-converter.js +200 -44
  93. package/dist/i3s-converter/helpers/gltf-attributes.d.ts.map +1 -1
  94. package/dist/i3s-converter/helpers/gltf-attributes.js +2 -3
  95. package/dist/i3s-converter/helpers/node-index-document.d.ts +95 -0
  96. package/dist/i3s-converter/helpers/node-index-document.d.ts.map +1 -0
  97. package/dist/i3s-converter/helpers/node-index-document.js +250 -0
  98. package/dist/i3s-converter/helpers/node-pages.d.ts +78 -43
  99. package/dist/i3s-converter/helpers/node-pages.d.ts.map +1 -1
  100. package/dist/i3s-converter/helpers/node-pages.js +195 -94
  101. package/dist/i3s-converter/i3s-converter.d.ts +33 -58
  102. package/dist/i3s-converter/i3s-converter.d.ts.map +1 -1
  103. package/dist/i3s-converter/i3s-converter.js +122 -233
  104. package/dist/i3s-converter/json-templates/geometry-definitions.d.ts +7 -0
  105. package/dist/i3s-converter/json-templates/geometry-definitions.d.ts.map +1 -0
  106. package/dist/i3s-converter/json-templates/geometry-definitions.js +87 -0
  107. package/dist/i3s-converter/json-templates/layers.d.ts +1 -30
  108. package/dist/i3s-converter/json-templates/layers.d.ts.map +1 -1
  109. package/dist/i3s-converter/json-templates/layers.js +2 -86
  110. package/dist/i3s-converter/json-templates/shared-resources.js +3 -3
  111. package/dist/i3s-converter/types.d.ts +34 -8
  112. package/dist/i3s-converter/types.d.ts.map +1 -1
  113. package/dist/lib/utils/file-utils.d.ts +17 -1
  114. package/dist/lib/utils/file-utils.d.ts.map +1 -1
  115. package/dist/lib/utils/file-utils.js +64 -7
  116. package/dist/lib/utils/write-queue.d.ts +19 -3
  117. package/dist/lib/utils/write-queue.d.ts.map +1 -1
  118. package/dist/lib/utils/write-queue.js +18 -12
  119. package/dist/workers/i3s-attributes-worker.js +1 -1
  120. package/package.json +25 -20
  121. package/src/converter-cli.ts +22 -2
  122. package/src/deps-installer/deps-installer.ts +9 -0
  123. package/src/i3s-converter/helpers/batch-ids-extensions.ts +3 -3
  124. package/src/i3s-converter/helpers/geometry-attributes.ts +16 -11
  125. package/src/i3s-converter/helpers/geometry-converter.ts +217 -48
  126. package/src/i3s-converter/helpers/gltf-attributes.ts +2 -3
  127. package/src/i3s-converter/helpers/node-index-document.ts +315 -0
  128. package/src/i3s-converter/helpers/node-pages.ts +215 -110
  129. package/src/i3s-converter/i3s-converter.ts +170 -312
  130. package/src/i3s-converter/json-templates/geometry-definitions.ts +83 -0
  131. package/src/i3s-converter/json-templates/layers.ts +2 -91
  132. package/src/i3s-converter/json-templates/shared-resources.ts +3 -3
  133. package/src/i3s-converter/types.ts +29 -2
  134. package/src/lib/utils/file-utils.ts +62 -7
  135. package/src/lib/utils/write-queue.ts +36 -15
  136. package/src/workers/i3s-attributes-worker.ts +2 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loaders.gl/tile-converter",
3
- "version": "3.3.0-alpha.7",
3
+ "version": "3.3.0",
4
4
  "description": "Converter",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -33,29 +33,30 @@
33
33
  "fs": false,
34
34
  "path": false,
35
35
  "process": false,
36
- "archiver": false
36
+ "archiver": false,
37
+ "join-images": false
37
38
  },
38
39
  "scripts": {
39
40
  "pre-build": "npm run build-bundle && npm run build-converter-bundle && npm run build-i3s-attributes-worker && npm run build-3d-tiles-attributes-worker",
40
- "build-bundle": "esbuild ./src/index.ts --bundle --outfile=dist/dist.min.js --platform=node",
41
+ "build-bundle": "esbuild ./src/index.ts --bundle --outfile=dist/dist.min.js --platform=node --external:join-images",
41
42
  "build-converter-bundle": "webpack --display errors-only --config ./converter-webpack/bundle.js",
42
- "build-i3s-attributes-worker": "esbuild src/workers/i3s-attributes-worker.ts --outfile=dist/i3s-attributes-worker.js --platform=node --target=esnext,node12 --minify --bundle --sourcemap --define:__VERSION__=\\\"$npm_package_version\\\"",
43
- "build-3d-tiles-attributes-worker": "esbuild src/workers/3d-tiles-attributes-worker.ts --outfile=dist/3d-tiles-attributes-worker.js --platform=node --target=esnext,node12 --minify --bundle --sourcemap --define:__VERSION__=\\\"$npm_package_version\\\""
43
+ "build-i3s-attributes-worker": "esbuild src/workers/i3s-attributes-worker.ts --outfile=dist/i3s-attributes-worker.js --platform=node --target=esnext,node12 --external:join-images --minify --bundle --sourcemap --define:__VERSION__=\\\"$npm_package_version\\\"",
44
+ "build-3d-tiles-attributes-worker": "esbuild src/workers/3d-tiles-attributes-worker.ts --outfile=dist/3d-tiles-attributes-worker.js --platform=node --target=esnext,node12 --external:join-images --minify --bundle --sourcemap --define:__VERSION__=\\\"$npm_package_version\\\""
44
45
  },
45
46
  "dependencies": {
46
- "@loaders.gl/3d-tiles": "3.3.0-alpha.7",
47
- "@loaders.gl/crypto": "3.3.0-alpha.7",
48
- "@loaders.gl/draco": "3.3.0-alpha.7",
49
- "@loaders.gl/gltf": "3.3.0-alpha.7",
50
- "@loaders.gl/i3s": "3.3.0-alpha.7",
51
- "@loaders.gl/images": "3.3.0-alpha.7",
52
- "@loaders.gl/loader-utils": "3.3.0-alpha.7",
53
- "@loaders.gl/polyfills": "3.3.0-alpha.7",
54
- "@loaders.gl/schema": "3.3.0-alpha.7",
55
- "@loaders.gl/textures": "3.3.0-alpha.7",
56
- "@loaders.gl/tiles": "3.3.0-alpha.7",
57
- "@loaders.gl/worker-utils": "3.3.0-alpha.7",
58
- "@loaders.gl/zip": "3.3.0-alpha.7",
47
+ "@loaders.gl/3d-tiles": "3.3.0",
48
+ "@loaders.gl/crypto": "3.3.0",
49
+ "@loaders.gl/draco": "3.3.0",
50
+ "@loaders.gl/gltf": "3.3.0",
51
+ "@loaders.gl/i3s": "3.3.0",
52
+ "@loaders.gl/images": "3.3.0",
53
+ "@loaders.gl/loader-utils": "3.3.0",
54
+ "@loaders.gl/polyfills": "3.3.0",
55
+ "@loaders.gl/schema": "3.3.0",
56
+ "@loaders.gl/textures": "3.3.0",
57
+ "@loaders.gl/tiles": "3.3.0",
58
+ "@loaders.gl/worker-utils": "3.3.0",
59
+ "@loaders.gl/zip": "3.3.0",
59
60
  "@luma.gl/engine": "^8.5.4",
60
61
  "@math.gl/core": "^3.5.1",
61
62
  "@math.gl/culling": "^3.5.1",
@@ -65,7 +66,7 @@
65
66
  "cors": "^2.8.5",
66
67
  "crypt": "^0.0.2",
67
68
  "debug": "~2.6.9",
68
- "express": "~4.16.1",
69
+ "express": "~4.17.3",
69
70
  "json-map-transform": "^1.2.6",
70
71
  "jszip": "^3.5.0",
71
72
  "md5": "^2.3.0",
@@ -75,5 +76,9 @@
75
76
  "peerDependencies": {
76
77
  "@loaders.gl/core": "^3.2.0"
77
78
  },
78
- "gitHead": "29b08f3519c50984e84bf4234e607cab7c7d1c3e"
79
+ "quarantinedDependencies": {
80
+ "join-images": "^1.1.3",
81
+ "sharp": "^0.31.3"
82
+ },
83
+ "gitHead": "566d194f175a03e042d3e588cdd514048f428cc1"
79
84
  }
@@ -14,6 +14,10 @@ type TileConversionOptions = {
14
14
  /** Output folder. This folder will be created by converter if doesn't exist. It is relative to the converter path.
15
15
  * Default: "data" folder */
16
16
  output: string;
17
+ /** Keep created 3DNodeIndexDocument files on disk instead of memory. This option reduce memory usage but decelerates conversion speed */
18
+ instantNodeWriting: boolean;
19
+ /** Try to merge similar materials to be able to merge meshes into one node (I3S to 3DTiles conversion only) */
20
+ mergeMaterials: boolean;
17
21
  /** 3DTiles->I3S only. location of 7z.exe archiver to create slpk on Windows OS, default: "C:\Program Files\7-Zip\7z.exe" */
18
22
  sevenZipExe: string;
19
23
  /** location of the Earth Gravity Model (*.pgm) file to convert heights from ellipsoidal to gravity-related format,
@@ -99,6 +103,12 @@ function printHelp(): void {
99
103
  );
100
104
  console.log('--name [Tileset name]');
101
105
  console.log('--output [Output folder, default: "data" folder]');
106
+ console.log(
107
+ '--instant-node-writing [Keep created 3DNodeIndexDocument files on disk instead of memory. This option reduce memory usage but decelerates conversion speed]'
108
+ );
109
+ console.log(
110
+ '--split-nodes [Prevent to merge similar materials that could lead to incorrect visualization (I3S to 3DTiles conversion only)]'
111
+ );
102
112
  console.log('--slpk [Generate slpk (Scene Layer Packages) I3S output file]');
103
113
  console.log(
104
114
  '--tileset [tileset.json file (3DTiles) / http://..../SceneServer/layers/0 resource (I3S)]'
@@ -154,9 +164,11 @@ async function convert(options: ValidatedTileConversionOptions) {
154
164
  egmFilePath: options.egm,
155
165
  token: options.token,
156
166
  draco: options.draco,
167
+ mergeMaterials: options.mergeMaterials,
157
168
  generateTextures: options.generateTextures,
158
169
  generateBoundingVolumes: options.generateBoundingVolumes,
159
- validate: options.validate
170
+ validate: options.validate,
171
+ instantNodeWriting: options.instantNodeWriting
160
172
  });
161
173
  break;
162
174
  default:
@@ -222,6 +234,8 @@ function validateOptionsWithEqual(args: string[]): string[] {
222
234
  function parseOptions(args: string[]): TileConversionOptions {
223
235
  const opts: TileConversionOptions = {
224
236
  output: 'data',
237
+ instantNodeWriting: false,
238
+ mergeMaterials: true,
225
239
  sevenZipExe: 'C:\\Program Files\\7-Zip\\7z.exe',
226
240
  egm: join(process.cwd(), 'deps', 'egm2008-5.pgm'),
227
241
  draco: true,
@@ -248,6 +262,12 @@ function parseOptions(args: string[]): TileConversionOptions {
248
262
  case '--output':
249
263
  opts.output = getStringValue(index, args);
250
264
  break;
265
+ case '--instant-node-writing':
266
+ opts.instantNodeWriting = getBooleanValue(index, args);
267
+ break;
268
+ case '--split-nodes':
269
+ opts.mergeMaterials = getBooleanValue(index, args);
270
+ break;
251
271
  case '--max-depth':
252
272
  opts.maxDepth = getIntegerValue(index, args);
253
273
  break;
@@ -340,7 +360,7 @@ function getIntegerValue(index: number, args: string[]): number {
340
360
 
341
361
  function getBooleanValue(index: number, args: string[]): boolean {
342
362
  const stringValue: string = getStringValue(index, args).toLowerCase().trim();
343
- if (args[index] === '--no-draco' && !stringValue) {
363
+ if (['--no-draco', '--split-nodes'].includes(args[index]) && !stringValue) {
344
364
  return false;
345
365
  }
346
366
  if (!stringValue || stringValue === 'true') {
@@ -2,6 +2,7 @@ import {load, fetchFile} from '@loaders.gl/core';
2
2
  import {ZipLoader} from '@loaders.gl/zip';
3
3
  import {writeFile} from '../lib/utils/file-utils';
4
4
  import {join} from 'path';
5
+ import {ChildProcessProxy} from '@loaders.gl/worker-utils';
5
6
 
6
7
  // @ts-ignore TS2304: Cannot find name '__VERSION__'.
7
8
  const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'beta';
@@ -42,6 +43,14 @@ export class DepsInstaller {
42
43
  console.log('Installing "Basis Loader worker"'); // eslint-disable-line no-console
43
44
  await this.installWorker('textures', 'basis-nodejs-worker.js', workersPath);
44
45
 
46
+ console.log('Installing "join-images" npm package');
47
+ const childProcess = new ChildProcessProxy();
48
+ await childProcess.start({
49
+ command: 'npm',
50
+ arguments: ['install', 'sharp', 'join-images'],
51
+ wait: 0
52
+ });
53
+
45
54
  console.log('All dependencies were installed succesfully.'); // eslint-disable-line no-console
46
55
  }
47
56
 
@@ -13,9 +13,9 @@ const EXT_FEATURE_METADATA = 'EXT_feature_metadata';
13
13
 
14
14
  /**
15
15
  * Getting batchIds from 3DTilesNext extensions.
16
- * @param attributes
17
- * @param primitive
18
- * @param textures
16
+ * @param attributes - gltf accessors
17
+ * @param primitive - gltf primitive data
18
+ * @param images - gltf texture images
19
19
  */
20
20
  export function handleBatchIdsExtensions(
21
21
  attributes: {
@@ -10,7 +10,7 @@ const POSITIONS_AND_NORMALS_PER_TRIANGLE = 9;
10
10
  * @returns attirbutes with featureCount, featureIds and changed faceRange.
11
11
  */
12
12
  export function generateAttributes(attributes: ConvertedAttributes): GeometryAttributes {
13
- const {positions, normals, texCoords, colors, featureIndices} = attributes;
13
+ const {positions, normals, texCoords, colors, uvRegions, featureIndices} = attributes;
14
14
  const triangleCount = positions.length / POSITIONS_AND_NORMALS_PER_TRIANGLE;
15
15
 
16
16
  if (!featureIndices.length) {
@@ -21,7 +21,8 @@ export function generateAttributes(attributes: ConvertedAttributes): GeometryAtt
21
21
  positions,
22
22
  normals,
23
23
  texCoords,
24
- colors
24
+ colors,
25
+ uvRegions
25
26
  };
26
27
  }
27
28
 
@@ -113,6 +114,7 @@ function makeAttributeObjects(attributes: GeometryAttributes): GroupedByFeatureI
113
114
  positions,
114
115
  normals,
115
116
  colors,
117
+ uvRegions,
116
118
  texCoords,
117
119
  faceRange = new Uint32Array(0)
118
120
  } = attributes;
@@ -122,16 +124,16 @@ function makeAttributeObjects(attributes: GeometryAttributes): GroupedByFeatureI
122
124
  let normalsList = new Float32Array(normals);
123
125
  let colorsList = new Uint8Array(colors);
124
126
  let texCoordsList = new Float32Array(texCoords);
125
-
126
- let faceRangeIndex = 0;
127
+ let uvRegionsList = new Uint16Array(uvRegions);
127
128
 
128
129
  for (let index = 0; index < featureIds.length; index++) {
129
- const startIndex = faceRange[index + faceRangeIndex];
130
- const endIndex = faceRange[index + faceRangeIndex + 1];
130
+ const startIndex = faceRange[index * 2];
131
+ const endIndex = faceRange[index * 2 + 1];
131
132
 
132
133
  const positionsCount = getSliceAttributeCount('positions', startIndex, endIndex);
133
134
  const normalsCount = getSliceAttributeCount('normals', startIndex, endIndex);
134
135
  const colorsCount = getSliceAttributeCount('colors', startIndex, endIndex);
136
+ const uvRegionsCount = getSliceAttributeCount('uvRegions', startIndex, endIndex);
135
137
  const texCoordsCount = getSliceAttributeCount('texCoords', startIndex, endIndex);
136
138
 
137
139
  groupedData.push({
@@ -139,15 +141,15 @@ function makeAttributeObjects(attributes: GeometryAttributes): GroupedByFeatureI
139
141
  positions: positionsList.slice(0, positionsCount),
140
142
  normals: normalsList.slice(0, normalsCount),
141
143
  colors: colorsList.slice(0, colorsCount),
144
+ uvRegions: uvRegionsList.slice(0, uvRegionsCount),
142
145
  texCoords: texCoordsList.slice(0, texCoordsCount)
143
146
  });
144
147
 
145
148
  positionsList = positionsList.slice(positionsCount);
146
149
  normalsList = normalsList.slice(normalsCount);
147
150
  colorsList = colorsList.slice(colorsCount);
151
+ uvRegionsList = uvRegionsList.slice(uvRegionsCount);
148
152
  texCoordsList = texCoordsList.slice(texCoordsCount);
149
-
150
- faceRangeIndex += 1;
151
153
  }
152
154
 
153
155
  return groupedData.sort((first, second) => first.featureId - second.featureId);
@@ -165,7 +167,7 @@ function getSliceAttributeCount(
165
167
  startIndex: number,
166
168
  endIndex: number
167
169
  ): number {
168
- const colorsPerVertex = 4;
170
+ const itemsPerVertex4 = 4;
169
171
  const texCoordsPerVertex = 2;
170
172
 
171
173
  const trianglesCount = endIndex - startIndex + 1;
@@ -176,7 +178,8 @@ function getSliceAttributeCount(
176
178
  case 'normals':
177
179
  return trianglesCount * POSITIONS_AND_NORMALS_PER_TRIANGLE;
178
180
  case 'colors':
179
- return vertexCount * colorsPerVertex;
181
+ case 'uvRegions':
182
+ return vertexCount * itemsPerVertex4;
180
183
  case 'texCoords':
181
184
  return vertexCount * texCoordsPerVertex;
182
185
  default:
@@ -232,6 +235,7 @@ function groupAttributesAndRangesByFeatureId(
232
235
  let positions = new Float32Array(firstAttributeObject.positions);
233
236
  let normals = new Float32Array(firstAttributeObject.normals);
234
237
  let colors = new Uint8Array(firstAttributeObject.colors);
238
+ let uvRegions = new Uint16Array(firstAttributeObject.uvRegions);
235
239
  let texCoords = new Float32Array(firstAttributeObject.texCoords);
236
240
  const range = [0];
237
241
 
@@ -245,6 +249,7 @@ function groupAttributesAndRangesByFeatureId(
245
249
  positions = concatenateTypedArrays(positions, currentAttributesObject.positions);
246
250
  normals = concatenateTypedArrays(normals, currentAttributesObject.normals);
247
251
  colors = concatenateTypedArrays(colors, currentAttributesObject.colors);
252
+ uvRegions = concatenateTypedArrays(uvRegions, currentAttributesObject.uvRegions);
248
253
  texCoords = concatenateTypedArrays(texCoords, currentAttributesObject.texCoords);
249
254
 
250
255
  const groupedObject = unifiedObjects[objIndex];
@@ -258,5 +263,5 @@ function groupAttributesAndRangesByFeatureId(
258
263
  range.push(positions.length / POSITIONS_AND_NORMALS_PER_TRIANGLE - 1);
259
264
 
260
265
  const faceRange = new Uint32Array(range);
261
- return {faceRange, featureIds, positions, normals, colors, texCoords, featureCount};
266
+ return {faceRange, featureIds, positions, normals, colors, uvRegions, texCoords, featureCount};
262
267
  }