@itwin/ecschema-rpcinterface-tests 5.8.0-dev.13 → 5.8.0-dev.15

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.
@@ -105442,6 +105442,7 @@ class Parser {
105442
105442
  prevIndices: p.polyline.prevIndices.data,
105443
105443
  nextIndicesAndParams: p.polyline.nextIndicesAndParams,
105444
105444
  },
105445
+ hasCumulativeDistances: p.hasCumulativeDistances,
105445
105446
  },
105446
105447
  });
105447
105448
  }
@@ -105657,6 +105658,7 @@ class Parser {
105657
105658
  type,
105658
105659
  weight: displayParams.width,
105659
105660
  linePixels: displayParams.linePixels,
105661
+ hasCumulativeDistances: false,
105660
105662
  },
105661
105663
  };
105662
105664
  }
@@ -107944,9 +107946,17 @@ class InstancedGraphicPropsBuilder {
107944
107946
  "use strict";
107945
107947
  __webpack_require__.r(__webpack_exports__);
107946
107948
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
107947
- /* harmony export */ lineCodeFromLinePixels: () => (/* binding */ lineCodeFromLinePixels)
107949
+ /* harmony export */ getLineCodePatterns: () => (/* binding */ getLineCodePatterns),
107950
+ /* harmony export */ initializeDefaultPatterns: () => (/* binding */ initializeDefaultPatterns),
107951
+ /* harmony export */ initializeLineCodeCapacity: () => (/* binding */ initializeLineCodeCapacity),
107952
+ /* harmony export */ lineCodeFromLinePixels: () => (/* binding */ lineCodeFromLinePixels),
107953
+ /* harmony export */ lineCodeTextureCapacity: () => (/* binding */ lineCodeTextureCapacity),
107954
+ /* harmony export */ lineCodeTextureSize: () => (/* binding */ lineCodeTextureSize),
107955
+ /* harmony export */ onLineCodeAssigned: () => (/* binding */ onLineCodeAssigned),
107956
+ /* harmony export */ resetLineCodeState: () => (/* binding */ resetLineCodeState)
107948
107957
  /* harmony export */ });
107949
- /* harmony import */ var _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @itwin/core-common */ "../../core/common/lib/esm/core-common.js");
107958
+ /* harmony import */ var _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @itwin/core-bentley */ "../../core/bentley/lib/esm/core-bentley.js");
107959
+ /* harmony import */ var _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @itwin/core-common */ "../../core/common/lib/esm/core-common.js");
107950
107960
  /*---------------------------------------------------------------------------------------------
107951
107961
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
107952
107962
  * See LICENSE.md in the project root for license terms and full copyright notice.
@@ -107955,24 +107965,108 @@ __webpack_require__.r(__webpack_exports__);
107955
107965
  * @module WebGL
107956
107966
  */
107957
107967
 
107958
- /** Map a LinePixels value to an integer in [0..9] that can be used by shaders to index into the corresponding pixel pattern.
107959
- * This is used for feature overrides, including those defined by InstancedGraphicParams.
107968
+
107969
+ const textureSize = 32;
107970
+ // Initial capacity - will be updated to System.maxTextureSize in initializeLineCodeCapacity().
107971
+ // This value is used only for tests that don't initialize the full System.
107972
+ let maxLineCodeSlots = 16384;
107973
+ const patternToCode = new Map();
107974
+ const patterns = [];
107975
+ const assignmentEvent = new _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.BeEvent();
107976
+ let defaultPatternsInitialized = false;
107977
+ /** Initialize the maximum line code slots based on System's maxTextureSize.
107978
+ * Must be called before initializeDefaultPatterns().
107979
+ * @internal
107960
107980
  */
107961
- function lineCodeFromLinePixels(pixels) {
107981
+ function initializeLineCodeCapacity(maxTexSize) {
107982
+ // Cap at the smaller of maxTextureSize or theoretical maximum (65,536)
107983
+ maxLineCodeSlots = Math.min(maxTexSize, 65536);
107984
+ }
107985
+ const defaultPatterns = [
107986
+ _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__.LinePixels.Solid,
107987
+ _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__.LinePixels.Code1,
107988
+ _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__.LinePixels.Code2,
107989
+ _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__.LinePixels.Code3,
107990
+ _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__.LinePixels.Code4,
107991
+ _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__.LinePixels.Code5,
107992
+ _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__.LinePixels.Code6,
107993
+ _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__.LinePixels.Code7,
107994
+ _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__.LinePixels.HiddenLine,
107995
+ _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__.LinePixels.Invisible,
107996
+ ];
107997
+ function normalizePatternValue(pixels) {
107962
107998
  switch (pixels) {
107963
- case _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.LinePixels.Code0: return 0;
107964
- case _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.LinePixels.Code1: return 1;
107965
- case _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.LinePixels.Code2: return 2;
107966
- case _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.LinePixels.Code3: return 3;
107967
- case _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.LinePixels.Code4: return 4;
107968
- case _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.LinePixels.Code5: return 5;
107969
- case _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.LinePixels.Code6: return 6;
107970
- case _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.LinePixels.Code7: return 7;
107971
- case _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.LinePixels.HiddenLine: return 8;
107972
- case _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.LinePixels.Invisible: return 9;
107973
- default: return 0;
107999
+ case _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__.LinePixels.Invalid:
108000
+ return normalizePatternValue(_itwin_core_common__WEBPACK_IMPORTED_MODULE_1__.LinePixels.Solid);
108001
+ case _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__.LinePixels.Solid:
108002
+ case _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__.LinePixels.Code0:
108003
+ return 0xffffffff;
108004
+ default:
108005
+ return pixels >>> 0;
107974
108006
  }
107975
108007
  }
108008
+ function assignCodeForPattern(pattern) {
108009
+ const normalized = pattern >>> 0;
108010
+ const existing = patternToCode.get(normalized);
108011
+ if (undefined !== existing)
108012
+ return existing;
108013
+ if (patterns.length >= maxLineCodeSlots) {
108014
+ // Exceeded maximum supported line patterns
108015
+ return 0;
108016
+ }
108017
+ const code = patterns.length;
108018
+ patterns.push(normalized);
108019
+ patternToCode.set(normalized, code);
108020
+ assignmentEvent.raiseEvent({ code, pattern: normalized });
108021
+ return code;
108022
+ }
108023
+ /** Initialize default line patterns. Called when System is ready.
108024
+ * @internal
108025
+ */
108026
+ function initializeDefaultPatterns() {
108027
+ if (defaultPatternsInitialized)
108028
+ return;
108029
+ defaultPatternsInitialized = true;
108030
+ for (const pattern of defaultPatterns) {
108031
+ const normalized = normalizePatternValue(pattern);
108032
+ if (undefined !== normalized)
108033
+ assignCodeForPattern(normalized);
108034
+ }
108035
+ }
108036
+ /** Reset initialization state - used when System reinitializes.
108037
+ * @internal
108038
+ */
108039
+ function resetLineCodeState() {
108040
+ patternToCode.clear();
108041
+ patterns.length = 0;
108042
+ defaultPatternsInitialized = false;
108043
+ }
108044
+ /** Map a LinePixels value to a texture row index that identifies the corresponding pattern. */
108045
+ function lineCodeFromLinePixels(pixels) {
108046
+ // Ensure default patterns are initialized (for tests that don't call System.onInitialized)
108047
+ initializeDefaultPatterns();
108048
+ const normalized = normalizePatternValue(pixels);
108049
+ if (undefined === normalized)
108050
+ return 0;
108051
+ return assignCodeForPattern(normalized);
108052
+ }
108053
+ /** @internal */
108054
+ function onLineCodeAssigned(listener) {
108055
+ assignmentEvent.addListener(listener);
108056
+ return () => assignmentEvent.removeListener(listener);
108057
+ }
108058
+ /** @internal */
108059
+ function getLineCodePatterns() {
108060
+ return patterns;
108061
+ }
108062
+ /** @internal */
108063
+ const lineCodeTextureSize = textureSize;
108064
+ /** Get the current capacity of the line code texture.
108065
+ * @internal
108066
+ */
108067
+ function lineCodeTextureCapacity() {
108068
+ return maxLineCodeSlots;
108069
+ }
107976
108070
 
107977
108071
 
107978
108072
  /***/ }),
@@ -108627,6 +108721,7 @@ function createPolylineArgs(mesh) {
108627
108721
  points: mesh.points,
108628
108722
  colors,
108629
108723
  features,
108724
+ cumulativeDistances: mesh.cumulativeDistances,
108630
108725
  };
108631
108726
  }
108632
108727
  /** The vertices of the edges are shared with those of the surface. */
@@ -108691,6 +108786,7 @@ class Mesh {
108691
108786
  uvParams = [];
108692
108787
  colorMap = new _ColorMap__WEBPACK_IMPORTED_MODULE_3__.ColorMap(); // used to be called ColorTable
108693
108788
  colors = [];
108789
+ cumulativeDistances;
108694
108790
  edges;
108695
108791
  features;
108696
108792
  type;
@@ -109183,6 +109279,7 @@ function createPolylineParams(args, maxDimension) {
109183
109279
  type: args.flags.type ?? _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.PolylineTypeFlags.Normal,
109184
109280
  weight: args.width,
109185
109281
  linePixels: args.linePixels,
109282
+ hasCumulativeDistances: (args.cumulativeDistances?.length ?? 0) > 0,
109186
109283
  };
109187
109284
  }
109188
109285
  /** @internal */
@@ -109742,6 +109839,50 @@ __webpack_require__.r(__webpack_exports__);
109742
109839
 
109743
109840
 
109744
109841
 
