@itwin/core-common 3.2.0-dev.72 → 3.3.0-dev.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 (31) hide show
  1. package/lib/cjs/HiddenLine.d.ts +12 -17
  2. package/lib/cjs/HiddenLine.d.ts.map +1 -1
  3. package/lib/cjs/HiddenLine.js +6 -2
  4. package/lib/cjs/HiddenLine.js.map +1 -1
  5. package/lib/cjs/rpc/web/RpcMultipart.d.ts +1 -0
  6. package/lib/cjs/rpc/web/RpcMultipart.d.ts.map +1 -1
  7. package/lib/cjs/rpc/web/multipart/RpcMultipartParser.d.ts +1 -0
  8. package/lib/cjs/rpc/web/multipart/RpcMultipartParser.d.ts.map +1 -1
  9. package/lib/cjs/tile/ElementGraphics.d.ts +8 -2
  10. package/lib/cjs/tile/ElementGraphics.d.ts.map +1 -1
  11. package/lib/cjs/tile/ElementGraphics.js.map +1 -1
  12. package/lib/cjs/tile/TileMetadata.d.ts +18 -13
  13. package/lib/cjs/tile/TileMetadata.d.ts.map +1 -1
  14. package/lib/cjs/tile/TileMetadata.js +164 -134
  15. package/lib/cjs/tile/TileMetadata.js.map +1 -1
  16. package/lib/esm/HiddenLine.d.ts +12 -17
  17. package/lib/esm/HiddenLine.d.ts.map +1 -1
  18. package/lib/esm/HiddenLine.js +6 -2
  19. package/lib/esm/HiddenLine.js.map +1 -1
  20. package/lib/esm/rpc/web/RpcMultipart.d.ts +1 -0
  21. package/lib/esm/rpc/web/RpcMultipart.d.ts.map +1 -1
  22. package/lib/esm/rpc/web/multipart/RpcMultipartParser.d.ts +1 -0
  23. package/lib/esm/rpc/web/multipart/RpcMultipartParser.d.ts.map +1 -1
  24. package/lib/esm/tile/ElementGraphics.d.ts +8 -2
  25. package/lib/esm/tile/ElementGraphics.d.ts.map +1 -1
  26. package/lib/esm/tile/ElementGraphics.js.map +1 -1
  27. package/lib/esm/tile/TileMetadata.d.ts +18 -13
  28. package/lib/esm/tile/TileMetadata.d.ts.map +1 -1
  29. package/lib/esm/tile/TileMetadata.js +163 -133
  30. package/lib/esm/tile/TileMetadata.js.map +1 -1
  31. package/package.json +8 -8
@@ -43,6 +43,7 @@ export interface TileOptions {
43
43
  readonly disableMagnification: boolean;
44
44
  readonly alwaysSubdivideIncompleteTiles: boolean;
45
45
  readonly enableIndexedEdges: boolean;
46
+ readonly generateAllPolyfaceEdges: boolean;
46
47
  }
47
48
  /** @internal */
