@itwin/core-frontend 3.0.0-dev.140 → 3.0.0-dev.141

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 (159) hide show
  1. package/lib/cjs/render/MockRender.d.ts +3 -1
  2. package/lib/cjs/render/MockRender.d.ts.map +1 -1
  3. package/lib/cjs/render/MockRender.js.map +1 -1
  4. package/lib/cjs/render/RenderSystem.d.ts +3 -1
  5. package/lib/cjs/render/RenderSystem.d.ts.map +1 -1
  6. package/lib/cjs/render/RenderSystem.js +4 -2
  7. package/lib/cjs/render/RenderSystem.js.map +1 -1
  8. package/lib/cjs/render/primitives/EdgeParams.d.ts +50 -0
  9. package/lib/cjs/render/primitives/EdgeParams.d.ts.map +1 -0
  10. package/lib/cjs/render/primitives/EdgeParams.js +116 -0
  11. package/lib/cjs/render/primitives/EdgeParams.js.map +1 -0
  12. package/lib/cjs/render/primitives/PointStringParams.d.ts +16 -0
  13. package/lib/cjs/render/primitives/PointStringParams.d.ts.map +1 -0
  14. package/lib/cjs/render/primitives/PointStringParams.js +43 -0
  15. package/lib/cjs/render/primitives/PointStringParams.js.map +1 -0
  16. package/lib/cjs/render/primitives/PolylineParams.d.ts +44 -0
  17. package/lib/cjs/render/primitives/PolylineParams.d.ts.map +1 -0
  18. package/lib/cjs/render/primitives/PolylineParams.js +205 -0
  19. package/lib/cjs/render/primitives/PolylineParams.js.map +1 -0
  20. package/lib/cjs/render/primitives/SurfaceParams.d.ts +46 -0
  21. package/lib/cjs/render/primitives/SurfaceParams.d.ts.map +1 -0
  22. package/lib/cjs/render/primitives/SurfaceParams.js +42 -0
  23. package/lib/cjs/render/primitives/SurfaceParams.js.map +1 -0
  24. package/lib/cjs/render/primitives/VertexTable.d.ts +3 -123
  25. package/lib/cjs/render/primitives/VertexTable.d.ts.map +1 -1
  26. package/lib/cjs/render/primitives/VertexTable.js +10 -351
  27. package/lib/cjs/render/primitives/VertexTable.js.map +1 -1
  28. package/lib/cjs/render/webgl/CachedGeometry.d.ts +4 -2
  29. package/lib/cjs/render/webgl/CachedGeometry.d.ts.map +1 -1
  30. package/lib/cjs/render/webgl/CachedGeometry.js.map +1 -1
  31. package/lib/cjs/render/webgl/EdgeGeometry.d.ts +73 -0
  32. package/lib/cjs/render/webgl/EdgeGeometry.d.ts.map +1 -0
  33. package/lib/cjs/render/webgl/EdgeGeometry.js +141 -0
  34. package/lib/cjs/render/webgl/EdgeGeometry.js.map +1 -0
  35. package/lib/cjs/render/webgl/InstancedGeometry.d.ts +4 -4
  36. package/lib/cjs/render/webgl/InstancedGeometry.d.ts.map +1 -1
  37. package/lib/cjs/render/webgl/Material.d.ts +1 -1
  38. package/lib/cjs/render/webgl/Material.d.ts.map +1 -1
  39. package/lib/cjs/render/webgl/Material.js.map +1 -1
  40. package/lib/cjs/render/webgl/Mesh.d.ts +6 -162
  41. package/lib/cjs/render/webgl/Mesh.d.ts.map +1 -1
  42. package/lib/cjs/render/webgl/Mesh.js +11 -456
  43. package/lib/cjs/render/webgl/Mesh.js.map +1 -1
  44. package/lib/cjs/render/webgl/MeshData.d.ts +38 -0
  45. package/lib/cjs/render/webgl/MeshData.d.ts.map +1 -0
  46. package/lib/cjs/render/webgl/MeshData.js +66 -0
  47. package/lib/cjs/render/webgl/MeshData.js.map +1 -0
  48. package/lib/cjs/render/webgl/MeshGeometry.d.ts +38 -0
  49. package/lib/cjs/render/webgl/MeshGeometry.d.ts.map +1 -0
  50. package/lib/cjs/render/webgl/MeshGeometry.js +60 -0
  51. package/lib/cjs/render/webgl/MeshGeometry.js.map +1 -0
  52. package/lib/cjs/render/webgl/PointString.d.ts +1 -1
  53. package/lib/cjs/render/webgl/PointString.d.ts.map +1 -1
  54. package/lib/cjs/render/webgl/PointString.js.map +1 -1
  55. package/lib/cjs/render/webgl/Polyline.d.ts +1 -1
  56. package/lib/cjs/render/webgl/Polyline.d.ts.map +1 -1
  57. package/lib/cjs/render/webgl/Polyline.js.map +1 -1
  58. package/lib/cjs/render/webgl/RenderCommands.js +4 -4
  59. package/lib/cjs/render/webgl/RenderCommands.js.map +1 -1
  60. package/lib/cjs/render/webgl/SurfaceGeometry.d.ts +54 -0
  61. package/lib/cjs/render/webgl/SurfaceGeometry.d.ts.map +1 -0
  62. package/lib/cjs/render/webgl/SurfaceGeometry.js +240 -0
  63. package/lib/cjs/render/webgl/SurfaceGeometry.js.map +1 -0
  64. package/lib/cjs/render/webgl/System.d.ts +3 -1
  65. package/lib/cjs/render/webgl/System.d.ts.map +1 -1
  66. package/lib/cjs/render/webgl/System.js.map +1 -1
  67. package/lib/cjs/render/webgl/glsl/Surface.js +3 -3
  68. package/lib/cjs/render/webgl/glsl/Surface.js.map +1 -1
  69. package/lib/cjs/render-primitives.d.ts +5 -1
  70. package/lib/cjs/render-primitives.d.ts.map +1 -1
  71. package/lib/cjs/render-primitives.js +5 -1
  72. package/lib/cjs/render-primitives.js.map +1 -1
  73. package/lib/cjs/tile/ImdlReader.d.ts.map +1 -1
  74. package/lib/cjs/tile/ImdlReader.js +8 -5
  75. package/lib/cjs/tile/ImdlReader.js.map +1 -1
  76. package/lib/cjs/webgl.d.ts +4 -0
  77. package/lib/cjs/webgl.d.ts.map +1 -1
  78. package/lib/cjs/webgl.js +4 -0
  79. package/lib/cjs/webgl.js.map +1 -1
  80. package/lib/esm/render/MockRender.d.ts +3 -1
  81. package/lib/esm/render/MockRender.d.ts.map +1 -1
  82. package/lib/esm/render/MockRender.js.map +1 -1
  83. package/lib/esm/render/RenderSystem.d.ts +3 -1
  84. package/lib/esm/render/RenderSystem.d.ts.map +1 -1
  85. package/lib/esm/render/RenderSystem.js +3 -1
  86. package/lib/esm/render/RenderSystem.js.map +1 -1
  87. package/lib/esm/render/primitives/EdgeParams.d.ts +50 -0
  88. package/lib/esm/render/primitives/EdgeParams.d.ts.map +1 -0
  89. package/lib/esm/render/primitives/EdgeParams.js +113 -0
  90. package/lib/esm/render/primitives/EdgeParams.js.map +1 -0
  91. package/lib/esm/render/primitives/PointStringParams.d.ts +16 -0
  92. package/lib/esm/render/primitives/PointStringParams.d.ts.map +1 -0
  93. package/lib/esm/render/primitives/PointStringParams.js +39 -0
  94. package/lib/esm/render/primitives/PointStringParams.js.map +1 -0
  95. package/lib/esm/render/primitives/PolylineParams.d.ts +44 -0
  96. package/lib/esm/render/primitives/PolylineParams.d.ts.map +1 -0
  97. package/lib/esm/render/primitives/PolylineParams.js +199 -0
  98. package/lib/esm/render/primitives/PolylineParams.js.map +1 -0
  99. package/lib/esm/render/primitives/SurfaceParams.d.ts +46 -0
  100. package/lib/esm/render/primitives/SurfaceParams.d.ts.map +1 -0
  101. package/lib/esm/render/primitives/SurfaceParams.js +37 -0
  102. package/lib/esm/render/primitives/SurfaceParams.js.map +1 -0
  103. package/lib/esm/render/primitives/VertexTable.d.ts +3 -123
  104. package/lib/esm/render/primitives/VertexTable.d.ts.map +1 -1
  105. package/lib/esm/render/primitives/VertexTable.js +5 -341
  106. package/lib/esm/render/primitives/VertexTable.js.map +1 -1
  107. package/lib/esm/render/webgl/CachedGeometry.d.ts +4 -2
  108. package/lib/esm/render/webgl/CachedGeometry.d.ts.map +1 -1
  109. package/lib/esm/render/webgl/CachedGeometry.js.map +1 -1
  110. package/lib/esm/render/webgl/EdgeGeometry.d.ts +73 -0
  111. package/lib/esm/render/webgl/EdgeGeometry.d.ts.map +1 -0
  112. package/lib/esm/render/webgl/EdgeGeometry.js +135 -0
  113. package/lib/esm/render/webgl/EdgeGeometry.js.map +1 -0
  114. package/lib/esm/render/webgl/InstancedGeometry.d.ts +4 -4
  115. package/lib/esm/render/webgl/InstancedGeometry.d.ts.map +1 -1
  116. package/lib/esm/render/webgl/Material.d.ts +1 -1
  117. package/lib/esm/render/webgl/Material.d.ts.map +1 -1
  118. package/lib/esm/render/webgl/Material.js.map +1 -1
  119. package/lib/esm/render/webgl/Mesh.d.ts +6 -162
  120. package/lib/esm/render/webgl/Mesh.d.ts.map +1 -1
  121. package/lib/esm/render/webgl/Mesh.js +5 -443
  122. package/lib/esm/render/webgl/Mesh.js.map +1 -1
  123. package/lib/esm/render/webgl/MeshData.d.ts +38 -0
  124. package/lib/esm/render/webgl/MeshData.d.ts.map +1 -0
  125. package/lib/esm/render/webgl/MeshData.js +62 -0
  126. package/lib/esm/render/webgl/MeshData.js.map +1 -0
  127. package/lib/esm/render/webgl/MeshGeometry.d.ts +38 -0
  128. package/lib/esm/render/webgl/MeshGeometry.d.ts.map +1 -0
  129. package/lib/esm/render/webgl/MeshGeometry.js +56 -0
  130. package/lib/esm/render/webgl/MeshGeometry.js.map +1 -0
  131. package/lib/esm/render/webgl/PointString.d.ts +1 -1
  132. package/lib/esm/render/webgl/PointString.d.ts.map +1 -1
  133. package/lib/esm/render/webgl/PointString.js.map +1 -1
  134. package/lib/esm/render/webgl/Polyline.d.ts +1 -1
  135. package/lib/esm/render/webgl/Polyline.d.ts.map +1 -1
  136. package/lib/esm/render/webgl/Polyline.js.map +1 -1
  137. package/lib/esm/render/webgl/RenderCommands.js +1 -1
  138. package/lib/esm/render/webgl/RenderCommands.js.map +1 -1
  139. package/lib/esm/render/webgl/SurfaceGeometry.d.ts +54 -0
  140. package/lib/esm/render/webgl/SurfaceGeometry.d.ts.map +1 -0
  141. package/lib/esm/render/webgl/SurfaceGeometry.js +235 -0
  142. package/lib/esm/render/webgl/SurfaceGeometry.js.map +1 -0
  143. package/lib/esm/render/webgl/System.d.ts +3 -1
  144. package/lib/esm/render/webgl/System.d.ts.map +1 -1
  145. package/lib/esm/render/webgl/System.js.map +1 -1
  146. package/lib/esm/render/webgl/glsl/Surface.js +1 -1
  147. package/lib/esm/render/webgl/glsl/Surface.js.map +1 -1
  148. package/lib/esm/render-primitives.d.ts +5 -1
  149. package/lib/esm/render-primitives.d.ts.map +1 -1
  150. package/lib/esm/render-primitives.js +5 -1
  151. package/lib/esm/render-primitives.js.map +1 -1
  152. package/lib/esm/tile/ImdlReader.d.ts.map +1 -1
  153. package/lib/esm/tile/ImdlReader.js +4 -1
  154. package/lib/esm/tile/ImdlReader.js.map +1 -1
  155. package/lib/esm/webgl.d.ts +4 -0
  156. package/lib/esm/webgl.d.ts.map +1 -1
  157. package/lib/esm/webgl.js +4 -0
  158. package/lib/esm/webgl.js.map +1 -1
  159. package/package.json +22 -22