109842
+ const scratchU32 = new Uint32Array(1);
109843
+ const scratchF32 = new Float32Array(scratchU32.buffer);
109844
+ function floatToUint32(val) {
109845
+ scratchF32[0] = val;
109846
+ return scratchU32[0];
109847
+ }
109848
+ function computePolylineCumulativeDistances(args) {
109849
+ if (args.cumulativeDistances !== undefined)
109850
+ return args.cumulativeDistances;
109851
+ const positions = [];
109852
+ if (args.points instanceof _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.QPoint3dList) {
109853
+ positions.length = args.points.length;
109854
+ for (let i = 0; i < args.points.length; i++)
109855
+ positions[i] = args.points.list[i].unquantize(args.points.params);
109856
+ }
109857
+ else {
109858
+ positions.length = args.points.length;
109859
+ for (let i = 0; i < args.points.length; i++)
109860
+ positions[i] = args.points[i];
109861
+ }
109862
+ const cumulativeDistances = new Float32Array(positions.length);
109863
+ cumulativeDistances.fill(Number.NaN);
109864
+ for (const line of args.polylines) {
109865
+ if (line.length < 2)
109866
+ continue;
109867
+ let dist = 0.0;
109868
+ for (let i = 0; i < line.length; i++) {
109869
+ const idx = line[i];
109870
+ if (i > 0) {
109871
+ const p0 = positions[line[i - 1]];
109872
+ const p1 = positions[idx];
109873
+ dist += p0.distance(p1);
109874
+ }
109875
+ // Preserve the first assignment if a vertex is shared across lines.
109876
+ if (Number.isNaN(cumulativeDistances[idx]))
109877
+ cumulativeDistances[idx] = dist;
109878
+ }
109879
+ }
109880
+ for (let i = 0; i < cumulativeDistances.length; i++) {
109881
+ if (Number.isNaN(cumulativeDistances[i]))
109882
+ cumulativeDistances[i] = 0.0;
109883
+ }
109884
+ return cumulativeDistances;
109885
+ }
109745
109886
  /** @internal */
109746
109887
  function createMeshParams(args, maxDimension, enableIndexedEdges) {
109747
109888
  const builder = createMeshBuilder(args);
@@ -109912,6 +110053,23 @@ var Quantized;
109912
110053
  }
109913
110054
  }
109914
110055
  Quantized.SimpleBuilder = SimpleBuilder;
110056
+ class PolylineBuilder extends SimpleBuilder {
110057
+ _cumDist;
110058
+ constructor(args) {
110059
+ super(args);
110060
+ this._cumDist = computePolylineCumulativeDistances(args);
110061
+ }
110062
+ get numRgbaPerVertex() { return 4; }
110063
+ appendVertex(vertIndex) {
110064
+ super.appendVertex(vertIndex);
110065
+ this.appendCumulativeDistance(vertIndex);
110066
+ }
110067
+ appendCumulativeDistance(vertIndex) {
110068
+ const dist = vertIndex < this._cumDist.length ? this._cumDist[vertIndex] : 0.0;
110069
+ this.append32(floatToUint32(dist));
110070
+ }
110071
+ }
110072
+ Quantized.PolylineBuilder = PolylineBuilder;
109915
110073
  /** Supplies vertex data from a MeshArgs. */
109916
110074
  class MeshBuilder extends SimpleBuilder {
109917
110075
  type;
@@ -110090,6 +110248,23 @@ var Unquantized;
110090
110248
  }
110091
110249
  }
110092
110250
  Unquantized.SimpleBuilder = SimpleBuilder;
110251
+ class PolylineBuilder extends SimpleBuilder {
110252
+ _cumDist;
110253
+ constructor(args) {
110254
+ super(args);
110255
+ this._cumDist = computePolylineCumulativeDistances(args);
110256
+ }
110257
+ get numRgbaPerVertex() { return 6; }
110258
+ appendVertex(vertIndex) {
110259
+ super.appendVertex(vertIndex);
110260
+ this.appendCumulativeDistance(vertIndex);
110261
+ }
110262
+ appendCumulativeDistance(vertIndex) {
110263
+ const dist = vertIndex < this._cumDist.length ? this._cumDist[vertIndex] : 0.0;
110264
+ this.append32(floatToUint32(dist));
110265
+ }
110266
+ }
110267
+ Unquantized.PolylineBuilder = PolylineBuilder;
110093
110268
  class MeshBuilder extends SimpleBuilder {
110094
110269
  type;
110095
110270
  constructor(args, type) {
@@ -110180,10 +110355,15 @@ function createMeshBuilder(args) {
110180
110355
  return Unquantized.MeshBuilder.create(args);
110181
110356
  }
110182
110357
  function createPolylineBuilder(args) {
110183
- if (args.points instanceof _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.QPoint3dList)
110184
- return new Quantized.SimpleBuilder(args);
110185
- else
110186
- return new Unquantized.SimpleBuilder(args);
110358
+ const quantized = args.points instanceof _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.QPoint3dList;
110359
+ if (args.flags.isDisjoint) {
110360
+ return quantized
110361
+ ? new Quantized.SimpleBuilder(args)
110362
+ : new Unquantized.SimpleBuilder(args);
110363
+ }
110364
+ return quantized
110365
+ ? new Quantized.PolylineBuilder(args)
110366
+ : new Unquantized.PolylineBuilder(args);
110187
110367
  }
110188
110368
 
110189
110369
 
@@ -117565,6 +117745,7 @@ class CachedGeometry {
117565
117745
  get viewIndependentOrigin() { return undefined; }
117566
117746
  get isViewIndependent() { return undefined !== this.viewIndependentOrigin; }
117567
117747
  get supportsThematicDisplay() { return false; }
117748
+ get hasCumulativeDistances() { return false; }
117568
117749
  get isEdge() {
117569
117750
  switch (this.renderOrder) {
117570
117751
  case 6 /* RenderOrder.Edge */:
@@ -123301,7 +123482,8 @@ __webpack_require__.r(__webpack_exports__);
123301
123482
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
123302
123483
  /* harmony export */ LineCode: () => (/* binding */ LineCode)
123303
123484
  /* harmony export */ });
123304
- /* harmony import */ var _common_internal_render_LineCode__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../common/internal/render/LineCode */ "../../core/frontend/lib/esm/common/internal/render/LineCode.js");
123485
+ /* harmony import */ var _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @itwin/core-bentley */ "../../core/bentley/lib/esm/core-bentley.js");
123486
+ /* harmony import */ var _common_internal_render_LineCode__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../common/internal/render/LineCode */ "../../core/frontend/lib/esm/common/internal/render/LineCode.js");
123305
123487
  /*---------------------------------------------------------------------------------------------
123306
123488
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
123307
123489
  * See LICENSE.md in the project root for license terms and full copyright notice.
@@ -123310,38 +123492,71 @@ __webpack_require__.r(__webpack_exports__);
123310
123492
  * @module WebGL
123311
123493
  */
123312
123494
 
123495
+
123313
123496
  /** Describes one of the pre-defined line patterns. See Render.LinePixels.
123314
123497
  * @internal
123315
123498
  */
123316
123499
  var LineCode;
123317
123500
  (function (LineCode) {
123318
123501
  function valueFromLinePixels(pixels) {
123319
- return (0,_common_internal_render_LineCode__WEBPACK_IMPORTED_MODULE_0__.lineCodeFromLinePixels)(pixels);
123502
+ return (0,_common_internal_render_LineCode__WEBPACK_IMPORTED_MODULE_1__.lineCodeFromLinePixels)(pixels);
123320
123503
  }
123321
123504
  LineCode.valueFromLinePixels = valueFromLinePixels;
123505
+ function initializeCapacity(maxTexSize) {
123506
+ (0,_common_internal_render_LineCode__WEBPACK_IMPORTED_MODULE_1__.initializeLineCodeCapacity)(maxTexSize);
123507
+ // Recreate texture data array with the new capacity
123508
+ textureData = new Uint8Array(LineCode.size * capacity());
123509
+ // Reset and reassign default patterns with new capacity
123510
+ isInitializing = true;
123511
+ (0,_common_internal_render_LineCode__WEBPACK_IMPORTED_MODULE_1__.resetLineCodeState)();
123512
+ (0,_common_internal_render_LineCode__WEBPACK_IMPORTED_MODULE_1__.initializeDefaultPatterns)();
123513
+ isInitializing = false;
123514
+ }
123515
+ LineCode.initializeCapacity = initializeCapacity;
123322
123516
  LineCode.solid = 0;
123323
- LineCode.count = 16; // only 10 line codes, but pad to 16 to make height a power of two.
123324
- LineCode.size = 32;
123325
- // NB: Non-power-of-two textures in WebGL only support clamp-to-edge.
123326
- // Make this a power of two so we can use repeat.
123327
- LineCode.lineCodeData = [
123328
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
123329
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
123330
- 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff,
123331
- 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
123332
- 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
123333
- 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff,
123334
- 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff,
123335
- 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
123336
- 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff,
123337
- 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
123338
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
123339
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
123340
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
123341
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
123342
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
123343
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
123344
- ];
123517
+ LineCode.size = _common_internal_render_LineCode__WEBPACK_IMPORTED_MODULE_1__.lineCodeTextureSize;
123518
+ function capacity() {
123519
+ return (0,_common_internal_render_LineCode__WEBPACK_IMPORTED_MODULE_1__.lineCodeTextureCapacity)();
123520
+ }
123521
+ LineCode.capacity = capacity;
123522
+ let textureData;
123523
+ const textureUpdated = new _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.BeEvent();
123524
+ // Initialize with default capacity for tests that don't create a full System
123525
+ function ensureTextureData() {
123526
+ if (undefined === textureData) {
123527
+ textureData = new Uint8Array(LineCode.size * capacity());
123528
+ (0,_common_internal_render_LineCode__WEBPACK_IMPORTED_MODULE_1__.initializeDefaultPatterns)();
123529
+ }
123530
+ }
123531
+ function writeRow(code, pattern) {
123532
+ ensureTextureData();
123533
+ if (code < 0 || code >= capacity())
123534
+ return;
123535
+ const offset = code * LineCode.size;
123536
+ for (let i = 0; i < LineCode.size; i++) {
123537
+ const bit = (pattern >>> i) & 0x1;
123538
+ const data = textureData;
123539
+ if (data)
123540
+ data[offset + i] = bit ? 0xff : 0x00;
123541
+ }
123542
+ }
123543
+ let isInitializing = false;
123544
+ (0,_common_internal_render_LineCode__WEBPACK_IMPORTED_MODULE_1__.onLineCodeAssigned)((args) => {
123545
+ writeRow(args.code, args.pattern);
123546
+ if (!isInitializing)
123547
+ textureUpdated.raiseEvent();
123548
+ });
123549
+ function getTextureData() {
123550
+ ensureTextureData();
123551
+ // textureData is guaranteed to be defined after ensureTextureData()
123552
+ return textureData ?? new Uint8Array(0);
123553
+ }
123554
+ LineCode.getTextureData = getTextureData;
123555
+ function onTextureUpdated(listener) {
123556
+ textureUpdated.addListener(listener);
123557
+ return () => textureUpdated.removeListener(listener);
123558
+ }
123559
+ LineCode.onTextureUpdated = onTextureUpdated;
123345
123560
  })(LineCode || (LineCode = {}));
