@itwin/core-common 5.0.0-dev.40 → 5.0.0-dev.49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. package/CHANGELOG.md +11 -1
  2. package/lib/cjs/AnalysisStyle.d.ts +0 -3
  3. package/lib/cjs/AnalysisStyle.d.ts.map +1 -1
  4. package/lib/cjs/AnalysisStyle.js +0 -3
  5. package/lib/cjs/AnalysisStyle.js.map +1 -1
  6. package/lib/cjs/FeatureSymbology.d.ts +25 -46
  7. package/lib/cjs/FeatureSymbology.d.ts.map +1 -1
  8. package/lib/cjs/FeatureSymbology.js +14 -29
  9. package/lib/cjs/FeatureSymbology.js.map +1 -1
  10. package/lib/cjs/FeatureTable.d.ts +6 -108
  11. package/lib/cjs/FeatureTable.d.ts.map +1 -1
  12. package/lib/cjs/FeatureTable.js +8 -329
  13. package/lib/cjs/FeatureTable.js.map +1 -1
  14. package/lib/cjs/Gradient.d.ts +3 -4
  15. package/lib/cjs/Gradient.d.ts.map +1 -1
  16. package/lib/cjs/Gradient.js +3 -4
  17. package/lib/cjs/Gradient.js.map +1 -1
  18. package/lib/cjs/HiddenLine.d.ts +17 -18
  19. package/lib/cjs/HiddenLine.d.ts.map +1 -1
  20. package/lib/cjs/HiddenLine.js +0 -1
  21. package/lib/cjs/HiddenLine.js.map +1 -1
  22. package/lib/cjs/Image.d.ts +7 -8
  23. package/lib/cjs/Image.d.ts.map +1 -1
  24. package/lib/cjs/Image.js +3 -4
  25. package/lib/cjs/Image.js.map +1 -1
  26. package/lib/cjs/PlanProjectionSettings.d.ts +1 -2
  27. package/lib/cjs/PlanProjectionSettings.d.ts.map +1 -1
  28. package/lib/cjs/PlanProjectionSettings.js +0 -1
  29. package/lib/cjs/PlanProjectionSettings.js.map +1 -1
  30. package/lib/cjs/PlanarClipMask.d.ts +0 -12
  31. package/lib/cjs/PlanarClipMask.d.ts.map +1 -1
  32. package/lib/cjs/PlanarClipMask.js.map +1 -1
  33. package/lib/cjs/QPoint.d.ts +5 -5
  34. package/lib/cjs/QPoint.d.ts.map +1 -1
  35. package/lib/cjs/QPoint.js +5 -5
  36. package/lib/cjs/QPoint.js.map +1 -1
  37. package/lib/cjs/RenderPolyline.d.ts +36 -0
  38. package/lib/cjs/RenderPolyline.d.ts.map +1 -0
  39. package/lib/cjs/RenderPolyline.js +26 -0
  40. package/lib/cjs/RenderPolyline.js.map +1 -0
  41. package/lib/cjs/RenderTexture.d.ts +4 -2
  42. package/lib/cjs/RenderTexture.d.ts.map +1 -1
  43. package/lib/cjs/RenderTexture.js +8 -0
  44. package/lib/cjs/RenderTexture.js.map +1 -1
  45. package/lib/cjs/TextureMapping.d.ts +17 -14
  46. package/lib/cjs/TextureMapping.d.ts.map +1 -1
  47. package/lib/cjs/TextureMapping.js +22 -17
  48. package/lib/cjs/TextureMapping.js.map +1 -1
  49. package/lib/cjs/ViewFlags.d.ts +1 -3
  50. package/lib/cjs/ViewFlags.d.ts.map +1 -1
  51. package/lib/cjs/ViewFlags.js +1 -3
  52. package/lib/cjs/ViewFlags.js.map +1 -1
  53. package/lib/cjs/core-common.d.ts +1 -1
  54. package/lib/cjs/core-common.d.ts.map +1 -1
  55. package/lib/cjs/core-common.js +1 -1
  56. package/lib/cjs/core-common.js.map +1 -1
  57. package/lib/cjs/internal/PackedFeatureTable.d.ts +111 -0
  58. package/lib/cjs/internal/PackedFeatureTable.d.ts.map +1 -0
  59. package/lib/cjs/internal/PackedFeatureTable.js +349 -0
  60. package/lib/cjs/internal/PackedFeatureTable.js.map +1 -0
  61. package/lib/cjs/internal/RenderMesh.d.ts +52 -0
  62. package/lib/cjs/internal/RenderMesh.d.ts.map +1 -0
  63. package/lib/cjs/{Render.js → internal/RenderMesh.js} +3 -25
  64. package/lib/cjs/internal/RenderMesh.js.map +1 -0
  65. package/lib/cjs/internal/cross-package.d.ts +2 -0
  66. package/lib/cjs/internal/cross-package.d.ts.map +1 -1
  67. package/lib/cjs/internal/cross-package.js +12 -0
  68. package/lib/cjs/internal/cross-package.js.map +1 -1
  69. package/lib/cjs/rpc/core/RpcRequest.d.ts +1 -1
  70. package/lib/cjs/rpc/core/RpcRequest.d.ts.map +1 -1
  71. package/lib/cjs/rpc/core/RpcRequest.js +4 -4
  72. package/lib/cjs/rpc/core/RpcRequest.js.map +1 -1
  73. package/lib/esm/AnalysisStyle.d.ts +0 -3
  74. package/lib/esm/AnalysisStyle.d.ts.map +1 -1
  75. package/lib/esm/AnalysisStyle.js +0 -3
  76. package/lib/esm/AnalysisStyle.js.map +1 -1
  77. package/lib/esm/FeatureSymbology.d.ts +25 -46
  78. package/lib/esm/FeatureSymbology.d.ts.map +1 -1
  79. package/lib/esm/FeatureSymbology.js +14 -29
  80. package/lib/esm/FeatureSymbology.js.map +1 -1
  81. package/lib/esm/FeatureTable.d.ts +6 -108
  82. package/lib/esm/FeatureTable.d.ts.map +1 -1
  83. package/lib/esm/FeatureTable.js +6 -324
  84. package/lib/esm/FeatureTable.js.map +1 -1
  85. package/lib/esm/Gradient.d.ts +3 -4
  86. package/lib/esm/Gradient.d.ts.map +1 -1
  87. package/lib/esm/Gradient.js +3 -4
  88. package/lib/esm/Gradient.js.map +1 -1
  89. package/lib/esm/HiddenLine.d.ts +17 -18
  90. package/lib/esm/HiddenLine.d.ts.map +1 -1
  91. package/lib/esm/HiddenLine.js +0 -1
  92. package/lib/esm/HiddenLine.js.map +1 -1
  93. package/lib/esm/Image.d.ts +7 -8
  94. package/lib/esm/Image.d.ts.map +1 -1
  95. package/lib/esm/Image.js +3 -4
  96. package/lib/esm/Image.js.map +1 -1
  97. package/lib/esm/PlanProjectionSettings.d.ts +1 -2
  98. package/lib/esm/PlanProjectionSettings.d.ts.map +1 -1
  99. package/lib/esm/PlanProjectionSettings.js +0 -1
  100. package/lib/esm/PlanProjectionSettings.js.map +1 -1
  101. package/lib/esm/PlanarClipMask.d.ts +0 -12
  102. package/lib/esm/PlanarClipMask.d.ts.map +1 -1
  103. package/lib/esm/PlanarClipMask.js.map +1 -1
  104. package/lib/esm/QPoint.d.ts +5 -5
  105. package/lib/esm/QPoint.d.ts.map +1 -1
  106. package/lib/esm/QPoint.js +5 -5
  107. package/lib/esm/QPoint.js.map +1 -1
  108. package/lib/esm/RenderPolyline.d.ts +36 -0
  109. package/lib/esm/RenderPolyline.d.ts.map +1 -0
  110. package/lib/esm/RenderPolyline.js +23 -0
  111. package/lib/esm/RenderPolyline.js.map +1 -0
  112. package/lib/esm/RenderTexture.d.ts +4 -2
  113. package/lib/esm/RenderTexture.d.ts.map +1 -1
  114. package/lib/esm/RenderTexture.js +8 -0
  115. package/lib/esm/RenderTexture.js.map +1 -1
  116. package/lib/esm/TextureMapping.d.ts +17 -14
  117. package/lib/esm/TextureMapping.d.ts.map +1 -1
  118. package/lib/esm/TextureMapping.js +22 -17
  119. package/lib/esm/TextureMapping.js.map +1 -1
  120. package/lib/esm/ViewFlags.d.ts +1 -3
  121. package/lib/esm/ViewFlags.d.ts.map +1 -1
  122. package/lib/esm/ViewFlags.js +1 -3
  123. package/lib/esm/ViewFlags.js.map +1 -1
  124. package/lib/esm/core-common.d.ts +1 -1
  125. package/lib/esm/core-common.d.ts.map +1 -1
  126. package/lib/esm/core-common.js +1 -1
  127. package/lib/esm/core-common.js.map +1 -1
  128. package/lib/esm/internal/PackedFeatureTable.d.ts +111 -0
  129. package/lib/esm/internal/PackedFeatureTable.d.ts.map +1 -0
  130. package/lib/esm/internal/PackedFeatureTable.js +342 -0
  131. package/lib/esm/internal/PackedFeatureTable.js.map +1 -0
  132. package/lib/esm/internal/RenderMesh.d.ts +52 -0
  133. package/lib/esm/internal/RenderMesh.d.ts.map +1 -0
  134. package/lib/esm/{Render.js → internal/RenderMesh.js} +2 -23
  135. package/lib/esm/internal/RenderMesh.js.map +1 -0
  136. package/lib/esm/internal/cross-package.d.ts +2 -0
  137. package/lib/esm/internal/cross-package.d.ts.map +1 -1
  138. package/lib/esm/internal/cross-package.js +2 -1
  139. package/lib/esm/internal/cross-package.js.map +1 -1
  140. package/lib/esm/rpc/core/RpcRequest.d.ts +1 -1
  141. package/lib/esm/rpc/core/RpcRequest.d.ts.map +1 -1
  142. package/lib/esm/rpc/core/RpcRequest.js +4 -4
  143. package/lib/esm/rpc/core/RpcRequest.js.map +1 -1
  144. package/package.json +7 -7
  145. package/lib/cjs/Render.d.ts +0 -85
  146. package/lib/cjs/Render.d.ts.map +0 -1
  147. package/lib/cjs/Render.js.map +0 -1
  148. package/lib/esm/Render.d.ts +0 -85
  149. package/lib/esm/Render.d.ts.map +0 -1
  150. package/lib/esm/Render.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RenderPolyline.js","sourceRoot":"","sources":["../../src/RenderPolyline.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,qBAAqB;AAErB;;GAEG;AACH,IAAY,iBASX;AATD,WAAY,iBAAiB;IAC3B,2DAA2D;IAC3D,6DAAU,CAAA;IACV,8DAA8D;IAC9D,yDAAa,CAAA;IACb;;OAEG;IACH,+DAAgB,CAAA;AAClB,CAAC,EATW,iBAAiB,iCAAjB,iBAAiB,QAS5B","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Rendering\n */\n\n// cSpell:ignore vals\n\n/** Describes the semantics of a [PolylineArgs]($frontend).\n * @public\n */\nexport enum PolylineTypeFlags {\n /** Just an ordinary polyline with no special semantics. */\n Normal = 0,\n /** A polyline used to define the edges of a planar region. */\n Edge = 1 << 0,\n /** Like [[Edge]], but the edges are only displayed in [[RenderMode.Wireframe]] when the surface's fill is not displayed.\n * [[FillFlags]] controls whether the fill is displayed.\n */\n Outline = 1 << 1,\n}\n\n/** Flags describing a [PolylineArgs]($frontend).\n * @public\n */\nexport interface PolylineFlags {\n /** If `true`, the polylines are to be drawn as individual disconnected point strings instead of as connected line strings. */\n isDisjoint?: boolean;\n /** If `true`, the polylines' positions are all coplanar. */\n isPlanar?: boolean;\n /** If `true`, the polylines' positions all have the same z coordinate. */\n is2d?: boolean;\n /** Default: Normal. */\n type?: PolylineTypeFlags;\n}\n\n/** Describes the vertex indices of a single line within a [PolylineArgs]($frontend).\n * The indices represent either a line string as a connected series of points, or a point string as a set of disconnected points, depending\n * on the [[PolylineFlags.isDisjoint]] value of [PolylineArgs.flags]($frontend).\n * @public\n */\nexport type PolylineIndices = number[];\n"]}
