@itwin/core-common 4.0.0-dev.86 → 4.0.0-dev.89
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/CHANGELOG.md +13 -1
- package/lib/cjs/MaterialProps.d.ts +13 -1
- package/lib/cjs/MaterialProps.d.ts.map +1 -1
- package/lib/cjs/MaterialProps.js +2 -0
- package/lib/cjs/MaterialProps.js.map +1 -1
- package/lib/cjs/TextureMapping.d.ts +1 -1
- package/lib/cjs/TextureMapping.d.ts.map +1 -1
- package/lib/cjs/TextureMapping.js +4 -4
- package/lib/cjs/TextureMapping.js.map +1 -1
- package/lib/cjs/tile/IModelTileIO.d.ts +2 -2
- package/lib/cjs/tile/IModelTileIO.js +2 -2
- package/lib/cjs/tile/IModelTileIO.js.map +1 -1
- package/lib/cjs/tile/TileMetadata.d.ts +12 -0
- package/lib/cjs/tile/TileMetadata.d.ts.map +1 -1
- package/lib/cjs/tile/TileMetadata.js +45 -27
- package/lib/cjs/tile/TileMetadata.js.map +1 -1
- package/lib/esm/MaterialProps.d.ts +13 -1
- package/lib/esm/MaterialProps.d.ts.map +1 -1
- package/lib/esm/MaterialProps.js +2 -0
- package/lib/esm/MaterialProps.js.map +1 -1
- package/lib/esm/TextureMapping.d.ts +1 -1
- package/lib/esm/TextureMapping.d.ts.map +1 -1
- package/lib/esm/TextureMapping.js +4 -4
- package/lib/esm/TextureMapping.js.map +1 -1
- package/lib/esm/tile/IModelTileIO.d.ts +2 -2
- package/lib/esm/tile/IModelTileIO.js +2 -2
- package/lib/esm/tile/IModelTileIO.js.map +1 -1
- package/lib/esm/tile/TileMetadata.d.ts +12 -0
- package/lib/esm/tile/TileMetadata.d.ts.map +1 -1
- package/lib/esm/tile/TileMetadata.js +42 -25
- package/lib/esm/tile/TileMetadata.js.map +1 -1
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TileMetadata.js","sourceRoot":"","sources":["../../../src/tile/TileM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,EAAE,OAAoB;QACrE,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,mBAAmB,GAAG,wBAAS,CAAC,gBAAgB,KAAK,IAAI,CAAC;QAC/D,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC1B,CAAC;IAED;;OAEG;IACI,IAAI,CAAC,MAAkB,EAAE,KAAgB;QAC9C,MAAM,OAAO,GAAG,0BAA0B,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC;QAC9H,OAAO;YACL,YAAY,EAAE,OAAO,CAAC,YAAY;YAClC,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,cAAc,EAAE,OAAO,CAAC,cAAc;YACtC,iBAAiB,EAAE,OAAO,CAAC,iBAAiB;YAC5C,KAAK,EAAE,uBAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC;YACpC,SAAS,EAAE,KAAK,CAAC,SAAS;SAC3B,CAAC;IACJ,CAAC;CACF;AAzBD,gDAyBC","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 Tile\r\n */\r\n\r\nimport {\r\n assert, ByteStream, compareBooleans, compareBooleansOrUndefined, compareNumbers, compareStringsOrUndefined, Id64, Id64String,\r\n} from \"@itwin/core-bentley\";\r\nimport { Range3d, Vector3d } from \"@itwin/core-geometry\";\r\nimport { BatchType } from \"../FeatureTable\";\r\nimport { TileProps } from \"../TileProps\";\r\nimport { CurrentImdlVersion, FeatureTableHeader, ImdlFlags, ImdlHeader } from \"./IModelTileIO\";\r\nimport { TileReadError, TileReadStatus } from \"./TileIO\";\r\n\r\n// cspell:ignore imdl mult bitfield\r\n\r\n// NB: These constants correspond to those defined in Tile.cpp.\r\nnamespace Constants {\r\n export const minToleranceRatioMultiplier = 2;\r\n}\r\n\r\n/** Describes an iModel tile tree.\r\n * @internal\r\n */\r\nexport interface TileTreeMetadata {\r\n readonly modelId: Id64String;\r\n readonly is2d: boolean;\r\n readonly contentRange?: Range3d;\r\n readonly tileScreenSize: number;\r\n}\r\n\r\n/** Describes the contents of an iModel tile.\r\n * @internal\r\n */\r\nexport interface TileContentMetadata {\r\n readonly contentRange: Range3d;\r\n readonly isLeaf: boolean;\r\n readonly sizeMultiplier?: number;\r\n readonly emptySubRangeMask: number;\r\n}\r\n\r\n/** Describes an iModel tile.\r\n * @internal\r\n */\r\nexport interface TileMetadata extends TileContentMetadata {\r\n readonly contentId: string;\r\n readonly range: Range3d;\r\n}\r\n\r\n/** @internal */\r\nexport interface TileOptions {\r\n readonly maximumMajorTileFormatVersion: number;\r\n readonly enableInstancing: boolean;\r\n readonly enableImprovedElision: boolean;\r\n readonly ignoreAreaPatterns: boolean;\r\n readonly enableExternalTextures: boolean;\r\n readonly useProjectExtents: boolean;\r\n readonly optimizeBRepProcessing: boolean;\r\n readonly useLargerTiles: boolean;\r\n readonly disableMagnification: boolean;\r\n readonly alwaysSubdivideIncompleteTiles: boolean;\r\n readonly enableIndexedEdges: boolean;\r\n readonly generateAllPolyfaceEdges: boolean;\r\n}\r\n\r\n/** @internal */\r\nexport namespace TileOptions {\r\n /** Given the string representation of an [[IModelTileTreeId]] and the contentId of a [Tile]($frontend) belonging to that [TileTree]($frontend),\r\n * compute the [[TileOptions]] that were used to generate the Ids.\r\n * @throws Error if `treeId` or `contentId` are not valid Ids.\r\n * @note `treeId` and `contentId` are assumed to be valid Ids. They are not fully parsed and validated - only the information required by this function is extracted.\r\n * @note `treeId` and `contentId` are assumed to have been produced for version 4 or later of the iMdl tile format.\r\n */\r\n export function fromTreeIdAndContentId(treeId: string, contentId: string): TileOptions {\r\n const tree = treeFlagsAndFormatVersionFromId(treeId);\r\n const contentFlags = contentFlagsFromId(contentId);\r\n const edgeOptions = edgeOptionsFromTreeId(treeId);\r\n\r\n return {\r\n maximumMajorTileFormatVersion: tree.version,\r\n enableInstancing: 0 !== (contentFlags & ContentFlags.AllowInstancing),\r\n enableImprovedElision: 0 !== (contentFlags & ContentFlags.ImprovedElision),\r\n ignoreAreaPatterns: 0 !== (contentFlags & ContentFlags.IgnoreAreaPatterns),\r\n enableExternalTextures: 0 !== (contentFlags & ContentFlags.ExternalTextures),\r\n useProjectExtents: 0 !== (tree.flags & TreeFlags.UseProjectExtents),\r\n optimizeBRepProcessing: 0 !== (tree.flags & TreeFlags.OptimizeBRepProcessing),\r\n useLargerTiles: 0 !== (tree.flags & TreeFlags.UseLargerTiles),\r\n disableMagnification: false,\r\n alwaysSubdivideIncompleteTiles: false,\r\n enableIndexedEdges: edgeOptions && edgeOptions.indexed,\r\n generateAllPolyfaceEdges: edgeOptions && edgeOptions.smooth,\r\n };\r\n }\r\n}\r\n\r\ntype ParsedPrimary = Omit<PrimaryTileTreeId, \"type\" | \"animationId\" | \"enforceDisplayPriority\">;\r\ninterface ParsedClassifier {\r\n type: BatchType.VolumeClassifier | BatchType.PlanarClassifier;\r\n expansion: number;\r\n}\r\n\r\n/** The result of [[parseTileTreeIdAndContentId]].\r\n * @internal\r\n */\r\nexport interface ParsedTileTreeIdAndContentId {\r\n modelId: Id64String;\r\n treeId: IModelTileTreeId;\r\n contentId: ContentIdSpec;\r\n options: TileOptions;\r\n}\r\n\r\nclass Parser {\r\n public readonly input: string;\r\n public curPos = 0;\r\n\r\n public constructor(input: string) {\r\n this.input = input;\r\n }\r\n\r\n public parse(contentId: string): ParsedTileTreeIdAndContentId {\r\n this.require(this.input.length > 0);\r\n\r\n // Skip version and flags, they're handled by TileOptions.fromTreeIdAndContentId\r\n while (this.curPos < this.input.length && this.cur() !== \"-\")\r\n this.advance();\r\n\r\n this.eat(\"-\");\r\n this.require(this.curPos < this.input.length);\r\n\r\n const classifier = this.cur() === \"C\" ? this.parseClassifier() : undefined;\r\n const animationId = this.parseAnimation();\r\n\r\n const primary = classifier ? undefined : this.parsePrimary();\r\n this.require((undefined === classifier) !== (undefined === primary));\r\n\r\n const modelId = this.input.substring(this.curPos);\r\n this.require(Id64.isId64(modelId));\r\n\r\n const { flags: treeFlags } = treeFlagsAndFormatVersionFromId(this.input);\r\n const options = TileOptions.fromTreeIdAndContentId(this.input, contentId);\r\n\r\n let parsedContentId: ContentIdSpec;\r\n try {\r\n parsedContentId = ContentIdProvider.create(true, options).specFromId(contentId);\r\n } catch (e) {\r\n this.reject(\"Invalid content Id\");\r\n }\r\n\r\n if (Object.keys(parsedContentId).some((key) => parsedContentId.hasOwnProperty(key) && typeof parsedContentId[key as keyof ContentIdSpec] === \"number\" && !Number.isFinite(parsedContentId[key as keyof ContentIdSpec])))\r\n throw new Error(\"Invalid content Id\");\r\n\r\n let treeId: IModelTileTreeId;\r\n if (classifier) {\r\n treeId = { ...classifier, animationId };\r\n } else {\r\n assert(undefined !== primary);\r\n const enforceDisplayPriority = (treeFlags & TreeFlags.EnforceDisplayPriority) !== 0 ? true : undefined;\r\n treeId = { ...primary, animationId, type: BatchType.Primary, enforceDisplayPriority };\r\n }\r\n\r\n return {\r\n contentId: parsedContentId,\r\n modelId,\r\n options,\r\n treeId,\r\n };\r\n }\r\n\r\n private cur(): string {\r\n this.require(this.curPos < this.input.length);\r\n return this.input[this.curPos];\r\n }\r\n\r\n private advance(): void {\r\n this.require(this.curPos < this.input.length);\r\n ++this.curPos;\r\n }\r\n\r\n private eat(expectedChar: string): void {\r\n this.require(this.cur() === expectedChar);\r\n this.advance();\r\n }\r\n\r\n private reject(message = \"Invalid tree Id\"): never {\r\n throw new Error(message);\r\n }\r\n\r\n private require(condition: boolean, message = \"Invalid tree Id\"): asserts condition {\r\n if (!condition)\r\n this.reject(message);\r\n }\r\n\r\n private parseClassifier(): ParsedClassifier | undefined {\r\n this.eat(\"C\");\r\n let type = BatchType.VolumeClassifier;\r\n if (this.cur() === \"P\") {\r\n type = BatchType.PlanarClassifier;\r\n this.advance();\r\n }\r\n\r\n this.eat(\":\");\r\n\r\n // C: or CP: is always folowed by expansion then an underscore.\r\n let expansionStr = \"\";\r\n while (this.curPos < this.input.length && (this.cur() >= \"0\" && this.cur() <= \"9\" || this.cur() === \".\")) {\r\n expansionStr += this.cur();\r\n this.advance();\r\n }\r\n\r\n this.eat(\"_\");\r\n\r\n const expansion = Number.parseFloat(expansionStr);\r\n this.require(!Number.isNaN(expansion));\r\n\r\n return { type, expansion };\r\n }\r\n\r\n private parseAnimation(): Id64String | undefined {\r\n if (this.cur() !== \"A\")\r\n return undefined;\r\n\r\n this.eat(\"A\");\r\n this.eat(\":\");\r\n\r\n const termPos = this.input.indexOf(\"_\", this.curPos);\r\n this.require(termPos > this.curPos);\r\n\r\n const animationId = this.input.substring(this.curPos, termPos);\r\n this.require(Id64.isId64(animationId));\r\n\r\n this.curPos = termPos + 1; // Skip \"_\"\r\n return animationId;\r\n }\r\n\r\n private parsePrimary(): ParsedPrimary {\r\n const edges = this.parseEdges();\r\n const sectionCut = this.parseSectionCut();\r\n return { edges, sectionCut };\r\n }\r\n\r\n private parseEdges(): EdgeOptions | false {\r\n if (\"E\" !== this.cur())\r\n return { indexed: false, smooth: false };\r\n\r\n this.eat(\"E\");\r\n this.eat(\":\");\r\n\r\n const typeStr = this.cur();\r\n this.eat(typeStr);\r\n this.eat(\"_\");\r\n\r\n switch (typeStr) {\r\n case \"0\": return false;\r\n case \"2\": return { indexed: true, smooth: false };\r\n case \"3\": return { indexed: false, smooth: true };\r\n case \"4\": return { indexed: true, smooth: true };\r\n default: this.reject();\r\n }\r\n }\r\n\r\n private parseSectionCut(): string | undefined {\r\n if (\"S\" !== this.cur())\r\n return undefined;\r\n\r\n this.eat(\"S\");\r\n const termPos = this.input.indexOf(\"s\", this.curPos);\r\n this.require(termPos > this.curPos);\r\n\r\n const sectionCut = this.input.substring(this.curPos, termPos);\r\n this.curPos = termPos + 1; // Skip \"_\";\r\n return sectionCut;\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport function parseTileTreeIdAndContentId(treeId: string, contentId: string): ParsedTileTreeIdAndContentId {\r\n const parser = new Parser(treeId);\r\n return parser.parse(contentId);\r\n}\r\n\r\n/** @internal */\r\nexport const defaultTileOptions: TileOptions = Object.freeze({\r\n maximumMajorTileFormatVersion: CurrentImdlVersion.Major,\r\n enableInstancing: true,\r\n enableImprovedElision: true,\r\n ignoreAreaPatterns: false,\r\n enableExternalTextures: true,\r\n useProjectExtents: true,\r\n optimizeBRepProcessing: true,\r\n useLargerTiles: true,\r\n disableMagnification: false,\r\n alwaysSubdivideIncompleteTiles: false,\r\n enableIndexedEdges: true,\r\n generateAllPolyfaceEdges: true,\r\n});\r\n\r\nfunction contentFlagsFromId(id: string): ContentFlags {\r\n if (0 === id.length || \"-\" !== id[0])\r\n throw new Error(\"Invalid content Id\");\r\n\r\n // V4: -flags-d-i-j-k-m - version in tree Id\r\n const end = id.indexOf(\"-\", 1);\r\n if (-1 !== end) {\r\n const flags = Number.parseInt(id.substring(1, end), 16);\r\n if (!Number.isNaN(flags))\r\n return flags;\r\n }\r\n\r\n throw new Error(\"Invalid content Id\");\r\n}\r\n\r\nfunction treeFlagsAndFormatVersionFromId(id: string): { flags: TreeFlags, version: number } {\r\n if (0 === id.length)\r\n throw new Error(\"Invalid tree Id\");\r\n\r\n let parts = id.split(\"-\");\r\n if (parts.length > 0) {\r\n parts = parts[0].split(\"_\");\r\n if (parts.length === 2) {\r\n const version = Number.parseInt(parts[0], 16);\r\n const flags = Number.parseInt(parts[1], 16);\r\n if (!Number.isNaN(version) || !Number.isNaN(flags))\r\n return { version, flags };\r\n }\r\n }\r\n\r\n throw new Error(\"Invalid tree Id\");\r\n}\r\n\r\nfunction edgeOptionsFromTreeId(id: string): EdgeOptions {\r\n const pos = id.indexOf(\"E:\");\r\n if (pos <= 0)\r\n return { indexed: false, smooth: false };\r\n\r\n switch (id[pos + 2]) {\r\n case \"0\": return { indexed: defaultTileOptions.enableIndexedEdges, smooth: defaultTileOptions.generateAllPolyfaceEdges };\r\n case \"2\": return { indexed: true, smooth: false };\r\n case \"3\": return { indexed: false, smooth: true };\r\n case \"4\": return { indexed: true, smooth: true };\r\n }\r\n\r\n throw new Error(\"Invalid tree Id\");\r\n}\r\n\r\n/** @internal */\r\nexport function getMaximumMajorTileFormatVersion(maxMajorVersion: number, formatVersion?: number): number {\r\n // The `formatVersion` input is from the backend, telling us precisely the maximum major+minor version it can produce.\r\n // Ensure we do not request tiles of a newer major version than backend can supply or it can read; and also limit major version\r\n // to that optionally configured by the app.\r\n let majorVersion = maxMajorVersion;\r\n if (undefined !== formatVersion)\r\n majorVersion = Math.min((formatVersion >>> 0x10), majorVersion);\r\n\r\n // Version number less than 1 is invalid - ignore\r\n majorVersion = Math.max(majorVersion, 1);\r\n\r\n // Version number greater than current known version ignored\r\n majorVersion = Math.min(majorVersion, CurrentImdlVersion.Major);\r\n\r\n // Version numbers are integers - round down\r\n return Math.max(Math.floor(majorVersion), 1);\r\n}\r\n\r\n/** Flags controlling the structure of a tile tree. The flags are part of the tile tree's Id.\r\n * @alpha\r\n */\r\nexport enum TreeFlags {\r\n None = 0,\r\n UseProjectExtents = 1 << 0, // Use project extents as the basis of the tile tree's range.\r\n EnforceDisplayPriority = 1 << 1, // For 3d plan projection models, group graphics into layers based on subcategory.\r\n OptimizeBRepProcessing = 1 << 2, // Use an optimized pipeline for producing facets from BRep entities.\r\n UseLargerTiles = 1 << 3, // Produce tiles of larger size in screen pixels.\r\n}\r\n\r\n/** Describes how edges should be produced for tiles in a tile tree.\r\n * @internal\r\n */\r\nexport interface EdgeOptions {\r\n /** Generate indexed edges. These use less memory and draw more efficiently than non-indexed edges, but require WebGL 2.\r\n * Generally the display system will determine which to use based on the device's capabilities and application configuration.\r\n */\r\n indexed: boolean;\r\n /** For polyfaces that lack edge visibility information, generate edges for all faces; otherwise, infer edges from mesh topology. */\r\n smooth: boolean;\r\n}\r\n\r\nfunction compareEdgeOptions(a: EdgeOptions | false, b: EdgeOptions | false): number {\r\n if (typeof a !== typeof b)\r\n return a ? 1 : -1;\r\n\r\n if (typeof a === \"boolean\") {\r\n assert(typeof b === \"boolean\");\r\n return compareBooleans(a, b);\r\n }\r\n\r\n assert(typeof b === \"object\");\r\n let cmp = compareBooleans(a.indexed, b.indexed);\r\n if (0 === cmp)\r\n cmp = compareBooleans(a.smooth, b.smooth);\r\n\r\n return cmp;\r\n}\r\n\r\n/** Describes a tile tree used to draw the contents of a model, possibly with embedded animation.\r\n * @internal\r\n */\r\nexport interface PrimaryTileTreeId {\r\n /** Describes the type of tile tree. */\r\n type: BatchType.Primary;\r\n /** The type of edges to include in tile content. */\r\n edges: EdgeOptions | false;\r\n /** Id of the [DisplayStyle]($backend) or [RenderTimeline]($backend) element holding the [[RenderSchedule]] script to be applied to the tiles. */\r\n animationId?: Id64String;\r\n /** If true, meshes within the tiles will be grouped into nodes based on the display priority associated with their subcategories,\r\n * for ensuring the graphics display with correct priority.\r\n */\r\n enforceDisplayPriority?: boolean;\r\n /** If defined, the compact string representation of a clip vector applied to the tiles to produce cut geometry at the intersections with the clip planes.\r\n * Any geometry *not* intersecting the clip planes is omitted from the tiles.\r\n * @see [ClipVector.toCompactString[($core-geometry).\r\n */\r\n sectionCut?: string;\r\n}\r\n\r\n/** Describes a tile tree that can classify the contents of other tile trees using the model's geometry.\r\n * @internal\r\n */\r\nexport interface ClassifierTileTreeId {\r\n type: BatchType.VolumeClassifier | BatchType.PlanarClassifier;\r\n expansion: number;\r\n animationId?: Id64String;\r\n}\r\n\r\nfunction animationIdToString(animationId: Id64String): string {\r\n return `A:${animationId}_`;\r\n}\r\n\r\n/** Describes the Id of an iModel tile tree.\r\n * @internal\r\n */\r\nexport type IModelTileTreeId = PrimaryTileTreeId | ClassifierTileTreeId;\r\n\r\n/** Convert a tile tree Id to its string representation.\r\n * @internal\r\n */\r\nexport function iModelTileTreeIdToString(modelId: Id64String, treeId: IModelTileTreeId, options: TileOptions): string {\r\n let idStr = \"\";\r\n let flags = options.useProjectExtents ? TreeFlags.UseProjectExtents : TreeFlags.None;\r\n if (options.optimizeBRepProcessing)\r\n flags |= TreeFlags.OptimizeBRepProcessing;\r\n\r\n if (options.useLargerTiles)\r\n flags |= TreeFlags.UseLargerTiles;\r\n\r\n if (BatchType.Primary === treeId.type) {\r\n if (undefined !== treeId.animationId)\r\n idStr = `${idStr}${animationIdToString(treeId.animationId)}`;\r\n else if (treeId.enforceDisplayPriority) // animation and priority are currently mutually exclusive\r\n flags |= TreeFlags.EnforceDisplayPriority;\r\n\r\n let edges;\r\n if (!treeId.edges) {\r\n edges = \"E:0_\";\r\n } else {\r\n if (!treeId.edges.smooth)\r\n edges = treeId.edges.indexed ? \"E:2_\" : \"\";\r\n else\r\n edges = treeId.edges.indexed ? \"E:4_\" : \"E:3_\";\r\n }\r\n\r\n const sectionCut = treeId.sectionCut ? `S${treeId.sectionCut}s` : \"\";\r\n idStr = `${idStr}${edges}${sectionCut}`;\r\n } else {\r\n const typeStr = BatchType.PlanarClassifier === treeId.type ? \"CP\" : \"C\";\r\n idStr = `${idStr + typeStr}:${treeId.expansion.toFixed(6)}_`;\r\n\r\n if (BatchType.VolumeClassifier === treeId.type)\r\n flags |= TreeFlags.UseProjectExtents;\r\n\r\n if (undefined !== treeId.animationId)\r\n idStr = `${idStr}${animationIdToString(treeId.animationId)}`;\r\n }\r\n\r\n const version = getMaximumMajorTileFormatVersion(options.maximumMajorTileFormatVersion);\r\n if (version >= 4) {\r\n const prefix = `${version.toString(16)}_${flags.toString(16)}-`;\r\n idStr = prefix + idStr;\r\n }\r\n\r\n return idStr + modelId;\r\n}\r\n\r\n/** Ordinal comparison of two tile tree Ids, e.g., for use in sorted containers.\r\n * @internal\r\n */\r\nexport function compareIModelTileTreeIds(lhs: IModelTileTreeId, rhs: IModelTileTreeId): number {\r\n let cmp = compareNumbers(lhs.type, rhs.type);\r\n if (0 === cmp)\r\n cmp = compareStringsOrUndefined(lhs.animationId, rhs.animationId);\r\n\r\n if (0 !== cmp)\r\n return cmp;\r\n\r\n // NB: The redundant checks on BatchType below are to satisfy compiler.\r\n assert(lhs.type === rhs.type);\r\n if (BatchType.Primary === lhs.type && BatchType.Primary === rhs.type) {\r\n cmp = compareEdgeOptions(lhs.edges, rhs.edges);\r\n if (0 === cmp) {\r\n cmp = compareBooleansOrUndefined(lhs.enforceDisplayPriority, rhs.enforceDisplayPriority);\r\n if (0 === cmp)\r\n cmp = compareStringsOrUndefined(lhs.sectionCut, rhs.sectionCut);\r\n }\r\n } else if (BatchType.Primary !== lhs.type && BatchType.Primary !== rhs.type) {\r\n cmp = compareNumbers(lhs.expansion, rhs.expansion);\r\n }\r\n\r\n return cmp;\r\n}\r\n\r\n/** Flags controlling how tile content is produced. The flags are part of the ContentId.\r\n * @alpha\r\n */\r\nexport enum ContentFlags {\r\n None = 0,\r\n AllowInstancing = 1 << 0,\r\n ImprovedElision = 1 << 1,\r\n IgnoreAreaPatterns = 1 << 2,\r\n ExternalTextures = 1 << 3,\r\n}\r\n\r\n/** Describes the components of a tile's content Id.\r\n *\r\n * The depth specifies how many subdivisions from the root tile are to be performed to reach the sub-volume of interest.\r\n *\r\n * The i, j, and k parameters specify how to subdivide the tile's volume. Each sub-division is performed along the longest axis of the\r\n * volume. The volume is first sub-divided based on `i`, then the result sub-divided based on `j`, and finally that result sub-divided\r\n * based on `k`.\r\n *\r\n * The multiplier is an integer - generally a power of two - multiplied by the screen size of a tile (512 pixels) used to\r\n * produce a higher-resolution tile for the same volume.\r\n * @internal\r\n */\r\ninterface ContentIdSpec {\r\n depth: number;\r\n i: number;\r\n j: number;\r\n k: number;\r\n multiplier: number;\r\n}\r\n\r\n/** Contains logic for working with tile content Ids according to a specific content Id scheme. Which scheme is used depends on\r\n * the major version of the tile format.\r\n * @internal\r\n */\r\nexport abstract class ContentIdProvider {\r\n public readonly majorFormatVersion: number;\r\n public readonly contentFlags: ContentFlags;\r\n\r\n protected constructor(formatVersion: number, contentFlags: ContentFlags) {\r\n this.majorFormatVersion = formatVersion;\r\n this.contentFlags = contentFlags;\r\n }\r\n\r\n public get rootContentId(): string {\r\n return this.computeId(0, 0, 0, 0, 1);\r\n }\r\n\r\n public idFromParentAndMultiplier(parentId: string, multiplier: number): string {\r\n const lastSepPos = parentId.lastIndexOf(this._separator);\r\n assert(-1 !== lastSepPos);\r\n return parentId.substring(0, lastSepPos + 1) + multiplier.toString(16);\r\n }\r\n\r\n public specFromId(id: string): ContentIdSpec {\r\n const parts = id.split(this._separator);\r\n const len = parts.length;\r\n assert(len >= 5);\r\n return {\r\n depth: parseInt(parts[len - 5], 16),\r\n i: parseInt(parts[len - 4], 16),\r\n j: parseInt(parts[len - 3], 16),\r\n k: parseInt(parts[len - 2], 16),\r\n multiplier: parseInt(parts[len - 1], 16),\r\n };\r\n }\r\n\r\n public idFromSpec(spec: ContentIdSpec): string {\r\n return this.computeId(spec.depth, spec.i, spec.j, spec.k, spec.multiplier);\r\n }\r\n\r\n protected join(depth: number, i: number, j: number, k: number, mult: number): string {\r\n const sep = this._separator;\r\n return depth.toString(16) + sep + i.toString(16) + sep + j.toString(16) + sep + k.toString(16) + sep + mult.toString(16);\r\n }\r\n\r\n protected abstract get _separator(): string;\r\n protected abstract computeId(depth: number, i: number, j: number, k: number, mult: number): string;\r\n\r\n /** formatVersion is the maximum major version supported by the back-end supplying the tile tree.\r\n * Must ensure front-end does not request tiles of a format the back-end cannot supply, and back-end does\r\n * not supply tiles of a format the front-end doesn't recognize.\r\n */\r\n public static create(allowInstancing: boolean, options: TileOptions, formatVersion?: number): ContentIdProvider {\r\n const majorVersion = getMaximumMajorTileFormatVersion(options.maximumMajorTileFormatVersion, formatVersion);\r\n assert(majorVersion > 0);\r\n assert(Math.floor(majorVersion) === majorVersion);\r\n switch (majorVersion) {\r\n case 0:\r\n case 1:\r\n return new ContentIdV1Provider(majorVersion);\r\n case 2:\r\n case 3:\r\n return new ContentIdV2Provider(majorVersion, allowInstancing, options);\r\n default:\r\n return new ContentIdV4Provider(allowInstancing, options, majorVersion);\r\n }\r\n }\r\n}\r\n\r\n/** The original (major version 1) tile format used a content Id scheme of the format\r\n * `depth/i/j/k/multiplier`.\r\n * @internal\r\n */\r\nclass ContentIdV1Provider extends ContentIdProvider {\r\n public constructor(majorVersion: number) {\r\n super(majorVersion, ContentFlags.None);\r\n }\r\n\r\n protected get _separator() { return \"/\"; }\r\n protected computeId(depth: number, i: number, j: number, k: number, mult: number): string {\r\n return this.join(depth, i, j, k, mult);\r\n }\r\n}\r\n\r\n/** Tile formats 2 and 3 use a content Id scheme encoding styling flags and the major format version\r\n * into the content Id, of the format `_majorVersion_flags_depth_i_j_k_multiplier`.\r\n * @internal\r\n */\r\nclass ContentIdV2Provider extends ContentIdProvider {\r\n private readonly _prefix: string;\r\n\r\n public constructor(majorVersion: number, allowInstancing: boolean, options: TileOptions) {\r\n const flags = (allowInstancing && options.enableInstancing) ? ContentFlags.AllowInstancing : ContentFlags.None;\r\n super(majorVersion, flags);\r\n this._prefix = this._separator + majorVersion.toString(16) + this._separator + flags.toString(16) + this._separator;\r\n }\r\n\r\n protected get _separator() { return \"_\"; }\r\n protected computeId(depth: number, i: number, j: number, k: number, mult: number): string {\r\n return this._prefix + this.join(depth, i, j, k, mult);\r\n }\r\n}\r\n\r\n/** Tile formats 4+ encode styling flags but not major format version. (The version is specified by the tile tree's Id).\r\n * Format: `-flags-depth-i-j-k-multiplier`.\r\n * @internal\r\n */\r\nclass ContentIdV4Provider extends ContentIdProvider {\r\n private readonly _prefix: string;\r\n\r\n public constructor(allowInstancing: boolean, options: TileOptions, majorVersion: number) {\r\n let flags = (allowInstancing && options.enableInstancing) ? ContentFlags.AllowInstancing : ContentFlags.None;\r\n if (options.enableImprovedElision)\r\n flags = flags | ContentFlags.ImprovedElision;\r\n\r\n if (options.ignoreAreaPatterns)\r\n flags = flags | ContentFlags.IgnoreAreaPatterns;\r\n\r\n if (options.enableExternalTextures)\r\n flags = flags | ContentFlags.ExternalTextures;\r\n\r\n super(majorVersion, flags);\r\n this._prefix = this._separator + flags.toString(16) + this._separator;\r\n }\r\n\r\n protected get _separator() { return \"-\"; }\r\n protected computeId(depth: number, i: number, j: number, k: number, mult: number): string {\r\n return this._prefix + this.join(depth, i, j, k, mult);\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport function bisectTileRange3d(range: Range3d, takeUpper: boolean): void {\r\n const diag = range.diagonal();\r\n const pt = takeUpper ? range.high : range.low;\r\n if (diag.x > diag.y && diag.x > diag.z)\r\n pt.x = (range.low.x + range.high.x) / 2.0;\r\n else if (diag.y > diag.z)\r\n pt.y = (range.low.y + range.high.y) / 2.0;\r\n else\r\n pt.z = (range.low.z + range.high.z) / 2.0;\r\n}\r\n\r\n/** @internal */\r\nexport function bisectTileRange2d(range: Range3d, takeUpper: boolean): void {\r\n const diag = range.diagonal();\r\n const pt = takeUpper ? range.high : range.low;\r\n if (diag.x > diag.y)\r\n pt.x = (range.low.x + range.high.x) / 2.0;\r\n else\r\n pt.y = (range.low.y + range.high.y) / 2.0;\r\n}\r\n\r\n/** Given a description of a tile, compute the ranges which would result from sub-dividing its range into 4 or 8 sub-volumes.\r\n * @internal\r\n */\r\nexport function computeChildTileRanges(tile: TileMetadata, root: TileTreeMetadata): Array<{ range: Range3d, isEmpty: boolean }> {\r\n const emptyMask = tile.emptySubRangeMask;\r\n const is2d = root.is2d;\r\n const bisectRange = is2d ? bisectTileRange2d : bisectTileRange3d;\r\n\r\n const ranges: Array<{ range: Range3d, isEmpty: boolean }> = [];\r\n for (let i = 0; i < 2; i++) {\r\n for (let j = 0; j < 2; j++) {\r\n for (let k = 0; k < (is2d ? 1 : 2); k++) {\r\n const emptyBit = 1 << (i + j * 2 + k * 4);\r\n const isEmpty = 0 !== (emptyMask & emptyBit);\r\n\r\n const range = tile.range.clone();\r\n bisectRange(range, 0 === i);\r\n bisectRange(range, 0 === j);\r\n if (!is2d)\r\n bisectRange(range, 0 === k);\r\n\r\n ranges.push({ range, isEmpty });\r\n }\r\n }\r\n }\r\n\r\n return ranges;\r\n}\r\n\r\n/** Given a description of the parent tile, obtain the properties of its child tiles, and the number of empty children.\r\n * @internal\r\n */\r\nexport function computeChildTileProps(parent: TileMetadata, idProvider: ContentIdProvider, root: TileTreeMetadata): { children: TileProps[], numEmpty: number } {\r\n let numEmpty = 0;\r\n const children: TileProps[] = [];\r\n\r\n // Leaf nodes have no children\r\n if (parent.isLeaf)\r\n return { children, numEmpty };\r\n\r\n // One child, same volume as parent, but higher-resolution.\r\n if (undefined !== parent.sizeMultiplier) {\r\n const sizeMultiplier = parent.sizeMultiplier * 2;\r\n const contentId = idProvider.idFromParentAndMultiplier(parent.contentId, sizeMultiplier);\r\n children.push({\r\n contentId,\r\n range: parent.range,\r\n contentRange: parent.contentRange,\r\n sizeMultiplier,\r\n isLeaf: false,\r\n maximumSize: root.tileScreenSize,\r\n });\r\n\r\n return { children, numEmpty };\r\n }\r\n\r\n // Sub-divide parent's range into 4 (for 2d trees) or 8 (for 3d trees) child tiles.\r\n const parentSpec = idProvider.specFromId(parent.contentId);\r\n const childSpec: ContentIdSpec = { ...parentSpec };\r\n childSpec.depth = parentSpec.depth + 1;\r\n\r\n // This mask is a bitfield in which an 'on' bit indicates sub-volume containing no geometry.\r\n // Don't bother creating children or requesting content for such empty volumes.\r\n const emptyMask = parent.emptySubRangeMask;\r\n\r\n // Spatial tree range == project extents; content range == model range.\r\n // Trivially reject children whose ranges are entirely outside model range.\r\n let treeContentRange = root.contentRange;\r\n if (undefined !== treeContentRange && treeContentRange.containsRange(parent.range)) {\r\n // Parent is wholly within model range - don't bother testing child ranges against it.\r\n treeContentRange = undefined;\r\n }\r\n\r\n const is2d = root.is2d;\r\n const bisectRange = is2d ? bisectTileRange2d : bisectTileRange3d;\r\n for (let i = 0; i < 2; i++) {\r\n for (let j = 0; j < 2; j++) {\r\n for (let k = 0; k < (is2d ? 1 : 2); k++) {\r\n const emptyBit = 1 << (i + j * 2 + k * 4);\r\n if (0 !== (emptyMask & emptyBit)) {\r\n // volume is known to contain no geometry.\r\n ++numEmpty;\r\n continue;\r\n }\r\n\r\n const range = parent.range.clone();\r\n bisectRange(range, 0 === i);\r\n bisectRange(range, 0 === j);\r\n if (!is2d)\r\n bisectRange(range, 0 === k);\r\n\r\n if (undefined !== treeContentRange && !range.intersectsRange(treeContentRange)) {\r\n // volume is within project extents but entirely outside model range\r\n ++numEmpty;\r\n continue;\r\n }\r\n\r\n childSpec.i = parentSpec.i * 2 + i;\r\n childSpec.j = parentSpec.j * 2 + j;\r\n childSpec.k = parentSpec.k * 2 + k;\r\n\r\n const childId = idProvider.idFromSpec(childSpec);\r\n children.push({ contentId: childId, range, maximumSize: root.tileScreenSize });\r\n }\r\n }\r\n }\r\n\r\n return { children, numEmpty };\r\n}\r\n\r\n/** @internal */\r\nexport interface TileContentDescription extends TileContentMetadata {\r\n readonly featureTableStartPos: number;\r\n}\r\n\r\n/** Deserializes tile content metadata.\r\n * @throws [[TileReadError]]\r\n * @internal\r\n */\r\nexport function readTileContentDescription(stream: ByteStream, sizeMultiplier: number | undefined, is2d: boolean, options: TileOptions, isVolumeClassifier: boolean): TileContentDescription {\r\n stream.reset();\r\n\r\n const header = new ImdlHeader(stream);\r\n if (!header.isValid)\r\n throw new TileReadError(TileReadStatus.InvalidHeader);\r\n else if (!header.isReadableVersion)\r\n throw new TileReadError(TileReadStatus.NewerMajorVersion);\r\n\r\n // Skip the feature table.\r\n const featureTableStartPos = stream.curPos;\r\n const ftHeader = FeatureTableHeader.readFrom(stream);\r\n if (undefined === ftHeader)\r\n throw new TileReadError(TileReadStatus.InvalidFeatureTable);\r\n\r\n stream.curPos = featureTableStartPos + ftHeader.length;\r\n\r\n // Determine subdivision based on header data.\r\n const completeTile = 0 === (header.flags & ImdlFlags.Incomplete);\r\n const emptyTile = completeTile && 0 === header.numElementsIncluded && 0 === header.numElementsExcluded;\r\n let isLeaf = (emptyTile || isVolumeClassifier); // Current classifier algorithm supports only a single tile.\r\n if (!isLeaf) {\r\n // Non-spatial (2d) models are of arbitrary scale and contain geometry like line work and especially text which\r\n // can be adversely affected by quantization issues when zooming in closely.\r\n const maxLeafTolerance = 1.0;\r\n\r\n // Must sub-divide if tile explicitly specifies...\r\n let canSkipSubdivision = 0 === (header.flags & ImdlFlags.DisallowMagnification);\r\n // ...or in 2d, or if app explicitly disabled magnification, or tolerance large enough to risk quantization error...\r\n canSkipSubdivision = canSkipSubdivision && !is2d && !options.disableMagnification && header.tolerance <= maxLeafTolerance;\r\n // ...or app specifies incomplete tiles must always be sub-divided.\r\n canSkipSubdivision = canSkipSubdivision && (completeTile || !options.alwaysSubdivideIncompleteTiles);\r\n if (canSkipSubdivision) {\r\n const minElementsPerTile = 100;\r\n if (completeTile && 0 === header.numElementsExcluded && header.numElementsIncluded <= minElementsPerTile) {\r\n const containsCurves = 0 !== (header.flags & ImdlFlags.ContainsCurves);\r\n if (!containsCurves)\r\n isLeaf = true;\r\n else if (undefined === sizeMultiplier)\r\n sizeMultiplier = 1.0;\r\n } else if (undefined === sizeMultiplier && header.numElementsIncluded + header.numElementsExcluded <= minElementsPerTile) {\r\n sizeMultiplier = 1.0;\r\n }\r\n }\r\n }\r\n\r\n return {\r\n featureTableStartPos,\r\n contentRange: header.contentRange,\r\n isLeaf,\r\n sizeMultiplier,\r\n emptySubRangeMask: header.emptySubRanges,\r\n };\r\n}\r\n\r\nconst scratchRangeDiagonal = new Vector3d();\r\n\r\n/** Compute the chord tolerance for the specified tile of the given range with the specified size multiplier.\r\n * @internal\r\n */\r\nexport function computeTileChordTolerance(tile: TileMetadata, is3d: boolean, tileScreenSize: number): number {\r\n if (tile.range.isNull)\r\n return 0;\r\n\r\n const diagonal = tile.range.diagonal(scratchRangeDiagonal);\r\n const diagDist = is3d ? diagonal.magnitude() : diagonal.magnitudeXY();\r\n\r\n const mult = Math.max(tile.sizeMultiplier ?? 1, 1);\r\n return diagDist / (tileScreenSize * Constants.minToleranceRatioMultiplier * Math.max(1, mult));\r\n}\r\n\r\n/** Deserializes tile metadata.\r\n * @internal\r\n */\r\nexport class TileMetadataReader {\r\n private readonly _is2d: boolean;\r\n private readonly _isVolumeClassifier: boolean;\r\n private readonly _options: TileOptions;\r\n\r\n public constructor(type: BatchType, is2d: boolean, options: TileOptions) {\r\n this._is2d = is2d;\r\n this._isVolumeClassifier = BatchType.VolumeClassifier === type;\r\n this._options = options;\r\n }\r\n\r\n /** Produce metadata from the specified tile content.\r\n * @throws [[TileReadError]]\r\n */\r\n public read(stream: ByteStream, props: TileProps): TileMetadata {\r\n const content = readTileContentDescription(stream, props.sizeMultiplier, this._is2d, this._options, this._isVolumeClassifier);\r\n return {\r\n contentRange: content.contentRange,\r\n isLeaf: content.isLeaf,\r\n sizeMultiplier: content.sizeMultiplier,\r\n emptySubRangeMask: content.emptySubRangeMask,\r\n range: Range3d.fromJSON(props.range),\r\n contentId: props.contentId,\r\n };\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"TileMetadata.js","sourceRoot":"","sources":["../../../src/tile/TileMetadata.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAE6B;AAC7B,wDAAyD;AACzD,kDAA4C;AAE5C,iDAA+F;AAC/F,qCAAyD;AAEzD,mCAAmC;AAEnC,+DAA+D;AAC/D,IAAU,SAAS,CAElB;AAFD,WAAU,SAAS;IACJ,qCAA2B,GAAG,CAAC,CAAC;AAC/C,CAAC,EAFS,SAAS,KAAT,SAAS,QAElB;AA8CD,gBAAgB;AAChB,IAAiB,WAAW,CA2B3B;AA3BD,WAAiB,WAAW;IAC1B;;;;;OAKG;IACH,SAAgB,sBAAsB,CAAC,MAAc,EAAE,SAAiB;QACtE,MAAM,IAAI,GAAG,+BAA+B,CAAC,MAAM,CAAC,CAAC;QACrD,MAAM,YAAY,GAAG,kBAAkB,CAAC,SAAS,CAAC,CAAC;QACnD,MAAM,WAAW,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC;QAElD,OAA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/D,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC1B,CAAC;IAED;;OAEG;IACI,IAAI,CAAC,MAAkB,EAAE,KAAgB;QAC9C,MAAM,OAAO,GAAG,4BAA4B,CAAC;YAC3C,MAAM;YACN,cAAc,EAAE,KAAK,CAAC,cAAc;YACpC,IAAI,EAAE,IAAI,CAAC,KAAK;YAChB,OAAO,EAAE,IAAI,CAAC,QAAQ;YACtB,kBAAkB,EAAE,IAAI,CAAC,mBAAmB;SAC7C,CAAC,CAAC;QAEH,OAAO;YACL,YAAY,EAAE,OAAO,CAAC,YAAY;YAClC,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,cAAc,EAAE,OAAO,CAAC,cAAc;YACtC,iBAAiB,EAAE,OAAO,CAAC,iBAAiB;YAC5C,KAAK,EAAE,uBAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC;YACpC,SAAS,EAAE,KAAK,CAAC,SAAS;SAC3B,CAAC;IACJ,CAAC;CACF;AAhCD,gDAgCC","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 Tile\r\n */\r\n\r\nimport {\r\n assert, ByteStream, compareBooleans, compareBooleansOrUndefined, compareNumbers, compareStringsOrUndefined, Id64, Id64String,\r\n} from \"@itwin/core-bentley\";\r\nimport { Range3d, Vector3d } from \"@itwin/core-geometry\";\r\nimport { BatchType } from \"../FeatureTable\";\r\nimport { TileProps } from \"../TileProps\";\r\nimport { CurrentImdlVersion, FeatureTableHeader, ImdlFlags, ImdlHeader } from \"./IModelTileIO\";\r\nimport { TileReadError, TileReadStatus } from \"./TileIO\";\r\n\r\n// cspell:ignore imdl mult bitfield\r\n\r\n// NB: These constants correspond to those defined in Tile.cpp.\r\nnamespace Constants {\r\n export const minToleranceRatioMultiplier = 2;\r\n}\r\n\r\n/** Describes an iModel tile tree.\r\n * @internal\r\n */\r\nexport interface TileTreeMetadata {\r\n readonly modelId: Id64String;\r\n readonly is2d: boolean;\r\n readonly contentRange?: Range3d;\r\n readonly tileScreenSize: number;\r\n}\r\n\r\n/** Describes the contents of an iModel tile.\r\n * @internal\r\n */\r\nexport interface TileContentMetadata {\r\n readonly contentRange: Range3d;\r\n readonly isLeaf: boolean;\r\n readonly sizeMultiplier?: number;\r\n readonly emptySubRangeMask: number;\r\n}\r\n\r\n/** Describes an iModel tile.\r\n * @internal\r\n */\r\nexport interface TileMetadata extends TileContentMetadata {\r\n readonly contentId: string;\r\n readonly range: Range3d;\r\n}\r\n\r\n/** @internal */\r\nexport interface TileOptions {\r\n readonly maximumMajorTileFormatVersion: number;\r\n readonly enableInstancing: boolean;\r\n readonly enableImprovedElision: boolean;\r\n readonly ignoreAreaPatterns: boolean;\r\n readonly enableExternalTextures: boolean;\r\n readonly useProjectExtents: boolean;\r\n readonly optimizeBRepProcessing: boolean;\r\n readonly useLargerTiles: boolean;\r\n readonly disableMagnification: boolean;\r\n readonly alwaysSubdivideIncompleteTiles: boolean;\r\n readonly enableIndexedEdges: boolean;\r\n readonly generateAllPolyfaceEdges: boolean;\r\n}\r\n\r\n/** @internal */\r\nexport namespace TileOptions {\r\n /** Given the string representation of an [[IModelTileTreeId]] and the contentId of a [Tile]($frontend) belonging to that [TileTree]($frontend),\r\n * compute the [[TileOptions]] that were used to generate the Ids.\r\n * @throws Error if `treeId` or `contentId` are not valid Ids.\r\n * @note `treeId` and `contentId` are assumed to be valid Ids. They are not fully parsed and validated - only the information required by this function is extracted.\r\n * @note `treeId` and `contentId` are assumed to have been produced for version 4 or later of the iMdl tile format.\r\n */\r\n export function fromTreeIdAndContentId(treeId: string, contentId: string): TileOptions {\r\n const tree = treeFlagsAndFormatVersionFromId(treeId);\r\n const contentFlags = contentFlagsFromId(contentId);\r\n const edgeOptions = edgeOptionsFromTreeId(treeId);\r\n\r\n return {\r\n maximumMajorTileFormatVersion: tree.version,\r\n enableInstancing: 0 !== (contentFlags & ContentFlags.AllowInstancing),\r\n enableImprovedElision: 0 !== (contentFlags & ContentFlags.ImprovedElision),\r\n ignoreAreaPatterns: 0 !== (contentFlags & ContentFlags.IgnoreAreaPatterns),\r\n enableExternalTextures: 0 !== (contentFlags & ContentFlags.ExternalTextures),\r\n useProjectExtents: 0 !== (tree.flags & TreeFlags.UseProjectExtents),\r\n optimizeBRepProcessing: 0 !== (tree.flags & TreeFlags.OptimizeBRepProcessing),\r\n useLargerTiles: 0 !== (tree.flags & TreeFlags.UseLargerTiles),\r\n disableMagnification: false,\r\n alwaysSubdivideIncompleteTiles: false,\r\n enableIndexedEdges: edgeOptions && edgeOptions.indexed,\r\n generateAllPolyfaceEdges: edgeOptions && edgeOptions.smooth,\r\n };\r\n }\r\n}\r\n\r\ntype ParsedPrimary = Omit<PrimaryTileTreeId, \"type\" | \"animationId\" | \"enforceDisplayPriority\">;\r\ninterface ParsedClassifier {\r\n type: BatchType.VolumeClassifier | BatchType.PlanarClassifier;\r\n expansion: number;\r\n}\r\n\r\n/** The result of [[parseTileTreeIdAndContentId]].\r\n * @internal\r\n */\r\nexport interface ParsedTileTreeIdAndContentId {\r\n modelId: Id64String;\r\n treeId: IModelTileTreeId;\r\n contentId: ContentIdSpec;\r\n options: TileOptions;\r\n}\r\n\r\nclass Parser {\r\n public readonly input: string;\r\n public curPos = 0;\r\n\r\n public constructor(input: string) {\r\n this.input = input;\r\n }\r\n\r\n public parse(contentId: string): ParsedTileTreeIdAndContentId {\r\n this.require(this.input.length > 0);\r\n\r\n // Skip version and flags, they're handled by TileOptions.fromTreeIdAndContentId\r\n while (this.curPos < this.input.length && this.cur() !== \"-\")\r\n this.advance();\r\n\r\n this.eat(\"-\");\r\n this.require(this.curPos < this.input.length);\r\n\r\n const classifier = this.cur() === \"C\" ? this.parseClassifier() : undefined;\r\n const animationId = this.parseAnimation();\r\n\r\n const primary = classifier ? undefined : this.parsePrimary();\r\n this.require((undefined === classifier) !== (undefined === primary));\r\n\r\n const modelId = this.input.substring(this.curPos);\r\n this.require(Id64.isId64(modelId));\r\n\r\n const { flags: treeFlags } = treeFlagsAndFormatVersionFromId(this.input);\r\n const options = TileOptions.fromTreeIdAndContentId(this.input, contentId);\r\n\r\n let parsedContentId: ContentIdSpec;\r\n try {\r\n parsedContentId = ContentIdProvider.create(true, options).specFromId(contentId);\r\n } catch (e) {\r\n this.reject(\"Invalid content Id\");\r\n }\r\n\r\n if (Object.keys(parsedContentId).some((key) => parsedContentId.hasOwnProperty(key) && typeof parsedContentId[key as keyof ContentIdSpec] === \"number\" && !Number.isFinite(parsedContentId[key as keyof ContentIdSpec])))\r\n throw new Error(\"Invalid content Id\");\r\n\r\n let treeId: IModelTileTreeId;\r\n if (classifier) {\r\n treeId = { ...classifier, animationId };\r\n } else {\r\n assert(undefined !== primary);\r\n const enforceDisplayPriority = (treeFlags & TreeFlags.EnforceDisplayPriority) !== 0 ? true : undefined;\r\n treeId = { ...primary, animationId, type: BatchType.Primary, enforceDisplayPriority };\r\n }\r\n\r\n return {\r\n contentId: parsedContentId,\r\n modelId,\r\n options,\r\n treeId,\r\n };\r\n }\r\n\r\n private cur(): string {\r\n this.require(this.curPos < this.input.length);\r\n return this.input[this.curPos];\r\n }\r\n\r\n private advance(): void {\r\n this.require(this.curPos < this.input.length);\r\n ++this.curPos;\r\n }\r\n\r\n private eat(expectedChar: string): void {\r\n this.require(this.cur() === expectedChar);\r\n this.advance();\r\n }\r\n\r\n private reject(message = \"Invalid tree Id\"): never {\r\n throw new Error(message);\r\n }\r\n\r\n private require(condition: boolean, message = \"Invalid tree Id\"): asserts condition {\r\n if (!condition)\r\n this.reject(message);\r\n }\r\n\r\n private parseClassifier(): ParsedClassifier | undefined {\r\n this.eat(\"C\");\r\n let type = BatchType.VolumeClassifier;\r\n if (this.cur() === \"P\") {\r\n type = BatchType.PlanarClassifier;\r\n this.advance();\r\n }\r\n\r\n this.eat(\":\");\r\n\r\n // C: or CP: is always folowed by expansion then an underscore.\r\n let expansionStr = \"\";\r\n while (this.curPos < this.input.length && (this.cur() >= \"0\" && this.cur() <= \"9\" || this.cur() === \".\")) {\r\n expansionStr += this.cur();\r\n this.advance();\r\n }\r\n\r\n this.eat(\"_\");\r\n\r\n const expansion = Number.parseFloat(expansionStr);\r\n this.require(!Number.isNaN(expansion));\r\n\r\n return { type, expansion };\r\n }\r\n\r\n private parseAnimation(): Id64String | undefined {\r\n if (this.cur() !== \"A\")\r\n return undefined;\r\n\r\n this.eat(\"A\");\r\n this.eat(\":\");\r\n\r\n const termPos = this.input.indexOf(\"_\", this.curPos);\r\n this.require(termPos > this.curPos);\r\n\r\n const animationId = this.input.substring(this.curPos, termPos);\r\n this.require(Id64.isId64(animationId));\r\n\r\n this.curPos = termPos + 1; // Skip \"_\"\r\n return animationId;\r\n }\r\n\r\n private parsePrimary(): ParsedPrimary {\r\n const edges = this.parseEdges();\r\n const sectionCut = this.parseSectionCut();\r\n return { edges, sectionCut };\r\n }\r\n\r\n private parseEdges(): EdgeOptions | false {\r\n if (\"E\" !== this.cur())\r\n return { indexed: false, smooth: false };\r\n\r\n this.eat(\"E\");\r\n this.eat(\":\");\r\n\r\n const typeStr = this.cur();\r\n this.eat(typeStr);\r\n this.eat(\"_\");\r\n\r\n switch (typeStr) {\r\n case \"0\": return false;\r\n case \"2\": return { indexed: true, smooth: false };\r\n case \"3\": return { indexed: false, smooth: true };\r\n case \"4\": return { indexed: true, smooth: true };\r\n default: this.reject();\r\n }\r\n }\r\n\r\n private parseSectionCut(): string | undefined {\r\n if (\"S\" !== this.cur())\r\n return undefined;\r\n\r\n this.eat(\"S\");\r\n const termPos = this.input.indexOf(\"s\", this.curPos);\r\n this.require(termPos > this.curPos);\r\n\r\n const sectionCut = this.input.substring(this.curPos, termPos);\r\n this.curPos = termPos + 1; // Skip \"_\";\r\n return sectionCut;\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport function parseTileTreeIdAndContentId(treeId: string, contentId: string): ParsedTileTreeIdAndContentId {\r\n const parser = new Parser(treeId);\r\n return parser.parse(contentId);\r\n}\r\n\r\n/** @internal */\r\nexport const defaultTileOptions: TileOptions = Object.freeze({\r\n maximumMajorTileFormatVersion: CurrentImdlVersion.Major,\r\n enableInstancing: true,\r\n enableImprovedElision: true,\r\n ignoreAreaPatterns: false,\r\n enableExternalTextures: true,\r\n useProjectExtents: true,\r\n optimizeBRepProcessing: true,\r\n useLargerTiles: true,\r\n disableMagnification: false,\r\n alwaysSubdivideIncompleteTiles: false,\r\n enableIndexedEdges: true,\r\n generateAllPolyfaceEdges: true,\r\n});\r\n\r\nfunction contentFlagsFromId(id: string): ContentFlags {\r\n if (0 === id.length || \"-\" !== id[0])\r\n throw new Error(\"Invalid content Id\");\r\n\r\n // V4: -flags-d-i-j-k-m - version in tree Id\r\n const end = id.indexOf(\"-\", 1);\r\n if (-1 !== end) {\r\n const flags = Number.parseInt(id.substring(1, end), 16);\r\n if (!Number.isNaN(flags))\r\n return flags;\r\n }\r\n\r\n throw new Error(\"Invalid content Id\");\r\n}\r\n\r\nfunction treeFlagsAndFormatVersionFromId(id: string): { flags: TreeFlags, version: number } {\r\n if (0 === id.length)\r\n throw new Error(\"Invalid tree Id\");\r\n\r\n let parts = id.split(\"-\");\r\n if (parts.length > 0) {\r\n parts = parts[0].split(\"_\");\r\n if (parts.length === 2) {\r\n const version = Number.parseInt(parts[0], 16);\r\n const flags = Number.parseInt(parts[1], 16);\r\n if (!Number.isNaN(version) || !Number.isNaN(flags))\r\n return { version, flags };\r\n }\r\n }\r\n\r\n throw new Error(\"Invalid tree Id\");\r\n}\r\n\r\nfunction edgeOptionsFromTreeId(id: string): EdgeOptions {\r\n const pos = id.indexOf(\"E:\");\r\n if (pos <= 0)\r\n return { indexed: false, smooth: false };\r\n\r\n switch (id[pos + 2]) {\r\n case \"0\": return { indexed: defaultTileOptions.enableIndexedEdges, smooth: defaultTileOptions.generateAllPolyfaceEdges };\r\n case \"2\": return { indexed: true, smooth: false };\r\n case \"3\": return { indexed: false, smooth: true };\r\n case \"4\": return { indexed: true, smooth: true };\r\n }\r\n\r\n throw new Error(\"Invalid tree Id\");\r\n}\r\n\r\n/** @internal */\r\nexport function getMaximumMajorTileFormatVersion(maxMajorVersion: number, formatVersion?: number): number {\r\n // The `formatVersion` input is from the backend, telling us precisely the maximum major+minor version it can produce.\r\n // Ensure we do not request tiles of a newer major version than backend can supply or it can read; and also limit major version\r\n // to that optionally configured by the app.\r\n let majorVersion = maxMajorVersion;\r\n if (undefined !== formatVersion)\r\n majorVersion = Math.min((formatVersion >>> 0x10), majorVersion);\r\n\r\n // Version number less than 1 is invalid - ignore\r\n majorVersion = Math.max(majorVersion, 1);\r\n\r\n // Version number greater than current known version ignored\r\n majorVersion = Math.min(majorVersion, CurrentImdlVersion.Major);\r\n\r\n // Version numbers are integers - round down\r\n return Math.max(Math.floor(majorVersion), 1);\r\n}\r\n\r\n/** Flags controlling the structure of a tile tree. The flags are part of the tile tree's Id.\r\n * @alpha\r\n */\r\nexport enum TreeFlags {\r\n None = 0,\r\n UseProjectExtents = 1 << 0, // Use project extents as the basis of the tile tree's range.\r\n EnforceDisplayPriority = 1 << 1, // For 3d plan projection models, group graphics into layers based on subcategory.\r\n OptimizeBRepProcessing = 1 << 2, // Use an optimized pipeline for producing facets from BRep entities.\r\n UseLargerTiles = 1 << 3, // Produce tiles of larger size in screen pixels.\r\n}\r\n\r\n/** Describes how edges should be produced for tiles in a tile tree.\r\n * @internal\r\n */\r\nexport interface EdgeOptions {\r\n /** Generate indexed edges. These use less memory and draw more efficiently than non-indexed edges, but require WebGL 2.\r\n * Generally the display system will determine which to use based on the device's capabilities and application configuration.\r\n */\r\n indexed: boolean;\r\n /** For polyfaces that lack edge visibility information, generate edges for all faces; otherwise, infer edges from mesh topology. */\r\n smooth: boolean;\r\n}\r\n\r\nfunction compareEdgeOptions(a: EdgeOptions | false, b: EdgeOptions | false): number {\r\n if (typeof a !== typeof b)\r\n return a ? 1 : -1;\r\n\r\n if (typeof a === \"boolean\") {\r\n assert(typeof b === \"boolean\");\r\n return compareBooleans(a, b);\r\n }\r\n\r\n assert(typeof b === \"object\");\r\n let cmp = compareBooleans(a.indexed, b.indexed);\r\n if (0 === cmp)\r\n cmp = compareBooleans(a.smooth, b.smooth);\r\n\r\n return cmp;\r\n}\r\n\r\n/** Describes a tile tree used to draw the contents of a model, possibly with embedded animation.\r\n * @internal\r\n */\r\nexport interface PrimaryTileTreeId {\r\n /** Describes the type of tile tree. */\r\n type: BatchType.Primary;\r\n /** The type of edges to include in tile content. */\r\n edges: EdgeOptions | false;\r\n /** Id of the [DisplayStyle]($backend) or [RenderTimeline]($backend) element holding the [[RenderSchedule]] script to be applied to the tiles. */\r\n animationId?: Id64String;\r\n /** If true, meshes within the tiles will be grouped into nodes based on the display priority associated with their subcategories,\r\n * for ensuring the graphics display with correct priority.\r\n */\r\n enforceDisplayPriority?: boolean;\r\n /** If defined, the compact string representation of a clip vector applied to the tiles to produce cut geometry at the intersections with the clip planes.\r\n * Any geometry *not* intersecting the clip planes is omitted from the tiles.\r\n * @see [ClipVector.toCompactString[($core-geometry).\r\n */\r\n sectionCut?: string;\r\n}\r\n\r\n/** Describes a tile tree that can classify the contents of other tile trees using the model's geometry.\r\n * @internal\r\n */\r\nexport interface ClassifierTileTreeId {\r\n type: BatchType.VolumeClassifier | BatchType.PlanarClassifier;\r\n expansion: number;\r\n animationId?: Id64String;\r\n}\r\n\r\nfunction animationIdToString(animationId: Id64String): string {\r\n return `A:${animationId}_`;\r\n}\r\n\r\n/** Describes the Id of an iModel tile tree.\r\n * @internal\r\n */\r\nexport type IModelTileTreeId = PrimaryTileTreeId | ClassifierTileTreeId;\r\n\r\n/** Convert a tile tree Id to its string representation.\r\n * @internal\r\n */\r\nexport function iModelTileTreeIdToString(modelId: Id64String, treeId: IModelTileTreeId, options: TileOptions): string {\r\n let idStr = \"\";\r\n let flags = options.useProjectExtents ? TreeFlags.UseProjectExtents : TreeFlags.None;\r\n if (options.optimizeBRepProcessing)\r\n flags |= TreeFlags.OptimizeBRepProcessing;\r\n\r\n if (options.useLargerTiles)\r\n flags |= TreeFlags.UseLargerTiles;\r\n\r\n if (BatchType.Primary === treeId.type) {\r\n if (undefined !== treeId.animationId)\r\n idStr = `${idStr}${animationIdToString(treeId.animationId)}`;\r\n else if (treeId.enforceDisplayPriority) // animation and priority are currently mutually exclusive\r\n flags |= TreeFlags.EnforceDisplayPriority;\r\n\r\n let edges;\r\n if (!treeId.edges) {\r\n edges = \"E:0_\";\r\n } else {\r\n if (!treeId.edges.smooth)\r\n edges = treeId.edges.indexed ? \"E:2_\" : \"\";\r\n else\r\n edges = treeId.edges.indexed ? \"E:4_\" : \"E:3_\";\r\n }\r\n\r\n const sectionCut = treeId.sectionCut ? `S${treeId.sectionCut}s` : \"\";\r\n idStr = `${idStr}${edges}${sectionCut}`;\r\n } else {\r\n const typeStr = BatchType.PlanarClassifier === treeId.type ? \"CP\" : \"C\";\r\n idStr = `${idStr + typeStr}:${treeId.expansion.toFixed(6)}_`;\r\n\r\n if (BatchType.VolumeClassifier === treeId.type)\r\n flags |= TreeFlags.UseProjectExtents;\r\n\r\n if (undefined !== treeId.animationId)\r\n idStr = `${idStr}${animationIdToString(treeId.animationId)}`;\r\n }\r\n\r\n const version = getMaximumMajorTileFormatVersion(options.maximumMajorTileFormatVersion);\r\n if (version >= 4) {\r\n const prefix = `${version.toString(16)}_${flags.toString(16)}-`;\r\n idStr = prefix + idStr;\r\n }\r\n\r\n return idStr + modelId;\r\n}\r\n\r\n/** Ordinal comparison of two tile tree Ids, e.g., for use in sorted containers.\r\n * @internal\r\n */\r\nexport function compareIModelTileTreeIds(lhs: IModelTileTreeId, rhs: IModelTileTreeId): number {\r\n let cmp = compareNumbers(lhs.type, rhs.type);\r\n if (0 === cmp)\r\n cmp = compareStringsOrUndefined(lhs.animationId, rhs.animationId);\r\n\r\n if (0 !== cmp)\r\n return cmp;\r\n\r\n // NB: The redundant checks on BatchType below are to satisfy compiler.\r\n assert(lhs.type === rhs.type);\r\n if (BatchType.Primary === lhs.type && BatchType.Primary === rhs.type) {\r\n cmp = compareEdgeOptions(lhs.edges, rhs.edges);\r\n if (0 === cmp) {\r\n cmp = compareBooleansOrUndefined(lhs.enforceDisplayPriority, rhs.enforceDisplayPriority);\r\n if (0 === cmp)\r\n cmp = compareStringsOrUndefined(lhs.sectionCut, rhs.sectionCut);\r\n }\r\n } else if (BatchType.Primary !== lhs.type && BatchType.Primary !== rhs.type) {\r\n cmp = compareNumbers(lhs.expansion, rhs.expansion);\r\n }\r\n\r\n return cmp;\r\n}\r\n\r\n/** Flags controlling how tile content is produced. The flags are part of the ContentId.\r\n * @alpha\r\n */\r\nexport enum ContentFlags {\r\n None = 0,\r\n AllowInstancing = 1 << 0,\r\n ImprovedElision = 1 << 1,\r\n IgnoreAreaPatterns = 1 << 2,\r\n ExternalTextures = 1 << 3,\r\n}\r\n\r\n/** Describes the components of a tile's content Id.\r\n *\r\n * The depth specifies how many subdivisions from the root tile are to be performed to reach the sub-volume of interest.\r\n *\r\n * The i, j, and k parameters specify how to subdivide the tile's volume. Each sub-division is performed along the longest axis of the\r\n * volume. The volume is first sub-divided based on `i`, then the result sub-divided based on `j`, and finally that result sub-divided\r\n * based on `k`.\r\n *\r\n * The multiplier is an integer - generally a power of two - multiplied by the screen size of a tile (512 pixels) used to\r\n * produce a higher-resolution tile for the same volume.\r\n * @internal\r\n */\r\ninterface ContentIdSpec {\r\n depth: number;\r\n i: number;\r\n j: number;\r\n k: number;\r\n multiplier: number;\r\n}\r\n\r\n/** Contains logic for working with tile content Ids according to a specific content Id scheme. Which scheme is used depends on\r\n * the major version of the tile format.\r\n * @internal\r\n */\r\nexport abstract class ContentIdProvider {\r\n public readonly majorFormatVersion: number;\r\n public readonly contentFlags: ContentFlags;\r\n\r\n protected constructor(formatVersion: number, contentFlags: ContentFlags) {\r\n this.majorFormatVersion = formatVersion;\r\n this.contentFlags = contentFlags;\r\n }\r\n\r\n public get rootContentId(): string {\r\n return this.computeId(0, 0, 0, 0, 1);\r\n }\r\n\r\n public idFromParentAndMultiplier(parentId: string, multiplier: number): string {\r\n const lastSepPos = parentId.lastIndexOf(this._separator);\r\n assert(-1 !== lastSepPos);\r\n return parentId.substring(0, lastSepPos + 1) + multiplier.toString(16);\r\n }\r\n\r\n public specFromId(id: string): ContentIdSpec {\r\n const parts = id.split(this._separator);\r\n const len = parts.length;\r\n assert(len >= 5);\r\n return {\r\n depth: parseInt(parts[len - 5], 16),\r\n i: parseInt(parts[len - 4], 16),\r\n j: parseInt(parts[len - 3], 16),\r\n k: parseInt(parts[len - 2], 16),\r\n multiplier: parseInt(parts[len - 1], 16),\r\n };\r\n }\r\n\r\n public idFromSpec(spec: ContentIdSpec): string {\r\n return this.computeId(spec.depth, spec.i, spec.j, spec.k, spec.multiplier);\r\n }\r\n\r\n protected join(depth: number, i: number, j: number, k: number, mult: number): string {\r\n const sep = this._separator;\r\n return depth.toString(16) + sep + i.toString(16) + sep + j.toString(16) + sep + k.toString(16) + sep + mult.toString(16);\r\n }\r\n\r\n protected abstract get _separator(): string;\r\n protected abstract computeId(depth: number, i: number, j: number, k: number, mult: number): string;\r\n\r\n /** formatVersion is the maximum major version supported by the back-end supplying the tile tree.\r\n * Must ensure front-end does not request tiles of a format the back-end cannot supply, and back-end does\r\n * not supply tiles of a format the front-end doesn't recognize.\r\n */\r\n public static create(allowInstancing: boolean, options: TileOptions, formatVersion?: number): ContentIdProvider {\r\n const majorVersion = getMaximumMajorTileFormatVersion(options.maximumMajorTileFormatVersion, formatVersion);\r\n assert(majorVersion > 0);\r\n assert(Math.floor(majorVersion) === majorVersion);\r\n switch (majorVersion) {\r\n case 0:\r\n case 1:\r\n return new ContentIdV1Provider(majorVersion);\r\n case 2:\r\n case 3:\r\n return new ContentIdV2Provider(majorVersion, allowInstancing, options);\r\n default:\r\n return new ContentIdV4Provider(allowInstancing, options, majorVersion);\r\n }\r\n }\r\n}\r\n\r\n/** The original (major version 1) tile format used a content Id scheme of the format\r\n * `depth/i/j/k/multiplier`.\r\n * @internal\r\n */\r\nclass ContentIdV1Provider extends ContentIdProvider {\r\n public constructor(majorVersion: number) {\r\n super(majorVersion, ContentFlags.None);\r\n }\r\n\r\n protected get _separator() { return \"/\"; }\r\n protected computeId(depth: number, i: number, j: number, k: number, mult: number): string {\r\n return this.join(depth, i, j, k, mult);\r\n }\r\n}\r\n\r\n/** Tile formats 2 and 3 use a content Id scheme encoding styling flags and the major format version\r\n * into the content Id, of the format `_majorVersion_flags_depth_i_j_k_multiplier`.\r\n * @internal\r\n */\r\nclass ContentIdV2Provider extends ContentIdProvider {\r\n private readonly _prefix: string;\r\n\r\n public constructor(majorVersion: number, allowInstancing: boolean, options: TileOptions) {\r\n const flags = (allowInstancing && options.enableInstancing) ? ContentFlags.AllowInstancing : ContentFlags.None;\r\n super(majorVersion, flags);\r\n this._prefix = this._separator + majorVersion.toString(16) + this._separator + flags.toString(16) + this._separator;\r\n }\r\n\r\n protected get _separator() { return \"_\"; }\r\n protected computeId(depth: number, i: number, j: number, k: number, mult: number): string {\r\n return this._prefix + this.join(depth, i, j, k, mult);\r\n }\r\n}\r\n\r\n/** Tile formats 4+ encode styling flags but not major format version. (The version is specified by the tile tree's Id).\r\n * Format: `-flags-depth-i-j-k-multiplier`.\r\n * @internal\r\n */\r\nclass ContentIdV4Provider extends ContentIdProvider {\r\n private readonly _prefix: string;\r\n\r\n public constructor(allowInstancing: boolean, options: TileOptions, majorVersion: number) {\r\n let flags = (allowInstancing && options.enableInstancing) ? ContentFlags.AllowInstancing : ContentFlags.None;\r\n if (options.enableImprovedElision)\r\n flags = flags | ContentFlags.ImprovedElision;\r\n\r\n if (options.ignoreAreaPatterns)\r\n flags = flags | ContentFlags.IgnoreAreaPatterns;\r\n\r\n if (options.enableExternalTextures)\r\n flags = flags | ContentFlags.ExternalTextures;\r\n\r\n super(majorVersion, flags);\r\n this._prefix = this._separator + flags.toString(16) + this._separator;\r\n }\r\n\r\n protected get _separator() { return \"-\"; }\r\n protected computeId(depth: number, i: number, j: number, k: number, mult: number): string {\r\n return this._prefix + this.join(depth, i, j, k, mult);\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport function bisectTileRange3d(range: Range3d, takeUpper: boolean): void {\r\n const diag = range.diagonal();\r\n const pt = takeUpper ? range.high : range.low;\r\n if (diag.x > diag.y && diag.x > diag.z)\r\n pt.x = (range.low.x + range.high.x) / 2.0;\r\n else if (diag.y > diag.z)\r\n pt.y = (range.low.y + range.high.y) / 2.0;\r\n else\r\n pt.z = (range.low.z + range.high.z) / 2.0;\r\n}\r\n\r\n/** @internal */\r\nexport function bisectTileRange2d(range: Range3d, takeUpper: boolean): void {\r\n const diag = range.diagonal();\r\n const pt = takeUpper ? range.high : range.low;\r\n if (diag.x > diag.y)\r\n pt.x = (range.low.x + range.high.x) / 2.0;\r\n else\r\n pt.y = (range.low.y + range.high.y) / 2.0;\r\n}\r\n\r\n/** Given a description of a tile, compute the ranges which would result from sub-dividing its range into 4 or 8 sub-volumes.\r\n * @internal\r\n */\r\nexport function computeChildTileRanges(tile: TileMetadata, root: TileTreeMetadata): Array<{ range: Range3d, isEmpty: boolean }> {\r\n const emptyMask = tile.emptySubRangeMask;\r\n const is2d = root.is2d;\r\n const bisectRange = is2d ? bisectTileRange2d : bisectTileRange3d;\r\n\r\n const ranges: Array<{ range: Range3d, isEmpty: boolean }> = [];\r\n for (let i = 0; i < 2; i++) {\r\n for (let j = 0; j < 2; j++) {\r\n for (let k = 0; k < (is2d ? 1 : 2); k++) {\r\n const emptyBit = 1 << (i + j * 2 + k * 4);\r\n const isEmpty = 0 !== (emptyMask & emptyBit);\r\n\r\n const range = tile.range.clone();\r\n bisectRange(range, 0 === i);\r\n bisectRange(range, 0 === j);\r\n if (!is2d)\r\n bisectRange(range, 0 === k);\r\n\r\n ranges.push({ range, isEmpty });\r\n }\r\n }\r\n }\r\n\r\n return ranges;\r\n}\r\n\r\n/** Given a description of the parent tile, obtain the properties of its child tiles, and the number of empty children.\r\n * @internal\r\n */\r\nexport function computeChildTileProps(parent: TileMetadata, idProvider: ContentIdProvider, root: TileTreeMetadata): { children: TileProps[], numEmpty: number } {\r\n let numEmpty = 0;\r\n const children: TileProps[] = [];\r\n\r\n // Leaf nodes have no children\r\n if (parent.isLeaf)\r\n return { children, numEmpty };\r\n\r\n // One child, same volume as parent, but higher-resolution.\r\n if (undefined !== parent.sizeMultiplier) {\r\n const sizeMultiplier = parent.sizeMultiplier * 2;\r\n const contentId = idProvider.idFromParentAndMultiplier(parent.contentId, sizeMultiplier);\r\n children.push({\r\n contentId,\r\n range: parent.range,\r\n contentRange: parent.contentRange,\r\n sizeMultiplier,\r\n isLeaf: false,\r\n maximumSize: root.tileScreenSize,\r\n });\r\n\r\n return { children, numEmpty };\r\n }\r\n\r\n // Sub-divide parent's range into 4 (for 2d trees) or 8 (for 3d trees) child tiles.\r\n const parentSpec = idProvider.specFromId(parent.contentId);\r\n const childSpec: ContentIdSpec = { ...parentSpec };\r\n childSpec.depth = parentSpec.depth + 1;\r\n\r\n // This mask is a bitfield in which an 'on' bit indicates sub-volume containing no geometry.\r\n // Don't bother creating children or requesting content for such empty volumes.\r\n const emptyMask = parent.emptySubRangeMask;\r\n\r\n // Spatial tree range == project extents; content range == model range.\r\n // Trivially reject children whose ranges are entirely outside model range.\r\n let treeContentRange = root.contentRange;\r\n if (undefined !== treeContentRange && treeContentRange.containsRange(parent.range)) {\r\n // Parent is wholly within model range - don't bother testing child ranges against it.\r\n treeContentRange = undefined;\r\n }\r\n\r\n const is2d = root.is2d;\r\n const bisectRange = is2d ? bisectTileRange2d : bisectTileRange3d;\r\n for (let i = 0; i < 2; i++) {\r\n for (let j = 0; j < 2; j++) {\r\n for (let k = 0; k < (is2d ? 1 : 2); k++) {\r\n const emptyBit = 1 << (i + j * 2 + k * 4);\r\n if (0 !== (emptyMask & emptyBit)) {\r\n // volume is known to contain no geometry.\r\n ++numEmpty;\r\n continue;\r\n }\r\n\r\n const range = parent.range.clone();\r\n bisectRange(range, 0 === i);\r\n bisectRange(range, 0 === j);\r\n if (!is2d)\r\n bisectRange(range, 0 === k);\r\n\r\n if (undefined !== treeContentRange && !range.intersectsRange(treeContentRange)) {\r\n // volume is within project extents but entirely outside model range\r\n ++numEmpty;\r\n continue;\r\n }\r\n\r\n childSpec.i = parentSpec.i * 2 + i;\r\n childSpec.j = parentSpec.j * 2 + j;\r\n childSpec.k = parentSpec.k * 2 + k;\r\n\r\n const childId = idProvider.idFromSpec(childSpec);\r\n children.push({ contentId: childId, range, maximumSize: root.tileScreenSize });\r\n }\r\n }\r\n }\r\n\r\n return { children, numEmpty };\r\n}\r\n\r\n/** @internal */\r\nexport interface TileContentDescription extends TileContentMetadata {\r\n readonly featureTableStartPos: number;\r\n}\r\n\r\n/** Deserializes tile content metadata.\r\n * @throws [[TileReadError]]\r\n * @internal\r\n * @deprecated in 4.0. Use decodeTileContentDescription. I think tile agents (or their tests) are using this function.\r\n */\r\nexport function readTileContentDescription(stream: ByteStream, sizeMultiplier: number | undefined, is2d: boolean, options: TileOptions, isVolumeClassifier: boolean): TileContentDescription {\r\n return decodeTileContentDescription({ stream, sizeMultiplier, is2d, options, isVolumeClassifier });\r\n}\r\n\r\n/** @internal */\r\nexport interface DecodeTileContentDescriptionArgs {\r\n stream: ByteStream;\r\n options: TileOptions;\r\n isVolumeClassifier?: boolean;\r\n is2d?: boolean;\r\n sizeMultiplier?: number;\r\n isLeaf?: boolean;\r\n}\r\n\r\n/** @internal */\r\nexport function decodeTileContentDescription(args: DecodeTileContentDescriptionArgs): TileContentDescription {\r\n const { stream, options } = args;\r\n const isVolumeClassifier = args.isVolumeClassifier ?? false;\r\n\r\n stream.reset();\r\n\r\n const header = new ImdlHeader(stream);\r\n if (!header.isValid)\r\n throw new TileReadError(TileReadStatus.InvalidHeader);\r\n else if (!header.isReadableVersion)\r\n throw new TileReadError(TileReadStatus.NewerMajorVersion);\r\n\r\n // Skip the feature table.\r\n const featureTableStartPos = stream.curPos;\r\n const ftHeader = FeatureTableHeader.readFrom(stream);\r\n if (undefined === ftHeader)\r\n throw new TileReadError(TileReadStatus.InvalidFeatureTable);\r\n\r\n stream.curPos = featureTableStartPos + ftHeader.length;\r\n\r\n let sizeMultiplier = args.sizeMultiplier;\r\n let isLeaf = args.isLeaf;\r\n if (undefined === isLeaf) {\r\n // Determine subdivision based on header data.\r\n const completeTile = 0 === (header.flags & ImdlFlags.Incomplete);\r\n const emptyTile = completeTile && 0 === header.numElementsIncluded && 0 === header.numElementsExcluded;\r\n isLeaf = (emptyTile || isVolumeClassifier); // Current classifier algorithm supports only a single tile.\r\n if (!isLeaf) {\r\n // Non-spatial (2d) models are of arbitrary scale and contain geometry like line work and especially text which\r\n // can be adversely affected by quantization issues when zooming in closely.\r\n const maxLeafTolerance = 1.0;\r\n\r\n // Must sub-divide if tile explicitly specifies...\r\n let canSkipSubdivision = 0 === (header.flags & ImdlFlags.DisallowMagnification);\r\n // ...or in 2d, or if app explicitly disabled magnification, or tolerance large enough to risk quantization error...\r\n canSkipSubdivision = canSkipSubdivision && !args.is2d && !options.disableMagnification && header.tolerance <= maxLeafTolerance;\r\n // ...or app specifies incomplete tiles must always be sub-divided.\r\n canSkipSubdivision = canSkipSubdivision && (completeTile || !options.alwaysSubdivideIncompleteTiles);\r\n if (canSkipSubdivision) {\r\n const minElementsPerTile = 100;\r\n if (completeTile && 0 === header.numElementsExcluded && header.numElementsIncluded <= minElementsPerTile) {\r\n const containsCurves = 0 !== (header.flags & ImdlFlags.ContainsCurves);\r\n if (!containsCurves)\r\n isLeaf = true;\r\n else if (undefined === sizeMultiplier)\r\n sizeMultiplier = 1.0;\r\n } else if (undefined === sizeMultiplier && header.numElementsIncluded + header.numElementsExcluded <= minElementsPerTile) {\r\n sizeMultiplier = 1.0;\r\n }\r\n }\r\n }\r\n }\r\n\r\n return {\r\n featureTableStartPos,\r\n contentRange: header.contentRange,\r\n isLeaf,\r\n sizeMultiplier,\r\n emptySubRangeMask: header.emptySubRanges,\r\n };\r\n}\r\n\r\nconst scratchRangeDiagonal = new Vector3d();\r\n\r\n/** Compute the chord tolerance for the specified tile of the given range with the specified size multiplier.\r\n * @internal\r\n */\r\nexport function computeTileChordTolerance(tile: TileMetadata, is3d: boolean, tileScreenSize: number): number {\r\n if (tile.range.isNull)\r\n return 0;\r\n\r\n const diagonal = tile.range.diagonal(scratchRangeDiagonal);\r\n const diagDist = is3d ? diagonal.magnitude() : diagonal.magnitudeXY();\r\n\r\n const mult = Math.max(tile.sizeMultiplier ?? 1, 1);\r\n return diagDist / (tileScreenSize * Constants.minToleranceRatioMultiplier * Math.max(1, mult));\r\n}\r\n\r\n/** Deserializes tile metadata.\r\n * @internal\r\n */\r\nexport class TileMetadataReader {\r\n private readonly _is2d: boolean;\r\n private readonly _isVolumeClassifier: boolean;\r\n private readonly _options: TileOptions;\r\n\r\n public constructor(type: BatchType, is2d: boolean, options: TileOptions) {\r\n this._is2d = is2d;\r\n this._isVolumeClassifier = BatchType.VolumeClassifier === type;\r\n this._options = options;\r\n }\r\n\r\n /** Produce metadata from the specified tile content.\r\n * @throws [[TileReadError]]\r\n */\r\n public read(stream: ByteStream, props: TileProps): TileMetadata {\r\n const content = decodeTileContentDescription({\r\n stream,\r\n sizeMultiplier: props.sizeMultiplier,\r\n is2d: this._is2d,\r\n options: this._options,\r\n isVolumeClassifier: this._isVolumeClassifier,\r\n });\r\n\r\n return {\r\n contentRange: content.contentRange,\r\n isLeaf: content.isLeaf,\r\n sizeMultiplier: content.sizeMultiplier,\r\n emptySubRangeMask: content.emptySubRangeMask,\r\n range: Range3d.fromJSON(props.range),\r\n contentId: props.contentId,\r\n };\r\n }\r\n}\r\n"]}
|
|
@@ -51,6 +51,16 @@ export interface TextureMapProps {
|
|
|
51
51
|
pattern_mapping?: TextureMapping.Mode;
|
|
52
52
|
/** Weight at which to combine diffuse image and color; if undefined, defaults to 1.0 */
|
|
53
53
|
pattern_weight?: number;
|
|
54
|
+
/** If true, override the mapping mode with constant LOD mapping for the normal map, defaults to false. */
|
|
55
|
+
pattern_useConstantLod?: boolean;
|
|
56
|
+
/** The number of times the texture is repeated if pattern_useConstantLod is true. Increasing this will make the texture pattern appear smaller, decreasing it will make it larger. Defaults to 1.*/
|
|
57
|
+
pattern_constantlod_repetitions?: number;
|
|
58
|
+
/** An offset in world units used to shift the texture when pattern_useConstantLod is true. Defaults to (0, 0). */
|
|
59
|
+
pattern_constantlod_offset?: Point2dProps;
|
|
60
|
+
/** The minimum distance (from the eye to the surface) at which to clamp the texture size when pattern_useConstantLod is true. Defaults to 1. */
|
|
61
|
+
pattern_constantlod_mindistanceclamp?: number;
|
|
62
|
+
/** The maximum distance (from the eye to the surface) at which to clamp the texture size when pattern_useConstantLod is true. Defaults to 2^32. */
|
|
63
|
+
pattern_constantlod_maxdistanceclamp?: number;
|
|
54
64
|
/** The Id of the persistent [Texture]($backend) element defining the texture image. */
|
|
55
65
|
TextureId: Id64String;
|
|
56
66
|
}
|
|
@@ -63,7 +73,9 @@ export declare enum NormalMapFlags {
|
|
|
63
73
|
/** Indicates that the Y component of each vector - stored in the texture's green channel - points upward along the positive Y axis and should
|
|
64
74
|
* be negated. By default it points downward.
|
|
65
75
|
*/
|
|
66
|
-
GreenUp = 1
|
|
76
|
+
GreenUp = 1,
|
|
77
|
+
/** If true, override the mapping mode with constant LOD mapping for the normal map. */
|
|
78
|
+
UseConstantLod = 2
|
|
67
79
|
}
|
|
68
80
|
/** Describes how to apply [normal mapping](https://en.wikipedia.org/wiki/Normal_mapping) to a surface material.
|
|
69
81
|
* @see [[RenderMaterialAssetMapsProps.Normal]] to define a normal map for a [[RenderMaterialAssetProps]].
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MaterialProps.d.ts","sourceRoot":"","sources":["../../src/MaterialProps.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,sB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;IAC/E,WAAW,EAAE,MAAM,CAAC;IACpB,+CAA+C;IAC/C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE;QACf,2EAA2E;QAC3E,cAAc,CAAC,EAAE;YACf,iEAAiE;YACjE,cAAc,CAAC,EAAE,wBAAwB,CAAC;SAC3C,CAAC;KACH,CAAC;CACH"}
|
package/lib/esm/MaterialProps.js
CHANGED
|
@@ -29,5 +29,7 @@ export var NormalMapFlags;
|
|
|
29
29
|
* be negated. By default it points downward.
|
|
30
30
|
*/
|
|
31
31
|
NormalMapFlags[NormalMapFlags["GreenUp"] = 1] = "GreenUp";
|
|
32
|
+
/** If true, override the mapping mode with constant LOD mapping for the normal map. */
|
|
33
|
+
NormalMapFlags[NormalMapFlags["UseConstantLod"] = 2] = "UseConstantLod";
|
|
32
34
|
})(NormalMapFlags || (NormalMapFlags = {}));
|
|
33
35
|
//# sourceMappingURL=MaterialProps.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MaterialProps.js","sourceRoot":"","sources":["../../src/MaterialProps.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAqBH;;;GAGG;AACH,MAAM,CAAN,IAAY,eAOX;AAPD,WAAY,eAAe;IACzB,wCAAwC;IACxC,6DAAY,CAAA;IACZ,yDAAU,CAAA;IACV,mEAAe,CAAA;IACf,qDAAQ,CAAA;IACR,yDAAU,CAAA;AACZ,CAAC,EAPW,eAAe,KAAf,eAAe,QAO1B;
|
|
1
|
+
{"version":3,"file":"MaterialProps.js","sourceRoot":"","sources":["../../src/MaterialProps.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAqBH;;;GAGG;AACH,MAAM,CAAN,IAAY,eAOX;AAPD,WAAY,eAAe;IACzB,wCAAwC;IACxC,6DAAY,CAAA;IACZ,yDAAU,CAAA;IACV,mEAAe,CAAA;IACf,qDAAQ,CAAA;IACR,yDAAU,CAAA;AACZ,CAAC,EAPW,eAAe,KAAf,eAAe,QAO1B;AAwCD;;GAEG;AACH,MAAM,CAAN,IAAY,cASX;AATD,WAAY,cAAc;IACxB,wBAAwB;IACxB,mDAAQ,CAAA;IACR;;OAEG;IACH,yDAAgB,CAAA;IAChB,uFAAuF;IACvF,uEAAuB,CAAA;AACzB,CAAC,EATW,cAAc,KAAd,cAAc,QASzB","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 { DefinitionElementProps } from \"./ElementProps\";\r\nimport { TextureMapping } from \"./TextureMapping\";\r\n\r\n/** Describes a color as an array of three numbers ranging from 0 to 1 where the first entry corresponds to the color's red component,\r\n * the second to green, and the third to blue.\r\n * @see usage in [[RenderMaterialAssetProps]].\r\n * @public\r\n * @extensions\r\n */\r\nexport type RgbFactorProps = number[];\r\n\r\n/** A 2d point specified as an array of 2 numbers [x, y].\r\n * @see usage in [[TextureMapProps]].\r\n * @public\r\n * @extensions\r\n */\r\nexport type Point2dProps = number[];\r\n\r\n/** Describes the units in which a [[TextureMapProps]]' scale is expressed.\r\n * @public\r\n * @extensions\r\n */\r\nexport enum TextureMapUnits {\r\n /** Indicates the scale has no units. */\r\n Relative = 0,\r\n Meters = 3,\r\n Millimeters = 4,\r\n Feet = 5,\r\n Inches = 6,\r\n}\r\n\r\n/* eslint-disable @typescript-eslint/naming-convention */\r\n\r\n/** As part of a [[RenderMaterialAssetProps]], describes how to map a [[RenderTexture]]'s image to the triangles of a mesh to which the material is applied.\r\n * @see [[RenderMaterialAssetMapsProps]] for the supported types of texture mappings.\r\n * @public\r\n * @extensions\r\n */\r\nexport interface TextureMapProps {\r\n /** Angle in degrees to rotate texture when applying; defaults to 0.0 if undefined */\r\n pattern_angle?: number;\r\n /** If true, flip the pattern map in U; if undefined, defaults to false */\r\n pattern_u_flip?: boolean;\r\n /** If true, flip the pattern map in V; if undefined, defaults to false */\r\n pattern_flip?: boolean;\r\n /** X, Y scale to apply to the pattern map; if undefined, defaults to {0,0}, which is almost never useful. */\r\n pattern_scale?: Point2dProps;\r\n /** X, Y offset to apply to the pattern map; if undefined, defaults to {0,0} */\r\n pattern_offset?: Point2dProps;\r\n /** Units to use when applying the scaling; if undefined, defaults to [[TextureMapUnits.Relative]] */\r\n pattern_scalemode?: TextureMapUnits;\r\n /** Mapping mode to use for the texture application; if undefined, defaults to [[TextureMapping.Mode.Parametric]] */\r\n pattern_mapping?: TextureMapping.Mode;\r\n /** Weight at which to combine diffuse image and color; if undefined, defaults to 1.0 */\r\n pattern_weight?: number;\r\n /** If true, override the mapping mode with constant LOD mapping for the normal map, defaults to false. */\r\n pattern_useConstantLod?: boolean;\r\n /** The number of times the texture is repeated if pattern_useConstantLod is true. Increasing this will make the texture pattern appear smaller, decreasing it will make it larger. Defaults to 1.*/\r\n pattern_constantlod_repetitions?: number;\r\n /** An offset in world units used to shift the texture when pattern_useConstantLod is true. Defaults to (0, 0). */\r\n pattern_constantlod_offset?: Point2dProps;\r\n /** The minimum distance (from the eye to the surface) at which to clamp the texture size when pattern_useConstantLod is true. Defaults to 1. */\r\n pattern_constantlod_mindistanceclamp?: number;\r\n /** The maximum distance (from the eye to the surface) at which to clamp the texture size when pattern_useConstantLod is true. Defaults to 2^32. */\r\n pattern_constantlod_maxdistanceclamp?: number;\r\n /** The Id of the persistent [Texture]($backend) element defining the texture image. */\r\n TextureId: Id64String;\r\n}\r\n\r\n/** Flags applied to a [[NormalMapProps]]. The enum values can be combined using bitwise operators.\r\n * @public\r\n */\r\nexport enum NormalMapFlags {\r\n /** No special flags. */\r\n None = 0,\r\n /** Indicates that the Y component of each vector - stored in the texture's green channel - points upward along the positive Y axis and should\r\n * be negated. By default it points downward.\r\n */\r\n GreenUp = 1 << 0,\r\n /** If true, override the mapping mode with constant LOD mapping for the normal map. */\r\n UseConstantLod = 1 << 1,\r\n}\r\n\r\n/** Describes how to apply [normal mapping](https://en.wikipedia.org/wiki/Normal_mapping) to a surface material.\r\n * @see [[RenderMaterialAssetMapsProps.Normal]] to define a normal map for a [[RenderMaterialAssetProps]].\r\n * @public\r\n */\r\nexport interface NormalMapProps extends TextureMapProps {\r\n /** Flags controlling how the normal map is applied. Default: [[NormalMapFlags.None]]. */\r\n NormalFlags?: NormalMapFlags;\r\n}\r\n\r\n/** Describes different types of textures to be applied to a surface material to alter its appearance.\r\n * @note While technically both [[Pattern]] and [[Normal]] can define their own mapping parameters (`pattern_angle`, `pattern_mapping`, etc), in practice\r\n * if both maps are present they are expected to have identical mapping parameters, with the exception of `TextureId`.\r\n * @see [[RenderMaterialAssetProps.Map]] to define the texture maps for a material asset.\r\n * @public\r\n */\r\nexport interface RenderMaterialAssetMapsProps {\r\n /** Maps an image describing the diffuse color of the surface, replacing or mixing with the surface's own color. */\r\n Pattern?: TextureMapProps;\r\n /** Maps a [normal map](https://en.wikipedia.org/wiki/Normal_mapping) to the surface, simulating more complex surface details than are\r\n * present in the surface's geometry.\r\n */\r\n Normal?: NormalMapProps;\r\n}\r\n\r\n/** Describes the graphical properties of a [RenderMaterialElement]($backend) as part of a [[RenderMaterialProps]].\r\n * This representation is used to persist the material properties into the [IModelDb]($backend), but is unwieldy and verbose.\r\n * @see [RenderMaterialElementParams]($backend) for a somewhat more ergonomic representation.\r\n * @public\r\n * @extensions\r\n */\r\nexport interface RenderMaterialAssetProps {\r\n /** If true, this material has a fill/diffuse color; if undefined, defaults to false */\r\n HasBaseColor?: boolean;\r\n /** Surface color used for fill or diffuse illumination; if undefined, defaults to black */\r\n color?: RgbFactorProps;\r\n /** If true, this material has a specular color; if undefined, defaults to false */\r\n HasSpecularColor?: boolean;\r\n /** Surface color used for specular illumination; if undefined, defaults to black */\r\n specular_color?: RgbFactorProps;\r\n /** If true, this material has a specular exponent; if undefined, defaults to false */\r\n HasFinish?: boolean;\r\n /** Specular exponent (surface shininess); range is 0 to 128; if undefined, defaults to 13.5 */\r\n finish?: number;\r\n /** If true, this material has surface transparency; if undefined, defaults to false */\r\n HasTransmit?: boolean;\r\n /** Surface transparency; if undefined, defaults to 0.0 */\r\n transmit?: number;\r\n /** If true, this material has a value for diffuse reflectivity; if undefined, defaults to false */\r\n HasDiffuse?: boolean;\r\n /** Surface diffuse reflectivity; if undefined, defaults to 0.6 */\r\n diffuse?: number;\r\n /** If true, this material has a value for specular reflectivity; if undefined, defaults to false. If false, specular value is actually set to 0.0 */\r\n HasSpecular?: boolean;\r\n /** Surface specular reflectivity; if undefined, defaults to 0.4 */\r\n specular?: number;\r\n /** If true, this material has a value for environmental reflectivity; if undefined, defaults to false */\r\n HasReflect?: boolean;\r\n /** Surface environmental reflectivity; stored as fraction of specular in V8 material settings; if undefined defaults to 0.0 */\r\n reflect?: number;\r\n /** If true, this material has a surface reflectance color; if undefined, defaults to false. If false, reflectance color is actually set to specular color */\r\n HasReflectColor?: boolean;\r\n /** Surface reflectance color; if undefined, defaults to black */\r\n reflect_color?: RgbFactorProps;\r\n /** A scale by which to multiply the components of the normals read from [[Map.Normal]], if a normal map is defined.\r\n * Default: 1.0\r\n */\r\n pbr_normal?: number;\r\n /** An optional set of texture maps associated with this material. */\r\n Map?: RenderMaterialAssetMapsProps;\r\n}\r\n\r\n/** Properties that define a [RenderMaterialElement]($backend).\r\n * @see [[RenderMaterial]] for the representation used by the display system.\r\n * @public\r\n * @extensions\r\n */\r\nexport interface RenderMaterialProps extends DefinitionElementProps {\r\n /** The name of a palette that can be used to categorize multiple materials. */\r\n paletteName: string;\r\n /** An optional description of the material. */\r\n description?: string;\r\n jsonProperties?: {\r\n /** A container for various \"assets\" describing aspects of the material. */\r\n materialAssets?: {\r\n /** Properties of the material describing how it is displayed. */\r\n renderMaterial?: RenderMaterialAssetProps;\r\n };\r\n };\r\n}\r\n"]}
|
|
@@ -117,7 +117,7 @@ export declare namespace TextureMapping {
|
|
|
117
117
|
/** True if want to use constant LOD texture mapping for the surface texture. */
|
|
118
118
|
useConstantLod?: boolean;
|
|
119
119
|
/** Parameters for constantLod mapping mode. */
|
|
120
|
-
|
|
120
|
+
constantLodProps?: ConstantLodParamProps;
|
|
121
121
|
}
|
|
122
122
|
/** Parameters describing how a [[RenderTexture]]'s image is mapped to a surface. */
|
|
123
123
|
class Params {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextureMapping.d.ts","sourceRoot":"","sources":["../../src/TextureMapping.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,sBAAsB,EAAY,OAAO,EAAW,eAAe,EAAE,SAAS,EAAY,KAAK,EAAE,MAAM,sBAAsB,CAAC;AACvI,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,oHAAoH;IACpH,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,mGAAmG;IACnG,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mFAAmF;IACnF,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED;;GAEG;AACH,qBAAa,cAAc;IACzB,gLAAgL;IAChL,SAAgB,OAAO,EAAE,aAAa,CAAC;IACvC;;OAEG;IACI,eAAe,CAAC,EAAE,eAAe,CAAC;IACzC,4EAA4E;IAC5E,SAAgB,MAAM,EAAE,cAAc,CAAC,MAAM,CAAC;gBAE3B,EAAE,EAAE,aAAa,EAAE,MAAM,EAAE,cAAc,CAAC,MAAM;IAKnE,gBAAgB;IACT,eAAe,CAAC,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,SAAS,GAAG,OAAO,EAAE,GAAG,SAAS;CAGtG;AAED,cAAc;AACd,yBAAiB,cAAc,CAAC;IAC9B,qDAAqD;IACrD,KAAY,IAAI;QACd,IAAI,KAAK;QAC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CAAC,QAAQ,CAAC;QAC9C;;WAEG;QACI,MAAM,EAAE,MAAM,CAAC;QACtB,uDAAuD;QAChD,IAAI,EAAE,cAAc,CAAC,IAAI,CAAC;QACjC,gBAAgB;QACT,YAAY,EAAE,OAAO,CAAC;QAC7B,gFAAgF;QACzE,cAAc,EAAE,OAAO,CAAC;QAC/B,+CAA+C;QACxC,iBAAiB,EAAE,iBAAiB,CAAC;oBAEzB,KAAK,CAAC,EAAE,cAAc,CAAC,UAAU;QAcpD;;;WAGG;QACI,eAAe,CAAC,OAAO,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,SAAS,GAAG,OAAO,EAAE,GAAG,SAAS;QAwB5G,yEAAyE;QACzE,OAAO,CAAC,yBAAyB;QAiBjC,sHAAsH;QACtH,OAAO,CAAC,qBAAqB;QA+C7B,+HAA+H;QAC/H,OAAO,CAAC,6BAA6B;KActC;CACF"}
|
|
@@ -73,10 +73,10 @@ export class TextureMapping {
|
|
|
73
73
|
this.worldMapping = props?.worldMapping ?? false;
|
|
74
74
|
this.useConstantLod = props?.useConstantLod ?? false;
|
|
75
75
|
this.constantLodParams = {
|
|
76
|
-
repetitions: props?.
|
|
77
|
-
offset: props?.
|
|
78
|
-
minDistClamp: props?.
|
|
79
|
-
maxDistClamp: props?.
|
|
76
|
+
repetitions: props?.constantLodProps?.repetitions ?? 1,
|
|
77
|
+
offset: props?.constantLodProps?.offset ?? { x: 0, y: 0 },
|
|
78
|
+
minDistClamp: props?.constantLodProps?.minDistClamp ?? 1,
|
|
79
|
+
maxDistClamp: props?.constantLodProps?.maxDistClamp ?? 4096 * 1024 * 1024,
|
|
80
80
|
};
|
|
81
81
|
}
|
|
82
82
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextureMapping.js","sourceRoot":"","sources":["../../src/TextureMapping.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAA0B,QAAQ,EAAE,OAAO,EAAE,OAAO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AAiB,KAAK,SAAS;oBACjC,iBAAiB,CAAC,eAAe,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;gBAElD,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;gBACvC,WAAW,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;aACnD;YACD,OAAO,MAAM,CAAC;QAChB,CAAC;KACF;IA3IY,qBAAM,SA2IlB,CAAA;AACH,CAAC,EA5OgB,cAAc,KAAd,cAAc,QA4O9B;AAED,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC","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 { IndexedPolyfaceVisitor, Matrix3d, Point2d, Point3d, PolyfaceVisitor, Transform, Vector3d, XAndY } from \"@itwin/core-geometry\";\r\nimport { RenderTexture } from \"./RenderTexture\";\r\n\r\n/** Defines normal map parameters.\r\n * @beta\r\n */\r\nexport interface NormalMapParams {\r\n /** The texture to use as a normal map. If not present then the pattern map texture will be used as a normal map. */\r\n normalMap?: RenderTexture;\r\n /** True if the Y component stored in the green channel should be negated. By default, positive Y points downward, but some\r\n * normal maps are created with positive Y pointing upward.\r\n */\r\n greenUp?: boolean;\r\n /** Scale factor by which to multiply the components of the normal extracted from [[normalMap]]. */\r\n scale?: number;\r\n /** True if want to use constant LOD texture mapping for the normal map texture. */\r\n useConstantLod?: boolean;\r\n}\r\n\r\n/** Describes how to map a [[RenderTexture]]'s image onto a surface as part of a [[RenderMaterial]].\r\n * @public\r\n */\r\nexport class TextureMapping {\r\n /** The texture to be mapped to the surface. If normalMapParams is present but does not contain a normal map, then texture is used as a normal map rather than a pattern map. */\r\n public readonly texture: RenderTexture;\r\n /** The parameters for normal mapping.\r\n * @beta\r\n */\r\n public normalMapParams?: NormalMapParams;\r\n /** The parameters describing how the textures are mapped to the surface. */\r\n public readonly params: TextureMapping.Params;\r\n\r\n public constructor(tx: RenderTexture, params: TextureMapping.Params) {\r\n this.texture = tx;\r\n this.params = params;\r\n }\r\n\r\n /** @internal */\r\n public computeUVParams(visitor: PolyfaceVisitor, transformToImodel: Transform): Point2d[] | undefined {\r\n return this.params.computeUVParams(visitor as IndexedPolyfaceVisitor, transformToImodel);\r\n }\r\n}\r\n\r\n/** @public */\r\nexport namespace TextureMapping { // eslint-disable-line no-redeclare\r\n /** Enumerates the possible texture mapping modes. */\r\n export enum Mode {\r\n None = -1,\r\n Parametric = 0,\r\n ElevationDrape = 1,\r\n Planar = 2,\r\n /** @internal */\r\n DirectionalDrape = 3,\r\n /** @internal */\r\n Cubic = 4,\r\n /** @internal */\r\n Spherical = 5,\r\n /** @internal */\r\n Cylindrical = 6,\r\n /** @internal */\r\n Solid = 7,\r\n /** @internal Only valid for lights */\r\n FrontProject = 8,\r\n }\r\n\r\n /** A 2x3 matrix for mapping a texture image to a surface. */\r\n export class Trans2x3 {\r\n /** The 3x4 transform produced from the 2x3 matrix. */\r\n public readonly transform: Transform;\r\n\r\n /** Construct from the two rows of the matrix:\r\n * ```\r\n * | m00 m01 originX |\r\n * | m10 m11 originY |\r\n * ```\r\n * Producing the [Transform]($core-geometry):\r\n * ```\r\n * | m00 m01 0 originX |\r\n * | m10 m11 0 originY |\r\n * | 0 0 1 0 |\r\n * ```\r\n */\r\n public constructor(m00 = 1, m01 = 0, originX = 0, m10 = 0, m11 = 1, originY = 0) {\r\n const origin = new Point3d(originX, originY, 0);\r\n const matrix = Matrix3d.createRowValues(m00, m01, 0, m10, m11, 0, 0, 0, 1);\r\n this.transform = Transform.createRefs(origin, matrix);\r\n }\r\n\r\n /** An immutable 2x3 identity matrix. */\r\n public static readonly identity = new Trans2x3();\r\n }\r\n\r\n /** Properties used to construct a [[TextureMapping.ConstantLodParams]]. */\r\n export interface ConstantLodParamProps {\r\n /** The number of times the texture is repeated. Increasing this will make the texture pattern appear smaller, decreasing it will make it larger. Defaults to 1. */\r\n repetitions?: number;\r\n /** An offset in world units used to shift the texture. Defaults to (0, 0). */\r\n offset?: XAndY;\r\n /** The minimum distance (from the eye to the surface) at which to clamp the texture. Defaults to 1.*/\r\n minDistClamp?: number;\r\n /** The maximum distance (from the eye to the surface) at which to clamp the texture. Defaults to 2^32. */\r\n maxDistClamp?: number;\r\n }\r\n\r\n /** Parameters to define constant level of detail mapping mode, a mode of texture coordinate generation which dynamically creates\r\n * texture cooprdinates so that the level of detail of the texture in the rendered image remains somewhat constant. */\r\n export interface ConstantLodParams {\r\n /** The number of times the texture is repeated. Increasing this will make the texture pattern appear smaller, decreasing it will make it larger. */\r\n repetitions: number;\r\n /** An offset in world units used to shift the texture. */\r\n offset: XAndY;\r\n /** The minimum distance (from the eye to the surface) at which to clamp the texture. */\r\n minDistClamp: number;\r\n /** The maximum distance (from the eye to the surface) at which to clamp the texture. */\r\n maxDistClamp: number;\r\n }\r\n\r\n /** Properties used to construct a [[TextureMapping.Params]]. */\r\n export interface ParamProps {\r\n /** The matrix used to map the image to a surface. */\r\n textureMat2x3?: TextureMapping.Trans2x3;\r\n /** The ratio in [0, 1] with which to mix the color sampled from the texture with the surface's color.\r\n * A value of 0.0 uses only the surface color. A value of 1.0 uses only the texture color. A value of 0.5 uses an even mix of both.\r\n * @note This affects only the red, green, and blue components of the color. The alpha sampled from the texture is always multiplied by the surface color's alpha.\r\n * @note Defaults to 1.0\r\n */\r\n textureWeight?: number;\r\n /** The mode by which to map the image to a surface.\r\n * @note Defaults to [[TextureMapping.Mode.Parametric]].\r\n */\r\n mapMode?: TextureMapping.Mode;\r\n /** @internal */\r\n worldMapping?: boolean;\r\n /** True if want to use constant LOD texture mapping for the surface texture. */\r\n useConstantLod?: boolean;\r\n /** Parameters for constantLod mapping mode. */\r\n constantLodParams?: ConstantLodParamProps;\r\n }\r\n\r\n /** Parameters describing how a [[RenderTexture]]'s image is mapped to a surface. */\r\n export class Params {\r\n /** The matrix used to map the image to a surface. */\r\n public textureMatrix: TextureMapping.Trans2x3;\r\n /** The ratio in [0, 1] with which to mix the color sampled from the texture with the element's color.\r\n * A value of 0.0 uses only the element color. A value of 1.0 uses only the texture color.\r\n */\r\n public weight: number;\r\n /** The mode by which to map the image to a surface. */\r\n public mode: TextureMapping.Mode;\r\n /** @internal */\r\n public worldMapping: boolean;\r\n /** True if want to use constant LOD texture mapping for the surface texture. */\r\n public useConstantLod: boolean;\r\n /** Parameters for constantLod mapping mode. */\r\n public constantLodParams: ConstantLodParams;\r\n\r\n public constructor(props?: TextureMapping.ParamProps) {\r\n this.textureMatrix = props?.textureMat2x3 ?? Trans2x3.identity;\r\n this.weight = props?.textureWeight ?? 1;\r\n this.mode = props?.mapMode ?? Mode.Parametric;\r\n this.worldMapping = props?.worldMapping ?? false;\r\n this.useConstantLod = props?.useConstantLod ?? false;\r\n this.constantLodParams = {\r\n repetitions: props?.constantLodParams?.repetitions ?? 1,\r\n offset: props?.constantLodParams?.offset ?? { x: 0, y: 0 },\r\n minDistClamp: props?.constantLodParams?.minDistClamp ?? 1,\r\n maxDistClamp: props?.constantLodParams?.maxDistClamp ?? 4096 * 1024 * 1024,\r\n };\r\n }\r\n\r\n /**\r\n * Generates UV parameters for textured surfaces. Returns undefined on failure.\r\n * @internal\r\n */\r\n public computeUVParams(visitor: IndexedPolyfaceVisitor, transformToImodel: Transform): Point2d[] | undefined {\r\n switch (this.mode) {\r\n default: // Fall through to parametric in default case\r\n case TextureMapping.Mode.Parametric: {\r\n return this.computeParametricUVParams(visitor, this.textureMatrix.transform, !this.worldMapping);\r\n }\r\n case TextureMapping.Mode.Planar: {\r\n const normalIndices = visitor.normalIndex;\r\n if (!normalIndices)\r\n return undefined;\r\n\r\n // Ignore planar mode unless master or sub units for scaleMode and facet is planar\r\n if (!this.worldMapping || (visitor.normalIndex !== undefined && (normalIndices[0] !== normalIndices[1] || normalIndices[0] !== normalIndices[2]))) {\r\n return this.computeParametricUVParams(visitor, this.textureMatrix.transform, !this.worldMapping);\r\n } else {\r\n return this.computePlanarUVParams(visitor, this.textureMatrix.transform);\r\n }\r\n }\r\n case TextureMapping.Mode.ElevationDrape: {\r\n return this.computeElevationDrapeUVParams(visitor, this.textureMatrix.transform, transformToImodel);\r\n }\r\n }\r\n }\r\n\r\n /** Computes UV parameters given a texture mapping mode of parametric. */\r\n private computeParametricUVParams(visitor: IndexedPolyfaceVisitor, uvTransform: Transform, isRelativeUnits: boolean): Point2d[] {\r\n const params: Point2d[] = [];\r\n for (let i = 0; i < visitor.numEdgesThisFacet; i++) {\r\n let param = Point2d.create();\r\n\r\n if (isRelativeUnits || !visitor.tryGetDistanceParameter(i, param)) {\r\n if (!visitor.tryGetNormalizedParameter(i, param)) {\r\n // If mesh does not have facetFaceData, we still want to use the texture coordinates if they are present\r\n param = visitor.getParam(i)!;\r\n }\r\n }\r\n\r\n params.push(uvTransform.multiplyPoint2d(param));\r\n }\r\n return params;\r\n }\r\n\r\n /** Computes UV parameters given a texture mapping mode of planar. The result is stored in the Point2d array given. */\r\n private computePlanarUVParams(visitor: IndexedPolyfaceVisitor, uvTransform: Transform): Point2d[] | undefined {\r\n const params: Point2d[] = [];\r\n const points = visitor.point;\r\n let normal: Vector3d;\r\n\r\n if (visitor.normal === undefined)\r\n normal = points.getPoint3dAtUncheckedPointIndex(0).crossProductToPoints(points.getPoint3dAtUncheckedPointIndex(1), points.getPoint3dAtUncheckedPointIndex(2));\r\n else\r\n normal = visitor.normal.getVector3dAtCheckedVectorIndex(0)!;\r\n\r\n if (!normal.normalize(normal))\r\n return undefined;\r\n\r\n // adjust U texture coordinate to be a continuous length starting at the\r\n // origin. V coordinate stays the same. This mode assumes Z is up vector\r\n\r\n // Flipping normal puts us in a planar coordinate system consistent with MicroStation's display system\r\n normal.scale(-1.0, normal);\r\n\r\n // pick the first vertex normal\r\n const sideVector = Vector3d.create(normal.y, -normal.x, 0.0);\r\n\r\n // if the magnitude of the normal is near zero, the real normal points\r\n // almost straighten up.. In this case, use Y as the up vector to match QV\r\n\r\n const magnitude = sideVector.magnitude();\r\n sideVector.normalize(sideVector); // won't remain undefined if failed due to following check..\r\n\r\n if (magnitude < 1e-3) {\r\n normal.set(0, 0, -1);\r\n sideVector.set(1, 0, 0);\r\n }\r\n\r\n const upVector = sideVector.crossProduct(normal).normalize();\r\n if (!upVector)\r\n return undefined;\r\n\r\n const numEdges = visitor.numEdgesThisFacet;\r\n for (let i = 0; i < numEdges; i++) {\r\n const vector = Vector3d.createFrom(points.getPoint3dAtUncheckedPointIndex(i));\r\n\r\n params.push(Point2d.create(vector.dotProduct(sideVector), vector.dotProduct(upVector)));\r\n uvTransform.multiplyPoint2d(params[i], params[i]);\r\n }\r\n return params;\r\n }\r\n\r\n /** Computes UV parameters given a texture mapping mode of elevation drape. The result is stored in the Point2d array given. */\r\n private computeElevationDrapeUVParams(visitor: IndexedPolyfaceVisitor, uvTransform: Transform, transformToIModel?: Transform): Point2d[] {\r\n const params: Point2d[] = [];\r\n const numEdges = visitor.numEdgesThisFacet;\r\n for (let i = 0; i < numEdges; i++) {\r\n const point = visitor.point.getPoint3dAtUncheckedPointIndex(i);\r\n\r\n if (transformToIModel !== undefined)\r\n transformToIModel.multiplyPoint3d(point, point);\r\n\r\n params.push(Point2d.createFrom(point));\r\n uvTransform.multiplyPoint2d(params[i], params[i]);\r\n }\r\n return params;\r\n }\r\n }\r\n}\r\n\r\nObject.freeze(TextureMapping.Trans2x3.identity);\r\n"]}
|
|
1
|
+
{"version":3,"file":"TextureMapping.js","sourceRoot":"","sources":["../../src/TextureMapping.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAA0B,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAmB,SAAS,EAAE,QAAQ,EAAS,MAAM,s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Ae,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;gBAElD,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;gBACvC,WAAW,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;aACnD;YACD,OAAO,MAAM,CAAC;QAChB,CAAC;KACF;IA3IY,qBAAM,SA2IlB,CAAA;AACH,CAAC,EA5OgB,cAAc,KAAd,cAAc,QA4O9B;AAED,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC","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 { IndexedPolyfaceVisitor, Matrix3d, Point2d, Point3d, PolyfaceVisitor, Transform, Vector3d, XAndY } from \"@itwin/core-geometry\";\r\nimport { RenderTexture } from \"./RenderTexture\";\r\n\r\n/** Defines normal map parameters.\r\n * @beta\r\n */\r\nexport interface NormalMapParams {\r\n /** The texture to use as a normal map. If not present then the pattern map texture will be used as a normal map. */\r\n normalMap?: RenderTexture;\r\n /** True if the Y component stored in the green channel should be negated. By default, positive Y points downward, but some\r\n * normal maps are created with positive Y pointing upward.\r\n */\r\n greenUp?: boolean;\r\n /** Scale factor by which to multiply the components of the normal extracted from [[normalMap]]. */\r\n scale?: number;\r\n /** True if want to use constant LOD texture mapping for the normal map texture. */\r\n useConstantLod?: boolean;\r\n}\r\n\r\n/** Describes how to map a [[RenderTexture]]'s image onto a surface as part of a [[RenderMaterial]].\r\n * @public\r\n */\r\nexport class TextureMapping {\r\n /** The texture to be mapped to the surface. If normalMapParams is present but does not contain a normal map, then texture is used as a normal map rather than a pattern map. */\r\n public readonly texture: RenderTexture;\r\n /** The parameters for normal mapping.\r\n * @beta\r\n */\r\n public normalMapParams?: NormalMapParams;\r\n /** The parameters describing how the textures are mapped to the surface. */\r\n public readonly params: TextureMapping.Params;\r\n\r\n public constructor(tx: RenderTexture, params: TextureMapping.Params) {\r\n this.texture = tx;\r\n this.params = params;\r\n }\r\n\r\n /** @internal */\r\n public computeUVParams(visitor: PolyfaceVisitor, transformToImodel: Transform): Point2d[] | undefined {\r\n return this.params.computeUVParams(visitor as IndexedPolyfaceVisitor, transformToImodel);\r\n }\r\n}\r\n\r\n/** @public */\r\nexport namespace TextureMapping { // eslint-disable-line no-redeclare\r\n /** Enumerates the possible texture mapping modes. */\r\n export enum Mode {\r\n None = -1,\r\n Parametric = 0,\r\n ElevationDrape = 1,\r\n Planar = 2,\r\n /** @internal */\r\n DirectionalDrape = 3,\r\n /** @internal */\r\n Cubic = 4,\r\n /** @internal */\r\n Spherical = 5,\r\n /** @internal */\r\n Cylindrical = 6,\r\n /** @internal */\r\n Solid = 7,\r\n /** @internal Only valid for lights */\r\n FrontProject = 8,\r\n }\r\n\r\n /** A 2x3 matrix for mapping a texture image to a surface. */\r\n export class Trans2x3 {\r\n /** The 3x4 transform produced from the 2x3 matrix. */\r\n public readonly transform: Transform;\r\n\r\n /** Construct from the two rows of the matrix:\r\n * ```\r\n * | m00 m01 originX |\r\n * | m10 m11 originY |\r\n * ```\r\n * Producing the [Transform]($core-geometry):\r\n * ```\r\n * | m00 m01 0 originX |\r\n * | m10 m11 0 originY |\r\n * | 0 0 1 0 |\r\n * ```\r\n */\r\n public constructor(m00 = 1, m01 = 0, originX = 0, m10 = 0, m11 = 1, originY = 0) {\r\n const origin = new Point3d(originX, originY, 0);\r\n const matrix = Matrix3d.createRowValues(m00, m01, 0, m10, m11, 0, 0, 0, 1);\r\n this.transform = Transform.createRefs(origin, matrix);\r\n }\r\n\r\n /** An immutable 2x3 identity matrix. */\r\n public static readonly identity = new Trans2x3();\r\n }\r\n\r\n /** Properties used to construct a [[TextureMapping.ConstantLodParams]]. */\r\n export interface ConstantLodParamProps {\r\n /** The number of times the texture is repeated. Increasing this will make the texture pattern appear smaller, decreasing it will make it larger. Defaults to 1. */\r\n repetitions?: number;\r\n /** An offset in world units used to shift the texture. Defaults to (0, 0). */\r\n offset?: XAndY;\r\n /** The minimum distance (from the eye to the surface) at which to clamp the texture. Defaults to 1.*/\r\n minDistClamp?: number;\r\n /** The maximum distance (from the eye to the surface) at which to clamp the texture. Defaults to 2^32. */\r\n maxDistClamp?: number;\r\n }\r\n\r\n /** Parameters to define constant level of detail mapping mode, a mode of texture coordinate generation which dynamically creates\r\n * texture cooprdinates so that the level of detail of the texture in the rendered image remains somewhat constant. */\r\n export interface ConstantLodParams {\r\n /** The number of times the texture is repeated. Increasing this will make the texture pattern appear smaller, decreasing it will make it larger. */\r\n repetitions: number;\r\n /** An offset in world units used to shift the texture. */\r\n offset: XAndY;\r\n /** The minimum distance (from the eye to the surface) at which to clamp the texture. */\r\n minDistClamp: number;\r\n /** The maximum distance (from the eye to the surface) at which to clamp the texture. */\r\n maxDistClamp: number;\r\n }\r\n\r\n /** Properties used to construct a [[TextureMapping.Params]]. */\r\n export interface ParamProps {\r\n /** The matrix used to map the image to a surface. */\r\n textureMat2x3?: TextureMapping.Trans2x3;\r\n /** The ratio in [0, 1] with which to mix the color sampled from the texture with the surface's color.\r\n * A value of 0.0 uses only the surface color. A value of 1.0 uses only the texture color. A value of 0.5 uses an even mix of both.\r\n * @note This affects only the red, green, and blue components of the color. The alpha sampled from the texture is always multiplied by the surface color's alpha.\r\n * @note Defaults to 1.0\r\n */\r\n textureWeight?: number;\r\n /** The mode by which to map the image to a surface.\r\n * @note Defaults to [[TextureMapping.Mode.Parametric]].\r\n */\r\n mapMode?: TextureMapping.Mode;\r\n /** @internal */\r\n worldMapping?: boolean;\r\n /** True if want to use constant LOD texture mapping for the surface texture. */\r\n useConstantLod?: boolean;\r\n /** Parameters for constantLod mapping mode. */\r\n constantLodProps?: ConstantLodParamProps;\r\n }\r\n\r\n /** Parameters describing how a [[RenderTexture]]'s image is mapped to a surface. */\r\n export class Params {\r\n /** The matrix used to map the image to a surface. */\r\n public textureMatrix: TextureMapping.Trans2x3;\r\n /** The ratio in [0, 1] with which to mix the color sampled from the texture with the element's color.\r\n * A value of 0.0 uses only the element color. A value of 1.0 uses only the texture color.\r\n */\r\n public weight: number;\r\n /** The mode by which to map the image to a surface. */\r\n public mode: TextureMapping.Mode;\r\n /** @internal */\r\n public worldMapping: boolean;\r\n /** True if want to use constant LOD texture mapping for the surface texture. */\r\n public useConstantLod: boolean;\r\n /** Parameters for constantLod mapping mode. */\r\n public constantLodParams: ConstantLodParams;\r\n\r\n public constructor(props?: TextureMapping.ParamProps) {\r\n this.textureMatrix = props?.textureMat2x3 ?? Trans2x3.identity;\r\n this.weight = props?.textureWeight ?? 1;\r\n this.mode = props?.mapMode ?? Mode.Parametric;\r\n this.worldMapping = props?.worldMapping ?? false;\r\n this.useConstantLod = props?.useConstantLod ?? false;\r\n this.constantLodParams = {\r\n repetitions: props?.constantLodProps?.repetitions ?? 1,\r\n offset: props?.constantLodProps?.offset ?? { x: 0, y: 0 },\r\n minDistClamp: props?.constantLodProps?.minDistClamp ?? 1,\r\n maxDistClamp: props?.constantLodProps?.maxDistClamp ?? 4096 * 1024 * 1024,\r\n };\r\n }\r\n\r\n /**\r\n * Generates UV parameters for textured surfaces. Returns undefined on failure.\r\n * @internal\r\n */\r\n public computeUVParams(visitor: IndexedPolyfaceVisitor, transformToImodel: Transform): Point2d[] | undefined {\r\n switch (this.mode) {\r\n default: // Fall through to parametric in default case\r\n case TextureMapping.Mode.Parametric: {\r\n return this.computeParametricUVParams(visitor, this.textureMatrix.transform, !this.worldMapping);\r\n }\r\n case TextureMapping.Mode.Planar: {\r\n const normalIndices = visitor.normalIndex;\r\n if (!normalIndices)\r\n return undefined;\r\n\r\n // Ignore planar mode unless master or sub units for scaleMode and facet is planar\r\n if (!this.worldMapping || (visitor.normalIndex !== undefined && (normalIndices[0] !== normalIndices[1] || normalIndices[0] !== normalIndices[2]))) {\r\n return this.computeParametricUVParams(visitor, this.textureMatrix.transform, !this.worldMapping);\r\n } else {\r\n return this.computePlanarUVParams(visitor, this.textureMatrix.transform);\r\n }\r\n }\r\n case TextureMapping.Mode.ElevationDrape: {\r\n return this.computeElevationDrapeUVParams(visitor, this.textureMatrix.transform, transformToImodel);\r\n }\r\n }\r\n }\r\n\r\n /** Computes UV parameters given a texture mapping mode of parametric. */\r\n private computeParametricUVParams(visitor: IndexedPolyfaceVisitor, uvTransform: Transform, isRelativeUnits: boolean): Point2d[] {\r\n const params: Point2d[] = [];\r\n for (let i = 0; i < visitor.numEdgesThisFacet; i++) {\r\n let param = Point2d.create();\r\n\r\n if (isRelativeUnits || !visitor.tryGetDistanceParameter(i, param)) {\r\n if (!visitor.tryGetNormalizedParameter(i, param)) {\r\n // If mesh does not have facetFaceData, we still want to use the texture coordinates if they are present\r\n param = visitor.getParam(i)!;\r\n }\r\n }\r\n\r\n params.push(uvTransform.multiplyPoint2d(param));\r\n }\r\n return params;\r\n }\r\n\r\n /** Computes UV parameters given a texture mapping mode of planar. The result is stored in the Point2d array given. */\r\n private computePlanarUVParams(visitor: IndexedPolyfaceVisitor, uvTransform: Transform): Point2d[] | undefined {\r\n const params: Point2d[] = [];\r\n const points = visitor.point;\r\n let normal: Vector3d;\r\n\r\n if (visitor.normal === undefined)\r\n normal = points.getPoint3dAtUncheckedPointIndex(0).crossProductToPoints(points.getPoint3dAtUncheckedPointIndex(1), points.getPoint3dAtUncheckedPointIndex(2));\r\n else\r\n normal = visitor.normal.getVector3dAtCheckedVectorIndex(0)!;\r\n\r\n if (!normal.normalize(normal))\r\n return undefined;\r\n\r\n // adjust U texture coordinate to be a continuous length starting at the\r\n // origin. V coordinate stays the same. This mode assumes Z is up vector\r\n\r\n // Flipping normal puts us in a planar coordinate system consistent with MicroStation's display system\r\n normal.scale(-1.0, normal);\r\n\r\n // pick the first vertex normal\r\n const sideVector = Vector3d.create(normal.y, -normal.x, 0.0);\r\n\r\n // if the magnitude of the normal is near zero, the real normal points\r\n // almost straighten up.. In this case, use Y as the up vector to match QV\r\n\r\n const magnitude = sideVector.magnitude();\r\n sideVector.normalize(sideVector); // won't remain undefined if failed due to following check..\r\n\r\n if (magnitude < 1e-3) {\r\n normal.set(0, 0, -1);\r\n sideVector.set(1, 0, 0);\r\n }\r\n\r\n const upVector = sideVector.crossProduct(normal).normalize();\r\n if (!upVector)\r\n return undefined;\r\n\r\n const numEdges = visitor.numEdgesThisFacet;\r\n for (let i = 0; i < numEdges; i++) {\r\n const vector = Vector3d.createFrom(points.getPoint3dAtUncheckedPointIndex(i));\r\n\r\n params.push(Point2d.create(vector.dotProduct(sideVector), vector.dotProduct(upVector)));\r\n uvTransform.multiplyPoint2d(params[i], params[i]);\r\n }\r\n return params;\r\n }\r\n\r\n /** Computes UV parameters given a texture mapping mode of elevation drape. The result is stored in the Point2d array given. */\r\n private computeElevationDrapeUVParams(visitor: IndexedPolyfaceVisitor, uvTransform: Transform, transformToIModel?: Transform): Point2d[] {\r\n const params: Point2d[] = [];\r\n const numEdges = visitor.numEdgesThisFacet;\r\n for (let i = 0; i < numEdges; i++) {\r\n const point = visitor.point.getPoint3dAtUncheckedPointIndex(i);\r\n\r\n if (transformToIModel !== undefined)\r\n transformToIModel.multiplyPoint3d(point, point);\r\n\r\n params.push(Point2d.createFrom(point));\r\n uvTransform.multiplyPoint2d(params[i], params[i]);\r\n }\r\n return params;\r\n }\r\n }\r\n}\r\n\r\nObject.freeze(TextureMapping.Trans2x3.identity);\r\n"]}
|
|
@@ -27,13 +27,13 @@ export declare enum CurrentImdlVersion {
|
|
|
27
27
|
* front-end is not capable of reading the tile content. Otherwise, this front-end can read the tile content even if the header specifies a
|
|
28
28
|
* greater minor version than CurrentVersion.Minor, although some data may be skipped.
|
|
29
29
|
*/
|
|
30
|
-
Major =
|
|
30
|
+
Major = 31,
|
|
31
31
|
/** The unsigned 16-bit minor version number. If the major version in the tile header is equal to CurrentVersion.Major, then this package can
|
|
32
32
|
* read the tile content even if the minor version in the tile header is greater than this value, although some data may be skipped.
|
|
33
33
|
*/
|
|
34
34
|
Minor = 0,
|
|
35
35
|
/** The unsigned 32-bit version number derived from the 16-bit major and minor version numbers. */
|
|
36
|
-
Combined =
|
|
36
|
+
Combined = 2031616
|
|
37
37
|
}
|
|
38
38
|
/** Header embedded at the beginning of binary tile data in iMdl format describing its contents.
|
|
39
39
|
* @internal
|
|
@@ -33,13 +33,13 @@ export var CurrentImdlVersion;
|
|
|
33
33
|
* front-end is not capable of reading the tile content. Otherwise, this front-end can read the tile content even if the header specifies a
|
|
34
34
|
* greater minor version than CurrentVersion.Minor, although some data may be skipped.
|
|
35
35
|
*/
|
|
36
|
-
CurrentImdlVersion[CurrentImdlVersion["Major"] =
|
|
36
|
+
CurrentImdlVersion[CurrentImdlVersion["Major"] = 31] = "Major";
|
|
37
37
|
/** The unsigned 16-bit minor version number. If the major version in the tile header is equal to CurrentVersion.Major, then this package can
|
|
38
38
|
* read the tile content even if the minor version in the tile header is greater than this value, although some data may be skipped.
|
|
39
39
|
*/
|
|
40
40
|
CurrentImdlVersion[CurrentImdlVersion["Minor"] = 0] = "Minor";
|
|
41
41
|
/** The unsigned 32-bit version number derived from the 16-bit major and minor version numbers. */
|
|
42
|
-
CurrentImdlVersion[CurrentImdlVersion["Combined"] =
|
|
42
|
+
CurrentImdlVersion[CurrentImdlVersion["Combined"] = 2031616] = "Combined";
|
|
43
43
|
})(CurrentImdlVersion || (CurrentImdlVersion = {}));
|
|
44
44
|
/** Header embedded at the beginning of binary tile data in iMdl format describing its contents.
|
|
45
45
|
* @internal
|