123346
123561
 
123347
123562
 
@@ -125692,6 +125907,7 @@ class PolylineGeometry extends _CachedGeometry__WEBPACK_IMPORTED_MODULE_3__.LUTG
125692
125907
  lut;
125693
125908
  numIndices;
125694
125909
  _buffers;
125910
+ _hasCumulativeDistances;
125695
125911
  get lutBuffers() { return this._buffers.buffers; }
125696
125912
  constructor(lut, buffers, params, viOrigin) {
125697
125913
  super(viOrigin);
@@ -125705,6 +125921,7 @@ class PolylineGeometry extends _CachedGeometry__WEBPACK_IMPORTED_MODULE_3__.LUTG
125705
125921
  this.lut = lut;
125706
125922
  this.numIndices = params.polyline.indices.length;
125707
125923
  this._buffers = buffers;
125924
+ this._hasCumulativeDistances = params.hasCumulativeDistances;
125708
125925
  }
125709
125926
  get isDisposed() { return this._buffers.isDisposed && this.lut.isDisposed; }
125710
125927
  [Symbol.dispose]() {
@@ -125755,6 +125972,7 @@ class PolylineGeometry extends _CachedGeometry__WEBPACK_IMPORTED_MODULE_3__.LUTG
125755
125972
  get qScale() { return this.lut.qScale; }
125756
125973
  get numRgbaPerVertex() { return this.lut.numRgbaPerVertex; }
125757
125974
  get hasFeatures() { return this._hasFeatures; }
125975
+ get hasCumulativeDistances() { return this._hasCumulativeDistances; }
125758
125976
  _getLineWeight(params) {
125759
125977
  return this.isEdge ? params.target.computeEdgeWeight(params.renderPass, this.lineWeight) : this.lineWeight;
125760
125978
  }
@@ -132933,6 +133151,7 @@ class System extends _render_RenderSystem__WEBPACK_IMPORTED_MODULE_9__.RenderSys
132933
133151
  ];
132934
133152
  // The following are initialized immediately after the System is constructed.
132935
133153
  _lineCodeTexture;
133154
+ _lineCodeTextureListener;
132936
133155
  _noiseTexture;
132937
133156
  _techniques;
132938
133157
  _screenSpaceEffects;
@@ -133023,6 +133242,10 @@ class System extends _render_RenderSystem__WEBPACK_IMPORTED_MODULE_9__.RenderSys
133023
133242
  this._techniques = (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.dispose)(this._techniques);
133024
133243
  this._screenSpaceEffects = (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.dispose)(this._screenSpaceEffects);
133025
133244
  this._lineCodeTexture = (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.dispose)(this._lineCodeTexture);
133245
+ if (this._lineCodeTextureListener) {
133246
+ this._lineCodeTextureListener();
133247
+ this._lineCodeTextureListener = undefined;
133248
+ }
133026
133249
  this._noiseTexture = (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.dispose)(this._noiseTexture);
133027
133250
  // We must attempt to dispose of each idmap in the resourceCache (if idmap is already disposed, has no effect)
133028
133251
  this.resourceCache.forEach((idMap) => {
@@ -133034,14 +133257,23 @@ class System extends _render_RenderSystem__WEBPACK_IMPORTED_MODULE_9__.RenderSys
133034
133257
  this._removeEventListener = undefined;
133035
133258
  }
133036
133259
  }
133260
+ reloadLineCodeTexture() {
133261
+ if (!this._lineCodeTexture)
133262
+ return;
133263
+ const params = _Texture__WEBPACK_IMPORTED_MODULE_36__.Texture2DCreateParams.createForData(_LineCode__WEBPACK_IMPORTED_MODULE_21__.LineCode.size, _LineCode__WEBPACK_IMPORTED_MODULE_21__.LineCode.capacity(), _LineCode__WEBPACK_IMPORTED_MODULE_21__.LineCode.getTextureData(), true, _GL__WEBPACK_IMPORTED_MODULE_16__.GL.Texture.WrapMode.Repeat, _GL__WEBPACK_IMPORTED_MODULE_16__.GL.Texture.Format.Luminance);
133264
+ this._lineCodeTexture.reload(params);
133265
+ }
133037
133266
  onInitialized() {
133267
+ // Initialize LineCode capacity BEFORE creating techniques (which compile shaders that use the capacity)
133268
+ _LineCode__WEBPACK_IMPORTED_MODULE_21__.LineCode.initializeCapacity(this.maxTextureSize);
133038
133269
  this._techniques = _Technique__WEBPACK_IMPORTED_MODULE_35__.Techniques.create(this.context);
133039
133270
  const noiseDim = 4;
133040
133271
  const noiseArr = new Uint8Array([152, 235, 94, 173, 219, 215, 115, 176, 73, 205, 43, 201, 10, 81, 205, 198]);
133041
133272
  this._noiseTexture = _Texture__WEBPACK_IMPORTED_MODULE_36__.TextureHandle.createForData(noiseDim, noiseDim, noiseArr, false, _GL__WEBPACK_IMPORTED_MODULE_16__.GL.Texture.WrapMode.Repeat, _GL__WEBPACK_IMPORTED_MODULE_16__.GL.Texture.Format.Luminance);
133042
133273
  (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.assert)(undefined !== this._noiseTexture, "System.noiseTexture not created.");
133043
- this._lineCodeTexture = _Texture__WEBPACK_IMPORTED_MODULE_36__.TextureHandle.createForData(_LineCode__WEBPACK_IMPORTED_MODULE_21__.LineCode.size, _LineCode__WEBPACK_IMPORTED_MODULE_21__.LineCode.count, new Uint8Array(_LineCode__WEBPACK_IMPORTED_MODULE_21__.LineCode.lineCodeData), false, _GL__WEBPACK_IMPORTED_MODULE_16__.GL.Texture.WrapMode.Repeat, _GL__WEBPACK_IMPORTED_MODULE_16__.GL.Texture.Format.Luminance);
133274
+ this._lineCodeTexture = _Texture__WEBPACK_IMPORTED_MODULE_36__.TextureHandle.createForData(_LineCode__WEBPACK_IMPORTED_MODULE_21__.LineCode.size, _LineCode__WEBPACK_IMPORTED_MODULE_21__.LineCode.capacity(), _LineCode__WEBPACK_IMPORTED_MODULE_21__.LineCode.getTextureData(), true, _GL__WEBPACK_IMPORTED_MODULE_16__.GL.Texture.WrapMode.Repeat, _GL__WEBPACK_IMPORTED_MODULE_16__.GL.Texture.Format.Luminance);
133044
133275
  (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.assert)(undefined !== this._lineCodeTexture, "System.lineCodeTexture not created.");
133276
+ this._lineCodeTextureListener = _LineCode__WEBPACK_IMPORTED_MODULE_21__.LineCode.onTextureUpdated(() => this.reloadLineCodeTexture());
133045
133277
  this._screenSpaceEffects = new _ScreenSpaceEffect__WEBPACK_IMPORTED_MODULE_33__.ScreenSpaceEffects();
133046
133278
  }
