@itwin/core-common 3.0.0-extension.1 → 3.1.0-dev.0

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 (245) hide show
  1. package/CHANGELOG.md +84 -1
  2. package/LICENSE.md +1 -1
  3. package/lib/cjs/BackgroundMapSettings.d.ts +1 -1
  4. package/lib/cjs/BackgroundMapSettings.d.ts.map +1 -1
  5. package/lib/cjs/BackgroundMapSettings.js.map +1 -1
  6. package/lib/cjs/ConcurrentQuery.d.ts +28 -11
  7. package/lib/cjs/ConcurrentQuery.d.ts.map +1 -1
  8. package/lib/cjs/ConcurrentQuery.js +26 -12
  9. package/lib/cjs/ConcurrentQuery.js.map +1 -1
  10. package/lib/cjs/ContextRealityModel.d.ts +36 -16
  11. package/lib/cjs/ContextRealityModel.d.ts.map +1 -1
  12. package/lib/cjs/ContextRealityModel.js +46 -7
  13. package/lib/cjs/ContextRealityModel.js.map +1 -1
  14. package/lib/cjs/DisplayStyleSettings.d.ts +30 -24
  15. package/lib/cjs/DisplayStyleSettings.d.ts.map +1 -1
  16. package/lib/cjs/DisplayStyleSettings.js +43 -16
  17. package/lib/cjs/DisplayStyleSettings.js.map +1 -1
  18. package/lib/cjs/ECSqlReader.d.ts +17 -5
  19. package/lib/cjs/ECSqlReader.d.ts.map +1 -1
  20. package/lib/cjs/ECSqlReader.js +55 -22
  21. package/lib/cjs/ECSqlReader.js.map +1 -1
  22. package/lib/cjs/ECSqlTypes.d.ts +3 -3
  23. package/lib/cjs/ECSqlTypes.js +3 -3
  24. package/lib/cjs/ECSqlTypes.js.map +1 -1
  25. package/lib/cjs/Environment.d.ts +61 -0
  26. package/lib/cjs/Environment.d.ts.map +1 -0
  27. package/lib/cjs/Environment.js +74 -0
  28. package/lib/cjs/Environment.js.map +1 -0
  29. package/lib/cjs/FeatureSymbology.d.ts +97 -18
  30. package/lib/cjs/FeatureSymbology.d.ts.map +1 -1
  31. package/lib/cjs/FeatureSymbology.js +83 -27
  32. package/lib/cjs/FeatureSymbology.js.map +1 -1
  33. package/lib/cjs/GeoCoordinateServices.d.ts +66 -1
  34. package/lib/cjs/GeoCoordinateServices.d.ts.map +1 -1
  35. package/lib/cjs/GeoCoordinateServices.js +39 -1
  36. package/lib/cjs/GeoCoordinateServices.js.map +1 -1
  37. package/lib/cjs/Gradient.d.ts.map +1 -1
  38. package/lib/cjs/Gradient.js +10 -0
  39. package/lib/cjs/Gradient.js.map +1 -1
  40. package/lib/cjs/GroundPlane.d.ts +26 -15
  41. package/lib/cjs/GroundPlane.d.ts.map +1 -1
  42. package/lib/cjs/GroundPlane.js +40 -39
  43. package/lib/cjs/GroundPlane.js.map +1 -1
  44. package/lib/cjs/IModel.d.ts +33 -4
  45. package/lib/cjs/IModel.d.ts.map +1 -1
  46. package/lib/cjs/IModel.js +27 -10
  47. package/lib/cjs/IModel.js.map +1 -1
  48. package/lib/cjs/Localization.d.ts +1 -1
  49. package/lib/cjs/Localization.js.map +1 -1
  50. package/lib/cjs/MapLayerSettings.d.ts +2 -2
  51. package/lib/cjs/MapLayerSettings.js +2 -2
  52. package/lib/cjs/MapLayerSettings.js.map +1 -1
  53. package/lib/cjs/NativeAppProps.d.ts +2 -36
  54. package/lib/cjs/NativeAppProps.d.ts.map +1 -1
  55. package/lib/cjs/NativeAppProps.js.map +1 -1
  56. package/lib/cjs/PlanarClipMask.d.ts +73 -8
  57. package/lib/cjs/PlanarClipMask.d.ts.map +1 -1
  58. package/lib/cjs/PlanarClipMask.js +17 -24
  59. package/lib/cjs/PlanarClipMask.js.map +1 -1
  60. package/lib/cjs/RealityDataAccessProps.d.ts +42 -0
  61. package/lib/cjs/RealityDataAccessProps.d.ts.map +1 -0
  62. package/lib/cjs/RealityDataAccessProps.js +20 -0
  63. package/lib/cjs/RealityDataAccessProps.js.map +1 -0
  64. package/lib/cjs/RenderSchedule.d.ts +4 -0
  65. package/lib/cjs/RenderSchedule.d.ts.map +1 -1
  66. package/lib/cjs/RenderSchedule.js +5 -1
  67. package/lib/cjs/RenderSchedule.js.map +1 -1
  68. package/lib/cjs/RenderTexture.d.ts +8 -1
  69. package/lib/cjs/RenderTexture.d.ts.map +1 -1
  70. package/lib/cjs/RenderTexture.js.map +1 -1
  71. package/lib/cjs/SkyBox.d.ts +142 -34
  72. package/lib/cjs/SkyBox.d.ts.map +1 -1
  73. package/lib/cjs/SkyBox.js +192 -6
  74. package/lib/cjs/SkyBox.js.map +1 -1
  75. package/lib/cjs/TextureProps.d.ts +21 -2
  76. package/lib/cjs/TextureProps.d.ts.map +1 -1
  77. package/lib/cjs/TextureProps.js +19 -0
  78. package/lib/cjs/TextureProps.js.map +1 -1
  79. package/lib/cjs/ThematicDisplay.d.ts +6 -0
  80. package/lib/cjs/ThematicDisplay.d.ts.map +1 -1
  81. package/lib/cjs/ThematicDisplay.js +26 -0
  82. package/lib/cjs/ThematicDisplay.js.map +1 -1
  83. package/lib/cjs/TileProps.d.ts +6 -0
  84. package/lib/cjs/TileProps.d.ts.map +1 -1
  85. package/lib/cjs/TileProps.js.map +1 -1
  86. package/lib/cjs/ViewFlags.d.ts +8 -0
  87. package/lib/cjs/ViewFlags.d.ts.map +1 -1
  88. package/lib/cjs/ViewFlags.js +30 -10
  89. package/lib/cjs/ViewFlags.js.map +1 -1
  90. package/lib/cjs/core-common.d.ts +7 -0
  91. package/lib/cjs/core-common.d.ts.map +1 -1
  92. package/lib/cjs/core-common.js +7 -0
  93. package/lib/cjs/core-common.js.map +1 -1
  94. package/lib/cjs/geometry/FrustumPlanes.d.ts +1 -1
  95. package/lib/cjs/geometry/FrustumPlanes.d.ts.map +1 -1
  96. package/lib/cjs/geometry/FrustumPlanes.js +26 -13
  97. package/lib/cjs/geometry/FrustumPlanes.js.map +1 -1
  98. package/lib/cjs/ipc/IpcWebSocket.d.ts +12 -5
  99. package/lib/cjs/ipc/IpcWebSocket.d.ts.map +1 -1
  100. package/lib/cjs/ipc/IpcWebSocket.js +32 -8
  101. package/lib/cjs/ipc/IpcWebSocket.js.map +1 -1
  102. package/lib/cjs/ipc/IpcWebSocketTransport.d.ts +15 -0
  103. package/lib/cjs/ipc/IpcWebSocketTransport.d.ts.map +1 -0
  104. package/lib/cjs/ipc/IpcWebSocketTransport.js +142 -0
  105. package/lib/cjs/ipc/IpcWebSocketTransport.js.map +1 -0
  106. package/lib/cjs/rpc/core/RpcInvocation.d.ts +4 -4
  107. package/lib/cjs/rpc/core/RpcInvocation.d.ts.map +1 -1
  108. package/lib/cjs/rpc/core/RpcInvocation.js +3 -1
  109. package/lib/cjs/rpc/core/RpcInvocation.js.map +1 -1
  110. package/lib/cjs/rpc/web/BentleyCloudRpcProtocol.d.ts.map +1 -1
  111. package/lib/cjs/rpc/web/BentleyCloudRpcProtocol.js +3 -2
  112. package/lib/cjs/rpc/web/BentleyCloudRpcProtocol.js.map +1 -1
  113. package/lib/cjs/tile/ElementGraphics.d.ts +5 -1
  114. package/lib/cjs/tile/ElementGraphics.d.ts.map +1 -1
  115. package/lib/cjs/tile/ElementGraphics.js.map +1 -1
  116. package/lib/cjs/tile/GltfTileIO.d.ts +16 -79
  117. package/lib/cjs/tile/GltfTileIO.d.ts.map +1 -1
  118. package/lib/cjs/tile/GltfTileIO.js +72 -153
  119. package/lib/cjs/tile/GltfTileIO.js.map +1 -1
  120. package/lib/cjs/tile/TileMetadata.d.ts +20 -8
  121. package/lib/cjs/tile/TileMetadata.d.ts.map +1 -1
  122. package/lib/cjs/tile/TileMetadata.js +50 -53
  123. package/lib/cjs/tile/TileMetadata.js.map +1 -1
  124. package/lib/esm/BackgroundMapSettings.d.ts +1 -1
  125. package/lib/esm/BackgroundMapSettings.d.ts.map +1 -1
  126. package/lib/esm/BackgroundMapSettings.js.map +1 -1
  127. package/lib/esm/ConcurrentQuery.d.ts +28 -11
  128. package/lib/esm/ConcurrentQuery.d.ts.map +1 -1
  129. package/lib/esm/ConcurrentQuery.js +26 -12
  130. package/lib/esm/ConcurrentQuery.js.map +1 -1
  131. package/lib/esm/ContextRealityModel.d.ts +36 -16
  132. package/lib/esm/ContextRealityModel.d.ts.map +1 -1
  133. package/lib/esm/ContextRealityModel.js +45 -6
  134. package/lib/esm/ContextRealityModel.js.map +1 -1
  135. package/lib/esm/DisplayStyleSettings.d.ts +30 -24
  136. package/lib/esm/DisplayStyleSettings.d.ts.map +1 -1
  137. package/lib/esm/DisplayStyleSettings.js +43 -16
  138. package/lib/esm/DisplayStyleSettings.js.map +1 -1
  139. package/lib/esm/ECSqlReader.d.ts +17 -5
  140. package/lib/esm/ECSqlReader.d.ts.map +1 -1
  141. package/lib/esm/ECSqlReader.js +56 -23
  142. package/lib/esm/ECSqlReader.js.map +1 -1
  143. package/lib/esm/ECSqlTypes.d.ts +3 -3
  144. package/lib/esm/ECSqlTypes.js +3 -3
  145. package/lib/esm/ECSqlTypes.js.map +1 -1
  146. package/lib/esm/Environment.d.ts +61 -0
  147. package/lib/esm/Environment.d.ts.map +1 -0
  148. package/lib/esm/Environment.js +70 -0
  149. package/lib/esm/Environment.js.map +1 -0
  150. package/lib/esm/FeatureSymbology.d.ts +97 -18
  151. package/lib/esm/FeatureSymbology.d.ts.map +1 -1
  152. package/lib/esm/FeatureSymbology.js +84 -28
  153. package/lib/esm/FeatureSymbology.js.map +1 -1
  154. package/lib/esm/GeoCoordinateServices.d.ts +66 -1
  155. package/lib/esm/GeoCoordinateServices.d.ts.map +1 -1
  156. package/lib/esm/GeoCoordinateServices.js +39 -1
  157. package/lib/esm/GeoCoordinateServices.js.map +1 -1
  158. package/lib/esm/Gradient.d.ts.map +1 -1
  159. package/lib/esm/Gradient.js +10 -0
  160. package/lib/esm/Gradient.js.map +1 -1
  161. package/lib/esm/GroundPlane.d.ts +26 -15
  162. package/lib/esm/GroundPlane.d.ts.map +1 -1
  163. package/lib/esm/GroundPlane.js +40 -39
  164. package/lib/esm/GroundPlane.js.map +1 -1
  165. package/lib/esm/IModel.d.ts +33 -4
  166. package/lib/esm/IModel.d.ts.map +1 -1
  167. package/lib/esm/IModel.js +27 -10
  168. package/lib/esm/IModel.js.map +1 -1
  169. package/lib/esm/Localization.d.ts +1 -1
  170. package/lib/esm/Localization.js.map +1 -1
  171. package/lib/esm/MapLayerSettings.d.ts +2 -2
  172. package/lib/esm/MapLayerSettings.js +2 -2
  173. package/lib/esm/MapLayerSettings.js.map +1 -1
  174. package/lib/esm/NativeAppProps.d.ts +2 -36
  175. package/lib/esm/NativeAppProps.d.ts.map +1 -1
  176. package/lib/esm/NativeAppProps.js.map +1 -1
  177. package/lib/esm/PlanarClipMask.d.ts +73 -8
  178. package/lib/esm/PlanarClipMask.d.ts.map +1 -1
  179. package/lib/esm/PlanarClipMask.js +17 -24
  180. package/lib/esm/PlanarClipMask.js.map +1 -1
  181. package/lib/esm/RealityDataAccessProps.d.ts +42 -0
  182. package/lib/esm/RealityDataAccessProps.d.ts.map +1 -0
  183. package/lib/esm/RealityDataAccessProps.js +17 -0
  184. package/lib/esm/RealityDataAccessProps.js.map +1 -0
  185. package/lib/esm/RenderSchedule.d.ts +4 -0
  186. package/lib/esm/RenderSchedule.d.ts.map +1 -1
  187. package/lib/esm/RenderSchedule.js +5 -1
  188. package/lib/esm/RenderSchedule.js.map +1 -1
  189. package/lib/esm/RenderTexture.d.ts +8 -1
  190. package/lib/esm/RenderTexture.d.ts.map +1 -1
  191. package/lib/esm/RenderTexture.js.map +1 -1
  192. package/lib/esm/SkyBox.d.ts +142 -34
  193. package/lib/esm/SkyBox.d.ts.map +1 -1
  194. package/lib/esm/SkyBox.js +187 -5
  195. package/lib/esm/SkyBox.js.map +1 -1
  196. package/lib/esm/TextureProps.d.ts +21 -2
  197. package/lib/esm/TextureProps.d.ts.map +1 -1
  198. package/lib/esm/TextureProps.js +18 -1
  199. package/lib/esm/TextureProps.js.map +1 -1
  200. package/lib/esm/ThematicDisplay.d.ts +6 -0
  201. package/lib/esm/ThematicDisplay.d.ts.map +1 -1
  202. package/lib/esm/ThematicDisplay.js +26 -0
  203. package/lib/esm/ThematicDisplay.js.map +1 -1
  204. package/lib/esm/TileProps.d.ts +6 -0
  205. package/lib/esm/TileProps.d.ts.map +1 -1
  206. package/lib/esm/TileProps.js.map +1 -1
  207. package/lib/esm/ViewFlags.d.ts +8 -0
  208. package/lib/esm/ViewFlags.d.ts.map +1 -1
  209. package/lib/esm/ViewFlags.js +30 -10
  210. package/lib/esm/ViewFlags.js.map +1 -1
  211. package/lib/esm/core-common.d.ts +7 -0
  212. package/lib/esm/core-common.d.ts.map +1 -1
  213. package/lib/esm/core-common.js +7 -0
  214. package/lib/esm/core-common.js.map +1 -1
  215. package/lib/esm/geometry/FrustumPlanes.d.ts +1 -1
  216. package/lib/esm/geometry/FrustumPlanes.d.ts.map +1 -1
  217. package/lib/esm/geometry/FrustumPlanes.js +26 -13
  218. package/lib/esm/geometry/FrustumPlanes.js.map +1 -1
  219. package/lib/esm/ipc/IpcWebSocket.d.ts +12 -5
  220. package/lib/esm/ipc/IpcWebSocket.d.ts.map +1 -1
  221. package/lib/esm/ipc/IpcWebSocket.js +31 -6
  222. package/lib/esm/ipc/IpcWebSocket.js.map +1 -1
  223. package/lib/esm/ipc/IpcWebSocketTransport.d.ts +15 -0
  224. package/lib/esm/ipc/IpcWebSocketTransport.d.ts.map +1 -0
  225. package/lib/esm/ipc/IpcWebSocketTransport.js +138 -0
  226. package/lib/esm/ipc/IpcWebSocketTransport.js.map +1 -0
  227. package/lib/esm/rpc/core/RpcInvocation.d.ts +4 -4
  228. package/lib/esm/rpc/core/RpcInvocation.d.ts.map +1 -1
  229. package/lib/esm/rpc/core/RpcInvocation.js +3 -1
  230. package/lib/esm/rpc/core/RpcInvocation.js.map +1 -1
  231. package/lib/esm/rpc/web/BentleyCloudRpcProtocol.d.ts.map +1 -1
  232. package/lib/esm/rpc/web/BentleyCloudRpcProtocol.js +2 -1
  233. package/lib/esm/rpc/web/BentleyCloudRpcProtocol.js.map +1 -1
  234. package/lib/esm/tile/ElementGraphics.d.ts +5 -1
  235. package/lib/esm/tile/ElementGraphics.d.ts.map +1 -1
  236. package/lib/esm/tile/ElementGraphics.js.map +1 -1
  237. package/lib/esm/tile/GltfTileIO.d.ts +16 -79
  238. package/lib/esm/tile/GltfTileIO.d.ts.map +1 -1
  239. package/lib/esm/tile/GltfTileIO.js +70 -149
  240. package/lib/esm/tile/GltfTileIO.js.map +1 -1
  241. package/lib/esm/tile/TileMetadata.d.ts +20 -8
  242. package/lib/esm/tile/TileMetadata.d.ts.map +1 -1
  243. package/lib/esm/tile/TileMetadata.js +50 -53
  244. package/lib/esm/tile/TileMetadata.js.map +1 -1
  245. package/package.json +9 -10