@@ -1,7 +1,7 @@
1
1
  /** @packageDocumentation
2
2
  * @module Rendering
3
3
  */
4
- import { Id64String, IDisposable } from "@itwin/core-bentley";
4
+ import { Id64String } from "@itwin/core-bentley";
5
5
  /** Identifies an image to be used to produce a [[RenderTexture]] for a given purpose - for example,
6
6
  * as part of a [[SkyBox]]. If the string is a valid `Id64String`, it refers to a persistent [Texture]($backend) element stored in an iModel.
7
7
  * Otherwise, it is interpreted as a Url resolving to an HTMLImageElement.
@@ -15,7 +15,7 @@ export type TextureImageSpec = Id64String | string;
15
15
  * @see [RenderSystem.createTextureFromElement]($frontend) to obtain a texture from a [Texture]($backend) element.
16
16
  * @public
17
17
  */
18
- export declare abstract class RenderTexture implements IDisposable {
18
+ export declare abstract class RenderTexture implements Disposable {
19
19
  /** Indicates the type of texture. */
20
20
  readonly type: RenderTexture.Type;
21
21
  /** Used for ordered comparisons, e.g. in DisplayParams.compareForMerge */
@@ -30,6 +30,8 @@ export declare abstract class RenderTexture implements IDisposable {
30
30
  * the caller is responsible for invoking this method when it is finished using the texture; otherwise, the [RenderSystem]($frontend) will handle
31
31
  * its disposal.
32
32
  */
33
+ [Symbol.dispose](): void;
34
+ /** @deprecated in 5.0 Will be made protected in a future release. Use [Symbol.dispose] instead. */
33
35
  abstract dispose(): void;
34
36
  /** An [OrderedComparator]($bentley) that compares this texture against `other`. */
35
37
  compare(other: RenderTexture): number;
@@ -1 +1 @@
1
- {"version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G;QACH,SAAgB,GAAG,CAAC,EAAE,MAAM,CAAC;QAC7B,qCAAqC;QACrC,SAAgB,IAAI,EAAE,aAAa,CAAC,IAAI,CAAC;QACzC;;WAEG;QACH,SAAgB,OAAO,EAAE,OAAO,CAAC;oBAEd,GAAG,CAAC,EAAE,MAAM,EAAE,IAAI,GAAE,aAAa,CAAC,IAAgC,EAAE,OAAO,GAAE,OAAe;QAM/G,IAAW,aAAa,IAAI,OAAO,CAAyD;QAC5F,IAAW,OAAO,IAAI,OAAO,CAAmD;QAChF,IAAW,QAAQ,IAAI,OAAO,CAAoD;KACnF;CACF"}
@@ -23,6 +23,14 @@ class RenderTexture {
23
23
  this.type = type;
24
24
  this._guid = core_bentley_1.Guid.createValue();
25
25
  }
26
+ /** Releases any WebGL resources owned by this texture.
27
+ * For a texture created by a [RenderSystem]($frontend) for which [CreateTextureArgs.ownership]($frontend) was specified as "external",
28
+ * the caller is responsible for invoking this method when it is finished using the texture; otherwise, the [RenderSystem]($frontend) will handle
29
+ * its disposal.
30
+ */
31
+ [Symbol.dispose]() {
32
+ this.dispose(); // eslint-disable-line @typescript-eslint/no-deprecated
33
+ }
26
34
  /** An [OrderedComparator]($bentley) that compares this texture against `other`. */
27
35
  compare(other) {
28
36
  return (0, core_bentley_1.compareStrings)(this._guid, other._guid);
@@ -1 +1 @@
1
- {"version":3,"file":"RenderTexture.js","sourceRoot":"","sources":["../../src/RenderTexture.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAgG;AAUhG;;;;;GAKG;AACH,MAAsB,aAAa;IAMjC,IAAW,aAAa,KAAc,OAAO,aAAa,CAAC,IAAI,CAAC,WAAW,KAAK,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAC5F,IAAW,OAAO,KAAc,OAAO,aAAa,CAAC,IAAI,CAAC,KAAK,KAAK,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAChF,IAAW,QAAQ,KAAc,OAAO,aAAa,CAA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C,IAAI,CAAC,CAAC,CAAC;KACnF;IArBY,oBAAM,SAqBlB,CAAA;AACH,CAAC,EA3CgB,aAAa,6BAAb,aAAa,QA2C7B","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Rendering\n */\n\nimport { compareStrings, Guid, GuidString, Id64String, IDisposable } from \"@itwin/core-bentley\";\n\n/** Identifies an image to be used to produce a [[RenderTexture]] for a given purpose - for example,\n * as part of a [[SkyBox]]. If the string is a valid `Id64String`, it refers to a persistent [Texture]($backend) element stored in an iModel.\n * Otherwise, it is interpreted as a Url resolving to an HTMLImageElement.\n * @see [[SkySphereImageProps.texture]] and [[SkyCubeImageProps]].\n * @public\n */\nexport type TextureImageSpec = Id64String | string;\n\n/** Represents a texture image applied to a surface during rendering.\n * A RenderTexture is typically - but not always - associated with a [[RenderMaterial]].\n * @see [RenderSystem.createTextureFromImage]($frontend) to obtain a texture from an HTML image.\n * @see [RenderSystem.createTextureFromElement]($frontend) to obtain a texture from a [Texture]($backend) element.\n * @public\n */\nexport abstract class RenderTexture implements IDisposable {\n /** Indicates the type of texture. */\n public readonly type: RenderTexture.Type;\n /** Used for ordered comparisons, e.g. in DisplayParams.compareForMerge */\n private readonly _guid: GuidString;\n\n public get isTileSection(): boolean { return RenderTexture.Type.TileSection === this.type; }\n public get isGlyph(): boolean { return RenderTexture.Type.Glyph === this.type; }\n public get isSkyBox(): boolean { return RenderTexture.Type.SkyBox === this.type; }\n public abstract get bytesUsed(): number;\n\n protected constructor(type: RenderTexture.Type) {\n this.type = type;\n this._guid = Guid.createValue();\n }\n\n /** Releases any WebGL resources owned by this texture.\n * For a texture created by a [RenderSystem]($frontend) for which [CreateTextureArgs.ownership]($frontend) was specified as \"external\",\n * the caller is responsible for invoking this method when it is finished using the texture; otherwise, the [RenderSystem]($frontend) will handle\n * its disposal.\n */\n public abstract dispose(): void;\n\n /** An [OrderedComparator]($bentley) that compares this texture against `other`. */\n public compare(other: RenderTexture): number {\n return compareStrings(this._guid, other._guid);\n }\n}\n\n/** @public */\nexport namespace RenderTexture {\n /** The types of [[RenderTexture]]s that can be created by a [RenderSystem]($frontend). */\n export enum Type {\n /** An image applied to a surface, with support for mip-mapping and repetition. */\n Normal,\n /** An image containing any number of text glyphs, used for efficiently rendering readable small text. */\n Glyph,\n /** A non-repeating image with no mip-maps, used for example for reality models. */\n TileSection,\n /** A three-dimensional texture used for rendering a skybox. */\n SkyBox,\n /** A non-repeating image with mip-maps and and anisotropic filtering, used for map tiles when draped on terrain. */\n FilteredTileSection,\n /** A gradient image used for thematic display. */\n ThematicGradient,\n }\n\n /** Parameters used to construct a [[RenderTexture]].\n * @deprecated in 3.x. use RenderSystem.createTexture and CreateTextureArgs.\n * @public\n */\n export class Params {\n /** A string uniquely identifying this texture within the context of an [[IModel]]. Typically this is the element Id of the corresponding [Texture]($backend) element.\n * Textures created on the front-end generally have no key.\n */\n public readonly key?: string;\n /** Indicates the type of texture. */\n public readonly type: RenderTexture.Type;\n /** Indicates that some object is managing the lifetime of this texture and will take care of calling its dispose function appropriately.\n * An unowned texture associated with a [RenderGraphic]($frontend) will be disposed when the RenderGraphic is disposed.\n */\n public readonly isOwned: boolean;\n\n public constructor(key?: string, type: RenderTexture.Type = RenderTexture.Type.Normal, isOwned: boolean = false) {\n this.key = key;\n this.type = type;\n this.isOwned = isOwned;\n }\n\n public get isTileSection(): boolean { return RenderTexture.Type.TileSection === this.type; }\n public get isGlyph(): boolean { return RenderTexture.Type.Glyph === this.type; }\n public get isSkyBox(): boolean { return RenderTexture.Type.SkyBox === this.type; }\n }\n}\n"]}
1
+ {"version":3,"file":"RenderTexture.js","sourceRoot":"","sources":["../../src/RenderTexture.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAmF;AAUnF;;;;;GAKG;AACH,MAAsB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I,CAAC,IAAI,GAAG,IAAI,CAAC;YACjB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACzB,CAAC;QAED,IAAW,aAAa,KAAc,OAAO,aAAa,CAAC,IAAI,CAAC,WAAW,KAAK,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAC5F,IAAW,OAAO,KAAc,OAAO,aAAa,CAAC,IAAI,CAAC,KAAK,KAAK,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAChF,IAAW,QAAQ,KAAc,OAAO,aAAa,CAAC,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;KACnF;IArBY,oBAAM,SAqBlB,CAAA;AACH,CAAC,EA3CgB,aAAa,6BAAb,aAAa,QA2C7B","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Rendering\n */\n\nimport { compareStrings, Guid, GuidString, Id64String } from \"@itwin/core-bentley\";\n\n/** Identifies an image to be used to produce a [[RenderTexture]] for a given purpose - for example,\n * as part of a [[SkyBox]]. If the string is a valid `Id64String`, it refers to a persistent [Texture]($backend) element stored in an iModel.\n * Otherwise, it is interpreted as a Url resolving to an HTMLImageElement.\n * @see [[SkySphereImageProps.texture]] and [[SkyCubeImageProps]].\n * @public\n */\nexport type TextureImageSpec = Id64String | string;\n\n/** Represents a texture image applied to a surface during rendering.\n * A RenderTexture is typically - but not always - associated with a [[RenderMaterial]].\n * @see [RenderSystem.createTextureFromImage]($frontend) to obtain a texture from an HTML image.\n * @see [RenderSystem.createTextureFromElement]($frontend) to obtain a texture from a [Texture]($backend) element.\n * @public\n */\nexport abstract class RenderTexture implements Disposable {\n /** Indicates the type of texture. */\n public readonly type: RenderTexture.Type;\n /** Used for ordered comparisons, e.g. in DisplayParams.compareForMerge */\n private readonly _guid: GuidString;\n\n public get isTileSection(): boolean { return RenderTexture.Type.TileSection === this.type; }\n public get isGlyph(): boolean { return RenderTexture.Type.Glyph === this.type; }\n public get isSkyBox(): boolean { return RenderTexture.Type.SkyBox === this.type; }\n public abstract get bytesUsed(): number;\n\n protected constructor(type: RenderTexture.Type) {\n this.type = type;\n this._guid = Guid.createValue();\n }\n\n /** Releases any WebGL resources owned by this texture.\n * For a texture created by a [RenderSystem]($frontend) for which [CreateTextureArgs.ownership]($frontend) was specified as \"external\",\n * the caller is responsible for invoking this method when it is finished using the texture; otherwise, the [RenderSystem]($frontend) will handle\n * its disposal.\n */\n public [Symbol.dispose]() {\n this.dispose(); // eslint-disable-line @typescript-eslint/no-deprecated\n }\n\n /** @deprecated in 5.0 Will be made protected in a future release. Use [Symbol.dispose] instead. */\n public abstract dispose(): void; // eslint-disable-line @typescript-eslint/no-deprecated\n\n /** An [OrderedComparator]($bentley) that compares this texture against `other`. */\n public compare(other: RenderTexture): number {\n return compareStrings(this._guid, other._guid);\n }\n}\n\n/** @public */\nexport namespace RenderTexture {\n /** The types of [[RenderTexture]]s that can be created by a [RenderSystem]($frontend). */\n export enum Type {\n /** An image applied to a surface, with support for mip-mapping and repetition. */\n Normal,\n /** An image containing any number of text glyphs, used for efficiently rendering readable small text. */\n Glyph,\n /** A non-repeating image with no mip-maps, used for example for reality models. */\n TileSection,\n /** A three-dimensional texture used for rendering a skybox. */\n SkyBox,\n /** A non-repeating image with mip-maps and and anisotropic filtering, used for map tiles when draped on terrain. */\n FilteredTileSection,\n /** A gradient image used for thematic display. */\n ThematicGradient,\n }\n\n /** Parameters used to construct a [[RenderTexture]].\n * @deprecated in 3.x. use RenderSystem.createTexture and CreateTextureArgs.\n * @public\n */\n export class Params {\n /** A string uniquely identifying this texture within the context of an [[IModel]]. Typically this is the element Id of the corresponding [Texture]($backend) element.\n * Textures created on the front-end generally have no key.\n */\n public readonly key?: string;\n /** Indicates the type of texture. */\n public readonly type: RenderTexture.Type;\n /** Indicates that some object is managing the lifetime of this texture and will take care of calling its dispose function appropriately.\n * An unowned texture associated with a [RenderGraphic]($frontend) will be disposed when the RenderGraphic is disposed.\n */\n public readonly isOwned: boolean;\n\n public constructor(key?: string, type: RenderTexture.Type = RenderTexture.Type.Normal, isOwned: boolean = false) {\n this.key = key;\n this.type = type;\n this.isOwned = isOwned;\n }\n\n public get isTileSection(): boolean { return RenderTexture.Type.TileSection === this.type; }\n public get isGlyph(): boolean { return RenderTexture.Type.Glyph === this.type; }\n public get isSkyBox(): boolean { return RenderTexture.Type.SkyBox === this.type; }\n }\n}\n"]}
@@ -31,8 +31,12 @@ export declare class TextureMapping {
31
31
  /** The parameters describing how the textures are mapped to the surface. */
32
32
  readonly params: TextureMapping.Params;
33
33
  constructor(tx: RenderTexture, params: TextureMapping.Params);
34
- /** @internal */
35
- computeUVParams(visitor: PolyfaceVisitor, transformToImodel: Transform): Point2d[] | undefined;
34
+ /** Compute texture coordinates for a polyface.
35
+ * @param visitor The polyface for which to compute UV coordinates based on this texture mapping.
36
+ * @param localToWorld The polyface's local-to-world transform, used for [[TextureMapping.Mode.ElevationDrape]].
37
+ * @returns the texture coordinates, or undefined if computation failed.
38
+ */
39
+ computeUVParams(visitor: PolyfaceVisitor, localToWorld?: Transform): Point2d[] | undefined;
36
40
  /** An [OrderedComparator]($bentley) that compares this mapping against `other`. */
37
41
  compare(other: TextureMapping): number;
38
42
  }
@@ -44,17 +48,17 @@ export declare namespace TextureMapping {
44
48
  Parametric = 0,
45
49
  ElevationDrape = 1,
46
50
  Planar = 2,
47
- /** @internal */
51
+ /** Currently unsupported. */
48
52
  DirectionalDrape = 3,
49
- /** @internal */
53
+ /** Currently unsupported. */
50
54
  Cubic = 4,
51
- /** @internal */
55
+ /** Currently unsupported. */
52
56
  Spherical = 5,
53
- /** @internal */
57
+ /** Currently unsupported. */
54
58
  Cylindrical = 6,
55
- /** @internal */
59
+ /** Currently unsupported. */
56
60
  Solid = 7,
57
- /** @internal Only valid for lights */
61
+ /** Currently unsupported. */
58
62
  FrontProject = 8
59
63
  }
60
64
  /** A 2x3 matrix for mapping a texture image to a surface. */
@@ -116,7 +120,6 @@ export declare namespace TextureMapping {
116
120
  * @note Defaults to [[TextureMapping.Mode.Parametric]].
117
121
  */
118
122
  mapMode?: TextureMapping.Mode;
119
- /** @internal */
120
123
  worldMapping?: boolean;
121
124
  /** True if want to use constant LOD texture mapping for the surface texture. */
122
125
  useConstantLod?: boolean;
@@ -133,7 +136,6 @@ export declare namespace TextureMapping {
133
136
  weight: number;
134
137
  /** The mode by which to map the image to a surface. */
135
138
  mode: TextureMapping.Mode;
136
- /** @internal */
137
139
  worldMapping: boolean;
138
140
  /** True if want to use constant LOD texture mapping for the surface texture. */
139
141
  useConstantLod: boolean;
@@ -142,11 +144,12 @@ export declare namespace TextureMapping {
142
144
  constructor(props?: TextureMapping.ParamProps);
143
145
  /** An [OrderedComparator]($bentley) that compares these Params against `other`. */
144
146
  compare(other: Params): number;
145
- /**
146
- * Generates UV parameters for textured surfaces. Returns undefined on failure.
147
- * @internal
147
+ /** Compute texture coordinates for a polyface.
148
+ * @param visitor The polyface for which to compute UV coordinates based on this texture mapping.
149
+ * @param localToWorld The polyface's local-to-world transform, used for [[TextureMapping.Mode.ElevationDrape]].
150
+ * @returns the texture coordinates, or undefined if computation failed.
148
151
  */
149
- computeUVParams(visitor: IndexedPolyfaceVisitor, transformToImodel: Transform): Point2d[] | undefined;
152
+ computeUVParams(visitor: IndexedPolyfaceVisitor, localToWorld?: Transform): Point2d[] | undefined;
150
153
  /** Computes UV parameters given a texture mapping mode of parametric. */
151
154
  private computeParametricUVParams;
152
155
  /** Computes UV parameters given a texture mapping mode of planar. The result is stored in the Point2d array given. */
@@ -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,MA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UVParams(visitor, transformToImodel) {
28
- return this.params.computeUVParams(visitor, transformToImodel);
26
+ /** Compute texture coordinates for a polyface.
27
+ * @param visitor The polyface for which to compute UV coordinates based on this texture mapping.
28
+ * @param localToWorld The polyface's local-to-world transform, used for [[TextureMapping.Mode.ElevationDrape]].
29
+ * @returns the texture coordinates, or undefined if computation failed.
30
+ */
31
+ computeUVParams(visitor, localToWorld = core_geometry_1.Transform.createIdentity()) {
32
+ return this.params.computeUVParams(visitor, localToWorld);
29
33
  }
30
34
  /** An [OrderedComparator]($bentley) that compares this mapping against `other`. */
31
35
  compare(other) {
@@ -46,17 +50,17 @@ exports.TextureMapping = TextureMapping;
46
50
  Mode[Mode["Parametric"] = 0] = "Parametric";
47
51
  Mode[Mode["ElevationDrape"] = 1] = "ElevationDrape";
48
52
  Mode[Mode["Planar"] = 2] = "Planar";
49
- /** @internal */
53
+ /** Currently unsupported. */
50
54
  Mode[Mode["DirectionalDrape"] = 3] = "DirectionalDrape";
51
- /** @internal */
55
+ /** Currently unsupported. */
52
56
  Mode[Mode["Cubic"] = 4] = "Cubic";
53
- /** @internal */
57
+ /** Currently unsupported. */
54
58
  Mode[Mode["Spherical"] = 5] = "Spherical";
55
- /** @internal */
59
+ /** Currently unsupported. */
56
60
  Mode[Mode["Cylindrical"] = 6] = "Cylindrical";
57
- /** @internal */
61
+ /** Currently unsupported. */
58
62
  Mode[Mode["Solid"] = 7] = "Solid";
59
- /** @internal Only valid for lights */
63
+ /** Currently unsupported. */
60
64
  Mode[Mode["FrontProject"] = 8] = "FrontProject";
61
65
  })(Mode = TextureMapping.Mode || (TextureMapping.Mode = {}));
62
66
  /** A 2x3 matrix for mapping a texture image to a surface. */
@@ -127,11 +131,12 @@ exports.TextureMapping = TextureMapping;
127
131
  || (0, core_bentley_1.compareBooleans)(this.useConstantLod, other.useConstantLod) || this.textureMatrix.compare(other.textureMatrix)
128
132
  || compareConstantLodParams(this.constantLodParams, other.constantLodParams);
129
133
  }
130
- /**
131
- * Generates UV parameters for textured surfaces. Returns undefined on failure.
132
- * @internal
134
+ /** Compute texture coordinates for a polyface.
135
+ * @param visitor The polyface for which to compute UV coordinates based on this texture mapping.
136
+ * @param localToWorld The polyface's local-to-world transform, used for [[TextureMapping.Mode.ElevationDrape]].
137
+ * @returns the texture coordinates, or undefined if computation failed.
133
138
  */
134
- computeUVParams(visitor, transformToImodel) {
139
+ computeUVParams(visitor, localToWorld = core_geometry_1.Transform.createIdentity()) {
135
140
  switch (this.mode) {
136
141
  default: // Fall through to parametric in default case
137
142
  case TextureMapping.Mode.Parametric: {
@@ -150,7 +155,7 @@ exports.TextureMapping = TextureMapping;
150
155
  }
151
156
  }
152
157
  case TextureMapping.Mode.ElevationDrape: {
153
- return this.computeElevationDrapeUVParams(visitor, this.textureMatrix.transform, transformToImodel);
158
+ return this.computeElevationDrapeUVParams(visitor, this.textureMatrix.transform, localToWorld);
154
159
  }
155
160
  }
156
161
  }
@@ -206,13 +211,13 @@ exports.TextureMapping = TextureMapping;
206
211
  return params;
207
212
  }
208
213
  /** Computes UV parameters given a texture mapping mode of elevation drape. The result is stored in the Point2d array given. */
209
- computeElevationDrapeUVParams(visitor, uvTransform, transformToIModel) {
214
+ computeElevationDrapeUVParams(visitor, uvTransform, localToWorld) {
210
215
  const params = [];
211
216
  const numEdges = visitor.numEdgesThisFacet;
212
217
  for (let i = 0; i < numEdges; i++) {
213
218
  const point = visitor.point.getPoint3dAtUncheckedPointIndex(i);
214
- if (transformToIModel !== undefined)
215
- transformToIModel.multiplyPoint3d(point, point);
219
+ if (localToWorld !== undefined)
220
+ localToWorld.multiplyPoint3d(point, point);
216
221
  params.push(core_geometry_1.Point2d.createFrom(point));
217
222
  uvTransform.multiplyPoint2d(params[i], params[i]);
218
223
  }
@@ -1 +1 @@
1
- {"version":3,"file":"TextureMapping.js","sourceRoot":"","sources":["../../src/TextureMapping.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,wDAAuI;AAEvI,s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AAe,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;YACpD,CAAC;YACD,OAAO,MAAM,CAAC;QAChB,CAAC;QAED,+HAA+H;QACvH,6BAA6B,CAAC,OAA+B,EAAE,WAAsB,EAAE,iBAA6B;YAC1H,MAAM,MAAM,GAAc,EAAE,CAAC;YAC7B,MAAM,QAAQ,GAAG,OAAO,CAAC,iBAAiB,CAAC;YAC3C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,EAAE,CAAC,EAAE,EAAE,CAAC;gBAClC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC,CAAC,CAAC;gBAE/D,IAAI,iBAAiB,KAAK,SAAS;oBACjC,iBAAiB,CAAC,eAAe,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;gBAElD,MAAM,CAAC,IAAI,CAAC,uBAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;gBACvC,WAAW,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;YACpD,CAAC;YACD,OAAO,MAAM,CAAC;QAChB,CAAC;KACF;IAtJY,qBAAM,SAsJlB,CAAA;AACH,CAAC,EAjRgB,cAAc,8BAAd,cAAc,QAiR9B;AAED,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Rendering\n */\n\nimport { IndexedPolyfaceVisitor, Matrix3d, Point2d, Point3d, PolyfaceVisitor, Transform, Vector3d, XAndY } from \"@itwin/core-geometry\";\nimport { RenderTexture } from \"./RenderTexture\";\nimport { compareBooleans, compareBooleansOrUndefined, compareNumbers, compareNumbersOrUndefined, comparePossiblyUndefined } from \"@itwin/core-bentley\";\n\n/** Defines normal map parameters.\n * @beta\n */\nexport interface NormalMapParams {\n /** The texture to use as a normal map. If not present then the pattern map texture will be used as a normal map. */\n normalMap?: RenderTexture;\n /** True if the Y component stored in the green channel should be negated. By default, positive Y points downward, but some\n * normal maps are created with positive Y pointing upward.\n */\n greenUp?: boolean;\n /** Scale factor by which to multiply the components of the normal extracted from [[normalMap]]. */\n scale?: number;\n /** True if want to use constant LOD texture mapping for the normal map texture. */\n useConstantLod?: boolean;\n}\n\nfunction compareNormalMapParams(lhs: NormalMapParams, rhs: NormalMapParams): number {\n return comparePossiblyUndefined((lh, rh) => lh.compare(rh), lhs.normalMap, rhs.normalMap)\n || compareBooleansOrUndefined(lhs.greenUp, rhs.greenUp) || compareNumbersOrUndefined(lhs.scale, rhs.scale)\n || compareBooleansOrUndefined(lhs.useConstantLod, rhs.useConstantLod);\n}\n\n/** Describes how to map a [[RenderTexture]]'s image onto a surface as part of a [[RenderMaterial]].\n * @public\n */\nexport class TextureMapping {\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. */\n public readonly texture: RenderTexture;\n /** The parameters for normal mapping.\n * @beta\n */\n public normalMapParams?: NormalMapParams;\n /** The parameters describing how the textures are mapped to the surface. */\n public readonly params: TextureMapping.Params;\n\n public constructor(tx: RenderTexture, params: TextureMapping.Params) {\n this.texture = tx;\n this.params = params;\n }\n\n /** @internal */\n public computeUVParams(visitor: PolyfaceVisitor, transformToImodel: Transform): Point2d[] | undefined {\n return this.params.computeUVParams(visitor as IndexedPolyfaceVisitor, transformToImodel);\n }\n\n /** An [OrderedComparator]($bentley) that compares this mapping against `other`. */\n public compare(other: TextureMapping): number {\n if (this === other) {\n return 0;\n }\n\n return this.texture.compare(other.texture) || this.params.compare(other.params)\n || comparePossiblyUndefined((lh, rh) => compareNormalMapParams(lh, rh), this.normalMapParams, other.normalMapParams);\n }\n}\n\n/** @public */\nexport namespace TextureMapping {\n /** Enumerates the possible texture mapping modes. */\n export enum Mode {\n None = -1,\n Parametric = 0,\n ElevationDrape = 1,\n Planar = 2,\n /** @internal */\n DirectionalDrape = 3,\n /** @internal */\n Cubic = 4,\n /** @internal */\n Spherical = 5,\n /** @internal */\n Cylindrical = 6,\n /** @internal */\n Solid = 7,\n /** @internal Only valid for lights */\n FrontProject = 8,\n }\n\n /** A 2x3 matrix for mapping a texture image to a surface. */\n export class Trans2x3 {\n /** The 3x4 transform produced from the 2x3 matrix. */\n public readonly transform: Transform;\n\n /** Construct from the two rows of the matrix:\n * ```\n * | m00 m01 originX |\n * | m10 m11 originY |\n * ```\n * Producing the [Transform]($core-geometry):\n * ```\n * | m00 m01 0 originX |\n * | m10 m11 0 originY |\n * | 0 0 1 0 |\n * ```\n */\n public constructor(m00 = 1, m01 = 0, originX = 0, m10 = 0, m11 = 1, originY = 0) {\n const origin = new Point3d(originX, originY, 0);\n const matrix = Matrix3d.createRowValues(m00, m01, 0, m10, m11, 0, 0, 0, 1);\n this.transform = Transform.createRefs(origin, matrix);\n }\n\n /** An immutable 2x3 identity matrix. */\n public static readonly identity = new Trans2x3();\n\n /** An [OrderedComparator]($bentley) that compares this Trans2x3 against `other`. */\n public compare(other: Trans2x3): number {\n if (this === other) {\n return 0;\n }\n\n const originDiff = compareNumbers(this.transform.origin.x, other.transform.origin.x) || compareNumbers(this.transform.origin.y, other.transform.origin.y);\n if (originDiff !== 0) {\n return originDiff;\n }\n\n for (const i of [0, 1, 3, 4]) {\n const matDiff = compareNumbers(this.transform.matrix.coffs[i], other.transform.matrix.coffs[i]);\n if (matDiff !== 0) {\n return matDiff;\n }\n }\n\n return 0;\n }\n }\n\n /** Properties used to construct a [[TextureMapping.ConstantLodParams]]. */\n export interface ConstantLodParamProps {\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. */\n repetitions?: number;\n /** An offset in world units used to shift the texture. Defaults to (0, 0). */\n offset?: XAndY;\n /** The minimum distance (from the eye to the surface) at which to clamp the texture. Defaults to 1.*/\n minDistClamp?: number;\n /** The maximum distance (from the eye to the surface) at which to clamp the texture. Defaults to 2^32. */\n maxDistClamp?: number;\n }\n\n /** Parameters to define constant level of detail mapping mode, a mode of texture coordinate generation which dynamically creates\n * texture cooprdinates so that the level of detail of the texture in the rendered image remains somewhat constant. */\n export interface ConstantLodParams {\n /** The number of times the texture is repeated. Increasing this will make the texture pattern appear smaller, decreasing it will make it larger. */\n repetitions: number;\n /** An offset in world units used to shift the texture. */\n offset: XAndY;\n /** The minimum distance (from the eye to the surface) at which to clamp the texture. */\n minDistClamp: number;\n /** The maximum distance (from the eye to the surface) at which to clamp the texture. */\n maxDistClamp: number;\n }\n\n function compareConstantLodParams(lhs: ConstantLodParams, rhs: ConstantLodParams): number {\n return compareNumbers(lhs.repetitions, rhs.repetitions) || compareNumbers(lhs.offset.x, rhs.offset.x) || compareNumbers(lhs.offset.y, rhs.offset.y)\n || compareNumbers(lhs.minDistClamp, rhs.minDistClamp) || compareNumbers(lhs.maxDistClamp, rhs.maxDistClamp);\n }\n\n /** Properties used to construct a [[TextureMapping.Params]]. */\n export interface ParamProps {\n /** The matrix used to map the image to a surface. */\n textureMat2x3?: TextureMapping.Trans2x3;\n /** The ratio in [0, 1] with which to mix the color sampled from the texture with the surface's color.\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.\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.\n * @note Defaults to 1.0\n */\n textureWeight?: number;\n /** The mode by which to map the image to a surface.\n * @note Defaults to [[TextureMapping.Mode.Parametric]].\n */\n mapMode?: TextureMapping.Mode;\n /** @internal */\n worldMapping?: boolean;\n /** True if want to use constant LOD texture mapping for the surface texture. */\n useConstantLod?: boolean;\n /** Parameters for constantLod mapping mode. */\n constantLodProps?: ConstantLodParamProps;\n }\n\n /** Parameters describing how a [[RenderTexture]]'s image is mapped to a surface. */\n export class Params {\n /** The matrix used to map the image to a surface. */\n public textureMatrix: TextureMapping.Trans2x3;\n /** The ratio in [0, 1] with which to mix the color sampled from the texture with the element's color.\n * A value of 0.0 uses only the element color. A value of 1.0 uses only the texture color.\n */\n public weight: number;\n /** The mode by which to map the image to a surface. */\n public mode: TextureMapping.Mode;\n /** @internal */\n public worldMapping: boolean;\n /** True if want to use constant LOD texture mapping for the surface texture. */\n public useConstantLod: boolean;\n /** Parameters for constantLod mapping mode. */\n public constantLodParams: ConstantLodParams;\n\n public constructor(props?: TextureMapping.ParamProps) {\n this.textureMatrix = props?.textureMat2x3 ?? Trans2x3.identity;\n this.weight = props?.textureWeight ?? 1;\n this.mode = props?.mapMode ?? Mode.Parametric;\n this.worldMapping = props?.worldMapping ?? false;\n this.useConstantLod = props?.useConstantLod ?? false;\n this.constantLodParams = {\n repetitions: props?.constantLodProps?.repetitions ?? 1,\n offset: props?.constantLodProps?.offset ?? { x: 0, y: 0 },\n minDistClamp: props?.constantLodProps?.minDistClamp ?? 1,\n maxDistClamp: props?.constantLodProps?.maxDistClamp ?? 4096 * 1024 * 1024,\n };\n }\n\n /** An [OrderedComparator]($bentley) that compares these Params against `other`. */\n public compare(other: Params): number {\n if (this === other) {\n return 0;\n }\n\n return compareNumbers(this.weight, other.weight) || compareNumbers(this.mode, other.mode) || compareBooleans(this.worldMapping, other.worldMapping)\n || compareBooleans(this.useConstantLod, other.useConstantLod) || this.textureMatrix.compare(other.textureMatrix)\n || compareConstantLodParams(this.constantLodParams, other.constantLodParams);\n }\n\n /**\n * Generates UV parameters for textured surfaces. Returns undefined on failure.\n * @internal\n */\n public computeUVParams(visitor: IndexedPolyfaceVisitor, transformToImodel: Transform): Point2d[] | undefined {\n switch (this.mode) {\n default: // Fall through to parametric in default case\n case TextureMapping.Mode.Parametric: {\n return this.computeParametricUVParams(visitor, this.textureMatrix.transform, !this.worldMapping);\n }\n case TextureMapping.Mode.Planar: {\n const normalIndices = visitor.normalIndex;\n if (!normalIndices)\n return undefined;\n\n // Ignore planar mode unless master or sub units for scaleMode and facet is planar\n if (!this.worldMapping || (visitor.normalIndex !== undefined && (normalIndices[0] !== normalIndices[1] || normalIndices[0] !== normalIndices[2]))) {\n return this.computeParametricUVParams(visitor, this.textureMatrix.transform, !this.worldMapping);\n } else {\n return this.computePlanarUVParams(visitor, this.textureMatrix.transform);\n }\n }\n case TextureMapping.Mode.ElevationDrape: {\n return this.computeElevationDrapeUVParams(visitor, this.textureMatrix.transform, transformToImodel);\n }\n }\n }\n\n /** Computes UV parameters given a texture mapping mode of parametric. */\n private computeParametricUVParams(visitor: IndexedPolyfaceVisitor, uvTransform: Transform, isRelativeUnits: boolean): Point2d[] {\n const params: Point2d[] = [];\n for (let i = 0; i < visitor.numEdgesThisFacet; i++) {\n let param = Point2d.create();\n\n if (isRelativeUnits || !visitor.tryGetDistanceParameter(i, param)) {\n if (!visitor.tryGetNormalizedParameter(i, param)) {\n // If mesh does not have facetFaceData, we still want to use the texture coordinates if they are present\n param = visitor.getParam(i)!;\n }\n }\n\n params.push(uvTransform.multiplyPoint2d(param));\n }\n return params;\n }\n\n /** Computes UV parameters given a texture mapping mode of planar. The result is stored in the Point2d array given. */\n private computePlanarUVParams(visitor: IndexedPolyfaceVisitor, uvTransform: Transform): Point2d[] | undefined {\n const params: Point2d[] = [];\n const points = visitor.point;\n let normal: Vector3d;\n\n if (visitor.normal === undefined)\n normal = points.getPoint3dAtUncheckedPointIndex(0).crossProductToPoints(points.getPoint3dAtUncheckedPointIndex(1), points.getPoint3dAtUncheckedPointIndex(2));\n else\n normal = visitor.normal.getVector3dAtCheckedVectorIndex(0)!;\n\n if (!normal.normalize(normal))\n return undefined;\n\n // adjust U texture coordinate to be a continuous length starting at the\n // origin. V coordinate stays the same. This mode assumes Z is up vector\n\n // Flipping normal puts us in a planar coordinate system consistent with MicroStation's display system\n normal.scale(-1.0, normal);\n\n // pick the first vertex normal\n const sideVector = Vector3d.create(normal.y, -normal.x, 0.0);\n\n // if the magnitude of the normal is near zero, the real normal points\n // almost straighten up.. In this case, use Y as the up vector to match QV\n\n const magnitude = sideVector.magnitude();\n sideVector.normalize(sideVector); // won't remain undefined if failed due to following check..\n\n if (magnitude < 1e-3) {\n normal.set(0, 0, -1);\n sideVector.set(1, 0, 0);\n }\n\n const upVector = sideVector.crossProduct(normal).normalize();\n if (!upVector)\n return undefined;\n\n const numEdges = visitor.numEdgesThisFacet;\n for (let i = 0; i < numEdges; i++) {\n const vector = Vector3d.createFrom(points.getPoint3dAtUncheckedPointIndex(i));\n\n params.push(Point2d.create(vector.dotProduct(sideVector), vector.dotProduct(upVector)));\n uvTransform.multiplyPoint2d(params[i], params[i]);\n }\n return params;\n }\n\n /** Computes UV parameters given a texture mapping mode of elevation drape. The result is stored in the Point2d array given. */\n private computeElevationDrapeUVParams(visitor: IndexedPolyfaceVisitor, uvTransform: Transform, transformToIModel?: Transform): Point2d[] {\n const params: Point2d[] = [];\n const numEdges = visitor.numEdgesThisFacet;\n for (let i = 0; i < numEdges; i++) {\n const point = visitor.point.getPoint3dAtUncheckedPointIndex(i);\n\n if (transformToIModel !== undefined)\n transformToIModel.multiplyPoint3d(point, point);\n\n params.push(Point2d.createFrom(point));\n uvTransform.multiplyPoint2d(params[i], params[i]);\n }\n return params;\n }\n }\n}\n\nObject.freeze(TextureMapping.Trans2x3.identity);\n"]}
1
+ {"version":3,"file":"TextureMapping.js","sourceRoot":"","sources":["../../src/TextureMapping.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,wDAAuI;AAEvI,sDAAuJ;AAkBvJ,SAAS,sBAAsB,CAAC,GAAoB,EAAE,GAAoB;IACxE,OAAO,IAAA,uCAAwB,EAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,SAAS,EAAE,GAAG,CAAC,SAAS,C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E,WAAsB,EAAE,YAAwB;YACrH,MAAM,MAAM,GAAc,EAAE,CAAC;YAC7B,MAAM,QAAQ,GAAG,OAAO,CAAC,iBAAiB,CAAC;YAC3C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,EAAE,CAAC,EAAE,EAAE,CAAC;gBAClC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC,CAAC,CAAC;gBAE/D,IAAI,YAAY,KAAK,SAAS;oBAC5B,YAAY,CAAC,eAAe,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;gBAE7C,MAAM,CAAC,IAAI,CAAC,uBAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;gBACvC,WAAW,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;YACpD,CAAC;YACD,OAAO,MAAM,CAAC;QAChB,CAAC;KACF;IAtJY,qBAAM,SAsJlB,CAAA;AACH,CAAC,EAhRgB,cAAc,8BAAd,cAAc,QAgR9B;AAED,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Rendering\n */\n\nimport { IndexedPolyfaceVisitor, Matrix3d, Point2d, Point3d, PolyfaceVisitor, Transform, Vector3d, XAndY } from \"@itwin/core-geometry\";\nimport { RenderTexture } from \"./RenderTexture\";\nimport { compareBooleans, compareBooleansOrUndefined, compareNumbers, compareNumbersOrUndefined, comparePossiblyUndefined } from \"@itwin/core-bentley\";\n\n/** Defines normal map parameters.\n * @beta\n */\nexport interface NormalMapParams {\n /** The texture to use as a normal map. If not present then the pattern map texture will be used as a normal map. */\n normalMap?: RenderTexture;\n /** True if the Y component stored in the green channel should be negated. By default, positive Y points downward, but some\n * normal maps are created with positive Y pointing upward.\n */\n greenUp?: boolean;\n /** Scale factor by which to multiply the components of the normal extracted from [[normalMap]]. */\n scale?: number;\n /** True if want to use constant LOD texture mapping for the normal map texture. */\n useConstantLod?: boolean;\n}\n\nfunction compareNormalMapParams(lhs: NormalMapParams, rhs: NormalMapParams): number {\n return comparePossiblyUndefined((lh, rh) => lh.compare(rh), lhs.normalMap, rhs.normalMap)\n || compareBooleansOrUndefined(lhs.greenUp, rhs.greenUp) || compareNumbersOrUndefined(lhs.scale, rhs.scale)\n || compareBooleansOrUndefined(lhs.useConstantLod, rhs.useConstantLod);\n}\n\n/** Describes how to map a [[RenderTexture]]'s image onto a surface as part of a [[RenderMaterial]].\n * @public\n */\nexport class TextureMapping {\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. */\n public readonly texture: RenderTexture;\n /** The parameters for normal mapping.\n * @beta\n */\n public normalMapParams?: NormalMapParams;\n /** The parameters describing how the textures are mapped to the surface. */\n public readonly params: TextureMapping.Params;\n\n public constructor(tx: RenderTexture, params: TextureMapping.Params) {\n this.texture = tx;\n this.params = params;\n }\n\n /** Compute texture coordinates for a polyface.\n * @param visitor The polyface for which to compute UV coordinates based on this texture mapping.\n * @param localToWorld The polyface's local-to-world transform, used for [[TextureMapping.Mode.ElevationDrape]].\n * @returns the texture coordinates, or undefined if computation failed.\n */\n public computeUVParams(visitor: PolyfaceVisitor, localToWorld: Transform = Transform.createIdentity()): Point2d[] | undefined {\n return this.params.computeUVParams(visitor as IndexedPolyfaceVisitor, localToWorld);\n }\n\n /** An [OrderedComparator]($bentley) that compares this mapping against `other`. */\n public compare(other: TextureMapping): number {\n if (this === other) {\n return 0;\n }\n\n return this.texture.compare(other.texture) || this.params.compare(other.params)\n || comparePossiblyUndefined((lh, rh) => compareNormalMapParams(lh, rh), this.normalMapParams, other.normalMapParams);\n }\n}\n\n/** @public */\nexport namespace TextureMapping {\n /** Enumerates the possible texture mapping modes. */\n export enum Mode {\n None = -1,\n Parametric = 0,\n ElevationDrape = 1,\n Planar = 2,\n /** Currently unsupported. */\n DirectionalDrape = 3,\n /** Currently unsupported. */\n Cubic = 4,\n /** Currently unsupported. */\n Spherical = 5,\n /** Currently unsupported. */\n Cylindrical = 6,\n /** Currently unsupported. */\n Solid = 7,\n /** Currently unsupported. */\n FrontProject = 8,\n }\n\n /** A 2x3 matrix for mapping a texture image to a surface. */\n export class Trans2x3 {\n /** The 3x4 transform produced from the 2x3 matrix. */\n public readonly transform: Transform;\n\n /** Construct from the two rows of the matrix:\n * ```\n * | m00 m01 originX |\n * | m10 m11 originY |\n * ```\n * Producing the [Transform]($core-geometry):\n * ```\n * | m00 m01 0 originX |\n * | m10 m11 0 originY |\n * | 0 0 1 0 |\n * ```\n */\n public constructor(m00 = 1, m01 = 0, originX = 0, m10 = 0, m11 = 1, originY = 0) {\n const origin = new Point3d(originX, originY, 0);\n const matrix = Matrix3d.createRowValues(m00, m01, 0, m10, m11, 0, 0, 0, 1);\n this.transform = Transform.createRefs(origin, matrix);\n }\n\n /** An immutable 2x3 identity matrix. */\n public static readonly identity = new Trans2x3();\n\n /** An [OrderedComparator]($bentley) that compares this Trans2x3 against `other`. */\n public compare(other: Trans2x3): number {\n if (this === other) {\n return 0;\n }\n\n const originDiff = compareNumbers(this.transform.origin.x, other.transform.origin.x) || compareNumbers(this.transform.origin.y, other.transform.origin.y);\n if (originDiff !== 0) {\n return originDiff;\n }\n\n for (const i of [0, 1, 3, 4]) {\n const matDiff = compareNumbers(this.transform.matrix.coffs[i], other.transform.matrix.coffs[i]);\n if (matDiff !== 0) {\n return matDiff;\n }\n }\n\n return 0;\n }\n }\n\n /** Properties used to construct a [[TextureMapping.ConstantLodParams]]. */\n export interface ConstantLodParamProps {\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. */\n repetitions?: number;\n /** An offset in world units used to shift the texture. Defaults to (0, 0). */\n offset?: XAndY;\n /** The minimum distance (from the eye to the surface) at which to clamp the texture. Defaults to 1.*/\n minDistClamp?: number;\n /** The maximum distance (from the eye to the surface) at which to clamp the texture. Defaults to 2^32. */\n maxDistClamp?: number;\n }\n\n /** Parameters to define constant level of detail mapping mode, a mode of texture coordinate generation which dynamically creates\n * texture cooprdinates so that the level of detail of the texture in the rendered image remains somewhat constant. */\n export interface ConstantLodParams {\n /** The number of times the texture is repeated. Increasing this will make the texture pattern appear smaller, decreasing it will make it larger. */\n repetitions: number;\n /** An offset in world units used to shift the texture. */\n offset: XAndY;\n /** The minimum distance (from the eye to the surface) at which to clamp the texture. */\n minDistClamp: number;\n /** The maximum distance (from the eye to the surface) at which to clamp the texture. */\n maxDistClamp: number;\n }\n\n function compareConstantLodParams(lhs: ConstantLodParams, rhs: ConstantLodParams): number {\n return compareNumbers(lhs.repetitions, rhs.repetitions) || compareNumbers(lhs.offset.x, rhs.offset.x) || compareNumbers(lhs.offset.y, rhs.offset.y)\n || compareNumbers(lhs.minDistClamp, rhs.minDistClamp) || compareNumbers(lhs.maxDistClamp, rhs.maxDistClamp);\n }\n\n /** Properties used to construct a [[TextureMapping.Params]]. */\n export interface ParamProps {\n /** The matrix used to map the image to a surface. */\n textureMat2x3?: TextureMapping.Trans2x3;\n /** The ratio in [0, 1] with which to mix the color sampled from the texture with the surface's color.\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.\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.\n * @note Defaults to 1.0\n */\n textureWeight?: number;\n /** The mode by which to map the image to a surface.\n * @note Defaults to [[TextureMapping.Mode.Parametric]].\n */\n mapMode?: TextureMapping.Mode;\n worldMapping?: boolean;\n /** True if want to use constant LOD texture mapping for the surface texture. */\n useConstantLod?: boolean;\n /** Parameters for constantLod mapping mode. */\n constantLodProps?: ConstantLodParamProps;\n }\n\n /** Parameters describing how a [[RenderTexture]]'s image is mapped to a surface. */\n export class Params {\n /** The matrix used to map the image to a surface. */\n public textureMatrix: TextureMapping.Trans2x3;\n /** The ratio in [0, 1] with which to mix the color sampled from the texture with the element's color.\n * A value of 0.0 uses only the element color. A value of 1.0 uses only the texture color.\n */\n public weight: number;\n /** The mode by which to map the image to a surface. */\n public mode: TextureMapping.Mode;\n public worldMapping: boolean;\n /** True if want to use constant LOD texture mapping for the surface texture. */\n public useConstantLod: boolean;\n /** Parameters for constantLod mapping mode. */\n public constantLodParams: ConstantLodParams;\n\n public constructor(props?: TextureMapping.ParamProps) {\n this.textureMatrix = props?.textureMat2x3 ?? Trans2x3.identity;\n this.weight = props?.textureWeight ?? 1;\n this.mode = props?.mapMode ?? Mode.Parametric;\n this.worldMapping = props?.worldMapping ?? false;\n this.useConstantLod = props?.useConstantLod ?? false;\n this.constantLodParams = {\n repetitions: props?.constantLodProps?.repetitions ?? 1,\n offset: props?.constantLodProps?.offset ?? { x: 0, y: 0 },\n minDistClamp: props?.constantLodProps?.minDistClamp ?? 1,\n maxDistClamp: props?.constantLodProps?.maxDistClamp ?? 4096 * 1024 * 1024,\n };\n }\n\n /** An [OrderedComparator]($bentley) that compares these Params against `other`. */\n public compare(other: Params): number {\n if (this === other) {\n return 0;\n }\n\n return compareNumbers(this.weight, other.weight) || compareNumbers(this.mode, other.mode) || compareBooleans(this.worldMapping, other.worldMapping)\n || compareBooleans(this.useConstantLod, other.useConstantLod) || this.textureMatrix.compare(other.textureMatrix)\n || compareConstantLodParams(this.constantLodParams, other.constantLodParams);\n }\n\n /** Compute texture coordinates for a polyface.\n * @param visitor The polyface for which to compute UV coordinates based on this texture mapping.\n * @param localToWorld The polyface's local-to-world transform, used for [[TextureMapping.Mode.ElevationDrape]].\n * @returns the texture coordinates, or undefined if computation failed.\n */\n public computeUVParams(visitor: IndexedPolyfaceVisitor, localToWorld: Transform = Transform.createIdentity()): Point2d[] | undefined {\n switch (this.mode) {\n default: // Fall through to parametric in default case\n case TextureMapping.Mode.Parametric: {\n return this.computeParametricUVParams(visitor, this.textureMatrix.transform, !this.worldMapping);\n }\n case TextureMapping.Mode.Planar: {\n const normalIndices = visitor.normalIndex;\n if (!normalIndices)\n return undefined;\n\n // Ignore planar mode unless master or sub units for scaleMode and facet is planar\n if (!this.worldMapping || (visitor.normalIndex !== undefined && (normalIndices[0] !== normalIndices[1] || normalIndices[0] !== normalIndices[2]))) {\n return this.computeParametricUVParams(visitor, this.textureMatrix.transform, !this.worldMapping);\n } else {\n return this.computePlanarUVParams(visitor, this.textureMatrix.transform);\n }\n }\n case TextureMapping.Mode.ElevationDrape: {\n return this.computeElevationDrapeUVParams(visitor, this.textureMatrix.transform, localToWorld);\n }\n }\n }\n\n /** Computes UV parameters given a texture mapping mode of parametric. */\n private computeParametricUVParams(visitor: IndexedPolyfaceVisitor, uvTransform: Transform, isRelativeUnits: boolean): Point2d[] {\n const params: Point2d[] = [];\n for (let i = 0; i < visitor.numEdgesThisFacet; i++) {\n let param = Point2d.create();\n\n if (isRelativeUnits || !visitor.tryGetDistanceParameter(i, param)) {\n if (!visitor.tryGetNormalizedParameter(i, param)) {\n // If mesh does not have facetFaceData, we still want to use the texture coordinates if they are present\n param = visitor.getParam(i)!;\n }\n }\n\n params.push(uvTransform.multiplyPoint2d(param));\n }\n return params;\n }\n\n /** Computes UV parameters given a texture mapping mode of planar. The result is stored in the Point2d array given. */\n private computePlanarUVParams(visitor: IndexedPolyfaceVisitor, uvTransform: Transform): Point2d[] | undefined {\n const params: Point2d[] = [];\n const points = visitor.point;\n let normal: Vector3d;\n\n if (visitor.normal === undefined)\n normal = points.getPoint3dAtUncheckedPointIndex(0).crossProductToPoints(points.getPoint3dAtUncheckedPointIndex(1), points.getPoint3dAtUncheckedPointIndex(2));\n else\n normal = visitor.normal.getVector3dAtCheckedVectorIndex(0)!;\n\n if (!normal.normalize(normal))\n return undefined;\n\n // adjust U texture coordinate to be a continuous length starting at the\n // origin. V coordinate stays the same. This mode assumes Z is up vector\n\n // Flipping normal puts us in a planar coordinate system consistent with MicroStation's display system\n normal.scale(-1.0, normal);\n\n // pick the first vertex normal\n const sideVector = Vector3d.create(normal.y, -normal.x, 0.0);\n\n // if the magnitude of the normal is near zero, the real normal points\n // almost straighten up.. In this case, use Y as the up vector to match QV\n\n const magnitude = sideVector.magnitude();\n sideVector.normalize(sideVector); // won't remain undefined if failed due to following check..\n\n if (magnitude < 1e-3) {\n normal.set(0, 0, -1);\n sideVector.set(1, 0, 0);\n }\n\n const upVector = sideVector.crossProduct(normal).normalize();\n if (!upVector)\n return undefined;\n\n const numEdges = visitor.numEdgesThisFacet;\n for (let i = 0; i < numEdges; i++) {\n const vector = Vector3d.createFrom(points.getPoint3dAtUncheckedPointIndex(i));\n\n params.push(Point2d.create(vector.dotProduct(sideVector), vector.dotProduct(upVector)));\n uvTransform.multiplyPoint2d(params[i], params[i]);\n }\n return params;\n }\n\n /** Computes UV parameters given a texture mapping mode of elevation drape. The result is stored in the Point2d array given. */\n private computeElevationDrapeUVParams(visitor: IndexedPolyfaceVisitor, uvTransform: Transform, localToWorld?: Transform): Point2d[] {\n const params: Point2d[] = [];\n const numEdges = visitor.numEdgesThisFacet;\n for (let i = 0; i < numEdges; i++) {\n const point = visitor.point.getPoint3dAtUncheckedPointIndex(i);\n\n if (localToWorld !== undefined)\n localToWorld.multiplyPoint3d(point, point);\n\n params.push(Point2d.createFrom(point));\n uvTransform.multiplyPoint2d(params[i], params[i]);\n }\n return params;\n }\n }\n}\n\nObject.freeze(TextureMapping.Trans2x3.identity);\n"]}
@@ -241,9 +241,7 @@ export declare class ViewFlags {
241
241
  * @see [[copy]] and [[override]] to change multiple properties.
242
242
  */
243
243
  withRenderMode(renderMode: RenderMode): ViewFlags;
244
- /** Adjust view flags for renderer.
245
- * @internal
246
- */
244
+ /** Adjust some view flags based on [[renderMode]]. For example, [[transparency]] is always treated as `false` in [[RenderMode.SolidFill]]. */
247
245
  normalize(): ViewFlags;
248
246
  /** Returns true if edges that could be occluded by other geometry are visible for the current [[RenderMode]]. */
249
247
  hiddenEdgesVisible(): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"ViewFlags.d.ts","sourceRoot":"","sources":["../../src/ViewFlags.ts"],"names":[],"mappings":"AAIA;;GAEG;AAIH,OAAO,EAAa,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAElF;;;;GAIG;AACH,oBAAY,UAAU;IACpB;;;;OAIG;IACH,SAAS,IAAI;IACb;;;;OAIG;IACH,WAAW,IAAI;IACf;;;;;OAKG;IACH,SAAS,IAAI;IACb;;;OAGG;IACH,UAAU,IAAI;CACf;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,aAAa;IAC5B,+EAA+E;IAC/E,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,4EAA4E;IAC5E,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,0EAA0E;IAC1E,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,kDAAkD;IAClD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,wDAAwD;IACxD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,uFAAuF;IACvF,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,2CAA2C;IAC3C,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,6EAA6E;IAC7E,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,2DAA2D;IAC3D,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,4DAA4D;IAC5D,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,yEAAyE;IACzE,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,yEAAyE;IACzE,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,yEAAyE;IACzE,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,sFAAsF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B,CAAC,GAAG,SAAS;IAIlE;;;;OAIG;IACI,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC,mBAAmB,CAAC,GAAG,SAAS;IA4BnE;;;;;;OAMG;IACI,IAAI,CAAC,IAAI,EAAE,MAAM,IAAI,CAAC,mBAAmB,EAAE,YAAY,CAAC,EAAE,KAAK,EAAE,OAAO,GAAG,SAAS;IAS3F;;;;OAIG;IACI,cAAc,CAAC,UAAU,EAAE,UAAU,GAAG,SAAS;IAIxD,8IAA8I;IACvI,SAAS,IAAI,SAAS;IAoB7B,iHAAiH;IAC1G,kBAAkB,IAAI,OAAO;IAWpC,wHAAwH;IACjH,aAAa,IAAI,OAAO;IAI/B;;OAEG;IACI,MAAM,IAAI,aAAa;IAqD9B,sDAAsD;IAC/C,kBAAkB,IAAI,QAAQ,CAAC,aAAa,CAAC;IA+BpD,kFAAkF;IAClF,gBAAuB,QAAQ,YAAmB;IAElD;;OAEG;WACW,MAAM,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,GAAG,SAAS;IAIrE;;;;;;;OAOG;WACW,QAAQ,CAAC,IAAI,CAAC,EAAE,aAAa,GAAG,SAAS;IA0CvD,yDAAyD;IAClD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,mBAAmB,CAAC,GAAG,OAAO;CA6B7D;AAED;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAAG,OAAO,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC,CAAC;AAE9E;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC"}
@@ -158,9 +158,7 @@ class ViewFlags {
158
158
  withRenderMode(renderMode) {
159
159
  return renderMode === this.renderMode ? this : this.copy({ renderMode });
160
160
  }
161
- /** Adjust view flags for renderer.
162
- * @internal
163
- */
161
+ /** Adjust some view flags based on [[renderMode]]. For example, [[transparency]] is always treated as `false` in [[RenderMode.SolidFill]]. */
164
162
  normalize() {
165
163
  switch (this.renderMode) {
166
164
  case RenderMode.Wireframe: