@itwin/core-frontend 4.2.0-dev.17 → 4.2.0-dev.18

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.
@@ -507,7 +507,7 @@ function splitMeshParams(args) {
507
507
  const result = new Map();
508
508
  const mat = args.params.surface.material;
509
509
  const atlasOffset = undefined !== mat && mat.isAtlas ? mat.vertexTableOffset : undefined;
510
- const atlasInfo = atlasOffset ? { offset: atlasOffset, createMaterial: args.createMaterial } : undefined;
510
+ const atlasInfo = undefined !== atlasOffset ? { offset: atlasOffset, createMaterial: args.createMaterial } : undefined;
511
511
  const nodes = VertexTableSplitter.split({
512
512
  indices: args.params.surface.indices,
513
513
  vertices: args.params.vertices,
@@ -1 +1 @@
1
- {"version":3,"file":"VertexTableSplitter.js","sourceRoot":"","sources":["../../../../../src/common/render/primitives/VertexTableSplitter.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAoF;AACpF,oDAAkF;AAClF,6CAAkG;AAClG,+CAA+D;AAC/D,mDAAgD;AAChD,mDAAyE;AAazE;;;GAGG;AACH,MAAa,WAAW;IAKtB,YAAmB,eAAe,GAAG,CAAC;QAHrB,aAAQ,GAAG,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC;QAC9B,YAAO,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QAGpE,IAAI,CAAC,QAAQ,GAAG,IAAI,gCAAiB,CAAC,EAAE,eAAe,EAAE,eAAe,GAAG,CAAC,EAAE,CAAC,CAAC;IAClF,CAAC;IAED,IAAW,UAAU;QACnB,IAAA,qBAAM,EAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;QACzC,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;IAClC,CAAC;IAEM,I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D,MAAM,SAAS,GAAG,CAAC,YAAY,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;YACpD,MAAM,YAAY,GAAG,aAAa,CAAC,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;YACvE,IAAA,qBAAM,EAAC,SAAS,KAAK,YAAY,CAAC,CAAC;YACnC,YAAY,GAAG,CAAC,YAAY,GAAG,UAAU,CAAC,GAAG,YAAY,CAAC;YAC1D,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;SAC9C;QAED,EAAE,aAAa,CAAC;KACjB;IAED,MAAM,MAAM,GAAG,IAAI,GAAG,EAA0B,CAAC;IACjD,KAAK,MAAM,CAAC,EAAE,EAAE,IAAI,CAAC,IAAI,KAAK,EAAE;QAC9B,IAAA,qBAAM,EAAC,SAAS,KAAK,IAAI,CAAC,WAAW,IAAI,SAAS,KAAK,IAAI,CAAC,oBAAoB,CAAC,CAAC;QAClF,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAClE,MAAM,MAAM,GAAmB;YAC7B,GAAG,IAAI,CAAC,MAAM;YACd,QAAQ;YACR,QAAQ,EAAE;gBACR,OAAO;gBACP,WAAW,EAAE,IAAI,CAAC,WAAW,CAAC,eAAe,EAAE;gBAC/C,oBAAoB,EAAE,IAAI,CAAC,oBAAoB,CAAC,YAAY,EAAE;aAC/D;SACF,CAAC;QAEF,MAAM,CAAC,GAAG,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;KACxB;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AArDD,kDAqDC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Rendering\r\n */\r\n\r\nimport { assert, Uint32ArrayBuilder, Uint8ArrayBuilder } from \"@itwin/core-bentley\";\r\nimport { ColorDef, RenderFeatureTable, RenderMaterial } from \"@itwin/core-common\";\r\nimport { calculateEdgeTableParams, EdgeParams, EdgeTable, IndexedEdgeParams } from \"./EdgeParams\";\r\nimport { computeDimensions, VertexTable } from \"./VertexTable\";\r\nimport { VertexIndices } from \"./VertexIndices\";\r\nimport { createSurfaceMaterial, SurfaceMaterial } from \"./SurfaceParams\";\r\nimport { MaterialParams } from \"../MaterialParams\";\r\nimport { MeshParams } from \"./MeshParams\";\r\nimport { PointStringParams } from \"./PointStringParams\";\r\nimport { PolylineParams, TesselatedPolyline } from \"./PolylineParams\";\r\n\r\n/** @internal */\r\nexport interface VertexTableWithIndices {\r\n vertices: VertexTable;\r\n indices: VertexIndices;\r\n material?: SurfaceMaterial;\r\n}\r\n\r\n/** Builds up a [[VertexIndices]].\r\n * Exported strictly for tests.\r\n * @internal\r\n */\r\nexport class IndexBuffer {\r\n private readonly _builder: Uint8ArrayBuilder;\r\n private readonly _index32 = new Uint32Array(1);\r\n private readonly _index8 = new Uint8Array(this._index32.buffer, 0, 3);\r\n\r\n public constructor(initialCapacity = 3) {\r\n this._builder = new Uint8ArrayBuilder({ initialCapacity: initialCapacity * 3 });\r\n }\r\n\r\n public get numIndices(): number {\r\n assert((this._builder.length % 3) === 0);\r\n return this._builder.length / 3;\r\n }\r\n\r\n public push(index: number): void {\r\n this._index32[0] = index;\r\n this._builder.append(this._index8);\r\n }\r\n\r\n public toVertexIndices(): VertexIndices {\r\n return new VertexIndices(this._builder.toTypedArray());\r\n }\r\n}\r\n\r\n/** Builds up a [[VertexTable]]. */\r\nclass VertexBuffer {\r\n private readonly _builder: Uint32ArrayBuilder;\r\n private readonly _source: VertexTable;\r\n\r\n /** `source` is the original table containing the vertex data from which individual vertices will be obtained. */\r\n public constructor(source: VertexTable) {\r\n this._source = source;\r\n this._builder = new Uint32ArrayBuilder({ initialCapacity: 3 * source.numRgbaPerVertex });\r\n }\r\n\r\n /** The number of vertices currently in the table. */\r\n public get length(): number {\r\n assert((this._builder.length % this.vertexSize) === 0);\r\n return this._builder.length / this.vertexSize;\r\n }\r\n\r\n /** The number of 32-bit unsigned integers (RGBA values) per vertex. */\r\n public get vertexSize(): number {\r\n return this._source.numRgbaPerVertex;\r\n }\r\n\r\n /** Append a vertex. `vertex` must be of size [[vertexSize]]. */\r\n public push(vertex: Uint32Array): void {\r\n assert(vertex.length === this.vertexSize);\r\n this._builder.append(vertex);\r\n }\r\n\r\n /** Construct the finished vertex table. */\r\n public buildVertexTable(maxDimension: number, colorTable: ColorTable | undefined, materialAtlasTable: MaterialAtlasTable): VertexTable {\r\n const source = this._source;\r\n colorTable = colorTable ?? source.uniformColor;\r\n assert(undefined !== colorTable);\r\n\r\n const colorTableLength = colorTable instanceof Uint32Array ? colorTable.length : 0;\r\n const materialAtlasTableLength = materialAtlasTable instanceof Uint32Array ? materialAtlasTable.length : 0;\r\n const dimensions = computeDimensions(this.length, this.vertexSize, colorTableLength + materialAtlasTableLength, maxDimension);\r\n\r\n let rgbaData = this._builder.toTypedArray();\r\n if (dimensions.width * dimensions.height > rgbaData.length) {\r\n const prevData = rgbaData;\r\n rgbaData = new Uint32Array(dimensions.width * dimensions.height);\r\n rgbaData.set(prevData, 0);\r\n }\r\n\r\n let tableSize = this.vertexSize * this.length;\r\n if (colorTable instanceof Uint32Array) {\r\n rgbaData.set(colorTable, tableSize);\r\n tableSize += colorTable.length;\r\n }\r\n\r\n if (materialAtlasTable instanceof Uint32Array)\r\n rgbaData.set(materialAtlasTable, tableSize);\r\n\r\n return {\r\n data: new Uint8Array(rgbaData.buffer, rgbaData.byteOffset, rgbaData.byteLength),\r\n usesUnquantizedPositions: source.usesUnquantizedPositions,\r\n qparams: source.qparams,\r\n width: dimensions.width,\r\n height: dimensions.height,\r\n hasTranslucency: source.hasTranslucency,\r\n uniformColor: colorTable instanceof ColorDef ? colorTable : undefined,\r\n featureIndexType: source.featureIndexType,\r\n uniformFeatureID: source.uniformFeatureID,\r\n numVertices: this.length,\r\n numRgbaPerVertex: source.numRgbaPerVertex,\r\n uvParams: source.uvParams,\r\n };\r\n }\r\n}\r\n\r\ntype ColorTable = Uint32Array | ColorDef;\r\n\r\n/** Remaps portions of a source color table into a filtered target color table. */\r\nclass ColorTableRemapper {\r\n private readonly _remappedIndices = new Map<number, number>();\r\n private readonly _colorTable: Uint32Array;\r\n public readonly colors: number[] = [];\r\n private readonly _32 = new Uint32Array(1);\r\n private readonly _16 = new Uint16Array(this._32.buffer);\r\n\r\n public constructor(colorTable: Uint32Array) {\r\n this._colorTable = colorTable;\r\n }\r\n\r\n /** Extract the color index stored in `vertex`, ensure it is present in the remapped color table, and return its index in that table. */\r\n public remap(vertex: Uint32Array, usesUnquantizedPositions: boolean | undefined): void {\r\n const vertIndex = usesUnquantizedPositions ? 4 : 1;\r\n const shortIndex = usesUnquantizedPositions ? 0 : 1;\r\n this._32[0] = vertex[vertIndex];\r\n const oldIndex = this._16[shortIndex];\r\n let newIndex = this._remappedIndices.get(oldIndex);\r\n if (undefined === newIndex) {\r\n newIndex = this.colors.length;\r\n this._remappedIndices.set(oldIndex, newIndex);\r\n const color = this._colorTable[oldIndex];\r\n this.colors.push(color);\r\n }\r\n\r\n this._16[shortIndex] = newIndex;\r\n vertex[vertIndex] = this._32[0];\r\n }\r\n\r\n /** Construct the finished color table. */\r\n public buildColorTable(): ColorTable {\r\n assert(this.colors.length > 0);\r\n return this.colors.length > 1 ? new Uint32Array(this.colors) : ColorDef.fromAbgr(this.colors[0]);\r\n }\r\n}\r\n\r\ntype MaterialAtlasTable = Uint32Array | SurfaceMaterial | undefined;\r\n\r\ntype CreateRenderMaterial = (args: MaterialParams) => RenderMaterial | undefined;\r\n\r\nclass MaterialAtlasRemapper {\r\n private readonly _remappedIndices = new Map<number, number>();\r\n private readonly _atlasTable: Uint32Array;\r\n private readonly _createMaterial: CreateRenderMaterial;\r\n public readonly materials: number[] = [];\r\n private readonly _32 = new Uint32Array(1);\r\n private readonly _8 = new Uint8Array(this._32.buffer);\r\n\r\n public constructor(_atlasTable: Uint32Array, createMaterial: CreateRenderMaterial) {\r\n this._atlasTable = _atlasTable;\r\n this._createMaterial = createMaterial;\r\n }\r\n\r\n /** Extract the mat index stored in `vertex`, ensure it is present in the remapped atlas table, and return its index in that table. */\r\n public remap(vertex: Uint32Array, usesUnquantizedPositions: boolean | undefined): void {\r\n const vertIndex = usesUnquantizedPositions ? 3 : 2;\r\n this._32[0] = vertex[vertIndex];\r\n const oldIndex = this._8[3];\r\n let newIndex = this._remappedIndices.get(oldIndex);\r\n if (undefined === newIndex) {\r\n newIndex = this.materials.length / 4;\r\n this._remappedIndices.set(oldIndex, newIndex);\r\n let index = oldIndex * 4;\r\n this.materials.push(this._atlasTable[index++]);\r\n this.materials.push(this._atlasTable[index++]);\r\n this.materials.push(this._atlasTable[index++]);\r\n this.materials.push(this._atlasTable[index]);\r\n }\r\n\r\n this._8[3] = newIndex;\r\n vertex[vertIndex] = this._32[0];\r\n }\r\n\r\n private unpackFloat(value: number): number {\r\n this._32[0] = value;\r\n const valUint32 = this._32[0];\r\n const bias = 38.0;\r\n const temp = (valUint32 >>> 24) / 2.0;\r\n let exponent = Math.floor(temp);\r\n let sign = (temp - exponent) * 2.0;\r\n sign = -(sign * 2.0 - 1.0);\r\n const base = sign * (valUint32 & 0xffffff) / 16777216.0;\r\n exponent = exponent - bias;\r\n return base * Math.pow(10.0, exponent);\r\n }\r\n\r\n private materialFromAtlasEntry(entry: Uint32Array): SurfaceMaterial | undefined {\r\n const rgbOverridden = (entry[1] & 0x1000000) !== 0;\r\n const alphaOverridden = (entry[1] & 0x2000000) !== 0;\r\n const args: MaterialParams = {\r\n alpha: alphaOverridden ? (entry[0] >>> 24) / 255.0 : undefined,\r\n diffuse: {\r\n color: rgbOverridden ? ColorDef.fromTbgr(entry[0] & 0xffffff) : undefined,\r\n weight: (entry[1] >>> 8) / 255.0,\r\n },\r\n specular: {\r\n color: ColorDef.fromTbgr(entry[2]),\r\n weight: ((entry[1] >>> 16) & 0xff) / 255.0,\r\n exponent: this.unpackFloat(entry[3]),\r\n },\r\n };\r\n\r\n const material = this._createMaterial(args);\r\n return createSurfaceMaterial(material);\r\n }\r\n\r\n /** Construct the finished color table. */\r\n public buildAtlasTable(): MaterialAtlasTable {\r\n assert(this.materials.length > 0);\r\n const m = new Uint32Array(this.materials);\r\n return this.materials.length > 4 ? m : this.materialFromAtlasEntry(m);\r\n }\r\n}\r\n\r\n/** A node in a split vertex table. Each node corresponds to one or more elements. */\r\nclass Node {\r\n public readonly vertices: VertexBuffer;\r\n public readonly remappedIndices = new Map<number, number>();\r\n public readonly indices = new IndexBuffer();\r\n public readonly colors?: ColorTableRemapper;\r\n public readonly atlas?: MaterialAtlasRemapper;\r\n public readonly usesUnquantizedPositions?: boolean;\r\n\r\n /** `vertexTable` is the source table containing vertex data for all nodes, from which this node will extract the vertices belong to it. */\r\n public constructor(vertexTable: VertexTable, atlas?: AtlasInfo) {\r\n this.vertices = new VertexBuffer(vertexTable);\r\n if (undefined === vertexTable.uniformColor)\r\n this.colors = new ColorTableRemapper(new Uint32Array(vertexTable.data.buffer, vertexTable.data.byteOffset + 4 * vertexTable.numVertices * vertexTable.numRgbaPerVertex));\r\n\r\n if (atlas) {\r\n const atlasOffset = (vertexTable.numVertices * vertexTable.numRgbaPerVertex + atlas.offset) * 4;\r\n this.atlas = new MaterialAtlasRemapper(new Uint32Array(vertexTable.data.buffer, vertexTable.data.byteOffset + atlasOffset), atlas.createMaterial);\r\n }\r\n\r\n this.usesUnquantizedPositions = vertexTable.usesUnquantizedPositions;\r\n }\r\n\r\n public addVertex(originalIndex: number, vertex: Uint32Array): void {\r\n let newIndex = this.remappedIndices.get(originalIndex);\r\n if (undefined === newIndex) {\r\n newIndex = this.vertices.length;\r\n this.remappedIndices.set(originalIndex, newIndex);\r\n\r\n this.colors?.remap(vertex, this.usesUnquantizedPositions);\r\n this.atlas?.remap(vertex, this.usesUnquantizedPositions);\r\n this.vertices.push(vertex);\r\n }\r\n\r\n this.indices.push(newIndex);\r\n }\r\n\r\n public buildOutput(maxDimension: number): VertexTableWithIndices {\r\n const materialAtlas = this.atlas?.buildAtlasTable();\r\n const material: SurfaceMaterial | undefined = (materialAtlas instanceof Uint32Array) ? undefined : materialAtlas;\r\n return {\r\n indices: this.indices.toVertexIndices(),\r\n vertices: this.vertices.buildVertexTable(maxDimension, this.colors?.buildColorTable(), materialAtlas),\r\n material,\r\n };\r\n }\r\n}\r\n\r\ninterface AtlasInfo {\r\n offset: number;\r\n createMaterial: CreateRenderMaterial;\r\n}\r\n\r\ninterface VertexTableSplitArgs extends VertexTableWithIndices {\r\n featureTable: RenderFeatureTable;\r\n atlasInfo?: AtlasInfo;\r\n}\r\n\r\n/** @internal */\r\nexport type ComputeAnimationNodeId = (featureIndex: number) => number;\r\n\r\nclass VertexTableSplitter {\r\n private readonly _input: VertexTableSplitArgs;\r\n private readonly _computeNodeId: ComputeAnimationNodeId;\r\n private readonly _nodes = new Map<number, Node>();\r\n\r\n private constructor(input: VertexTableSplitArgs, computeNodeId: ComputeAnimationNodeId) {\r\n this._input = input;\r\n this._computeNodeId = computeNodeId;\r\n }\r\n\r\n /** Split the source into one or more output nodes, returning a mapping of integer node Id to node. */\r\n public static split(source: VertexTableSplitArgs, computeNodeId: ComputeAnimationNodeId): Map<number, Node> {\r\n const splitter = new VertexTableSplitter(source, computeNodeId);\r\n splitter.split();\r\n return splitter._nodes;\r\n }\r\n\r\n private split(): void {\r\n // Track the most recent feature and corresponding node to avoid repeated lookups - vertices for\r\n // individual features are largely contiguous.\r\n const curState = {\r\n featureIndex: -1,\r\n node: undefined as unknown as Node,\r\n };\r\n\r\n const vertSize = this._input.vertices.numRgbaPerVertex;\r\n const vertex = new Uint32Array(vertSize);\r\n const vertexTable = new Uint32Array(this._input.vertices.data.buffer, this._input.vertices.data.byteOffset, this._input.vertices.numVertices * vertSize);\r\n\r\n for (const index of this._input.indices) {\r\n // Extract the data for this vertex without allocating new typed arrays.\r\n const vertexOffset = index * vertSize;\r\n for (let i = 0; i < vertex.length; i++)\r\n vertex[i] = vertexTable[vertexOffset + i];\r\n\r\n // Determine to which element the vertex belongs and find the corresponding Node.\r\n const featureIndex = vertex[2] & 0x00ffffff;\r\n if (curState.featureIndex !== featureIndex) {\r\n curState.featureIndex = featureIndex;\r\n const nodeId = this._computeNodeId(featureIndex);\r\n let node = this._nodes.get(nodeId);\r\n if (undefined === node)\r\n this._nodes.set(nodeId, node = new Node(this._input.vertices, this._input.atlasInfo));\r\n\r\n curState.node = node;\r\n }\r\n\r\n // Add the vertex to the appropriate node.\r\n curState.node.addVertex(index, vertex);\r\n }\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport interface SplitVertexTableArgs {\r\n featureTable: RenderFeatureTable;\r\n maxDimension: number;\r\n computeNodeId: ComputeAnimationNodeId;\r\n}\r\n\r\n/** @internal */\r\nexport interface SplitPointStringArgs extends SplitVertexTableArgs {\r\n params: PointStringParams;\r\n}\r\n\r\n/** Given a PointStringParams and a function that can associate a node Id with an element Id, produce a mapping of nodes to PointStringParams, splitting up\r\n * the input params as needed.\r\n * @internal\r\n */\r\nexport function splitPointStringParams(args: SplitPointStringArgs): Map<number, PointStringParams> {\r\n const nodes = VertexTableSplitter.split({\r\n indices: args.params.indices,\r\n vertices: args.params.vertices,\r\n featureTable: args.featureTable,\r\n }, args.computeNodeId);\r\n\r\n const result = new Map<number, PointStringParams>();\r\n for (const [id, node] of nodes) {\r\n const { vertices, indices } = node.buildOutput(args.maxDimension);\r\n result.set(id, { vertices, indices, weight: args.params.weight });\r\n }\r\n\r\n return result;\r\n}\r\n\r\ninterface RemappedSegmentEdges {\r\n indices: IndexBuffer;\r\n endPointAndQuadIndices: Uint32ArrayBuilder;\r\n}\r\n\r\ninterface RemappedSilhouetteEdges extends RemappedSegmentEdges {\r\n normalPairs: Uint32ArrayBuilder;\r\n}\r\n\r\nclass RemappedPolylineEdges {\r\n public readonly indices = new IndexBuffer();\r\n public readonly prevIndices = new IndexBuffer();\r\n public readonly nextIndicesAndParams = new Uint32ArrayBuilder();\r\n}\r\n\r\ninterface RemappedIndexEdges {\r\n edges: Uint8ArrayBuilder;\r\n silhouettes: Uint8ArrayBuilder;\r\n}\r\n\r\ninterface RemappedEdges {\r\n segments?: RemappedSegmentEdges;\r\n silhouettes?: RemappedSilhouetteEdges;\r\n polylines?: RemappedPolylineEdges;\r\n indexed?: RemappedIndexEdges;\r\n}\r\n\r\ninterface RemappedIndex {\r\n node: Node;\r\n id: number;\r\n index: number;\r\n}\r\n\r\nfunction remapIndex(out: RemappedIndex, srcIndex: number, nodes: Map<number, Node>): boolean {\r\n for (const [id, node] of nodes) {\r\n const index = node.remappedIndices.get(srcIndex);\r\n if (undefined !== index) {\r\n out.index = index;\r\n out.node = node;\r\n out.id = id;\r\n return true;\r\n }\r\n }\r\n\r\n assert(false);\r\n return false;\r\n}\r\n\r\nfunction remapSegmentEdges(type: \"segments\" | \"silhouettes\", source: EdgeParams, nodes: Map<number, Node>, edges: Map<number, RemappedEdges>): void {\r\n const src = source[type];\r\n if (!src)\r\n return;\r\n\r\n const srcEndPts = new Uint32Array(src.endPointAndQuadIndices.buffer, src.endPointAndQuadIndices.byteOffset, src.endPointAndQuadIndices.length / 4);\r\n let srcNormalPairs;\r\n if (type === \"silhouettes\") {\r\n assert(undefined !== source.silhouettes);\r\n srcNormalPairs = new Uint32Array(source.silhouettes.normalPairs.buffer, source.silhouettes.normalPairs.byteOffset, source.silhouettes.normalPairs.length / 4);\r\n }\r\n\r\n let curIndexIndex = 0;\r\n const remappedIndex = { } as unknown as RemappedIndex;\r\n for (const srcIndex of src.indices) {\r\n if (remapIndex(remappedIndex, srcIndex, nodes)) {\r\n let endPointAndQuad = srcEndPts[curIndexIndex];\r\n const otherIndex = (endPointAndQuad & 0x00ffffff) >>> 0;\r\n const newOtherIndex = remappedIndex.node.remappedIndices.get(otherIndex);\r\n assert(undefined !== newOtherIndex);\r\n endPointAndQuad = (endPointAndQuad & 0xff000000) | newOtherIndex;\r\n\r\n let entry = edges.get(remappedIndex.id);\r\n if (!entry)\r\n edges.set(remappedIndex.id, entry = { });\r\n\r\n if (srcNormalPairs) {\r\n if (!entry.silhouettes)\r\n entry.silhouettes = { indices: new IndexBuffer(), endPointAndQuadIndices: new Uint32ArrayBuilder(), normalPairs: new Uint32ArrayBuilder() };\r\n\r\n entry.silhouettes.normalPairs.push(srcNormalPairs[curIndexIndex]);\r\n } else if (!entry.segments) {\r\n entry.segments = { indices: new IndexBuffer(), endPointAndQuadIndices: new Uint32ArrayBuilder() };\r\n }\r\n\r\n const segments = entry[type];\r\n assert(undefined !== segments);\r\n\r\n segments.indices.push(remappedIndex.index);\r\n segments.endPointAndQuadIndices.push(endPointAndQuad);\r\n }\r\n\r\n ++curIndexIndex;\r\n }\r\n}\r\n\r\nfunction remapPolylineEdges(src: TesselatedPolyline, nodes: Map<number, Node>, edges: Map<number, RemappedEdges>): void {\r\n const srcNextAndParam = new Uint32Array(src.nextIndicesAndParams.buffer, src.nextIndicesAndParams.byteOffset, src.nextIndicesAndParams.length / 4);\r\n const prevIter = src.prevIndices[Symbol.iterator]();\r\n let curIndexIndex = 0;\r\n const remappedIndex = { } as unknown as RemappedIndex;\r\n for (const srcIndex of src.indices) {\r\n if (remapIndex(remappedIndex, srcIndex, nodes)) {\r\n const prevIndex = prevIter.next().value;\r\n assert(undefined !== prevIndex);\r\n const newPrevIndex = remappedIndex.node.remappedIndices.get(prevIndex);\r\n assert(undefined !== newPrevIndex);\r\n\r\n let nextAndParam = srcNextAndParam[curIndexIndex];\r\n const nextIndex = (nextAndParam & 0x00ffffff) >>> 0;\r\n const newNextIndex = remappedIndex.node.remappedIndices.get(nextIndex);\r\n assert(undefined !== newNextIndex);\r\n nextAndParam = (nextAndParam & 0xff000000) | newNextIndex;\r\n\r\n let entry = edges.get(remappedIndex.id);\r\n if (!entry)\r\n edges.set(remappedIndex.id, entry = { });\r\n\r\n if (!entry.polylines)\r\n entry.polylines = new RemappedPolylineEdges();\r\n\r\n entry.polylines.indices.push(remappedIndex.index);\r\n entry.polylines.prevIndices.push(newPrevIndex);\r\n entry.polylines.nextIndicesAndParams.push(nextAndParam);\r\n }\r\n\r\n ++curIndexIndex;\r\n }\r\n}\r\n\r\nfunction remapIndexedEdges(src: IndexedEdgeParams, nodes: Map<number, Node>, edges: Map<number, RemappedEdges>): void {\r\n const srcEdgeData = src.edges.data;\r\n const numSegments = src.edges.numSegments;\r\n const silhouetteStartByteIndex = numSegments * 6 + src.edges.silhouettePadding;\r\n\r\n function getUint24EdgePair(byteIndex: number): [number, number] {\r\n return [srcEdgeData[byteIndex + 0] | (srcEdgeData[byteIndex + 1] << 8) | srcEdgeData[byteIndex + 2] << 16,\r\n srcEdgeData[byteIndex + 3] | (srcEdgeData[byteIndex + 4] << 8) | srcEdgeData[byteIndex + 5] << 16];\r\n }\r\n\r\n function setUint24EdgePair(indEdges: RemappedIndexEdges, value1: number, value2: number): void {\r\n indEdges.edges.push(value1 & 0x0000ff);\r\n indEdges.edges.push((value1 & 0x00ff00) >>> 8);\r\n indEdges.edges.push((value1 & 0xff0000) >>> 16);\r\n indEdges.edges.push(value2 & 0x0000ff);\r\n indEdges.edges.push((value2 & 0x00ff00) >>> 8);\r\n indEdges.edges.push((value2 & 0xff0000) >>> 16);\r\n }\r\n\r\n function getUint24SilPair(byteIndex: number): [number, number, number, number] {\r\n return [srcEdgeData[byteIndex + 0] | (srcEdgeData[byteIndex + 1] << 8) | srcEdgeData[byteIndex + 2] << 16,\r\n srcEdgeData[byteIndex + 3] | (srcEdgeData[byteIndex + 4] << 8) | srcEdgeData[byteIndex + 5] << 16,\r\n srcEdgeData[byteIndex + 6] | (srcEdgeData[byteIndex + 7] << 8), srcEdgeData[byteIndex + 8] | (srcEdgeData[byteIndex + 9] << 8)];\r\n }\r\n\r\n function setUint24SilPair(indSil: RemappedIndexEdges, value1: number, value2: number, norm1: number, norm2: number): void {\r\n indSil.silhouettes.push(value1 & 0x0000ff);\r\n indSil.silhouettes.push((value1 & 0x00ff00) >>> 8);\r\n indSil.silhouettes.push((value1 & 0xff0000) >>> 16);\r\n indSil.silhouettes.push(value2 & 0x0000ff);\r\n indSil.silhouettes.push((value2 & 0x00ff00) >>> 8);\r\n indSil.silhouettes.push((value2 & 0xff0000) >>> 16);\r\n indSil.silhouettes.push(norm1 & 0x0000ff);\r\n indSil.silhouettes.push((norm1 & 0x00ff00) >>> 8);\r\n indSil.silhouettes.push(norm2 & 0x0000ff);\r\n indSil.silhouettes.push((norm2 & 0x00ff00) >>> 8);\r\n }\r\n\r\n let maxIndex = 0;\r\n for (const srcIndex of src.indices)\r\n maxIndex = Math.max (srcIndex, maxIndex);\r\n\r\n const remappedIndex = { } as unknown as RemappedIndex;\r\n let es1Index = 0, es2Index = 0, n1 = 0, n2 = 0;\r\n for (let curSegment = 0, byteIndex = 0; curSegment <= maxIndex; ++curSegment) {\r\n if (curSegment < numSegments) { // edges\r\n [es1Index, es2Index] = getUint24EdgePair(byteIndex);\r\n byteIndex += 6;\r\n } else { // silhouettes\r\n byteIndex = silhouetteStartByteIndex + (curSegment - numSegments) * 10;\r\n [es1Index, es2Index, n1, n2] = getUint24SilPair(byteIndex);\r\n }\r\n\r\n if (remapIndex(remappedIndex, es1Index, nodes)) {\r\n let entry = edges.get(remappedIndex.id);\r\n if (!entry)\r\n edges.set(remappedIndex.id, entry = { });\r\n\r\n if (!entry.indexed)\r\n entry.indexed = { edges: new Uint8ArrayBuilder(), silhouettes: new Uint8ArrayBuilder() };\r\n\r\n if (curSegment < numSegments) { // edges\r\n const newE1Index = remappedIndex.node.remappedIndices.get(es1Index);\r\n assert(undefined !== newE1Index);\r\n const newE2Index = remappedIndex.node.remappedIndices.get(es2Index);\r\n assert(undefined !== newE2Index);\r\n setUint24EdgePair(entry.indexed, newE1Index, newE2Index);\r\n } else { // silhouettes\r\n const newS1Index = remappedIndex.node.remappedIndices.get(es1Index);\r\n assert(undefined !== newS1Index);\r\n const newS2Index = remappedIndex.node.remappedIndices.get(es2Index);\r\n assert(undefined !== newS2Index);\r\n setUint24SilPair(entry.indexed, newS1Index, newS2Index, n1, n2);\r\n }\r\n }\r\n }\r\n}\r\n\r\nfunction splitEdges(source: EdgeParams, nodes: Map<number, Node>, maxDimension: number): Map<number, EdgeParams> {\r\n const edges = new Map<number, RemappedEdges>();\r\n remapSegmentEdges(\"segments\", source, nodes, edges);\r\n remapSegmentEdges(\"silhouettes\", source, nodes, edges);\r\n\r\n if (source.polylines)\r\n remapPolylineEdges(source.polylines, nodes, edges);\r\n\r\n if (source.indexed)\r\n remapIndexedEdges(source.indexed, nodes, edges);\r\n\r\n const result = new Map<number, EdgeParams>();\r\n for (const [id, remappedEdges] of edges) {\r\n if (!remappedEdges.segments && !remappedEdges.silhouettes && !remappedEdges.indexed)\r\n continue;\r\n\r\n let edgeTable = { } as unknown as EdgeTable;\r\n let edgeIndices = { } as unknown as VertexIndices;\r\n if (remappedEdges.indexed) {\r\n const numSegmentEdges = remappedEdges.indexed.edges.length / 6;\r\n const numSilhouettes = remappedEdges.indexed.silhouettes.length / 10;\r\n const { width, height, silhouettePadding, silhouetteStartByteIndex } = calculateEdgeTableParams(numSegmentEdges, numSilhouettes, maxDimension);\r\n const data = new Uint8Array(width * height * 4);\r\n data.set(remappedEdges.indexed.edges.toTypedArray(), 0);\r\n if (numSilhouettes > 0)\r\n data.set(remappedEdges.indexed.silhouettes.toTypedArray(), silhouetteStartByteIndex + silhouettePadding);\r\n\r\n const numTotalEdges = numSegmentEdges + numSilhouettes;\r\n edgeIndices = new VertexIndices(new Uint8Array(numTotalEdges * 6 * 3));\r\n for (let i = 0; i < numTotalEdges; i++)\r\n for (let j = 0; j < 6; j++)\r\n edgeIndices.setNthIndex(i * 6 + j, i);\r\n\r\n edgeTable = {\r\n data,\r\n width,\r\n height,\r\n numSegments: numSegmentEdges,\r\n silhouettePadding,\r\n };\r\n }\r\n\r\n result.set(id, {\r\n weight: source.weight,\r\n linePixels: source.linePixels,\r\n segments: remappedEdges.segments ? {\r\n indices: remappedEdges.segments.indices.toVertexIndices(),\r\n endPointAndQuadIndices: remappedEdges.segments.endPointAndQuadIndices.toUint8Array(),\r\n } : undefined,\r\n silhouettes: remappedEdges.silhouettes ? {\r\n indices: remappedEdges.silhouettes.indices.toVertexIndices(),\r\n endPointAndQuadIndices: remappedEdges.silhouettes.endPointAndQuadIndices.toUint8Array(),\r\n normalPairs: remappedEdges.silhouettes.normalPairs.toUint8Array(),\r\n } : undefined,\r\n polylines: remappedEdges.polylines ? {\r\n indices: remappedEdges.polylines.indices.toVertexIndices(),\r\n prevIndices: remappedEdges.polylines.prevIndices.toVertexIndices(),\r\n nextIndicesAndParams: remappedEdges.polylines.nextIndicesAndParams.toUint8Array(),\r\n } : undefined,\r\n indexed: remappedEdges.indexed ? {\r\n indices: edgeIndices,\r\n edges: edgeTable,\r\n } : undefined,\r\n });\r\n }\r\n\r\n return result;\r\n}\r\n\r\n/** @internal */\r\nexport interface SplitMeshArgs extends SplitVertexTableArgs {\r\n params: MeshParams;\r\n createMaterial: CreateRenderMaterial;\r\n}\r\n\r\n/** @internal */\r\nexport function splitMeshParams(args: SplitMeshArgs): Map<number, MeshParams> {\r\n const result = new Map<number, MeshParams>();\r\n\r\n const mat = args.params.surface.material;\r\n const atlasOffset = undefined !== mat && mat.isAtlas ? mat.vertexTableOffset : undefined;\r\n const atlasInfo = atlasOffset ? { offset: atlasOffset, createMaterial: args.createMaterial } : undefined;\r\n\r\n const nodes = VertexTableSplitter.split({\r\n indices: args.params.surface.indices,\r\n vertices: args.params.vertices,\r\n featureTable: args.featureTable,\r\n atlasInfo,\r\n }, args.computeNodeId);\r\n\r\n const edges = args.params.edges ? splitEdges(args.params.edges, nodes, args.maxDimension) : undefined;\r\n\r\n for (const [id, node] of nodes) {\r\n const { vertices, indices, material } = node.buildOutput(args.maxDimension);\r\n const params: MeshParams = {\r\n vertices,\r\n surface: {\r\n type: args.params.surface.type,\r\n indices,\r\n fillFlags: args.params.surface.fillFlags,\r\n hasBakedLighting: args.params.surface.hasBakedLighting,\r\n textureMapping: args.params.surface.textureMapping,\r\n material: material !== undefined ? material : args.params.surface.material,\r\n },\r\n edges: edges?.get(id),\r\n isPlanar: args.params.isPlanar,\r\n // ###TODO handle aux channels.......\r\n auxChannels: args.params.auxChannels,\r\n };\r\n\r\n result.set(id, params);\r\n }\r\n\r\n return result;\r\n}\r\n\r\n/** @internal */\r\nexport interface SplitPolylineArgs extends SplitVertexTableArgs {\r\n params: PolylineParams;\r\n}\r\n\r\ninterface PolylineNode extends Node {\r\n prevIndices?: IndexBuffer;\r\n nextIndicesAndParams?: Uint32ArrayBuilder;\r\n}\r\n\r\n/** @internal */\r\nexport function splitPolylineParams(args: SplitPolylineArgs): Map<number, PolylineParams> {\r\n const nodes = VertexTableSplitter.split({\r\n indices: args.params.polyline.indices,\r\n vertices: args.params.vertices,\r\n featureTable: args.featureTable,\r\n }, args.computeNodeId) as Map<number, PolylineNode>;\r\n\r\n const src = args.params.polyline;\r\n const srcNextAndParam = new Uint32Array(src.nextIndicesAndParams.buffer, src.nextIndicesAndParams.byteOffset, src.nextIndicesAndParams.length / 4);\r\n let curIndexIndex = 0;\r\n const remappedIndex = { } as unknown as RemappedIndex;\r\n for (const prevIndex of src.prevIndices) {\r\n if (remapIndex(remappedIndex, prevIndex, nodes)) {\r\n const node = remappedIndex.node as PolylineNode;\r\n if (!node.prevIndices) {\r\n assert(undefined === node.nextIndicesAndParams);\r\n node.prevIndices = new IndexBuffer(node.indices.numIndices);\r\n node.nextIndicesAndParams = new Uint32ArrayBuilder({ initialCapacity: node.indices.numIndices });\r\n } else {\r\n assert(undefined !== node.nextIndicesAndParams);\r\n }\r\n\r\n node.prevIndices.push(remappedIndex.index);\r\n\r\n let nextAndParam = srcNextAndParam[curIndexIndex];\r\n const nextIndex = (nextAndParam & 0x00ffffff) >>> 0;\r\n const newNextIndex = remappedIndex.node.remappedIndices.get(nextIndex);\r\n assert(undefined !== newNextIndex);\r\n nextAndParam = (nextAndParam & 0xff000000) | newNextIndex;\r\n node.nextIndicesAndParams.push(nextAndParam);\r\n }\r\n\r\n ++curIndexIndex;\r\n }\r\n\r\n const result = new Map<number, PolylineParams>();\r\n for (const [id, node] of nodes) {\r\n assert(undefined !== node.prevIndices && undefined !== node.nextIndicesAndParams);\r\n const { vertices, indices } = node.buildOutput(args.maxDimension);\r\n const params: PolylineParams = {\r\n ...args.params,\r\n vertices,\r\n polyline: {\r\n indices,\r\n prevIndices: node.prevIndices.toVertexIndices(),\r\n nextIndicesAndParams: node.nextIndicesAndParams.toUint8Array(),\r\n },\r\n };\r\n\r\n result.set(id, params);\r\n }\r\n\r\n return result;\r\n}\r\n"]}
1
+ {"version":3,"file":"VertexTableSplitter.js","sourceRoot":"","sources":["../../../../../src/common/render/primitives/VertexTableSplitter.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAoF;AACpF,oDAAkF;AAClF,6CAAkG;AAClG,+CAA+D;AAC/D,mDAAgD;AAChD,mDAAyE;AAazE;;;GAGG;AACH,MAAa,WAAW;IAKtB,YAAmB,eAAe,GAAG,CAAC;QAHrB,aAAQ,GAAG,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC;QAC9B,YAAO,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QAGpE,IAAI,CAAC,QAAQ,GAAG,IAAI,gCAAiB,CAAC,EAAE,eAAe,EAAE,eAAe,GAAG,CAAC,EAAE,CAAC,CAAC;IAClF,CAAC;IAED,IAAW,UAAU;QACnB,IAAA,qBAAM,EAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;QACzC,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;IAClC,CAAC;IAE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CAAC,CAAC;YAClD,MAAM,SAAS,GAAG,CAAC,YAAY,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;YACpD,MAAM,YAAY,GAAG,aAAa,CAAC,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;YACvE,IAAA,qBAAM,EAAC,SAAS,KAAK,YAAY,CAAC,CAAC;YACnC,YAAY,GAAG,CAAC,YAAY,GAAG,UAAU,CAAC,GAAG,YAAY,CAAC;YAC1D,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;SAC9C;QAED,EAAE,aAAa,CAAC;KACjB;IAED,MAAM,MAAM,GAAG,IAAI,GAAG,EAA0B,CAAC;IACjD,KAAK,MAAM,CAAC,EAAE,EAAE,IAAI,CAAC,IAAI,KAAK,EAAE;QAC9B,IAAA,qBAAM,EAAC,SAAS,KAAK,IAAI,CAAC,WAAW,IAAI,SAAS,KAAK,IAAI,CAAC,oBAAoB,CAAC,CAAC;QAClF,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAClE,MAAM,MAAM,GAAmB;YAC7B,GAAG,IAAI,CAAC,MAAM;YACd,QAAQ;YACR,QAAQ,EAAE;gBACR,OAAO;gBACP,WAAW,EAAE,IAAI,CAAC,WAAW,CAAC,eAAe,EAAE;gBAC/C,oBAAoB,EAAE,IAAI,CAAC,oBAAoB,CAAC,YAAY,EAAE;aAC/D;SACF,CAAC;QAEF,MAAM,CAAC,GAAG,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;KACxB;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AArDD,kDAqDC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Rendering\r\n */\r\n\r\nimport { assert, Uint32ArrayBuilder, Uint8ArrayBuilder } from \"@itwin/core-bentley\";\r\nimport { ColorDef, RenderFeatureTable, RenderMaterial } from \"@itwin/core-common\";\r\nimport { calculateEdgeTableParams, EdgeParams, EdgeTable, IndexedEdgeParams } from \"./EdgeParams\";\r\nimport { computeDimensions, VertexTable } from \"./VertexTable\";\r\nimport { VertexIndices } from \"./VertexIndices\";\r\nimport { createSurfaceMaterial, SurfaceMaterial } from \"./SurfaceParams\";\r\nimport { MaterialParams } from \"../MaterialParams\";\r\nimport { MeshParams } from \"./MeshParams\";\r\nimport { PointStringParams } from \"./PointStringParams\";\r\nimport { PolylineParams, TesselatedPolyline } from \"./PolylineParams\";\r\n\r\n/** @internal */\r\nexport interface VertexTableWithIndices {\r\n vertices: VertexTable;\r\n indices: VertexIndices;\r\n material?: SurfaceMaterial;\r\n}\r\n\r\n/** Builds up a [[VertexIndices]].\r\n * Exported strictly for tests.\r\n * @internal\r\n */\r\nexport class IndexBuffer {\r\n private readonly _builder: Uint8ArrayBuilder;\r\n private readonly _index32 = new Uint32Array(1);\r\n private readonly _index8 = new Uint8Array(this._index32.buffer, 0, 3);\r\n\r\n public constructor(initialCapacity = 3) {\r\n this._builder = new Uint8ArrayBuilder({ initialCapacity: initialCapacity * 3 });\r\n }\r\n\r\n public get numIndices(): number {\r\n assert((this._builder.length % 3) === 0);\r\n return this._builder.length / 3;\r\n }\r\n\r\n public push(index: number): void {\r\n this._index32[0] = index;\r\n this._builder.append(this._index8);\r\n }\r\n\r\n public toVertexIndices(): VertexIndices {\r\n return new VertexIndices(this._builder.toTypedArray());\r\n }\r\n}\r\n\r\n/** Builds up a [[VertexTable]]. */\r\nclass VertexBuffer {\r\n private readonly _builder: Uint32ArrayBuilder;\r\n private readonly _source: VertexTable;\r\n\r\n /** `source` is the original table containing the vertex data from which individual vertices will be obtained. */\r\n public constructor(source: VertexTable) {\r\n this._source = source;\r\n this._builder = new Uint32ArrayBuilder({ initialCapacity: 3 * source.numRgbaPerVertex });\r\n }\r\n\r\n /** The number of vertices currently in the table. */\r\n public get length(): number {\r\n assert((this._builder.length % this.vertexSize) === 0);\r\n return this._builder.length / this.vertexSize;\r\n }\r\n\r\n /** The number of 32-bit unsigned integers (RGBA values) per vertex. */\r\n public get vertexSize(): number {\r\n return this._source.numRgbaPerVertex;\r\n }\r\n\r\n /** Append a vertex. `vertex` must be of size [[vertexSize]]. */\r\n public push(vertex: Uint32Array): void {\r\n assert(vertex.length === this.vertexSize);\r\n this._builder.append(vertex);\r\n }\r\n\r\n /** Construct the finished vertex table. */\r\n public buildVertexTable(maxDimension: number, colorTable: ColorTable | undefined, materialAtlasTable: MaterialAtlasTable): VertexTable {\r\n const source = this._source;\r\n colorTable = colorTable ?? source.uniformColor;\r\n assert(undefined !== colorTable);\r\n\r\n const colorTableLength = colorTable instanceof Uint32Array ? colorTable.length : 0;\r\n const materialAtlasTableLength = materialAtlasTable instanceof Uint32Array ? materialAtlasTable.length : 0;\r\n const dimensions = computeDimensions(this.length, this.vertexSize, colorTableLength + materialAtlasTableLength, maxDimension);\r\n\r\n let rgbaData = this._builder.toTypedArray();\r\n if (dimensions.width * dimensions.height > rgbaData.length) {\r\n const prevData = rgbaData;\r\n rgbaData = new Uint32Array(dimensions.width * dimensions.height);\r\n rgbaData.set(prevData, 0);\r\n }\r\n\r\n let tableSize = this.vertexSize * this.length;\r\n if (colorTable instanceof Uint32Array) {\r\n rgbaData.set(colorTable, tableSize);\r\n tableSize += colorTable.length;\r\n }\r\n\r\n if (materialAtlasTable instanceof Uint32Array)\r\n rgbaData.set(materialAtlasTable, tableSize);\r\n\r\n return {\r\n data: new Uint8Array(rgbaData.buffer, rgbaData.byteOffset, rgbaData.byteLength),\r\n usesUnquantizedPositions: source.usesUnquantizedPositions,\r\n qparams: source.qparams,\r\n width: dimensions.width,\r\n height: dimensions.height,\r\n hasTranslucency: source.hasTranslucency,\r\n uniformColor: colorTable instanceof ColorDef ? colorTable : undefined,\r\n featureIndexType: source.featureIndexType,\r\n uniformFeatureID: source.uniformFeatureID,\r\n numVertices: this.length,\r\n numRgbaPerVertex: source.numRgbaPerVertex,\r\n uvParams: source.uvParams,\r\n };\r\n }\r\n}\r\n\r\ntype ColorTable = Uint32Array | ColorDef;\r\n\r\n/** Remaps portions of a source color table into a filtered target color table. */\r\nclass ColorTableRemapper {\r\n private readonly _remappedIndices = new Map<number, number>();\r\n private readonly _colorTable: Uint32Array;\r\n public readonly colors: number[] = [];\r\n private readonly _32 = new Uint32Array(1);\r\n private readonly _16 = new Uint16Array(this._32.buffer);\r\n\r\n public constructor(colorTable: Uint32Array) {\r\n this._colorTable = colorTable;\r\n }\r\n\r\n /** Extract the color index stored in `vertex`, ensure it is present in the remapped color table, and return its index in that table. */\r\n public remap(vertex: Uint32Array, usesUnquantizedPositions: boolean | undefined): void {\r\n const vertIndex = usesUnquantizedPositions ? 4 : 1;\r\n const shortIndex = usesUnquantizedPositions ? 0 : 1;\r\n this._32[0] = vertex[vertIndex];\r\n const oldIndex = this._16[shortIndex];\r\n let newIndex = this._remappedIndices.get(oldIndex);\r\n if (undefined === newIndex) {\r\n newIndex = this.colors.length;\r\n this._remappedIndices.set(oldIndex, newIndex);\r\n const color = this._colorTable[oldIndex];\r\n this.colors.push(color);\r\n }\r\n\r\n this._16[shortIndex] = newIndex;\r\n vertex[vertIndex] = this._32[0];\r\n }\r\n\r\n /** Construct the finished color table. */\r\n public buildColorTable(): ColorTable {\r\n assert(this.colors.length > 0);\r\n return this.colors.length > 1 ? new Uint32Array(this.colors) : ColorDef.fromAbgr(this.colors[0]);\r\n }\r\n}\r\n\r\ntype MaterialAtlasTable = Uint32Array | SurfaceMaterial | undefined;\r\n\r\ntype CreateRenderMaterial = (args: MaterialParams) => RenderMaterial | undefined;\r\n\r\nclass MaterialAtlasRemapper {\r\n private readonly _remappedIndices = new Map<number, number>();\r\n private readonly _atlasTable: Uint32Array;\r\n private readonly _createMaterial: CreateRenderMaterial;\r\n public readonly materials: number[] = [];\r\n private readonly _32 = new Uint32Array(1);\r\n private readonly _8 = new Uint8Array(this._32.buffer);\r\n\r\n public constructor(_atlasTable: Uint32Array, createMaterial: CreateRenderMaterial) {\r\n this._atlasTable = _atlasTable;\r\n this._createMaterial = createMaterial;\r\n }\r\n\r\n /** Extract the mat index stored in `vertex`, ensure it is present in the remapped atlas table, and return its index in that table. */\r\n public remap(vertex: Uint32Array, usesUnquantizedPositions: boolean | undefined): void {\r\n const vertIndex = usesUnquantizedPositions ? 3 : 2;\r\n this._32[0] = vertex[vertIndex];\r\n const oldIndex = this._8[3];\r\n let newIndex = this._remappedIndices.get(oldIndex);\r\n if (undefined === newIndex) {\r\n newIndex = this.materials.length / 4;\r\n this._remappedIndices.set(oldIndex, newIndex);\r\n let index = oldIndex * 4;\r\n this.materials.push(this._atlasTable[index++]);\r\n this.materials.push(this._atlasTable[index++]);\r\n this.materials.push(this._atlasTable[index++]);\r\n this.materials.push(this._atlasTable[index]);\r\n }\r\n\r\n this._8[3] = newIndex;\r\n vertex[vertIndex] = this._32[0];\r\n }\r\n\r\n private unpackFloat(value: number): number {\r\n this._32[0] = value;\r\n const valUint32 = this._32[0];\r\n const bias = 38.0;\r\n const temp = (valUint32 >>> 24) / 2.0;\r\n let exponent = Math.floor(temp);\r\n let sign = (temp - exponent) * 2.0;\r\n sign = -(sign * 2.0 - 1.0);\r\n const base = sign * (valUint32 & 0xffffff) / 16777216.0;\r\n exponent = exponent - bias;\r\n return base * Math.pow(10.0, exponent);\r\n }\r\n\r\n private materialFromAtlasEntry(entry: Uint32Array): SurfaceMaterial | undefined {\r\n const rgbOverridden = (entry[1] & 0x1000000) !== 0;\r\n const alphaOverridden = (entry[1] & 0x2000000) !== 0;\r\n const args: MaterialParams = {\r\n alpha: alphaOverridden ? (entry[0] >>> 24) / 255.0 : undefined,\r\n diffuse: {\r\n color: rgbOverridden ? ColorDef.fromTbgr(entry[0] & 0xffffff) : undefined,\r\n weight: (entry[1] >>> 8) / 255.0,\r\n },\r\n specular: {\r\n color: ColorDef.fromTbgr(entry[2]),\r\n weight: ((entry[1] >>> 16) & 0xff) / 255.0,\r\n exponent: this.unpackFloat(entry[3]),\r\n },\r\n };\r\n\r\n const material = this._createMaterial(args);\r\n return createSurfaceMaterial(material);\r\n }\r\n\r\n /** Construct the finished color table. */\r\n public buildAtlasTable(): MaterialAtlasTable {\r\n assert(this.materials.length > 0);\r\n const m = new Uint32Array(this.materials);\r\n return this.materials.length > 4 ? m : this.materialFromAtlasEntry(m);\r\n }\r\n}\r\n\r\n/** A node in a split vertex table. Each node corresponds to one or more elements. */\r\nclass Node {\r\n public readonly vertices: VertexBuffer;\r\n public readonly remappedIndices = new Map<number, number>();\r\n public readonly indices = new IndexBuffer();\r\n public readonly colors?: ColorTableRemapper;\r\n public readonly atlas?: MaterialAtlasRemapper;\r\n public readonly usesUnquantizedPositions?: boolean;\r\n\r\n /** `vertexTable` is the source table containing vertex data for all nodes, from which this node will extract the vertices belong to it. */\r\n public constructor(vertexTable: VertexTable, atlas?: AtlasInfo) {\r\n this.vertices = new VertexBuffer(vertexTable);\r\n if (undefined === vertexTable.uniformColor)\r\n this.colors = new ColorTableRemapper(new Uint32Array(vertexTable.data.buffer, vertexTable.data.byteOffset + 4 * vertexTable.numVertices * vertexTable.numRgbaPerVertex));\r\n\r\n if (atlas) {\r\n const atlasOffset = (vertexTable.numVertices * vertexTable.numRgbaPerVertex + atlas.offset) * 4;\r\n this.atlas = new MaterialAtlasRemapper(new Uint32Array(vertexTable.data.buffer, vertexTable.data.byteOffset + atlasOffset), atlas.createMaterial);\r\n }\r\n\r\n this.usesUnquantizedPositions = vertexTable.usesUnquantizedPositions;\r\n }\r\n\r\n public addVertex(originalIndex: number, vertex: Uint32Array): void {\r\n let newIndex = this.remappedIndices.get(originalIndex);\r\n if (undefined === newIndex) {\r\n newIndex = this.vertices.length;\r\n this.remappedIndices.set(originalIndex, newIndex);\r\n\r\n this.colors?.remap(vertex, this.usesUnquantizedPositions);\r\n this.atlas?.remap(vertex, this.usesUnquantizedPositions);\r\n this.vertices.push(vertex);\r\n }\r\n\r\n this.indices.push(newIndex);\r\n }\r\n\r\n public buildOutput(maxDimension: number): VertexTableWithIndices {\r\n const materialAtlas = this.atlas?.buildAtlasTable();\r\n const material: SurfaceMaterial | undefined = (materialAtlas instanceof Uint32Array) ? undefined : materialAtlas;\r\n return {\r\n indices: this.indices.toVertexIndices(),\r\n vertices: this.vertices.buildVertexTable(maxDimension, this.colors?.buildColorTable(), materialAtlas),\r\n material,\r\n };\r\n }\r\n}\r\n\r\ninterface AtlasInfo {\r\n offset: number;\r\n createMaterial: CreateRenderMaterial;\r\n}\r\n\r\ninterface VertexTableSplitArgs extends VertexTableWithIndices {\r\n featureTable: RenderFeatureTable;\r\n atlasInfo?: AtlasInfo;\r\n}\r\n\r\n/** @internal */\r\nexport type ComputeAnimationNodeId = (featureIndex: number) => number;\r\n\r\nclass VertexTableSplitter {\r\n private readonly _input: VertexTableSplitArgs;\r\n private readonly _computeNodeId: ComputeAnimationNodeId;\r\n private readonly _nodes = new Map<number, Node>();\r\n\r\n private constructor(input: VertexTableSplitArgs, computeNodeId: ComputeAnimationNodeId) {\r\n this._input = input;\r\n this._computeNodeId = computeNodeId;\r\n }\r\n\r\n /** Split the source into one or more output nodes, returning a mapping of integer node Id to node. */\r\n public static split(source: VertexTableSplitArgs, computeNodeId: ComputeAnimationNodeId): Map<number, Node> {\r\n const splitter = new VertexTableSplitter(source, computeNodeId);\r\n splitter.split();\r\n return splitter._nodes;\r\n }\r\n\r\n private split(): void {\r\n // Track the most recent feature and corresponding node to avoid repeated lookups - vertices for\r\n // individual features are largely contiguous.\r\n const curState = {\r\n featureIndex: -1,\r\n node: undefined as unknown as Node,\r\n };\r\n\r\n const vertSize = this._input.vertices.numRgbaPerVertex;\r\n const vertex = new Uint32Array(vertSize);\r\n const vertexTable = new Uint32Array(this._input.vertices.data.buffer, this._input.vertices.data.byteOffset, this._input.vertices.numVertices * vertSize);\r\n\r\n for (const index of this._input.indices) {\r\n // Extract the data for this vertex without allocating new typed arrays.\r\n const vertexOffset = index * vertSize;\r\n for (let i = 0; i < vertex.length; i++)\r\n vertex[i] = vertexTable[vertexOffset + i];\r\n\r\n // Determine to which element the vertex belongs and find the corresponding Node.\r\n const featureIndex = vertex[2] & 0x00ffffff;\r\n if (curState.featureIndex !== featureIndex) {\r\n curState.featureIndex = featureIndex;\r\n const nodeId = this._computeNodeId(featureIndex);\r\n let node = this._nodes.get(nodeId);\r\n if (undefined === node)\r\n this._nodes.set(nodeId, node = new Node(this._input.vertices, this._input.atlasInfo));\r\n\r\n curState.node = node;\r\n }\r\n\r\n // Add the vertex to the appropriate node.\r\n curState.node.addVertex(index, vertex);\r\n }\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport interface SplitVertexTableArgs {\r\n featureTable: RenderFeatureTable;\r\n maxDimension: number;\r\n computeNodeId: ComputeAnimationNodeId;\r\n}\r\n\r\n/** @internal */\r\nexport interface SplitPointStringArgs extends SplitVertexTableArgs {\r\n params: PointStringParams;\r\n}\r\n\r\n/** Given a PointStringParams and a function that can associate a node Id with an element Id, produce a mapping of nodes to PointStringParams, splitting up\r\n * the input params as needed.\r\n * @internal\r\n */\r\nexport function splitPointStringParams(args: SplitPointStringArgs): Map<number, PointStringParams> {\r\n const nodes = VertexTableSplitter.split({\r\n indices: args.params.indices,\r\n vertices: args.params.vertices,\r\n featureTable: args.featureTable,\r\n }, args.computeNodeId);\r\n\r\n const result = new Map<number, PointStringParams>();\r\n for (const [id, node] of nodes) {\r\n const { vertices, indices } = node.buildOutput(args.maxDimension);\r\n result.set(id, { vertices, indices, weight: args.params.weight });\r\n }\r\n\r\n return result;\r\n}\r\n\r\ninterface RemappedSegmentEdges {\r\n indices: IndexBuffer;\r\n endPointAndQuadIndices: Uint32ArrayBuilder;\r\n}\r\n\r\ninterface RemappedSilhouetteEdges extends RemappedSegmentEdges {\r\n normalPairs: Uint32ArrayBuilder;\r\n}\r\n\r\nclass RemappedPolylineEdges {\r\n public readonly indices = new IndexBuffer();\r\n public readonly prevIndices = new IndexBuffer();\r\n public readonly nextIndicesAndParams = new Uint32ArrayBuilder();\r\n}\r\n\r\ninterface RemappedIndexEdges {\r\n edges: Uint8ArrayBuilder;\r\n silhouettes: Uint8ArrayBuilder;\r\n}\r\n\r\ninterface RemappedEdges {\r\n segments?: RemappedSegmentEdges;\r\n silhouettes?: RemappedSilhouetteEdges;\r\n polylines?: RemappedPolylineEdges;\r\n indexed?: RemappedIndexEdges;\r\n}\r\n\r\ninterface RemappedIndex {\r\n node: Node;\r\n id: number;\r\n index: number;\r\n}\r\n\r\nfunction remapIndex(out: RemappedIndex, srcIndex: number, nodes: Map<number, Node>): boolean {\r\n for (const [id, node] of nodes) {\r\n const index = node.remappedIndices.get(srcIndex);\r\n if (undefined !== index) {\r\n out.index = index;\r\n out.node = node;\r\n out.id = id;\r\n return true;\r\n }\r\n }\r\n\r\n assert(false);\r\n return false;\r\n}\r\n\r\nfunction remapSegmentEdges(type: \"segments\" | \"silhouettes\", source: EdgeParams, nodes: Map<number, Node>, edges: Map<number, RemappedEdges>): void {\r\n const src = source[type];\r\n if (!src)\r\n return;\r\n\r\n const srcEndPts = new Uint32Array(src.endPointAndQuadIndices.buffer, src.endPointAndQuadIndices.byteOffset, src.endPointAndQuadIndices.length / 4);\r\n let srcNormalPairs;\r\n if (type === \"silhouettes\") {\r\n assert(undefined !== source.silhouettes);\r\n srcNormalPairs = new Uint32Array(source.silhouettes.normalPairs.buffer, source.silhouettes.normalPairs.byteOffset, source.silhouettes.normalPairs.length / 4);\r\n }\r\n\r\n let curIndexIndex = 0;\r\n const remappedIndex = { } as unknown as RemappedIndex;\r\n for (const srcIndex of src.indices) {\r\n if (remapIndex(remappedIndex, srcIndex, nodes)) {\r\n let endPointAndQuad = srcEndPts[curIndexIndex];\r\n const otherIndex = (endPointAndQuad & 0x00ffffff) >>> 0;\r\n const newOtherIndex = remappedIndex.node.remappedIndices.get(otherIndex);\r\n assert(undefined !== newOtherIndex);\r\n endPointAndQuad = (endPointAndQuad & 0xff000000) | newOtherIndex;\r\n\r\n let entry = edges.get(remappedIndex.id);\r\n if (!entry)\r\n edges.set(remappedIndex.id, entry = { });\r\n\r\n if (srcNormalPairs) {\r\n if (!entry.silhouettes)\r\n entry.silhouettes = { indices: new IndexBuffer(), endPointAndQuadIndices: new Uint32ArrayBuilder(), normalPairs: new Uint32ArrayBuilder() };\r\n\r\n entry.silhouettes.normalPairs.push(srcNormalPairs[curIndexIndex]);\r\n } else if (!entry.segments) {\r\n entry.segments = { indices: new IndexBuffer(), endPointAndQuadIndices: new Uint32ArrayBuilder() };\r\n }\r\n\r\n const segments = entry[type];\r\n assert(undefined !== segments);\r\n\r\n segments.indices.push(remappedIndex.index);\r\n segments.endPointAndQuadIndices.push(endPointAndQuad);\r\n }\r\n\r\n ++curIndexIndex;\r\n }\r\n}\r\n\r\nfunction remapPolylineEdges(src: TesselatedPolyline, nodes: Map<number, Node>, edges: Map<number, RemappedEdges>): void {\r\n const srcNextAndParam = new Uint32Array(src.nextIndicesAndParams.buffer, src.nextIndicesAndParams.byteOffset, src.nextIndicesAndParams.length / 4);\r\n const prevIter = src.prevIndices[Symbol.iterator]();\r\n let curIndexIndex = 0;\r\n const remappedIndex = { } as unknown as RemappedIndex;\r\n for (const srcIndex of src.indices) {\r\n if (remapIndex(remappedIndex, srcIndex, nodes)) {\r\n const prevIndex = prevIter.next().value;\r\n assert(undefined !== prevIndex);\r\n const newPrevIndex = remappedIndex.node.remappedIndices.get(prevIndex);\r\n assert(undefined !== newPrevIndex);\r\n\r\n let nextAndParam = srcNextAndParam[curIndexIndex];\r\n const nextIndex = (nextAndParam & 0x00ffffff) >>> 0;\r\n const newNextIndex = remappedIndex.node.remappedIndices.get(nextIndex);\r\n assert(undefined !== newNextIndex);\r\n nextAndParam = (nextAndParam & 0xff000000) | newNextIndex;\r\n\r\n let entry = edges.get(remappedIndex.id);\r\n if (!entry)\r\n edges.set(remappedIndex.id, entry = { });\r\n\r\n if (!entry.polylines)\r\n entry.polylines = new RemappedPolylineEdges();\r\n\r\n entry.polylines.indices.push(remappedIndex.index);\r\n entry.polylines.prevIndices.push(newPrevIndex);\r\n entry.polylines.nextIndicesAndParams.push(nextAndParam);\r\n }\r\n\r\n ++curIndexIndex;\r\n }\r\n}\r\n\r\nfunction remapIndexedEdges(src: IndexedEdgeParams, nodes: Map<number, Node>, edges: Map<number, RemappedEdges>): void {\r\n const srcEdgeData = src.edges.data;\r\n const numSegments = src.edges.numSegments;\r\n const silhouetteStartByteIndex = numSegments * 6 + src.edges.silhouettePadding;\r\n\r\n function getUint24EdgePair(byteIndex: number): [number, number] {\r\n return [srcEdgeData[byteIndex + 0] | (srcEdgeData[byteIndex + 1] << 8) | srcEdgeData[byteIndex + 2] << 16,\r\n srcEdgeData[byteIndex + 3] | (srcEdgeData[byteIndex + 4] << 8) | srcEdgeData[byteIndex + 5] << 16];\r\n }\r\n\r\n function setUint24EdgePair(indEdges: RemappedIndexEdges, value1: number, value2: number): void {\r\n indEdges.edges.push(value1 & 0x0000ff);\r\n indEdges.edges.push((value1 & 0x00ff00) >>> 8);\r\n indEdges.edges.push((value1 & 0xff0000) >>> 16);\r\n indEdges.edges.push(value2 & 0x0000ff);\r\n indEdges.edges.push((value2 & 0x00ff00) >>> 8);\r\n indEdges.edges.push((value2 & 0xff0000) >>> 16);\r\n }\r\n\r\n function getUint24SilPair(byteIndex: number): [number, number, number, number] {\r\n return [srcEdgeData[byteIndex + 0] | (srcEdgeData[byteIndex + 1] << 8) | srcEdgeData[byteIndex + 2] << 16,\r\n srcEdgeData[byteIndex + 3] | (srcEdgeData[byteIndex + 4] << 8) | srcEdgeData[byteIndex + 5] << 16,\r\n srcEdgeData[byteIndex + 6] | (srcEdgeData[byteIndex + 7] << 8), srcEdgeData[byteIndex + 8] | (srcEdgeData[byteIndex + 9] << 8)];\r\n }\r\n\r\n function setUint24SilPair(indSil: RemappedIndexEdges, value1: number, value2: number, norm1: number, norm2: number): void {\r\n indSil.silhouettes.push(value1 & 0x0000ff);\r\n indSil.silhouettes.push((value1 & 0x00ff00) >>> 8);\r\n indSil.silhouettes.push((value1 & 0xff0000) >>> 16);\r\n indSil.silhouettes.push(value2 & 0x0000ff);\r\n indSil.silhouettes.push((value2 & 0x00ff00) >>> 8);\r\n indSil.silhouettes.push((value2 & 0xff0000) >>> 16);\r\n indSil.silhouettes.push(norm1 & 0x0000ff);\r\n indSil.silhouettes.push((norm1 & 0x00ff00) >>> 8);\r\n indSil.silhouettes.push(norm2 & 0x0000ff);\r\n indSil.silhouettes.push((norm2 & 0x00ff00) >>> 8);\r\n }\r\n\r\n let maxIndex = 0;\r\n for (const srcIndex of src.indices)\r\n maxIndex = Math.max (srcIndex, maxIndex);\r\n\r\n const remappedIndex = { } as unknown as RemappedIndex;\r\n let es1Index = 0, es2Index = 0, n1 = 0, n2 = 0;\r\n for (let curSegment = 0, byteIndex = 0; curSegment <= maxIndex; ++curSegment) {\r\n if (curSegment < numSegments) { // edges\r\n [es1Index, es2Index] = getUint24EdgePair(byteIndex);\r\n byteIndex += 6;\r\n } else { // silhouettes\r\n byteIndex = silhouetteStartByteIndex + (curSegment - numSegments) * 10;\r\n [es1Index, es2Index, n1, n2] = getUint24SilPair(byteIndex);\r\n }\r\n\r\n if (remapIndex(remappedIndex, es1Index, nodes)) {\r\n let entry = edges.get(remappedIndex.id);\r\n if (!entry)\r\n edges.set(remappedIndex.id, entry = { });\r\n\r\n if (!entry.indexed)\r\n entry.indexed = { edges: new Uint8ArrayBuilder(), silhouettes: new Uint8ArrayBuilder() };\r\n\r\n if (curSegment < numSegments) { // edges\r\n const newE1Index = remappedIndex.node.remappedIndices.get(es1Index);\r\n assert(undefined !== newE1Index);\r\n const newE2Index = remappedIndex.node.remappedIndices.get(es2Index);\r\n assert(undefined !== newE2Index);\r\n setUint24EdgePair(entry.indexed, newE1Index, newE2Index);\r\n } else { // silhouettes\r\n const newS1Index = remappedIndex.node.remappedIndices.get(es1Index);\r\n assert(undefined !== newS1Index);\r\n const newS2Index = remappedIndex.node.remappedIndices.get(es2Index);\r\n assert(undefined !== newS2Index);\r\n setUint24SilPair(entry.indexed, newS1Index, newS2Index, n1, n2);\r\n }\r\n }\r\n }\r\n}\r\n\r\nfunction splitEdges(source: EdgeParams, nodes: Map<number, Node>, maxDimension: number): Map<number, EdgeParams> {\r\n const edges = new Map<number, RemappedEdges>();\r\n remapSegmentEdges(\"segments\", source, nodes, edges);\r\n remapSegmentEdges(\"silhouettes\", source, nodes, edges);\r\n\r\n if (source.polylines)\r\n remapPolylineEdges(source.polylines, nodes, edges);\r\n\r\n if (source.indexed)\r\n remapIndexedEdges(source.indexed, nodes, edges);\r\n\r\n const result = new Map<number, EdgeParams>();\r\n for (const [id, remappedEdges] of edges) {\r\n if (!remappedEdges.segments && !remappedEdges.silhouettes && !remappedEdges.indexed)\r\n continue;\r\n\r\n let edgeTable = { } as unknown as EdgeTable;\r\n let edgeIndices = { } as unknown as VertexIndices;\r\n if (remappedEdges.indexed) {\r\n const numSegmentEdges = remappedEdges.indexed.edges.length / 6;\r\n const numSilhouettes = remappedEdges.indexed.silhouettes.length / 10;\r\n const { width, height, silhouettePadding, silhouetteStartByteIndex } = calculateEdgeTableParams(numSegmentEdges, numSilhouettes, maxDimension);\r\n const data = new Uint8Array(width * height * 4);\r\n data.set(remappedEdges.indexed.edges.toTypedArray(), 0);\r\n if (numSilhouettes > 0)\r\n data.set(remappedEdges.indexed.silhouettes.toTypedArray(), silhouetteStartByteIndex + silhouettePadding);\r\n\r\n const numTotalEdges = numSegmentEdges + numSilhouettes;\r\n edgeIndices = new VertexIndices(new Uint8Array(numTotalEdges * 6 * 3));\r\n for (let i = 0; i < numTotalEdges; i++)\r\n for (let j = 0; j < 6; j++)\r\n edgeIndices.setNthIndex(i * 6 + j, i);\r\n\r\n edgeTable = {\r\n data,\r\n width,\r\n height,\r\n numSegments: numSegmentEdges,\r\n silhouettePadding,\r\n };\r\n }\r\n\r\n result.set(id, {\r\n weight: source.weight,\r\n linePixels: source.linePixels,\r\n segments: remappedEdges.segments ? {\r\n indices: remappedEdges.segments.indices.toVertexIndices(),\r\n endPointAndQuadIndices: remappedEdges.segments.endPointAndQuadIndices.toUint8Array(),\r\n } : undefined,\r\n silhouettes: remappedEdges.silhouettes ? {\r\n indices: remappedEdges.silhouettes.indices.toVertexIndices(),\r\n endPointAndQuadIndices: remappedEdges.silhouettes.endPointAndQuadIndices.toUint8Array(),\r\n normalPairs: remappedEdges.silhouettes.normalPairs.toUint8Array(),\r\n } : undefined,\r\n polylines: remappedEdges.polylines ? {\r\n indices: remappedEdges.polylines.indices.toVertexIndices(),\r\n prevIndices: remappedEdges.polylines.prevIndices.toVertexIndices(),\r\n nextIndicesAndParams: remappedEdges.polylines.nextIndicesAndParams.toUint8Array(),\r\n } : undefined,\r\n indexed: remappedEdges.indexed ? {\r\n indices: edgeIndices,\r\n edges: edgeTable,\r\n } : undefined,\r\n });\r\n }\r\n\r\n return result;\r\n}\r\n\r\n/** @internal */\r\nexport interface SplitMeshArgs extends SplitVertexTableArgs {\r\n params: MeshParams;\r\n createMaterial: CreateRenderMaterial;\r\n}\r\n\r\n/** @internal */\r\nexport function splitMeshParams(args: SplitMeshArgs): Map<number, MeshParams> {\r\n const result = new Map<number, MeshParams>();\r\n\r\n const mat = args.params.surface.material;\r\n const atlasOffset = undefined !== mat && mat.isAtlas ? mat.vertexTableOffset : undefined;\r\n const atlasInfo = undefined !== atlasOffset ? { offset: atlasOffset, createMaterial: args.createMaterial } : undefined;\r\n\r\n const nodes = VertexTableSplitter.split({\r\n indices: args.params.surface.indices,\r\n vertices: args.params.vertices,\r\n featureTable: args.featureTable,\r\n atlasInfo,\r\n }, args.computeNodeId);\r\n\r\n const edges = args.params.edges ? splitEdges(args.params.edges, nodes, args.maxDimension) : undefined;\r\n\r\n for (const [id, node] of nodes) {\r\n const { vertices, indices, material } = node.buildOutput(args.maxDimension);\r\n const params: MeshParams = {\r\n vertices,\r\n surface: {\r\n type: args.params.surface.type,\r\n indices,\r\n fillFlags: args.params.surface.fillFlags,\r\n hasBakedLighting: args.params.surface.hasBakedLighting,\r\n textureMapping: args.params.surface.textureMapping,\r\n material: material !== undefined ? material : args.params.surface.material,\r\n },\r\n edges: edges?.get(id),\r\n isPlanar: args.params.isPlanar,\r\n // ###TODO handle aux channels.......\r\n auxChannels: args.params.auxChannels,\r\n };\r\n\r\n result.set(id, params);\r\n }\r\n\r\n return result;\r\n}\r\n\r\n/** @internal */\r\nexport interface SplitPolylineArgs extends SplitVertexTableArgs {\r\n params: PolylineParams;\r\n}\r\n\r\ninterface PolylineNode extends Node {\r\n prevIndices?: IndexBuffer;\r\n nextIndicesAndParams?: Uint32ArrayBuilder;\r\n}\r\n\r\n/** @internal */\r\nexport function splitPolylineParams(args: SplitPolylineArgs): Map<number, PolylineParams> {\r\n const nodes = VertexTableSplitter.split({\r\n indices: args.params.polyline.indices,\r\n vertices: args.params.vertices,\r\n featureTable: args.featureTable,\r\n }, args.computeNodeId) as Map<number, PolylineNode>;\r\n\r\n const src = args.params.polyline;\r\n const srcNextAndParam = new Uint32Array(src.nextIndicesAndParams.buffer, src.nextIndicesAndParams.byteOffset, src.nextIndicesAndParams.length / 4);\r\n let curIndexIndex = 0;\r\n const remappedIndex = { } as unknown as RemappedIndex;\r\n for (const prevIndex of src.prevIndices) {\r\n if (remapIndex(remappedIndex, prevIndex, nodes)) {\r\n const node = remappedIndex.node as PolylineNode;\r\n if (!node.prevIndices) {\r\n assert(undefined === node.nextIndicesAndParams);\r\n node.prevIndices = new IndexBuffer(node.indices.numIndices);\r\n node.nextIndicesAndParams = new Uint32ArrayBuilder({ initialCapacity: node.indices.numIndices });\r\n } else {\r\n assert(undefined !== node.nextIndicesAndParams);\r\n }\r\n\r\n node.prevIndices.push(remappedIndex.index);\r\n\r\n let nextAndParam = srcNextAndParam[curIndexIndex];\r\n const nextIndex = (nextAndParam & 0x00ffffff) >>> 0;\r\n const newNextIndex = remappedIndex.node.remappedIndices.get(nextIndex);\r\n assert(undefined !== newNextIndex);\r\n nextAndParam = (nextAndParam & 0xff000000) | newNextIndex;\r\n node.nextIndicesAndParams.push(nextAndParam);\r\n }\r\n\r\n ++curIndexIndex;\r\n }\r\n\r\n const result = new Map<number, PolylineParams>();\r\n for (const [id, node] of nodes) {\r\n assert(undefined !== node.prevIndices && undefined !== node.nextIndicesAndParams);\r\n const { vertices, indices } = node.buildOutput(args.maxDimension);\r\n const params: PolylineParams = {\r\n ...args.params,\r\n vertices,\r\n polyline: {\r\n indices,\r\n prevIndices: node.prevIndices.toVertexIndices(),\r\n nextIndicesAndParams: node.nextIndicesAndParams.toUint8Array(),\r\n },\r\n };\r\n\r\n result.set(id, params);\r\n }\r\n\r\n return result;\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"PrimaryTileTree.d.ts","sourceRoot":"","sources":["../../../src/tile/PrimaryTileTree.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAC6C,UAAU,EAC7D,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACmD,yBAAyB,EAAE,UAAU,EAA4B,gBAAgB,EAAE,qBAAqB,EAChK,iBAAiB,EAAc,cAAc,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,mBAAmB,EACzG,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAW,qBAAqB,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjF,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAyB,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAG3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE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7D,cAAc,CAAC,QAAQ,EAAE,UAAU,GAAG,UAAU,EAAE,GAAG,SAAS,EAAE,WAAW,EAAE,OAAO,GAAG,SAAS,EAAE,IAAI,EAAE,KAAK,GAAG,UAAU,GAAG,SAAS,GAAG,SAAS,GAAG,MAAM,EAAE,GAAG,IAAI,CAAC;IACrK,6CAA6C;IAC7C,gBAAgB,CAAC,IAAI,EAAE,oBAAoB,GAAG,IAAI,CAAC;IACnD,+CAA+C;IAC/C,kBAAkB,IAAI,IAAI,CAAC;CAC5B;AAED;;GAEG;AACH,yBAAiB,yBAAyB,CAAC;IACzC,+FAA+F;IAC/F,SAAgB,MAAM,CAAC,IAAI,EAAE,gBAAgB,GAAG,yBAAyB,CAExE;CACF"}
@@ -193,7 +193,9 @@ class PrimaryTreeReference extends internal_1.TileTreeReference {
193
193
  computeTransform(tree) {
194
194
  const baseTf = this.computeBaseTransform(tree);
195
195
  const displayTf = this.view.modelDisplayTransformProvider?.getModelDisplayTransform(this.model.id);
196
- return displayTf ? baseTf.multiplyTransformTransform(displayTf, displayTf) : baseTf;
196
+ if (!displayTf)
197
+ return baseTf;
198
+ return displayTf.premultiply ? displayTf.transform.multiplyTransformTransform(baseTf) : baseTf.multiplyTransformTransform(displayTf.transform);
197
199
  }
198
200
  }
199
201
  /** @internal */
@@ -1 +1 @@
1
- {"version":3,"file":"PrimaryTileTree.js","sourceRoot":"","sources":["../../../src/tile/PrimaryTileTree.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAE6B;AAC7B,oDAG4B;AAC5B,wDAAiF;AAEjF,4CAAyC;AAGzC,2DAAkE;AAClE,sEAAmE;AAKnE,yCAGoB;AAUpB,MAAM,sBAAuB,SAAQ,yBAAc;IAGjD,YAAmB,MAA4B,EAAE,MAAyB,EAAE,aAAqB;QAC/F,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACtB,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;IACrC,CAA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GAAG,CAAC;QACjB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACtB,GAAG,CAAC,KAAK,EAAE,CAAC;QAEZ,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,MAAM,EAAE;YACrD,IAAI,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YAClC,IAAI,CAAC,SAAS,EAAE;gBACd,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,kBAAkB,CAAC;gBAC9E,IAAI,KAAK,EAAE;oBACT,SAAS,GAAG,IAAI,gBAAgB,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;oBACpD,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;oBAC/C,SAAS,CAAC,gBAAgB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;iBAC9C;aACF;YAED,IAAI,SAAS;gBACX,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;SAC/B;IACH,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Tiles\r\n */\r\n\r\nimport {\r\n assert, comparePossiblyUndefined, compareStrings, Id64String,\r\n} from \"@itwin/core-bentley\";\r\nimport {\r\n BatchType, compareIModelTileTreeIds, FeatureAppearance, FeatureAppearanceProvider, HiddenLine, iModelTileTreeIdToString, MapLayerSettings, ModelMapLayerSettings,\r\n PrimaryTileTreeId, RenderMode, RenderSchedule, SpatialClassifier, ViewFlagOverrides, ViewFlagsProperties,\r\n} from \"@itwin/core-common\";\r\nimport { Range3d, StringifiedClipVector, Transform } from \"@itwin/core-geometry\";\r\nimport { DisplayStyleState } from \"../DisplayStyleState\";\r\nimport { IModelApp } from \"../IModelApp\";\r\nimport { IModelConnection } from \"../IModelConnection\";\r\nimport { GeometricModel3dState, GeometricModelState } from \"../ModelState\";\r\nimport { formatAnimationBranchId } from \"../render/GraphicBranch\";\r\nimport { AnimationNodeId } from \"../common/render/AnimationNodeId\";\r\nimport { RenderClipVolume } from \"../render/RenderClipVolume\";\r\nimport { SpatialViewState } from \"../SpatialViewState\";\r\nimport { SceneContext } from \"../ViewContext\";\r\nimport { AttachToViewportArgs, ViewState, ViewState3d } from \"../ViewState\";\r\nimport {\r\n IModelTileTree, IModelTileTreeParams, iModelTileTreeParamsFromJSON, MapLayerTileTreeReference, TileDrawArgs, TileGraphicType, TileTree, TileTreeOwner, TileTreeReference,\r\n TileTreeSupplier,\r\n} from \"./internal\";\r\n\r\ninterface PrimaryTreeId {\r\n treeId: PrimaryTileTreeId;\r\n modelId: Id64String;\r\n is3d: boolean;\r\n isPlanProjection: boolean;\r\n timeline?: RenderSchedule.ModelTimeline;\r\n}\r\n\r\nclass PlanProjectionTileTree extends IModelTileTree {\r\n public readonly baseElevation: number;\r\n\r\n public constructor(params: IModelTileTreeParams, treeId: PrimaryTileTreeId, baseElevation: number) {\r\n super(params, treeId);\r\n this.baseElevation = baseElevation;\r\n }\r\n}\r\n\r\nclass PrimaryTreeSupplier implements TileTreeSupplier {\r\n public constructor() {\r\n }\r\n\r\n public compareTileTreeIds(lhs: PrimaryTreeId, rhs: PrimaryTreeId): number {\r\n // NB: we don't compare isPlanProjection or is3d - they should always have the same value for a given modelId.\r\n return compareStrings(lhs.modelId, rhs.modelId) || compareIModelTileTreeIds(lhs.treeId, rhs.treeId)\r\n || comparePossiblyUndefined((x, y) => x.compareTo(y), lhs.timeline, rhs.timeline);\r\n }\r\n\r\n public async createTileTree(id: PrimaryTreeId, iModel: IModelConnection): Promise<TileTree | undefined> {\r\n const treeId = id.treeId;\r\n const idStr = iModelTileTreeIdToString(id.modelId, treeId, IModelApp.tileAdmin);\r\n const props = await IModelApp.tileAdmin.requestTileTreeProps(iModel, idStr);\r\n\r\n // ###TODO remove restriction that animated tile trees can't contained instanced geometry.\r\n const isAnimated = undefined !== treeId.animationId || undefined !== id.timeline;\r\n const allowInstancing = !isAnimated && !treeId.enforceDisplayPriority && !treeId.sectionCut;\r\n const options = {\r\n edges: treeId.edges,\r\n allowInstancing,\r\n is3d: id.is3d,\r\n batchType: BatchType.Primary,\r\n timeline: id.timeline,\r\n };\r\n\r\n const params = iModelTileTreeParamsFromJSON(props, iModel, id.modelId, options);\r\n if (!id.isPlanProjection)\r\n return new IModelTileTree(params, id.treeId);\r\n\r\n let elevation = 0;\r\n try {\r\n const ranges = await iModel.models.queryExtents(id.modelId);\r\n if (1 === ranges.length) {\r\n const range = Range3d.fromJSON(ranges[0].extents);\r\n const lo = range.low.z;\r\n const hi = range.high.z;\r\n if (lo <= hi)\r\n elevation = (lo + hi) / 2;\r\n }\r\n } catch (_err) {\r\n //\r\n }\r\n\r\n return new PlanProjectionTileTree(params, id.treeId, elevation);\r\n }\r\n\r\n public getOwner(id: PrimaryTreeId, iModel: IModelConnection): TileTreeOwner {\r\n return iModel.tiles.getTileTreeOwner(id, this);\r\n }\r\n\r\n public addModelsAnimatedByScript(modelIds: Set<Id64String>, scriptSourceId: Id64String, trees: Iterable<{ id: PrimaryTreeId, owner: TileTreeOwner }>): void {\r\n // Note: This is invoked when an element hosting a schedule script is updated - it doesn't care about frontend schedule scripts.\r\n for (const tree of trees)\r\n if (scriptSourceId === tree.id.treeId.animationId)\r\n modelIds.add(tree.id.modelId);\r\n }\r\n\r\n public addSpatialModels(modelIds: Set<Id64String>, trees: Iterable<{ id: PrimaryTreeId, owner: TileTreeOwner }>): void {\r\n for (const tree of trees)\r\n if (tree.id.is3d)\r\n modelIds.add(tree.id.modelId);\r\n }\r\n}\r\n\r\nconst primaryTreeSupplier = new PrimaryTreeSupplier();\r\n\r\n/** Find all extant tile trees associated with the specified model Ids and dispose of them.\r\n * This is used by BriefcaseConnection when a GraphicalEditingScope is exited or after a change to the models' geometry guids\r\n * is committed, undone, redone, or merged.\r\n * @internal\r\n */\r\nexport function disposeTileTreesForGeometricModels(modelIds: Set<Id64String>, iModel: IModelConnection): void {\r\n const trees = iModel.tiles.getTreeOwnersForSupplier(primaryTreeSupplier);\r\n for (const kvp of trees) {\r\n const id = kvp.id as PrimaryTreeId;\r\n assert(undefined !== id.modelId);\r\n if (modelIds.has(id.modelId))\r\n kvp.owner.dispose();\r\n }\r\n}\r\n\r\nclass PrimaryTreeReference extends TileTreeReference {\r\n public readonly view: ViewState;\r\n public readonly model: GeometricModelState;\r\n /** Chiefly for debugging - disables iteration of this reference in SpatialModelRefs to e.g. omit the reference from the scene. */\r\n public deactivated = false;\r\n protected _viewFlagOverrides: ViewFlagOverrides;\r\n protected _id: PrimaryTreeId;\r\n private _owner: TileTreeOwner;\r\n private readonly _sectionClip?: StringifiedClipVector;\r\n private readonly _sectionCutAppearanceProvider?: FeatureAppearanceProvider;\r\n protected readonly _animationTransformNodeId?: number;\r\n\r\n public constructor(view: ViewState, model: GeometricModelState, planProjection: boolean, transformNodeId: number | undefined, sectionClip?: StringifiedClipVector) {\r\n super();\r\n this.view = view;\r\n this.model = model;\r\n this._animationTransformNodeId = transformNodeId;\r\n\r\n this._sectionClip = sectionClip;\r\n this._viewFlagOverrides = { ...model.jsonProperties.viewFlagOverrides };\r\n if (sectionClip) {\r\n // Clipping will be applied on backend; don't clip out cut geometry.\r\n this._viewFlagOverrides.clipVolume = false;\r\n this._sectionCutAppearanceProvider = FeatureAppearanceProvider.supplement((app: FeatureAppearance) => {\r\n const cutApp = this.view.displayStyle.settings.clipStyle.cutStyle.appearance;\r\n return cutApp ? app.extendAppearance(cutApp) : app;\r\n });\r\n }\r\n\r\n const scriptInfo = IModelApp.tileAdmin.getScriptInfoForTreeId(model.id, view.displayStyle.scheduleScriptReference); // eslint-disable-line deprecation/deprecation\r\n this._id = {\r\n modelId: model.id,\r\n is3d: model.is3d,\r\n treeId: this.createTreeId(view, model.id),\r\n isPlanProjection: planProjection,\r\n timeline: scriptInfo?.timeline,\r\n };\r\n\r\n this._owner = primaryTreeSupplier.getOwner(this._id, model.iModel);\r\n }\r\n\r\n protected override getAnimationTransformNodeId() {\r\n return this._animationTransformNodeId ?? AnimationNodeId.Untransformed;\r\n }\r\n\r\n protected override getViewFlagOverrides(_tree: TileTree) {\r\n return this._viewFlagOverrides;\r\n }\r\n\r\n protected override getAppearanceProvider(_tree: TileTree): FeatureAppearanceProvider | undefined {\r\n if (this._sectionCutAppearanceProvider && this.view.displayStyle.settings.clipStyle.cutStyle.appearance)\r\n return this._sectionCutAppearanceProvider;\r\n\r\n return undefined;\r\n }\r\n\r\n protected override getHiddenLineSettings(_tree: TileTree): HiddenLine.Settings | undefined {\r\n return this._sectionClip ? this.view.displayStyle.settings.clipStyle.cutStyle.hiddenLine : undefined;\r\n }\r\n\r\n public override get castsShadows() {\r\n return true;\r\n }\r\n\r\n protected get isPlanProjection(): boolean {\r\n return false;\r\n }\r\n\r\n protected override getClipVolume(_tree: TileTree): RenderClipVolume | undefined {\r\n // ###TODO: reduce frequency with which getModelClip() is called\r\n return this.view.is3d() && !this._sectionClip ? this.view.getModelClip(this.model.id) : undefined;\r\n }\r\n\r\n public override createDrawArgs(context: SceneContext): TileDrawArgs | undefined {\r\n const args = super.createDrawArgs(context);\r\n if (args)\r\n args.intersectionClip = this._sectionClip;\r\n\r\n return args;\r\n }\r\n\r\n public get treeOwner(): TileTreeOwner {\r\n const newId = this.createTreeId(this.view, this._id.modelId);\r\n const timeline = IModelApp.tileAdmin.getScriptInfoForTreeId(this._id.modelId, this.view.displayStyle.scheduleScriptReference)?.timeline; // eslint-disable-line deprecation/deprecation\r\n if (0 !== compareIModelTileTreeIds(newId, this._id.treeId) || timeline !== this._id.timeline) {\r\n this._id = {\r\n modelId: this._id.modelId,\r\n is3d: this._id.is3d,\r\n treeId: newId,\r\n isPlanProjection: this._id.isPlanProjection,\r\n timeline,\r\n };\r\n\r\n this._owner = primaryTreeSupplier.getOwner(this._id, this.model.iModel);\r\n }\r\n\r\n return this._owner;\r\n }\r\n\r\n protected createTreeId(view: ViewState, modelId: Id64String): PrimaryTileTreeId {\r\n if (this._sectionClip) {\r\n // We do this each time in case the ClipStyle's overrides are modified.\r\n // ###TODO: can we avoid that? Event listeners maybe?\r\n this._viewFlagOverrides = {\r\n ...this.view.displayStyle.settings.clipStyle.cutStyle.viewflags,\r\n // Do not clip out the cut geometry intersecting the clip planes.\r\n clipVolume: false,\r\n // The cut geometry is planar - it should win a z-fight.\r\n // Also we need to preserve this flag if this is a plan projection tile tree reference.\r\n forceSurfaceDiscard: true,\r\n };\r\n }\r\n\r\n const animationId = IModelApp.tileAdmin.getScriptInfoForTreeId(modelId, view.displayStyle.scheduleScriptReference)?.animationId; // eslint-disable-line deprecation/deprecation\r\n const renderMode = this._viewFlagOverrides.renderMode ?? view.viewFlags.renderMode;\r\n const visibleEdges = this._viewFlagOverrides.visibleEdges ?? view.viewFlags.visibleEdges;\r\n const edgesRequired = visibleEdges || RenderMode.SmoothShade !== renderMode || IModelApp.tileAdmin.alwaysRequestEdges;\r\n const edges = edgesRequired ? IModelApp.tileAdmin.edgeOptions : false;\r\n const sectionCut = this._sectionClip?.clipString;\r\n return { type: BatchType.Primary, edges, animationId, sectionCut };\r\n }\r\n\r\n protected computeBaseTransform(tree: TileTree): Transform {\r\n return super.computeTransform(tree);\r\n }\r\n\r\n protected override computeTransform(tree: TileTree): Transform {\r\n const baseTf = this.computeBaseTransform(tree);\r\n const displayTf = this.view.modelDisplayTransformProvider?.getModelDisplayTransform(this.model.id);\r\n return displayTf ? baseTf.multiplyTransformTransform(displayTf, displayTf) : baseTf;\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport class AnimatedTreeReference extends PrimaryTreeReference {\r\n private readonly _branchId: string;\r\n\r\n public constructor(view: ViewState, model: GeometricModelState, transformNodeId: number) {\r\n super(view, model, false, transformNodeId);\r\n this._branchId = formatAnimationBranchId(model.id, transformNodeId);\r\n }\r\n\r\n protected override computeBaseTransform(tree: TileTree): Transform {\r\n const tf = super.computeBaseTransform(tree);\r\n const style = this.view.displayStyle;\r\n const script = style.scheduleScript;\r\n if (undefined === script || undefined === this._animationTransformNodeId)\r\n return tf;\r\n\r\n const timePoint = style.settings.timePoint ?? script.duration.low;\r\n const animTf = script.getTransform(this._id.modelId, this._animationTransformNodeId, timePoint);\r\n if (animTf)\r\n animTf.multiplyTransformTransform(tf, tf);\r\n\r\n return tf;\r\n }\r\n\r\n public override createDrawArgs(context: SceneContext): TileDrawArgs | undefined {\r\n const animBranch = context.viewport.target.animationBranches?.branchStates.get(this._branchId);\r\n if (animBranch && animBranch.omit)\r\n return undefined;\r\n\r\n const args = super.createDrawArgs(context);\r\n if (args?.tree && undefined !== this._animationTransformNodeId) {\r\n assert(args.tree instanceof IModelTileTree);\r\n args.boundingRange = args.tree.getTransformNodeRange(this._animationTransformNodeId);\r\n }\r\n\r\n return args;\r\n }\r\n}\r\n\r\nclass PlanProjectionTreeReference extends PrimaryTreeReference {\r\n private get _view3d() { return this.view as ViewState3d; }\r\n private readonly _baseTransform = Transform.createIdentity();\r\n\r\n public constructor(view: ViewState3d, model: GeometricModelState, sectionCut?: StringifiedClipVector) {\r\n super(view, model, true, undefined, sectionCut);\r\n this._viewFlagOverrides.forceSurfaceDiscard = true;\r\n }\r\n\r\n public override get castsShadows() {\r\n return false;\r\n }\r\n\r\n protected override get isPlanProjection(): boolean {\r\n return true;\r\n }\r\n\r\n public override createDrawArgs(context: SceneContext): TileDrawArgs | undefined {\r\n const args = super.createDrawArgs(context);\r\n if (undefined !== args && this._id.treeId.enforceDisplayPriority) {\r\n args.drawGraphics = () => { // eslint-disable-line @typescript-eslint/unbound-method\r\n const graphics = args.produceGraphics();\r\n if (undefined !== graphics) {\r\n const settings = this.getSettings();\r\n const asOverlay = undefined !== settings && settings.overlay;\r\n const transparency = settings?.transparency || 0;\r\n\r\n let elevation = settings?.elevation;\r\n if (undefined === elevation) {\r\n const tree = this.treeOwner.tileTree;\r\n if (tree) {\r\n assert(tree instanceof PlanProjectionTileTree);\r\n elevation = tree.baseElevation;\r\n } else {\r\n elevation = 0;\r\n }\r\n }\r\n\r\n context.outputGraphic(context.target.renderSystem.createGraphicLayerContainer(graphics, asOverlay, transparency, elevation));\r\n }\r\n };\r\n }\r\n\r\n return args;\r\n }\r\n\r\n protected override computeBaseTransform(tree: TileTree): Transform {\r\n assert(tree instanceof PlanProjectionTileTree);\r\n const transform = tree.iModelTransform.clone(this._baseTransform);\r\n\r\n const elevation = this.getSettings()?.elevation;\r\n if (undefined !== elevation)\r\n transform.origin.z = elevation;\r\n\r\n return transform;\r\n }\r\n\r\n public override draw(args: TileDrawArgs): void {\r\n const settings = this.getSettings();\r\n if (undefined === settings || settings.enforceDisplayPriority || !settings.overlay)\r\n super.draw(args);\r\n else\r\n args.context.withGraphicType(TileGraphicType.Overlay, () => args.tree.draw(args));\r\n }\r\n\r\n private getSettings() {\r\n return this._view3d.getDisplayStyle3d().settings.getPlanProjectionSettings(this.model.id);\r\n }\r\n\r\n protected override createTreeId(view: ViewState, modelId: Id64String): PrimaryTileTreeId {\r\n const id = super.createTreeId(view, modelId);\r\n const settings = this.getSettings();\r\n if (undefined !== settings && settings.enforceDisplayPriority)\r\n id.enforceDisplayPriority = true;\r\n\r\n return id;\r\n }\r\n}\r\n\r\nfunction isPlanProjection(view: ViewState, model: GeometricModelState): boolean {\r\n const model3d = view.is3d() ? model.asGeometricModel3d : undefined;\r\n return undefined !== model3d && model3d.isPlanProjection;\r\n}\r\n\r\nfunction createTreeRef(view: ViewState, model: GeometricModelState, sectionCut: StringifiedClipVector | undefined): PrimaryTreeReference {\r\n if (false !== IModelApp.renderSystem.options.planProjections && isPlanProjection(view, model))\r\n return new PlanProjectionTreeReference(view as ViewState3d, model, sectionCut);\r\n\r\n return new PrimaryTreeReference(view, model, false, undefined, sectionCut);\r\n}\r\n\r\n/** @internal */\r\nexport function createPrimaryTileTreeReference(view: ViewState, model: GeometricModelState): PrimaryTreeReference {\r\n return createTreeRef(view, model, undefined);\r\n}\r\n\r\nclass MaskTreeReference extends TileTreeReference {\r\n protected _id: PrimaryTreeId;\r\n private _owner: TileTreeOwner;\r\n public readonly model: GeometricModelState;\r\n public override get castsShadows() { return false; }\r\n public constructor(view: ViewState, model: GeometricModelState) {\r\n super();\r\n this.model = model;\r\n this._id = {\r\n modelId: model.id,\r\n is3d: model.is3d,\r\n treeId: this.createTreeId(),\r\n isPlanProjection: isPlanProjection(view, model),\r\n };\r\n\r\n this._owner = primaryTreeSupplier.getOwner(this._id, model.iModel);\r\n }\r\n\r\n public get treeOwner(): TileTreeOwner {\r\n const newId = this.createTreeId();\r\n if (0 !== compareIModelTileTreeIds(newId, this._id.treeId)) {\r\n this._id = { modelId: this._id.modelId, is3d: this._id.is3d, treeId: newId, isPlanProjection: false };\r\n this._owner = primaryTreeSupplier.getOwner(this._id, this.model.iModel);\r\n }\r\n\r\n return this._owner;\r\n }\r\n protected createTreeId(): PrimaryTileTreeId {\r\n return { type: BatchType.Primary, edges: false };\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport function createMaskTreeReference(view: ViewState, model: GeometricModelState): TileTreeReference {\r\n return new MaskTreeReference(view, model);\r\n}\r\n\r\n/** @internal */\r\nexport class ModelMapLayerTileTreeReference extends MapLayerTileTreeReference {\r\n private _id: PrimaryTreeId;\r\n private _owner: TileTreeOwner;\r\n public get isPlanar() { return true; }\r\n public get activeClassifier() { return this._classifier; }\r\n public constructor(layerSettings: MapLayerSettings, private _classifier: SpatialClassifier, layerIndex: number, iModel: IModelConnection, private _source?: DisplayStyleState) {\r\n super(layerSettings, layerIndex, iModel);\r\n this._id = {\r\n modelId: _classifier.modelId,\r\n is3d: true, // model.is3d,\r\n treeId: this.createTreeId(),\r\n isPlanProjection: false, // isPlanProjection(view, model),\r\n };\r\n\r\n this._owner = primaryTreeSupplier.getOwner(this._id, this.iModel);\r\n }\r\n\r\n protected createTreeId(): PrimaryTileTreeId {\r\n return { type: BatchType.Primary, edges: false };\r\n }\r\n\r\n public get treeOwner(): TileTreeOwner {\r\n const newId = this.createTreeId();\r\n if (0 !== compareIModelTileTreeIds(newId, this._id.treeId)) {\r\n this._id = { modelId: this._id.modelId, is3d: this._id.is3d, treeId: newId, isPlanProjection: false };\r\n this._owner = primaryTreeSupplier.getOwner(this._id, this.iModel);\r\n }\r\n\r\n return this._owner;\r\n }\r\n public get viewFlags(): Partial<ViewFlagsProperties> {\r\n return {\r\n renderMode: RenderMode.SmoothShade,\r\n transparency: true, // Igored for point clouds as they don't support transparency.\r\n textures: true,\r\n lighting: false,\r\n shadows: false,\r\n monochrome: false,\r\n materials: false,\r\n ambientOcclusion: false,\r\n visibleEdges: true,\r\n hiddenEdges: false,\r\n fill: true,\r\n };\r\n }\r\n}\r\n/** @internal */\r\nexport function createModelMapLayerTileTreeReference(layerSettings: ModelMapLayerSettings, layerIndex: number, iModel: IModelConnection): ModelMapLayerTileTreeReference | undefined {\r\n const classifier = SpatialClassifier.fromModelMapLayer(layerSettings);\r\n return classifier ? new ModelMapLayerTileTreeReference(layerSettings, classifier, layerIndex, iModel) : undefined;\r\n}\r\n\r\n/** Provides [[TileTreeReference]]s for the loaded models present in a [[SpatialViewState]]'s [[ModelSelectorState]].\r\n * @internal\r\n */\r\nexport interface SpatialTileTreeReferences extends Iterable<TileTreeReference> {\r\n /** Supplies an iterator over all of the [[TileTreeReference]]s. */\r\n [Symbol.iterator](): Iterator<TileTreeReference>;\r\n /** Requests that the set of [[TileTreeReference]]s be updated to match the current state of the view, e.g., after the model selector's contents have changed. */\r\n update(): void;\r\n /** See SpatialViewState.setTileTreeReferencesDeactivated. */\r\n setDeactivated(modelIds: Id64String | Id64String[] | undefined, deactivated: boolean | undefined, refs: \"all\" | \"animated\" | \"primary\" | \"section\" | number[]): void;\r\n /** See SpatialViewState.attachToViewport. */\r\n attachToViewport(args: AttachToViewportArgs): void;\r\n /** See SpatialViewState.detachFromViewport. */\r\n detachFromViewport(): void;\r\n}\r\n\r\n/** Provides [[TileTreeReference]]s for the loaded models present in a [[SpatialViewState]]'s [[ModelSelectorState]].\r\n * @internal\r\n */\r\nexport namespace SpatialTileTreeReferences {\r\n /** Create a SpatialTileTreeReferences object reflecting the contents of the specified view. */\r\n export function create(view: SpatialViewState): SpatialTileTreeReferences {\r\n return new SpatialRefs(view);\r\n }\r\n}\r\n\r\n/** Represents the [[TileTreeReference]]s associated with one model in a [[SpatialTileTreeReferences]]. */\r\nclass SpatialModelRefs implements Iterable<TileTreeReference> {\r\n /** The TileTreeReference representing the model's primary content. */\r\n private readonly _modelRef: TileTreeReference;\r\n /** TileTreeReferences representing nodes transformed by the view's schedule script. */\r\n private readonly _animatedRefs: PrimaryTreeReference[] = [];\r\n /** TileTreeReference providing cut geometry intersecting the view's clip volume. */\r\n private _sectionCutRef?: PrimaryTreeReference;\r\n /** Whether `this._modelRef` is a [[PrimaryTreeReference]] (as opposed to, e.g., a reality model tree reference). */\r\n private readonly _isPrimaryRef: boolean;\r\n\r\n public constructor(model: GeometricModel3dState, view: SpatialViewState) {\r\n this._modelRef = model.createTileTreeReference(view);\r\n this._isPrimaryRef = this._modelRef instanceof PrimaryTreeReference;\r\n }\r\n\r\n public *[Symbol.iterator](): Iterator<TileTreeReference> {\r\n if (!this._primaryRef || !this._primaryRef.deactivated)\r\n yield this._modelRef;\r\n\r\n for (const animated of this._animatedRefs)\r\n if (!animated.deactivated)\r\n yield animated;\r\n\r\n if (this._sectionCutRef && !this._sectionCutRef.deactivated)\r\n yield this._sectionCutRef;\r\n }\r\n\r\n public updateAnimated(script: RenderSchedule.ScriptReference | undefined): void {\r\n const ref = this._primaryRef;\r\n if (!ref)\r\n return;\r\n\r\n this._animatedRefs.length = 0;\r\n const nodeIds = script?.script.getTransformBatchIds(ref.model.id);\r\n if (nodeIds)\r\n for (const nodeId of nodeIds)\r\n this._animatedRefs.push(new AnimatedTreeReference(ref.view, ref.model, nodeId));\r\n }\r\n\r\n public updateSectionCut(clip: StringifiedClipVector | undefined): void {\r\n const ref = this._primaryRef;\r\n if (!ref) {\r\n assert(undefined === this._sectionCutRef);\r\n return;\r\n }\r\n\r\n // If the clip isn't supposed to apply to this model, don't produce cut geometry.\r\n const vfJson = clip ? ref.model.jsonProperties.viewFlagOverrides : undefined;\r\n const vfOvrs = vfJson ? { ...vfJson } : undefined;\r\n if (vfOvrs && !vfOvrs.clipVolume)\r\n clip = undefined;\r\n\r\n this._sectionCutRef = clip ? createTreeRef(ref.view, ref.model, clip) : undefined;\r\n }\r\n\r\n public setDeactivated(deactivated: boolean | undefined, which: \"all\" | \"animated\" | \"primary\" | \"section\" | number[]): void {\r\n if (typeof which !== \"string\") {\r\n for (const index of which)\r\n if (this._animatedRefs[index])\r\n this._animatedRefs[index].deactivated = deactivated ?? !this._animatedRefs[index].deactivated;\r\n\r\n return;\r\n }\r\n\r\n if ((\"all\" === which || \"primary\" === which) && this._primaryRef)\r\n this._primaryRef.deactivated = deactivated ?? !this._primaryRef.deactivated;\r\n\r\n if ((\"all\" === which || \"section\" === which) && this._sectionCutRef)\r\n this._sectionCutRef.deactivated = deactivated ?? !this._sectionCutRef.deactivated;\r\n\r\n if ((\"all\" === which || \"animated\" === which))\r\n for (const ref of this._animatedRefs)\r\n ref.deactivated = deactivated ?? !ref.deactivated;\r\n }\r\n\r\n private get _primaryRef(): PrimaryTreeReference | undefined {\r\n if (!this._isPrimaryRef)\r\n return undefined;\r\n\r\n assert(this._modelRef instanceof PrimaryTreeReference);\r\n return this._modelRef;\r\n }\r\n}\r\n\r\n/** Provides [[TileTreeReference]]s for the loaded models present in a [[SpatialViewState]]'s [[ModelSelectorState]]. */\r\nclass SpatialRefs implements SpatialTileTreeReferences {\r\n private _allLoaded = false;\r\n private readonly _view: SpatialViewState;\r\n private _refs = new Map<Id64String, SpatialModelRefs>();\r\n private _swapRefs = new Map<Id64String, SpatialModelRefs>();\r\n private _scheduleScript?: RenderSchedule.ScriptReference;\r\n private _sectionCut?: StringifiedClipVector;\r\n\r\n public constructor(view: SpatialViewState) {\r\n this._view = view;\r\n this._scheduleScript = view.displayStyle.scheduleScriptReference; // eslint-disable-line deprecation/deprecation\r\n this._sectionCut = this.getSectionCutFromView();\r\n }\r\n\r\n public update(): void {\r\n this._allLoaded = false;\r\n }\r\n\r\n public attachToViewport() { }\r\n public detachFromViewport() { }\r\n\r\n public *[Symbol.iterator](): Iterator<TileTreeReference> {\r\n this.load();\r\n for (const modelRef of this._refs.values())\r\n for (const ref of modelRef)\r\n yield ref;\r\n }\r\n\r\n public setDeactivated(modelIds: Id64String | Id64String[] | undefined, deactivated: boolean, refs: \"all\" | \"animated\" | \"primary\" | \"section\" | number[]): void {\r\n if (undefined === modelIds) {\r\n for (const model of this._refs.values())\r\n model.setDeactivated(deactivated, refs);\r\n\r\n return;\r\n }\r\n\r\n if (typeof modelIds === \"string\")\r\n modelIds = [modelIds];\r\n\r\n for (const modelId of modelIds)\r\n this._refs.get(modelId)?.setDeactivated(deactivated, refs);\r\n }\r\n\r\n private load(): void {\r\n if (!this._allLoaded) {\r\n this._allLoaded = true;\r\n this.updateModels();\r\n }\r\n\r\n const curScript = this._view.displayStyle.scheduleScriptReference; // eslint-disable-line deprecation/deprecation\r\n const prevScript = this._scheduleScript;\r\n if (curScript !== prevScript) {\r\n this._scheduleScript = curScript;\r\n if (!curScript || !prevScript || !curScript.script.equals(prevScript.script))\r\n for (const ref of this._refs.values())\r\n ref.updateAnimated(curScript);\r\n }\r\n\r\n const sectionCut = this.getSectionCutFromView();\r\n if (sectionCut?.clipString !== this._sectionCut?.clipString) {\r\n this._sectionCut = sectionCut;\r\n for (const ref of this._refs.values())\r\n ref.updateSectionCut(sectionCut);\r\n }\r\n }\r\n\r\n private getSectionCutFromView(): StringifiedClipVector | undefined {\r\n const wantCut = this._view.viewFlags.clipVolume && this._view.displayStyle.settings.clipStyle.produceCutGeometry;\r\n const clip = wantCut ? this._view.getViewClip() : undefined;\r\n return StringifiedClipVector.fromClipVector(clip);\r\n }\r\n\r\n /** Ensure this._refs contains a SpatialModelRefs for all loaded models in the model selector. */\r\n private updateModels(): void {\r\n const prev = this._refs;\r\n const cur = this._swapRefs;\r\n this._refs = cur;\r\n this._swapRefs = prev;\r\n cur.clear();\r\n\r\n for (const modelId of this._view.modelSelector.models) {\r\n let modelRefs = prev.get(modelId);\r\n if (!modelRefs) {\r\n const model = this._view.iModel.models.getLoaded(modelId)?.asGeometricModel3d;\r\n if (model) {\r\n modelRefs = new SpatialModelRefs(model, this._view);\r\n modelRefs.updateAnimated(this._scheduleScript);\r\n modelRefs.updateSectionCut(this._sectionCut);\r\n }\r\n }\r\n\r\n if (modelRefs)\r\n cur.set(modelId, modelRefs);\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"PrimaryTileTree.js","sourceRoot":"","sources":["../../../src/tile/PrimaryTileTree.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAE6B;AAC7B,oDAG4B;AAC5B,wDAAiF;AAEjF,4CAAyC;AAGzC,2DAAkE;AAClE,sEAAmE;AAKnE,yCAGoB;AAUpB,MAAM,sBAAuB,SAAQ,yBAAc;IAGjD,YAAmB,MAA4B,EAAE,MAAyB,EAAE,aAAqB;QAC/F,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACtB,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;IACrC,CAAC;CACF;AAED,MAAM,mBAAmB;IACvB;IACA,CAAC;IAEM,kBAAkB,CAAC,GAAkB,EAAE,GAAkB;QAC9D,8GAA8G;QAC9G,OAAO,IAAA,6BAAc,EAAC,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,IAAI,IAAA,sCAAwB,EAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC;eAC7F,IAAA,uCAAwB,EAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,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CAAC,OAAO,CAAC,CAAC;YAClC,IAAI,CAAC,SAAS,EAAE;gBACd,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,kBAAkB,CAAC;gBAC9E,IAAI,KAAK,EAAE;oBACT,SAAS,GAAG,IAAI,gBAAgB,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;oBACpD,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;oBAC/C,SAAS,CAAC,gBAAgB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;iBAC9C;aACF;YAED,IAAI,SAAS;gBACX,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;SAC/B;IACH,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Tiles\r\n */\r\n\r\nimport {\r\n assert, comparePossiblyUndefined, compareStrings, Id64String,\r\n} from \"@itwin/core-bentley\";\r\nimport {\r\n BatchType, compareIModelTileTreeIds, FeatureAppearance, FeatureAppearanceProvider, HiddenLine, iModelTileTreeIdToString, MapLayerSettings, ModelMapLayerSettings,\r\n PrimaryTileTreeId, RenderMode, RenderSchedule, SpatialClassifier, ViewFlagOverrides, ViewFlagsProperties,\r\n} from \"@itwin/core-common\";\r\nimport { Range3d, StringifiedClipVector, Transform } from \"@itwin/core-geometry\";\r\nimport { DisplayStyleState } from \"../DisplayStyleState\";\r\nimport { IModelApp } from \"../IModelApp\";\r\nimport { IModelConnection } from \"../IModelConnection\";\r\nimport { GeometricModel3dState, GeometricModelState } from \"../ModelState\";\r\nimport { formatAnimationBranchId } from \"../render/GraphicBranch\";\r\nimport { AnimationNodeId } from \"../common/render/AnimationNodeId\";\r\nimport { RenderClipVolume } from \"../render/RenderClipVolume\";\r\nimport { SpatialViewState } from \"../SpatialViewState\";\r\nimport { SceneContext } from \"../ViewContext\";\r\nimport { AttachToViewportArgs, ViewState, ViewState3d } from \"../ViewState\";\r\nimport {\r\n IModelTileTree, IModelTileTreeParams, iModelTileTreeParamsFromJSON, MapLayerTileTreeReference, TileDrawArgs, TileGraphicType, TileTree, TileTreeOwner, TileTreeReference,\r\n TileTreeSupplier,\r\n} from \"./internal\";\r\n\r\ninterface PrimaryTreeId {\r\n treeId: PrimaryTileTreeId;\r\n modelId: Id64String;\r\n is3d: boolean;\r\n isPlanProjection: boolean;\r\n timeline?: RenderSchedule.ModelTimeline;\r\n}\r\n\r\nclass PlanProjectionTileTree extends IModelTileTree {\r\n public readonly baseElevation: number;\r\n\r\n public constructor(params: IModelTileTreeParams, treeId: PrimaryTileTreeId, baseElevation: number) {\r\n super(params, treeId);\r\n this.baseElevation = baseElevation;\r\n }\r\n}\r\n\r\nclass PrimaryTreeSupplier implements TileTreeSupplier {\r\n public constructor() {\r\n }\r\n\r\n public compareTileTreeIds(lhs: PrimaryTreeId, rhs: PrimaryTreeId): number {\r\n // NB: we don't compare isPlanProjection or is3d - they should always have the same value for a given modelId.\r\n return compareStrings(lhs.modelId, rhs.modelId) || compareIModelTileTreeIds(lhs.treeId, rhs.treeId)\r\n || comparePossiblyUndefined((x, y) => x.compareTo(y), lhs.timeline, rhs.timeline);\r\n }\r\n\r\n public async createTileTree(id: PrimaryTreeId, iModel: IModelConnection): Promise<TileTree | undefined> {\r\n const treeId = id.treeId;\r\n const idStr = iModelTileTreeIdToString(id.modelId, treeId, IModelApp.tileAdmin);\r\n const props = await IModelApp.tileAdmin.requestTileTreeProps(iModel, idStr);\r\n\r\n // ###TODO remove restriction that animated tile trees can't contained instanced geometry.\r\n const isAnimated = undefined !== treeId.animationId || undefined !== id.timeline;\r\n const allowInstancing = !isAnimated && !treeId.enforceDisplayPriority && !treeId.sectionCut;\r\n const options = {\r\n edges: treeId.edges,\r\n allowInstancing,\r\n is3d: id.is3d,\r\n batchType: BatchType.Primary,\r\n timeline: id.timeline,\r\n };\r\n\r\n const params = iModelTileTreeParamsFromJSON(props, iModel, id.modelId, options);\r\n if (!id.isPlanProjection)\r\n return new IModelTileTree(params, id.treeId);\r\n\r\n let elevation = 0;\r\n try {\r\n const ranges = await iModel.models.queryExtents(id.modelId);\r\n if (1 === ranges.length) {\r\n const range = Range3d.fromJSON(ranges[0].extents);\r\n const lo = range.low.z;\r\n const hi = range.high.z;\r\n if (lo <= hi)\r\n elevation = (lo + hi) / 2;\r\n }\r\n } catch (_err) {\r\n //\r\n }\r\n\r\n return new PlanProjectionTileTree(params, id.treeId, elevation);\r\n }\r\n\r\n public getOwner(id: PrimaryTreeId, iModel: IModelConnection): TileTreeOwner {\r\n return iModel.tiles.getTileTreeOwner(id, this);\r\n }\r\n\r\n public addModelsAnimatedByScript(modelIds: Set<Id64String>, scriptSourceId: Id64String, trees: Iterable<{ id: PrimaryTreeId, owner: TileTreeOwner }>): void {\r\n // Note: This is invoked when an element hosting a schedule script is updated - it doesn't care about frontend schedule scripts.\r\n for (const tree of trees)\r\n if (scriptSourceId === tree.id.treeId.animationId)\r\n modelIds.add(tree.id.modelId);\r\n }\r\n\r\n public addSpatialModels(modelIds: Set<Id64String>, trees: Iterable<{ id: PrimaryTreeId, owner: TileTreeOwner }>): void {\r\n for (const tree of trees)\r\n if (tree.id.is3d)\r\n modelIds.add(tree.id.modelId);\r\n }\r\n}\r\n\r\nconst primaryTreeSupplier = new PrimaryTreeSupplier();\r\n\r\n/** Find all extant tile trees associated with the specified model Ids and dispose of them.\r\n * This is used by BriefcaseConnection when a GraphicalEditingScope is exited or after a change to the models' geometry guids\r\n * is committed, undone, redone, or merged.\r\n * @internal\r\n */\r\nexport function disposeTileTreesForGeometricModels(modelIds: Set<Id64String>, iModel: IModelConnection): void {\r\n const trees = iModel.tiles.getTreeOwnersForSupplier(primaryTreeSupplier);\r\n for (const kvp of trees) {\r\n const id = kvp.id as PrimaryTreeId;\r\n assert(undefined !== id.modelId);\r\n if (modelIds.has(id.modelId))\r\n kvp.owner.dispose();\r\n }\r\n}\r\n\r\nclass PrimaryTreeReference extends TileTreeReference {\r\n public readonly view: ViewState;\r\n public readonly model: GeometricModelState;\r\n /** Chiefly for debugging - disables iteration of this reference in SpatialModelRefs to e.g. omit the reference from the scene. */\r\n public deactivated = false;\r\n protected _viewFlagOverrides: ViewFlagOverrides;\r\n protected _id: PrimaryTreeId;\r\n private _owner: TileTreeOwner;\r\n private readonly _sectionClip?: StringifiedClipVector;\r\n private readonly _sectionCutAppearanceProvider?: FeatureAppearanceProvider;\r\n protected readonly _animationTransformNodeId?: number;\r\n\r\n public constructor(view: ViewState, model: GeometricModelState, planProjection: boolean, transformNodeId: number | undefined, sectionClip?: StringifiedClipVector) {\r\n super();\r\n this.view = view;\r\n this.model = model;\r\n this._animationTransformNodeId = transformNodeId;\r\n\r\n this._sectionClip = sectionClip;\r\n this._viewFlagOverrides = { ...model.jsonProperties.viewFlagOverrides };\r\n if (sectionClip) {\r\n // Clipping will be applied on backend; don't clip out cut geometry.\r\n this._viewFlagOverrides.clipVolume = false;\r\n this._sectionCutAppearanceProvider = FeatureAppearanceProvider.supplement((app: FeatureAppearance) => {\r\n const cutApp = this.view.displayStyle.settings.clipStyle.cutStyle.appearance;\r\n return cutApp ? app.extendAppearance(cutApp) : app;\r\n });\r\n }\r\n\r\n const scriptInfo = IModelApp.tileAdmin.getScriptInfoForTreeId(model.id, view.displayStyle.scheduleScriptReference); // eslint-disable-line deprecation/deprecation\r\n this._id = {\r\n modelId: model.id,\r\n is3d: model.is3d,\r\n treeId: this.createTreeId(view, model.id),\r\n isPlanProjection: planProjection,\r\n timeline: scriptInfo?.timeline,\r\n };\r\n\r\n this._owner = primaryTreeSupplier.getOwner(this._id, model.iModel);\r\n }\r\n\r\n protected override getAnimationTransformNodeId() {\r\n return this._animationTransformNodeId ?? AnimationNodeId.Untransformed;\r\n }\r\n\r\n protected override getViewFlagOverrides(_tree: TileTree) {\r\n return this._viewFlagOverrides;\r\n }\r\n\r\n protected override getAppearanceProvider(_tree: TileTree): FeatureAppearanceProvider | undefined {\r\n if (this._sectionCutAppearanceProvider && this.view.displayStyle.settings.clipStyle.cutStyle.appearance)\r\n return this._sectionCutAppearanceProvider;\r\n\r\n return undefined;\r\n }\r\n\r\n protected override getHiddenLineSettings(_tree: TileTree): HiddenLine.Settings | undefined {\r\n return this._sectionClip ? this.view.displayStyle.settings.clipStyle.cutStyle.hiddenLine : undefined;\r\n }\r\n\r\n public override get castsShadows() {\r\n return true;\r\n }\r\n\r\n protected get isPlanProjection(): boolean {\r\n return false;\r\n }\r\n\r\n protected override getClipVolume(_tree: TileTree): RenderClipVolume | undefined {\r\n // ###TODO: reduce frequency with which getModelClip() is called\r\n return this.view.is3d() && !this._sectionClip ? this.view.getModelClip(this.model.id) : undefined;\r\n }\r\n\r\n public override createDrawArgs(context: SceneContext): TileDrawArgs | undefined {\r\n const args = super.createDrawArgs(context);\r\n if (args)\r\n args.intersectionClip = this._sectionClip;\r\n\r\n return args;\r\n }\r\n\r\n public get treeOwner(): TileTreeOwner {\r\n const newId = this.createTreeId(this.view, this._id.modelId);\r\n const timeline = IModelApp.tileAdmin.getScriptInfoForTreeId(this._id.modelId, this.view.displayStyle.scheduleScriptReference)?.timeline; // eslint-disable-line deprecation/deprecation\r\n if (0 !== compareIModelTileTreeIds(newId, this._id.treeId) || timeline !== this._id.timeline) {\r\n this._id = {\r\n modelId: this._id.modelId,\r\n is3d: this._id.is3d,\r\n treeId: newId,\r\n isPlanProjection: this._id.isPlanProjection,\r\n timeline,\r\n };\r\n\r\n this._owner = primaryTreeSupplier.getOwner(this._id, this.model.iModel);\r\n }\r\n\r\n return this._owner;\r\n }\r\n\r\n protected createTreeId(view: ViewState, modelId: Id64String): PrimaryTileTreeId {\r\n if (this._sectionClip) {\r\n // We do this each time in case the ClipStyle's overrides are modified.\r\n // ###TODO: can we avoid that? Event listeners maybe?\r\n this._viewFlagOverrides = {\r\n ...this.view.displayStyle.settings.clipStyle.cutStyle.viewflags,\r\n // Do not clip out the cut geometry intersecting the clip planes.\r\n clipVolume: false,\r\n // The cut geometry is planar - it should win a z-fight.\r\n // Also we need to preserve this flag if this is a plan projection tile tree reference.\r\n forceSurfaceDiscard: true,\r\n };\r\n }\r\n\r\n const animationId = IModelApp.tileAdmin.getScriptInfoForTreeId(modelId, view.displayStyle.scheduleScriptReference)?.animationId; // eslint-disable-line deprecation/deprecation\r\n const renderMode = this._viewFlagOverrides.renderMode ?? view.viewFlags.renderMode;\r\n const visibleEdges = this._viewFlagOverrides.visibleEdges ?? view.viewFlags.visibleEdges;\r\n const edgesRequired = visibleEdges || RenderMode.SmoothShade !== renderMode || IModelApp.tileAdmin.alwaysRequestEdges;\r\n const edges = edgesRequired ? IModelApp.tileAdmin.edgeOptions : false;\r\n const sectionCut = this._sectionClip?.clipString;\r\n return { type: BatchType.Primary, edges, animationId, sectionCut };\r\n }\r\n\r\n protected computeBaseTransform(tree: TileTree): Transform {\r\n return super.computeTransform(tree);\r\n }\r\n\r\n protected override computeTransform(tree: TileTree): Transform {\r\n const baseTf = this.computeBaseTransform(tree);\r\n const displayTf = this.view.modelDisplayTransformProvider?.getModelDisplayTransform(this.model.id);\r\n if (!displayTf)\r\n return baseTf;\r\n\r\n return displayTf.premultiply ? displayTf.transform.multiplyTransformTransform(baseTf) : baseTf.multiplyTransformTransform(displayTf.transform);\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport class AnimatedTreeReference extends PrimaryTreeReference {\r\n private readonly _branchId: string;\r\n\r\n public constructor(view: ViewState, model: GeometricModelState, transformNodeId: number) {\r\n super(view, model, false, transformNodeId);\r\n this._branchId = formatAnimationBranchId(model.id, transformNodeId);\r\n }\r\n\r\n protected override computeBaseTransform(tree: TileTree): Transform {\r\n const tf = super.computeBaseTransform(tree);\r\n const style = this.view.displayStyle;\r\n const script = style.scheduleScript;\r\n if (undefined === script || undefined === this._animationTransformNodeId)\r\n return tf;\r\n\r\n const timePoint = style.settings.timePoint ?? script.duration.low;\r\n const animTf = script.getTransform(this._id.modelId, this._animationTransformNodeId, timePoint);\r\n if (animTf)\r\n animTf.multiplyTransformTransform(tf, tf);\r\n\r\n return tf;\r\n }\r\n\r\n public override createDrawArgs(context: SceneContext): TileDrawArgs | undefined {\r\n const animBranch = context.viewport.target.animationBranches?.branchStates.get(this._branchId);\r\n if (animBranch && animBranch.omit)\r\n return undefined;\r\n\r\n const args = super.createDrawArgs(context);\r\n if (args?.tree && undefined !== this._animationTransformNodeId) {\r\n assert(args.tree instanceof IModelTileTree);\r\n args.boundingRange = args.tree.getTransformNodeRange(this._animationTransformNodeId);\r\n }\r\n\r\n return args;\r\n }\r\n}\r\n\r\nclass PlanProjectionTreeReference extends PrimaryTreeReference {\r\n private get _view3d() { return this.view as ViewState3d; }\r\n private readonly _baseTransform = Transform.createIdentity();\r\n\r\n public constructor(view: ViewState3d, model: GeometricModelState, sectionCut?: StringifiedClipVector) {\r\n super(view, model, true, undefined, sectionCut);\r\n this._viewFlagOverrides.forceSurfaceDiscard = true;\r\n }\r\n\r\n public override get castsShadows() {\r\n return false;\r\n }\r\n\r\n protected override get isPlanProjection(): boolean {\r\n return true;\r\n }\r\n\r\n public override createDrawArgs(context: SceneContext): TileDrawArgs | undefined {\r\n const args = super.createDrawArgs(context);\r\n if (undefined !== args && this._id.treeId.enforceDisplayPriority) {\r\n args.drawGraphics = () => { // eslint-disable-line @typescript-eslint/unbound-method\r\n const graphics = args.produceGraphics();\r\n if (undefined !== graphics) {\r\n const settings = this.getSettings();\r\n const asOverlay = undefined !== settings && settings.overlay;\r\n const transparency = settings?.transparency || 0;\r\n\r\n let elevation = settings?.elevation;\r\n if (undefined === elevation) {\r\n const tree = this.treeOwner.tileTree;\r\n if (tree) {\r\n assert(tree instanceof PlanProjectionTileTree);\r\n elevation = tree.baseElevation;\r\n } else {\r\n elevation = 0;\r\n }\r\n }\r\n\r\n context.outputGraphic(context.target.renderSystem.createGraphicLayerContainer(graphics, asOverlay, transparency, elevation));\r\n }\r\n };\r\n }\r\n\r\n return args;\r\n }\r\n\r\n protected override computeBaseTransform(tree: TileTree): Transform {\r\n assert(tree instanceof PlanProjectionTileTree);\r\n const transform = tree.iModelTransform.clone(this._baseTransform);\r\n\r\n const elevation = this.getSettings()?.elevation;\r\n if (undefined !== elevation)\r\n transform.origin.z = elevation;\r\n\r\n return transform;\r\n }\r\n\r\n public override draw(args: TileDrawArgs): void {\r\n const settings = this.getSettings();\r\n if (undefined === settings || settings.enforceDisplayPriority || !settings.overlay)\r\n super.draw(args);\r\n else\r\n args.context.withGraphicType(TileGraphicType.Overlay, () => args.tree.draw(args));\r\n }\r\n\r\n private getSettings() {\r\n return this._view3d.getDisplayStyle3d().settings.getPlanProjectionSettings(this.model.id);\r\n }\r\n\r\n protected override createTreeId(view: ViewState, modelId: Id64String): PrimaryTileTreeId {\r\n const id = super.createTreeId(view, modelId);\r\n const settings = this.getSettings();\r\n if (undefined !== settings && settings.enforceDisplayPriority)\r\n id.enforceDisplayPriority = true;\r\n\r\n return id;\r\n }\r\n}\r\n\r\nfunction isPlanProjection(view: ViewState, model: GeometricModelState): boolean {\r\n const model3d = view.is3d() ? model.asGeometricModel3d : undefined;\r\n return undefined !== model3d && model3d.isPlanProjection;\r\n}\r\n\r\nfunction createTreeRef(view: ViewState, model: GeometricModelState, sectionCut: StringifiedClipVector | undefined): PrimaryTreeReference {\r\n if (false !== IModelApp.renderSystem.options.planProjections && isPlanProjection(view, model))\r\n return new PlanProjectionTreeReference(view as ViewState3d, model, sectionCut);\r\n\r\n return new PrimaryTreeReference(view, model, false, undefined, sectionCut);\r\n}\r\n\r\n/** @internal */\r\nexport function createPrimaryTileTreeReference(view: ViewState, model: GeometricModelState): PrimaryTreeReference {\r\n return createTreeRef(view, model, undefined);\r\n}\r\n\r\nclass MaskTreeReference extends TileTreeReference {\r\n protected _id: PrimaryTreeId;\r\n private _owner: TileTreeOwner;\r\n public readonly model: GeometricModelState;\r\n public override get castsShadows() { return false; }\r\n public constructor(view: ViewState, model: GeometricModelState) {\r\n super();\r\n this.model = model;\r\n this._id = {\r\n modelId: model.id,\r\n is3d: model.is3d,\r\n treeId: this.createTreeId(),\r\n isPlanProjection: isPlanProjection(view, model),\r\n };\r\n\r\n this._owner = primaryTreeSupplier.getOwner(this._id, model.iModel);\r\n }\r\n\r\n public get treeOwner(): TileTreeOwner {\r\n const newId = this.createTreeId();\r\n if (0 !== compareIModelTileTreeIds(newId, this._id.treeId)) {\r\n this._id = { modelId: this._id.modelId, is3d: this._id.is3d, treeId: newId, isPlanProjection: false };\r\n this._owner = primaryTreeSupplier.getOwner(this._id, this.model.iModel);\r\n }\r\n\r\n return this._owner;\r\n }\r\n protected createTreeId(): PrimaryTileTreeId {\r\n return { type: BatchType.Primary, edges: false };\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport function createMaskTreeReference(view: ViewState, model: GeometricModelState): TileTreeReference {\r\n return new MaskTreeReference(view, model);\r\n}\r\n\r\n/** @internal */\r\nexport class ModelMapLayerTileTreeReference extends MapLayerTileTreeReference {\r\n private _id: PrimaryTreeId;\r\n private _owner: TileTreeOwner;\r\n public get isPlanar() { return true; }\r\n public get activeClassifier() { return this._classifier; }\r\n public constructor(layerSettings: MapLayerSettings, private _classifier: SpatialClassifier, layerIndex: number, iModel: IModelConnection, private _source?: DisplayStyleState) {\r\n super(layerSettings, layerIndex, iModel);\r\n this._id = {\r\n modelId: _classifier.modelId,\r\n is3d: true, // model.is3d,\r\n treeId: this.createTreeId(),\r\n isPlanProjection: false, // isPlanProjection(view, model),\r\n };\r\n\r\n this._owner = primaryTreeSupplier.getOwner(this._id, this.iModel);\r\n }\r\n\r\n protected createTreeId(): PrimaryTileTreeId {\r\n return { type: BatchType.Primary, edges: false };\r\n }\r\n\r\n public get treeOwner(): TileTreeOwner {\r\n const newId = this.createTreeId();\r\n if (0 !== compareIModelTileTreeIds(newId, this._id.treeId)) {\r\n this._id = { modelId: this._id.modelId, is3d: this._id.is3d, treeId: newId, isPlanProjection: false };\r\n this._owner = primaryTreeSupplier.getOwner(this._id, this.iModel);\r\n }\r\n\r\n return this._owner;\r\n }\r\n public get viewFlags(): Partial<ViewFlagsProperties> {\r\n return {\r\n renderMode: RenderMode.SmoothShade,\r\n transparency: true, // Igored for point clouds as they don't support transparency.\r\n textures: true,\r\n lighting: false,\r\n shadows: false,\r\n monochrome: false,\r\n materials: false,\r\n ambientOcclusion: false,\r\n visibleEdges: true,\r\n hiddenEdges: false,\r\n fill: true,\r\n };\r\n }\r\n}\r\n/** @internal */\r\nexport function createModelMapLayerTileTreeReference(layerSettings: ModelMapLayerSettings, layerIndex: number, iModel: IModelConnection): ModelMapLayerTileTreeReference | undefined {\r\n const classifier = SpatialClassifier.fromModelMapLayer(layerSettings);\r\n return classifier ? new ModelMapLayerTileTreeReference(layerSettings, classifier, layerIndex, iModel) : undefined;\r\n}\r\n\r\n/** Provides [[TileTreeReference]]s for the loaded models present in a [[SpatialViewState]]'s [[ModelSelectorState]].\r\n * @internal\r\n */\r\nexport interface SpatialTileTreeReferences extends Iterable<TileTreeReference> {\r\n /** Supplies an iterator over all of the [[TileTreeReference]]s. */\r\n [Symbol.iterator](): Iterator<TileTreeReference>;\r\n /** Requests that the set of [[TileTreeReference]]s be updated to match the current state of the view, e.g., after the model selector's contents have changed. */\r\n update(): void;\r\n /** See SpatialViewState.setTileTreeReferencesDeactivated. */\r\n setDeactivated(modelIds: Id64String | Id64String[] | undefined, deactivated: boolean | undefined, refs: \"all\" | \"animated\" | \"primary\" | \"section\" | number[]): void;\r\n /** See SpatialViewState.attachToViewport. */\r\n attachToViewport(args: AttachToViewportArgs): void;\r\n /** See SpatialViewState.detachFromViewport. */\r\n detachFromViewport(): void;\r\n}\r\n\r\n/** Provides [[TileTreeReference]]s for the loaded models present in a [[SpatialViewState]]'s [[ModelSelectorState]].\r\n * @internal\r\n */\r\nexport namespace SpatialTileTreeReferences {\r\n /** Create a SpatialTileTreeReferences object reflecting the contents of the specified view. */\r\n export function create(view: SpatialViewState): SpatialTileTreeReferences {\r\n return new SpatialRefs(view);\r\n }\r\n}\r\n\r\n/** Represents the [[TileTreeReference]]s associated with one model in a [[SpatialTileTreeReferences]]. */\r\nclass SpatialModelRefs implements Iterable<TileTreeReference> {\r\n /** The TileTreeReference representing the model's primary content. */\r\n private readonly _modelRef: TileTreeReference;\r\n /** TileTreeReferences representing nodes transformed by the view's schedule script. */\r\n private readonly _animatedRefs: PrimaryTreeReference[] = [];\r\n /** TileTreeReference providing cut geometry intersecting the view's clip volume. */\r\n private _sectionCutRef?: PrimaryTreeReference;\r\n /** Whether `this._modelRef` is a [[PrimaryTreeReference]] (as opposed to, e.g., a reality model tree reference). */\r\n private readonly _isPrimaryRef: boolean;\r\n\r\n public constructor(model: GeometricModel3dState, view: SpatialViewState) {\r\n this._modelRef = model.createTileTreeReference(view);\r\n this._isPrimaryRef = this._modelRef instanceof PrimaryTreeReference;\r\n }\r\n\r\n public *[Symbol.iterator](): Iterator<TileTreeReference> {\r\n if (!this._primaryRef || !this._primaryRef.deactivated)\r\n yield this._modelRef;\r\n\r\n for (const animated of this._animatedRefs)\r\n if (!animated.deactivated)\r\n yield animated;\r\n\r\n if (this._sectionCutRef && !this._sectionCutRef.deactivated)\r\n yield this._sectionCutRef;\r\n }\r\n\r\n public updateAnimated(script: RenderSchedule.ScriptReference | undefined): void {\r\n const ref = this._primaryRef;\r\n if (!ref)\r\n return;\r\n\r\n this._animatedRefs.length = 0;\r\n const nodeIds = script?.script.getTransformBatchIds(ref.model.id);\r\n if (nodeIds)\r\n for (const nodeId of nodeIds)\r\n this._animatedRefs.push(new AnimatedTreeReference(ref.view, ref.model, nodeId));\r\n }\r\n\r\n public updateSectionCut(clip: StringifiedClipVector | undefined): void {\r\n const ref = this._primaryRef;\r\n if (!ref) {\r\n assert(undefined === this._sectionCutRef);\r\n return;\r\n }\r\n\r\n // If the clip isn't supposed to apply to this model, don't produce cut geometry.\r\n const vfJson = clip ? ref.model.jsonProperties.viewFlagOverrides : undefined;\r\n const vfOvrs = vfJson ? { ...vfJson } : undefined;\r\n if (vfOvrs && !vfOvrs.clipVolume)\r\n clip = undefined;\r\n\r\n this._sectionCutRef = clip ? createTreeRef(ref.view, ref.model, clip) : undefined;\r\n }\r\n\r\n public setDeactivated(deactivated: boolean | undefined, which: \"all\" | \"animated\" | \"primary\" | \"section\" | number[]): void {\r\n if (typeof which !== \"string\") {\r\n for (const index of which)\r\n if (this._animatedRefs[index])\r\n this._animatedRefs[index].deactivated = deactivated ?? !this._animatedRefs[index].deactivated;\r\n\r\n return;\r\n }\r\n\r\n if ((\"all\" === which || \"primary\" === which) && this._primaryRef)\r\n this._primaryRef.deactivated = deactivated ?? !this._primaryRef.deactivated;\r\n\r\n if ((\"all\" === which || \"section\" === which) && this._sectionCutRef)\r\n this._sectionCutRef.deactivated = deactivated ?? !this._sectionCutRef.deactivated;\r\n\r\n if ((\"all\" === which || \"animated\" === which))\r\n for (const ref of this._animatedRefs)\r\n ref.deactivated = deactivated ?? !ref.deactivated;\r\n }\r\n\r\n private get _primaryRef(): PrimaryTreeReference | undefined {\r\n if (!this._isPrimaryRef)\r\n return undefined;\r\n\r\n assert(this._modelRef instanceof PrimaryTreeReference);\r\n return this._modelRef;\r\n }\r\n}\r\n\r\n/** Provides [[TileTreeReference]]s for the loaded models present in a [[SpatialViewState]]'s [[ModelSelectorState]]. */\r\nclass SpatialRefs implements SpatialTileTreeReferences {\r\n private _allLoaded = false;\r\n private readonly _view: SpatialViewState;\r\n private _refs = new Map<Id64String, SpatialModelRefs>();\r\n private _swapRefs = new Map<Id64String, SpatialModelRefs>();\r\n private _scheduleScript?: RenderSchedule.ScriptReference;\r\n private _sectionCut?: StringifiedClipVector;\r\n\r\n public constructor(view: SpatialViewState) {\r\n this._view = view;\r\n this._scheduleScript = view.displayStyle.scheduleScriptReference; // eslint-disable-line deprecation/deprecation\r\n this._sectionCut = this.getSectionCutFromView();\r\n }\r\n\r\n public update(): void {\r\n this._allLoaded = false;\r\n }\r\n\r\n public attachToViewport() { }\r\n public detachFromViewport() { }\r\n\r\n public *[Symbol.iterator](): Iterator<TileTreeReference> {\r\n this.load();\r\n for (const modelRef of this._refs.values())\r\n for (const ref of modelRef)\r\n yield ref;\r\n }\r\n\r\n public setDeactivated(modelIds: Id64String | Id64String[] | undefined, deactivated: boolean, refs: \"all\" | \"animated\" | \"primary\" | \"section\" | number[]): void {\r\n if (undefined === modelIds) {\r\n for (const model of this._refs.values())\r\n model.setDeactivated(deactivated, refs);\r\n\r\n return;\r\n }\r\n\r\n if (typeof modelIds === \"string\")\r\n modelIds = [modelIds];\r\n\r\n for (const modelId of modelIds)\r\n this._refs.get(modelId)?.setDeactivated(deactivated, refs);\r\n }\r\n\r\n private load(): void {\r\n if (!this._allLoaded) {\r\n this._allLoaded = true;\r\n this.updateModels();\r\n }\r\n\r\n const curScript = this._view.displayStyle.scheduleScriptReference; // eslint-disable-line deprecation/deprecation\r\n const prevScript = this._scheduleScript;\r\n if (curScript !== prevScript) {\r\n this._scheduleScript = curScript;\r\n if (!curScript || !prevScript || !curScript.script.equals(prevScript.script))\r\n for (const ref of this._refs.values())\r\n ref.updateAnimated(curScript);\r\n }\r\n\r\n const sectionCut = this.getSectionCutFromView();\r\n if (sectionCut?.clipString !== this._sectionCut?.clipString) {\r\n this._sectionCut = sectionCut;\r\n for (const ref of this._refs.values())\r\n ref.updateSectionCut(sectionCut);\r\n }\r\n }\r\n\r\n private getSectionCutFromView(): StringifiedClipVector | undefined {\r\n const wantCut = this._view.viewFlags.clipVolume && this._view.displayStyle.settings.clipStyle.produceCutGeometry;\r\n const clip = wantCut ? this._view.getViewClip() : undefined;\r\n return StringifiedClipVector.fromClipVector(clip);\r\n }\r\n\r\n /** Ensure this._refs contains a SpatialModelRefs for all loaded models in the model selector. */\r\n private updateModels(): void {\r\n const prev = this._refs;\r\n const cur = this._swapRefs;\r\n this._refs = cur;\r\n this._swapRefs = prev;\r\n cur.clear();\r\n\r\n for (const modelId of this._view.modelSelector.models) {\r\n let modelRefs = prev.get(modelId);\r\n if (!modelRefs) {\r\n const model = this._view.iModel.models.getLoaded(modelId)?.asGeometricModel3d;\r\n if (model) {\r\n modelRefs = new SpatialModelRefs(model, this._view);\r\n modelRefs.updateAnimated(this._scheduleScript);\r\n modelRefs.updateSectionCut(this._sectionCut);\r\n }\r\n }\r\n\r\n if (modelRefs)\r\n cur.set(modelId, modelRefs);\r\n }\r\n }\r\n}\r\n"]}
@@ -118,7 +118,7 @@ class TileDrawArgs {
118
118
  }
119
119
  computePixelSizeScaleFactor() {
120
120
  // Check to see if a model display transform with non-uniform scaling is being used.
121
- const mat = this.context.viewport.view.modelDisplayTransformProvider?.getModelDisplayTransform(this.tree.modelId)?.matrix;
121
+ const mat = this.context.viewport.view.modelDisplayTransformProvider?.getModelDisplayTransform(this.tree.modelId)?.transform.matrix;
122
122
  if (!mat)
123
123
  return 1;
124
124
  const scale = [0, 1, 2].map((x) => mat.getColumn(x).magnitude());