@itwin/core-frontend 3.0.0-dev.157 → 3.0.0-dev.159
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.
- package/lib/cjs/render/GraphicBuilder.d.ts +1 -1
- package/lib/cjs/render/GraphicBuilder.js.map +1 -1
- package/lib/cjs/tile/B3dmReader.d.ts +1 -0
- package/lib/cjs/tile/B3dmReader.d.ts.map +1 -1
- package/lib/cjs/tile/B3dmReader.js +3 -2
- package/lib/cjs/tile/B3dmReader.js.map +1 -1
- package/lib/cjs/tile/GltfReader.d.ts +438 -32
- package/lib/cjs/tile/GltfReader.d.ts.map +1 -1
- package/lib/cjs/tile/GltfReader.js +409 -166
- package/lib/cjs/tile/GltfReader.js.map +1 -1
- package/lib/cjs/tile/I3dmReader.d.ts +1 -0
- package/lib/cjs/tile/I3dmReader.d.ts.map +1 -1
- package/lib/cjs/tile/I3dmReader.js +2 -1
- package/lib/cjs/tile/I3dmReader.js.map +1 -1
- package/lib/cjs/tile/ImdlReader.d.ts +334 -10
- package/lib/cjs/tile/ImdlReader.d.ts.map +1 -1
- package/lib/cjs/tile/ImdlReader.js +84 -44
- package/lib/cjs/tile/ImdlReader.js.map +1 -1
- package/lib/esm/render/GraphicBuilder.d.ts +1 -1
- package/lib/esm/render/GraphicBuilder.js.map +1 -1
- package/lib/esm/tile/B3dmReader.d.ts +1 -0
- package/lib/esm/tile/B3dmReader.d.ts.map +1 -1
- package/lib/esm/tile/B3dmReader.js +4 -3
- package/lib/esm/tile/B3dmReader.js.map +1 -1
- package/lib/esm/tile/GltfReader.d.ts +438 -32
- package/lib/esm/tile/GltfReader.d.ts.map +1 -1
- package/lib/esm/tile/GltfReader.js +384 -143
- package/lib/esm/tile/GltfReader.js.map +1 -1
- package/lib/esm/tile/I3dmReader.d.ts +1 -0
- package/lib/esm/tile/I3dmReader.d.ts.map +1 -1
- package/lib/esm/tile/I3dmReader.js +2 -1
- package/lib/esm/tile/I3dmReader.js.map +1 -1
- package/lib/esm/tile/ImdlReader.d.ts +334 -10
- package/lib/esm/tile/ImdlReader.d.ts.map +1 -1
- package/lib/esm/tile/ImdlReader.js +86 -46
- package/lib/esm/tile/ImdlReader.js.map +1 -1
- package/package.json +22 -22
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImdlReader.js","sourceRoot":"","sources":["../../../src/tile/ImdlReader.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAgF;AAChF,wDAAmK;AACnK,oDAI4B;AAC5B,4CAAyC;AAEzC,2DAAyE;AAEzE,0EAA6F;AAC7F,sEAAmE;AACnE,6EAAgE;AAChE,sEAA4I;AAE5I,kEAA0F;AAC1F,8EAA2E;AAC3E,wEAAyF;AAIzF,yCAAiG;AASjG;;;;;;;GAOG;AACI,KAAK,UAAU,mBAAmB,CAAC,KAAiB,EAAE,MAAwB,EAAE,OAAmB,EAAE,IAAa,EAAE,OAA8B;IACvJ,MAAM,MAAM,GAAG,IAAI,yBAAU,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC5C,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;QAC/B,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO;QACtC,MAAM,EAAE,qBAAS,CAAC,YAAY;KAC/B,CAAC,CAAC;IAEH,IAAI,CAAC,MAAM;QACT,OAAO,SAAS,CAAC;IAEnB,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;IACnC,OAAO,MAAM,CAAC,OAAO,CAAC;AACxB,CAAC;AAZD,kDAYC;AAED,MAAM,WAAW,GAAG,WAAW,CAAC;AAChC,SAAS,aAAa,CAAC,QAAgB;IACrC,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IAC1C,IAAA,qBAAM,EAAC,CAAC,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,C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CAAC,CAAC;qBAC/B;oBAED,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE;wBAC5B,MAAM,YAAY,GAAG,CAAC,KAAK,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,aAAa,CAAC,CAAC;wBACnH,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC,CAAC;qBACvE;iBACF;aACF;SACF;QAED,IAAI,WAAsC,CAAC;QAC3C,QAAQ,QAAQ,CAAC,MAAM,EAAE;YACvB,KAAK,CAAC;gBACJ,MAAM;YACR,KAAK,CAAC;gBACJ,WAAW,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;gBAC1B,MAAM;YACR;gBACE,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;gBACvD,MAAM;SACT;QAED,IAAI,SAAS,KAAK,WAAW,IAAI,KAAK,KAAK,IAAI,CAAC,QAAQ;YACtD,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;QAEjG,OAAO;YACL,UAAU,EAAE,4BAAc,CAAC,OAAO;YAClC,MAAM;YACN,cAAc;YACd,YAAY,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,YAAY;YAC5D,OAAO,EAAE,WAAW;YACpB,iBAAiB;SAClB,CAAC;IACJ,CAAC;CACF;AA9vBD,gCA8vBC","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 { assert, ByteStream, Id64String, JsonUtils } from \"@itwin/core-bentley\";\r\nimport { ClipVector, ClipVectorProps, Point2d, Point3d, Range2d, Range3d, Range3dProps, Transform, TransformProps, XYProps, XYZProps } from \"@itwin/core-geometry\";\r\nimport {\r\n BatchType, ColorDef, ColorDefProps, ElementAlignedBox3d, FeatureIndexType, FeatureTableHeader, FillFlags, Gradient, ImageSource, ImdlHeader, LinePixels,\r\n PackedFeatureTable, PolylineTypeFlags, QParams2d, QParams3d, readTileContentDescription, RenderMaterial, RenderTexture, TextureMapping,\r\n TileReadError, TileReadStatus,\r\n} from \"@itwin/core-common\";\r\nimport { IModelApp } from \"../IModelApp\";\r\nimport { IModelConnection } from \"../IModelConnection\";\r\nimport { AnimationNodeId, GraphicBranch } from \"../render/GraphicBranch\";\r\nimport { InstancedGraphicParams } from \"../render/InstancedGraphicParams\";\r\nimport { AuxChannelTable, AuxChannelTableProps } from \"../render/primitives/AuxChannelTable\";\r\nimport { DisplayParams } from \"../render/primitives/DisplayParams\";\r\nimport { Mesh } from \"../render/primitives/mesh/MeshPrimitives\";\r\nimport { createSurfaceMaterial, isValidSurfaceType, SurfaceMaterial, SurfaceParams, SurfaceType } from \"../render/primitives/SurfaceParams\";\r\nimport { EdgeParams, IndexedEdgeParams, SegmentEdgeParams, SilhouetteParams } from \"../render/primitives/EdgeParams\";\r\nimport { MeshParams, VertexIndices, VertexTable } from \"../render/primitives/VertexTable\";\r\nimport { PointStringParams } from \"../render/primitives/PointStringParams\";\r\nimport { PolylineParams, TesselatedPolyline } from \"../render/primitives/PolylineParams\";\r\nimport { RenderGraphic } from \"../render/RenderGraphic\";\r\nimport { RenderGeometry, RenderSystem } from \"../render/RenderSystem\";\r\nimport { BatchOptions } from \"../render/GraphicBuilder\";\r\nimport { GltfReader, GltfReaderProps, IModelTileContent, ShouldAbortReadGltf } from \"./internal\";\r\n\r\n/* eslint-disable no-restricted-syntax */\r\n\r\n/** @internal */\r\nexport interface ImdlReaderResult extends IModelTileContent {\r\n readStatus: TileReadStatus;\r\n}\r\n\r\n/** Convert the byte array returned by [[TileAdmin.requestElementGraphics]] into a [[RenderGraphic]].\r\n * @param bytes The binary graphics data obtained from `requestElementGraphics`.\r\n * @param iModel The iModel with which the graphics are associated.\r\n * @param modelId The Id of the [[GeometricModelState]] with which the graphics are associated. Can be an invalid Id.\r\n * @param is3d True if the graphics are 3d.\r\n * @param options Options customizing how [Feature]($common)s within the graphic can be resymbolized; or false if you don't want to produce a batch.\r\n * @public\r\n */\r\nexport async function readElementGraphics(bytes: Uint8Array, iModel: IModelConnection, modelId: Id64String, is3d: boolean, options?: BatchOptions | false): Promise<RenderGraphic | undefined> {\r\n const stream = new ByteStream(bytes.buffer);\r\n const reader = ImdlReader.create({\r\n stream, iModel, modelId, is3d, options,\r\n system: IModelApp.renderSystem,\r\n });\r\n\r\n if (!reader)\r\n return undefined;\r\n\r\n const result = await reader.read();\r\n return result.graphic;\r\n}\r\n\r\nconst nodeIdRegex = /Node_(.*)/;\r\nfunction extractNodeId(nodeName: string): number {\r\n const match = nodeName.match(nodeIdRegex);\r\n assert(!!match && match.length === 2);\r\n if (!match || match.length !== 2)\r\n return 0;\r\n\r\n const nodeId = Number.parseInt(match[1], 10);\r\n assert(!Number.isNaN(nodeId));\r\n return Number.isNaN(nodeId) ? 0 : nodeId;\r\n}\r\n\r\ninterface ImdlMaterialAtlas {\r\n readonly numMaterials: number;\r\n readonly hasTranslucency?: boolean;\r\n readonly overridesAlpha?: boolean;\r\n}\r\n\r\ninterface ImdlVertexTable {\r\n readonly bufferView: string;\r\n readonly count: number;\r\n readonly numRgbaPerVertex: number;\r\n readonly numColors?: number;\r\n readonly width: number;\r\n readonly height: number;\r\n readonly hasTranslucency: boolean;\r\n readonly featureIndexType: FeatureIndexType;\r\n readonly featureID?: number;\r\n readonly uniformColor?: ColorDefProps;\r\n readonly params: {\r\n readonly decodedMin: number[];\r\n readonly decodedMax: number[];\r\n };\r\n readonly materialAtlas?: ImdlMaterialAtlas;\r\n}\r\n\r\ninterface ImdlInstances {\r\n readonly count: number;\r\n readonly transformCenter: number[];\r\n readonly featureIds: string;\r\n readonly transforms: string;\r\n readonly symbologyOverrides?: string;\r\n}\r\n\r\ninterface ImdlPrimitive {\r\n readonly material?: string;\r\n readonly vertices: ImdlVertexTable;\r\n readonly isPlanar?: boolean;\r\n readonly viewIndependentOrigin?: XYZProps;\r\n readonly instances?: ImdlInstances;\r\n}\r\n\r\ntype ImdlAuxChannelTable = Omit<AuxChannelTableProps, \"data\"> & { bufferView: string };\r\n\r\ninterface ImdlSegmentEdges {\r\n readonly indices: string;\r\n readonly endPointAndQuadIndices: string;\r\n}\r\n\r\ninterface ImdlSilhouetteEdges extends ImdlSegmentEdges {\r\n readonly normalPairs: string;\r\n}\r\n\r\ninterface ImdlIndexedEdges {\r\n readonly indices: string;\r\n readonly edges: string;\r\n readonly width: number;\r\n readonly height: number;\r\n readonly numSegments: number;\r\n readonly silhouettePadding: number;\r\n}\r\n\r\ninterface ImdlMeshEdges {\r\n readonly segments?: ImdlSegmentEdges;\r\n readonly silhouettes?: ImdlSilhouetteEdges;\r\n readonly polylines?: ImdlPolyline;\r\n readonly indexed?: ImdlIndexedEdges;\r\n}\r\n\r\ninterface ImdlPolyline {\r\n readonly indices: string;\r\n readonly prevIndices: string;\r\n readonly nextIndicesAndParams: string;\r\n}\r\n\r\ninterface ImdlAreaPattern {\r\n readonly type: \"areaPattern\";\r\n /** Used as lookup key into ImdlReader._patternSymbols. */\r\n readonly symbolName: string;\r\n readonly clip: ClipVectorProps;\r\n readonly scale: number;\r\n readonly spacing: XYProps;\r\n readonly orgTransform: TransformProps;\r\n readonly origin: XYProps;\r\n /** Lookup key in ImdlReader._bufferViews. */\r\n readonly xyOffsets: string;\r\n readonly featureId: number;\r\n readonly modelTransform: TransformProps;\r\n readonly range: Range3dProps;\r\n readonly symbolTranslation: XYZProps;\r\n readonly viewIndependentOrigin?: XYZProps;\r\n}\r\n\r\ninterface ImdlSurface {\r\n readonly type: SurfaceType;\r\n readonly indices: string;\r\n readonly alwaysDisplayTexture?: boolean;\r\n readonly uvParams?: {\r\n readonly decodedMin: number[];\r\n readonly decodedMax: number[];\r\n };\r\n}\r\n\r\ninterface ImdlMeshPrimitive extends ImdlPrimitive {\r\n readonly type: Mesh.PrimitiveType.Mesh;\r\n readonly surface: ImdlSurface;\r\n readonly edges?: ImdlMeshEdges;\r\n readonly auxChannels?: ImdlAuxChannelTable;\r\n readonly areaPattern?: ImdlAreaPattern;\r\n}\r\n\r\ninterface ImdlPolylinePrimitive extends ImdlPrimitive, ImdlPolyline {\r\n readonly type: Mesh.PrimitiveType.Polyline;\r\n}\r\n\r\ninterface ImdlPointStringPrimitive extends ImdlPrimitive {\r\n readonly type: Mesh.PrimitiveType.Point;\r\n readonly indices: string;\r\n}\r\n\r\ntype AnyImdlPrimitive = ImdlMeshPrimitive | ImdlPolylinePrimitive | ImdlPointStringPrimitive;\r\n\r\ninterface ImdlMesh {\r\n readonly primitives?: Array<AnyImdlPrimitive | ImdlAreaPattern>;\r\n readonly layer?: string;\r\n}\r\n\r\ninterface ImdlAreaPatternSymbol {\r\n readonly primitives: AnyImdlPrimitive[];\r\n}\r\n\r\n/** Arguments supplied to [[ImdlReader.create]]\r\n * @internal\r\n */\r\nexport interface ImdlReaderCreateArgs {\r\n stream: ByteStream;\r\n iModel: IModelConnection;\r\n modelId: Id64String;\r\n is3d: boolean;\r\n system: RenderSystem;\r\n type?: BatchType; // default Primary\r\n loadEdges?: boolean; // default true\r\n isCanceled?: ShouldAbortReadGltf;\r\n sizeMultiplier?: number;\r\n options?: BatchOptions | false;\r\n containsTransformNodes?: boolean; // default false\r\n}\r\n\r\n/** Deserializes tile content in iMdl format. These tiles contain element geometry encoded into a format optimized for the imodeljs webgl renderer.\r\n * @internal\r\n */\r\nexport class ImdlReader extends GltfReader {\r\n private readonly _sizeMultiplier?: number;\r\n private readonly _loadEdges: boolean;\r\n private readonly _options: BatchOptions | false;\r\n private readonly _patternSymbols: { [key: string]: ImdlAreaPatternSymbol | undefined };\r\n private readonly _patternGeometry = new Map<string, RenderGeometry[]>();\r\n private readonly _containsTransformNodes: boolean;\r\n\r\n /** Attempt to initialize an ImdlReader to deserialize iModel tile data beginning at the stream's current position. */\r\n public static create(args: ImdlReaderCreateArgs): ImdlReader | undefined {\r\n const header = new ImdlHeader(args.stream);\r\n if (!header.isValid || !header.isReadableVersion)\r\n return undefined;\r\n\r\n // The feature table follows the iMdl header\r\n if (!this.skipFeatureTable(args.stream))\r\n return undefined;\r\n\r\n // A glTF header follows the feature table\r\n const props = GltfReaderProps.create(args.stream, false);\r\n return undefined !== props ? new ImdlReader(props, args) : undefined;\r\n }\r\n\r\n /** Attempt to deserialize the tile data */\r\n public async read(): Promise<ImdlReaderResult> {\r\n let content;\r\n try {\r\n content = readTileContentDescription(this._buffer, this._sizeMultiplier, !this._is3d, IModelApp.tileAdmin, this._isVolumeClassifier);\r\n } catch (e) {\r\n if (e instanceof TileReadError)\r\n return { isLeaf: true, readStatus: e.errorNumber };\r\n else\r\n throw e;\r\n }\r\n\r\n const featureTable = this.readFeatureTable(content.featureTableStartPos);\r\n if (undefined === featureTable)\r\n return { readStatus: TileReadStatus.InvalidFeatureTable, isLeaf: true };\r\n\r\n // Textures must be loaded asynchronously first...\r\n await this.loadNamedTextures();\r\n if (this._isCanceled)\r\n return { readStatus: TileReadStatus.Canceled, isLeaf: true };\r\n\r\n return this.finishRead(content.isLeaf, featureTable, content.contentRange, content.emptySubRangeMask, content.sizeMultiplier);\r\n }\r\n\r\n /** @internal */\r\n protected override extractReturnToCenter(_extensions: any): number[] | undefined { return undefined; }\r\n\r\n /** @internal */\r\n protected override createDisplayParams(json: any): DisplayParams | undefined {\r\n const type = JsonUtils.asInt(json.type, DisplayParams.Type.Mesh);\r\n const lineColor = ColorDef.create(JsonUtils.asInt(json.lineColor));\r\n const fillColor = ColorDef.create(JsonUtils.asInt(json.fillColor));\r\n const width = JsonUtils.asInt(json.lineWidth);\r\n const linePixels = JsonUtils.asInt(json.linePixels, LinePixels.Solid);\r\n const fillFlags = JsonUtils.asInt(json.fillFlags, FillFlags.None);\r\n const ignoreLighting = JsonUtils.asBool(json.ignoreLighting);\r\n\r\n // Material will always contain its own texture if it has one\r\n const materialKey = json.materialId;\r\n const material = undefined !== materialKey ? this.materialFromJson(materialKey) : undefined;\r\n\r\n // We will only attempt to include the texture if material is undefined\r\n let textureMapping;\r\n if (!material) {\r\n const textureJson = json.texture;\r\n textureMapping = undefined !== textureJson ? this.textureMappingFromJson(textureJson) : undefined;\r\n\r\n if (undefined === textureMapping) {\r\n // Look for a gradient. If defined, create a texture mapping. No reason to pass the Gradient.Symb to the DisplayParams once we have the texture.\r\n const gradientProps = json.gradient as Gradient.SymbProps;\r\n const gradient = undefined !== gradientProps ? Gradient.Symb.fromJSON(gradientProps) : undefined;\r\n if (undefined !== gradient) {\r\n const texture = this._system.getGradientTexture(gradient, this._iModel);\r\n if (undefined !== texture) {\r\n // ###TODO: would be better if DisplayParams created the TextureMapping - but that requires an IModelConnection and a RenderSystem...\r\n textureMapping = new TextureMapping(texture, new TextureMapping.Params({ textureMat2x3: new TextureMapping.Trans2x3(0, 1, 0, 1, 0, 0) }));\r\n }\r\n }\r\n }\r\n }\r\n\r\n return new DisplayParams(type, lineColor, fillColor, width, linePixels, fillFlags, material, undefined, ignoreLighting, textureMapping);\r\n }\r\n\r\n /** @internal */\r\n protected colorDefFromMaterialJson(json: any): ColorDef | undefined {\r\n return undefined !== json ? ColorDef.from(json[0] * 255 + 0.5, json[1] * 255 + 0.5, json[2] * 255 + 0.5) : undefined;\r\n }\r\n\r\n /** @internal */\r\n protected materialFromJson(key: string): RenderMaterial | undefined {\r\n if (this._renderMaterials === undefined || this._renderMaterials[key] === undefined)\r\n return undefined;\r\n\r\n let material = this._system.findMaterial(key, this._iModel);\r\n if (!material) {\r\n const materialJson = this._renderMaterials[key];\r\n\r\n const materialParams = new RenderMaterial.Params(key);\r\n materialParams.diffuseColor = this.colorDefFromMaterialJson(materialJson.diffuseColor);\r\n if (materialJson.diffuse !== undefined)\r\n materialParams.diffuse = JsonUtils.asDouble(materialJson.diffuse);\r\n materialParams.specularColor = this.colorDefFromMaterialJson(materialJson.specularColor);\r\n if (materialJson.specular !== undefined)\r\n materialParams.specular = JsonUtils.asDouble(materialJson.specular);\r\n materialParams.reflectColor = this.colorDefFromMaterialJson(materialJson.reflectColor);\r\n if (materialJson.reflect !== undefined)\r\n materialParams.reflect = JsonUtils.asDouble(materialJson.reflect);\r\n\r\n if (materialJson.specularExponent !== undefined)\r\n materialParams.specularExponent = materialJson.specularExponent;\r\n\r\n if (undefined !== materialJson.transparency)\r\n materialParams.alpha = 1.0 - materialJson.transparency;\r\n\r\n materialParams.refract = JsonUtils.asDouble(materialJson.refract);\r\n materialParams.shadows = JsonUtils.asBool(materialJson.shadows);\r\n materialParams.ambient = JsonUtils.asDouble(materialJson.ambient);\r\n\r\n if (undefined !== materialJson.textureMapping)\r\n materialParams.textureMapping = this.textureMappingFromJson(materialJson.textureMapping.texture);\r\n\r\n material = this._system.createMaterial(materialParams, this._iModel);\r\n }\r\n\r\n return material;\r\n }\r\n\r\n private textureMappingFromJson(json: any): TextureMapping | undefined {\r\n if (undefined === json)\r\n return undefined;\r\n\r\n const name = JsonUtils.asString(json.name);\r\n const namedTex = 0 !== name.length ? this._namedTextures[name] : undefined;\r\n const texture = undefined !== namedTex ? namedTex.renderTexture as RenderTexture : undefined;\r\n if (undefined === texture) {\r\n assert(false, \"bad texture mapping json\");\r\n return undefined;\r\n }\r\n\r\n const paramsJson = json.params;\r\n const tf = paramsJson.transform;\r\n const paramProps: TextureMapping.ParamProps = {\r\n textureMat2x3: new TextureMapping.Trans2x3(tf[0][0], tf[0][1], tf[0][2], tf[1][0], tf[1][1], tf[1][2]),\r\n textureWeight: JsonUtils.asDouble(paramsJson.weight, 1.0),\r\n mapMode: JsonUtils.asInt(paramsJson.mode),\r\n worldMapping: JsonUtils.asBool(paramsJson.worldMapping),\r\n };\r\n\r\n return new TextureMapping(texture, new TextureMapping.Params(paramProps));\r\n }\r\n\r\n private async loadNamedTextures(): Promise<void> {\r\n if (undefined === this._namedTextures)\r\n return;\r\n\r\n const promises = new Array<Promise<void>>();\r\n for (const name of Object.keys(this._namedTextures))\r\n promises.push(this.loadNamedTexture(name));\r\n\r\n if (promises.length > 0)\r\n await Promise.all(promises);\r\n }\r\n\r\n private async loadNamedTexture(name: string): Promise<void> {\r\n if (this._isCanceled)\r\n return;\r\n\r\n const namedTex = this._namedTextures[name];\r\n assert(undefined !== namedTex); // we got here by iterating the keys of this.namedTextures...\r\n if (undefined === namedTex)\r\n return;\r\n\r\n const texture = this._system.findTexture(name, this._iModel);\r\n if (undefined !== texture) {\r\n namedTex.renderTexture = texture;\r\n return;\r\n }\r\n\r\n namedTex.renderTexture = await this.readNamedTexture(namedTex, name);\r\n }\r\n\r\n private async readNamedTexture(namedTex: any, name: string): Promise<RenderTexture | undefined> {\r\n // Reasons a texture could be embedded in the tile content instead of requested separately from the backend:\r\n // - external textures are disabled\r\n // - the texture name is not a valid Id64 string\r\n // - the texture is below a certain backend-hardcoded size threshold\r\n // The bufferViewJson being defined signifies any of the above conditions. In that case, the image content\r\n // has been embedded in the tile contents. Otherwise, we will attempt to request the image content separately\r\n // from the backend.\r\n\r\n let textureType = RenderTexture.Type.Normal;\r\n const isGlyph = JsonUtils.asBool(namedTex.isGlyph);\r\n const isTileSection = !isGlyph && JsonUtils.asBool(namedTex.isTileSection);\r\n if (isGlyph)\r\n textureType = RenderTexture.Type.Glyph;\r\n else if (isTileSection)\r\n textureType = RenderTexture.Type.TileSection;\r\n\r\n // We produce unique tile sections for very large (> 8 megapixel) textures, and unique glyph atlases for raster text.\r\n // Neither should be cached.\r\n const cacheable = !isGlyph && !isTileSection;\r\n const ownership = cacheable ? { iModel: this._iModel, key: name } : undefined;\r\n\r\n const bufferViewId = JsonUtils.asString(namedTex.bufferView);\r\n const bufferViewJson = 0 !== bufferViewId.length ? this._bufferViews[bufferViewId] : undefined;\r\n\r\n if (undefined !== bufferViewJson) { // presence of bufferViewJson signifies we should read the texture from the tile content\r\n const byteOffset = JsonUtils.asInt(bufferViewJson.byteOffset);\r\n const byteLength = JsonUtils.asInt(bufferViewJson.byteLength);\r\n if (0 === byteLength)\r\n return undefined;\r\n\r\n const texBytes = this._binaryData.subarray(byteOffset, byteOffset + byteLength);\r\n const format = namedTex.format;\r\n const source = new ImageSource(texBytes, format);\r\n return this._system.createTextureFromSource({ source, ownership, type: textureType });\r\n }\r\n\r\n // bufferViewJson was undefined, so attempt to request the texture directly from the backend\r\n // eslint-disable-next-line deprecation/deprecation\r\n const params = new RenderTexture.Params(cacheable ? name : undefined, textureType);\r\n return this._system.createTextureFromElement(name, this._iModel, params, namedTex.format);\r\n }\r\n\r\n /** @internal */\r\n protected readFeatureTable(startPos: number): PackedFeatureTable | undefined {\r\n this._buffer.curPos = startPos;\r\n const header = FeatureTableHeader.readFrom(this._buffer);\r\n if (undefined === header || 0 !== header.length % 4)\r\n return undefined;\r\n\r\n // NB: We make a copy of the sub-array because we don't want to pin the entire data array in memory.\r\n const numUint32s = (header.length - FeatureTableHeader.sizeInBytes) / 4;\r\n const packedFeatureArray = new Uint32Array(this._buffer.nextUint32s(numUint32s));\r\n if (this._buffer.isPastTheEnd)\r\n return undefined;\r\n\r\n let animNodesArray: Uint8Array | Uint16Array | Uint32Array | undefined;\r\n const animationNodes = JsonUtils.asObject(this._scene.animationNodes);\r\n if (undefined !== animationNodes) {\r\n const bytesPerId = JsonUtils.asInt(animationNodes.bytesPerId);\r\n const bufferViewId = JsonUtils.asString(animationNodes.bufferView);\r\n const bufferViewJson = this._bufferViews[bufferViewId];\r\n if (undefined !== bufferViewJson) {\r\n const byteOffset = JsonUtils.asInt(bufferViewJson.byteOffset);\r\n const byteLength = JsonUtils.asInt(bufferViewJson.byteLength);\r\n const bytes = this._binaryData.subarray(byteOffset, byteOffset + byteLength);\r\n switch (bytesPerId) {\r\n case 1:\r\n animNodesArray = new Uint8Array(bytes);\r\n break;\r\n case 2:\r\n // NB: A *copy* of the subarray.\r\n animNodesArray = Uint16Array.from(new Uint16Array(bytes.buffer, bytes.byteOffset, bytes.byteLength / 2));\r\n break;\r\n case 4:\r\n // NB: A *copy* of the subarray.\r\n animNodesArray = Uint32Array.from(new Uint32Array(bytes.buffer, bytes.byteOffset, bytes.byteLength / 4));\r\n break;\r\n }\r\n }\r\n }\r\n\r\n this._buffer.curPos = startPos + header.length;\r\n\r\n return new PackedFeatureTable(packedFeatureArray, this._modelId, header.count, header.maxFeatures, this._type, animNodesArray);\r\n }\r\n\r\n private constructor(props: GltfReaderProps, args: ImdlReaderCreateArgs) {\r\n super(props, args.iModel, args.modelId, args.is3d, args.system, args.type, args.isCanceled);\r\n this._sizeMultiplier = args.sizeMultiplier;\r\n this._loadEdges = args.loadEdges ?? true;\r\n this._options = args.options ?? {};\r\n this._containsTransformNodes = args.containsTransformNodes ?? false;\r\n this._patternSymbols = props.scene.patternSymbols ?? {};\r\n }\r\n\r\n private static skipFeatureTable(stream: ByteStream): boolean {\r\n const startPos = stream.curPos;\r\n const header = FeatureTableHeader.readFrom(stream);\r\n if (undefined !== header)\r\n stream.curPos = startPos + header.length;\r\n\r\n return undefined !== header;\r\n }\r\n\r\n private readAreaPattern(json: ImdlAreaPattern): RenderGraphic | undefined {\r\n const geometry = this.getPatternGeometry(json.symbolName);\r\n if (!geometry || geometry.length === 0)\r\n return undefined;\r\n\r\n const xyOffsets = this.findBuffer(json.xyOffsets);\r\n if (!xyOffsets)\r\n return undefined;\r\n\r\n const clip = ClipVector.fromJSON(json.clip);\r\n const clipVolume = clip && clip.isValid ? this._system.createClipVolume(clip) : undefined;\r\n if (!clipVolume)\r\n return undefined;\r\n\r\n const viewIndependentOrigin = json.viewIndependentOrigin ? Point3d.fromJSON(json.viewIndependentOrigin) : undefined;\r\n const pattern = this._system.createAreaPattern({\r\n xyOffsets: new Float32Array(xyOffsets.buffer, xyOffsets.byteOffset, xyOffsets.byteLength / 4),\r\n featureId: json.featureId,\r\n orgTransform: Transform.fromJSON(json.orgTransform),\r\n origin: Point2d.fromJSON(json.origin),\r\n scale: json.scale,\r\n spacing: Point2d.fromJSON(json.spacing),\r\n patternToModel: Transform.fromJSON(json.modelTransform),\r\n range: Range3d.fromJSON(json.range),\r\n symbolTranslation: Point3d.fromJSON(json.symbolTranslation),\r\n viewIndependentOrigin,\r\n });\r\n\r\n if (!pattern)\r\n return undefined;\r\n\r\n const branch = new GraphicBranch(true);\r\n for (const geom of geometry) {\r\n const graphic = this._system.createRenderGraphic(geom, pattern);\r\n if (graphic)\r\n branch.add(graphic);\r\n }\r\n\r\n if (branch.isEmpty)\r\n return undefined;\r\n\r\n return this._system.createGraphicBranch(branch, Transform.createIdentity(), { clipVolume });\r\n }\r\n\r\n private readMeshGraphic(primitive: AnyImdlPrimitive | ImdlAreaPattern): RenderGraphic | undefined {\r\n if (primitive.type === \"areaPattern\")\r\n return this.readAreaPattern(primitive);\r\n\r\n const instances = this.readInstances(primitive);\r\n const geometry = this.readPrimitiveGeometry(primitive);\r\n return geometry ? this._system.createRenderGraphic(geometry, instances) : undefined;\r\n }\r\n\r\n private findBuffer(bufferViewId: string): Uint8Array | undefined {\r\n if (typeof bufferViewId !== \"string\" || 0 === bufferViewId.length)\r\n return undefined;\r\n\r\n const bufferViewJson = this._bufferViews[bufferViewId];\r\n if (undefined === bufferViewJson)\r\n return undefined;\r\n\r\n const byteOffset = JsonUtils.asInt(bufferViewJson.byteOffset);\r\n const byteLength = JsonUtils.asInt(bufferViewJson.byteLength);\r\n if (0 === byteLength)\r\n return undefined;\r\n\r\n return this._binaryData.subarray(byteOffset, byteOffset + byteLength);\r\n }\r\n\r\n private readVertexTable(primitive: AnyImdlPrimitive): VertexTable | undefined {\r\n const json = primitive.vertices;\r\n if (undefined === json)\r\n return undefined;\r\n\r\n const bytes = this.findBuffer(JsonUtils.asString(json.bufferView));\r\n if (undefined === bytes)\r\n return undefined;\r\n\r\n const uniformFeatureID = undefined !== json.featureID ? JsonUtils.asInt(json.featureID) : undefined;\r\n\r\n const rangeMin = JsonUtils.asArray(json.params.decodedMin);\r\n const rangeMax = JsonUtils.asArray(json.params.decodedMax);\r\n if (undefined === rangeMin || undefined === rangeMax)\r\n return undefined;\r\n\r\n const qparams = QParams3d.fromRange(Range3d.create(Point3d.create(rangeMin[0], rangeMin[1], rangeMin[2]), Point3d.create(rangeMax[0], rangeMax[1], rangeMax[2])));\r\n\r\n const uniformColor = undefined !== json.uniformColor ? ColorDef.fromJSON(json.uniformColor) : undefined;\r\n let uvParams: QParams2d | undefined;\r\n if (Mesh.PrimitiveType.Mesh === primitive.type && primitive.surface && primitive.surface.uvParams) {\r\n const uvMin = primitive.surface.uvParams.decodedMin;\r\n const uvMax = primitive.surface.uvParams.decodedMax;\r\n const uvRange = new Range2d(uvMin[0], uvMin[1], uvMax[0], uvMax[1]);\r\n uvParams = QParams2d.fromRange(uvRange);\r\n }\r\n\r\n return new VertexTable({\r\n data: bytes,\r\n qparams,\r\n width: json.width,\r\n height: json.height,\r\n hasTranslucency: json.hasTranslucency,\r\n uniformColor,\r\n featureIndexType: json.featureIndexType,\r\n uniformFeatureID,\r\n numVertices: json.count,\r\n numRgbaPerVertex: json.numRgbaPerVertex,\r\n uvParams,\r\n });\r\n }\r\n\r\n private readAuxChannelTable(primitive: ImdlMeshPrimitive): AuxChannelTable | undefined {\r\n const json = primitive.auxChannels;\r\n if (undefined === json)\r\n return undefined;\r\n\r\n const bytes = this.findBuffer(JsonUtils.asString(json.bufferView));\r\n if (undefined === bytes)\r\n return undefined;\r\n\r\n const props: AuxChannelTableProps = {\r\n data: bytes,\r\n width: json.width,\r\n height: json.height,\r\n count: json.count,\r\n numBytesPerVertex: json.numBytesPerVertex,\r\n displacements: json.displacements,\r\n normals: json.normals,\r\n params: json.params,\r\n };\r\n\r\n return AuxChannelTable.fromJSON(props);\r\n }\r\n\r\n private readInstances(primitive: ImdlPrimitive): InstancedGraphicParams | undefined {\r\n const json = primitive.instances;\r\n if (undefined === json)\r\n return undefined;\r\n\r\n const count = JsonUtils.asInt(json.count, 0);\r\n if (count <= 0)\r\n return undefined;\r\n\r\n const centerComponents = JsonUtils.asArray(json.transformCenter);\r\n if (undefined === centerComponents || 3 !== centerComponents.length)\r\n return undefined;\r\n\r\n const transformCenter = Point3d.create(centerComponents[0], centerComponents[1], centerComponents[2]);\r\n\r\n const featureIds = this.findBuffer(JsonUtils.asString(json.featureIds));\r\n if (undefined === featureIds)\r\n return undefined;\r\n\r\n const transformBytes = this.findBuffer(JsonUtils.asString(json.transforms));\r\n if (undefined === transformBytes)\r\n return undefined;\r\n\r\n // 1 transform = 3 rows of 4 floats = 12 floats per instance\r\n const numFloats = transformBytes.byteLength / 4;\r\n assert(Math.floor(numFloats) === numFloats);\r\n assert(0 === numFloats % 12);\r\n\r\n const transforms = new Float32Array(transformBytes.buffer, transformBytes.byteOffset, numFloats);\r\n\r\n let symbologyOverrides: Uint8Array | undefined;\r\n if (undefined !== json.symbologyOverrides)\r\n symbologyOverrides = this.findBuffer(JsonUtils.asString(json.symbologyOverrides));\r\n\r\n return { count, transforms, transformCenter, featureIds, symbologyOverrides };\r\n }\r\n\r\n private readVertexIndices(bufferName: string): VertexIndices | undefined {\r\n const bytes = this.findBuffer(bufferName);\r\n return undefined !== bytes ? new VertexIndices(bytes) : undefined;\r\n }\r\n\r\n private createPointStringGeometry(primitive: ImdlPointStringPrimitive, displayParams: DisplayParams, vertices: VertexTable, viewIndependentOrigin: Point3d | undefined): RenderGeometry | undefined {\r\n const indices = this.readVertexIndices(primitive.indices);\r\n if (undefined === indices)\r\n return undefined;\r\n\r\n const params = new PointStringParams(vertices, indices, displayParams.width);\r\n return this._system.createPointStringGeometry(params, viewIndependentOrigin);\r\n }\r\n\r\n private readTesselatedPolyline(json: ImdlPolyline): TesselatedPolyline | undefined {\r\n const indices = this.readVertexIndices(json.indices);\r\n const prevIndices = this.readVertexIndices(json.prevIndices);\r\n const nextIndicesAndParams = this.findBuffer(json.nextIndicesAndParams);\r\n\r\n if (!indices || !prevIndices || !nextIndicesAndParams)\r\n return undefined;\r\n\r\n return { indices, prevIndices, nextIndicesAndParams };\r\n }\r\n\r\n private createPolylineGeometry(primitive: ImdlPolylinePrimitive, displayParams: DisplayParams, vertices: VertexTable, isPlanar: boolean, viewIndependentOrigin: Point3d | undefined): RenderGeometry | undefined {\r\n const polyline = this.readTesselatedPolyline(primitive);\r\n if (undefined === polyline)\r\n return undefined;\r\n\r\n let flags = PolylineTypeFlags.Normal;\r\n if (DisplayParams.RegionEdgeType.Outline === displayParams.regionEdgeType)\r\n flags = (undefined === displayParams.gradient || displayParams.gradient.isOutlined) ? PolylineTypeFlags.Edge : PolylineTypeFlags.Outline;\r\n\r\n const params = new PolylineParams(vertices, polyline, displayParams.width, displayParams.linePixels, isPlanar, flags);\r\n return this._system.createPolylineGeometry(params, viewIndependentOrigin);\r\n }\r\n\r\n private readSurface(mesh: ImdlMeshPrimitive, displayParams: DisplayParams): SurfaceParams | undefined {\r\n const surf = mesh.surface;\r\n if (undefined === surf)\r\n return undefined;\r\n\r\n const indices = this.readVertexIndices(surf.indices);\r\n if (undefined === indices)\r\n return undefined;\r\n\r\n const type = surf.type;\r\n if (!isValidSurfaceType(type))\r\n return undefined;\r\n\r\n const texture = undefined !== displayParams.textureMapping ? displayParams.textureMapping.texture : undefined;\r\n let material: SurfaceMaterial | undefined;\r\n const atlas = mesh.vertices.materialAtlas;\r\n const numColors = mesh.vertices.numColors;\r\n if (undefined !== atlas && undefined !== numColors) {\r\n material = {\r\n isAtlas: true,\r\n hasTranslucency: JsonUtils.asBool(atlas.hasTranslucency),\r\n overridesAlpha: JsonUtils.asBool(atlas.overridesAlpha, false),\r\n vertexTableOffset: JsonUtils.asInt(numColors),\r\n numMaterials: JsonUtils.asInt(atlas.numMaterials),\r\n };\r\n } else {\r\n material = createSurfaceMaterial(displayParams.material);\r\n }\r\n\r\n const textureMapping = undefined !== texture ? { texture, alwaysDisplayed: JsonUtils.asBool(surf.alwaysDisplayTexture) } : undefined;\r\n return {\r\n type,\r\n indices,\r\n fillFlags: displayParams.fillFlags,\r\n hasBakedLighting: false,\r\n hasFixedNormals: false,\r\n material,\r\n textureMapping,\r\n };\r\n }\r\n\r\n private readSegmentEdges(json: ImdlSegmentEdges): SegmentEdgeParams | undefined {\r\n const indices = this.readVertexIndices(json.indices);\r\n const endPointAndQuadIndices = this.findBuffer(json.endPointAndQuadIndices);\r\n return undefined !== indices && undefined !== endPointAndQuadIndices ? { indices, endPointAndQuadIndices } : undefined;\r\n }\r\n\r\n private readSilhouettes(json: ImdlSilhouetteEdges): SilhouetteParams | undefined {\r\n const segments = this.readSegmentEdges(json);\r\n const normalPairs = this.findBuffer(json.normalPairs);\r\n return undefined !== segments && undefined !== normalPairs ? { normalPairs, indices: segments.indices, endPointAndQuadIndices: segments.endPointAndQuadIndices } : undefined;\r\n }\r\n\r\n private readIndexedEdges(json: ImdlIndexedEdges): IndexedEdgeParams | undefined {\r\n const indices = this.readVertexIndices(json.indices);\r\n const edgeTable = this.findBuffer(json.edges);\r\n if (!indices || !edgeTable)\r\n return undefined;\r\n\r\n return {\r\n indices,\r\n edges: {\r\n data: edgeTable,\r\n width: json.width,\r\n height: json.height,\r\n silhouettePadding: json.silhouettePadding,\r\n numSegments: json.numSegments,\r\n },\r\n };\r\n }\r\n\r\n private readEdges(json: ImdlMeshEdges, displayParams: DisplayParams): { succeeded: boolean, params?: EdgeParams } {\r\n let segments: SegmentEdgeParams | undefined;\r\n let silhouettes: SilhouetteParams | undefined;\r\n let polylines: TesselatedPolyline | undefined;\r\n let indexed: IndexedEdgeParams | undefined;\r\n\r\n let succeeded = false;\r\n if (undefined !== json.segments && undefined === (segments = this.readSegmentEdges(json.segments)))\r\n return { succeeded };\r\n\r\n if (undefined !== json.silhouettes && undefined === (silhouettes = this.readSilhouettes(json.silhouettes)))\r\n return { succeeded };\r\n\r\n if (undefined !== json.polylines && undefined === (polylines = this.readTesselatedPolyline(json.polylines)))\r\n return { succeeded };\r\n\r\n if (undefined !== json.indexed && undefined === (indexed = this.readIndexedEdges(json.indexed)))\r\n return { succeeded };\r\n\r\n succeeded = true;\r\n let params: EdgeParams | undefined;\r\n if (segments || silhouettes || polylines || indexed) {\r\n params = {\r\n segments,\r\n silhouettes,\r\n polylines,\r\n indexed,\r\n weight: displayParams.width,\r\n linePixels: displayParams.linePixels,\r\n };\r\n }\r\n\r\n return { succeeded, params };\r\n }\r\n\r\n private createMeshGeometry(primitive: ImdlMeshPrimitive, displayParams: DisplayParams, vertices: VertexTable, isPlanar: boolean, auxChannels: AuxChannelTable | undefined, viewIndependentOrigin: Point3d | undefined): RenderGeometry | undefined {\r\n const surface = this.readSurface(primitive, displayParams);\r\n if (undefined === surface)\r\n return undefined;\r\n\r\n // ###TODO: Tile generator shouldn't bother producing edges for classification meshes in the first place...\r\n let edgeParams: EdgeParams | undefined;\r\n if (this._loadEdges && undefined !== primitive.edges && SurfaceType.VolumeClassifier !== surface.type) {\r\n const edgeResult = this.readEdges(primitive.edges, displayParams);\r\n if (!edgeResult.succeeded)\r\n return undefined;\r\n else\r\n edgeParams = edgeResult.params;\r\n }\r\n\r\n const params = new MeshParams(vertices, surface, edgeParams, isPlanar, auxChannels);\r\n return this._system.createMeshGeometry(params, viewIndependentOrigin);\r\n }\r\n\r\n private readPrimitiveGeometry(primitive: AnyImdlPrimitive): RenderGeometry | undefined {\r\n const materialName = primitive.material ?? \"\";\r\n const materialValue = 0 < materialName.length ? JsonUtils.asObject(this._materialValues[materialName]) : undefined;\r\n const displayParams = undefined !== materialValue ? this.createDisplayParams(materialValue) : undefined;\r\n if (undefined === displayParams)\r\n return undefined;\r\n\r\n const vertices = this.readVertexTable(primitive);\r\n if (undefined === vertices) {\r\n assert(false, \"bad vertex table in tile data.\");\r\n return undefined;\r\n }\r\n\r\n const viOrigin = primitive.viewIndependentOrigin ? Point3d.fromJSON(primitive.viewIndependentOrigin) : undefined;\r\n const isPlanar = !this._is3d || JsonUtils.asBool(primitive.isPlanar);\r\n switch (primitive.type) {\r\n case Mesh.PrimitiveType.Mesh:\r\n return this.createMeshGeometry(primitive, displayParams, vertices, isPlanar, this.readAuxChannelTable(primitive), viOrigin);\r\n case Mesh.PrimitiveType.Polyline:\r\n return this.createPolylineGeometry(primitive, displayParams, vertices, isPlanar, viOrigin);\r\n case Mesh.PrimitiveType.Point:\r\n return this.createPointStringGeometry(primitive, displayParams, vertices, viOrigin);\r\n default:\r\n assert(false, \"unhandled primitive type\");\r\n return undefined;\r\n }\r\n }\r\n\r\n private getPatternGeometry(patternName: string): RenderGeometry[] | undefined {\r\n let geometry = this._patternGeometry.get(patternName);\r\n if (geometry)\r\n return geometry;\r\n\r\n const symbol = this._patternSymbols[patternName];\r\n if (!symbol)\r\n return undefined;\r\n\r\n geometry = [];\r\n for (const primitive of symbol.primitives) {\r\n const geom = this.readPrimitiveGeometry(primitive);\r\n if (geom)\r\n geometry.push(geom);\r\n }\r\n\r\n this._patternGeometry.set(patternName, geometry);\r\n return geometry;\r\n }\r\n\r\n private finishRead(isLeaf: boolean, featureTable: PackedFeatureTable, contentRange: ElementAlignedBox3d, emptySubRangeMask: number, sizeMultiplier?: number): ImdlReaderResult {\r\n const graphics: RenderGraphic[] = [];\r\n\r\n if (undefined === this._nodes.Node_Root) {\r\n // Unstructured -- prior to animation support....\r\n for (const meshKey of Object.keys(this._meshes)) {\r\n const meshValue = this._meshes[meshKey] as ImdlMesh | undefined;\r\n const primitives = meshValue?.primitives;\r\n if (!primitives || !meshValue)\r\n continue;\r\n\r\n for (const primitive of primitives) {\r\n const graphic = this.readMeshGraphic(primitive);\r\n if (undefined !== graphic)\r\n graphics.push(graphic);\r\n }\r\n }\r\n } else {\r\n const readBranch = (primitives: any[], nodeId: number, animationId: string | undefined) => {\r\n const branch = new GraphicBranch(true);\r\n branch.animationId = animationId;\r\n branch.animationNodeId = nodeId;\r\n\r\n for (const primitive of primitives) {\r\n const graphic = this.readMeshGraphic(primitive);\r\n if (graphic)\r\n branch.add(graphic);\r\n }\r\n\r\n if (!branch.isEmpty)\r\n graphics.push(this._system.createBranch(branch, Transform.createIdentity()));\r\n };\r\n\r\n for (const nodeKey of Object.keys(this._nodes)) {\r\n const meshValue = this._meshes[this._nodes[nodeKey]] as ImdlMesh | undefined;\r\n const primitives = meshValue?.primitives;\r\n if (!primitives || !meshValue)\r\n continue;\r\n\r\n const layerId = meshValue.layer;\r\n if (\"Node_Root\" === nodeKey) {\r\n // If transform nodes exist in the tile tree, then we need to create a branch for Node_Root so that elements not associated with\r\n // any node in the schedule script can be grouped together.\r\n if (this._containsTransformNodes) {\r\n readBranch(primitives, AnimationNodeId.Untransformed, undefined);\r\n } else {\r\n for (const primitive of primitives) {\r\n const graphic = this.readMeshGraphic(primitive);\r\n if (undefined !== graphic)\r\n graphics.push(graphic);\r\n }\r\n }\r\n } else if (undefined === layerId) {\r\n readBranch(primitives, extractNodeId(nodeKey), `${this._modelId}_${nodeKey}`);\r\n } else {\r\n const layerGraphics: RenderGraphic[] = [];\r\n for (const primitive of primitives) {\r\n const graphic = this.readMeshGraphic(primitive);\r\n if (undefined !== graphic)\r\n layerGraphics.push(graphic);\r\n }\r\n\r\n if (layerGraphics.length > 0) {\r\n const layerGraphic = 1 === layerGraphics.length ? layerGraphics[0] : this._system.createGraphicList(layerGraphics);\r\n graphics.push(this._system.createGraphicLayer(layerGraphic, layerId));\r\n }\r\n }\r\n }\r\n }\r\n\r\n let tileGraphic: RenderGraphic | undefined;\r\n switch (graphics.length) {\r\n case 0:\r\n break;\r\n case 1:\r\n tileGraphic = graphics[0];\r\n break;\r\n default:\r\n tileGraphic = this._system.createGraphicList(graphics);\r\n break;\r\n }\r\n\r\n if (undefined !== tileGraphic && false !== this._options)\r\n tileGraphic = this._system.createBatch(tileGraphic, featureTable, contentRange, this._options);\r\n\r\n return {\r\n readStatus: TileReadStatus.Success,\r\n isLeaf,\r\n sizeMultiplier,\r\n contentRange: contentRange.isNull ? undefined : contentRange,\r\n graphic: tileGraphic,\r\n emptySubRangeMask,\r\n };\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"ImdlReader.js","sourceRoot":"","sources":["../../../src/tile/ImdlReader.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA8F;AAC9F,wDAAmK;AACnK,oDAI4B;AAC5B,4CAAyC;AAEzC,2DAAyE;AAEzE,0EAA6F;AAC7F,sEAAmE;AACnE,6EAAgE;AAChE,sEAA4I;AAE5I,kEAA0F;AAC1F,8EAA2E;AAC3E,wEAAyF;AAgBzF;;;;;;;GAOG;AACI,KAAK,UAAU,mBAAmB,CAAC,KAAiB,EAAE,MAAwB,EAAE,OAAmB,EAAE,IAAa,EAAE,OAA8B;IACvJ,MAAM,MAAM,GAAG,IAAI,yBAAU,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC5C,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;QAC/B,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO;QACtC,MAAM,EAAE,qBAAS,CAAC,YAAY;KAC/B,CAAC,CAAC;IAEH,IAAI,CAAC,MAAM;QACT,OAAO,SAAS,CAAC;IAEnB,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;IACnC,OAAO,MAAM,CAAC,OAAO,CAAC;AACxB,CAAC;AAZD,kDAYC;AAED,MAAM,WAAW,GAAG,WAAW,CAAC;AAChC,SAAS,aAAa,CAAC,QAAgB;IACrC,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IAC1C,IAAA,qBAAM,EAAC,CAAC,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC;IACtC,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAC9B,OAAO,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QAED,IAAI,WAAsC,CAAC;QAC3C,QAAQ,QAAQ,CAAC,MAAM,EAAE;YACvB,KAAK,CAAC;gBACJ,MAAM;YACR,KAAK,CAAC;gBACJ,WAAW,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;gBAC1B,MAAM;YACR;gBACE,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;gBACvD,MAAM;SACT;QAED,IAAI,SAAS,KAAK,WAAW,IAAI,KAAK,KAAK,IAAI,CAAC,QAAQ;YACtD,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;QAEjG,OAAO;YACL,UAAU,EAAE,4BAAc,CAAC,OAAO;YAClC,MAAM;YACN,cAAc;YACd,YAAY,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,YAAY;YAC5D,OAAO,EAAE,WAAW;YACpB,iBAAiB;SAClB,CAAC;IACJ,CAAC;CACF;AA7zBD,gCA6zBC","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 { assert, ByteStream, Id64String, JsonUtils, utf8ToString } from \"@itwin/core-bentley\";\r\nimport { ClipVector, ClipVectorProps, Point2d, Point3d, Range2d, Range3d, Range3dProps, Transform, TransformProps, XYProps, XYZProps } from \"@itwin/core-geometry\";\r\nimport {\r\n BatchType, ColorDef, ColorDefProps, ElementAlignedBox3d, FeatureIndexType, FeatureTableHeader, FillFlags, GltfHeader, Gradient, ImageSource, ImageSourceFormat, ImdlHeader, LinePixels,\r\n PackedFeatureTable, PolylineTypeFlags, QParams2d, QParams3d, readTileContentDescription, RenderMaterial, RenderTexture, TextureMapping,\r\n TileReadError, TileReadStatus,\r\n} from \"@itwin/core-common\";\r\nimport { IModelApp } from \"../IModelApp\";\r\nimport { IModelConnection } from \"../IModelConnection\";\r\nimport { AnimationNodeId, GraphicBranch } from \"../render/GraphicBranch\";\r\nimport { InstancedGraphicParams } from \"../render/InstancedGraphicParams\";\r\nimport { AuxChannelTable, AuxChannelTableProps } from \"../render/primitives/AuxChannelTable\";\r\nimport { DisplayParams } from \"../render/primitives/DisplayParams\";\r\nimport { Mesh } from \"../render/primitives/mesh/MeshPrimitives\";\r\nimport { createSurfaceMaterial, isValidSurfaceType, SurfaceMaterial, SurfaceParams, SurfaceType } from \"../render/primitives/SurfaceParams\";\r\nimport { EdgeParams, IndexedEdgeParams, SegmentEdgeParams, SilhouetteParams } from \"../render/primitives/EdgeParams\";\r\nimport { MeshParams, VertexIndices, VertexTable } from \"../render/primitives/VertexTable\";\r\nimport { PointStringParams } from \"../render/primitives/PointStringParams\";\r\nimport { PolylineParams, TesselatedPolyline } from \"../render/primitives/PolylineParams\";\r\nimport { RenderGraphic } from \"../render/RenderGraphic\";\r\nimport { RenderGeometry, RenderSystem } from \"../render/RenderSystem\";\r\nimport { BatchOptions } from \"../render/GraphicBuilder\";\r\nimport { IModelTileContent } from \"./internal\";\r\n\r\n/** @internal */\r\nexport type ShouldAbortImdlReader = (reader: ImdlReader) => boolean;\r\n\r\n/* eslint-disable no-restricted-syntax */\r\n\r\n/** @internal */\r\nexport interface ImdlReaderResult extends IModelTileContent {\r\n readStatus: TileReadStatus;\r\n}\r\n\r\n/** Convert the byte array returned by [[TileAdmin.requestElementGraphics]] into a [[RenderGraphic]].\r\n * @param bytes The binary graphics data obtained from `requestElementGraphics`.\r\n * @param iModel The iModel with which the graphics are associated.\r\n * @param modelId The Id of the [[GeometricModelState]] with which the graphics are associated. Can be an invalid Id.\r\n * @param is3d True if the graphics are 3d.\r\n * @param options Options customizing how [Feature]($common)s within the graphic can be resymbolized; or false if you don't want to produce a batch.\r\n * @public\r\n */\r\nexport async function readElementGraphics(bytes: Uint8Array, iModel: IModelConnection, modelId: Id64String, is3d: boolean, options?: BatchOptions | false): Promise<RenderGraphic | undefined> {\r\n const stream = new ByteStream(bytes.buffer);\r\n const reader = ImdlReader.create({\r\n stream, iModel, modelId, is3d, options,\r\n system: IModelApp.renderSystem,\r\n });\r\n\r\n if (!reader)\r\n return undefined;\r\n\r\n const result = await reader.read();\r\n return result.graphic;\r\n}\r\n\r\nconst nodeIdRegex = /Node_(.*)/;\r\nfunction extractNodeId(nodeName: string): number {\r\n const match = nodeName.match(nodeIdRegex);\r\n assert(!!match && match.length === 2);\r\n if (!match || match.length !== 2)\r\n return 0;\r\n\r\n const nodeId = Number.parseInt(match[1], 10);\r\n assert(!Number.isNaN(nodeId));\r\n return Number.isNaN(nodeId) ? 0 : nodeId;\r\n}\r\n\r\n/** Describes a [ColorDef]($common) as [r, g, b] with each component in [0..1]. */\r\ntype ImdlColorDef = number[];\r\n\r\n/** Describes a [TextureMapping]($common). */\r\ninterface ImdlTextureMapping {\r\n /** Optional name, which may be the Id of a persistent [RenderTexture]($common) or some other name unique among all texture mappings within the tile. */\r\n name?: string;\r\n /** Describes the [TextureMapping.Params]($common). */\r\n params: {\r\n /** Describes a [TextureMapping.Trans2x3]($common) as a 2x3 matrix. */\r\n transform: number[][];\r\n /** @see [TextureMapping.Params.weight]($common). Default: 1.0. */\r\n weight?: number;\r\n /** Default: [TextureMapping.Mode.Parametric]($common). */\r\n mode?: TextureMapping.Mode;\r\n /** @see [TextureMapping.Params.worldMapping]($common). Default: false. */\r\n worldMapping?: boolean;\r\n };\r\n}\r\n\r\n/** Describes a [RenderTexture]($common) with its image embedded into the tile data. */\r\ninterface ImdlNamedTexture {\r\n /** If true, the image is a texture atlas containing any number of glyphs used for text. */\r\n isGlyph?: boolean;\r\n /** If true, the texture should not repeat and should not be mip-mapped. */\r\n isTileSection?: boolean;\r\n /** The Id of the [[ImdlBufferView]] containing the image data. */\r\n bufferView: string;\r\n /** The format of the image data referenced by [[bufferView]]. */\r\n format: ImageSourceFormat;\r\n}\r\n\r\n/** Describes a [[DisplayParams]]. */\r\ninterface ImdlDisplayParams {\r\n type: DisplayParams.Type;\r\n lineColor?: ColorDefProps;\r\n fillColor?: ColorDefProps;\r\n lineWidth?: number;\r\n linePixels?: LinePixels;\r\n fillFlags?: FillFlags;\r\n ignoreLighting?: boolean;\r\n materialId?: string;\r\n texture?: ImdlTextureMapping;\r\n gradient?: Gradient.SymbProps;\r\n}\r\n\r\n/** Describes a [RenderMaterial]($common). */\r\ninterface ImdlRenderMaterial {\r\n diffuseColor?: ImdlColorDef;\r\n diffuse?: number;\r\n specularColor?: ImdlColorDef;\r\n specular?: number;\r\n reflectColor?: ImdlColorDef;\r\n reflect?: number;\r\n specularExponent?: number;\r\n /** In [0..1] where 0 is fully opaque. */\r\n transparency?: number;\r\n refract?: number;\r\n shadows?: boolean;\r\n ambient?: number;\r\n textureMapping?: {\r\n texture: ImdlTextureMapping;\r\n };\r\n}\r\n\r\n/** Describes a [[SurfaceMaterialAtlas]] embedded into an [[ImdlVertexTable]]. */\r\ninterface ImdlMaterialAtlas {\r\n readonly numMaterials: number;\r\n readonly hasTranslucency?: boolean;\r\n readonly overridesAlpha?: boolean;\r\n}\r\n\r\n/** Describes a [[VertexTable]]. */\r\ninterface ImdlVertexTable {\r\n /** Id of the [[ImdlBufferView]] containing the binary vertex table data. */\r\n readonly bufferView: string;\r\n /** The number of vertices in the table. */\r\n readonly count: number;\r\n /** The number of RGBA values in the lookup texture allocated per vertex. */\r\n readonly numRgbaPerVertex: number;\r\n /** The number of colors in the color table embedded into the vertex table, or undefined if [[uniformColor]] is defined. */\r\n readonly numColors?: number;\r\n /** The width of the lookup texture. */\r\n readonly width: number;\r\n /** The height of the lookup texture. */\r\n readonly height: number;\r\n /** True if [[uniformColor]] has transparency or the embedded color table contains transparent colors. */\r\n readonly hasTranslucency: boolean;\r\n /** Describes the number (0, 1, or more than 1) of features contained in the vertex table. */\r\n readonly featureIndexType: FeatureIndexType;\r\n /** If [[featureIndexType]] is [FeatureIndexType.Uniform]($common), the ID of the feature associated with all vertices in the table. */\r\n readonly featureID?: number;\r\n /** If defined, the color associated with all vertices in the table. */\r\n readonly uniformColor?: ColorDefProps;\r\n /** The quantization range of the vertex positions. @see [QParams3d]($common). */\r\n readonly params: {\r\n readonly decodedMin: number[];\r\n readonly decodedMax: number[];\r\n };\r\n /** If the vertex table contains multiple surface materials, describes the embedded material atlas. */\r\n readonly materialAtlas?: ImdlMaterialAtlas;\r\n}\r\n\r\n/** Describes how to draw a single [[ImdlPrimitive]] repeatedly.\r\n * @see [[InstancedGraphicParams]].\r\n */\r\ninterface ImdlInstances {\r\n readonly count: number;\r\n readonly transformCenter: number[];\r\n readonly featureIds: string;\r\n readonly transforms: string;\r\n readonly symbologyOverrides?: string;\r\n}\r\n\r\n/** Describes a unit of geometry within an [[ImdlMesh]]. */\r\ninterface ImdlPrimitive {\r\n /** The Id of the associated [[ImdlDisplayParams]]. */\r\n readonly material?: string;\r\n /** A lookup table containing the primitive's vertices. */\r\n readonly vertices: ImdlVertexTable;\r\n /** If true, all the vertices lie in a single plane. */\r\n readonly isPlanar?: boolean;\r\n /** If defined, a point about which the primitive should rotate when displayed to always face the camera. */\r\n readonly viewIndependentOrigin?: XYZProps;\r\n /** If defined, describes repeated instances of the same primitive. */\r\n readonly instances?: ImdlInstances;\r\n}\r\n\r\n/** Per-vertex data used to animate and/or resymbolize a mesh.\r\n * @see [[AuxChannelTable]].\r\n */\r\ntype ImdlAuxChannelTable = Omit<AuxChannelTableProps, \"data\"> & { bufferView: string };\r\n\r\n/** Describes the \"hard\" edges of an [[ImdlMeshPrimitive]]. These edges represent simple line segments connecting two vertices of the mesh.\r\n * They are always visible regardless of view orientation.\r\n * Each segment is represented as a quad such that it can be expanded to a desired width in pixels.\r\n */\r\ninterface ImdlSegmentEdges {\r\n /** Id of the [[ImdlBufferView]] containing - for each vertex of each quad - the 24-bit index of the vertex in the mesh's [[ImdlVertexTable]]. */\r\n readonly indices: string;\r\n /** Id of the [[ImdlBufferView]] containing - for each vertex of each quad - the 24-bit index of the segmnent's other endpoint in the mesh's [[ImdlVertexTable]],\r\n * along with a \"quad index\" in [0..3] identifying which corner of the quad the vertex represents.\r\n */\r\n readonly endPointAndQuadIndices: string;\r\n}\r\n\r\n/** Describes \"hidden\" edges of an [[ImdlMeshPrimitive]]. These edges represent simple line segments connecting two vertices of the mesh.\r\n * A given silhouette is visible when only one of the faces associated with the edge is facing the camera, producing view-dependent outlines for curved\r\n * geometry like spheres and cones.\r\n */\r\ninterface ImdlSilhouetteEdges extends ImdlSegmentEdges {\r\n /** The Id of the [[ImdlBufferView]] containing - for each vertex - a pair of [OctEncodedNormal]($common)s for the two faces associated with the edge. */\r\n readonly normalPairs: string;\r\n}\r\n\r\n/** A compact alternative representation of [[ImdlSegmentEdges]] and [[ImdlSilhouetteEdges]] consisting of a lookup table containing information about each unique\r\n * edge, along with indices into that table.\r\n * @see [[IndexedEdgeParams]].\r\n */\r\ninterface ImdlIndexedEdges {\r\n /** Id of the [[ImdlBufferView]] containing the indices - 6 per segment, forming a quad. */\r\n readonly indices: string;\r\n /** Id of the [[ImdlBufferView]] containing the lookup table binary data. */\r\n readonly edges: string;\r\n /** Width of the lookup texture. */\r\n readonly width: number;\r\n /** Height of the lookup texture. */\r\n readonly height: number;\r\n /** The number of simple segments in the lower partition of the lookup table. @see [[IndexedEdgeParams.numSegments]]. */\r\n readonly numSegments: number;\r\n /** The number of bytes inserted for alignment between the lower and upper partitions of the lookup table. @see [[IndexedEdgeParams.silhouettePadding]]. */\r\n readonly silhouettePadding: number;\r\n}\r\n\r\n/** Describes the edges of an [[ImdlMeshPrimitive]]. */\r\ninterface ImdlMeshEdges {\r\n /** @see [[ImdlSegmentEdges]]. */\r\n readonly segments?: ImdlSegmentEdges;\r\n /** @see [[ImdlSilhouetteEdges]]. */\r\n readonly silhouettes?: ImdlSilhouetteEdges;\r\n /** Line strings with additional joint triangles inserted to produce wide edges with rounded corners.\r\n * Typically only produced for 2d views.\r\n */\r\n readonly polylines?: ImdlPolyline;\r\n /** @see [[ImdlIndexedEdges]]. */\r\n readonly indexed?: ImdlIndexedEdges;\r\n}\r\n\r\n/** Describes a collection of line strings with additional joint triangles inserted to produce wide line strings with rounded corners.\r\n * @see [[TesselatedPolyline]] and [[PolylineParams]].\r\n */\r\ninterface ImdlPolyline {\r\n /** Id of the [[ImdlBufferView]] containing the [[TesselatedPolyline.indices]]. */\r\n readonly indices: string;\r\n /** Id of the [[ImdlBufferView]] containing the [[TesselatedPolyline.prevIndices]]. */\r\n readonly prevIndices: string;\r\n /** Id of the [[ImdlBufferView]] containing the [[TesselatedPolyline.nextIndicesAndParams]]. */\r\n readonly nextIndicesAndParams: string;\r\n}\r\n\r\n/** Describes a planar region in which a pattern symbol is repeated in a regular grid.\r\n * @see [[PatternGraphicParams]].\r\n */\r\ninterface ImdlAreaPattern {\r\n readonly type: \"areaPattern\";\r\n /** The Id of the [[ImdlAreaPatternSymbol]] containing the pattern geometry. */\r\n readonly symbolName: string;\r\n /** A [ClipVector]($geometry-core) used to clip symbols to the pattern region's boundary. */\r\n readonly clip: ClipVectorProps;\r\n /** Uniform scale applied to the pattern geometry. */\r\n readonly scale: number;\r\n /** Spacing between each instance of the pattern in meters. */\r\n readonly spacing: XYProps;\r\n readonly orgTransform: TransformProps;\r\n readonly origin: XYProps;\r\n /** Id of the [[ImdlBufferView]] containing the offset of each occurrence of the symbol in pattern-space. */\r\n readonly xyOffsets: string;\r\n readonly featureId: number;\r\n readonly modelTransform: TransformProps;\r\n readonly range: Range3dProps;\r\n readonly symbolTranslation: XYZProps;\r\n readonly viewIndependentOrigin?: XYZProps;\r\n}\r\n\r\n/** Describes the surface of an [[ImdlMeshPrimitive]] as a collection of triangles. */\r\ninterface ImdlSurface {\r\n /** The type of surface. */\r\n readonly type: SurfaceType;\r\n /** The 24-bit indices into the [[ImdlVertexTable]] of each triangle's vertex. */\r\n readonly indices: string;\r\n /** If true, the [[ImdlTextureMapping]] is applied regardless of [ViewFlags.textures]($common). */\r\n readonly alwaysDisplayTexture?: boolean;\r\n /** The quantization range for the UV coordinates. @see [QParams2d]($common). */\r\n readonly uvParams?: {\r\n readonly decodedMin: number[];\r\n readonly decodedMax: number[];\r\n };\r\n}\r\n\r\n/** Describes a triangle mesh, optionally including its edges. @see [[MeshParams]]. */\r\ninterface ImdlMeshPrimitive extends ImdlPrimitive {\r\n /** Type discriminator for [[AnyImdlPrimitive]]. */\r\n readonly type: Mesh.PrimitiveType.Mesh;\r\n readonly surface: ImdlSurface;\r\n readonly edges?: ImdlMeshEdges;\r\n readonly auxChannels?: ImdlAuxChannelTable;\r\n readonly areaPattern?: ImdlAreaPattern;\r\n}\r\n\r\n/** Describes a collection of line strings. @see [[PolylineParams]]. */\r\ninterface ImdlPolylinePrimitive extends ImdlPrimitive, ImdlPolyline {\r\n /** Type discriminator for [[AnyImdlPrimitive]]. */\r\n readonly type: Mesh.PrimitiveType.Polyline;\r\n}\r\n\r\n/** Describes a collection of individual points. @see [[PointStringParams. */\r\ninterface ImdlPointStringPrimitive extends ImdlPrimitive {\r\n /** Type discriminator for [[AnyImdlPrimitive]]. */\r\n readonly type: Mesh.PrimitiveType.Point;\r\n /** The Id of the [[ImdlBufferView]] containing - for each point - the 24-bit index of the corresponding vertex in the [[ImdlVertexTable]]. */\r\n readonly indices: string;\r\n}\r\n\r\ntype AnyImdlPrimitive = ImdlMeshPrimitive | ImdlPolylinePrimitive | ImdlPointStringPrimitive;\r\n\r\n/** A collection of primitive geometry to be rendered. */\r\ninterface ImdlMesh {\r\n /** The geometry to be rendered. */\r\n readonly primitives?: Array<AnyImdlPrimitive | ImdlAreaPattern>;\r\n /** If this mesh defines a layer, the unique Id of that layer.\r\n * @see [[RenderSystem.createGraphicLayer]] for a description of layers.\r\n */\r\n readonly layer?: string;\r\n}\r\n\r\n/** A collection of primitive geometry to be rendered as the pattern symbol for an [[ImdlAreaPattern]]. */\r\ninterface ImdlAreaPatternSymbol {\r\n readonly primitives: AnyImdlPrimitive[];\r\n}\r\n\r\n/** If the tile has an associated [RenderSchedule.Script]($common), an array of Ids of nodes in the script used to group elements. */\r\ninterface ImdlAnimationNodes {\r\n /** The number of bytes in each integer Id provided by [[bufferView]] - either 1, 2, or 4. */\r\n bytesPerId: number;\r\n /** The Id of the [[ImdlBufferView]] containing the tightly-packed array of 1-, 2- or 4-byte unsigned integer node Ids; the number of bytes is specified by [[bytesPerId]]. */\r\n bufferView: string;\r\n}\r\n\r\n/** Describes a contiguous array of bytes within the binary portion of the tile. */\r\ninterface ImdlBufferView {\r\n /** The number of bytes in the array. */\r\n byteLength: number;\r\n /** The offset from the beginning of the binary portion of the tile data to the first byte in the array. */\r\n byteOffset: number;\r\n}\r\n\r\n/** A top-level dictionary of resources of a particular type contained in an [[Imdl]] tile.\r\n * Each resource has a unique name by which it can be referred to by other contents of the tile.\r\n */\r\ninterface ImdlDictionary<T> {\r\n [key: string]: T | undefined;\r\n}\r\n\r\n/** Describes all of the geometry contained in the tile. */\r\ninterface ImdlScene {\r\n /** The Ids of the elements of [[Imdl.nodes]] to be included in the scene. */\r\n nodes: string[];\r\n}\r\n\r\n/** Describes the top-level contents of a tile.\r\n * @internal\r\n */\r\nexport interface Imdl {\r\n /** The Id of the ImdlScene in [[scenes]] that describes the tile's geometry. */\r\n scene: string;\r\n /** The collection of ImdlScenes included in the tile. */\r\n scenes: ImdlDictionary<ImdlScene>;\r\n /** Maps each node Id to the Id of the corresponding mesh in [[meshes]]. */\r\n nodes: ImdlDictionary<string>;\r\n meshes: ImdlDictionary<ImdlMesh>;\r\n bufferViews: ImdlDictionary<ImdlBufferView>;\r\n materials?: ImdlDictionary<ImdlDisplayParams>;\r\n patternSymbols?: ImdlDictionary<ImdlAreaPatternSymbol>;\r\n animationNodes?: ImdlAnimationNodes;\r\n renderMaterials?: ImdlDictionary<ImdlRenderMaterial>;\r\n namedTextures?: ImdlDictionary<ImdlNamedTexture>;\r\n}\r\n\r\n/** Arguments supplied to [[ImdlReader.create]]\r\n * @internal\r\n */\r\nexport interface ImdlReaderCreateArgs {\r\n stream: ByteStream;\r\n iModel: IModelConnection;\r\n modelId: Id64String;\r\n is3d: boolean;\r\n system: RenderSystem;\r\n type?: BatchType; // default Primary\r\n loadEdges?: boolean; // default true\r\n isCanceled?: ShouldAbortImdlReader;\r\n sizeMultiplier?: number;\r\n options?: BatchOptions | false;\r\n containsTransformNodes?: boolean; // default false\r\n}\r\n\r\n/** Deserializes tile content in iMdl format. These tiles contain element geometry encoded into a format optimized for the imodeljs webgl renderer.\r\n * @internal\r\n */\r\nexport class ImdlReader {\r\n private readonly _buffer: ByteStream;\r\n private readonly _bufferViews: ImdlDictionary<ImdlBufferView>;\r\n private readonly _meshes: ImdlDictionary<ImdlMesh>;\r\n private readonly _nodes: ImdlDictionary<string>;\r\n private readonly _materialValues: ImdlDictionary<ImdlDisplayParams>;\r\n private readonly _renderMaterials: ImdlDictionary<ImdlRenderMaterial>;\r\n private readonly _namedTextures: ImdlDictionary<ImdlNamedTexture & { renderTexture?: RenderTexture }>;\r\n private readonly _patternSymbols: { [key: string]: ImdlAreaPatternSymbol | undefined };\r\n private readonly _animationNodes?: ImdlAnimationNodes;\r\n private readonly _binaryData: Uint8Array;\r\n private readonly _iModel: IModelConnection;\r\n private readonly _is3d: boolean;\r\n private readonly _modelId: Id64String;\r\n private readonly _system: RenderSystem;\r\n private readonly _type: BatchType;\r\n private readonly _canceled?: ShouldAbortImdlReader;\r\n private readonly _sizeMultiplier?: number;\r\n private readonly _loadEdges: boolean;\r\n private readonly _options: BatchOptions | false;\r\n private readonly _patternGeometry = new Map<string, RenderGeometry[]>();\r\n private readonly _containsTransformNodes: boolean;\r\n\r\n private get _isCanceled(): boolean { return undefined !== this._canceled && this._canceled(this); }\r\n private get _isVolumeClassifier(): boolean { return BatchType.VolumeClassifier === this._type; }\r\n\r\n /** Attempt to initialize an ImdlReader to deserialize iModel tile data beginning at the stream's current position. */\r\n public static create(args: ImdlReaderCreateArgs): ImdlReader | undefined {\r\n const imdlHeader = new ImdlHeader(args.stream);\r\n if (!imdlHeader.isValid || !imdlHeader.isReadableVersion)\r\n return undefined;\r\n\r\n // The feature table follows the iMdl header\r\n if (!this.skipFeatureTable(args.stream))\r\n return undefined;\r\n\r\n // A glTF header follows the feature table\r\n const gltfHeader = new GltfHeader(args.stream);\r\n if (!gltfHeader.isValid)\r\n return undefined;\r\n\r\n args.stream.curPos = gltfHeader.scenePosition;\r\n const sceneStrData = args.stream.nextBytes(gltfHeader.sceneStrLength);\r\n const sceneStr = utf8ToString(sceneStrData);\r\n if (!sceneStr)\r\n return undefined;\r\n\r\n try {\r\n const sceneValue = JSON.parse(sceneStr);\r\n const imdl: Imdl = {\r\n scene: JsonUtils.asString(sceneValue.scene),\r\n scenes: JsonUtils.asArray(sceneValue.scenes),\r\n animationNodes: JsonUtils.asObject(sceneValue.animationNodes),\r\n bufferViews: JsonUtils.asObject(sceneValue.bufferViews),\r\n meshes: JsonUtils.asObject(sceneValue.meshes),\r\n nodes: JsonUtils.asObject(sceneValue.nodes),\r\n materials: JsonUtils.asObject(sceneValue.materials),\r\n renderMaterials: JsonUtils.asObject(sceneValue.renderMaterials),\r\n namedTextures: JsonUtils.asObject(sceneValue.namedTextures),\r\n patternSymbols: JsonUtils.asObject(sceneValue.patternSymbols),\r\n };\r\n\r\n return undefined !== imdl.meshes ? new ImdlReader(imdl, gltfHeader.binaryPosition, args) : undefined;\r\n } catch (_) {\r\n return undefined;\r\n }\r\n }\r\n\r\n private constructor(imdl: Imdl, binaryPosition: number, args: ImdlReaderCreateArgs) {\r\n this._buffer = args.stream;\r\n this._binaryData = new Uint8Array(this._buffer.arrayBuffer, binaryPosition);\r\n\r\n this._animationNodes = JsonUtils.asObject(imdl.animationNodes);\r\n this._bufferViews = imdl.bufferViews;\r\n this._meshes = imdl.meshes;\r\n this._nodes = imdl.nodes;\r\n this._materialValues = imdl.materials ?? { };\r\n this._renderMaterials = imdl.renderMaterials ?? { };\r\n this._namedTextures = imdl.namedTextures ?? { };\r\n this._patternSymbols = imdl.patternSymbols ?? {};\r\n\r\n this._iModel = args.iModel;\r\n this._modelId = args.modelId;\r\n this._is3d = args.is3d;\r\n this._system = args.system;\r\n this._type = args.type ?? BatchType.Primary;\r\n this._canceled = args.isCanceled;\r\n\r\n this._sizeMultiplier = args.sizeMultiplier;\r\n this._loadEdges = args.loadEdges ?? true;\r\n this._options = args.options ?? {};\r\n this._containsTransformNodes = args.containsTransformNodes ?? false;\r\n }\r\n\r\n /** Attempt to deserialize the tile data */\r\n public async read(): Promise<ImdlReaderResult> {\r\n let content;\r\n try {\r\n content = readTileContentDescription(this._buffer, this._sizeMultiplier, !this._is3d, IModelApp.tileAdmin, this._isVolumeClassifier);\r\n } catch (e) {\r\n if (e instanceof TileReadError)\r\n return { isLeaf: true, readStatus: e.errorNumber };\r\n else\r\n throw e;\r\n }\r\n\r\n const featureTable = this.readFeatureTable(content.featureTableStartPos);\r\n if (undefined === featureTable)\r\n return { readStatus: TileReadStatus.InvalidFeatureTable, isLeaf: true };\r\n\r\n // Textures must be loaded asynchronously first...\r\n await this.loadNamedTextures();\r\n if (this._isCanceled)\r\n return { readStatus: TileReadStatus.Canceled, isLeaf: true };\r\n\r\n return this.finishRead(content.isLeaf, featureTable, content.contentRange, content.emptySubRangeMask, content.sizeMultiplier);\r\n }\r\n\r\n /** @internal */\r\n protected createDisplayParams(json: ImdlDisplayParams): DisplayParams | undefined {\r\n const type = JsonUtils.asInt(json.type, DisplayParams.Type.Mesh);\r\n const lineColor = ColorDef.create(JsonUtils.asInt(json.lineColor));\r\n const fillColor = ColorDef.create(JsonUtils.asInt(json.fillColor));\r\n const width = JsonUtils.asInt(json.lineWidth);\r\n const linePixels = JsonUtils.asInt(json.linePixels, LinePixels.Solid);\r\n const fillFlags = JsonUtils.asInt(json.fillFlags, FillFlags.None);\r\n const ignoreLighting = JsonUtils.asBool(json.ignoreLighting);\r\n\r\n // Material will always contain its own texture if it has one\r\n const materialKey = json.materialId;\r\n const material = undefined !== materialKey ? this.materialFromJson(materialKey) : undefined;\r\n\r\n // We will only attempt to include the texture if material is undefined\r\n let textureMapping;\r\n if (!material) {\r\n const textureJson = json.texture;\r\n textureMapping = undefined !== textureJson ? this.textureMappingFromJson(textureJson) : undefined;\r\n\r\n if (undefined === textureMapping) {\r\n // Look for a gradient. If defined, create a texture mapping. No reason to pass the Gradient.Symb to the DisplayParams once we have the texture.\r\n const gradientProps = json.gradient;\r\n const gradient = undefined !== gradientProps ? Gradient.Symb.fromJSON(gradientProps) : undefined;\r\n if (undefined !== gradient) {\r\n const texture = this._system.getGradientTexture(gradient, this._iModel);\r\n if (undefined !== texture) {\r\n // ###TODO: would be better if DisplayParams created the TextureMapping - but that requires an IModelConnection and a RenderSystem...\r\n textureMapping = new TextureMapping(texture, new TextureMapping.Params({ textureMat2x3: new TextureMapping.Trans2x3(0, 1, 0, 1, 0, 0) }));\r\n }\r\n }\r\n }\r\n }\r\n\r\n return new DisplayParams(type, lineColor, fillColor, width, linePixels, fillFlags, material, undefined, ignoreLighting, textureMapping);\r\n }\r\n\r\n /** @internal */\r\n protected colorDefFromMaterialJson(json: ImdlColorDef | undefined): ColorDef | undefined {\r\n return undefined !== json ? ColorDef.from(json[0] * 255 + 0.5, json[1] * 255 + 0.5, json[2] * 255 + 0.5) : undefined;\r\n }\r\n\r\n /** @internal */\r\n protected materialFromJson(key: string): RenderMaterial | undefined {\r\n const material = this._system.findMaterial(key, this._iModel);\r\n if (material)\r\n return material;\r\n\r\n if (!this._renderMaterials)\r\n return undefined;\r\n\r\n const materialJson = this._renderMaterials[key];\r\n if (!materialJson)\r\n return undefined;\r\n\r\n const materialParams = new RenderMaterial.Params(key);\r\n materialParams.diffuseColor = this.colorDefFromMaterialJson(materialJson.diffuseColor);\r\n if (materialJson.diffuse !== undefined)\r\n materialParams.diffuse = JsonUtils.asDouble(materialJson.diffuse);\r\n\r\n materialParams.specularColor = this.colorDefFromMaterialJson(materialJson.specularColor);\r\n if (materialJson.specular !== undefined)\r\n materialParams.specular = JsonUtils.asDouble(materialJson.specular);\r\n\r\n materialParams.reflectColor = this.colorDefFromMaterialJson(materialJson.reflectColor);\r\n if (materialJson.reflect !== undefined)\r\n materialParams.reflect = JsonUtils.asDouble(materialJson.reflect);\r\n\r\n if (materialJson.specularExponent !== undefined)\r\n materialParams.specularExponent = materialJson.specularExponent;\r\n\r\n if (undefined !== materialJson.transparency)\r\n materialParams.alpha = 1.0 - materialJson.transparency;\r\n\r\n materialParams.refract = JsonUtils.asDouble(materialJson.refract);\r\n materialParams.shadows = JsonUtils.asBool(materialJson.shadows);\r\n materialParams.ambient = JsonUtils.asDouble(materialJson.ambient);\r\n\r\n if (undefined !== materialJson.textureMapping)\r\n materialParams.textureMapping = this.textureMappingFromJson(materialJson.textureMapping.texture);\r\n\r\n return this._system.createMaterial(materialParams, this._iModel);\r\n }\r\n\r\n private textureMappingFromJson(json: ImdlTextureMapping | undefined): TextureMapping | undefined {\r\n if (undefined === json)\r\n return undefined;\r\n\r\n const name = JsonUtils.asString(json.name);\r\n const namedTex = 0 !== name.length ? this._namedTextures[name] : undefined;\r\n const texture = undefined !== namedTex ? namedTex.renderTexture : undefined;\r\n if (undefined === texture) {\r\n assert(false, \"bad texture mapping json\");\r\n return undefined;\r\n }\r\n\r\n const paramsJson = json.params;\r\n const tf = paramsJson.transform;\r\n const paramProps: TextureMapping.ParamProps = {\r\n textureMat2x3: new TextureMapping.Trans2x3(tf[0][0], tf[0][1], tf[0][2], tf[1][0], tf[1][1], tf[1][2]),\r\n textureWeight: JsonUtils.asDouble(paramsJson.weight, 1.0),\r\n mapMode: JsonUtils.asInt(paramsJson.mode),\r\n worldMapping: JsonUtils.asBool(paramsJson.worldMapping),\r\n };\r\n\r\n return new TextureMapping(texture, new TextureMapping.Params(paramProps));\r\n }\r\n\r\n private async loadNamedTextures(): Promise<void> {\r\n if (undefined === this._namedTextures)\r\n return;\r\n\r\n const promises = new Array<Promise<void>>();\r\n for (const name of Object.keys(this._namedTextures))\r\n promises.push(this.loadNamedTexture(name));\r\n\r\n if (promises.length > 0)\r\n await Promise.all(promises);\r\n }\r\n\r\n private async loadNamedTexture(name: string): Promise<void> {\r\n if (this._isCanceled)\r\n return;\r\n\r\n const namedTex = this._namedTextures[name];\r\n assert(undefined !== namedTex); // we got here by iterating the keys of this.namedTextures...\r\n if (undefined === namedTex)\r\n return;\r\n\r\n const texture = this._system.findTexture(name, this._iModel);\r\n if (undefined !== texture) {\r\n namedTex.renderTexture = texture;\r\n return;\r\n }\r\n\r\n namedTex.renderTexture = await this.readNamedTexture(namedTex, name);\r\n }\r\n\r\n private async readNamedTexture(namedTex: ImdlNamedTexture, name: string): Promise<RenderTexture | undefined> {\r\n // Reasons a texture could be embedded in the tile content instead of requested separately from the backend:\r\n // - external textures are disabled\r\n // - the texture name is not a valid Id64 string\r\n // - the texture is below a certain backend-hardcoded size threshold\r\n // The bufferViewJson being defined signifies any of the above conditions. In that case, the image content\r\n // has been embedded in the tile contents. Otherwise, we will attempt to request the image content separately\r\n // from the backend.\r\n\r\n let textureType = RenderTexture.Type.Normal;\r\n const isGlyph = JsonUtils.asBool(namedTex.isGlyph);\r\n const isTileSection = !isGlyph && JsonUtils.asBool(namedTex.isTileSection);\r\n if (isGlyph)\r\n textureType = RenderTexture.Type.Glyph;\r\n else if (isTileSection)\r\n textureType = RenderTexture.Type.TileSection;\r\n\r\n // We produce unique tile sections for very large (> 8 megapixel) textures, and unique glyph atlases for raster text.\r\n // Neither should be cached.\r\n const cacheable = !isGlyph && !isTileSection;\r\n const ownership = cacheable ? { iModel: this._iModel, key: name } : undefined;\r\n\r\n const bufferViewId = JsonUtils.asString(namedTex.bufferView);\r\n const bufferViewJson = 0 !== bufferViewId.length ? this._bufferViews[bufferViewId] : undefined;\r\n\r\n if (undefined !== bufferViewJson) { // presence of bufferViewJson signifies we should read the texture from the tile content\r\n const byteOffset = JsonUtils.asInt(bufferViewJson.byteOffset);\r\n const byteLength = JsonUtils.asInt(bufferViewJson.byteLength);\r\n if (0 === byteLength)\r\n return undefined;\r\n\r\n const texBytes = this._binaryData.subarray(byteOffset, byteOffset + byteLength);\r\n const format = namedTex.format;\r\n const source = new ImageSource(texBytes, format);\r\n return this._system.createTextureFromSource({ source, ownership, type: textureType });\r\n }\r\n\r\n // bufferViewJson was undefined, so attempt to request the texture directly from the backend\r\n // eslint-disable-next-line deprecation/deprecation\r\n const params = new RenderTexture.Params(cacheable ? name : undefined, textureType);\r\n return this._system.createTextureFromElement(name, this._iModel, params, namedTex.format);\r\n }\r\n\r\n /** @internal */\r\n protected readFeatureTable(startPos: number): PackedFeatureTable | undefined {\r\n this._buffer.curPos = startPos;\r\n const header = FeatureTableHeader.readFrom(this._buffer);\r\n if (undefined === header || 0 !== header.length % 4)\r\n return undefined;\r\n\r\n // NB: We make a copy of the sub-array because we don't want to pin the entire data array in memory.\r\n const numUint32s = (header.length - FeatureTableHeader.sizeInBytes) / 4;\r\n const packedFeatureArray = new Uint32Array(this._buffer.nextUint32s(numUint32s));\r\n if (this._buffer.isPastTheEnd)\r\n return undefined;\r\n\r\n let animNodesArray: Uint8Array | Uint16Array | Uint32Array | undefined;\r\n const animationNodes = this._animationNodes;\r\n if (undefined !== animationNodes) {\r\n const bytesPerId = JsonUtils.asInt(animationNodes.bytesPerId);\r\n const bufferViewId = JsonUtils.asString(animationNodes.bufferView);\r\n const bufferViewJson = this._bufferViews[bufferViewId];\r\n if (undefined !== bufferViewJson) {\r\n const byteOffset = JsonUtils.asInt(bufferViewJson.byteOffset);\r\n const byteLength = JsonUtils.asInt(bufferViewJson.byteLength);\r\n const bytes = this._binaryData.subarray(byteOffset, byteOffset + byteLength);\r\n switch (bytesPerId) {\r\n case 1:\r\n animNodesArray = new Uint8Array(bytes);\r\n break;\r\n case 2:\r\n // NB: A *copy* of the subarray.\r\n animNodesArray = Uint16Array.from(new Uint16Array(bytes.buffer, bytes.byteOffset, bytes.byteLength / 2));\r\n break;\r\n case 4:\r\n // NB: A *copy* of the subarray.\r\n animNodesArray = Uint32Array.from(new Uint32Array(bytes.buffer, bytes.byteOffset, bytes.byteLength / 4));\r\n break;\r\n }\r\n }\r\n }\r\n\r\n this._buffer.curPos = startPos + header.length;\r\n\r\n return new PackedFeatureTable(packedFeatureArray, this._modelId, header.count, header.maxFeatures, this._type, animNodesArray);\r\n }\r\n\r\n private static skipFeatureTable(stream: ByteStream): boolean {\r\n const startPos = stream.curPos;\r\n const header = FeatureTableHeader.readFrom(stream);\r\n if (undefined !== header)\r\n stream.curPos = startPos + header.length;\r\n\r\n return undefined !== header;\r\n }\r\n\r\n private readAreaPattern(json: ImdlAreaPattern): RenderGraphic | undefined {\r\n const geometry = this.getPatternGeometry(json.symbolName);\r\n if (!geometry || geometry.length === 0)\r\n return undefined;\r\n\r\n const xyOffsets = this.findBuffer(json.xyOffsets);\r\n if (!xyOffsets)\r\n return undefined;\r\n\r\n const clip = ClipVector.fromJSON(json.clip);\r\n const clipVolume = clip && clip.isValid ? this._system.createClipVolume(clip) : undefined;\r\n if (!clipVolume)\r\n return undefined;\r\n\r\n const viewIndependentOrigin = json.viewIndependentOrigin ? Point3d.fromJSON(json.viewIndependentOrigin) : undefined;\r\n const pattern = this._system.createAreaPattern({\r\n xyOffsets: new Float32Array(xyOffsets.buffer, xyOffsets.byteOffset, xyOffsets.byteLength / 4),\r\n featureId: json.featureId,\r\n orgTransform: Transform.fromJSON(json.orgTransform),\r\n origin: Point2d.fromJSON(json.origin),\r\n scale: json.scale,\r\n spacing: Point2d.fromJSON(json.spacing),\r\n patternToModel: Transform.fromJSON(json.modelTransform),\r\n range: Range3d.fromJSON(json.range),\r\n symbolTranslation: Point3d.fromJSON(json.symbolTranslation),\r\n viewIndependentOrigin,\r\n });\r\n\r\n if (!pattern)\r\n return undefined;\r\n\r\n const branch = new GraphicBranch(true);\r\n for (const geom of geometry) {\r\n const graphic = this._system.createRenderGraphic(geom, pattern);\r\n if (graphic)\r\n branch.add(graphic);\r\n }\r\n\r\n if (branch.isEmpty)\r\n return undefined;\r\n\r\n return this._system.createGraphicBranch(branch, Transform.createIdentity(), { clipVolume });\r\n }\r\n\r\n private readMeshGraphic(primitive: AnyImdlPrimitive | ImdlAreaPattern): RenderGraphic | undefined {\r\n if (primitive.type === \"areaPattern\")\r\n return this.readAreaPattern(primitive);\r\n\r\n const instances = this.readInstances(primitive);\r\n const geometry = this.readPrimitiveGeometry(primitive);\r\n return geometry ? this._system.createRenderGraphic(geometry, instances) : undefined;\r\n }\r\n\r\n private findBuffer(bufferViewId: string): Uint8Array | undefined {\r\n if (typeof bufferViewId !== \"string\" || 0 === bufferViewId.length)\r\n return undefined;\r\n\r\n const bufferViewJson = this._bufferViews[bufferViewId];\r\n if (undefined === bufferViewJson)\r\n return undefined;\r\n\r\n const byteOffset = JsonUtils.asInt(bufferViewJson.byteOffset);\r\n const byteLength = JsonUtils.asInt(bufferViewJson.byteLength);\r\n if (0 === byteLength)\r\n return undefined;\r\n\r\n return this._binaryData.subarray(byteOffset, byteOffset + byteLength);\r\n }\r\n\r\n private readVertexTable(primitive: AnyImdlPrimitive): VertexTable | undefined {\r\n const json = primitive.vertices;\r\n if (undefined === json)\r\n return undefined;\r\n\r\n const bytes = this.findBuffer(JsonUtils.asString(json.bufferView));\r\n if (undefined === bytes)\r\n return undefined;\r\n\r\n const uniformFeatureID = undefined !== json.featureID ? JsonUtils.asInt(json.featureID) : undefined;\r\n\r\n const rangeMin = JsonUtils.asArray(json.params.decodedMin);\r\n const rangeMax = JsonUtils.asArray(json.params.decodedMax);\r\n if (undefined === rangeMin || undefined === rangeMax)\r\n return undefined;\r\n\r\n const qparams = QParams3d.fromRange(Range3d.create(Point3d.create(rangeMin[0], rangeMin[1], rangeMin[2]), Point3d.create(rangeMax[0], rangeMax[1], rangeMax[2])));\r\n\r\n const uniformColor = undefined !== json.uniformColor ? ColorDef.fromJSON(json.uniformColor) : undefined;\r\n let uvParams: QParams2d | undefined;\r\n if (Mesh.PrimitiveType.Mesh === primitive.type && primitive.surface && primitive.surface.uvParams) {\r\n const uvMin = primitive.surface.uvParams.decodedMin;\r\n const uvMax = primitive.surface.uvParams.decodedMax;\r\n const uvRange = new Range2d(uvMin[0], uvMin[1], uvMax[0], uvMax[1]);\r\n uvParams = QParams2d.fromRange(uvRange);\r\n }\r\n\r\n return new VertexTable({\r\n data: bytes,\r\n qparams,\r\n width: json.width,\r\n height: json.height,\r\n hasTranslucency: json.hasTranslucency,\r\n uniformColor,\r\n featureIndexType: json.featureIndexType,\r\n uniformFeatureID,\r\n numVertices: json.count,\r\n numRgbaPerVertex: json.numRgbaPerVertex,\r\n uvParams,\r\n });\r\n }\r\n\r\n private readAuxChannelTable(primitive: ImdlMeshPrimitive): AuxChannelTable | undefined {\r\n const json = primitive.auxChannels;\r\n if (undefined === json)\r\n return undefined;\r\n\r\n const bytes = this.findBuffer(JsonUtils.asString(json.bufferView));\r\n if (undefined === bytes)\r\n return undefined;\r\n\r\n const props: AuxChannelTableProps = {\r\n data: bytes,\r\n width: json.width,\r\n height: json.height,\r\n count: json.count,\r\n numBytesPerVertex: json.numBytesPerVertex,\r\n displacements: json.displacements,\r\n normals: json.normals,\r\n params: json.params,\r\n };\r\n\r\n return AuxChannelTable.fromJSON(props);\r\n }\r\n\r\n private readInstances(primitive: ImdlPrimitive): InstancedGraphicParams | undefined {\r\n const json = primitive.instances;\r\n if (undefined === json)\r\n return undefined;\r\n\r\n const count = JsonUtils.asInt(json.count, 0);\r\n if (count <= 0)\r\n return undefined;\r\n\r\n const centerComponents = JsonUtils.asArray(json.transformCenter);\r\n if (undefined === centerComponents || 3 !== centerComponents.length)\r\n return undefined;\r\n\r\n const transformCenter = Point3d.create(centerComponents[0], centerComponents[1], centerComponents[2]);\r\n\r\n const featureIds = this.findBuffer(JsonUtils.asString(json.featureIds));\r\n if (undefined === featureIds)\r\n return undefined;\r\n\r\n const transformBytes = this.findBuffer(JsonUtils.asString(json.transforms));\r\n if (undefined === transformBytes)\r\n return undefined;\r\n\r\n // 1 transform = 3 rows of 4 floats = 12 floats per instance\r\n const numFloats = transformBytes.byteLength / 4;\r\n assert(Math.floor(numFloats) === numFloats);\r\n assert(0 === numFloats % 12);\r\n\r\n const transforms = new Float32Array(transformBytes.buffer, transformBytes.byteOffset, numFloats);\r\n\r\n let symbologyOverrides: Uint8Array | undefined;\r\n if (undefined !== json.symbologyOverrides)\r\n symbologyOverrides = this.findBuffer(JsonUtils.asString(json.symbologyOverrides));\r\n\r\n return { count, transforms, transformCenter, featureIds, symbologyOverrides };\r\n }\r\n\r\n private readVertexIndices(bufferName: string): VertexIndices | undefined {\r\n const bytes = this.findBuffer(bufferName);\r\n return undefined !== bytes ? new VertexIndices(bytes) : undefined;\r\n }\r\n\r\n private createPointStringGeometry(primitive: ImdlPointStringPrimitive, displayParams: DisplayParams, vertices: VertexTable, viewIndependentOrigin: Point3d | undefined): RenderGeometry | undefined {\r\n const indices = this.readVertexIndices(primitive.indices);\r\n if (undefined === indices)\r\n return undefined;\r\n\r\n const params = new PointStringParams(vertices, indices, displayParams.width);\r\n return this._system.createPointStringGeometry(params, viewIndependentOrigin);\r\n }\r\n\r\n private readTesselatedPolyline(json: ImdlPolyline): TesselatedPolyline | undefined {\r\n const indices = this.readVertexIndices(json.indices);\r\n const prevIndices = this.readVertexIndices(json.prevIndices);\r\n const nextIndicesAndParams = this.findBuffer(json.nextIndicesAndParams);\r\n\r\n if (!indices || !prevIndices || !nextIndicesAndParams)\r\n return undefined;\r\n\r\n return { indices, prevIndices, nextIndicesAndParams };\r\n }\r\n\r\n private createPolylineGeometry(primitive: ImdlPolylinePrimitive, displayParams: DisplayParams, vertices: VertexTable, isPlanar: boolean, viewIndependentOrigin: Point3d | undefined): RenderGeometry | undefined {\r\n const polyline = this.readTesselatedPolyline(primitive);\r\n if (undefined === polyline)\r\n return undefined;\r\n\r\n let flags = PolylineTypeFlags.Normal;\r\n if (DisplayParams.RegionEdgeType.Outline === displayParams.regionEdgeType)\r\n flags = (undefined === displayParams.gradient || displayParams.gradient.isOutlined) ? PolylineTypeFlags.Edge : PolylineTypeFlags.Outline;\r\n\r\n const params = new PolylineParams(vertices, polyline, displayParams.width, displayParams.linePixels, isPlanar, flags);\r\n return this._system.createPolylineGeometry(params, viewIndependentOrigin);\r\n }\r\n\r\n private readSurface(mesh: ImdlMeshPrimitive, displayParams: DisplayParams): SurfaceParams | undefined {\r\n const surf = mesh.surface;\r\n if (undefined === surf)\r\n return undefined;\r\n\r\n const indices = this.readVertexIndices(surf.indices);\r\n if (undefined === indices)\r\n return undefined;\r\n\r\n const type = surf.type;\r\n if (!isValidSurfaceType(type))\r\n return undefined;\r\n\r\n const texture = undefined !== displayParams.textureMapping ? displayParams.textureMapping.texture : undefined;\r\n let material: SurfaceMaterial | undefined;\r\n const atlas = mesh.vertices.materialAtlas;\r\n const numColors = mesh.vertices.numColors;\r\n if (undefined !== atlas && undefined !== numColors) {\r\n material = {\r\n isAtlas: true,\r\n hasTranslucency: JsonUtils.asBool(atlas.hasTranslucency),\r\n overridesAlpha: JsonUtils.asBool(atlas.overridesAlpha, false),\r\n vertexTableOffset: JsonUtils.asInt(numColors),\r\n numMaterials: JsonUtils.asInt(atlas.numMaterials),\r\n };\r\n } else {\r\n material = createSurfaceMaterial(displayParams.material);\r\n }\r\n\r\n const textureMapping = undefined !== texture ? { texture, alwaysDisplayed: JsonUtils.asBool(surf.alwaysDisplayTexture) } : undefined;\r\n return {\r\n type,\r\n indices,\r\n fillFlags: displayParams.fillFlags,\r\n hasBakedLighting: false,\r\n hasFixedNormals: false,\r\n material,\r\n textureMapping,\r\n };\r\n }\r\n\r\n private readSegmentEdges(json: ImdlSegmentEdges): SegmentEdgeParams | undefined {\r\n const indices = this.readVertexIndices(json.indices);\r\n const endPointAndQuadIndices = this.findBuffer(json.endPointAndQuadIndices);\r\n return undefined !== indices && undefined !== endPointAndQuadIndices ? { indices, endPointAndQuadIndices } : undefined;\r\n }\r\n\r\n private readSilhouettes(json: ImdlSilhouetteEdges): SilhouetteParams | undefined {\r\n const segments = this.readSegmentEdges(json);\r\n const normalPairs = this.findBuffer(json.normalPairs);\r\n return undefined !== segments && undefined !== normalPairs ? { normalPairs, indices: segments.indices, endPointAndQuadIndices: segments.endPointAndQuadIndices } : undefined;\r\n }\r\n\r\n private readIndexedEdges(json: ImdlIndexedEdges): IndexedEdgeParams | undefined {\r\n const indices = this.readVertexIndices(json.indices);\r\n const edgeTable = this.findBuffer(json.edges);\r\n if (!indices || !edgeTable)\r\n return undefined;\r\n\r\n return {\r\n indices,\r\n edges: {\r\n data: edgeTable,\r\n width: json.width,\r\n height: json.height,\r\n silhouettePadding: json.silhouettePadding,\r\n numSegments: json.numSegments,\r\n },\r\n };\r\n }\r\n\r\n private readEdges(json: ImdlMeshEdges, displayParams: DisplayParams): { succeeded: boolean, params?: EdgeParams } {\r\n let segments: SegmentEdgeParams | undefined;\r\n let silhouettes: SilhouetteParams | undefined;\r\n let polylines: TesselatedPolyline | undefined;\r\n let indexed: IndexedEdgeParams | undefined;\r\n\r\n let succeeded = false;\r\n if (undefined !== json.segments && undefined === (segments = this.readSegmentEdges(json.segments)))\r\n return { succeeded };\r\n\r\n if (undefined !== json.silhouettes && undefined === (silhouettes = this.readSilhouettes(json.silhouettes)))\r\n return { succeeded };\r\n\r\n if (undefined !== json.polylines && undefined === (polylines = this.readTesselatedPolyline(json.polylines)))\r\n return { succeeded };\r\n\r\n if (undefined !== json.indexed && undefined === (indexed = this.readIndexedEdges(json.indexed)))\r\n return { succeeded };\r\n\r\n succeeded = true;\r\n let params: EdgeParams | undefined;\r\n if (segments || silhouettes || polylines || indexed) {\r\n params = {\r\n segments,\r\n silhouettes,\r\n polylines,\r\n indexed,\r\n weight: displayParams.width,\r\n linePixels: displayParams.linePixels,\r\n };\r\n }\r\n\r\n return { succeeded, params };\r\n }\r\n\r\n private createMeshGeometry(primitive: ImdlMeshPrimitive, displayParams: DisplayParams, vertices: VertexTable, isPlanar: boolean, auxChannels: AuxChannelTable | undefined, viewIndependentOrigin: Point3d | undefined): RenderGeometry | undefined {\r\n const surface = this.readSurface(primitive, displayParams);\r\n if (undefined === surface)\r\n return undefined;\r\n\r\n // ###TODO: Tile generator shouldn't bother producing edges for classification meshes in the first place...\r\n let edgeParams: EdgeParams | undefined;\r\n if (this._loadEdges && undefined !== primitive.edges && SurfaceType.VolumeClassifier !== surface.type) {\r\n const edgeResult = this.readEdges(primitive.edges, displayParams);\r\n if (!edgeResult.succeeded)\r\n return undefined;\r\n else\r\n edgeParams = edgeResult.params;\r\n }\r\n\r\n const params = new MeshParams(vertices, surface, edgeParams, isPlanar, auxChannels);\r\n return this._system.createMeshGeometry(params, viewIndependentOrigin);\r\n }\r\n\r\n private readPrimitiveGeometry(primitive: AnyImdlPrimitive): RenderGeometry | undefined {\r\n const materialName = primitive.material ?? \"\";\r\n const materialValue = 0 < materialName.length ? JsonUtils.asObject(this._materialValues[materialName]) : undefined;\r\n const displayParams = undefined !== materialValue ? this.createDisplayParams(materialValue) : undefined;\r\n if (undefined === displayParams)\r\n return undefined;\r\n\r\n const vertices = this.readVertexTable(primitive);\r\n if (undefined === vertices) {\r\n assert(false, \"bad vertex table in tile data.\");\r\n return undefined;\r\n }\r\n\r\n const viOrigin = primitive.viewIndependentOrigin ? Point3d.fromJSON(primitive.viewIndependentOrigin) : undefined;\r\n const isPlanar = !this._is3d || JsonUtils.asBool(primitive.isPlanar);\r\n switch (primitive.type) {\r\n case Mesh.PrimitiveType.Mesh:\r\n return this.createMeshGeometry(primitive, displayParams, vertices, isPlanar, this.readAuxChannelTable(primitive), viOrigin);\r\n case Mesh.PrimitiveType.Polyline:\r\n return this.createPolylineGeometry(primitive, displayParams, vertices, isPlanar, viOrigin);\r\n case Mesh.PrimitiveType.Point:\r\n return this.createPointStringGeometry(primitive, displayParams, vertices, viOrigin);\r\n default:\r\n assert(false, \"unhandled primitive type\");\r\n return undefined;\r\n }\r\n }\r\n\r\n private getPatternGeometry(patternName: string): RenderGeometry[] | undefined {\r\n let geometry = this._patternGeometry.get(patternName);\r\n if (geometry)\r\n return geometry;\r\n\r\n const symbol = this._patternSymbols[patternName];\r\n if (!symbol)\r\n return undefined;\r\n\r\n geometry = [];\r\n for (const primitive of symbol.primitives) {\r\n const geom = this.readPrimitiveGeometry(primitive);\r\n if (geom)\r\n geometry.push(geom);\r\n }\r\n\r\n this._patternGeometry.set(patternName, geometry);\r\n return geometry;\r\n }\r\n\r\n private finishRead(isLeaf: boolean, featureTable: PackedFeatureTable, contentRange: ElementAlignedBox3d, emptySubRangeMask: number, sizeMultiplier?: number): ImdlReaderResult {\r\n const graphics: RenderGraphic[] = [];\r\n\r\n if (undefined === this._nodes.Node_Root) {\r\n // Unstructured -- prior to animation support....\r\n for (const meshKey of Object.keys(this._meshes)) {\r\n const meshValue = this._meshes[meshKey];\r\n const primitives = meshValue?.primitives;\r\n if (!primitives || !meshValue)\r\n continue;\r\n\r\n for (const primitive of primitives) {\r\n const graphic = this.readMeshGraphic(primitive);\r\n if (undefined !== graphic)\r\n graphics.push(graphic);\r\n }\r\n }\r\n } else {\r\n const readBranch = (primitives: Array<AnyImdlPrimitive | ImdlAreaPattern>, nodeId: number, animationId: string | undefined) => {\r\n const branch = new GraphicBranch(true);\r\n branch.animationId = animationId;\r\n branch.animationNodeId = nodeId;\r\n\r\n for (const primitive of primitives) {\r\n const graphic = this.readMeshGraphic(primitive);\r\n if (graphic)\r\n branch.add(graphic);\r\n }\r\n\r\n if (!branch.isEmpty)\r\n graphics.push(this._system.createBranch(branch, Transform.createIdentity()));\r\n };\r\n\r\n for (const nodeKey of Object.keys(this._nodes)) {\r\n const nodeValue = this._nodes[nodeKey];\r\n const meshValue = undefined !== nodeValue ? this._meshes[nodeValue] : undefined;\r\n const primitives = meshValue?.primitives;\r\n if (!primitives || !meshValue)\r\n continue;\r\n\r\n const layerId = meshValue.layer;\r\n if (\"Node_Root\" === nodeKey) {\r\n // If transform nodes exist in the tile tree, then we need to create a branch for Node_Root so that elements not associated with\r\n // any node in the schedule script can be grouped together.\r\n if (this._containsTransformNodes) {\r\n readBranch(primitives, AnimationNodeId.Untransformed, undefined);\r\n } else {\r\n for (const primitive of primitives) {\r\n const graphic = this.readMeshGraphic(primitive);\r\n if (undefined !== graphic)\r\n graphics.push(graphic);\r\n }\r\n }\r\n } else if (undefined === layerId) {\r\n readBranch(primitives, extractNodeId(nodeKey), `${this._modelId}_${nodeKey}`);\r\n } else {\r\n const layerGraphics: RenderGraphic[] = [];\r\n for (const primitive of primitives) {\r\n const graphic = this.readMeshGraphic(primitive);\r\n if (undefined !== graphic)\r\n layerGraphics.push(graphic);\r\n }\r\n\r\n if (layerGraphics.length > 0) {\r\n const layerGraphic = 1 === layerGraphics.length ? layerGraphics[0] : this._system.createGraphicList(layerGraphics);\r\n graphics.push(this._system.createGraphicLayer(layerGraphic, layerId));\r\n }\r\n }\r\n }\r\n }\r\n\r\n let tileGraphic: RenderGraphic | undefined;\r\n switch (graphics.length) {\r\n case 0:\r\n break;\r\n case 1:\r\n tileGraphic = graphics[0];\r\n break;\r\n default:\r\n tileGraphic = this._system.createGraphicList(graphics);\r\n break;\r\n }\r\n\r\n if (undefined !== tileGraphic && false !== this._options)\r\n tileGraphic = this._system.createBatch(tileGraphic, featureTable, contentRange, this._options);\r\n\r\n return {\r\n readStatus: TileReadStatus.Success,\r\n isLeaf,\r\n sizeMultiplier,\r\n contentRange: contentRange.isNull ? undefined : contentRange,\r\n graphic: tileGraphic,\r\n emptySubRangeMask,\r\n };\r\n }\r\n}\r\n"]}
|
|
@@ -87,7 +87,7 @@ export interface BatchOptions {
|
|
|
87
87
|
/** If true, the contents of the batch will only be drawn by [[Viewport.readPixels]], not [[Viewport.renderFrame]], causing them to be locatable but invisible. */
|
|
88
88
|
locateOnly?: boolean;
|
|
89
89
|
}
|
|
90
|
-
/** Options used as part of [[GraphicBuilderOptions]] to describe a pickable [[RenderGraphic]].
|
|
90
|
+
/** Options used as part of [[GraphicBuilderOptions]] to describe a [pickable]($docs/learning/frontend/ViewDecorations#pickable-view-graphic-decorations) [[RenderGraphic]].
|
|
91
91
|
* @public
|
|
92
92
|
*/
|
|
93
93
|
export interface PickableGraphicOptions extends BatchOptions {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GraphicBuilder.js","sourceRoot":"","sources":["../../../src/render/GraphicBuilder.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAGH,OAAO,EAC2B,IAAI,EAAuD,SAAS,GACrG,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAA2B,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAMtG;;;;;;;GAOG;AACH,MAAM,CAAN,IAAY,WAkDX;AAlDD,WAAY,WAAW;IACrB;;;;;;;OAOG;IACH,iEAAc,CAAA;IACd,qEAAqE;IACrE;;;;;;OAMG;IACH,+CAAK,CAAA;IACL,8GAA8G;IAC9G;;;;;;OAMG;IACH,mEAAe,CAAA;IACf;;;;;;;;;;OAUG;IACH,6DAAY,CAAA;IACZ;;;;;;;;OAQG;IACH,2DAAW,CAAA;AACb,CAAC,EAlDW,WAAW,KAAX,WAAW,QAkDtB;AAyHD;;;;;;;;;;;;;GAaG;AACH,MAAM,OAAgB,cAAc;IAuClC,gBAAgB;IAChB,YAAsB,OAAoE;;QACxF,sHAAsH;QACtH,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QAExB,MAAM,EAAE,GAAG,OAAO,CAAC,QAAQ,CAAC;QAC5B,IAAI,CAAC,SAAS,GAAG,MAAA,OAAO,CAAC,SAAS,mCAAI,SAAS,CAAC,cAAc,EAAE,CAAC;QACjE,IAAI,CAAC,MAAM,GAAG,MAAA,EAAE,aAAF,EAAE,uBAAF,EAAE,CAAE,MAAM,mCAAI,OAAO,CAAC,MAAM,CAAC;QAC3C,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAA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AAK,EAAE;SAChC,CAAC,CAAC;QAEH,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QAC9E,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QAChF,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IACtF,CAAC;IAED;;;;;;OAMG;IACI,YAAY,CAAC,SAAmB,EAAE,SAAmB,EAAE,SAAiB,EAAE,UAAU,GAAG,UAAU,CAAC,KAAK;QAC5G,IAAI,CAAC,qBAAqB,CAAC,aAAa,CAAC,aAAa,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC;IACvG,CAAC;IAED;;;;;OAKG;IACI,eAAe,CAAC,SAAmB,IAAI,IAAI,CAAC,qBAAqB,CAAC,aAAa,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;CACvH","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 { Id64String } from \"@itwin/core-bentley\";\r\nimport {\r\n AnyCurvePrimitive, Arc3d, Loop, Path, Point2d, Point3d, Polyface, Range3d, SolidPrimitive, Transform,\r\n} from \"@itwin/core-geometry\";\r\nimport { AnalysisStyle, ColorDef, Frustum, GraphicParams, LinePixels, Npc } from \"@itwin/core-common\";\r\nimport { IModelConnection } from \"../IModelConnection\";\r\nimport { Viewport } from \"../Viewport\";\r\nimport { RenderGraphic } from \"./RenderGraphic\";\r\nimport { GraphicPrimitive } from \"./GraphicPrimitive\";\r\n\r\n/**\r\n * Describes the type of a [[GraphicBuilder]], which defines the coordinate system in which the builder's geometry is defined and\r\n * controls the behavior of the [[RenderGraphic]] produced by the builder.\r\n * @note For those types for which depth-testing is disabled, the order in which the individual geometric primitives are drawn determines which geometry draws on top of other geometry.\r\n * - Within a [[GraphicList]], each [[RenderGraphic]] is rendered in the order in which it appears in the list; and\r\n * - Within a single [[RenderGraphic]], each geometric primitive is rendered in the ordered in which it was added to the GraphicBuilder.\r\n * @public\r\n */\r\nexport enum GraphicType {\r\n /**\r\n * Renders behind all other graphics. For example, the border of a [[SheetViewState]] is of this type.\r\n * Coordinates: [[CoordSystem.View]].\r\n * [[RenderMode]]: [[RenderMode.SmoothShade]].\r\n * Lighting: none.\r\n * Depth-testing: disabled.\r\n * @see [[Decorations.viewBackground]]\r\n */\r\n ViewBackground,\r\n /** Used for the scene itself, dynamics, and 'normal' decorations. */\r\n /**\r\n * Renders as if it were part of the scene. All of the [[ViewFlags]] applied to the view's normal geometry also applies to these types of decorations.\r\n * Coordinates: [[CoordSystem.World]].\r\n * Lighting and [[RenderMode]]: from view.\r\n * Depth-testing: enabled.\r\n * @see [[Decorations.normal]].\r\n */\r\n Scene,\r\n /** Renders within the scene. Coordinates: world. RenderMode: smooth. Lighting: default. Z-testing: enabled */\r\n /** Renders within the scene, but ignores the view's [[ViewFlags]].\r\n * Coordinates: [[CoordSystem.World]].\r\n * Lighting: default.\r\n * [[RenderMode]]: [[RenderMode.SmoothShade]].\r\n * Depth-testing: enabled.\r\n * @see [[Decorations.world]].\r\n */\r\n WorldDecoration,\r\n /**\r\n * Renders as an overlay on top of the scene. These decorations differ from [[GraphicType.WorldDecoration]] only in that depth-testing is disabled.\r\n * For example, the ACS triad and [[WindowAreaTool]] decorations are of this type.\r\n * Coordinates: [[CoordSystem.World]].\r\n * [[RenderMode]]: [[RenderMode.SmoothShade]]\r\n * Lighting: default.\r\n * Depth-testing: disabled.\r\n * Renders atop the scene. Coordinates: world. RenderMode: smooth. Lighting: none. Z-testing: disabled\r\n * @note Overlay decorations typically employ some degree of transparency to ensure that they do not fully obscure the scene.\r\n * @see [[Decorations.worldOverlay]]\r\n */\r\n WorldOverlay,\r\n /**\r\n * Renders as an overlay on top of the scene. These decorations differ from [[GraphicType.WorldOverlay]] only in that their geometry is defined in view coordinates rather than world.\r\n * Coordinates: [[CoordSystem.View]].\r\n * [[RenderMode]]: [[RenderMode.SmoothShade]]\r\n * Lighting: default.\r\n * Depth-testing: disabled.\r\n * @note For more flexibility in defining view overlay decorations, consider using a [[CanvasDecorationList]].\r\n * @see [[Decorations.viewOverlay]]\r\n */\r\n ViewOverlay,\r\n}\r\n\r\n/** Options used when constructing a `Batch` - that is, a [[RenderGraphic]] with an associated [FeatureTable]($common) describing individual [Feature]($common)s within the\r\n * graphic. Individual features can be resymbolized in a variety of ways including flashing and hiliting.\r\n * For example, to prevent graphics produced by [[readElementGraphics]] from being hilited when their corresponding element is in the [[SelectionSet]],\r\n * pass `{ noHilite: true }` to [[readElementGraphics]].\r\n * @public\r\n */\r\nexport interface BatchOptions {\r\n /** Identifies the [[Tile]] associated with the batch, chiefly for debugging purposes.\r\n * @beta\r\n */\r\n tileId?: string;\r\n /** If true, features within the batch will not be flashed on mouseover. */\r\n noFlash?: boolean;\r\n /** If true, features within the batch will not be hilited when their corresponding element is in the [[SelectionSet]]. */\r\n noHilite?: boolean;\r\n /** If true, features within the batch will not be emphasized when the corresponding [[Feature]] is emphasized using [FeatureOverrides]($common). */\r\n noEmphasis?: boolean;\r\n /** If true, the contents of the batch will only be drawn by [[Viewport.readPixels]], not [[Viewport.renderFrame]], causing them to be locatable but invisible. */\r\n locateOnly?: boolean;\r\n}\r\n\r\n/** Options used as part of [[GraphicBuilderOptions]] to describe a pickable [[RenderGraphic]].\r\n * @public\r\n */\r\nexport interface PickableGraphicOptions extends BatchOptions {\r\n /** Unique identifier for the graphic.\r\n * @see [[IModelConnection.transientIds]] to obtain a unique Id in the context of an iModel.\r\n */\r\n id: Id64String;\r\n}\r\n\r\n/** Options for creating a [[GraphicBuilder]] used by functions like [[DecorateContext.createGraphic]] and [[RenderSystem.createGraphic]].\r\n * @see [[ViewportGraphicBuilderOptions]] to create a graphic builder for a [[Viewport]].\r\n * @see [[CustomGraphicBuilderOptions]] to create a graphic builder unassociated with any [[Viewport]].\r\n * @public\r\n */\r\nexport interface GraphicBuilderOptions {\r\n /** The type of graphic to produce. */\r\n type: GraphicType;\r\n\r\n /** The local-to-world transform in which the builder's geometry is to be defined - by default, an identity transform. */\r\n placement?: Transform;\r\n\r\n /** If the graphic is to be pickable, specifies the pickable Id and other options. */\r\n pickable?: PickableGraphicOptions;\r\n\r\n /** If true, the order in which geometry is added to the builder is preserved.\r\n * This is useful for overlay and background graphics because they draw without using the depth buffer. For example, to draw an overlay containing a red shape with a white outline,\r\n * you would add the shape to the GraphicBuilder first, followed by the outline, to ensure the outline draws \"in front of\" the shape.\r\n * It defaults to true for overlays and background graphics, and false for other graphic types.\r\n * It is not useful for other types of graphics and imposes a performance penalty due to increased number of draw calls.\r\n * For overlay and background graphics that do not need to draw in any particular order, the performance penalty can be eliminated by setting this to `false`.\r\n */\r\n preserveOrder?: boolean;\r\n\r\n /** Controls whether normals are generated for surfaces. Normals allow 3d geometry to receive lighting; without them the geometry will be unaffected by lighting.\r\n * By default, normals are generated only for graphics of type [[GraphicType.Scene]]; or for any type of graphic if [[GraphicBuilder.wantEdges]] is true, because\r\n * normals are required to prevent z-fighting between surfaces and their edges. This default can be overridden by explicitly specifying `true` or `false`.\r\n * @see [[GraphicType]] for a description of whether and how different types of graphics are affected by lighting.\r\n */\r\n wantNormals?: boolean;\r\n\r\n /** Controls whether edges are generated for surfaces.\r\n * Edges are only displayed if [ViewFlags.renderMode]($common) is not [RenderMode.SmoothShade]($common) or [ViewFlags.visibleEdges]($common) is `true`.\r\n * Since all decoration graphics except [[GraphicType.Scene]] are drawn in smooth shaded mode with no visible edges, by default edges are only produced for scene graphics, and\r\n * - if a [[Viewport]] is supplied with the options - only if [ViewFlags.edgesRequired]($common) is true for the viewport.\r\n * That default can be overridden by explicitly specifying `true` or `false`. This can be useful for non-scene decorations contained in a [[GraphicBranch]] that applies [ViewFlagOverrides]($common)\r\n * that change the edge display settings; or for scene decorations that might be cached for reuse after the viewport's edge settings are changed.\r\n * @note Edges will tend to z-fight with their surfaces unless the graphic is [[pickable]].\r\n */\r\n generateEdges?: boolean;\r\n}\r\n\r\n/** Options for creating a [[GraphicBuilder]] to produce a [[RenderGraphic]] to be displayed in a specific [[Viewport]].\r\n * The level of detail of the graphic will be computed from the position of its geometry within the viewport's [Frustum]($common).\r\n * Default values for [[GraphicBuilderOptions.wantNormals]] and [[GraphicBuilderOptions.generateEdges]] will be determined by the viewport's [ViewFlags]($common).\r\n * The [[GraphicBuilder.iModel]] will be set to the viewport's [[IModelConnection]].\r\n * @public\r\n */\r\nexport interface ViewportGraphicBuilderOptions extends GraphicBuilderOptions {\r\n /** The viewport in which the resultant [[RenderGraphic]] is to be drawn. */\r\n viewport: Viewport;\r\n\r\n /** If true, [[ViewState.getAspectRatioSkew]] will be taken into account when computing the level of detail for the produced graphics. */\r\n applyAspectRatioSkew?: boolean;\r\n\r\n iModel?: never;\r\n computeChordTolerance?: never;\r\n}\r\n\r\n/** Arguments used to compute the chord tolerance (level of detail) of the [[RenderGraphic]]s produced by a [[GraphicBuilder]].\r\n * Generally, the chord tolerance should be roughly equivalent to the size in meters of one pixel on screen where the graphic is to be displayed.\r\n * For [[GraphicType.ViewOverlay]] and [[GraphicType.ViewBackground]], which already define their geometry in pixels, the chord tolerance should typically be 1.\r\n * @see [[CustomGraphicBuilderOptions.computeChordTolerance]].\r\n * @public\r\n */\r\nexport interface ComputeChordToleranceArgs {\r\n /** The graphic builder being used to produce the graphics. */\r\n readonly graphic: GraphicBuilder;\r\n /** A function that computes a range enclosing all of the geometry that was added to the builder. */\r\n readonly computeRange: () => Range3d;\r\n}\r\n\r\n/** Options for creating a [[GraphicBuilder]] to produce a [[RenderGraphic]] that is not associated with any particular [[Viewport]] and may not be associated with\r\n * any particular [[IModelConnection]].\r\n * This is primarily useful when the same graphic is to be saved and reused for display in multiple viewports and for which a chord tolerance can be computed\r\n * independently of each viewport's [Frustum]($common).\r\n * @public\r\n */\r\nexport interface CustomGraphicBuilderOptions extends GraphicBuilderOptions {\r\n /** Optionally, the IModelConnection with which the graphic is associated. */\r\n iModel?: IModelConnection;\r\n /** A function that can compute the level of detail for the graphics produced by the builder. */\r\n computeChordTolerance: (args: ComputeChordToleranceArgs) => number;\r\n\r\n applyAspectRatioSkew?: never;\r\n viewport?: never;\r\n}\r\n\r\n/** Provides methods for constructing a [[RenderGraphic]] from geometric primitives.\r\n * GraphicBuilder is primarily used for creating [[Decorations]] to be displayed inside a [[Viewport]].\r\n *\r\n * The typical process for constructing a [[RenderGraphic]] proceeds as follows:\r\n * 1. Use [[DecorateContext.createGraphic]] or [[RenderSystem.createGraphic]] to obtain a builder.\r\n * 2. Set up the symbology using [[GraphicBuilder.activateGraphicParams]] or [[GraphicBuilder.setSymbology]].\r\n * 3. Add one or more geometric primitives using methods like [[GraphicBuilder.addShape]] and [[GraphicBuilder.addLineString]], possibly setting new symbology in between.\r\n * 4. Use [[GraphicBuilder.finish]] to produce the finished [[RenderGraphic]].\r\n *\r\n * @note Most of the methods which add geometry to the builder take ownership of their inputs rather than cloning them.\r\n * So, for example, if you pass an array of points to addLineString(), you should not subsequently modify that array.\r\n *\r\n * @public\r\n */\r\nexport abstract class GraphicBuilder {\r\n /** The local coordinate system transform applied to this builder's geometry.\r\n * @see [[GraphicBuilderOptions.placement]].\r\n */\r\n public readonly placement: Transform;\r\n\r\n /** The iModel associated with this builder, if any. */\r\n public readonly iModel?: IModelConnection;\r\n\r\n /** The type of graphic to be produced by this builder.\r\n * @see [[GraphicBuilderOptions.type]].\r\n */\r\n public readonly type: GraphicType;\r\n\r\n /** If the graphic is to be pickable, specifies the pickable Id and other options. */\r\n public readonly pickable?: Readonly<PickableGraphicOptions>;\r\n\r\n /** If true, the order in which geometry is added to the builder is preserved.\r\n * @see [[GraphicBuilderOptions.preserveOrder]] for more details.\r\n */\r\n public readonly preserveOrder: boolean;\r\n\r\n /** Controls whether normals are generated for surfaces.\r\n * @note Normals are required for proper edge display, so by default they are always produced if [[wantEdges]] is `true`.\r\n * @see [[GraphicBuilderOptions.wantNormals]] for more details.\r\n */\r\n public readonly wantNormals: boolean;\r\n\r\n /** Controls whether edges are generated for surfaces.\r\n * @see [[GraphicBuilderOptions.generateEdges]] for more details.\r\n */\r\n public readonly wantEdges: boolean;\r\n\r\n /** @alpha */\r\n public readonly analysisStyle?: AnalysisStyle;\r\n\r\n protected readonly _computeChordTolerance: (args: ComputeChordToleranceArgs) => number;\r\n protected readonly _options: CustomGraphicBuilderOptions | ViewportGraphicBuilderOptions;\r\n\r\n /** @internal */\r\n protected constructor(options: ViewportGraphicBuilderOptions | CustomGraphicBuilderOptions) {\r\n // Stored for potential use later in creating a new GraphicBuilder from this one (see PrimitiveBuilder.finishGraphic).\r\n this._options = options;\r\n\r\n const vp = options.viewport;\r\n this.placement = options.placement ?? Transform.createIdentity();\r\n this.iModel = vp?.iModel ?? options.iModel;\r\n this.type = options.type;\r\n this.pickable = options.pickable;\r\n this.wantEdges = options.generateEdges ?? (this.type === GraphicType.Scene && (!vp || vp.viewFlags.edgesRequired()));\r\n this.wantNormals = options.wantNormals ?? (this.wantEdges || this.type === GraphicType.Scene);\r\n this.preserveOrder = options.preserveOrder ?? (this.isOverlay || this.isViewBackground);\r\n\r\n if (!options.viewport) {\r\n this._computeChordTolerance = options.computeChordTolerance;\r\n return;\r\n }\r\n\r\n this.analysisStyle = options.viewport.displayStyle.settings.analysisStyle;\r\n\r\n this._computeChordTolerance = (args: ComputeChordToleranceArgs) => {\r\n let pixelSize = 1;\r\n if (!this.isViewCoordinates) {\r\n // Compute the horizontal distance in meters between two adjacent pixels at the center of the geometry.\r\n pixelSize = options.viewport.getPixelSizeAtPoint(args.computeRange().center);\r\n pixelSize = options.viewport.target.adjustPixelSizeForLOD(pixelSize);\r\n\r\n // Aspect ratio skew > 1.0 stretches the view in Y. In that case use the smaller vertical pixel distance for our stroke tolerance.\r\n const skew = options.applyAspectRatioSkew ? options.viewport.view.getAspectRatioSkew() : 0;\r\n if (skew > 1)\r\n pixelSize /= skew;\r\n }\r\n\r\n return pixelSize * 0.25;\r\n };\r\n }\r\n\r\n /** The Id to be associated with the graphic for picking.\r\n * @see [[GraphicBuilderOptions.pickable]] for more options.\r\n */\r\n public get pickId(): Id64String | undefined {\r\n return this.pickable?.id;\r\n }\r\n\r\n /** Whether the builder's geometry is defined in [[CoordSystem.View]] coordinates.\r\n * @see [[isWorldCoordinates]].\r\n */\r\n public get isViewCoordinates(): boolean {\r\n return this.type === GraphicType.ViewBackground || this.type === GraphicType.ViewOverlay;\r\n }\r\n\r\n /** Whether the builder's geometry is defined in [[CoordSystem.World]] coordinates.\r\n * @see [[isViewCoordinates]].\r\n */\r\n public get isWorldCoordinates(): boolean {\r\n return !this.isViewCoordinates;\r\n }\r\n\r\n /** True if the builder produces a graphic of [[GraphicType.Scene]]. */\r\n public get isSceneGraphic(): boolean {\r\n return this.type === GraphicType.Scene;\r\n }\r\n\r\n /** True if the builder produces a graphic of [[GraphicType.ViewBackground]]. */\r\n public get isViewBackground(): boolean {\r\n return this.type === GraphicType.ViewBackground;\r\n }\r\n\r\n /** True if the builder produces a graphic of [[GraphicType.WorldOverlay]] or [[GraphicType.ViewOerlay]]. */\r\n public get isOverlay(): boolean {\r\n return this.type === GraphicType.ViewOverlay || this.type === GraphicType.WorldOverlay;\r\n }\r\n\r\n /**\r\n * Processes the accumulated symbology and geometry to produce a renderable graphic.\r\n * This function can only be called once; after the [[RenderGraphic]] has been extracted the [[GraphicBuilder]] should no longer be used.\r\n */\r\n public abstract finish(): RenderGraphic;\r\n\r\n /** Sets the current active symbology for this builder. Any new geometry subsequently added to the builder will be drawn using the specified symbology.\r\n * @param graphicParams The symbology to apply to subsequent geometry.\r\n * @see [[GraphicBuilder.setSymbology]] for a convenient way to set common symbology options.\r\n */\r\n public abstract activateGraphicParams(graphicParams: GraphicParams): void;\r\n\r\n /**\r\n * Appends a 3d line string to the builder.\r\n * @param points Array of vertices in the line string.\r\n */\r\n public abstract addLineString(points: Point3d[]): void;\r\n\r\n /**\r\n * Appends a 2d line string to the builder.\r\n * @param points Array of vertices in the line string.\r\n * @param zDepth Z value in local coordinates to use for each point.\r\n */\r\n public abstract addLineString2d(points: Point2d[], zDepth: number): void;\r\n\r\n /**\r\n * Appends a 3d point string to the builder. The points are drawn disconnected, with a diameter in pixels defined by the builder's active [[GraphicParams.rasterWidth]].\r\n * @param points Array of vertices in the point string.\r\n */\r\n public abstract addPointString(points: Point3d[]): void;\r\n\r\n /**\r\n * Appends a 2d point string to the builder. The points are drawn disconnected, with a diameter in pixels defined by the builder's active [[GraphicParams.rasterWidth]].\r\n * @param points Array of vertices in the point string.\r\n * @param zDepth Z value in local coordinates to use for each point.\r\n */\r\n public abstract addPointString2d(points: Point2d[], zDepth: number): void;\r\n\r\n /**\r\n * Appends a closed 3d planar region to the builder.\r\n * @param points Array of vertices of the shape.\r\n */\r\n public abstract addShape(points: Point3d[]): void;\r\n\r\n /**\r\n * Appends a closed 2d region to the builder.\r\n * @param points Array of vertices of the shape.\r\n * @param zDepth Z value in local coordinates to use for each point.\r\n */\r\n public abstract addShape2d(points: Point2d[], zDepth: number): void;\r\n\r\n /**\r\n * Appends a 3d open arc or closed ellipse to the builder.\r\n * @param arc Description of the arc or ellipse.\r\n * @param isEllipse If true, and if the arc defines a full sweep, then draw as a closed ellipse instead of an arc.\r\n * @param filled If true, and isEllipse is also true, then draw ellipse filled.\r\n */\r\n public abstract addArc(arc: Arc3d, isEllipse: boolean, filled: boolean): void;\r\n\r\n /**\r\n * Appends a 2d open arc or closed ellipse to the builder.\r\n * @param arc Description of the arc or ellipse.\r\n * @param isEllipse If true, and if the arc defines a full sweep, then draw as a closed ellipse instead of an arc.\r\n * @param filled If true, and isEllipse is also true, then draw ellipse filled.\r\n * @param zDepth Z value in local coordinates to use for each point in the arc or ellipse.\r\n */\r\n public abstract addArc2d(ellipse: Arc3d, isEllipse: boolean, filled: boolean, zDepth: number): void;\r\n\r\n /** Append a 3d open path to the builder. */\r\n public abstract addPath(path: Path): void;\r\n\r\n /** Append a 3d planar region to the builder. */\r\n public abstract addLoop(loop: Loop): void;\r\n\r\n /** Append a [CurvePrimitive]($core-geometry) to the builder. */\r\n public addCurvePrimitive(curve: AnyCurvePrimitive): void {\r\n switch (curve.curvePrimitiveType) {\r\n case \"lineString\":\r\n this.addLineString(curve.points);\r\n break;\r\n case \"lineSegment\":\r\n this.addLineString([curve.startPoint(), curve.endPoint()]);\r\n break;\r\n case \"arc\":\r\n this.addArc(curve, false, false);\r\n break;\r\n default:\r\n const path = new Path();\r\n if (path.tryAddChild(curve))\r\n this.addPath(path);\r\n\r\n break;\r\n }\r\n }\r\n\r\n /** Append a mesh to the builder.\r\n * @param meshData Describes the mesh\r\n * @param filled If the mesh describes a planar region, indicates whether its interior area should be drawn with fill in [[RenderMode.Wireframe]].\r\n */\r\n public abstract addPolyface(meshData: Polyface, filled: boolean): void;\r\n\r\n /** Append a solid primitive to the builder. */\r\n public abstract addSolidPrimitive(solidPrimitive: SolidPrimitive): void;\r\n\r\n /** Append any primitive to the builder.\r\n * @param primitive The graphic primitive to append.\r\n */\r\n public addPrimitive(primitive: GraphicPrimitive): void {\r\n switch (primitive.type) {\r\n case \"linestring\":\r\n this.addLineString(primitive.points);\r\n break;\r\n case \"linestring2d\":\r\n this.addLineString2d(primitive.points, primitive.zDepth);\r\n break;\r\n case \"pointstring\":\r\n this.addPointString(primitive.points);\r\n break;\r\n case \"pointstring2d\":\r\n this.addPointString2d(primitive.points, primitive.zDepth);\r\n break;\r\n case \"shape\":\r\n this.addShape(primitive.points);\r\n break;\r\n case \"shape2d\":\r\n this.addShape2d(primitive.points, primitive.zDepth);\r\n break;\r\n case \"arc\":\r\n this.addArc(primitive.arc, true === primitive.isEllipse, true === primitive.filled);\r\n break;\r\n case \"arc2d\":\r\n this.addArc2d(primitive.arc, true === primitive.isEllipse, true === primitive.filled, primitive.zDepth);\r\n break;\r\n case \"path\":\r\n this.addPath(primitive.path);\r\n break;\r\n case \"loop\":\r\n this.addLoop(primitive.loop);\r\n break;\r\n case \"polyface\":\r\n this.addPolyface(primitive.polyface, true === primitive.filled);\r\n break;\r\n case \"solidPrimitive\":\r\n this.addSolidPrimitive(primitive.solidPrimitive);\r\n break;\r\n }\r\n }\r\n\r\n /** Add Range3d edges. Useful for debugging. */\r\n public addRangeBox(range: Range3d) {\r\n this.addFrustum(Frustum.fromRange(range));\r\n }\r\n\r\n /** Add Frustum edges. Useful for debugging. */\r\n public addFrustum(frustum: Frustum) {\r\n this.addRangeBoxFromCorners(frustum.points);\r\n }\r\n\r\n /** Add range edges from corner points */\r\n public addRangeBoxFromCorners(p: Point3d[]) {\r\n this.addLineString([\r\n p[Npc.LeftBottomFront],\r\n p[Npc.LeftTopFront],\r\n p[Npc.RightTopFront],\r\n p[Npc.RightBottomFront],\r\n p[Npc.RightBottomRear],\r\n p[Npc.RightTopRear],\r\n p[Npc.LeftTopRear],\r\n p[Npc.LeftBottomRear],\r\n p[Npc.LeftBottomFront].clone(),\r\n p[Npc.RightBottomFront].clone(),\r\n ]);\r\n\r\n this.addLineString([p[Npc.LeftTopFront].clone(), p[Npc.LeftTopRear].clone()]);\r\n this.addLineString([p[Npc.RightTopFront].clone(), p[Npc.RightTopRear].clone()]);\r\n this.addLineString([p[Npc.LeftBottomRear].clone(), p[Npc.RightBottomRear].clone()]);\r\n }\r\n\r\n /** Sets the current active symbology for this builder. Any new geometry subsequently added will be drawn using the specified symbology.\r\n * @param lineColor The color in which to draw lines.\r\n * @param fillColor The color in which to draw filled regions.\r\n * @param lineWidth The width in pixels to draw lines. The renderer will clamp this value to an integer in the range [1, 32].\r\n * @param linePixels The pixel pattern in which to draw lines.\r\n * @see [[GraphicBuilder.activateGraphicParams]] for additional symbology options.\r\n */\r\n public setSymbology(lineColor: ColorDef, fillColor: ColorDef, lineWidth: number, linePixels = LinePixels.Solid) {\r\n this.activateGraphicParams(GraphicParams.fromSymbology(lineColor, fillColor, lineWidth, linePixels));\r\n }\r\n\r\n /** Set the current active symbology for this builder to be a blanking fill before adding a planar region.\r\n * A planar region drawn with blanking fill renders behind other geometry in the same graphic.\r\n * Blanking fill is not affected by the fill [[ViewFlags]] being disabled.\r\n * An example would be to add a line to a graphic containing a shape with blanking fill so that the line is always shown in front of the fill.\r\n * @param fillColor The color in which to draw filled regions.\r\n */\r\n public setBlankingFill(fillColor: ColorDef) { this.activateGraphicParams(GraphicParams.fromBlankingFill(fillColor)); }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"GraphicBuilder.js","sourceRoot":"","sources":["../../../src/render/GraphicBuilder.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAGH,OAAO,EAC2B,IAAI,EAAuD,SAAS,GACrG,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAA2B,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAMtG;;;;;;;GAOG;AACH,MAAM,CAAN,IAAY,WAkDX;AAlDD,WAAY,WAAW;IACrB;;;;;;;OAOG;IACH,iEAAc,CAAA;IACd,qEAAqE;IACrE;;;;;;OAMG;IACH,+CAAK,CAAA;IACL,8GAA8G;IAC9G;;;;;;OAMG;IACH,mEAAe,CAAA;IACf;;;;;;;;;;OAUG;IACH,6DAAY,CAAA;IACZ;;;;;;;;OAQG;IACH,2DAAW,CAAA;AACb,CAAC,EAlD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CAAC,CAAC,CAAC;IACvG,CAAC;IAED;;;;;OAKG;IACI,eAAe,CAAC,SAAmB,IAAI,IAAI,CAAC,qBAAqB,CAAC,aAAa,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;CACvH","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 { Id64String } from \"@itwin/core-bentley\";\r\nimport {\r\n AnyCurvePrimitive, Arc3d, Loop, Path, Point2d, Point3d, Polyface, Range3d, SolidPrimitive, Transform,\r\n} from \"@itwin/core-geometry\";\r\nimport { AnalysisStyle, ColorDef, Frustum, GraphicParams, LinePixels, Npc } from \"@itwin/core-common\";\r\nimport { IModelConnection } from \"../IModelConnection\";\r\nimport { Viewport } from \"../Viewport\";\r\nimport { RenderGraphic } from \"./RenderGraphic\";\r\nimport { GraphicPrimitive } from \"./GraphicPrimitive\";\r\n\r\n/**\r\n * Describes the type of a [[GraphicBuilder]], which defines the coordinate system in which the builder's geometry is defined and\r\n * controls the behavior of the [[RenderGraphic]] produced by the builder.\r\n * @note For those types for which depth-testing is disabled, the order in which the individual geometric primitives are drawn determines which geometry draws on top of other geometry.\r\n * - Within a [[GraphicList]], each [[RenderGraphic]] is rendered in the order in which it appears in the list; and\r\n * - Within a single [[RenderGraphic]], each geometric primitive is rendered in the ordered in which it was added to the GraphicBuilder.\r\n * @public\r\n */\r\nexport enum GraphicType {\r\n /**\r\n * Renders behind all other graphics. For example, the border of a [[SheetViewState]] is of this type.\r\n * Coordinates: [[CoordSystem.View]].\r\n * [[RenderMode]]: [[RenderMode.SmoothShade]].\r\n * Lighting: none.\r\n * Depth-testing: disabled.\r\n * @see [[Decorations.viewBackground]]\r\n */\r\n ViewBackground,\r\n /** Used for the scene itself, dynamics, and 'normal' decorations. */\r\n /**\r\n * Renders as if it were part of the scene. All of the [[ViewFlags]] applied to the view's normal geometry also applies to these types of decorations.\r\n * Coordinates: [[CoordSystem.World]].\r\n * Lighting and [[RenderMode]]: from view.\r\n * Depth-testing: enabled.\r\n * @see [[Decorations.normal]].\r\n */\r\n Scene,\r\n /** Renders within the scene. Coordinates: world. RenderMode: smooth. Lighting: default. Z-testing: enabled */\r\n /** Renders within the scene, but ignores the view's [[ViewFlags]].\r\n * Coordinates: [[CoordSystem.World]].\r\n * Lighting: default.\r\n * [[RenderMode]]: [[RenderMode.SmoothShade]].\r\n * Depth-testing: enabled.\r\n * @see [[Decorations.world]].\r\n */\r\n WorldDecoration,\r\n /**\r\n * Renders as an overlay on top of the scene. These decorations differ from [[GraphicType.WorldDecoration]] only in that depth-testing is disabled.\r\n * For example, the ACS triad and [[WindowAreaTool]] decorations are of this type.\r\n * Coordinates: [[CoordSystem.World]].\r\n * [[RenderMode]]: [[RenderMode.SmoothShade]]\r\n * Lighting: default.\r\n * Depth-testing: disabled.\r\n * Renders atop the scene. Coordinates: world. RenderMode: smooth. Lighting: none. Z-testing: disabled\r\n * @note Overlay decorations typically employ some degree of transparency to ensure that they do not fully obscure the scene.\r\n * @see [[Decorations.worldOverlay]]\r\n */\r\n WorldOverlay,\r\n /**\r\n * Renders as an overlay on top of the scene. These decorations differ from [[GraphicType.WorldOverlay]] only in that their geometry is defined in view coordinates rather than world.\r\n * Coordinates: [[CoordSystem.View]].\r\n * [[RenderMode]]: [[RenderMode.SmoothShade]]\r\n * Lighting: default.\r\n * Depth-testing: disabled.\r\n * @note For more flexibility in defining view overlay decorations, consider using a [[CanvasDecorationList]].\r\n * @see [[Decorations.viewOverlay]]\r\n */\r\n ViewOverlay,\r\n}\r\n\r\n/** Options used when constructing a `Batch` - that is, a [[RenderGraphic]] with an associated [FeatureTable]($common) describing individual [Feature]($common)s within the\r\n * graphic. Individual features can be resymbolized in a variety of ways including flashing and hiliting.\r\n * For example, to prevent graphics produced by [[readElementGraphics]] from being hilited when their corresponding element is in the [[SelectionSet]],\r\n * pass `{ noHilite: true }` to [[readElementGraphics]].\r\n * @public\r\n */\r\nexport interface BatchOptions {\r\n /** Identifies the [[Tile]] associated with the batch, chiefly for debugging purposes.\r\n * @beta\r\n */\r\n tileId?: string;\r\n /** If true, features within the batch will not be flashed on mouseover. */\r\n noFlash?: boolean;\r\n /** If true, features within the batch will not be hilited when their corresponding element is in the [[SelectionSet]]. */\r\n noHilite?: boolean;\r\n /** If true, features within the batch will not be emphasized when the corresponding [[Feature]] is emphasized using [FeatureOverrides]($common). */\r\n noEmphasis?: boolean;\r\n /** If true, the contents of the batch will only be drawn by [[Viewport.readPixels]], not [[Viewport.renderFrame]], causing them to be locatable but invisible. */\r\n locateOnly?: boolean;\r\n}\r\n\r\n/** Options used as part of [[GraphicBuilderOptions]] to describe a [pickable]($docs/learning/frontend/ViewDecorations#pickable-view-graphic-decorations) [[RenderGraphic]].\r\n * @public\r\n */\r\nexport interface PickableGraphicOptions extends BatchOptions {\r\n /** Unique identifier for the graphic.\r\n * @see [[IModelConnection.transientIds]] to obtain a unique Id in the context of an iModel.\r\n */\r\n id: Id64String;\r\n}\r\n\r\n/** Options for creating a [[GraphicBuilder]] used by functions like [[DecorateContext.createGraphic]] and [[RenderSystem.createGraphic]].\r\n * @see [[ViewportGraphicBuilderOptions]] to create a graphic builder for a [[Viewport]].\r\n * @see [[CustomGraphicBuilderOptions]] to create a graphic builder unassociated with any [[Viewport]].\r\n * @public\r\n */\r\nexport interface GraphicBuilderOptions {\r\n /** The type of graphic to produce. */\r\n type: GraphicType;\r\n\r\n /** The local-to-world transform in which the builder's geometry is to be defined - by default, an identity transform. */\r\n placement?: Transform;\r\n\r\n /** If the graphic is to be pickable, specifies the pickable Id and other options. */\r\n pickable?: PickableGraphicOptions;\r\n\r\n /** If true, the order in which geometry is added to the builder is preserved.\r\n * This is useful for overlay and background graphics because they draw without using the depth buffer. For example, to draw an overlay containing a red shape with a white outline,\r\n * you would add the shape to the GraphicBuilder first, followed by the outline, to ensure the outline draws \"in front of\" the shape.\r\n * It defaults to true for overlays and background graphics, and false for other graphic types.\r\n * It is not useful for other types of graphics and imposes a performance penalty due to increased number of draw calls.\r\n * For overlay and background graphics that do not need to draw in any particular order, the performance penalty can be eliminated by setting this to `false`.\r\n */\r\n preserveOrder?: boolean;\r\n\r\n /** Controls whether normals are generated for surfaces. Normals allow 3d geometry to receive lighting; without them the geometry will be unaffected by lighting.\r\n * By default, normals are generated only for graphics of type [[GraphicType.Scene]]; or for any type of graphic if [[GraphicBuilder.wantEdges]] is true, because\r\n * normals are required to prevent z-fighting between surfaces and their edges. This default can be overridden by explicitly specifying `true` or `false`.\r\n * @see [[GraphicType]] for a description of whether and how different types of graphics are affected by lighting.\r\n */\r\n wantNormals?: boolean;\r\n\r\n /** Controls whether edges are generated for surfaces.\r\n * Edges are only displayed if [ViewFlags.renderMode]($common) is not [RenderMode.SmoothShade]($common) or [ViewFlags.visibleEdges]($common) is `true`.\r\n * Since all decoration graphics except [[GraphicType.Scene]] are drawn in smooth shaded mode with no visible edges, by default edges are only produced for scene graphics, and\r\n * - if a [[Viewport]] is supplied with the options - only if [ViewFlags.edgesRequired]($common) is true for the viewport.\r\n * That default can be overridden by explicitly specifying `true` or `false`. This can be useful for non-scene decorations contained in a [[GraphicBranch]] that applies [ViewFlagOverrides]($common)\r\n * that change the edge display settings; or for scene decorations that might be cached for reuse after the viewport's edge settings are changed.\r\n * @note Edges will tend to z-fight with their surfaces unless the graphic is [[pickable]].\r\n */\r\n generateEdges?: boolean;\r\n}\r\n\r\n/** Options for creating a [[GraphicBuilder]] to produce a [[RenderGraphic]] to be displayed in a specific [[Viewport]].\r\n * The level of detail of the graphic will be computed from the position of its geometry within the viewport's [Frustum]($common).\r\n * Default values for [[GraphicBuilderOptions.wantNormals]] and [[GraphicBuilderOptions.generateEdges]] will be determined by the viewport's [ViewFlags]($common).\r\n * The [[GraphicBuilder.iModel]] will be set to the viewport's [[IModelConnection]].\r\n * @public\r\n */\r\nexport interface ViewportGraphicBuilderOptions extends GraphicBuilderOptions {\r\n /** The viewport in which the resultant [[RenderGraphic]] is to be drawn. */\r\n viewport: Viewport;\r\n\r\n /** If true, [[ViewState.getAspectRatioSkew]] will be taken into account when computing the level of detail for the produced graphics. */\r\n applyAspectRatioSkew?: boolean;\r\n\r\n iModel?: never;\r\n computeChordTolerance?: never;\r\n}\r\n\r\n/** Arguments used to compute the chord tolerance (level of detail) of the [[RenderGraphic]]s produced by a [[GraphicBuilder]].\r\n * Generally, the chord tolerance should be roughly equivalent to the size in meters of one pixel on screen where the graphic is to be displayed.\r\n * For [[GraphicType.ViewOverlay]] and [[GraphicType.ViewBackground]], which already define their geometry in pixels, the chord tolerance should typically be 1.\r\n * @see [[CustomGraphicBuilderOptions.computeChordTolerance]].\r\n * @public\r\n */\r\nexport interface ComputeChordToleranceArgs {\r\n /** The graphic builder being used to produce the graphics. */\r\n readonly graphic: GraphicBuilder;\r\n /** A function that computes a range enclosing all of the geometry that was added to the builder. */\r\n readonly computeRange: () => Range3d;\r\n}\r\n\r\n/** Options for creating a [[GraphicBuilder]] to produce a [[RenderGraphic]] that is not associated with any particular [[Viewport]] and may not be associated with\r\n * any particular [[IModelConnection]].\r\n * This is primarily useful when the same graphic is to be saved and reused for display in multiple viewports and for which a chord tolerance can be computed\r\n * independently of each viewport's [Frustum]($common).\r\n * @public\r\n */\r\nexport interface CustomGraphicBuilderOptions extends GraphicBuilderOptions {\r\n /** Optionally, the IModelConnection with which the graphic is associated. */\r\n iModel?: IModelConnection;\r\n /** A function that can compute the level of detail for the graphics produced by the builder. */\r\n computeChordTolerance: (args: ComputeChordToleranceArgs) => number;\r\n\r\n applyAspectRatioSkew?: never;\r\n viewport?: never;\r\n}\r\n\r\n/** Provides methods for constructing a [[RenderGraphic]] from geometric primitives.\r\n * GraphicBuilder is primarily used for creating [[Decorations]] to be displayed inside a [[Viewport]].\r\n *\r\n * The typical process for constructing a [[RenderGraphic]] proceeds as follows:\r\n * 1. Use [[DecorateContext.createGraphic]] or [[RenderSystem.createGraphic]] to obtain a builder.\r\n * 2. Set up the symbology using [[GraphicBuilder.activateGraphicParams]] or [[GraphicBuilder.setSymbology]].\r\n * 3. Add one or more geometric primitives using methods like [[GraphicBuilder.addShape]] and [[GraphicBuilder.addLineString]], possibly setting new symbology in between.\r\n * 4. Use [[GraphicBuilder.finish]] to produce the finished [[RenderGraphic]].\r\n *\r\n * @note Most of the methods which add geometry to the builder take ownership of their inputs rather than cloning them.\r\n * So, for example, if you pass an array of points to addLineString(), you should not subsequently modify that array.\r\n *\r\n * @public\r\n */\r\nexport abstract class GraphicBuilder {\r\n /** The local coordinate system transform applied to this builder's geometry.\r\n * @see [[GraphicBuilderOptions.placement]].\r\n */\r\n public readonly placement: Transform;\r\n\r\n /** The iModel associated with this builder, if any. */\r\n public readonly iModel?: IModelConnection;\r\n\r\n /** The type of graphic to be produced by this builder.\r\n * @see [[GraphicBuilderOptions.type]].\r\n */\r\n public readonly type: GraphicType;\r\n\r\n /** If the graphic is to be pickable, specifies the pickable Id and other options. */\r\n public readonly pickable?: Readonly<PickableGraphicOptions>;\r\n\r\n /** If true, the order in which geometry is added to the builder is preserved.\r\n * @see [[GraphicBuilderOptions.preserveOrder]] for more details.\r\n */\r\n public readonly preserveOrder: boolean;\r\n\r\n /** Controls whether normals are generated for surfaces.\r\n * @note Normals are required for proper edge display, so by default they are always produced if [[wantEdges]] is `true`.\r\n * @see [[GraphicBuilderOptions.wantNormals]] for more details.\r\n */\r\n public readonly wantNormals: boolean;\r\n\r\n /** Controls whether edges are generated for surfaces.\r\n * @see [[GraphicBuilderOptions.generateEdges]] for more details.\r\n */\r\n public readonly wantEdges: boolean;\r\n\r\n /** @alpha */\r\n public readonly analysisStyle?: AnalysisStyle;\r\n\r\n protected readonly _computeChordTolerance: (args: ComputeChordToleranceArgs) => number;\r\n protected readonly _options: CustomGraphicBuilderOptions | ViewportGraphicBuilderOptions;\r\n\r\n /** @internal */\r\n protected constructor(options: ViewportGraphicBuilderOptions | CustomGraphicBuilderOptions) {\r\n // Stored for potential use later in creating a new GraphicBuilder from this one (see PrimitiveBuilder.finishGraphic).\r\n this._options = options;\r\n\r\n const vp = options.viewport;\r\n this.placement = options.placement ?? Transform.createIdentity();\r\n this.iModel = vp?.iModel ?? options.iModel;\r\n this.type = options.type;\r\n this.pickable = options.pickable;\r\n this.wantEdges = options.generateEdges ?? (this.type === GraphicType.Scene && (!vp || vp.viewFlags.edgesRequired()));\r\n this.wantNormals = options.wantNormals ?? (this.wantEdges || this.type === GraphicType.Scene);\r\n this.preserveOrder = options.preserveOrder ?? (this.isOverlay || this.isViewBackground);\r\n\r\n if (!options.viewport) {\r\n this._computeChordTolerance = options.computeChordTolerance;\r\n return;\r\n }\r\n\r\n this.analysisStyle = options.viewport.displayStyle.settings.analysisStyle;\r\n\r\n this._computeChordTolerance = (args: ComputeChordToleranceArgs) => {\r\n let pixelSize = 1;\r\n if (!this.isViewCoordinates) {\r\n // Compute the horizontal distance in meters between two adjacent pixels at the center of the geometry.\r\n pixelSize = options.viewport.getPixelSizeAtPoint(args.computeRange().center);\r\n pixelSize = options.viewport.target.adjustPixelSizeForLOD(pixelSize);\r\n\r\n // Aspect ratio skew > 1.0 stretches the view in Y. In that case use the smaller vertical pixel distance for our stroke tolerance.\r\n const skew = options.applyAspectRatioSkew ? options.viewport.view.getAspectRatioSkew() : 0;\r\n if (skew > 1)\r\n pixelSize /= skew;\r\n }\r\n\r\n return pixelSize * 0.25;\r\n };\r\n }\r\n\r\n /** The Id to be associated with the graphic for picking.\r\n * @see [[GraphicBuilderOptions.pickable]] for more options.\r\n */\r\n public get pickId(): Id64String | undefined {\r\n return this.pickable?.id;\r\n }\r\n\r\n /** Whether the builder's geometry is defined in [[CoordSystem.View]] coordinates.\r\n * @see [[isWorldCoordinates]].\r\n */\r\n public get isViewCoordinates(): boolean {\r\n return this.type === GraphicType.ViewBackground || this.type === GraphicType.ViewOverlay;\r\n }\r\n\r\n /** Whether the builder's geometry is defined in [[CoordSystem.World]] coordinates.\r\n * @see [[isViewCoordinates]].\r\n */\r\n public get isWorldCoordinates(): boolean {\r\n return !this.isViewCoordinates;\r\n }\r\n\r\n /** True if the builder produces a graphic of [[GraphicType.Scene]]. */\r\n public get isSceneGraphic(): boolean {\r\n return this.type === GraphicType.Scene;\r\n }\r\n\r\n /** True if the builder produces a graphic of [[GraphicType.ViewBackground]]. */\r\n public get isViewBackground(): boolean {\r\n return this.type === GraphicType.ViewBackground;\r\n }\r\n\r\n /** True if the builder produces a graphic of [[GraphicType.WorldOverlay]] or [[GraphicType.ViewOerlay]]. */\r\n public get isOverlay(): boolean {\r\n return this.type === GraphicType.ViewOverlay || this.type === GraphicType.WorldOverlay;\r\n }\r\n\r\n /**\r\n * Processes the accumulated symbology and geometry to produce a renderable graphic.\r\n * This function can only be called once; after the [[RenderGraphic]] has been extracted the [[GraphicBuilder]] should no longer be used.\r\n */\r\n public abstract finish(): RenderGraphic;\r\n\r\n /** Sets the current active symbology for this builder. Any new geometry subsequently added to the builder will be drawn using the specified symbology.\r\n * @param graphicParams The symbology to apply to subsequent geometry.\r\n * @see [[GraphicBuilder.setSymbology]] for a convenient way to set common symbology options.\r\n */\r\n public abstract activateGraphicParams(graphicParams: GraphicParams): void;\r\n\r\n /**\r\n * Appends a 3d line string to the builder.\r\n * @param points Array of vertices in the line string.\r\n */\r\n public abstract addLineString(points: Point3d[]): void;\r\n\r\n /**\r\n * Appends a 2d line string to the builder.\r\n * @param points Array of vertices in the line string.\r\n * @param zDepth Z value in local coordinates to use for each point.\r\n */\r\n public abstract addLineString2d(points: Point2d[], zDepth: number): void;\r\n\r\n /**\r\n * Appends a 3d point string to the builder. The points are drawn disconnected, with a diameter in pixels defined by the builder's active [[GraphicParams.rasterWidth]].\r\n * @param points Array of vertices in the point string.\r\n */\r\n public abstract addPointString(points: Point3d[]): void;\r\n\r\n /**\r\n * Appends a 2d point string to the builder. The points are drawn disconnected, with a diameter in pixels defined by the builder's active [[GraphicParams.rasterWidth]].\r\n * @param points Array of vertices in the point string.\r\n * @param zDepth Z value in local coordinates to use for each point.\r\n */\r\n public abstract addPointString2d(points: Point2d[], zDepth: number): void;\r\n\r\n /**\r\n * Appends a closed 3d planar region to the builder.\r\n * @param points Array of vertices of the shape.\r\n */\r\n public abstract addShape(points: Point3d[]): void;\r\n\r\n /**\r\n * Appends a closed 2d region to the builder.\r\n * @param points Array of vertices of the shape.\r\n * @param zDepth Z value in local coordinates to use for each point.\r\n */\r\n public abstract addShape2d(points: Point2d[], zDepth: number): void;\r\n\r\n /**\r\n * Appends a 3d open arc or closed ellipse to the builder.\r\n * @param arc Description of the arc or ellipse.\r\n * @param isEllipse If true, and if the arc defines a full sweep, then draw as a closed ellipse instead of an arc.\r\n * @param filled If true, and isEllipse is also true, then draw ellipse filled.\r\n */\r\n public abstract addArc(arc: Arc3d, isEllipse: boolean, filled: boolean): void;\r\n\r\n /**\r\n * Appends a 2d open arc or closed ellipse to the builder.\r\n * @param arc Description of the arc or ellipse.\r\n * @param isEllipse If true, and if the arc defines a full sweep, then draw as a closed ellipse instead of an arc.\r\n * @param filled If true, and isEllipse is also true, then draw ellipse filled.\r\n * @param zDepth Z value in local coordinates to use for each point in the arc or ellipse.\r\n */\r\n public abstract addArc2d(ellipse: Arc3d, isEllipse: boolean, filled: boolean, zDepth: number): void;\r\n\r\n /** Append a 3d open path to the builder. */\r\n public abstract addPath(path: Path): void;\r\n\r\n /** Append a 3d planar region to the builder. */\r\n public abstract addLoop(loop: Loop): void;\r\n\r\n /** Append a [CurvePrimitive]($core-geometry) to the builder. */\r\n public addCurvePrimitive(curve: AnyCurvePrimitive): void {\r\n switch (curve.curvePrimitiveType) {\r\n case \"lineString\":\r\n this.addLineString(curve.points);\r\n break;\r\n case \"lineSegment\":\r\n this.addLineString([curve.startPoint(), curve.endPoint()]);\r\n break;\r\n case \"arc\":\r\n this.addArc(curve, false, false);\r\n break;\r\n default:\r\n const path = new Path();\r\n if (path.tryAddChild(curve))\r\n this.addPath(path);\r\n\r\n break;\r\n }\r\n }\r\n\r\n /** Append a mesh to the builder.\r\n * @param meshData Describes the mesh\r\n * @param filled If the mesh describes a planar region, indicates whether its interior area should be drawn with fill in [[RenderMode.Wireframe]].\r\n */\r\n public abstract addPolyface(meshData: Polyface, filled: boolean): void;\r\n\r\n /** Append a solid primitive to the builder. */\r\n public abstract addSolidPrimitive(solidPrimitive: SolidPrimitive): void;\r\n\r\n /** Append any primitive to the builder.\r\n * @param primitive The graphic primitive to append.\r\n */\r\n public addPrimitive(primitive: GraphicPrimitive): void {\r\n switch (primitive.type) {\r\n case \"linestring\":\r\n this.addLineString(primitive.points);\r\n break;\r\n case \"linestring2d\":\r\n this.addLineString2d(primitive.points, primitive.zDepth);\r\n break;\r\n case \"pointstring\":\r\n this.addPointString(primitive.points);\r\n break;\r\n case \"pointstring2d\":\r\n this.addPointString2d(primitive.points, primitive.zDepth);\r\n break;\r\n case \"shape\":\r\n this.addShape(primitive.points);\r\n break;\r\n case \"shape2d\":\r\n this.addShape2d(primitive.points, primitive.zDepth);\r\n break;\r\n case \"arc\":\r\n this.addArc(primitive.arc, true === primitive.isEllipse, true === primitive.filled);\r\n break;\r\n case \"arc2d\":\r\n this.addArc2d(primitive.arc, true === primitive.isEllipse, true === primitive.filled, primitive.zDepth);\r\n break;\r\n case \"path\":\r\n this.addPath(primitive.path);\r\n break;\r\n case \"loop\":\r\n this.addLoop(primitive.loop);\r\n break;\r\n case \"polyface\":\r\n this.addPolyface(primitive.polyface, true === primitive.filled);\r\n break;\r\n case \"solidPrimitive\":\r\n this.addSolidPrimitive(primitive.solidPrimitive);\r\n break;\r\n }\r\n }\r\n\r\n /** Add Range3d edges. Useful for debugging. */\r\n public addRangeBox(range: Range3d) {\r\n this.addFrustum(Frustum.fromRange(range));\r\n }\r\n\r\n /** Add Frustum edges. Useful for debugging. */\r\n public addFrustum(frustum: Frustum) {\r\n this.addRangeBoxFromCorners(frustum.points);\r\n }\r\n\r\n /** Add range edges from corner points */\r\n public addRangeBoxFromCorners(p: Point3d[]) {\r\n this.addLineString([\r\n p[Npc.LeftBottomFront],\r\n p[Npc.LeftTopFront],\r\n p[Npc.RightTopFront],\r\n p[Npc.RightBottomFront],\r\n p[Npc.RightBottomRear],\r\n p[Npc.RightTopRear],\r\n p[Npc.LeftTopRear],\r\n p[Npc.LeftBottomRear],\r\n p[Npc.LeftBottomFront].clone(),\r\n p[Npc.RightBottomFront].clone(),\r\n ]);\r\n\r\n this.addLineString([p[Npc.LeftTopFront].clone(), p[Npc.LeftTopRear].clone()]);\r\n this.addLineString([p[Npc.RightTopFront].clone(), p[Npc.RightTopRear].clone()]);\r\n this.addLineString([p[Npc.LeftBottomRear].clone(), p[Npc.RightBottomRear].clone()]);\r\n }\r\n\r\n /** Sets the current active symbology for this builder. Any new geometry subsequently added will be drawn using the specified symbology.\r\n * @param lineColor The color in which to draw lines.\r\n * @param fillColor The color in which to draw filled regions.\r\n * @param lineWidth The width in pixels to draw lines. The renderer will clamp this value to an integer in the range [1, 32].\r\n * @param linePixels The pixel pattern in which to draw lines.\r\n * @see [[GraphicBuilder.activateGraphicParams]] for additional symbology options.\r\n */\r\n public setSymbology(lineColor: ColorDef, fillColor: ColorDef, lineWidth: number, linePixels = LinePixels.Solid) {\r\n this.activateGraphicParams(GraphicParams.fromSymbology(lineColor, fillColor, lineWidth, linePixels));\r\n }\r\n\r\n /** Set the current active symbology for this builder to be a blanking fill before adding a planar region.\r\n * A planar region drawn with blanking fill renders behind other geometry in the same graphic.\r\n * Blanking fill is not affected by the fill [[ViewFlags]] being disabled.\r\n * An example would be to add a line to a graphic containing a shape with blanking fill so that the line is always shown in front of the fill.\r\n * @param fillColor The color in which to draw filled regions.\r\n */\r\n public setBlankingFill(fillColor: ColorDef) { this.activateGraphicParams(GraphicParams.fromBlankingFill(fillColor)); }\r\n}\r\n"]}
|
|
@@ -22,6 +22,7 @@ export declare class B3dmReader extends GltfReader {
|
|
|
22
22
|
private _pseudoRtcBias?;
|
|
23
23
|
private _batchIdRemap;
|
|
24
24
|
private _colors?;
|
|
25
|
+
private readonly _modelId;
|
|
25
26
|
static create(stream: ByteStream, iModel: IModelConnection, modelId: Id64String, is3d: boolean, range: ElementAlignedBox3d, system: RenderSystem, yAxisUp: boolean, isLeaf: boolean, tileCenter: Point3d, transformToRoot?: Transform, isCanceled?: ShouldAbortReadGltf, idMap?: BatchedTileIdMap, deduplicateVertices?: boolean): B3dmReader | undefined;
|
|
26
27
|
private constructor();
|
|
27
28
|
read(): Promise<GltfReaderResult>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"B3dmReader.d.ts","sourceRoot":"","sources":["../../../src/tile/B3dmReader.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,UAAU,EAAa,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAY,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAmC,mBAAmB,
|
|
1
|
+
{"version":3,"file":"B3dmReader.d.ts","sourceRoot":"","sources":["../../../src/tile/B3dmReader.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,UAAU,EAAa,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAY,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAmC,mBAAmB,EAAyC,MAAM,oBAAoB,CAAC;AACjI,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,MAAM,0CAA0C,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EACL,gBAAgB,EAAgC,UAAU,EAAmB,gBAAgB,EAAE,mBAAmB,EACnH,MAAM,YAAY,CAAC;AAEpB;;;GAGG;AACH,qBAAa,UAAW,SAAQ,UAAU;IAsCtC,OAAO,CAAC,MAAM;IAAuB,OAAO,CAAC,OAAO;IAAW,OAAO,CAAC,iBAAiB;IAAU,OAAO,CAAC,gBAAgB,CAAC;IAAa,OAAO,CAAC,eAAe,CAAC;IAC5H,OAAO,CAAC,MAAM,CAAC;IAAoB,OAAO,CAAC,cAAc,CAAC;IAtChG,OAAO,CAAC,aAAa,CAA6B;IAClD,OAAO,CAAC,OAAO,CAAC,CAAgB;IAChC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAa;WAExB,MAAM,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,gBAAgB,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,mBAAmB,EAC/H,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,eAAe,CAAC,EAAE,SAAS,EACzG,UAAU,CAAC,EAAE,mBAAmB,EAAE,KAAK,CAAC,EAAE,gBAAgB,EAAE,mBAAmB,UAAM,GAAG,UAAU,GAAG,SAAS;IA8BhH,OAAO;IAOM,IAAI,IAAI,OAAO,CAAC,gBAAgB,CAAC;cAiF3B,cAAc,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG;CA+BxD"}
|
|
@@ -7,15 +7,15 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { JsonUtils } from "@itwin/core-bentley";
|
|
9
9
|
import { Transform, Vector3d } from "@itwin/core-geometry";
|
|
10
|
-
import { B3dmHeader, BatchType, ColorDef, Feature, FeatureTable,
|
|
11
|
-
import { GltfReader, GltfReaderProps } from "./internal";
|
|
10
|
+
import { B3dmHeader, BatchType, ColorDef, Feature, FeatureTable, TileReadStatus } from "@itwin/core-common";
|
|
11
|
+
import { GltfDataType, GltfReader, GltfReaderProps, } from "./internal";
|
|
12
12
|
/**
|
|
13
13
|
* Deserializes a tile in [b3dm](https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/specification/TileFormats/Batched3DModel) format.
|
|
14
14
|
* @internal
|
|
15
15
|
*/
|
|
16
16
|
export class B3dmReader extends GltfReader {
|
|
17
17
|
constructor(props, iModel, modelId, is3d, system, _range, _isLeaf, _batchTableLength, _transformToRoot, _batchTableJson, isCanceled, _idMap, _pseudoRtcBias, deduplicateVertices = false) {
|
|
18
|
-
super(props, iModel,
|
|
18
|
+
super(props, iModel, is3d, system, BatchType.Primary, isCanceled, deduplicateVertices);
|
|
19
19
|
this._range = _range;
|
|
20
20
|
this._isLeaf = _isLeaf;
|
|
21
21
|
this._batchTableLength = _batchTableLength;
|
|
@@ -24,6 +24,7 @@ export class B3dmReader extends GltfReader {
|
|
|
24
24
|
this._idMap = _idMap;
|
|
25
25
|
this._pseudoRtcBias = _pseudoRtcBias;
|
|
26
26
|
this._batchIdRemap = new Map();
|
|
27
|
+
this._modelId = modelId;
|
|
27
28
|
}
|
|
28
29
|
static create(stream, iModel, modelId, is3d, range, system, yAxisUp, isLeaf, tileCenter, transformToRoot, isCanceled, idMap, deduplicateVertices = false) {
|
|
29
30
|
const header = new B3dmHeader(stream);
|