@@ -1,9 +1,11 @@
1
1
  /** @packageDocumentation
2
2
  * @module Rendering
3
3
  */
4
- import { ColorDef, ColorIndex, FeatureIndex, FeatureIndexType, FillFlags, LinePixels, PolylineData, PolylineTypeFlags, QParams2d, QParams3d, QPoint3dList, RenderMaterial, RenderTexture } from "@itwin/core-common";
4
+ import { ColorDef, ColorIndex, FeatureIndex, FeatureIndexType, QParams2d, QParams3d } from "@itwin/core-common";
5
5
  import { AuxChannelTable } from "./AuxChannelTable";
6
6
  import { MeshArgs, PolylineArgs } from "./mesh/MeshPrimitives";
7
+ import { SurfaceParams } from "./SurfaceParams";
8
+ import { EdgeParams } from "./EdgeParams";
7
9
  /**
8
10
  * Holds an array of indices into a VertexTable. Each index is a 24-bit unsigned integer.
9
11
  * The order of the indices specifies the order in which vertices are drawn.
@@ -94,111 +96,6 @@ export declare class VertexTable implements VertexTableProps {
94
96
  static buildFrom(builder: VertexTableBuilder, colorIndex: ColorIndex, featureIndex: FeatureIndex): VertexTable;
95
97
  static createForPolylines(args: PolylineArgs): VertexTable | undefined;
96
98
  }
97
- /** Describes point string geometry to be submitted to the rendering system.
98
- * @internal
99
- */
100
- export declare class PointStringParams {
101
- readonly vertices: VertexTable;
102
- readonly indices: VertexIndices;
103
- readonly weight: number;
104
- constructor(vertices: VertexTable, indices: VertexIndices, weight: number);
105
- static create(args: PolylineArgs): PointStringParams | undefined;
106
- }
107
- /**
108
- * Represents a tesselated polyline.
109
- * Given a polyline as a line string, each segment of the line string is triangulated into a quad.
110
- * Based on the angle between two segments, additional joint triangles may be inserted in between to enable smoothly-rounded corners.
111
- * @internal
112
- */
113
- export interface TesselatedPolyline {
114
- /** 24-bit index of each vertex. */
115
- readonly indices: VertexIndices;
116
- /** 24-bit index of the previous vertex in the polyline. */
117
- readonly prevIndices: VertexIndices;
118
- /** 24-bit index of the next vertex in the polyline, plus 8-bit parameter describing the semantics of this vertex. */
119
- readonly nextIndicesAndParams: Uint8Array;
120
- }
121
- /** Strictly for tests. @internal */
122
- export declare function tesselatePolyline(polylines: PolylineData[], points: QPoint3dList, doJointTriangles: boolean): TesselatedPolyline;
123
- /** @internal */
124
- export declare enum SurfaceType {
125
- Unlit = 0,
126
- Lit = 1,
127
- Textured = 2,
128
- TexturedLit = 3,
129
- VolumeClassifier = 4
130
- }
131
- /** @internal */
132
- export declare function isValidSurfaceType(value: number): boolean;
133
- /** @internal */
134
- export interface SurfaceRenderMaterial {
135
- readonly isAtlas: false;
136
- readonly material: RenderMaterial;
137
- }
138
- /** @internal */
139
- export interface SurfaceMaterialAtlas {
140
- readonly isAtlas: true;
141
- readonly hasTranslucency: boolean;
142
- readonly overridesAlpha: boolean;
143
- readonly vertexTableOffset: number;
144
- readonly numMaterials: number;
145
- }
146
- /** @internal */
147
- export declare type SurfaceMaterial = SurfaceRenderMaterial | SurfaceMaterialAtlas;
148
- /** @internal */
149
- export declare function createSurfaceMaterial(source: RenderMaterial | undefined): SurfaceMaterial | undefined;
150
- /** @internal */
151
- export interface SurfaceParams {
152
- readonly type: SurfaceType;
153
- readonly indices: VertexIndices;
154
- readonly fillFlags: FillFlags;
155
- readonly hasBakedLighting: boolean;
156
- readonly hasFixedNormals: boolean;
157
- readonly textureMapping?: {
158
- texture: RenderTexture;
159
- alwaysDisplayed: boolean;
160
- };
161
- readonly material?: SurfaceMaterial;
162
- }
163
- /**
164
- * Describes a set of line segments representing edges of a mesh.
165
- * Each segment is expanded into a quad defined by two triangles.
166
- * The positions are adjusted in the shader to account for the edge width.
167
- * @internal
168
- */
169
- export interface SegmentEdgeParams {
170
- /** The 24-bit indices of the tesselated line segment */
171
- readonly indices: VertexIndices;
172
- /**
173
- * For each 24-bit index, 4 bytes:
174
- * the 24-bit index of the vertex at the other end of the segment, followed by
175
- * an 8-bit 'quad index' in [0..3] indicating which point in the expanded quad the vertex represents.
176
- */
177
- readonly endPointAndQuadIndices: Uint8Array;
178
- }
179
- /**
180
- * A set of line segments representing edges of curved portions of a mesh.
181
- * Each vertex is augmented with a pair of oct-encoded normals used in the shader
182
- * to determine whether or not the edge should be displayed.
183
- * @internal
184
- */
185
- export interface SilhouetteParams extends SegmentEdgeParams {
186
- /** Per index, 2 16-bit oct-encoded normals */
187
- readonly normalPairs: Uint8Array;
188
- }
189
- /** Describes the edges of a mesh. */
190
- export interface EdgeParams {
191
- /** The edge width in pixels. */
192
- readonly weight: number;
193
- /** The line pattern in which edges are drawn. */
194
- readonly linePixels: LinePixels;
195
- /** Simple single-segment edges, always displayed when edge display is enabled. */
196
- readonly segments?: SegmentEdgeParams;
197
- /** Single-segment edges of curved surfaces, displayed based on edge normal relative to eye. */
198
- readonly silhouettes?: SilhouetteParams;
199
- /** Polyline edges, always displayed when edge display is enabled. */
200
- readonly polylines?: TesselatedPolyline;
201
- }
202
99
  /**
203
100
  * Describes mesh geometry to be submitted to the rendering system.
204
101
  * A mesh consists of a surface and its edges, which may include any combination of silhouettes, polylines, and single segments.
@@ -215,23 +112,6 @@ export declare class MeshParams {
215
112
  /** Construct from a MeshArgs. */