48
49
  export declare namespace TileOptions {
@@ -54,13 +55,17 @@ export declare namespace TileOptions {
54
55
  */
55
56
  function fromTreeIdAndContentId(treeId: string, contentId: string): TileOptions;
56
57
  }
57
- /** @internal */
58
- export declare function parseTileTreeIdAndContentId(treeId: string, contentId: string): {
58
+ /** The result of [[parseTileTreeIdAndContentId]].
59
+ * @internal
60
+ */
61
+ export interface ParsedTileTreeIdAndContentId {
59
62
  modelId: Id64String;
60
63
  treeId: IModelTileTreeId;
61
64
  contentId: ContentIdSpec;
62
65
  options: TileOptions;
63
- };
66
+ }
67
+ /** @internal */
68
+ export declare function parseTileTreeIdAndContentId(treeId: string, contentId: string): ParsedTileTreeIdAndContentId;
64
69
  /** @internal */
65
70
  export declare const defaultTileOptions: TileOptions;
66
71
  /** @internal */
@@ -75,16 +80,16 @@ export declare enum TreeFlags {
75
80
  OptimizeBRepProcessing = 4,
76
81
  UseLargerTiles = 8
77
82
  }
78
- /** Describes the type of edges to include in the graphics for a tile tree.
79
- * @alpha
83
+ /** Describes how edges should be produced for tiles in a tile tree.
84
+ * @internal
80
85
  */
81
- export declare enum EdgeType {
82
- /** Omit all edges. */
83
- None = 0,
84
- /** Include non-indexed edges, which consume more memory and are less efficient to draw than [[Indexed]] edges, but are compatible with WebGL 1. */
85
- NonIndexed = 1,
86
- /** Include indexed edges, which use less memory and draw more efficiently than [[NonIndexed]] edges, but require WebGL 2. */
87
- Indexed = 2
86
+ export interface EdgeOptions {
87
+ /** Generate indexed edges. These use less memory and draw more efficiently than non-indexed edges, but require WebGL 2.
88
+ * Generally the display system will determine which to use based on the device's capabilities and application configuration.
89
+ */
90
+ indexed: boolean;
91
+ /** For polyfaces that lack edge visibility information, generate edges for all faces; otherwise, infer edges from mesh topology. */
92
+ smooth: boolean;
88
93
  }
89
94
  /** Describes a tile tree used to draw the contents of a model, possibly with embedded animation.
90
95
  * @internal
@@ -93,7 +98,7 @@ export interface PrimaryTileTreeId {
93
98
  /** Describes the type of tile tree. */
94
99
  type: BatchType.Primary;
95
100
  /** The type of edges to include in tile content. */
96
- edges: EdgeType;
101
+ edges: EdgeOptions | false;
97
102
  /** Id of the [DisplayStyle]($backend) or [RenderTimeline]($backend) element holding the [[RenderSchedule]] script to be applied to the tiles. */
98
103
  animationId?: Id64String;
99
104
  /** If true, meshes within the tiles will be grouped into nodes based on the display priority associated with their subcategories,
@@ -1 +1 @@
1
- {"version":3,"file":"TileMetadata.d.ts","sourceRoot":"","sources":["../../../src/tile/TileMetadata.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EACG,UAAU,EAA+E,UAAU,EAC5G,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAY,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAWzC;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;IAC7B,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC;IAChC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;CACjC;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;IAC/B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IAC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;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CA4E9J;AAED,gBAAgB;AAChB,MAAM,WAAW,sBAAuB,SAAQ,mBAAmB;IACjE,QAAQ,CAAC,oBAAoB,EAAE,MAAM,CAAC;CACvC;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,GAAG,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,OAAO,GAAG,sBAAsB,CAqD3L;AAID;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,GAAG,MAAM,CAS3G;AAED;;GAEG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAU;IAChC,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAU;IAC9C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAc;gBAEpB,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW;IAMvE;;OAEG;IACI,IAAI,CAAC,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,GAAG,YAAY;CAWhE"}
@@ -5,7 +5,7 @@
5
5
  /** @packageDocumentation
6
6
  * @module Tile
7
7
  */
8
- import { assert, compareBooleansOrUndefined, compareNumbers, compareStringsOrUndefined, Id64, } from "@itwin/core-bentley";
8
+ import { assert, compareBooleans, compareBooleansOrUndefined, compareNumbers, compareStringsOrUndefined, Id64, } from "@itwin/core-bentley";
9
9
  import { Range3d, Vector3d } from "@itwin/core-geometry";
10
10
  import { BatchType } from "../FeatureTable";
11
11
  import { CurrentImdlVersion, FeatureTableHeader, ImdlFlags, ImdlHeader } from "./IModelTileIO";
@@ -28,6 +28,7 @@ export var TileOptions;
28
28
  function fromTreeIdAndContentId(treeId, contentId) {
29
29
  const tree = treeFlagsAndFormatVersionFromId(treeId);
30
30
  const contentFlags = contentFlagsFromId(contentId);
31
+ const edgeOptions = edgeOptionsFromTreeId(treeId);
31
32
  return {
32
33
  maximumMajorTileFormatVersion: tree.version,
33
34
  enableInstancing: 0 !== (contentFlags & ContentFlags.AllowInstancing),
@@ -39,137 +40,143 @@ export var TileOptions;
39
40
  useLargerTiles: 0 !== (tree.flags & TreeFlags.UseLargerTiles),
40
41
  disableMagnification: false,
41
42
  alwaysSubdivideIncompleteTiles: false,
42
- enableIndexedEdges: true,
43
+ enableIndexedEdges: edgeOptions && edgeOptions.indexed,
44
+ generateAllPolyfaceEdges: edgeOptions && edgeOptions.smooth,
43
45
  };
44
46
  }
45
47
  TileOptions.fromTreeIdAndContentId = fromTreeIdAndContentId;
46
48
  })(TileOptions || (TileOptions = {}));