@@ -5,6 +5,7 @@
5
5
  /** @packageDocumentation
6
6
  * @module Tile
7
7
  */
8
+ import { assert } from "@itwin/core-bentley";
8
9
  import { TileFormat, TileHeader } from "./TileIO";
9
10
  /** Known version of the [glTF format](https://www.khronos.org/gltf/).
10
11
  * @internal
@@ -22,164 +23,84 @@ export var GltfV2ChunkTypes;
22
23
  GltfV2ChunkTypes[GltfV2ChunkTypes["JSON"] = 1313821514] = "JSON";
23
24
  GltfV2ChunkTypes[GltfV2ChunkTypes["Binary"] = 5130562] = "Binary";
24
25
  })(GltfV2ChunkTypes || (GltfV2ChunkTypes = {}));
25
- /** @internal */
26
- export var GltfMeshMode;
27
- (function (GltfMeshMode) {
28
- GltfMeshMode[GltfMeshMode["Points"] = 0] = "Points";
29
- GltfMeshMode[GltfMeshMode["Lines"] = 1] = "Lines";
30
- GltfMeshMode[GltfMeshMode["LineStrip"] = 3] = "LineStrip";
31
- GltfMeshMode[GltfMeshMode["Triangles"] = 4] = "Triangles";
32
- })(GltfMeshMode || (GltfMeshMode = {}));
33
- /** @internal */
34
- export var GltfDataType;
35
- (function (GltfDataType) {
36
- GltfDataType[GltfDataType["SignedByte"] = 5120] = "SignedByte";
37
- GltfDataType[GltfDataType["UnsignedByte"] = 5121] = "UnsignedByte";
38
- GltfDataType[GltfDataType["SignedShort"] = 5122] = "SignedShort";
39
- GltfDataType[GltfDataType["UnsignedShort"] = 5123] = "UnsignedShort";
40
- GltfDataType[GltfDataType["UInt32"] = 5125] = "UInt32";
41
- GltfDataType[GltfDataType["Float"] = 5126] = "Float";
42
- GltfDataType[GltfDataType["Rgb"] = 6407] = "Rgb";
43
- GltfDataType[GltfDataType["Rgba"] = 6408] = "Rgba";
44
- GltfDataType[GltfDataType["IntVec2"] = 35667] = "IntVec2";
45
- GltfDataType[GltfDataType["IntVec3"] = 35668] = "IntVec3";
46
- GltfDataType[GltfDataType["FloatVec2"] = 35664] = "FloatVec2";
47
- GltfDataType[GltfDataType["FloatVec3"] = 35665] = "FloatVec3";
48
- GltfDataType[GltfDataType["FloatVec4"] = 35666] = "FloatVec4";
49
- GltfDataType[GltfDataType["FloatMat3"] = 35675] = "FloatMat3";
50
- GltfDataType[GltfDataType["FloatMat4"] = 35676] = "FloatMat4";
51
- GltfDataType[GltfDataType["Sampler2d"] = 35678] = "Sampler2d";
52
- })(GltfDataType || (GltfDataType = {}));
53
- /** @internal */
54
- export var GltfConstants;
55
- (function (GltfConstants) {
56
- GltfConstants[GltfConstants["CullFace"] = 2884] = "CullFace";
57
- GltfConstants[GltfConstants["DepthTest"] = 2929] = "DepthTest";
58
- GltfConstants[GltfConstants["Nearest"] = 9728] = "Nearest";
59
- GltfConstants[GltfConstants["Linear"] = 9729] = "Linear";
60
- GltfConstants[GltfConstants["LinearMipmapLinear"] = 9987] = "LinearMipmapLinear";
61
- GltfConstants[GltfConstants["ClampToEdge"] = 33071] = "ClampToEdge";
62
- GltfConstants[GltfConstants["ArrayBuffer"] = 34962] = "ArrayBuffer";
63
- GltfConstants[GltfConstants["ElementArrayBuffer"] = 34963] = "ElementArrayBuffer";
64
- GltfConstants[GltfConstants["FragmentShader"] = 35632] = "FragmentShader";
65
- GltfConstants[GltfConstants["VertexShader"] = 35633] = "VertexShader";
66
- })(GltfConstants || (GltfConstants = {}));
67
- /**
68
- * A chunk of binary data exposed as a typed array.
69
- * The count member indicates how many elements exist. This may be less than this.buffer.length due to padding added to the
70
- * binary stream to ensure correct alignment.
71
- * @internal
72
- */
73
- export class GltfBufferData {
74
- constructor(buffer, count) {
75
- this.buffer = buffer;
76
- this.count = count;
77
- }
78
- /**
79
- * Create a GltfBufferData of the desired type. The actual type may differ from the desired type - for example, small 32-bit integers
80
- * may be represented as 8-bit or 16-bit integers instead.
81
- * If the actual data type is not convertible to the desired type, this function returns undefined.
82
- */
83
- static create(bytes, actualType, expectedType, count) {
84
- if (expectedType !== actualType) {
85
- // Some data is stored in smaller data types to save space if no values exceed the maximum of the smaller type.
86
- switch (expectedType) {
87
- case GltfDataType.Float:
88
- case GltfDataType.UnsignedByte:
89
- return undefined;
90
- case GltfDataType.UnsignedShort:
91
- if (GltfDataType.UnsignedByte !== actualType)
92
- return undefined;
93
- break;
94
- case GltfDataType.UInt32:
95
- if (GltfDataType.UnsignedByte !== actualType && GltfDataType.UnsignedShort !== actualType)
96
- return undefined;
97
- break;
98
- }
99
- }
100
- const data = this.createDataBuffer(bytes, actualType);
101
- return undefined !== data ? new GltfBufferData(data, count) : undefined;
102
- }
103
- static createDataBuffer(bytes, actualType) {
104
- // NB: Endianness of typed array data is determined by the 'platform byte order'. Actual data is always little-endian.
105
- // We are assuming little-endian platform. If we find a big-endian platform, we'll need to use a DataView instead.
106
- switch (actualType) {
107
- case GltfDataType.UnsignedByte:
108
- return bytes;
109
- case GltfDataType.UnsignedShort:
110
- return new Uint16Array(bytes.buffer, bytes.byteOffset, bytes.byteLength / 2);
111
- case GltfDataType.UInt32:
112
- return new Uint32Array(bytes.buffer, bytes.byteOffset, bytes.byteLength / 4);
113
- case GltfDataType.Float:
114
- return new Float32Array(bytes.buffer, bytes.byteOffset, bytes.byteLength / 4);
115
- default:
116
- return undefined;
117
- }
118
- }
119
- }
120
- /**
121
- * A view of a chunk of glTF binary data containing an array of elements of a specific data type.
122
- * The count member indicates how many elements exist; this may be smaller than this.data.length.
123
- * The count member may also indicate the number of elements of a type containing more than one value of the
124
- * underlying type. For example, a buffer of 4 32-bit floating point 'vec2' elements will have a count of 4,
125
- * but its data member will contain 8 32-bit floating point values (2 per vec2).
126
- * The accessor member may contain additional JSON data specific to a particular buffer.
127
- * @internal
128
- */
129
- export class GltfBufferView {
130
- constructor(data, count, type, accessor, stride) {
131
- this.data = data;
132
- this.count = count;
133
- this.type = type;
134
- this.accessor = accessor;
135
- this.stride = stride;
136
- }
137
- get byteLength() { return this.data.length; }
138
- toBufferData(desiredType) {
139
- return GltfBufferData.create(this.data, this.type, desiredType, this.count);
140
- }
26
+ function consumeNextChunk(stream) {
27
+ if (stream.isAtTheEnd)
28
+ return undefined;
29
+ const offset = stream.curPos + 8;
30
+ const length = stream.nextUint32;
31
+ const type = stream.nextUint32;
32
+ stream.advance(length);
33
+ return stream.isPastTheEnd ? false : { offset, length, type };
141
34
  }
142
- /** Header preceding glTF data.
143
- * @internal
144
- */
145
- export class GltfHeader extends TileHeader {
35
+ /** @internal */
36
+ export class GlbHeader extends TileHeader {
146
37
  constructor(stream) {
147
38
  super(stream);
148
- this.scenePosition = 0;
149
- this.sceneStrLength = 0;
150
- this.binaryPosition = 0;
39
+ this.gltfLength = 0;
40
+ this.jsonChunk = { offset: 0, length: 0 };
41
+ this.additionalChunks = [];
151
42
  this.gltfLength = stream.nextUint32;
152
- this.sceneStrLength = stream.nextUint32;
153
- const value5 = stream.nextUint32;
43
+ const jsonLength = stream.nextUint32;
44
+ const word5 = stream.nextUint32;
154
45
  // Early versions of the reality data tile publisher incorrectly put version 2 into header - handle these old tiles
155
46
  // validating the chunk type.
156
- if (this.version === GltfVersions.Version2 && value5 === GltfVersions.Gltf1SceneFormat)
47
+ if (this.version === GltfVersions.Version2 && word5 === GltfVersions.Gltf1SceneFormat)
157
48
  this.version = GltfVersions.Version1;
158
- if (this.version === GltfVersions.Version1) {
159
- const gltfSceneFormat = value5;
160
- if (GltfVersions.Gltf1SceneFormat !== gltfSceneFormat) {
161
- this.invalidate();
162
- return;
163
- }
164
- this.scenePosition = stream.curPos;
165
- this.binaryPosition = stream.curPos + this.sceneStrLength;
166
- }
167
- else if (this.version === GltfVersions.Version2) {
168
- const sceneChunkType = value5;
169
- this.scenePosition = stream.curPos;
170
- stream.curPos = stream.curPos + this.sceneStrLength;
171
- const binaryLength = stream.nextUint32;
172
- const binaryChunkType = stream.nextUint32;
173
- if (GltfV2ChunkTypes.JSON !== sceneChunkType || GltfV2ChunkTypes.Binary !== binaryChunkType || 0 === binaryLength) {
49
+ this.jsonChunk = { offset: stream.curPos, length: jsonLength };
50
+ switch (this.version) {
51
+ case GltfVersions.Version1:
52
+ if (GltfVersions.Gltf1SceneFormat !== word5) {
53
+ this.invalidate();
54
+ return;
55
+ }
56
+ const binaryOffset = stream.curPos + jsonLength;
57
+ this.binaryChunk = { offset: binaryOffset, length: this.gltfLength - binaryOffset };
58
+ break;
59
+ case GltfVersions.Version2:
60
+ if (word5 !== GltfV2ChunkTypes.JSON) {
61
+ this.invalidate();
62
+ return;
63
+ }
64
+ stream.advance(jsonLength);
65
+ if (stream.isPastTheEnd) {
66
+ this.invalidate();
67
+ return;
68
+ }
69
+ let chunk;
70
+ while (chunk = consumeNextChunk(stream)) {
71
+ switch (chunk.type) {
72
+ case GltfV2ChunkTypes.JSON:
73
+ // Only one JSON chunk permitted and it must be the first.
74
+ this.invalidate();
75
+ return;
76
+ case GltfV2ChunkTypes.Binary:
77
+ // At most one binary chunk permitted and it must be the second if present.
78
+ if (this.binaryChunk || this.additionalChunks.length) {
79
+ this.invalidate();
80
+ return;
81
+ }
82
+ this.binaryChunk = { offset: chunk.offset, length: chunk.length };
83
+ break;
84
+ default:
85
+ // Any other chunk type should be ignored - for use by extensions.
86
+ this.additionalChunks.push(chunk);
87
+ break;
88
+ }
89
+ }
90
+ if (false === chunk) {
91
+ this.invalidate();
92
+ return;
93
+ }
94
+ assert(undefined === chunk);
95
+ assert(stream.isAtTheEnd);
96
+ break;
97
+ default:
174
98
  this.invalidate();
175
- return;
176
- }
177
- this.binaryPosition = stream.curPos;
178
- }
179
- else {
180
- this.invalidate();
99
+ break;
181
100
  }
182
101
  }
183
- get isValid() { return TileFormat.Gltf === this.format; }
102
+ get isValid() {
103
+ return TileFormat.Gltf === this.format;
104
+ }
184
105
  }
185
106
  //# sourceMappingURL=GltfTileIO.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"GltfTileIO.js","sourceRoot":"","sources":["../../../src/tile/GltfTileIO.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAGH,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAElD;;GAEG;AACH,MAAM,CAAN,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,uDAAY,CAAA;IACZ,uDAAY,CAAA;IACZ,mEAAyB,CAAA;IACzB,uEAAoB,CAAA;AACtB,CAAC,EALW,YAAY,KAAZ,YAAY,QAKvB;AAED,gBAAgB;AAChB,MAAM,CAAN,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IAC1B,gEAAiB,CAAA;IACjB,iEAAmB,CAAA;AACrB,CAAC,EAHW,gBAAgB,KAAhB,gBAAgB,QAG3B;AAED,gBAAgB;AAChB,MAAM,CAAN,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,mDAAU,CAAA;IACV,iDAAS,CAAA;IACT,yDAAa,CAAA;IACb,yDAAa,CAAA;AACf,CAAC,EALW,YAAY,KAAZ,YAAY,QAKvB;AAED,gBAAgB;AAChB,MAAM,CAAN,IAAY,YAiBX;AAjBD,WAAY,YAAY;IACtB,8DAAmB,CAAA;IACnB,kEAAqB,CAAA;IACrB,gEAAkB,CAAA;IAClB,oEAAoB,CAAA;IACpB,sDAAa,CAAA;IACb,oDAAY,CAAA;IACZ,gDAAU,CAAA;IACV,kDAAW,CAAA;IACX,yDAAgB,CAAA;IAChB,yDAAgB,CAAA;IAChB,6DAAiB,CAAA;IACjB,6DAAiB,CAAA;IACjB,6DAAiB,CAAA;IACjB,6DAAiB,CAAA;IACjB,6DAAiB,CAAA;IACjB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UAAU,CAAC;YACvC,MAAM,eAAe,GAAG,MAAM,CAAC,UAAU,CAAC;YAC1C,IAAI,gBAAgB,CAAC,IAAI,KAAK,cAAc,IAAI,gBAAgB,CAAC,MAAM,KAAK,eAAe,IAAI,CAAC,KAAK,YAAY,EAAE;gBACjH,IAAI,CAAC,UAAU,EAAE,CAAC;gBAClB,OAAO;aACR;YAED,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC;SACrC;aAAM;YACL,IAAI,CAAC,UAAU,EAAE,CAAC;SACnB;IACH,CAAC;IArCD,IAAW,OAAO,KAAc,OAAO,UAAU,CAAC,IAAI,KAAK,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;CAsC1E","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Tile\r\n */\r\n\r\nimport { ByteStream } from \"@itwin/core-bentley\";\r\nimport { TileFormat, TileHeader } from \"./TileIO\";\r\n\r\n/** Known version of the [glTF format](https://www.khronos.org/gltf/).\r\n * @internal\r\n */\r\nexport enum GltfVersions {\r\n Version1 = 1,\r\n Version2 = 2,\r\n CurrentVersion = Version1,\r\n Gltf1SceneFormat = 0,\r\n}\r\n\r\n/** @internal */\r\nexport enum GltfV2ChunkTypes {\r\n JSON = 0x4E4F534a,\r\n Binary = 0x004E4942,\r\n}\r\n\r\n/** @internal */\r\nexport enum GltfMeshMode {\r\n Points = 0,\r\n Lines = 1,\r\n LineStrip = 3,\r\n Triangles = 4,\r\n}\r\n\r\n/** @internal */\r\nexport enum GltfDataType {\r\n SignedByte = 0x1400,\r\n UnsignedByte = 0x1401,\r\n SignedShort = 5122,\r\n UnsignedShort = 5123,\r\n UInt32 = 5125,\r\n Float = 5126,\r\n Rgb = 6407,\r\n Rgba = 6408,\r\n IntVec2 = 0x8b53,\r\n IntVec3 = 0x8b54,\r\n FloatVec2 = 35664,\r\n FloatVec3 = 35665,\r\n FloatVec4 = 35666,\r\n FloatMat3 = 35675,\r\n FloatMat4 = 35676,\r\n Sampler2d = 35678,\r\n}\r\n\r\n/** @internal */\r\nexport enum GltfConstants {\r\n CullFace = 2884,\r\n DepthTest = 2929,\r\n Nearest = 0x2600,\r\n Linear = 9729,\r\n LinearMipmapLinear = 9987,\r\n ClampToEdge = 33071,\r\n ArrayBuffer = 34962,\r\n ElementArrayBuffer = 34963,\r\n FragmentShader = 35632,\r\n VertexShader = 35633,\r\n}\r\n\r\n/** @internal */\r\nexport type GltfDataBuffer = Uint8Array | Uint16Array | Uint32Array | Float32Array;\r\n\r\n/**\r\n * A chunk of binary data exposed as a typed array.\r\n * The count member indicates how many elements exist. This may be less than this.buffer.length due to padding added to the\r\n * binary stream to ensure correct alignment.\r\n * @internal\r\n */\r\nexport class GltfBufferData {\r\n public readonly buffer: GltfDataBuffer;\r\n public readonly count: number;\r\n\r\n public constructor(buffer: GltfDataBuffer, count: number) {\r\n this.buffer = buffer;\r\n this.count = count;\r\n }\r\n\r\n /**\r\n * Create a GltfBufferData of the desired type. The actual type may differ from the desired type - for example, small 32-bit integers\r\n * may be represented as 8-bit or 16-bit integers instead.\r\n * If the actual data type is not convertible to the desired type, this function returns undefined.\r\n */\r\n public static create(bytes: Uint8Array, actualType: GltfDataType, expectedType: GltfDataType, count: number): GltfBufferData | undefined {\r\n if (expectedType !== actualType) {\r\n // Some data is stored in smaller data types to save space if no values exceed the maximum of the smaller type.\r\n switch (expectedType) {\r\n case GltfDataType.Float:\r\n case GltfDataType.UnsignedByte:\r\n return undefined;\r\n case GltfDataType.UnsignedShort:\r\n if (GltfDataType.UnsignedByte !== actualType)\r\n return undefined;\r\n break;\r\n case GltfDataType.UInt32:\r\n if (GltfDataType.UnsignedByte !== actualType && GltfDataType.UnsignedShort !== actualType)\r\n return undefined;\r\n break;\r\n }\r\n }\r\n\r\n const data = this.createDataBuffer(bytes, actualType);\r\n return undefined !== data ? new GltfBufferData(data, count) : undefined;\r\n }\r\n\r\n private static createDataBuffer(bytes: Uint8Array, actualType: GltfDataType): GltfDataBuffer | undefined {\r\n // NB: Endianness of typed array data is determined by the 'platform byte order'. Actual data is always little-endian.\r\n // We are assuming little-endian platform. If we find a big-endian platform, we'll need to use a DataView instead.\r\n switch (actualType) {\r\n case GltfDataType.UnsignedByte:\r\n return bytes;\r\n case GltfDataType.UnsignedShort:\r\n return new Uint16Array(bytes.buffer, bytes.byteOffset, bytes.byteLength / 2);\r\n case GltfDataType.UInt32:\r\n return new Uint32Array(bytes.buffer, bytes.byteOffset, bytes.byteLength / 4);\r\n case GltfDataType.Float:\r\n return new Float32Array(bytes.buffer, bytes.byteOffset, bytes.byteLength / 4);\r\n default:\r\n return undefined;\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * A view of a chunk of glTF binary data containing an array of elements of a specific data type.\r\n * The count member indicates how many elements exist; this may be smaller than this.data.length.\r\n * The count member may also indicate the number of elements of a type containing more than one value of the\r\n * underlying type. For example, a buffer of 4 32-bit floating point 'vec2' elements will have a count of 4,\r\n * but its data member will contain 8 32-bit floating point values (2 per vec2).\r\n * The accessor member may contain additional JSON data specific to a particular buffer.\r\n * @internal\r\n */\r\nexport class GltfBufferView {\r\n public readonly data: Uint8Array;\r\n public readonly count: number;\r\n public readonly type: GltfDataType;\r\n public readonly accessor: any;\r\n public readonly stride: number;\r\n\r\n public get byteLength(): number { return this.data.length; }\r\n\r\n public constructor(data: Uint8Array, count: number, type: GltfDataType, accessor: any, stride: number) {\r\n this.data = data;\r\n this.count = count;\r\n this.type = type;\r\n this.accessor = accessor;\r\n this.stride = stride;\r\n }\r\n\r\n public toBufferData(desiredType: GltfDataType): GltfBufferData | undefined {\r\n return GltfBufferData.create(this.data, this.type, desiredType, this.count);\r\n }\r\n}\r\n\r\n/** Header preceding glTF data.\r\n * @internal\r\n */\r\nexport class GltfHeader extends TileHeader {\r\n public readonly gltfLength: number;\r\n public readonly scenePosition: number = 0;\r\n public readonly sceneStrLength: number = 0;\r\n public readonly binaryPosition: number = 0;\r\n public get isValid(): boolean { return TileFormat.Gltf === this.format; }\r\n\r\n public constructor(stream: ByteStream) {\r\n super(stream);\r\n this.gltfLength = stream.nextUint32;\r\n this.sceneStrLength = stream.nextUint32;\r\n const value5 = stream.nextUint32;\r\n\r\n // Early versions of the reality data tile publisher incorrectly put version 2 into header - handle these old tiles\r\n // validating the chunk type.\r\n if (this.version === GltfVersions.Version2 && value5 === GltfVersions.Gltf1SceneFormat)\r\n this.version = GltfVersions.Version1;\r\n\r\n if (this.version === GltfVersions.Version1) {\r\n const gltfSceneFormat = value5;\r\n if (GltfVersions.Gltf1SceneFormat !== gltfSceneFormat) {\r\n this.invalidate();\r\n return;\r\n }\r\n\r\n this.scenePosition = stream.curPos;\r\n this.binaryPosition = stream.curPos + this.sceneStrLength;\r\n } else if (this.version === GltfVersions.Version2) {\r\n const sceneChunkType = value5;\r\n this.scenePosition = stream.curPos;\r\n stream.curPos = stream.curPos + this.sceneStrLength;\r\n const binaryLength = stream.nextUint32;\r\n const binaryChunkType = stream.nextUint32;\r\n if (GltfV2ChunkTypes.JSON !== sceneChunkType || GltfV2ChunkTypes.Binary !== binaryChunkType || 0 === binaryLength) {\r\n this.invalidate();\r\n return;\r\n }\r\n\r\n this.binaryPosition = stream.curPos;\r\n } else {\r\n this.invalidate();\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"GltfTileIO.js","sourceRoot":"","sources":["../../../src/tile/GltfTileIO.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAc,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAElD;;GAEG;AACH,MAAM,CAAN,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,uDAAY,CAAA;IACZ,uDAAY,CAAA;IACZ,mEAAy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,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC;4BAClE,MAAM;wBACR;4BACE,kEAAkE;4BAClE,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;4BAClC,MAAM;qBACT;iBACF;gBAED,IAAI,KAAK,KAAK,KAAK,EAAE;oBACnB,IAAI,CAAC,UAAU,EAAE,CAAC;oBAClB,OAAO;iBACR;gBAED,MAAM,CAAC,SAAS,KAAK,KAAK,CAAC,CAAC;gBAC5B,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;gBAC1B,MAAM;YACR;gBACE,IAAI,CAAC,UAAU,EAAE,CAAC;gBAClB,MAAM;SACT;IACH,CAAC;IA1ED,IAAW,OAAO;QAChB,OAAO,UAAU,CAAC,IAAI,KAAK,IAAI,CAAC,MAAM,CAAC;IACzC,CAAC;CAyEF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Tile\r\n */\r\n\r\nimport { assert, ByteStream } from \"@itwin/core-bentley\";\r\nimport { TileFormat, TileHeader } from \"./TileIO\";\r\n\r\n/** Known version of the [glTF format](https://www.khronos.org/gltf/).\r\n * @internal\r\n */\r\nexport enum GltfVersions {\r\n Version1 = 1,\r\n Version2 = 2,\r\n CurrentVersion = Version1,\r\n Gltf1SceneFormat = 0,\r\n}\r\n\r\n/** @internal */\r\nexport enum GltfV2ChunkTypes {\r\n JSON = 0x4E4F534a,\r\n Binary = 0x004E4942,\r\n}\r\n\r\n/** A chunk of a glb file.\r\n * @internal\r\n */\r\nexport interface GltfChunk {\r\n /** Offset of the first byte of the chunk's data relative to the beginning of the glb data.\r\n * This excludes the 8-byte chunk header containing the length and type fields.\r\n */\r\n offset: number;\r\n /** The number of bytes in the chunk's data. */\r\n length: number;\r\n}\r\n\r\n/** Describes a glTF chunk's data along with its type.\r\n * @internal\r\n */\r\nexport type TypedGltfChunk = GltfChunk & { type: number };\r\n\r\nfunction consumeNextChunk(stream: ByteStream): TypedGltfChunk | undefined | false {\r\n if (stream.isAtTheEnd)\r\n return undefined;\r\n\r\n const offset = stream.curPos + 8;\r\n const length = stream.nextUint32;\r\n const type = stream.nextUint32;\r\n stream.advance(length);\r\n return stream.isPastTheEnd ? false : { offset, length, type };\r\n}\r\n\r\n/** @internal */\r\nexport class GlbHeader extends TileHeader {\r\n public readonly gltfLength: number = 0;\r\n public readonly jsonChunk: GltfChunk = { offset: 0, length: 0 };\r\n public readonly binaryChunk?: GltfChunk;\r\n public readonly additionalChunks: TypedGltfChunk[] = [];\r\n\r\n public get isValid(): boolean {\r\n return TileFormat.Gltf === this.format;\r\n }\r\n\r\n public constructor(stream: ByteStream) {\r\n super(stream);\r\n this.gltfLength = stream.nextUint32;\r\n\r\n const jsonLength = stream.nextUint32;\r\n const word5 = stream.nextUint32;\r\n\r\n // Early versions of the reality data tile publisher incorrectly put version 2 into header - handle these old tiles\r\n // validating the chunk type.\r\n if (this.version === GltfVersions.Version2 && word5 === GltfVersions.Gltf1SceneFormat)\r\n this.version = GltfVersions.Version1;\r\n\r\n this.jsonChunk = { offset: stream.curPos, length: jsonLength };\r\n switch (this.version) {\r\n case GltfVersions.Version1:\r\n if (GltfVersions.Gltf1SceneFormat !== word5) {\r\n this.invalidate();\r\n return;\r\n }\r\n\r\n const binaryOffset = stream.curPos + jsonLength;\r\n this.binaryChunk = { offset: binaryOffset, length: this.gltfLength - binaryOffset };\r\n break;\r\n case GltfVersions.Version2:\r\n if (word5 !== GltfV2ChunkTypes.JSON) {\r\n this.invalidate();\r\n return;\r\n }\r\n\r\n stream.advance(jsonLength);\r\n if (stream.isPastTheEnd) {\r\n this.invalidate();\r\n return;\r\n }\r\n\r\n let chunk;\r\n while (chunk = consumeNextChunk(stream)) {\r\n switch (chunk.type) {\r\n case GltfV2ChunkTypes.JSON:\r\n // Only one JSON chunk permitted and it must be the first.\r\n this.invalidate();\r\n return;\r\n case GltfV2ChunkTypes.Binary:\r\n // At most one binary chunk permitted and it must be the second if present.\r\n if (this.binaryChunk || this.additionalChunks.length) {\r\n this.invalidate();\r\n return;\r\n }\r\n\r\n this.binaryChunk = { offset: chunk.offset, length: chunk.length };\r\n break;\r\n default:\r\n // Any other chunk type should be ignored - for use by extensions.\r\n this.additionalChunks.push(chunk);\r\n break;\r\n }\r\n }\r\n\r\n if (false === chunk) {\r\n this.invalidate();\r\n return;\r\n }\r\n\r\n assert(undefined === chunk);\r\n assert(stream.isAtTheEnd);\r\n break;\r\n default:\r\n this.invalidate();\r\n break;\r\n }\r\n }\r\n}\r\n"]}
@@ -12,6 +12,7 @@ export interface TileTreeMetadata {
12
12
  readonly modelId: Id64String;
13
13
  readonly is2d: boolean;
14
14
  readonly contentRange?: Range3d;
15
+ readonly tileScreenSize: number;
15
16
  }
16
17
  /** Describes the contents of an iModel tile.
17
18
  * @internal
@@ -38,8 +39,10 @@ export interface TileOptions {
38
39
  readonly enableExternalTextures: boolean;
39
40
  readonly useProjectExtents: boolean;
40
41
  readonly optimizeBRepProcessing: boolean;
42
+ readonly useLargerTiles: boolean;
41
43
  readonly disableMagnification: boolean;
42
44
  readonly alwaysSubdivideIncompleteTiles: boolean;
45
+ readonly enableIndexedEdges: boolean;
43
46
  }
44
47
  /** @internal */
45
48
  export declare namespace TileOptions {
@@ -69,7 +72,19 @@ export declare enum TreeFlags {
69
72
  None = 0,
70
73
  UseProjectExtents = 1,
71
74
  EnforceDisplayPriority = 2,
72
- OptimizeBRepProcessing = 4
75
+ OptimizeBRepProcessing = 4,
76
+ UseLargerTiles = 8
77
+ }
78
+ /** Describes the type of edges to include in the graphics for a tile tree.
79
+ * @alpha
80
+ */
81
+ export declare enum EdgeType {
82
+ /** Omit all edges. */
83
+ None = 0,
84
+ /** Include non-indexed edges, which consume more memory and are less efficient to draw than [[Indexed]] edges, but are compatible with WebGL 1. */
85
+ NonIndexed = 1,
86
+ /** Include indexed edges, which use less memory and draw more efficiently than [[NonIndexed]] edges, but require WebGL 2. */
87
+ Indexed = 2
73
88
  }
74
89
  /** Describes a tile tree used to draw the contents of a model, possibly with embedded animation.
75
90
  * @internal
@@ -77,12 +92,10 @@ export declare enum TreeFlags {
77
92
  export interface PrimaryTileTreeId {
78
93
  /** Describes the type of tile tree. */
79
94
  type: BatchType.Primary;
80
- /** Whether to include edges in tile content. */
81
- edgesRequired: boolean;
82
- /** Id of the [DisplayStyle]($backend) holding the [[RenderSchedule]] script to be applied to the tiles. */
95
+ /** The type of edges to include in tile content. */
96
+ edges: EdgeType;
97
+ /** Id of the [DisplayStyle]($backend) or [RenderTimeline]($backend) element holding the [[RenderSchedule]] script to be applied to the tiles. */
83
98
  animationId?: Id64String;
84
- /** Id of the transform node within the [[RenderSchedule]] script to be applied to the tiles. */
85
- animationTransformNodeId?: number;
86
99
  /** If true, meshes within the tiles will be grouped into nodes based on the display priority associated with their subcategories,
87
100
  * for ensuring the graphics display with correct priority.
88
101
  */
@@ -100,7 +113,6 @@ export interface ClassifierTileTreeId {
100
113
  type: BatchType.VolumeClassifier | BatchType.PlanarClassifier;
101
114
  expansion: number;
102
115
  animationId?: Id64String;
103
- animationTransformNodeId?: number;
104
116
  }
105
117
  /** Describes the Id of an iModel tile tree.
106
118
  * @internal
@@ -194,7 +206,7 @@ export declare function readTileContentDescription(stream: ByteStream, sizeMulti
194
206
  /** Compute the chord tolerance for the specified tile of the given range with the specified size multiplier.
195
207
  * @internal
196
208
  */
197
- export declare function computeTileChordTolerance(tile: TileMetadata, is3d: boolean): number;
209
+ export declare function computeTileChordTolerance(tile: TileMetadata, is3d: boolean, tileScreenSize: number): number;
198
210
  /** Deserializes tile metadata.
199
211
  * @internal
200
212
  */
@@ -1 +1 @@
1
- {"version":3,"file":"TileMetadata.d.ts","sourceRoot":"","sources":["../../../src/tile/TileMetadata.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH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YAAY,EAAE,IAAI,EAAE,gBAAgB,GAAG,KAAK,CAAC;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC,CAwB9H;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,YAAY,EAAE,UAAU,EAAE,iBAAiB,EAAE,IAAI,EAAE,gBAAgB,GAAG;IAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CA4E9J;AAED,gBAAgB;AAChB,MAAM,WAAW,sBAAuB,SAAQ,mBAAmB;IACjE,QAAQ,CAAC,oBAAoB,EAAE,MAAM,CAAC;CACvC;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,GAAG,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,OAAO,GAAG,sBAAsB,CAqD3L;AAID;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,GAAG,MAAM,CAS3G;AAED;;GAEG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAU;IAChC,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAU;IAC9C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAc;gBAEpB,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW;IAMvE;;OAEG;IACI,IAAI,CAAC,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,GAAG,YAAY;CAWhE"}
@@ -5,7 +5,7 @@
5
5
  /** @packageDocumentation
6
6
  * @module Tile
7
7
  */
8
- import { assert, compareBooleans, compareBooleansOrUndefined, compareNumbers, compareNumbersOrUndefined, compareStringsOrUndefined, Id64, } from "@itwin/core-bentley";
8
+ import { assert, compareBooleansOrUndefined, compareNumbers, compareStringsOrUndefined, Id64, } from "@itwin/core-bentley";
9
9
  import { Range3d, Vector3d } from "@itwin/core-geometry";
10
10
  import { BatchType } from "../FeatureTable";
11
11
  import { CurrentImdlVersion, FeatureTableHeader, ImdlFlags, ImdlHeader } from "./IModelTileIO";
@@ -14,10 +14,7 @@ import { TileReadError, TileReadStatus } from "./TileIO";
14
14
  // NB: These constants correspond to those defined in Tile.cpp.
15
15
  var Constants;
16
16
  (function (Constants) {
17
- Constants.tileScreenSize = 512;
18
17
  Constants.minToleranceRatioMultiplier = 2;
19
- Constants.minToleranceRatio = Constants.tileScreenSize * Constants.minToleranceRatioMultiplier;
20
- Constants.untransformedNodeValue = 0xffffffff;
21
18
  })(Constants || (Constants = {}));
22
19
  /** @internal */
23
20
  export var TileOptions;
@@ -39,8 +36,10 @@ export var TileOptions;
39
36
  enableExternalTextures: 0 !== (contentFlags & ContentFlags.ExternalTextures),
40
37
  useProjectExtents: 0 !== (tree.flags & TreeFlags.UseProjectExtents),
41
38
  optimizeBRepProcessing: 0 !== (tree.flags & TreeFlags.OptimizeBRepProcessing),
39
+ useLargerTiles: 0 !== (tree.flags & TreeFlags.UseLargerTiles),
42
40
  disableMagnification: false,
43
41
  alwaysSubdivideIncompleteTiles: false,
42
+ enableIndexedEdges: true,
44
43
  };
45
44
  }
46
45
  TileOptions.fromTreeIdAndContentId = fromTreeIdAndContentId;
@@ -48,7 +47,7 @@ export var TileOptions;
48
47
  /** @internal */
49
48
  export function parseTileTreeIdAndContentId(treeId, contentId) {
50
49
  let idx = 0;
51
- let type, expansion, animationId, nodeId, edgesRequired, sectionCut;
50
+ let type, expansion, animationId, edges, sectionCut;
52
51
  // Skip version and flags, they're handled by TileOptions.fromTreeIdAndContentId
53
52
  while (idx < treeId.length && treeId[idx] !== "-")
54
53
  idx++;
@@ -64,15 +63,15 @@ export function parseTileTreeIdAndContentId(treeId, contentId) {
64
63
  }
65
64
  // Animation
66
65
  // eslint-disable-next-line prefer-const
67
- ({ idx, animationId, nodeId } = parseAnimation(idx, treeId, animationId, nodeId));
66
+ ({ idx, animationId } = parseAnimation(idx, treeId, animationId));
68
67
  if (type === BatchType.Primary) {
69
- ({ idx, edgesRequired, sectionCut } = parsePrimary(idx, treeId, edgesRequired, sectionCut));
68
+ ({ idx, edges, sectionCut } = parsePrimary(idx, treeId, edges, sectionCut));
70
69
  }
71
70
  const modelId = treeId.substr(idx);
72
71
  if (!Id64.isId64(modelId))
73
72
  throw new Error("Invalid tree Id");
74
73
  const { flags: treeFlags } = treeFlagsAndFormatVersionFromId(treeId);
75
- const parsedTreeId = getTreeId(type, edgesRequired, sectionCut, animationId, nodeId, expansion, (treeFlags & TreeFlags.EnforceDisplayPriority) !== 0 ? true : undefined);
74
+ const parsedTreeId = getTreeId(type, edges, sectionCut, animationId, expansion, (treeFlags & TreeFlags.EnforceDisplayPriority) !== 0 ? true : undefined);
76
75
  const options = TileOptions.fromTreeIdAndContentId(treeId, contentId);
77
76
  let parsedContentId;
78
77
  try {
@@ -90,14 +89,13 @@ export function parseTileTreeIdAndContentId(treeId, contentId) {
90
89
  treeId: parsedTreeId,
91
90
  };
92
91
  }
93
- function getTreeId(type, edgesRequired, sectionCut, animationId, nodeId, expansion, enforceDisplayPriority) {
92
+ function getTreeId(type, edges, sectionCut, animationId, expansion, enforceDisplayPriority) {
94
93
  if (type === BatchType.Primary)
95
94
  return {
96
95
  type,
97
- edgesRequired,
96
+ edges,
98
97
  sectionCut,
99
98
  animationId,
100
- animationTransformNodeId: nodeId,
101
99
  enforceDisplayPriority,
102
100
  };
103
101
  else
@@ -105,18 +103,19 @@ function getTreeId(type, edgesRequired, sectionCut, animationId, nodeId, expansi
105
103
  type,
106
104
  expansion,
107
105
  animationId,
108
- animationTransformNodeId: nodeId,
109
106
  };
110
107
  }
111
- function parsePrimary(idx, treeId, edgesRequired, sectionCut) {
108
+ function parsePrimary(idx, treeId, edges = EdgeType.None, sectionCut) {
112
109
  // Edges
113
- const edgesStr = "E:0_";
114
- if (idx < treeId.length && treeId.startsWith(edgesStr, idx)) {
115
- edgesRequired = false;
116
- idx += edgesStr.length;
117
- }
118
- else {
119
- edgesRequired = true;
110
+ edges = EdgeType.NonIndexed;
111
+ if (idx < treeId.length) {
112
+ const noEdgesStr = "E:0_";
113
+ if (treeId.startsWith(noEdgesStr, idx))
114
+ edges = EdgeType.None;
115
+ else if (treeId.startsWith("E:2_", idx))
116
+ edges = EdgeType.Indexed;
117
+ if (EdgeType.NonIndexed !== edges)
118
+ idx += noEdgesStr.length;
120
119
  }
121
120
  // Section cut
122
121
  if (idx + 1 < treeId.length && treeId[idx] === "S") {
@@ -129,7 +128,7 @@ function parsePrimary(idx, treeId, edgesRequired, sectionCut) {
129
128
  throw new Error("Invalid tree Id");
130
129
  idx++; // s
131
130
  }
132
- return { idx, edgesRequired, sectionCut };
131
+ return { idx, edges, sectionCut };
133
132
  }
134
133
  function parseClassifier(idx, treeId, expansion) {
135
134
  let type;
@@ -156,7 +155,7 @@ function parseClassifier(idx, treeId, expansion) {
156
155
  expansion = Number.parseFloat(expansionStr);
157
156
  return { idx, type, expansion };
158
157
  }
159
- function parseAnimation(idx, treeId, animationId, nodeId) {
158
+ function parseAnimation(idx, treeId, animationId) {
160
159
  if (idx < treeId.length && treeId[idx] === "A") {
161
160
  if (idx + 1 < treeId.length && treeId[idx + 1] !== ":")
162
161
  throw new Error("Invalid tree Id");
@@ -169,22 +168,8 @@ function parseAnimation(idx, treeId, animationId, nodeId) {
169
168
  if (!Id64.isId64(animationId) || idx === treeId.length)
170
169
  throw new Error("Invalid tree Id");
171
170
  idx++; // _
172
- if (idx === treeId.length || treeId[idx] !== "#")
173
- throw new Error("Invalid tree Id");
174
- idx++; // #
175
- // Parse animation node id
176
- let nodeIdStr = "";
177
- while (idx < treeId.length && treeId[idx] !== "_") {
178
- nodeIdStr += treeId[idx++];
179
- }
180
- nodeId = Number.parseInt(nodeIdStr, 16);
181
- if (idx === treeId.length || !Number.isFinite(nodeId) || nodeId.toString(16).toUpperCase() !== nodeIdStr.toUpperCase()) // if toString doesn't round-trip, that means there were invalid characters in the string
182
- throw new Error("Invalid tree Id");
183
- idx++; // _
184
- if (nodeId === Constants.untransformedNodeValue)
185
- nodeId = undefined;
186
171
  }
187
- return { idx, animationId, nodeId };
172
+ return { idx, animationId };
188
173
  }
189
174
  /** @internal */
190
175
  export const defaultTileOptions = Object.freeze({
@@ -195,8 +180,10 @@ export const defaultTileOptions = Object.freeze({
195
180
  enableExternalTextures: true,
196
181
  useProjectExtents: true,
197
182
  optimizeBRepProcessing: true,
183
+ useLargerTiles: true,
198
184
  disableMagnification: false,
199
185
  alwaysSubdivideIncompleteTiles: false,
186
+ enableIndexedEdges: true,
200
187
  });
201
188
  function contentFlagsFromId(id) {
202
189
  if (0 === id.length || "-" !== id[0])
@@ -249,11 +236,22 @@ export var TreeFlags;
249
236
  TreeFlags[TreeFlags["UseProjectExtents"] = 1] = "UseProjectExtents";
250
237
  TreeFlags[TreeFlags["EnforceDisplayPriority"] = 2] = "EnforceDisplayPriority";
251
238
  TreeFlags[TreeFlags["OptimizeBRepProcessing"] = 4] = "OptimizeBRepProcessing";
239
+ TreeFlags[TreeFlags["UseLargerTiles"] = 8] = "UseLargerTiles";
252
240
  })(TreeFlags || (TreeFlags = {}));
253
- function animationIdToString(animationId, nodeId) {
254
- if (undefined === nodeId)
255
- nodeId = Constants.untransformedNodeValue;
256
- return `A:${animationId}_#${nodeId.toString(16)}_`;
241
+ /** Describes the type of edges to include in the graphics for a tile tree.
242
+ * @alpha
243
+ */
244
+ export var EdgeType;
245
+ (function (EdgeType) {
246
+ /** Omit all edges. */
247
+ EdgeType[EdgeType["None"] = 0] = "None";
248
+ /** Include non-indexed edges, which consume more memory and are less efficient to draw than [[Indexed]] edges, but are compatible with WebGL 1. */
249
+ EdgeType[EdgeType["NonIndexed"] = 1] = "NonIndexed";
250
+ /** Include indexed edges, which use less memory and draw more efficiently than [[NonIndexed]] edges, but require WebGL 2. */
251
+ EdgeType[EdgeType["Indexed"] = 2] = "Indexed";
252
+ })(EdgeType || (EdgeType = {}));
253
+ function animationIdToString(animationId) {
254
+ return `A:${animationId}_`;
257
255
  }
258
256
  /** Convert a tile tree Id to its string representation.
259
257
  * @internal
@@ -263,12 +261,14 @@ export function iModelTileTreeIdToString(modelId, treeId, options) {
263
261
  let flags = options.useProjectExtents ? TreeFlags.UseProjectExtents : TreeFlags.None;
264
262
  if (options.optimizeBRepProcessing)
265
263
  flags |= TreeFlags.OptimizeBRepProcessing;
264
+ if (options.useLargerTiles)
265
+ flags |= TreeFlags.UseLargerTiles;
266
266
  if (BatchType.Primary === treeId.type) {
267
267
  if (undefined !== treeId.animationId)
268
- idStr = `${idStr}${animationIdToString(treeId.animationId, treeId.animationTransformNodeId)}`;
268
+ idStr = `${idStr}${animationIdToString(treeId.animationId)}`;
269
269
  else if (treeId.enforceDisplayPriority) // animation and priority are currently mutually exclusive
270
270
  flags |= TreeFlags.EnforceDisplayPriority;
271
- const edges = treeId.edgesRequired ? "" : "E:0_";
271
+ const edges = treeId.edges !== EdgeType.NonIndexed ? `E:${treeId.edges}_` : "";
272
272
  const sectionCut = treeId.sectionCut ? `S${treeId.sectionCut}s` : "";
273
273
  idStr = `${idStr}${edges}${sectionCut}`;
274
274
  }
@@ -278,7 +278,7 @@ export function iModelTileTreeIdToString(modelId, treeId, options) {
278
278
  if (BatchType.VolumeClassifier === treeId.type)
279
279
  flags |= TreeFlags.UseProjectExtents;
280
280
  if (undefined !== treeId.animationId)
281
- idStr = `${idStr}${animationIdToString(treeId.animationId, treeId.animationTransformNodeId)}`;
281
+ idStr = `${idStr}${animationIdToString(treeId.animationId)}`;
282
282
  }
283
283
  const version = getMaximumMajorTileFormatVersion(options.maximumMajorTileFormatVersion);
284
284
  if (version >= 4) {
@@ -292,17 +292,14 @@ export function iModelTileTreeIdToString(modelId, treeId, options) {
292
292
  */
293
293
  export function compareIModelTileTreeIds(lhs, rhs) {
294
294
  let cmp = compareNumbers(lhs.type, rhs.type);
295
- if (0 === cmp) {
295
+ if (0 === cmp)
296
296
  cmp = compareStringsOrUndefined(lhs.animationId, rhs.animationId);
297
- if (0 === cmp)
298
- cmp = compareNumbersOrUndefined(lhs.animationTransformNodeId, rhs.animationTransformNodeId);
299
- }
300
297
  if (0 !== cmp)
301
298
  return cmp;
302
299
  // NB: The redundant checks on BatchType below are to satisfy compiler.
303
300
  assert(lhs.type === rhs.type);
304
301
  if (BatchType.Primary === lhs.type && BatchType.Primary === rhs.type) {
305
- cmp = compareBooleans(lhs.edgesRequired, rhs.edgesRequired);
302
+ cmp = compareNumbers(lhs.edges, rhs.edges);
306
303
  if (0 === cmp) {
307
304
  cmp = compareBooleansOrUndefined(lhs.enforceDisplayPriority, rhs.enforceDisplayPriority);
308
305
  if (0 === cmp)
@@ -493,7 +490,7 @@ export function computeChildTileProps(parent, idProvider, root) {
493
490
  contentRange: parent.contentRange,
494
491
  sizeMultiplier,
495
492
  isLeaf: false,
496
- maximumSize: Constants.tileScreenSize,
493
+ maximumSize: root.tileScreenSize,
497
494
  });
498
495
  return { children, numEmpty };
499
496
  }
@@ -536,7 +533,7 @@ export function computeChildTileProps(parent, idProvider, root) {
536
533
  childSpec.j = parentSpec.j * 2 + j;
537
534
  childSpec.k = parentSpec.k * 2 + k;
538
535
  const childId = idProvider.idFromSpec(childSpec);
539
- children.push({ contentId: childId, range, maximumSize: Constants.tileScreenSize });
536
+ children.push({ contentId: childId, range, maximumSize: root.tileScreenSize });
540
537
  }
541
538
  }
542
539
  }
@@ -599,14 +596,14 @@ const scratchRangeDiagonal = new Vector3d();
599
596
  /** Compute the chord tolerance for the specified tile of the given range with the specified size multiplier.
600
597
  * @internal
601
598
  */
602
- export function computeTileChordTolerance(tile, is3d) {
599
+ export function computeTileChordTolerance(tile, is3d, tileScreenSize) {
603
600
  var _a;
604
601
  if (tile.range.isNull)
605
602
  return 0;
606
603
  const diagonal = tile.range.diagonal(scratchRangeDiagonal);
607
604
  const diagDist = is3d ? diagonal.magnitude() : diagonal.magnitudeXY();
608
605
  const mult = Math.max((_a = tile.sizeMultiplier) !== null && _a !== void 0 ? _a : 1, 1);
609
- return diagDist / (Constants.minToleranceRatio * Math.max(1, mult));
606
+ return diagDist / (tileScreenSize * Constants.minToleranceRatioMultiplier * Math.max(1, mult));
610
607
  }
611
608
  /** Deserializes tile metadata.
612
609
  * @internal