133047
133279
  createTarget(canvas) {
@@ -136284,6 +136516,7 @@ __webpack_require__.r(__webpack_exports__);
136284
136516
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
136285
136517
  /* harmony export */ ExternalTextureLoader: () => (/* binding */ ExternalTextureLoader),
136286
136518
  /* harmony export */ Texture: () => (/* binding */ Texture),
136519
+ /* harmony export */ Texture2DCreateParams: () => (/* binding */ Texture2DCreateParams),
136287
136520
  /* harmony export */ Texture2DDataUpdater: () => (/* binding */ Texture2DDataUpdater),
136288
136521
  /* harmony export */ Texture2DHandle: () => (/* binding */ Texture2DHandle),
136289
136522
  /* harmony export */ TextureCubeHandle: () => (/* binding */ TextureCubeHandle),
@@ -140940,7 +141173,7 @@ const computePosition = `
140940
141173
 
140941
141174
  return pos;
140942
141175
  `;
140943
- const lineCodeArgs = "g_windowDir, g_windowPos, 0.0";
141176
+ const lineCodeArgs = "g_windowDir, g_windowPos, 0.0, 0.0";
140944
141177
  const adjustContrast = `
140945
141178
  float bgi = u_bgIntensity;
140946
141179
  if (bgi < 0.0)
@@ -143277,14 +143510,15 @@ __webpack_require__.r(__webpack_exports__);
143277
143510
  /* harmony import */ var _RenderFlags__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../RenderFlags */ "../../core/frontend/lib/esm/internal/render/webgl/RenderFlags.js");
143278
143511
  /* harmony import */ var _ShaderBuilder__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../ShaderBuilder */ "../../core/frontend/lib/esm/internal/render/webgl/ShaderBuilder.js");
143279
143512
  /* harmony import */ var _System__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../System */ "../../core/frontend/lib/esm/internal/render/webgl/System.js");
143280
- /* harmony import */ var _Color__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Color */ "../../core/frontend/lib/esm/internal/render/webgl/glsl/Color.js");
143281
- /* harmony import */ var _Edge__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./Edge */ "../../core/frontend/lib/esm/internal/render/webgl/glsl/Edge.js");
143282
- /* harmony import */ var _Common__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./Common */ "../../core/frontend/lib/esm/internal/render/webgl/glsl/Common.js");
143283
- /* harmony import */ var _Decode__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./Decode */ "../../core/frontend/lib/esm/internal/render/webgl/glsl/Decode.js");
143284
- /* harmony import */ var _FeatureSymbology__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./FeatureSymbology */ "../../core/frontend/lib/esm/internal/render/webgl/glsl/FeatureSymbology.js");
143285
- /* harmony import */ var _Fragment__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./Fragment */ "../../core/frontend/lib/esm/internal/render/webgl/glsl/Fragment.js");
143286
- /* harmony import */ var _Vertex__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./Vertex */ "../../core/frontend/lib/esm/internal/render/webgl/glsl/Vertex.js");
143287
- /* harmony import */ var _Viewport__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./Viewport */ "../../core/frontend/lib/esm/internal/render/webgl/glsl/Viewport.js");
143513
+ /* harmony import */ var _LineCode__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../LineCode */ "../../core/frontend/lib/esm/internal/render/webgl/LineCode.js");
143514
+ /* harmony import */ var _Color__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./Color */ "../../core/frontend/lib/esm/internal/render/webgl/glsl/Color.js");
143515
+ /* harmony import */ var _Edge__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./Edge */ "../../core/frontend/lib/esm/internal/render/webgl/glsl/Edge.js");
143516
+ /* harmony import */ var _Common__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./Common */ "../../core/frontend/lib/esm/internal/render/webgl/glsl/Common.js");
143517
+ /* harmony import */ var _Decode__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./Decode */ "../../core/frontend/lib/esm/internal/render/webgl/glsl/Decode.js");
143518
+ /* harmony import */ var _FeatureSymbology__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./FeatureSymbology */ "../../core/frontend/lib/esm/internal/render/webgl/glsl/FeatureSymbology.js");
143519
+ /* harmony import */ var _Fragment__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./Fragment */ "../../core/frontend/lib/esm/internal/render/webgl/glsl/Fragment.js");
143520
+ /* harmony import */ var _Vertex__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./Vertex */ "../../core/frontend/lib/esm/internal/render/webgl/glsl/Vertex.js");
143521
+ /* harmony import */ var _Viewport__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./Viewport */ "../../core/frontend/lib/esm/internal/render/webgl/glsl/Viewport.js");
143288
143522
  /*---------------------------------------------------------------------------------------------
143289
143523
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
143290
143524
  * See LICENSE.md in the project root for license terms and full copyright notice.
@@ -143305,6 +143539,7 @@ __webpack_require__.r(__webpack_exports__);
143305
143539
 
143306
143540
 
143307
143541
 
143542
+
143308
143543
  const checkForDiscard = "return discardByLineCode;";
143309
143544
  const applyLineCode = `
143310
143545
  if (v_texc.x >= 0.0) { // v_texc = (-1,-1) for solid lines - don't bother with any of this
@@ -143327,7 +143562,7 @@ const applyLineCode = `
143327
143562
  return baseColor;
143328
143563
  `;
143329
143564
  const computeTextureCoord = `
143330
- vec2 computeLineCodeTextureCoords(vec2 windowDir, vec4 projPos, float adjust) {
143565
+ vec2 computeLineCodeTextureCoords(vec2 windowDir, vec4 projPos, float adjust, float patternDist) {
143331
143566
  vec2 texc;
143332
143567
  float lineCode = computeLineCode();
143333
143568
  if (0.0 == lineCode) {
@@ -143337,22 +143572,65 @@ vec2 computeLineCodeTextureCoords(vec2 windowDir, vec4 projPos, float adjust) {
143337
143572
  const float imagesPerPixel = 1.0/32.0;
143338
143573
  const float textureCoordinateBase = 8192.0; // Temp workardound for clipping problem in perspective views (negative values don't seem to interpolate correctly).
143339
143574
 
143340
- if (abs(windowDir.x) > abs(windowDir.y))
143341
- texc.x = textureCoordinateBase + imagesPerPixel * (projPos.x + adjust * windowDir.x);
143342
- else
143343
- texc.x = textureCoordinateBase + imagesPerPixel * (projPos.y + adjust * windowDir.y);
143575
+ float patternDistPixels;
143576
+ if (u_useCumDist > 0.5) {
143577
+ patternDistPixels = patternDist * u_pixelsPerWorld;
143578
+ } else {
143579
+ if (abs(windowDir.x) > abs(windowDir.y))
143580
+ patternDistPixels = projPos.x + adjust * windowDir.x;
143581
+ else
143582
+ patternDistPixels = projPos.y + adjust * windowDir.y;
143583
+ }
143584
+ texc.x = textureCoordinateBase + imagesPerPixel * patternDistPixels;
143344
143585
 
143345
- const float numLineCodes = 16.0; // NB: Actually only 10, but texture is 16px tall because it needs to be a power of 2.
143346
- const float rowsPerCode = 1.0;
143347
- const float numRows = numLineCodes*rowsPerCode;
143348
- const float centerY = 0.5/numRows;
143349
- const float stepY = rowsPerCode/numRows;
143586
+ // Use uniform to support dynamic capacity based on System.maxTextureSize
143587
+ float numRows = u_numLineCodes;
143588
+ float centerY = 0.5 / numRows;
143589
+ float stepY = 1.0 / numRows;
143350
143590
  texc.y = stepY * lineCode + centerY;
143351
143591
  }
143352
143592
 
143353
143593
  return texc;
143354
143594
  }
143355
143595
  `;
143596
+ function addPixelsPerWorldUniform(prog) {
143597
+ const addUniform = (shader) => {
143598
+ shader.addUniform("u_pixelsPerWorld", 2 /* VariableType.Float */, (prg) => {
143599
+ prg.addProgramUniform("u_pixelsPerWorld", (uniform, params) => {
143600
+ // Calculate pixels per world unit from viewport
143601
+ // For orthographic views this is constant and provides stable pattern scaling
143602
+ const vp = params.target.viewRect;
143603
+ // Default to 1.0 if we can't calculate (will use world units directly)
143604
+ let pixelsPerWorld = 1.0;
143605
+ // Get frustum planes: { top, bottom, left, right }
143606
+ const planes = params.target.uniforms.frustum.planes;
143607
+ const worldWidth = planes[3] - planes[2]; // right - left
143608
+ if (worldWidth > 0) {
143609
+ // worldWidth is the view width in world units
143610
+ pixelsPerWorld = vp.width / worldWidth;
143611
+ }
143612
+ uniform.setUniform1f(pixelsPerWorld);
143613
+ });
143614
+ });
143615
+ };
143616
+ addUniform(prog.vert);
143617
+ addUniform(prog.frag);
143618
+ }
143619
+ function addUseCumulativeDistanceUniform(prog) {
143620
+ prog.vert.addUniform("u_useCumDist", 2 /* VariableType.Float */, (prg) => {
143621
+ prg.addGraphicUniform("u_useCumDist", (uniform, params) => {
143622
+ uniform.setUniform1f(params.geometry.hasCumulativeDistances ? 1.0 : 0.0);
143623
+ });
143624
+ });
143625
+ }
143626
+ function addNumLineCodesUniform(prog) {
143627
+ prog.vert.addUniform("u_numLineCodes", 2 /* VariableType.Float */, (prg) => {
143628
+ prg.addProgramUniform("u_numLineCodes", (uniform, _params) => {
143629
+ // Pass the current LineCode capacity to the shader
143630
+ uniform.setUniform1f(_LineCode__WEBPACK_IMPORTED_MODULE_5__.LineCode.capacity());
143631
+ });
143632
+ });
143633
+ }
143356
143634
  /** @internal */
143357
143635
  const adjustWidth = `
143358
143636
  void adjustWidth(inout float width, vec2 d2, vec2 org) {
@@ -143434,10 +143712,13 @@ function addLineCodeTexture(frag) {
143434
143712
  function addLineCode(prog, args) {
143435
143713
  const vert = prog.vert;
143436
143714
  const frag = prog.frag;
143437
- (0,_Vertex__WEBPACK_IMPORTED_MODULE_11__.addLineCode)(vert);
143715
+ (0,_Vertex__WEBPACK_IMPORTED_MODULE_12__.addLineCode)(vert);
143716
+ addPixelsPerWorldUniform(prog);
143717
+ addUseCumulativeDistanceUniform(prog);
143718
+ addNumLineCodesUniform(prog); // Add uniform for dynamic capacity
143438
143719
  const funcCall = `computeLineCodeTextureCoords(${args})`;
143439
143720
  prog.addFunctionComputedVaryingWithArgs("v_texc", 3 /* VariableType.Vec2 */, funcCall, computeTextureCoord);
143440
- (0,_Common__WEBPACK_IMPORTED_MODULE_7__.addFrustum)(prog);
143721
+ (0,_Common__WEBPACK_IMPORTED_MODULE_8__.addFrustum)(prog);
143441
143722
  addLineCodeTexture(prog.frag);
143442
143723
  frag.set(3 /* FragmentShaderComponent.FinalizeBaseColor */, applyLineCode);
143443
143724
  frag.set(4 /* FragmentShaderComponent.CheckForDiscard */, checkForDiscard);
@@ -143445,28 +143726,30 @@ function addLineCode(prog, args) {
143445
143726
  }
143446
143727
  function polylineAddLineCode(prog) {
143447
143728
  addLineCode(prog, lineCodeArgs);
143448
- (0,_Vertex__WEBPACK_IMPORTED_MODULE_11__.addModelViewMatrix)(prog.vert);
143729
+ (0,_Vertex__WEBPACK_IMPORTED_MODULE_12__.addModelViewMatrix)(prog.vert);
143449
143730
  }
143450
143731
  function addCommon(prog) {
143451
143732
  const vert = prog.vert;
143452
- (0,_Viewport__WEBPACK_IMPORTED_MODULE_12__.addModelToWindowCoordinates)(vert); // adds u_mvp, u_viewportTransformation
143453
- (0,_Vertex__WEBPACK_IMPORTED_MODULE_11__.addProjectionMatrix)(vert);
143454
- (0,_Vertex__WEBPACK_IMPORTED_MODULE_11__.addModelViewMatrix)(vert);
143455
- (0,_Viewport__WEBPACK_IMPORTED_MODULE_12__.addViewport)(vert);
143733
+ (0,_Viewport__WEBPACK_IMPORTED_MODULE_13__.addModelToWindowCoordinates)(vert); // adds u_mvp, u_viewportTransformation
143734
+ (0,_Vertex__WEBPACK_IMPORTED_MODULE_12__.addProjectionMatrix)(vert);
143735
+ (0,_Vertex__WEBPACK_IMPORTED_MODULE_12__.addModelViewMatrix)(vert);
143736
+ (0,_Viewport__WEBPACK_IMPORTED_MODULE_13__.addViewport)(vert);
143456
143737
  vert.addGlobal("g_windowPos", 5 /* VariableType.Vec4 */);
143457
143738
  vert.addGlobal("g_prevPos", 5 /* VariableType.Vec4 */);
143458
143739
  vert.addGlobal("g_nextPos", 5 /* VariableType.Vec4 */);
143459
143740
  vert.addGlobal("g_windowDir", 3 /* VariableType.Vec2 */);
143460
143741
  vert.addInitializer(decodeAdjacentPositions);
143461
- vert.addFunction(_Decode__WEBPACK_IMPORTED_MODULE_8__.unquantize2d);
143462
- (0,_Vertex__WEBPACK_IMPORTED_MODULE_11__.addLineWeight)(vert);
143742
+ vert.addFunction(_Decode__WEBPACK_IMPORTED_MODULE_9__.unquantize2d);
143743
+ (0,_Vertex__WEBPACK_IMPORTED_MODULE_12__.addLineWeight)(vert);
143463
143744
  vert.addGlobal("miterAdjust", 2 /* VariableType.Float */, "0.0");
143745
+ prog.addVarying("v_patternDistance", 2 /* VariableType.Float */);
143464
143746
  prog.addVarying("v_eyeSpace", 4 /* VariableType.Vec3 */);
143465
- vert.set(10 /* VertexShaderComponent.ComputePosition */, computePosition);
143747
+ vert.set(10 /* VertexShaderComponent.ComputePosition */, buildComputePosition(vert.positionType));
143466
143748
  prog.addVarying("v_lnInfo", 5 /* VariableType.Vec4 */);
143467
143749
  addAdjustWidth(vert);
143468
- (0,_Vertex__WEBPACK_IMPORTED_MODULE_11__.addSamplePosition)(vert);
143750
+ (0,_Vertex__WEBPACK_IMPORTED_MODULE_12__.addSamplePosition)(vert);
143469
143751
  vert.addFunction(decodePosition);
143752
+ vert.addFunction(decodeFloatFromBytes);
143470
143753
  }
143471
143754
  const decodePosition = `
143472
143755
  vec4 decodePosition(vec3 baseIndex) {
@@ -143478,7 +143761,18 @@ const decodeAdjacentPositions = `
143478
143761
  g_prevPos = decodePosition(a_prevIndex);
143479
143762
  g_nextPos = decodePosition(a_nextIndex);
143480
143763
  `;
143481
- const computePosition = `
143764
+ const decodeFloatFromBytes = `
143765
+ float decodeFloatFromBytes(vec4 bytes) {
143766
+ uvec4 b = uvec4(bytes);
143767
+ uint u = b.x | (b.y << 8) | (b.z << 16) | (b.w << 24);
143768
+ return uintBitsToFloat(u);
143769
+ }
143770
+ `;
143771
+ function buildComputePosition(positionType) {
143772
+ const cumDistExpr = positionType === "unquantized"
143773
+ ? "((u_vertParams.z > 5.0) ? decodeFloatFromBytes(g_vertLutData5) : 0.0)"
143774
+ : "((u_vertParams.z > 3.0) ? decodeFloatFromBytes(g_vertLutData3) : 0.0)";
143775
+ return `
143482
143776
  const float kNone = 0.0,
143483
143777
  kSquare = 1.0*3.0,
143484
143778
  kMiter = 2.0*3.0,
@@ -143503,9 +143797,11 @@ const computePosition = `
143503
143797
  if (param >= kNoneAdjWt)
143504
143798
  param -= kNoneAdjWt;
143505
143799
 
143800
+ bool isSegmentStart = true;
143506
143801
  if (param >= kNegateAlong) {
143507
143802
  directionScale = -directionScale;
143508
143803
  param -= kNegateAlong;
143804
+ isSegmentStart = false;
143509
143805
  }
143510
143806
 
143511
143807
  if (param >= kNegatePerp) {
@@ -143518,6 +143814,11 @@ const computePosition = `
143518
143814
  vec4 projNext = modelToWindowCoordinates(next, rawPos, otherPos, otherMvPos);
143519
143815
  g_windowDir = projNext.xy - g_windowPos.xy;
143520
143816
 
143817
+ if (u_useCumDist > 0.5)
143818
+ v_patternDistance = ${cumDistExpr};
143819
+ else
143820
+ v_patternDistance = 0.0;
143821
+
143521
143822
  if (param < kJointBase) {
143522
143823
  vec2 dir = (directionScale > 0.0) ? g_windowDir : -g_windowDir;
143523
143824
  vec2 pos = (directionScale > 0.0) ? g_windowPos.xy : projNext.xy;
@@ -143585,18 +143886,19 @@ const computePosition = `
143585
143886
 
143586
143887
  return pos;
143587
143888
  `;
143588
- const lineCodeArgs = "g_windowDir, g_windowPos, miterAdjust";
143889
+ }
143890
+ const lineCodeArgs = "g_windowDir, g_windowPos, miterAdjust, v_patternDistance";
143589
143891
  /** @internal */
143590
143892
  function createPolylineBuilder(isInstanced, positionType) {
143591
143893
  const instanced = 1 /* IsInstanced.Yes */ === isInstanced;
143592
143894
  const attrMap = _AttributeMap__WEBPACK_IMPORTED_MODULE_1__.AttributeMap.findAttributeMap(1 /* TechniqueId.Polyline */, instanced);
143593
143895
  const builder = new _ShaderBuilder__WEBPACK_IMPORTED_MODULE_3__.ProgramBuilder(attrMap, { positionType, instanced });
143594
- (0,_Common__WEBPACK_IMPORTED_MODULE_7__.addShaderFlags)(builder);
143896
+ (0,_Common__WEBPACK_IMPORTED_MODULE_8__.addShaderFlags)(builder);
143595
143897
  addCommon(builder);
143596
143898
  polylineAddLineCode(builder);
143597
- (0,_Color__WEBPACK_IMPORTED_MODULE_5__.addColor)(builder);
143598
- (0,_Edge__WEBPACK_IMPORTED_MODULE_6__.addEdgeContrast)(builder.vert);
143599
- (0,_Fragment__WEBPACK_IMPORTED_MODULE_10__.addWhiteOnWhiteReversal)(builder.frag);
143899
+ (0,_Color__WEBPACK_IMPORTED_MODULE_6__.addColor)(builder);
143900
+ (0,_Edge__WEBPACK_IMPORTED_MODULE_7__.addEdgeContrast)(builder.vert);
143901
+ (0,_Fragment__WEBPACK_IMPORTED_MODULE_11__.addWhiteOnWhiteReversal)(builder.frag);
143600
143902
  return builder;
143601
143903
  }
143602
143904
  /** @internal */
@@ -143605,8 +143907,9 @@ function createPolylineHiliter(isInstanced, positionType) {
143605
143907
  const attrMap = _AttributeMap__WEBPACK_IMPORTED_MODULE_1__.AttributeMap.findAttributeMap(1 /* TechniqueId.Polyline */, instanced);
143606
143908
  const builder = new _ShaderBuilder__WEBPACK_IMPORTED_MODULE_3__.ProgramBuilder(attrMap, { positionType, instanced });
143607
143909
  addCommon(builder);
143608
- (0,_Common__WEBPACK_IMPORTED_MODULE_7__.addFrustum)(builder);
143609
- (0,_FeatureSymbology__WEBPACK_IMPORTED_MODULE_9__.addHiliter)(builder, true);
143910
+ addUseCumulativeDistanceUniform(builder);
143911
+ (0,_Common__WEBPACK_IMPORTED_MODULE_8__.addFrustum)(builder);
143912
+ (0,_FeatureSymbology__WEBPACK_IMPORTED_MODULE_10__.addHiliter)(builder, true);
143610
143913
  return builder;
143611
143914
  }
143612
143915
 
@@ -148666,6 +148969,7 @@ function createPrimitiveGeometry(primitive, options, viOrigin) {
148666
148969
  indices: new _common_internal_render_VertexIndices__WEBPACK_IMPORTED_MODULE_6__.VertexIndices(primitive.params.polyline.indices),
148667
148970
  prevIndices: new _common_internal_render_VertexIndices__WEBPACK_IMPORTED_MODULE_6__.VertexIndices(primitive.params.polyline.prevIndices),
148668
148971
  },
148972
+ hasCumulativeDistances: primitive.params.hasCumulativeDistances,
148669
148973
  }, viOrigin);
148670
148974
  case "mesh": {
148671
148975
  const surf = primitive.params.surface;
@@ -157442,6 +157746,11 @@ class QuantityFormatter {
157442
157746
  * @internal
157443
157747
  */
157444
157748
  async onInitialized() {
157749
+ // Remove any existing listener before re-registering to avoid duplicates when called via setUnitsProvider.
157750
+ if (this._removeFormatsProviderListener) {
157751
+ this._removeFormatsProviderListener();
157752
+ this._removeFormatsProviderListener = undefined;
157753
+ }
157445
157754
  await this.initializeQuantityTypesRegistry();
157446
157755
  const initialKoQs = [["DefaultToolsUnits.LENGTH", "Units.M"], ["DefaultToolsUnits.ANGLE", "Units.RAD"], ["DefaultToolsUnits.AREA", "Units.SQ_M"], ["DefaultToolsUnits.VOLUME", "Units.CUB_M"], ["DefaultToolsUnits.LENGTH_COORDINATE", "Units.M"], ["CivilUnits.STATION", "Units.M"], ["CivilUnits.LENGTH", "Units.M"], ["AecUnits.LENGTH", "Units.M"]];
157447
157756
  for (const entry of initialKoQs) {
@@ -157510,7 +157819,11 @@ class QuantityFormatter {
157510
157819
  set unitsProvider(unitsProvider) {
157511
157820
  this.setUnitsProvider(unitsProvider); // eslint-disable-line @typescript-eslint/no-floating-promises
157512
157821
  }
157513
- /** async method to set a units provider and reload caches */
157822
+ /**
157823
+ * Async method to set a units provider and reload caches.
157824
+ * @note If the active primitive tool may be holding stale unit data, callers should follow this with
157825
+ * `IModelApp.toolAdmin.restartPrimitiveTool()` to allow the tool to reinitialize itself.
157826
+ */
157514
157827
  async setUnitsProvider(unitsProvider) {
157515
157828
  this._unitsProvider = unitsProvider;
157516
157829
  try {
@@ -157524,12 +157837,14 @@ class QuantityFormatter {
157524
157837
  await _IModelApp__WEBPACK_IMPORTED_MODULE_3__.IModelApp.quantityFormatter.resetToUseInternalUnitsProvider();
157525
157838
  return;
157526
157839
  }
157527
- // force default tool to start so any tool that may be using cached data will not be using bad data.
157528
- if (_IModelApp__WEBPACK_IMPORTED_MODULE_3__.IModelApp.toolAdmin)
157529
- await _IModelApp__WEBPACK_IMPORTED_MODULE_3__.IModelApp.toolAdmin.startDefaultTool();
157530
157840
  this.onUnitsProviderChanged.emit();
157531
157841
  }
157532
- /** Async call typically used after IModel is closed to reset UnitsProvider to default one that does not require an Units schema. */
157842
+ /**
157843
+ * Async call typically used after an iModel is closed to reset the UnitsProvider to the default one
157844
+ * that does not require a Units schema.
157845
+ * @note If the active primitive tool may be holding stale unit data, callers should follow this with
157846
+ * `IModelApp.toolAdmin.restartPrimitiveTool()` to allow the tool to reinitialize itself.
157847
+ */
157533
157848
  async resetToUseInternalUnitsProvider() {
157534
157849
  if (this._unitsProvider instanceof _BasicUnitsProvider__WEBPACK_IMPORTED_MODULE_4__.BasicUnitsProvider)
157535
157850
  return;
@@ -157899,7 +158214,7 @@ const DEFAULT_FORMATKEY_BY_UNIT_SYSTEM = [
157899
158214
  { type: getQuantityTypeKey(QuantityType.Coordinate), formatKey: "[units:length]meter2" },
157900
158215
  { type: getQuantityTypeKey(QuantityType.Stationing), formatKey: "[units:length]m-sta2" },
157901
158216
  { type: getQuantityTypeKey(QuantityType.LengthSurvey), formatKey: "[units:length]meter4" },
157902
- { type: getQuantityTypeKey(QuantityType.LengthEngineering), formatKey: "[units:length]millimeter3" },
158217
+ { type: getQuantityTypeKey(QuantityType.LengthEngineering), formatKey: "[units:length]meter4" },
157903
158218
  ],
157904
158219
  },
157905
158220
  {
@@ -157961,20 +158276,6 @@ const DEFAULT_FORMATPROPS = [
157961
158276
  type: "Decimal",
157962
158277
  },
157963
158278
  },
157964
- {
157965
- key: "[units:length]millimeter3",
157966
- description: "millimeters (labeled) 3 decimal places",
157967
- format: {
157968
- composite: {
157969
- includeZero: true,
157970
- spacer: "",
157971
- units: [{ label: "mm", name: "Units.MM" }],
157972
- },
157973
- formatTraits: ["keepSingleZero", "showUnitLabel"],
157974
- precision: 3,
157975
- type: "Decimal",
157976
- },
157977
- },
157978
158279
  {
157979
158280
  key: "[units:length]meter2",
157980
158281
  description: "meters (labeled) 2 decimal places",
@@ -161219,12 +161520,26 @@ class GltfMeshData {
161219
161520
  uvs;
161220
161521
  uvRange;
161221
161522
  indices;
161523
+ cumulativeDistances;
161222
161524
  type = "mesh";
161223
161525
  constructor(props) {
161224
161526
  this.primitive = props;
161225
161527
  }
161226
161528
  }
161227
161529
  const emptyDict = {};
161530
+ function linePixelsFromGltfPattern(pattern) {
161531
+ if (undefined === pattern)
161532
+ return undefined;
161533
+ const normalized = pattern >>> 0;
161534
+ if (0 === normalized)
161535
+ return undefined;
161536
+ if (normalized <= 0xffff) {
161537
+ const mask16 = normalized & 0xffff;
161538
+ const repeated = ((mask16 << 16) | mask16) >>> 0;
161539
+ return repeated;
161540
+ }
161541
+ return normalized;
161542
+ }
161228
161543
  function colorFromJson(values) {
161229
161544
  return _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.ColorDef.from(values[0] * 255, values[1] * 255, values[2] * 255, (1.0 - values[3]) * 255);
161230
161545
  }
@@ -161524,6 +161839,8 @@ class GltfReader {
161524
161839
  const pointCount = gltfMesh.points.length / 3;
161525
161840
  (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.assert)(mesh.points instanceof _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.QPoint3dList);
161526
161841
  mesh.points.fromTypedArray(gltfMesh.pointRange, gltfMesh.points);
161842
+ if (gltfMesh.cumulativeDistances)
161843
+ mesh.cumulativeDistances = gltfMesh.cumulativeDistances;
161527
161844
  if (mesh.triangles && gltfMesh.indices)
161528
161845
  mesh.triangles.addFromTypedArray(gltfMesh.indices);
161529
161846
  if (gltfMesh.uvs && gltfMesh.uvRange && gltfMesh.uvQParams) {
@@ -161966,7 +162283,69 @@ class GltfReader {
161966
162283
  return "BLEND" === material.alphaMode;
161967
162284
  }
161968
162285
  }
161969
- createDisplayParams(material, hasBakedLighting, isPointPrimitive = false) {
162286
+ getMaterialLineStyle(material) {
162287
+ const ext = material.extensions?.BENTLEY_materials_line_style;
162288
+ if (!ext)
162289
+ return undefined;
162290
+ let width = _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.JsonUtils.asInt(ext.width);
162291
+ if (undefined !== width)
162292
+ width = Math.max(1, width);
162293
+ const patternValue = _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.JsonUtils.asInt(ext.pattern);
162294
+ const linePixels = linePixelsFromGltfPattern(patternValue);
162295
+ if (undefined === width && undefined === linePixels)
162296
+ return undefined;
162297
+ return { width, linePixels };
162298
+ }
162299
+ readCumulativeDistances(mesh, primitive) {
162300
+ const positionView = this.getBufferView(primitive.attributes, "POSITION");
162301
+ const pointCount = positionView?.count ?? 0;
162302
+ const semantic = "BENTLEY_materials_line_style:CUMULATIVE_DISTANCE";
162303
+ const attrView = this.getBufferView(primitive.attributes, semantic);
162304
+ if (attrView) {
162305
+ if ("SCALAR" !== attrView.accessor.type || (0 !== pointCount && attrView.count !== pointCount)) {
162306
+ mesh.cumulativeDistances = new Float32Array(0);
162307
+ return;
162308
+ }
162309
+ if (_common_gltf_GltfSchema__WEBPACK_IMPORTED_MODULE_12__.GltfDataType.Float === attrView.type) {
162310
+ const data = attrView.toBufferData(_common_gltf_GltfSchema__WEBPACK_IMPORTED_MODULE_12__.GltfDataType.Float);
162311
+ if (!data || !(data.buffer instanceof Float32Array)) {
162312
+ mesh.cumulativeDistances = new Float32Array(0);
162313
+ return;
162314
+ }
162315
+ mesh.cumulativeDistances = data.buffer.subarray(0, data.count);
162316
+ return;
162317
+ }
162318
+ if (attrView.accessor.normalized) {
162319
+ const maxDistance = Array.isArray(attrView.accessor.max) && attrView.accessor.max.length > 0 ? attrView.accessor.max[0] : 1.0;
162320
+ const count = attrView.count;
162321
+ let data;
162322
+ let denom = 1;
162323
+ if (_common_gltf_GltfSchema__WEBPACK_IMPORTED_MODULE_12__.GltfDataType.UnsignedShort === attrView.type) {
162324
+ data = attrView.toBufferData(_common_gltf_GltfSchema__WEBPACK_IMPORTED_MODULE_12__.GltfDataType.UnsignedShort);
162325
+ denom = 65535;
162326
+ }
162327
+ else if (_common_gltf_GltfSchema__WEBPACK_IMPORTED_MODULE_12__.GltfDataType.UnsignedByte === attrView.type) {
162328
+ data = attrView.toBufferData(_common_gltf_GltfSchema__WEBPACK_IMPORTED_MODULE_12__.GltfDataType.UnsignedByte);
162329
+ denom = 255;
162330
+ }
162331
+ if (!data || !data.buffer) {
162332
+ mesh.cumulativeDistances = new Float32Array(0);
162333
+ return;
162334
+ }
162335
+ const out = new Float32Array(count);
162336
+ const scale = maxDistance / denom;
162337
+ const src = data.buffer;
162338
+ for (let i = 0; i < count; i++)
162339
+ out[i] = src[i] * scale;
162340
+ mesh.cumulativeDistances = out;
162341
+ return;
162342
+ }
162343
+ mesh.cumulativeDistances = new Float32Array(0);
162344
+ return;
162345
+ }
162346
+ mesh.cumulativeDistances = new Float32Array(0);
162347
+ }
162348
+ createDisplayParams(material, hasBakedLighting, isPointPrimitive = false, lineStyle) {
161970
162349
  let constantLodParamProps;
161971
162350
  let normalMapUseConstantLod = false;
161972
162351
  if (!(0,_common_gltf_GltfSchema__WEBPACK_IMPORTED_MODULE_12__.isGltf1Material)(material)) {
@@ -162012,13 +162391,14 @@ class GltfReader {
162012
162391
  // DisplayParams doesn't want a separate texture mapping if the material already has one.
162013
162392
  textureMapping = undefined;
162014
162393
  }
162015
- let width = 1;
162016
- if (isPointPrimitive && !(0,_common_gltf_GltfSchema__WEBPACK_IMPORTED_MODULE_12__.isGltf1Material)(material)) {
162394
+ const overrides = lineStyle ?? this.getMaterialLineStyle(material);
162395
+ let width = overrides?.width ?? 1;
162396
+ if (undefined === overrides?.width && isPointPrimitive && !(0,_common_gltf_GltfSchema__WEBPACK_IMPORTED_MODULE_12__.isGltf1Material)(material)) {
162017
162397
  const pointStyle = material.extensions?.BENTLEY_materials_point_style;
162018
- if (pointStyle && pointStyle.diameter > 0 && Math.floor(pointStyle.diameter) === pointStyle.diameter) {
162398
+ if (pointStyle?.diameter && pointStyle.diameter > 0 && Math.floor(pointStyle.diameter) === pointStyle.diameter)
162019
162399
  width = pointStyle.diameter;
162020
- }
162021
162400
  }
162401
+ const linePixels = overrides?.linePixels ?? _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.LinePixels.Solid;
162022
162402
  // Process BENTLEY_materials_planar_fill extension
162023
162403
  let fillFlags = _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.FillFlags.None;
162024
162404
  if (!(0,_common_gltf_GltfSchema__WEBPACK_IMPORTED_MODULE_12__.isGltf1Material)(material)) {
@@ -162042,7 +162422,7 @@ class GltfReader {
162042
162422
  }
162043
162423
  }
162044
162424
  }
162045
- return new _common_internal_render_DisplayParams__WEBPACK_IMPORTED_MODULE_8__.DisplayParams(_common_internal_render_DisplayParams__WEBPACK_IMPORTED_MODULE_8__.DisplayParams.Type.Mesh, color, color, width, _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.LinePixels.Solid, fillFlags, renderMaterial, undefined, hasBakedLighting, textureMapping);
162425
+ return new _common_internal_render_DisplayParams__WEBPACK_IMPORTED_MODULE_8__.DisplayParams(_common_internal_render_DisplayParams__WEBPACK_IMPORTED_MODULE_8__.DisplayParams.Type.Mesh, color, color, width, linePixels, fillFlags, renderMaterial, undefined, hasBakedLighting, textureMapping);
162046
162426
  }
162047
162427
  readMeshPrimitives(node, featureTable, thisTransform, thisBias, instances) {
162048
162428
  const meshes = [];
@@ -162088,7 +162468,7 @@ class GltfReader {
162088
162468
  }
162089
162469
  readMeshPrimitive(primitive, featureTable, pseudoRtcBias) {
162090
162470
  const meshMode = _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.JsonUtils.asInt(primitive.mode, _common_gltf_GltfSchema__WEBPACK_IMPORTED_MODULE_12__.GltfMeshMode.Triangles);
162091
- if (meshMode === _common_gltf_GltfSchema__WEBPACK_IMPORTED_MODULE_12__.GltfMeshMode.Points /* && !this._vertexTableRequired */) {
162471
+ if (meshMode === _common_gltf_GltfSchema__WEBPACK_IMPORTED_MODULE_12__.GltfMeshMode.Points && !this._vertexTableRequired) {
162092
162472
  const pointCloud = this.readPointCloud2(primitive, undefined !== featureTable);
162093
162473
  if (pointCloud)
162094
162474
  return pointCloud;
@@ -162097,6 +162477,7 @@ class GltfReader {
162097
162477
  const material = 0 < materialName.length ? this._materials[materialName] : {};
162098
162478
  if (!material)
162099
162479
  return undefined;
162480
+ const hasBakedLighting = undefined === primitive.attributes.NORMAL || undefined !== material.extensions?.KHR_materials_unlit;
162100
162481
  let primitiveType = -1;
162101
162482
  switch (meshMode) {
162102
162483
  case _common_gltf_GltfSchema__WEBPACK_IMPORTED_MODULE_12__.GltfMeshMode.Lines:
@@ -162112,8 +162493,10 @@ class GltfReader {
162112
162493
  default:
162113
162494
  return undefined;
162114
162495
  }
162115
- const hasBakedLighting = undefined === primitive.attributes.NORMAL || undefined !== material.extensions?.KHR_materials_unlit;
162116
- const displayParams = material ? this.createDisplayParams(material, hasBakedLighting, _common_internal_render_MeshPrimitive__WEBPACK_IMPORTED_MODULE_11__.MeshPrimitiveType.Point === primitiveType) : undefined;
162496
+ // Only extract line style for line primitives or meshes with edges
162497
+ const hasEdges = primitive.extensions?.EXT_mesh_primitive_edge_visibility || primitive.extensions?.CESIUM_primitive_outline;
162498
+ const lineStyle = (primitiveType === _common_internal_render_MeshPrimitive__WEBPACK_IMPORTED_MODULE_11__.MeshPrimitiveType.Polyline || hasEdges) ? this.getMaterialLineStyle(material) : undefined;
162499
+ const displayParams = this.createDisplayParams(material, hasBakedLighting, primitiveType === _common_internal_render_MeshPrimitive__WEBPACK_IMPORTED_MODULE_11__.MeshPrimitiveType.Point, lineStyle);
162117
162500
  if (!displayParams)
162118
162501
  return undefined;
162119
162502
  const isVolumeClassifier = this._isVolumeClassifier;
@@ -162187,6 +162570,7 @@ class GltfReader {
162187
162570
  case _common_internal_render_MeshPrimitive__WEBPACK_IMPORTED_MODULE_11__.MeshPrimitiveType.Polyline:
162188
162571
  case _common_internal_render_MeshPrimitive__WEBPACK_IMPORTED_MODULE_11__.MeshPrimitiveType.Point: {
162189
162572
  (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.assert)(meshMode === _common_gltf_GltfSchema__WEBPACK_IMPORTED_MODULE_12__.GltfMeshMode.Points || meshMode === _common_gltf_GltfSchema__WEBPACK_IMPORTED_MODULE_12__.GltfMeshMode.Lines || meshMode === _common_gltf_GltfSchema__WEBPACK_IMPORTED_MODULE_12__.GltfMeshMode.LineStrip);
162573
+ this.readCumulativeDistances(mesh, primitive);
162190
162574
  if (undefined !== mesh.primitive.polylines && !this.readPolylines(mesh.primitive.polylines, primitive, "indices", meshMode))
162191
162575
  return undefined;
162192
162576
  break;
@@ -162270,11 +162654,18 @@ class GltfReader {
162270
162654
  }
162271
162655
  getEdgeAppearance(materialId) {
162272
162656
  const material = undefined !== materialId ? this._materials[materialId] : undefined;
162273
- const displayParams = material ? this.createDisplayParams(material, false) : undefined;
162274
- if (displayParams) {
162275
- return { color: displayParams.lineColor };
162276
- }
162277
- return undefined;
162657
+ if (!material)
162658
+ return undefined;
162659
+ const lineStyle = this.getMaterialLineStyle(material);
162660
+ const displayParams = this.createDisplayParams(material, false, false, lineStyle);
162661
+ if (!displayParams)
162662
+ return undefined;
162663
+ const appearance = {
162664
+ color: displayParams.lineColor,
162665
+ width: lineStyle?.width,
162666
+ linePixels: lineStyle?.linePixels,
162667
+ };
162668
+ return appearance;
162278
162669
  }
162279
162670
  readPointCloud2(primitive, hasFeatures) {
162280
162671
  let pointRange;
@@ -183680,7 +184071,12 @@ class ToolAdmin {
183680
184071
  await this.setPrimitiveTool(newTool);
183681
184072
  }
183682
184073
  // it is important to raise event after setPrimitiveTool is called
183683
- this.onActiveToolChanged(undefined !== newTool ? newTool : this.idleTool, StartOrResume.Start);
184074
+ const activeTool = newTool ?? this._idleTool;
184075
+ // _idleTool is cleared during onShutDown(); skip the event if shutdown has already run
184076
+ // to avoid emitting activeToolChanged with an undefined tool.
184077
+ if (undefined === activeTool)
184078
+ return;
184079
+ this.onActiveToolChanged(activeTool, StartOrResume.Start);
183684
184080
  }
183685
184081
  finally {
183686
184082
  if (resolveStarting)
@@ -324586,7 +324982,7 @@ var loadLanguages = instance.loadLanguages;
324586
324982
  /***/ ((module) => {
324587
324983
 
324588
324984
  "use strict";
324589
- module.exports = /*#__PURE__*/JSON.parse('{"name":"@itwin/core-frontend","version":"5.8.0-dev.13","description":"iTwin.js frontend components","main":"lib/cjs/core-frontend.js","module":"lib/esm/core-frontend.js","typings":"lib/cjs/core-frontend","license":"MIT","scripts":{"build":"npm run -s copy:public && npm run -s build:cjs && npm run -s build:esm && npm run -s webpackWorkers && npm run -s copy:workers && npm run -s copy:draco","build:cjs":"npm run -s copy:js:cjs && tsc 1>&2 --outDir lib/cjs","build:esm":"npm run -s copy:js:esm && tsc 1>&2 --module ES2022 --outDir lib/esm","clean":"rimraf -g lib .rush/temp/package-deps*.json","copy:public":"cpx \\"./src/public/**/*\\" ./lib/public","copy:js:cjs":"cpx \\"./src/**/*.js\\" ./lib/cjs","copy:js:esm":"cpx \\"./src/**/*.js\\" ./lib/esm","copy:workers":"cpx \\"./lib/workers/webpack/parse-imdl-worker.js\\" ./lib/public/scripts","copy:draco":"cpx \\"./node_modules/@loaders.gl/draco/dist/libs/*\\" ./lib/public/scripts","docs":"betools docs --json=../../generated-docs/core/core-frontend/file.json --tsIndexFile=./core-frontend.ts --onlyJson --excludes=webgl/**/*,**/map/*.d.ts,**/tile/*.d.ts,**/*-css.ts && npm run -s extract","extract":"betools extract --fileExt=ts --extractFrom=./src/test/example-code --recursive --out=../../generated-docs/extract","extract-api":"betools extract-api --entry=core-frontend && npm run extract-extension-api","extract-extension-api":"eslint --no-inline-config -c extraction.eslint.config.js \\"./src/**/*.ts\\" 1>&2","lint":"eslint \\"./src/**/*.ts\\" 1>&2","lint-fix":"eslint --fix -f visualstudio \\"./src/**/*.ts\\" 1>&2","lint-deprecation":"eslint --fix -f visualstudio --no-inline-config -c ../../common/config/eslint/eslint.config.deprecation-policy.js \\"./src/**/*.ts\\"","pseudolocalize":"betools pseudolocalize --englishDir ./src/public/locales/en --out ./public/locales/en-PSEUDO","test":"npm run webpackTestWorker && vitest --run","cover":"npm run webpackTestWorker && vitest --run","webpackTests":"webpack --config ./src/test/utils/webpack.config.js 1>&2 && npm run -s webpackTestWorker","webpackTestWorker":"webpack --config ./src/test/worker/webpack.config.js 1>&2 && cpx \\"./lib/test/test-worker.js\\" ./lib/test","webpackWorkers":"webpack --config ./src/workers/ImdlParser/webpack.config.js 1>&2"},"repository":{"type":"git","url":"https://github.com/iTwin/itwinjs-core.git","directory":"core/frontend"},"keywords":["Bentley","BIM","iModel","digital-twin","iTwin"],"author":{"name":"Bentley Systems, Inc.","url":"http://www.bentley.com"},"peerDependencies":{"@itwin/appui-abstract":"workspace:*","@itwin/core-bentley":"workspace:*","@itwin/core-common":"workspace:*","@itwin/core-geometry":"workspace:*","@itwin/core-orbitgt":"workspace:*","@itwin/core-quantity":"workspace:*","@itwin/ecschema-metadata":"workspace:*","@itwin/ecschema-rpcinterface-common":"workspace:*"},"//devDependencies":["NOTE: All peerDependencies should also be listed as devDependencies since peerDependencies are not considered by npm install","NOTE: All tools used by scripts in this package must be listed as devDependencies"],"devDependencies":{"@bentley/aec-units-schema":"^1.0.3","@bentley/formats-schema":"^1.0.0","@bentley/units-schema":"^1.0.9","@itwin/appui-abstract":"workspace:*","@itwin/build-tools":"workspace:*","@itwin/core-bentley":"workspace:*","@itwin/core-common":"workspace:*","@itwin/core-geometry":"workspace:*","@itwin/core-orbitgt":"workspace:*","@itwin/core-quantity":"workspace:*","@itwin/ecschema-metadata":"workspace:*","@itwin/ecschema-rpcinterface-common":"workspace:*","@itwin/object-storage-core":"^3.0.4","@itwin/eslint-plugin":"^6.0.0","@types/chai-as-promised":"^7","@types/draco3d":"^1.4.10","@types/sinon":"^17.0.2","@vitest/browser":"^3.0.6","@vitest/coverage-v8":"^3.0.6","cpx2":"^8.0.0","eslint":"^9.31.0","glob":"^10.5.0","playwright":"~1.56.1","rimraf":"^6.0.1","sinon":"^17.0.2","source-map-loader":"^5.0.0","typescript":"~5.6.2","vitest":"^3.0.6","vite-multiple-assets":"^1.3.1","vite-plugin-static-copy":"2.2.0","webpack":"^5.97.1"},"//dependencies":["NOTE: these dependencies should be only for things that DO NOT APPEAR IN THE API","NOTE: core-frontend should remain UI technology agnostic, so no react/angular dependencies are allowed"],"dependencies":{"@itwin/core-i18n":"workspace:*","@itwin/webgl-compatibility":"workspace:*","@loaders.gl/core":"^4.3.4","@loaders.gl/draco":"^4.3.4","fuse.js":"^3.3.0","wms-capabilities":"0.4.0"}}');
324985
+ module.exports = /*#__PURE__*/JSON.parse('{"name":"@itwin/core-frontend","version":"5.8.0-dev.15","description":"iTwin.js frontend components","main":"lib/cjs/core-frontend.js","module":"lib/esm/core-frontend.js","typings":"lib/cjs/core-frontend","license":"MIT","scripts":{"build":"npm run -s copy:public && npm run -s build:cjs && npm run -s build:esm && npm run -s webpackWorkers && npm run -s copy:workers && npm run -s copy:draco","build:cjs":"npm run -s copy:js:cjs && tsc 1>&2 --outDir lib/cjs","build:esm":"npm run -s copy:js:esm && tsc 1>&2 --module ES2022 --outDir lib/esm","clean":"rimraf -g lib .rush/temp/package-deps*.json","copy:public":"cpx \\"./src/public/**/*\\" ./lib/public","copy:js:cjs":"cpx \\"./src/**/*.js\\" ./lib/cjs","copy:js:esm":"cpx \\"./src/**/*.js\\" ./lib/esm","copy:workers":"cpx \\"./lib/workers/webpack/parse-imdl-worker.js\\" ./lib/public/scripts","copy:draco":"cpx \\"./node_modules/@loaders.gl/draco/dist/libs/*\\" ./lib/public/scripts","docs":"betools docs --json=../../generated-docs/core/core-frontend/file.json --tsIndexFile=./core-frontend.ts --onlyJson --excludes=webgl/**/*,**/map/*.d.ts,**/tile/*.d.ts,**/*-css.ts && npm run -s extract","extract":"betools extract --fileExt=ts --extractFrom=./src/test/example-code --recursive --out=../../generated-docs/extract","extract-api":"betools extract-api --entry=core-frontend && npm run extract-extension-api","extract-extension-api":"eslint --no-inline-config -c extraction.eslint.config.js \\"./src/**/*.ts\\" 1>&2","lint":"eslint \\"./src/**/*.ts\\" 1>&2","lint-fix":"eslint --fix -f visualstudio \\"./src/**/*.ts\\" 1>&2","lint-deprecation":"eslint --fix -f visualstudio --no-inline-config -c ../../common/config/eslint/eslint.config.deprecation-policy.js \\"./src/**/*.ts\\"","pseudolocalize":"betools pseudolocalize --englishDir ./src/public/locales/en --out ./public/locales/en-PSEUDO","test":"npm run webpackTestWorker && vitest --run","cover":"npm run webpackTestWorker && vitest --run","webpackTests":"webpack --config ./src/test/utils/webpack.config.js 1>&2 && npm run -s webpackTestWorker","webpackTestWorker":"webpack --config ./src/test/worker/webpack.config.js 1>&2 && cpx \\"./lib/test/test-worker.js\\" ./lib/test","webpackWorkers":"webpack --config ./src/workers/ImdlParser/webpack.config.js 1>&2"},"repository":{"type":"git","url":"https://github.com/iTwin/itwinjs-core.git","directory":"core/frontend"},"keywords":["Bentley","BIM","iModel","digital-twin","iTwin"],"author":{"name":"Bentley Systems, Inc.","url":"http://www.bentley.com"},"peerDependencies":{"@itwin/appui-abstract":"workspace:*","@itwin/core-bentley":"workspace:*","@itwin/core-common":"workspace:*","@itwin/core-geometry":"workspace:*","@itwin/core-orbitgt":"workspace:*","@itwin/core-quantity":"workspace:*","@itwin/ecschema-metadata":"workspace:*","@itwin/ecschema-rpcinterface-common":"workspace:*"},"//devDependencies":["NOTE: All peerDependencies should also be listed as devDependencies since peerDependencies are not considered by npm install","NOTE: All tools used by scripts in this package must be listed as devDependencies"],"devDependencies":{"@bentley/aec-units-schema":"^1.0.3","@bentley/formats-schema":"^1.0.0","@bentley/units-schema":"^1.0.9","@itwin/appui-abstract":"workspace:*","@itwin/build-tools":"workspace:*","@itwin/core-bentley":"workspace:*","@itwin/core-common":"workspace:*","@itwin/core-geometry":"workspace:*","@itwin/core-orbitgt":"workspace:*","@itwin/core-quantity":"workspace:*","@itwin/ecschema-metadata":"workspace:*","@itwin/ecschema-rpcinterface-common":"workspace:*","@itwin/object-storage-core":"^3.0.4","@itwin/eslint-plugin":"^6.0.0","@types/chai-as-promised":"^7","@types/draco3d":"^1.4.10","@types/sinon":"^17.0.2","@vitest/browser":"^3.0.6","@vitest/coverage-v8":"^3.0.6","cpx2":"^8.0.0","eslint":"^9.31.0","glob":"^10.5.0","playwright":"~1.56.1","rimraf":"^6.0.1","sinon":"^17.0.2","source-map-loader":"^5.0.0","typescript":"~5.6.2","vitest":"^3.0.6","vite-multiple-assets":"^1.3.1","vite-plugin-static-copy":"2.2.0","webpack":"^5.97.1"},"//dependencies":["NOTE: these dependencies should be only for things that DO NOT APPEAR IN THE API","NOTE: core-frontend should remain UI technology agnostic, so no react/angular dependencies are allowed"],"dependencies":{"@itwin/core-i18n":"workspace:*","@itwin/webgl-compatibility":"workspace:*","@loaders.gl/core":"^4.3.4","@loaders.gl/draco":"^4.3.4","fuse.js":"^3.3.0","wms-capabilities":"0.4.0"}}');
324590
324986
 
324591
324987
  /***/ })
324592
324988