216
113
  static create(args: MeshArgs): MeshParams;
217
114
  }
218
- /**
219
- * Describes a set of tesselated polylines.
220
- * Each segment of each polyline is triangulated into a quad. Additional triangles may be inserted
221
- * between segments to enable rounded corners.
222
- */
223
- export declare class PolylineParams {
224
- readonly vertices: VertexTable;
225
- readonly polyline: TesselatedPolyline;
226
- readonly isPlanar: boolean;
227
- readonly type: PolylineTypeFlags;
228
- readonly weight: number;
229
- readonly linePixels: LinePixels;
230
- /** Directly construct a PolylineParams. The PolylineParams takes ownership of all input data. */
231
- constructor(vertices: VertexTable, polyline: TesselatedPolyline, weight: number, linePixels: LinePixels, isPlanar: boolean, type?: PolylineTypeFlags);
232
- /** Construct from an PolylineArgs. */
233
- static create(args: PolylineArgs): PolylineParams | undefined;
234
- }
235
115
  /** Builds a VertexTable from some data type supplying the vertex data. */
236
116
  export declare abstract class VertexTableBuilder {
237
117
  data?: Uint8Array;
@@ -1 +1 @@
1
- {"version":3,"file":"VertexTable.d.ts","sourceRoot":"","sources":["../../../../src/render/primitives/VertexTable.ts"],"names":[],"mappings":"AAIA;;GAEG;AAIH,OAAO,EACL,QAAQ,EAAE,UAAU,EAAE,YAAY,EAAE,gBAAgB,EAAE,SAAS,EAAE,UAAU,EAAkC,YAAY,EAAE,iBAAiB,EAC5I,SAAS,EAAE,SAAS,EAAY,YAAY,EAAE,cAAc,EAAE,aAAa,EAC5E,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE/D;;;;GAIG;AACH,qBAAa,aAAa;IACxB,SAAgB,IAAI,EAAE,UAAU,CAAC;IAEjC;;;OAGG;gBACgB,IAAI,EAAE,UAAU;IAKnC,wCAAwC;IACxC,IAAW,MAAM,IAAI,MAAM,CAAiC;IAE5D,sFAAsF;WACxE,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,aAAa;WAQ3C,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI;IAO7E,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAMlC,aAAa,IAAI,MAAM,EAAE;CAOjC;AAED,gBAAgB;AAChB,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,gBAAgB;AAChB,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,UAAU,CA6BzG;AAED;;GAEG;AACH,MAAM,WA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AAW,EAAE,OAAO,EAAE,aAAa,EAAE,KAAK,CAAC,EAAE,UAAU,EAAE,QAAQ,CAAC,EAAE,OAAO,EAAE,WAAW,CAAC,EAAE,eAAe;IAQvI,iCAAiC;WACnB,MAAM,CAAC,IAAI,EAAE,QAAQ,GAAG,UAAU;CAoBjD;AAED,0EAA0E;AAC1E,8BAAsB,kBAAkB;IAC/B,IAAI,CAAC,EAAE,UAAU,CAAC;IACzB,OAAO,CAAC,SAAS,CAAa;IAE9B,aAAoB,WAAW,IAAI,MAAM,CAAC;IAC1C,aAAoB,gBAAgB,IAAI,MAAM,CAAC;IAC/C,aAAoB,OAAO,IAAI,SAAS,CAAC;IACzC,IAAW,QAAQ,IAAI,SAAS,GAAG,SAAS,CAAsB;aAClD,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAE9C,gBAAgB,CAAC,UAAU,EAAE,UAAU;IAQ9C,SAAS,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM;IAKhC,SAAS,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM;IAQ7B,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,MAAM;IAI9B,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,MAAM;IAK9B,OAAO,CAAC,WAAW;CA4BpB"}
@@ -7,12 +7,14 @@
7
7
  * @module Rendering
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.VertexTableBuilder = exports.PolylineParams = exports.MeshParams = exports.createSurfaceMaterial = exports.isValidSurfaceType = exports.SurfaceType = exports.tesselatePolyline = exports.PointStringParams = exports.VertexTable = exports.computeDimensions = exports.VertexIndices = void 0;
10
+ exports.VertexTableBuilder = exports.MeshParams = exports.VertexTable = exports.computeDimensions = exports.VertexIndices = void 0;
11
11
  const core_bentley_1 = require("@itwin/core-bentley");
12
12
  const core_geometry_1 = require("@itwin/core-geometry");
13
13
  const core_common_1 = require("@itwin/core-common");
14
14
  const IModelApp_1 = require("../../IModelApp");
15
15
  const AuxChannelTable_1 = require("./AuxChannelTable");
16
+ const SurfaceParams_1 = require("./SurfaceParams");
17
+ const EdgeParams_1 = require("./EdgeParams");
16
18
  /**
17
19
  * Holds an array of indices into a VertexTable. Each index is a 24-bit unsigned integer.
18
20
  * The order of the indices specifies the order in which vertices are drawn.
@@ -137,321 +139,6 @@ class VertexTable {
137
139
  }
138
140
  }
139
141
  exports.VertexTable = VertexTable;
140
- /** Describes point string geometry to be submitted to the rendering system.
141
- * @internal
142
- */
143
- class PointStringParams {
144
- constructor(vertices, indices, weight) {
145
- this.vertices = vertices;
146
- this.indices = indices;
147
- this.weight = weight;
148
- }
149
- static create(args) {
150
- if (!args.flags.isDisjoint)
151
- return undefined;
152
- const vertices = VertexTable.createForPolylines(args);
153
- if (undefined === vertices)
154
- return undefined;
155
- const polylines = args.polylines;
156
- let vertIndices = polylines[0].vertIndices;
157
- if (1 < polylines.length) {
158
- // We used to assert this wouldn't happen - apparently it does...
159
- vertIndices = [];
160
- for (const polyline of polylines)
161
- for (const vertIndex of polyline.vertIndices)
162
- vertIndices.push(vertIndex);
163
- }
164
- const vertexIndices = VertexIndices.fromArray(vertIndices);
165
- (0, core_bentley_1.assert)(vertexIndices.length === vertIndices.length);
166
- return new PointStringParams(vertices, vertexIndices, args.width);
167
- }
168
- }
169
- exports.PointStringParams = PointStringParams;
170
- class PolylineVertex {
171
- constructor() {
172
- this.isSegmentStart = false;
173
- this.isPolylineStartOrEnd = false;
174
- this.vertexIndex = 0;
175
- this.prevIndex = 0;
176
- this.nextIndex = 0;
177
- }
178
- init(isSegmentStart, isPolylineStartOrEnd, vertexIndex, prevIndex, nextIndex) {
179
- this.isSegmentStart = isSegmentStart;
180
- this.isPolylineStartOrEnd = isPolylineStartOrEnd;
181
- this.vertexIndex = vertexIndex;
182
- this.prevIndex = prevIndex;
183
- this.nextIndex = nextIndex;
184
- }
185
- computeParam(negatePerp, adjacentToJoint = false, joint = false, noDisplacement = false) {
186
- if (joint)
187
- return 12 /* kJointBase */;
188
- let param;
189
- if (noDisplacement)
190
- param = 96 /* kNoneAdjustWeight */; // prevent getting tossed before width adjustment
191
- else if (adjacentToJoint)
192
- param = 9 /* kMiterInsideOnly */;
193
- else
194
- param = this.isPolylineStartOrEnd ? 3 /* kSquare */ : 6 /* kMiter */;
195
- let adjust = 0;
196
- if (negatePerp)
197
- adjust = 24 /* kNegatePerp */;
198
- if (!this.isSegmentStart)
199
- adjust += 48 /* kNegateAlong */;
200
- return param + adjust;
201
- }
202
- }
203
- class PolylineTesselator {
204
- constructor(polylines, points, doJointTriangles) {
205
- this._numIndices = 0;
206
- this._vertIndex = [];
207
- this._prevIndex = [];
208
- this._nextIndex = [];
209
- this._nextParam = [];
210
- this._position = [];
211
- this._polylines = polylines;
212
- this._points = points;
213
- this._doJoints = doJointTriangles;
214
- }
215
- static fromPolyline(args) {
216
- return new PolylineTesselator(args.polylines, args.points, wantJointTriangles(args.width, args.flags.is2d));
217
- }
218
- static fromMesh(args) {
219
- if (undefined !== args.edges.polylines.lines && undefined !== args.points)
220
- return new PolylineTesselator(args.edges.polylines.lines, args.points, wantJointTriangles(args.edges.width, args.is2d));
221
- return undefined;
222
- }
223
- tesselate() {
224
- for (const p of this._points.list)
225
- this._position.push(p.unquantize(this._points.params));
226
- this._tesselate();
227
- const vertIndex = VertexIndices.fromArray(this._vertIndex);
228
- const prevIndex = VertexIndices.fromArray(this._prevIndex);
229
- const nextIndexAndParam = new Uint8Array(this._numIndices * 4);
230
- for (let i = 0; i < this._numIndices; i++) {
231
- const index = this._nextIndex[i];
232
- const j = i * 4;
233
- VertexIndices.encodeIndex(index, nextIndexAndParam, j);
234
- nextIndexAndParam[j + 3] = this._nextParam[i] & 0x000000ff;
235
- }
236
- return {
237
- indices: vertIndex,
238
- prevIndices: prevIndex,
239
- nextIndicesAndParams: nextIndexAndParam,
240
- };
241
- }
242
- _tesselate() {
243
- const v0 = new PolylineVertex(), v1 = new PolylineVertex();
244
- const maxJointDot = -0.7;
245
- for (const line of this._polylines) {
246
- if (line.numIndices < 2)
247
- continue;
248
- const last = line.numIndices - 1;
249
- const isClosed = line.vertIndices[0] === line.vertIndices[last];
250
- for (let i = 0; i < last; ++i) {
251
- const idx0 = line.vertIndices[i];
252
- const idx1 = line.vertIndices[i + 1];
253
- const isStart = (0 === i);
254
- const isEnd = (last - 1 === i);
255
- const prevIdx0 = isStart ? (isClosed ? line.vertIndices[last - 1] : idx0) : line.vertIndices[i - 1];
256
- const nextIdx1 = isEnd ? (isClosed ? line.vertIndices[1] : idx1) : line.vertIndices[i + 2];
257
- v0.init(true, isStart && !isClosed, idx0, prevIdx0, idx1);
258
- v1.init(false, isEnd && !isClosed, idx1, nextIdx1, idx0);
259
- const jointAt0 = this._doJoints && (isClosed || !isStart) && this._dotProduct(v0) > maxJointDot;
260
- const jointAt1 = this._doJoints && (isClosed || !isEnd) && this._dotProduct(v1) > maxJointDot;
261
- if (jointAt0 || jointAt1) {
262
- this._addVertex(v0, v0.computeParam(true, jointAt0, false, false));
263
- this._addVertex(v1, v1.computeParam(false, jointAt1, false, false));
264
- this._addVertex(v0, v0.computeParam(false, jointAt0, false, true));
265
- this._addVertex(v0, v0.computeParam(false, jointAt0, false, true));
266
- this._addVertex(v1, v1.computeParam(false, jointAt1, false, false));
267
- this._addVertex(v1, v1.computeParam(false, jointAt1, false, true));
268
- this._addVertex(v0, v0.computeParam(false, jointAt0, false, true));
269
- this._addVertex(v1, v1.computeParam(false, jointAt1, false, true));
270
- this._addVertex(v0, v0.computeParam(false, jointAt0, false, false));
271
- this._addVertex(v0, v0.computeParam(false, jointAt0, false, false));
272
- this._addVertex(v1, v1.computeParam(false, jointAt1, false, true));
273
- this._addVertex(v1, v1.computeParam(true, jointAt1, false, false));
274
- if (jointAt0)
275
- this.addJointTriangles(v0, v0.computeParam(false, true, false, true), v0);
276
- if (jointAt1)
277
- this.addJointTriangles(v1, v1.computeParam(false, true, false, true), v1);
278
- }
279
- else {
280
- this._addVertex(v0, v0.computeParam(true));
281
- this._addVertex(v1, v1.computeParam(false));
282
- this._addVertex(v0, v0.computeParam(false));
283
- this._addVertex(v0, v0.computeParam(false));
284
- this._addVertex(v1, v1.computeParam(false));
285
- this._addVertex(v1, v1.computeParam(true));
286
- }
287
- }
288
- }
289
- }
290
- addJointTriangles(v0, p0, v1) {
291
- const param = v1.computeParam(false, false, true);
292
- for (let i = 0; i < 3; i++) {
293
- this._addVertex(v0, p0);
294
- this._addVertex(v1, param + i + 1);
295
- this._addVertex(v1, param + i);
296
- }
297
- }
298
- _dotProduct(v) {
299
- const pos = this._position[v.vertexIndex];
300
- const prevDir = core_geometry_1.Vector3d.createStartEnd(this._position[v.prevIndex], pos);
301
- const nextDir = core_geometry_1.Vector3d.createStartEnd(this._position[v.nextIndex], pos);
302
- return prevDir.dotProduct(nextDir);
303
- }
304
- _addVertex(vertex, param) {
305
- this._vertIndex[this._numIndices] = vertex.vertexIndex;
306
- this._prevIndex[this._numIndices] = vertex.prevIndex;
307
- this._nextIndex[this._numIndices] = vertex.nextIndex;
308
- this._nextParam[this._numIndices] = param;
309
- this._numIndices++;
310
- }
311
- }
312
- /** Strictly for tests. @internal */
313
- function tesselatePolyline(polylines, points, doJointTriangles) {
314
- const tesselator = new PolylineTesselator(polylines, points, doJointTriangles);
315
- return tesselator.tesselate();
316
- }
317
- exports.tesselatePolyline = tesselatePolyline;
318
- /** @internal */
319
- var SurfaceType;
320
- (function (SurfaceType) {
321
- SurfaceType[SurfaceType["Unlit"] = 0] = "Unlit";
322
- SurfaceType[SurfaceType["Lit"] = 1] = "Lit";
323
- SurfaceType[SurfaceType["Textured"] = 2] = "Textured";
324
- SurfaceType[SurfaceType["TexturedLit"] = 3] = "TexturedLit";
325
- SurfaceType[SurfaceType["VolumeClassifier"] = 4] = "VolumeClassifier";
326
- })(SurfaceType = exports.SurfaceType || (exports.SurfaceType = {}));
327
- /** @internal */
328
- function isValidSurfaceType(value) {
329
- switch (value) {
330
- case SurfaceType.Unlit:
331
- case SurfaceType.Lit:
332
- case SurfaceType.Textured:
333
- case SurfaceType.TexturedLit:
334
- case SurfaceType.VolumeClassifier:
335
- return true;
336
- default:
337
- return false;
338
- }
339
- }
340
- exports.isValidSurfaceType = isValidSurfaceType;
341
- /** @internal */
342
- function createSurfaceMaterial(source) {
343
- if (undefined === source)
344
- return undefined;
345
- else
346
- return { isAtlas: false, material: source };
347
- }
348
- exports.createSurfaceMaterial = createSurfaceMaterial;
349
- function convertPolylinesAndEdges(polylines, edges) {
350
- let numIndices = undefined !== edges ? edges.length : 0;
351
- if (undefined !== polylines)
352
- for (const pd of polylines)
353
- numIndices += (pd.vertIndices.length - 1);
354
- if (0 === numIndices)
355
- return undefined;
356
- numIndices *= 6;
357
- const indexBytes = new Uint8Array(numIndices * 3);
358
- const endPointAndQuadIndexBytes = new Uint8Array(numIndices * 4);
359
- let ndx = 0;
360
- let ndx2 = 0;
361
- const addPoint = (p0, p1, quadIndex) => {
362
- VertexIndices.encodeIndex(p0, indexBytes, ndx);
363
- ndx += 3;
364
- VertexIndices.encodeIndex(p1, endPointAndQuadIndexBytes, ndx2);
365
- endPointAndQuadIndexBytes[ndx2 + 3] = quadIndex;
366
- ndx2 += 4;
367
- };
368
- if (undefined !== polylines) {
369
- for (const pd of polylines) {
370
- const num = pd.vertIndices.length - 1;
371
- for (let i = 0; i < num; ++i) {
372
- let p0 = pd.vertIndices[i];
373
- let p1 = pd.vertIndices[i + 1];
374
- if (p1 < p0) { // swap so that lower index is first.
375
- p0 = p1;
376
- p1 = pd.vertIndices[i];
377
- }
378
- addPoint(p0, p1, 0);
379
- addPoint(p1, p0, 2);
380
- addPoint(p0, p1, 1);
381
- addPoint(p0, p1, 1);
382
- addPoint(p1, p0, 2);
383
- addPoint(p1, p0, 3);
384
- }
385
- }
386
- }
387
- if (undefined !== edges) {
388
- for (const meshEdge of edges) {
389
- const p0 = meshEdge.indices[0];
390
- const p1 = meshEdge.indices[1];
391
- addPoint(p0, p1, 0);
392
- addPoint(p1, p0, 2);
393
- addPoint(p0, p1, 1);
394
- addPoint(p0, p1, 1);
395
- addPoint(p1, p0, 2);
396
- addPoint(p1, p0, 3);
397
- }
398
- }
399
- return {
400
- indices: new VertexIndices(indexBytes),
401
- endPointAndQuadIndices: endPointAndQuadIndexBytes,
402
- };
403
- }
404
- function convertSilhouettes(edges, normalPairs) {
405
- const base = convertPolylinesAndEdges(undefined, edges);
406
- if (undefined === base)
407
- return undefined;
408
- const normalPairBytes = new Uint8Array(normalPairs.length * 6 * 4);
409
- const normalPair16 = new Uint16Array(normalPairBytes.buffer);
410
- let ndx = 0;
411
- for (const pair of normalPairs) {
412
- for (let i = 0; i < 6; i++) {
413
- normalPair16[ndx++] = pair.first.value;
414
- normalPair16[ndx++] = pair.second.value;
415
- }
416
- }
417
- return {
418
- indices: base.indices,
419
- endPointAndQuadIndices: base.endPointAndQuadIndices,
420
- normalPairs: normalPairBytes,
421
- };
422
- }
423
- function wantJointTriangles(weight, is2d) {
424
- // Joints are incredibly expensive. In 3d, only generate them if the line is sufficiently wide for them to be noticeable.
425
- const jointWidthThreshold = 3;
426
- return is2d || weight >= jointWidthThreshold;
427
- }
428
- function convertEdges(meshArgs) {
429
- const args = meshArgs.edges;
430
- if (undefined === args)
431
- return undefined;
432
- let polylines;
433
- let segments;
434
- if (wantJointTriangles(args.width, meshArgs.is2d)) {
435
- segments = convertPolylinesAndEdges(args.polylines.lines, args.edges.edges);
436
- }
437
- else {
438
- segments = convertPolylinesAndEdges(undefined, args.edges.edges);
439
- const tesselator = PolylineTesselator.fromMesh(meshArgs);
440
- if (undefined !== tesselator)
441
- polylines = tesselator.tesselate();
442
- }
443
- // ###TODO: why the heck are the edges and normals of SilhouetteEdgeArgs potentially undefined???
444
- const silhouettes = undefined !== args.silhouettes.edges && undefined !== args.silhouettes.normals ? convertSilhouettes(args.silhouettes.edges, args.silhouettes.normals) : undefined;
445
- if (undefined === segments && undefined === silhouettes && undefined === polylines)
446
- return undefined;
447
- return {
448
- weight: args.width,
449
- linePixels: args.linePixels,
450
- segments,
451
- silhouettes,
452
- polylines,
453
- };
454
- }
455
142
  /**
456
143
  * Describes mesh geometry to be submitted to the rendering system.
457
144
  * A mesh consists of a surface and its edges, which may include any combination of silhouettes, polylines, and single segments.
@@ -478,42 +165,14 @@ class MeshParams {
478
165
  hasBakedLighting: args.hasBakedLighting,
479
166
  hasFixedNormals: args.hasFixedNormals,
480
167
  textureMapping: undefined !== args.texture ? { texture: args.texture, alwaysDisplayed: false } : undefined,
481
- material: createSurfaceMaterial(args.material),
168
+ material: (0, SurfaceParams_1.createSurfaceMaterial)(args.material),
482
169
  };
483
170
  const channels = undefined !== args.auxChannels ? AuxChannelTable_1.AuxChannelTable.fromChannels(args.auxChannels, vertices.numVertices) : undefined;
484
- const edges = convertEdges(args);
171
+ const edges = EdgeParams_1.EdgeParams.fromMeshArgs(args);
485
172
  return new MeshParams(vertices, surface, edges, args.isPlanar, channels);
486
173
  }
487
174
  }
488
175
  exports.MeshParams = MeshParams;
489
- /**
490
- * Describes a set of tesselated polylines.
491
- * Each segment of each polyline is triangulated into a quad. Additional triangles may be inserted
492
- * between segments to enable rounded corners.
493
- */
494
- class PolylineParams {
495
- /** Directly construct a PolylineParams. The PolylineParams takes ownership of all input data. */
496
- constructor(vertices, polyline, weight, linePixels, isPlanar, type = core_common_1.PolylineTypeFlags.Normal) {
497
- this.vertices = vertices;
498
- this.polyline = polyline;
499
- this.isPlanar = isPlanar;
500
- this.weight = weight;
501
- this.linePixels = linePixels;
502
- this.type = type;
503
- }
504
- /** Construct from an PolylineArgs. */
505
- static create(args) {
506
- (0, core_bentley_1.assert)(!args.flags.isDisjoint);
507
- const vertices = VertexTable.createForPolylines(args);
508
- if (undefined === vertices)
509
- return undefined;
510
- const tesselator = PolylineTesselator.fromPolyline(args);
511
- if (undefined === tesselator)
512
- return undefined;
513
- return new PolylineParams(vertices, tesselator.tesselate(), args.width, args.linePixels, args.flags.isPlanar, args.flags.type);
514
- }
515
- }
516
- exports.PolylineParams = PolylineParams;
517
176
  /** Builds a VertexTable from some data type supplying the vertex data. */
518
177
  class VertexTableBuilder {
519
178
  constructor() {
@@ -626,7 +285,7 @@ class MeshBuilder extends SimpleBuilder {
626
285
  }
627
286
  static create(args) {
628
287
  if (args.isVolumeClassifier)
629
- return new MeshBuilder(args, SurfaceType.VolumeClassifier);
288
+ return new MeshBuilder(args, SurfaceParams_1.SurfaceType.VolumeClassifier);
630
289
  const isLit = undefined !== args.normals && 0 < args.normals.length;
631
290
  const isTextured = undefined !== args.texture;
632
291
  let uvParams;
@@ -642,7 +301,7 @@ class MeshBuilder extends SimpleBuilder {
642
301
  if (isLit)
643
302
  return isTextured ? new TexturedLitMeshBuilder(args, uvParams) : new LitMeshBuilder(args);
644
303
  else
645
- return isTextured ? new TexturedMeshBuilder(args, uvParams) : new MeshBuilder(args, SurfaceType.Unlit);
304
+ return isTextured ? new TexturedMeshBuilder(args, uvParams) : new MeshBuilder(args, SurfaceParams_1.SurfaceType.Unlit);
646
305
  }
647
306
  }
648
307
  /** Supplies vertex data from a MeshArgs where each vertex consists of 16 bytes.
@@ -650,7 +309,7 @@ class MeshBuilder extends SimpleBuilder {
650
309
  * The color index is left uninitialized as it is unused.
651
310
  */
652
311
  class TexturedMeshBuilder extends MeshBuilder {
653
- constructor(args, qparams, type = SurfaceType.Textured) {
312
+ constructor(args, qparams, type = SurfaceParams_1.SurfaceType.Textured) {
654
313
  super(args, type);
655
314
  this._qpoint = new core_common_1.QPoint2d();
656
315
  this._qparams = qparams;
@@ -674,7 +333,7 @@ class TexturedMeshBuilder extends MeshBuilder {
674
333
  /** As with TexturedMeshBuilder, but the color index is replaced with the oct-encoded normal value. */
675
334
  class TexturedLitMeshBuilder extends TexturedMeshBuilder {
676
335
  constructor(args, qparams) {
677
- super(args, qparams, SurfaceType.TexturedLit);
336
+ super(args, qparams, SurfaceParams_1.SurfaceType.TexturedLit);
678
337
  (0, core_bentley_1.assert)(undefined !== args.normals);
679
338
  }
680
339
  appendNormal(vertIndex) { this.append16(this.args.normals[vertIndex].value); }
@@ -682,7 +341,7 @@ class TexturedLitMeshBuilder extends TexturedMeshBuilder {
682
341
  /** 16 bytes. The last 2 bytes are unused; the 2 immediately preceding it hold the oct-encoded normal value. */
683
342
  class LitMeshBuilder extends MeshBuilder {
684
343
  constructor(args) {
685
- super(args, SurfaceType.Lit);
344
+ super(args, SurfaceParams_1.SurfaceType.Lit);
686
345
  (0, core_bentley_1.assert)(undefined !== args.normals);
687
346
  }
688
347
  get numRgbaPerVertex() { return 4; }