47
- /** @internal */
48
- export function parseTileTreeIdAndContentId(treeId, contentId) {
49
- let idx = 0;
50
- let type, expansion, animationId, edges, sectionCut;
51
- // Skip version and flags, they're handled by TileOptions.fromTreeIdAndContentId
52
- while (idx < treeId.length && treeId[idx] !== "-")
53
- idx++;
54
- idx++; // -
55
- if (idx >= treeId.length)
56
- throw new Error("Invalid tree Id");
57
- if (treeId[idx] === "C") {
58
- // PlanarClassifier or VolumeClassifier
59
- ({ idx, type, expansion } = parseClassifier(idx, treeId, expansion));
60
- }
61
- else {
62
- type = BatchType.Primary;
63
- }
64
- // Animation
65
- // eslint-disable-next-line prefer-const
66
- ({ idx, animationId } = parseAnimation(idx, treeId, animationId));
67
- if (type === BatchType.Primary) {
68
- ({ idx, edges, sectionCut } = parsePrimary(idx, treeId, edges, sectionCut));
69
- }
70
- const modelId = treeId.substr(idx);
71
- if (!Id64.isId64(modelId))
72
- throw new Error("Invalid tree Id");
73
- const { flags: treeFlags } = treeFlagsAndFormatVersionFromId(treeId);
74
- const parsedTreeId = getTreeId(type, edges, sectionCut, animationId, expansion, (treeFlags & TreeFlags.EnforceDisplayPriority) !== 0 ? true : undefined);
75
- const options = TileOptions.fromTreeIdAndContentId(treeId, contentId);
76
- let parsedContentId;
77
- try {
78
- parsedContentId = ContentIdProvider.create(true, options).specFromId(contentId);
79
- }
80
- catch (e) {
81
- throw new Error("Invalid content Id");
82
- }
83
- if (Object.keys(parsedContentId).some((key) => parsedContentId.hasOwnProperty(key) && typeof parsedContentId[key] === "number" && !Number.isFinite(parsedContentId[key])))
84
- throw new Error("Invalid content Id");
85
- return {
86
- contentId: parsedContentId,
87
- modelId,
88
- options,
89
- treeId: parsedTreeId,
90
- };
91
- }
92
- function getTreeId(type, edges, sectionCut, animationId, expansion, enforceDisplayPriority) {
93
- if (type === BatchType.Primary)
94
- return {
95
- type,
96
- edges,
97
- sectionCut,
98
- animationId,
99
- enforceDisplayPriority,
100
- };
101
- else
49
+ class Parser {
50
+ constructor(input) {
51
+ this.curPos = 0;
52
+ this.input = input;
53
+ }
54
+ parse(contentId) {
55
+ this.require(this.input.length > 0);
56
+ // Skip version and flags, they're handled by TileOptions.fromTreeIdAndContentId
57
+ while (this.curPos < this.input.length && this.cur() !== "-")
58
+ this.advance();
59
+ this.eat("-");
60
+ this.require(this.curPos < this.input.length);
61
+ const classifier = this.cur() === "C" ? this.parseClassifier() : undefined;
62
+ const animationId = this.parseAnimation();
63
+ const primary = classifier ? undefined : this.parsePrimary();
64
+ this.require((undefined === classifier) !== (undefined === primary));
65
+ const modelId = this.input.substr(this.curPos);
66
+ this.require(Id64.isId64(modelId));
67
+ const { flags: treeFlags } = treeFlagsAndFormatVersionFromId(this.input);
68
+ const options = TileOptions.fromTreeIdAndContentId(this.input, contentId);
69
+ let parsedContentId;
70
+ try {
71
+ parsedContentId = ContentIdProvider.create(true, options).specFromId(contentId);
72
+ }
73
+ catch (e) {
74
+ this.reject("Invalid content Id");
75
+ }
76
+ if (Object.keys(parsedContentId).some((key) => parsedContentId.hasOwnProperty(key) && typeof parsedContentId[key] === "number" && !Number.isFinite(parsedContentId[key])))
77
+ throw new Error("Invalid content Id");
78
+ let treeId;
79
+ if (classifier) {
80
+ treeId = { ...classifier, animationId };
81
+ }
82
+ else {
83
+ assert(undefined !== primary);
84
+ const enforceDisplayPriority = (treeFlags & TreeFlags.EnforceDisplayPriority) !== 0 ? true : undefined;
85
+ treeId = { ...primary, animationId, type: BatchType.Primary, enforceDisplayPriority };
86
+ }
102
87
  return {
103
- type,
104
- expansion,
105
- animationId,
88
+ contentId: parsedContentId,
89
+ modelId,
90
+ options,
91
+ treeId,
106
92
  };
107
- }
108
- function parsePrimary(idx, treeId, edges = EdgeType.None, sectionCut) {
109
- // Edges
110
- edges = EdgeType.NonIndexed;
111
- if (idx < treeId.length) {
112
- const noEdgesStr = "E:0_";
113
- if (treeId.startsWith(noEdgesStr, idx))
114
- edges = EdgeType.None;
115
- else if (treeId.startsWith("E:2_", idx))
116
- edges = EdgeType.Indexed;
117
- if (EdgeType.NonIndexed !== edges)
118
- idx += noEdgesStr.length;
119
- }
120
- // Section cut
121
- if (idx + 1 < treeId.length && treeId[idx] === "S") {
122
- idx++; // S
123
- sectionCut = "";
124
- while (idx < treeId.length && treeId[idx] !== "s") {
125
- sectionCut += treeId[idx++];
126
- }
127
- if (idx === treeId.length)
128
- throw new Error("Invalid tree Id");
129
- idx++; // s
130
93
  }
131
- return { idx, edges, sectionCut };
132
- }
133
- function parseClassifier(idx, treeId, expansion) {
134
- let type;
135
- idx++; // C
136
- if (idx + 1 < treeId.length && treeId[idx] === "P" && treeId[idx + 1] === ":") {
137
- type = BatchType.PlanarClassifier;
138
- idx += 2; // P:
94
+ cur() {
95
+ this.require(this.curPos < this.input.length);
96
+ return this.input[this.curPos];
139
97
  }
140
- else if (idx < treeId.length && treeId[idx] === ":") {
141
- type = BatchType.VolumeClassifier;
142
- idx++; // :
98
+ advance() {
99
+ this.require(this.curPos < this.input.length);
100
+ ++this.curPos;
143
101
  }
144
- else {
145
- throw new Error("Invalid tree Id");
102
+ eat(expectedChar) {
103
+ this.require(this.cur() === expectedChar);
104
+ this.advance();
146
105
  }
147
- // C: or CP: is always followed by {expansion}_
148
- let expansionStr = "";
149
- while (idx < treeId.length && (treeId[idx] >= "0" && treeId[idx] <= "9" || treeId[idx] === ".")) {
150
- expansionStr += treeId[idx++];
106
+ reject(message = "Invalid tree Id") {
107
+ throw new Error(message);
151
108
  }
152
- if (idx === treeId.length || treeId[idx] !== "_")
153
- throw new Error("Invalid tree Id");
154
- idx++; // _
155
- expansion = Number.parseFloat(expansionStr);
156
- return { idx, type, expansion };
157
- }
158
- function parseAnimation(idx, treeId, animationId) {
159
- if (idx < treeId.length && treeId[idx] === "A") {
160
- if (idx + 1 < treeId.length && treeId[idx + 1] !== ":")
161
- throw new Error("Invalid tree Id");
162
- idx += 2;
163
- // Parse animation id
164
- animationId = "";
165
- while (idx < treeId.length && treeId[idx] !== "_") {
166
- animationId += treeId[idx++];
109
+ require(condition, message = "Invalid tree Id") {
110
+ if (!condition)
111
+ this.reject(message);
112
+ }
113
+ parseClassifier() {
114
+ this.eat("C");
115
+ let type = BatchType.VolumeClassifier;
116
+ if (this.cur() === "P") {
117
+ type = BatchType.PlanarClassifier;
118
+ this.advance();
167
119
  }
168
- if (!Id64.isId64(animationId) || idx === treeId.length)
169
- throw new Error("Invalid tree Id");
170
- idx++; // _
120
+ this.eat(":");
121
+ // C: or CP: is always folowed by expansion then an underscore.
122
+ let expansionStr = "";
123
+ while (this.curPos < this.input.length && (this.cur() >= "0" && this.cur() <= "9" || this.cur() === ".")) {
124
+ expansionStr += this.cur();
125
+ this.advance();
126
+ }
127
+ this.eat("_");
128
+ const expansion = Number.parseFloat(expansionStr);
129
+ this.require(!Number.isNaN(expansion));
130
+ return { type, expansion };
131
+ }
132
+ parseAnimation() {
133
+ if (this.cur() !== "A")
134
+ return undefined;
135
+ this.eat("A");
136
+ this.eat(":");
137
+ const termPos = this.input.indexOf("_", this.curPos);
138
+ this.require(termPos > this.curPos);
139
+ const animationId = this.input.substring(this.curPos, termPos);
140
+ this.require(Id64.isId64(animationId));
141
+ this.curPos = termPos + 1; // Skip "_"
142
+ return animationId;
143
+ }
144
+ parsePrimary() {
145
+ const edges = this.parseEdges();
146
+ const sectionCut = this.parseSectionCut();
147
+ return { edges, sectionCut };
148
+ }
149
+ parseEdges() {
150
+ if ("E" !== this.cur())
151
+ return { indexed: false, smooth: false };
152
+ this.eat("E");
153
+ this.eat(":");
154
+ const typeStr = this.cur();
155
+ this.eat(typeStr);
156
+ this.eat("_");
157
+ switch (typeStr) {
158
+ case "0": return false;
159
+ case "2": return { indexed: true, smooth: false };
160
+ case "3": return { indexed: false, smooth: true };
161
+ case "4": return { indexed: true, smooth: true };
162
+ default: this.reject();
163
+ }
164
+ }
165
+ parseSectionCut() {
166
+ if ("S" !== this.cur())
167
+ return undefined;
168
+ this.eat("S");
169
+ const termPos = this.input.indexOf("s", this.curPos);
170
+ this.require(termPos > this.curPos);
171
+ const sectionCut = this.input.substring(this.curPos, termPos);
172
+ this.curPos = termPos + 1; // Skip "_";
173
+ return sectionCut;
171
174
  }
172
- return { idx, animationId };
175
+ }
176
+ /** @internal */
177
+ export function parseTileTreeIdAndContentId(treeId, contentId) {
178
+ const parser = new Parser(treeId);
179
+ return parser.parse(contentId);
173
180
  }
174
181
  /** @internal */
175
182
  export const defaultTileOptions = Object.freeze({
@@ -184,6 +191,7 @@ export const defaultTileOptions = Object.freeze({
184
191
  disableMagnification: false,
185
192
  alwaysSubdivideIncompleteTiles: false,
186
193
  enableIndexedEdges: true,
194
+ generateAllPolyfaceEdges: true,
187
195
  });
188
196
  function contentFlagsFromId(id) {
189
197
  if (0 === id.length || "-" !== id[0])
@@ -212,6 +220,18 @@ function treeFlagsAndFormatVersionFromId(id) {
212
220
  }
213
221
  throw new Error("Invalid tree Id");
214
222
  }
223
+ function edgeOptionsFromTreeId(id) {
224
+ const pos = id.indexOf("E:");
225
+ if (pos <= 0)
226
+ return { indexed: false, smooth: false };
227
+ switch (id[pos + 2]) {
228
+ case "0": return { indexed: defaultTileOptions.enableIndexedEdges, smooth: defaultTileOptions.generateAllPolyfaceEdges };
229
+ case "2": return { indexed: true, smooth: false };
230
+ case "3": return { indexed: false, smooth: true };
231
+ case "4": return { indexed: true, smooth: true };
232
+ }
233
+ throw new Error("Invalid tree Id");
234
+ }
215
235
  /** @internal */
216
236
  export function getMaximumMajorTileFormatVersion(maxMajorVersion, formatVersion) {
217
237
  // The `formatVersion` input is from the backend, telling us precisely the maximum major+minor version it can produce.
@@ -238,18 +258,19 @@ export var TreeFlags;
238
258
  TreeFlags[TreeFlags["OptimizeBRepProcessing"] = 4] = "OptimizeBRepProcessing";
239
259
  TreeFlags[TreeFlags["UseLargerTiles"] = 8] = "UseLargerTiles";
240
260
  })(TreeFlags || (TreeFlags = {}));
241
- /** Describes the type of edges to include in the graphics for a tile tree.
242
- * @alpha
243
- */
244
- export var EdgeType;
245
- (function (EdgeType) {
246
- /** Omit all edges. */
247
- EdgeType[EdgeType["None"] = 0] = "None";
248
- /** Include non-indexed edges, which consume more memory and are less efficient to draw than [[Indexed]] edges, but are compatible with WebGL 1. */
249
- EdgeType[EdgeType["NonIndexed"] = 1] = "NonIndexed";
250
- /** Include indexed edges, which use less memory and draw more efficiently than [[NonIndexed]] edges, but require WebGL 2. */
251
- EdgeType[EdgeType["Indexed"] = 2] = "Indexed";
252
- })(EdgeType || (EdgeType = {}));
261
+ function compareEdgeOptions(a, b) {
262
+ if (typeof a !== typeof b)
263
+ return a ? 1 : -1;
264
+ if (typeof a === "boolean") {
265
+ assert(typeof b === "boolean");
266
+ return compareBooleans(a, b);
267
+ }
268
+ assert(typeof b === "object");
269
+ let cmp = compareBooleans(a.indexed, b.indexed);
270
+ if (0 === cmp)
271
+ cmp = compareBooleans(a.smooth, b.smooth);
272
+ return cmp;
273
+ }
253
274
  function animationIdToString(animationId) {
254
275
  return `A:${animationId}_`;
255
276
  }
@@ -268,7 +289,16 @@ export function iModelTileTreeIdToString(modelId, treeId, options) {
268
289
  idStr = `${idStr}${animationIdToString(treeId.animationId)}`;
269
290
  else if (treeId.enforceDisplayPriority) // animation and priority are currently mutually exclusive
270
291
  flags |= TreeFlags.EnforceDisplayPriority;
271
- const edges = treeId.edges !== EdgeType.NonIndexed ? `E:${treeId.edges}_` : "";
292
+ let edges;
293
+ if (!treeId.edges) {
294
+ edges = "E:0_";
295
+ }
296
+ else {
297
+ if (!treeId.edges.smooth)
298
+ edges = treeId.edges.indexed ? "E:2_" : "";
299
+ else
300
+ edges = treeId.edges.indexed ? "E:4_" : "E:3_";
301
+ }
272
302
  const sectionCut = treeId.sectionCut ? `S${treeId.sectionCut}s` : "";
273
303
  idStr = `${idStr}${edges}${sectionCut}`;
274
304
  }
@@ -299,7 +329,7 @@ export function compareIModelTileTreeIds(lhs, rhs) {
299
329
  // NB: The redundant checks on BatchType below are to satisfy compiler.
300
330
  assert(lhs.type === rhs.type);
301
331
  if (BatchType.Primary === lhs.type && BatchType.Primary === rhs.type) {
302
- cmp = compareNumbers(lhs.edges, rhs.edges);
332
+ cmp = compareEdgeOptions(lhs.edges, rhs.edges);
303
333
  if (0 === cmp) {
304
334
  cmp = compareBooleansOrUndefined(lhs.enforceDisplayPriority, rhs.enforceDisplayPriority);
305
335
  if (0 === cmp)