itowns 2.45.1 → 2.45.2-next.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 (220) hide show
  1. package/dist/455.js +1 -1
  2. package/dist/455.js.map +1 -1
  3. package/dist/debug.js +1 -1
  4. package/dist/debug.js.LICENSE.txt +8 -2
  5. package/dist/debug.js.map +1 -1
  6. package/dist/itowns.js +1 -1
  7. package/dist/itowns.js.LICENSE.txt +1 -1
  8. package/dist/itowns.js.map +1 -1
  9. package/dist/itowns_lasparser.js +1 -1
  10. package/dist/itowns_lasparser.js.map +1 -1
  11. package/dist/itowns_lasworker.js +1 -1
  12. package/dist/itowns_lasworker.js.map +1 -1
  13. package/dist/itowns_potree2worker.js +1 -1
  14. package/dist/itowns_potree2worker.js.map +1 -1
  15. package/dist/itowns_widgets.js +1 -1
  16. package/dist/itowns_widgets.js.map +1 -1
  17. package/examples/copc_simple_loader.html +3 -3
  18. package/examples/entwine_3d_loader.html +2 -2
  19. package/examples/entwine_simple_loader.html +10 -6
  20. package/examples/view_3d_map_webxr.html +2 -5
  21. package/lib/Controls/FirstPersonControls.d.ts +90 -0
  22. package/lib/Controls/FlyControls.d.ts +36 -0
  23. package/lib/Controls/GlobeControls.d.ts +274 -0
  24. package/lib/Controls/PlanarControls.d.ts +339 -0
  25. package/lib/Controls/StateControl.d.ts +140 -0
  26. package/lib/Controls/StreetControls.d.ts +134 -0
  27. package/lib/Controls/VRControls.d.ts +56 -0
  28. package/lib/Controls/VRControls.js +409 -0
  29. package/lib/Converter/Feature2Mesh.d.ts +42 -0
  30. package/lib/Converter/Feature2Texture.d.ts +5 -0
  31. package/lib/Converter/convertToTile.d.ts +5 -0
  32. package/lib/Converter/convertToTile.js +2 -2
  33. package/lib/Converter/textureConverter.d.ts +4 -0
  34. package/lib/Core/3DTiles/C3DTBatchTable.d.ts +49 -0
  35. package/lib/Core/3DTiles/C3DTBatchTableHierarchyExtension.d.ts +37 -0
  36. package/lib/Core/3DTiles/C3DTBoundingVolume.d.ts +39 -0
  37. package/lib/Core/3DTiles/C3DTExtensions.d.ts +75 -0
  38. package/lib/Core/3DTiles/C3DTFeature.d.ts +47 -0
  39. package/lib/Core/3DTiles/C3DTilesEnums.d.ts +14 -0
  40. package/lib/Core/3DTiles/C3DTileset.d.ts +46 -0
  41. package/lib/Core/3DTiles/utils/BinaryPropertyAccessor.d.ts +14 -0
  42. package/lib/Core/AnimationPlayer.d.ts +53 -0
  43. package/lib/Core/CopcNode.d.ts +67 -0
  44. package/lib/Core/CopcNode.js +50 -69
  45. package/lib/Core/Deprecated/Undeprecator.d.ts +6 -0
  46. package/lib/Core/EntwinePointTileNode.d.ts +58 -0
  47. package/lib/Core/EntwinePointTileNode.js +6 -34
  48. package/lib/Core/Feature.d.ts +323 -0
  49. package/lib/Core/Geographic/GeoidGrid.d.ts +86 -0
  50. package/lib/Core/Label.d.ts +86 -0
  51. package/lib/Core/MainLoop.d.ts +23 -0
  52. package/lib/Core/Picking.d.ts +6 -0
  53. package/lib/Core/Picking.js +4 -0
  54. package/lib/Core/PointCloudNode.d.ts +14 -0
  55. package/lib/Core/PointCloudNode.js +28 -0
  56. package/lib/Core/Potree2Node.d.ts +11 -0
  57. package/lib/Core/Potree2Node.js +3 -57
  58. package/lib/Core/Potree2PointAttributes.d.ts +97 -0
  59. package/lib/Core/PotreeNode.d.ts +13 -0
  60. package/lib/Core/PotreeNode.js +17 -17
  61. package/lib/Core/Prefab/Globe/Atmosphere.d.ts +66 -0
  62. package/lib/Core/Prefab/Globe/Atmosphere.js +10 -5
  63. package/lib/Core/Prefab/Globe/GlobeLayer.d.ts +48 -0
  64. package/lib/Core/Prefab/Globe/GlobeTileBuilder.d.ts +38 -0
  65. package/lib/Core/Prefab/Globe/SkyShader.d.ts +5 -0
  66. package/lib/Core/Prefab/Globe/SkyShader.js +3 -3
  67. package/lib/Core/Prefab/GlobeView.d.ts +65 -0
  68. package/lib/Core/Prefab/GlobeView.js +9 -0
  69. package/lib/Core/Prefab/Planar/PlanarLayer.d.ts +38 -0
  70. package/lib/Core/Prefab/Planar/PlanarTileBuilder.d.ts +32 -0
  71. package/lib/Core/Prefab/PlanarView.d.ts +33 -0
  72. package/lib/Core/Prefab/TileBuilder.d.ts +63 -0
  73. package/lib/Core/Prefab/computeBufferTileGeometry.d.ts +17 -0
  74. package/lib/Core/Scheduler/Cache.d.ts +25 -0
  75. package/lib/Core/Scheduler/CancelledCommandException.d.ts +12 -0
  76. package/lib/Core/Scheduler/Scheduler.d.ts +106 -0
  77. package/lib/Core/Style.d.ts +248 -0
  78. package/lib/Core/StyleOptions.d.ts +455 -0
  79. package/lib/Core/System/Capabilities.d.ts +9 -0
  80. package/lib/Core/Tile/Tile.d.ts +70 -0
  81. package/lib/Core/Tile/TileGrid.d.ts +12 -0
  82. package/lib/Core/TileGeometry.d.ts +46 -0
  83. package/lib/Core/TileMesh.d.ts +50 -0
  84. package/lib/Core/TileMesh.js +2 -4
  85. package/lib/Core/View.d.ts +403 -0
  86. package/lib/Core/View.js +1 -7
  87. package/lib/Layer/C3DTilesLayer.d.ts +140 -0
  88. package/lib/Layer/ColorLayer.d.ts +128 -0
  89. package/lib/Layer/ColorLayer.js +4 -4
  90. package/lib/Layer/CopcLayer.d.ts +42 -0
  91. package/lib/Layer/CopcLayer.js +3 -6
  92. package/lib/Layer/ElevationLayer.d.ts +96 -0
  93. package/lib/Layer/ElevationLayer.js +3 -3
  94. package/lib/Layer/EntwinePointTileLayer.d.ts +56 -0
  95. package/lib/Layer/EntwinePointTileLayer.js +4 -3
  96. package/lib/Layer/FeatureGeometryLayer.d.ts +62 -0
  97. package/lib/Layer/GeoidLayer.d.ts +41 -0
  98. package/lib/Layer/GeometryLayer.d.ts +120 -0
  99. package/lib/Layer/InfoLayer.d.ts +24 -0
  100. package/lib/Layer/InfoLayer.js +1 -1
  101. package/lib/Layer/LabelLayer.d.ts +93 -0
  102. package/lib/Layer/LabelLayer.js +2 -2
  103. package/lib/Layer/Layer.d.ts +185 -0
  104. package/lib/Layer/LayerUpdateState.d.ts +24 -0
  105. package/lib/Layer/LayerUpdateStrategy.d.ts +11 -0
  106. package/lib/Layer/LayerUpdateStrategy.js +2 -7
  107. package/lib/Layer/OGC3DTilesLayer.d.ts +277 -0
  108. package/lib/Layer/OGC3DTilesLayer.js +21 -0
  109. package/lib/Layer/OrientedImageLayer.d.ts +53 -0
  110. package/lib/Layer/PointCloudLayer.d.ts +103 -0
  111. package/lib/Layer/PointCloudLayer.js +1 -1
  112. package/lib/Layer/Potree2Layer.d.ts +56 -0
  113. package/lib/Layer/PotreeLayer.d.ts +55 -0
  114. package/lib/Layer/RasterLayer.d.ts +8 -0
  115. package/lib/Layer/RasterLayer.js +2 -2
  116. package/lib/Layer/ReferencingLayerProperties.d.ts +2 -0
  117. package/lib/Layer/ReferencingLayerProperties.js +0 -12
  118. package/lib/Layer/TiledGeometryLayer.d.ts +192 -0
  119. package/lib/Layer/TiledGeometryLayer.js +4 -3
  120. package/lib/Main.d.ts +89 -0
  121. package/lib/Main.js +3 -1
  122. package/lib/Parser/B3dmParser.d.ts +26 -0
  123. package/lib/Parser/CameraCalibrationParser.d.ts +32 -0
  124. package/lib/Parser/GDFParser.d.ts +24 -0
  125. package/lib/Parser/GTXParser.d.ts +28 -0
  126. package/lib/Parser/GeoJsonParser.d.ts +12 -0
  127. package/lib/Parser/GpxParser.d.ts +12 -0
  128. package/lib/Parser/ISGParser.d.ts +23 -0
  129. package/lib/Parser/KMLParser.d.ts +12 -0
  130. package/lib/Parser/LASParser.d.ts +61 -0
  131. package/lib/Parser/MapBoxUrlParser.d.ts +9 -0
  132. package/lib/Parser/PntsParser.d.ts +4 -0
  133. package/lib/Parser/Potree2BinParser.d.ts +8 -0
  134. package/lib/Parser/PotreeBinParser.d.ts +4 -0
  135. package/lib/Parser/PotreeCinParser.d.ts +4 -0
  136. package/lib/Parser/ShapefileParser.d.ts +25 -0
  137. package/lib/Parser/VectorTileParser.d.ts +34 -0
  138. package/lib/Parser/XbilParser.d.ts +18 -0
  139. package/lib/Parser/deprecated/LegacyGLTFLoader.d.ts +32 -0
  140. package/lib/Parser/iGLTFLoader.d.ts +104 -0
  141. package/lib/Process/3dTilesProcessing.d.ts +43 -0
  142. package/lib/Process/FeatureProcessing.d.ts +4 -0
  143. package/lib/Process/LayeredMaterialNodeProcessing.d.ts +3 -0
  144. package/lib/Process/LayeredMaterialNodeProcessing.js +12 -12
  145. package/lib/Process/ObjectRemovalHelper.d.ts +32 -0
  146. package/lib/Process/handlerNodeError.d.ts +1 -0
  147. package/lib/Provider/3dTilesProvider.d.ts +7 -0
  148. package/lib/Provider/DataSourceProvider.d.ts +4 -0
  149. package/lib/Provider/Fetcher.d.ts +101 -0
  150. package/lib/Provider/PointCloudProvider.d.ts +4 -0
  151. package/lib/Provider/TileProvider.d.ts +4 -0
  152. package/lib/Provider/URLBuilder.d.ts +28 -0
  153. package/lib/Renderer/Camera.d.ts +95 -0
  154. package/lib/Renderer/Color.d.ts +3 -0
  155. package/lib/Renderer/ColorLayersOrdering.d.ts +38 -0
  156. package/lib/Renderer/ColorLayersOrdering.js +2 -2
  157. package/lib/Renderer/CommonMaterial.d.ts +6 -0
  158. package/lib/Renderer/Label2DRenderer.d.ts +31 -0
  159. package/lib/Renderer/LayeredMaterial.d.ts +121 -0
  160. package/lib/Renderer/LayeredMaterial.js +221 -141
  161. package/lib/Renderer/OBB.d.ts +65 -0
  162. package/lib/Renderer/OrientedImageCamera.d.ts +36 -0
  163. package/lib/Renderer/OrientedImageMaterial.d.ts +68 -0
  164. package/lib/Renderer/PointsMaterial.d.ts +226 -0
  165. package/lib/Renderer/PointsMaterial.js +60 -22
  166. package/lib/Renderer/RasterTile.d.ts +53 -0
  167. package/lib/Renderer/RasterTile.js +8 -9
  168. package/lib/Renderer/RenderMode.d.ts +11 -0
  169. package/lib/Renderer/RenderMode.js +1 -0
  170. package/lib/Renderer/Shader/ShaderChunk.d.ts +78 -0
  171. package/lib/Renderer/Shader/ShaderUtils.d.ts +5 -0
  172. package/lib/Renderer/WebXR.d.ts +33 -0
  173. package/lib/Renderer/WebXR.js +128 -47
  174. package/lib/Renderer/c3DEngine.d.ts +55 -0
  175. package/lib/Renderer/c3DEngine.js +5 -1
  176. package/lib/Source/C3DTilesGoogleSource.d.ts +38 -0
  177. package/lib/Source/C3DTilesIonSource.d.ts +31 -0
  178. package/lib/Source/C3DTilesSource.d.ts +17 -0
  179. package/lib/Source/CopcSource.d.ts +79 -0
  180. package/lib/Source/EntwinePointTileSource.d.ts +40 -0
  181. package/lib/Source/EntwinePointTileSource.js +0 -5
  182. package/lib/Source/FileSource.d.ts +118 -0
  183. package/lib/Source/OGC3DTilesGoogleSource.d.ts +24 -0
  184. package/lib/Source/OGC3DTilesIonSource.d.ts +26 -0
  185. package/lib/Source/OGC3DTilesSource.d.ts +21 -0
  186. package/lib/Source/OrientedImageSource.d.ts +48 -0
  187. package/lib/Source/Potree2Source.d.ts +157 -0
  188. package/lib/Source/PotreeSource.d.ts +69 -0
  189. package/lib/Source/Source.d.ts +122 -0
  190. package/lib/Source/TMSSource.d.ts +77 -0
  191. package/lib/Source/VectorTilesSource.d.ts +56 -0
  192. package/lib/Source/WFSSource.d.ts +110 -0
  193. package/lib/Source/WMSSource.d.ts +85 -0
  194. package/lib/Source/WMTSSource.d.ts +65 -0
  195. package/lib/ThreeExtended/capabilities/WebGL.d.ts +9 -0
  196. package/lib/ThreeExtended/libs/ktx-parse.module.d.ts +274 -0
  197. package/lib/ThreeExtended/libs/motion-controllers.module.d.ts +64 -0
  198. package/lib/ThreeExtended/libs/motion-controllers.module.js +375 -0
  199. package/lib/ThreeExtended/libs/zstddec.module.d.ts +6 -0
  200. package/lib/ThreeExtended/loaders/DDSLoader.js +40 -1
  201. package/lib/ThreeExtended/loaders/DRACOLoader.d.ts +41 -0
  202. package/lib/ThreeExtended/loaders/GLTFLoader.d.ts +16 -0
  203. package/lib/ThreeExtended/loaders/GLTFLoader.js +22 -3
  204. package/lib/ThreeExtended/loaders/KTX2Loader.d.ts +116 -0
  205. package/lib/ThreeExtended/loaders/KTX2Loader.js +9 -2
  206. package/lib/ThreeExtended/math/ColorSpaces.d.ts +56 -0
  207. package/lib/ThreeExtended/utils/BufferGeometryUtils.d.ts +62 -0
  208. package/lib/ThreeExtended/utils/BufferGeometryUtils.js +2 -2
  209. package/lib/ThreeExtended/utils/WorkerPool.d.ts +19 -0
  210. package/lib/ThreeExtended/webxr/XRControllerModelFactory.d.ts +25 -0
  211. package/lib/ThreeExtended/webxr/XRControllerModelFactory.js +209 -0
  212. package/lib/Utils/CameraUtils.d.ts +132 -0
  213. package/lib/Utils/DEMUtils.d.ts +84 -0
  214. package/lib/Utils/DEMUtils.js +2 -2
  215. package/lib/Utils/FeaturesUtils.d.ts +17 -0
  216. package/lib/Utils/Gradients.d.ts +13 -0
  217. package/lib/Utils/ThreeUtils.d.ts +14 -0
  218. package/lib/Utils/placeObjectOnGround.d.ts +28 -0
  219. package/lib/global.d.js +0 -0
  220. package/package.json +18 -15
@@ -0,0 +1,116 @@
1
+ export class KTX2Loader extends Loader<any, string> {
2
+ constructor(manager: any);
3
+ transcoderPath: string;
4
+ transcoderBinary: string | ArrayBuffer | null;
5
+ transcoderPending: Promise<void> | null;
6
+ workerPool: WorkerPool;
7
+ workerSourceURL: string;
8
+ workerConfig: {
9
+ astcSupported: any;
10
+ astcHDRSupported: boolean;
11
+ etc1Supported: any;
12
+ etc2Supported: any;
13
+ dxtSupported: any;
14
+ bptcSupported: any;
15
+ pvrtcSupported: any;
16
+ } | {
17
+ astcSupported: any;
18
+ astcHDRSupported: boolean;
19
+ etc1Supported: any;
20
+ etc2Supported: any;
21
+ dxtSupported: any;
22
+ bptcSupported: any;
23
+ pvrtcSupported: any;
24
+ } | {
25
+ astcSupported: any;
26
+ astcHDRSupported: any;
27
+ etc1Supported: any;
28
+ etc2Supported: any;
29
+ dxtSupported: any;
30
+ bptcSupported: any;
31
+ pvrtcSupported: any;
32
+ } | null;
33
+ setTranscoderPath(path: any): this;
34
+ setWorkerLimit(num: any): this;
35
+ detectSupportAsync(renderer: any): Promise<this>;
36
+ detectSupport(renderer: any): this;
37
+ init(): Promise<void>;
38
+ load(url: any, onLoad: any, onProgress: any, onError: any): void;
39
+ parse(buffer: any, onLoad: any, onError: any): any;
40
+ _createTextureFrom(transcodeResult: any, container: any): Promise<never> | CompressedTexture;
41
+ /**
42
+ * @param {ArrayBuffer} buffer
43
+ * @param {?Object} config
44
+ * @return {Promise<CompressedTexture|CompressedArrayTexture|DataTexture|Data3DTexture>}
45
+ */
46
+ _createTexture(buffer: ArrayBuffer, config?: Object | null): Promise<CompressedTexture | CompressedArrayTexture | DataTexture | Data3DTexture>;
47
+ dispose(): this;
48
+ }
49
+ export namespace KTX2Loader {
50
+ namespace BasisFormat {
51
+ let ETC1S: number;
52
+ let UASTC: number;
53
+ let UASTC_HDR: number;
54
+ }
55
+ namespace TranscoderFormat {
56
+ let ETC1: number;
57
+ let ETC2: number;
58
+ let BC1: number;
59
+ let BC3: number;
60
+ let BC4: number;
61
+ let BC5: number;
62
+ let BC7_M6_OPAQUE_ONLY: number;
63
+ let BC7_M5: number;
64
+ let PVRTC1_4_RGB: number;
65
+ let PVRTC1_4_RGBA: number;
66
+ let ASTC_4x4: number;
67
+ let ATC_RGB: number;
68
+ let ATC_RGBA_INTERPOLATED_ALPHA: number;
69
+ let RGBA32: number;
70
+ let RGB565: number;
71
+ let BGR565: number;
72
+ let RGBA4444: number;
73
+ let BC6H: number;
74
+ let RGB_HALF: number;
75
+ let RGBA_HALF: number;
76
+ }
77
+ namespace EngineFormat {
78
+ export { RGBAFormat };
79
+ export { RGBA_ASTC_4x4_Format };
80
+ export { RGB_BPTC_UNSIGNED_Format };
81
+ export { RGBA_BPTC_Format };
82
+ export { RGBA_ETC2_EAC_Format };
83
+ export { RGBA_PVRTC_4BPPV1_Format };
84
+ export { RGBA_S3TC_DXT5_Format };
85
+ export { RGB_ETC1_Format };
86
+ export { RGB_ETC2_Format };
87
+ export { RGB_PVRTC_4BPPV1_Format };
88
+ export { RGBA_S3TC_DXT1_Format };
89
+ }
90
+ namespace EngineType {
91
+ export { UnsignedByteType };
92
+ export { HalfFloatType };
93
+ export { FloatType };
94
+ }
95
+ function BasisWorker(): void;
96
+ }
97
+ import { Loader } from 'three';
98
+ import { WorkerPool } from '../utils/WorkerPool.js';
99
+ import { CompressedTexture } from 'three';
100
+ import { CompressedArrayTexture } from 'three';
101
+ import { DataTexture } from 'three';
102
+ import { Data3DTexture } from 'three';
103
+ import { RGBAFormat } from 'three';
104
+ import { RGBA_ASTC_4x4_Format } from 'three';
105
+ import { RGB_BPTC_UNSIGNED_Format } from 'three';
106
+ import { RGBA_BPTC_Format } from 'three';
107
+ import { RGBA_ETC2_EAC_Format } from 'three';
108
+ import { RGBA_PVRTC_4BPPV1_Format } from 'three';
109
+ import { RGBA_S3TC_DXT5_Format } from 'three';
110
+ import { RGB_ETC1_Format } from 'three';
111
+ import { RGB_ETC2_Format } from 'three';
112
+ import { RGB_PVRTC_4BPPV1_Format } from 'three';
113
+ import { RGBA_S3TC_DXT1_Format } from 'three';
114
+ import { UnsignedByteType } from 'three';
115
+ import { HalfFloatType } from 'three';
116
+ import { FloatType } from 'three';
@@ -175,7 +175,7 @@ class KTX2Loader extends Loader {
175
175
 
176
176
  /**
177
177
  * @param {ArrayBuffer} buffer
178
- * @param {object?} config
178
+ * @param {?Object} config
179
179
  * @return {Promise<CompressedTexture|CompressedArrayTexture|DataTexture|Data3DTexture>}
180
180
  */
181
181
  async _createTexture(buffer) {
@@ -566,7 +566,12 @@ KTX2Loader.BasisWorker = function () {
566
566
  return (value & value - 1) === 0 && value !== 0;
567
567
  }
568
568
 
569
- /** Concatenates N byte arrays. */
569
+ /**
570
+ * Concatenates N byte arrays.
571
+ *
572
+ * @param {Uint8Array[]} arrays
573
+ * @return {Uint8Array}
574
+ */
570
575
  function concat(arrays) {
571
576
  if (arrays.length === 1) return arrays[0];
572
577
  let totalByteLength = 0;
@@ -682,6 +687,8 @@ async function createRawTexture(container) {
682
687
  } else {
683
688
  if (container.pixelDepth > 0) throw new Error('THREE.KTX2Loader: Unsupported pixelDepth.');
684
689
  texture = new CompressedTexture(mipmaps, container.pixelWidth, container.pixelHeight);
690
+ texture.minFilter = mipmaps.length === 1 ? LinearFilter : LinearMipmapLinearFilter;
691
+ texture.magFilter = LinearFilter;
685
692
  }
686
693
  texture.mipmaps = mipmaps;
687
694
  texture.type = TYPE_MAP[vkFormat];
@@ -0,0 +1,56 @@
1
+ export const DisplayP3ColorSpace: "display-p3";
2
+ export const LinearDisplayP3ColorSpace: "display-p3-linear";
3
+ export namespace DisplayP3ColorSpaceImpl {
4
+ export { P3_PRIMARIES as primaries };
5
+ export { D65 as whitePoint };
6
+ export { SRGBTransfer as transfer };
7
+ export { LINEAR_DISPLAY_P3_TO_XYZ as toXYZ };
8
+ export { XYZ_TO_LINEAR_DISPLAY_P3 as fromXYZ };
9
+ export { P3_LUMINANCE_COEFFICIENTS as luminanceCoefficients };
10
+ export namespace outputColorSpaceConfig {
11
+ export { DisplayP3ColorSpace as drawingBufferColorSpace };
12
+ }
13
+ }
14
+ export namespace LinearDisplayP3ColorSpaceImpl {
15
+ export { P3_PRIMARIES as primaries };
16
+ export { D65 as whitePoint };
17
+ export { LinearTransfer as transfer };
18
+ export { LINEAR_DISPLAY_P3_TO_XYZ as toXYZ };
19
+ export { XYZ_TO_LINEAR_DISPLAY_P3 as fromXYZ };
20
+ export { P3_LUMINANCE_COEFFICIENTS as luminanceCoefficients };
21
+ export namespace workingColorSpaceConfig {
22
+ export { DisplayP3ColorSpace as unpackColorSpace };
23
+ }
24
+ export namespace outputColorSpaceConfig_1 {
25
+ export { DisplayP3ColorSpace as drawingBufferColorSpace };
26
+ }
27
+ export { outputColorSpaceConfig_1 as outputColorSpaceConfig };
28
+ }
29
+ export const LinearRec2020ColorSpace: "rec2020-linear";
30
+ export namespace LinearRec2020ColorSpaceImpl {
31
+ export { REC2020_PRIMARIES as primaries };
32
+ export { D65 as whitePoint };
33
+ export { LinearTransfer as transfer };
34
+ export { LINEAR_REC2020_TO_XYZ as toXYZ };
35
+ export { XYZ_TO_LINEAR_REC2020 as fromXYZ };
36
+ export { REC2020_LUMINANCE_COEFFICIENTS as luminanceCoefficients };
37
+ }
38
+ declare const P3_PRIMARIES: number[];
39
+ declare const D65: number[];
40
+ import { SRGBTransfer } from 'three';
41
+ /******************************************************************************
42
+ * Display P3 definitions
43
+ */
44
+ declare const LINEAR_DISPLAY_P3_TO_XYZ: Matrix3;
45
+ declare const XYZ_TO_LINEAR_DISPLAY_P3: Matrix3;
46
+ declare const P3_LUMINANCE_COEFFICIENTS: number[];
47
+ import { LinearTransfer } from 'three';
48
+ declare const REC2020_PRIMARIES: number[];
49
+ /******************************************************************************
50
+ * Rec. 2020 definitions
51
+ */
52
+ declare const LINEAR_REC2020_TO_XYZ: Matrix3;
53
+ declare const XYZ_TO_LINEAR_REC2020: Matrix3;
54
+ declare const REC2020_LUMINANCE_COEFFICIENTS: number[];
55
+ import { Matrix3 } from 'three';
56
+ export {};
@@ -0,0 +1,62 @@
1
+ /**
2
+ * @param {BufferAttribute} attribute
3
+ * @return {BufferAttribute}
4
+ */
5
+ export function deepCloneAttribute(attribute: BufferAttribute): BufferAttribute;
6
+ export function deinterleaveAttribute(attribute: any): BufferAttribute;
7
+ export function deinterleaveGeometry(geometry: any): void;
8
+ import { BufferAttribute } from 'three';
9
+ export function computeMikkTSpaceTangents(geometry: any, MikkTSpace: any, negateSign?: boolean): any;
10
+ /**
11
+ * @param {Array<BufferGeometry>} geometries
12
+ * @param {boolean} useGroups
13
+ * @return {BufferGeometry}
14
+ */
15
+ export function mergeGeometries(geometries: Array<BufferGeometry>, useGroups?: boolean): BufferGeometry;
16
+ /**
17
+ * @param {Array<BufferAttribute>} attributes
18
+ * @return {BufferAttribute}
19
+ */
20
+ export function mergeAttributes(attributes: Array<BufferAttribute>): BufferAttribute;
21
+ /**
22
+ * @param {Array<BufferAttribute>} attributes
23
+ * @return {Array<InterleavedBufferAttribute>}
24
+ */
25
+ export function interleaveAttributes(attributes: Array<BufferAttribute>): Array<InterleavedBufferAttribute>;
26
+ /**
27
+ * @param {BufferGeometry} geometry
28
+ * @return {number}
29
+ */
30
+ export function estimateBytesUsed(geometry: BufferGeometry): number;
31
+ /**
32
+ * @param {BufferGeometry} geometry
33
+ * @param {number} tolerance
34
+ * @return {BufferGeometry}
35
+ */
36
+ export function mergeVertices(geometry: BufferGeometry, tolerance?: number): BufferGeometry;
37
+ /**
38
+ * @param {BufferGeometry} geometry
39
+ * @param {number} drawMode
40
+ * @return {BufferGeometry}
41
+ */
42
+ export function toTrianglesDrawMode(geometry: BufferGeometry, drawMode: number): BufferGeometry;
43
+ /**
44
+ * Calculates the morphed attributes of a morphed/skinned BufferGeometry.
45
+ * Helpful for Raytracing or Decals.
46
+ * @param {Mesh | Line | Points} object An instance of Mesh, Line or Points.
47
+ * @return {Object} An Object with original position/normal attributes and morphed ones.
48
+ */
49
+ export function computeMorphedAttributes(object: Mesh | Line | Points): Object;
50
+ export function mergeGroups(geometry: any): any;
51
+ /**
52
+ * Modifies the supplied geometry if it is non-indexed, otherwise creates a new,
53
+ * non-indexed geometry. Returns the geometry with smooth normals everywhere except
54
+ * faces that meet at an angle greater than the crease angle.
55
+ *
56
+ * @param {BufferGeometry} geometry
57
+ * @param {number} [creaseAngle]
58
+ * @return {BufferGeometry}
59
+ */
60
+ export function toCreasedNormals(geometry: BufferGeometry, creaseAngle?: number): BufferGeometry;
61
+ import { BufferGeometry } from 'three';
62
+ import { InterleavedBufferAttribute } from 'three';
@@ -53,7 +53,7 @@ function computeMikkTSpaceTangents(geometry, MikkTSpace) {
53
53
 
54
54
  /**
55
55
  * @param {Array<BufferGeometry>} geometries
56
- * @param {Boolean} useGroups
56
+ * @param {boolean} useGroups
57
57
  * @return {BufferGeometry}
58
58
  */
59
59
  function mergeGeometries(geometries) {
@@ -233,7 +233,7 @@ function mergeAttributes(attributes) {
233
233
  }
234
234
 
235
235
  /**
236
- * @param {BufferAttribute}
236
+ * @param {BufferAttribute} attribute
237
237
  * @return {BufferAttribute}
238
238
  */
239
239
  export function deepCloneAttribute(attribute) {
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @author Deepkolos / https://github.com/deepkolos
3
+ */
4
+ export class WorkerPool {
5
+ constructor(pool?: number);
6
+ pool: number;
7
+ queue: any[];
8
+ workers: any[];
9
+ workersResolve: any[];
10
+ workerStatus: number;
11
+ _initWorker(workerId: any): void;
12
+ _getIdleWorker(): number;
13
+ _onMessage(workerId: any, msg: any): void;
14
+ setWorkerCreator(workerCreator: any): void;
15
+ workerCreator: any;
16
+ setWorkerLimit(pool: any): void;
17
+ postMessage(msg: any, transfer: any): Promise<any>;
18
+ dispose(): void;
19
+ }
@@ -0,0 +1,25 @@
1
+ export class XRControllerModelFactory {
2
+ constructor(gltfLoader?: null, onLoad?: null);
3
+ gltfLoader: GLTFLoader;
4
+ path: string;
5
+ _assetCache: {};
6
+ onLoad: any;
7
+ setPath(path: any): this;
8
+ createControllerModel(controller: any): XRControllerModel;
9
+ }
10
+ import { GLTFLoader } from '../loaders/GLTFLoader.js';
11
+ declare class XRControllerModel extends Object3D<import("three").Object3DEventMap> {
12
+ constructor();
13
+ motionController: any;
14
+ envMap: any;
15
+ setEnvironmentMap(envMap: any): this;
16
+ /**
17
+ * Polls data from the XRInputSource and updates the model's components to match
18
+ * the real world data
19
+ *
20
+ * @param {boolean} force
21
+ */
22
+ updateMatrixWorld(force: boolean): void;
23
+ }
24
+ import { Object3D } from 'three';
25
+ export {};
@@ -0,0 +1,209 @@
1
+ import { Mesh, MeshBasicMaterial, Object3D, SphereGeometry } from 'three';
2
+ import { GLTFLoader } from "../loaders/GLTFLoader.js";
3
+ import { Constants as MotionControllerConstants, fetchProfile, MotionController } from "../libs/motion-controllers.module.js";
4
+ const DEFAULT_PROFILES_PATH = 'https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles';
5
+ const DEFAULT_PROFILE = 'generic-trigger';
6
+ class XRControllerModel extends Object3D {
7
+ constructor() {
8
+ super();
9
+ this.motionController = null;
10
+ this.envMap = null;
11
+ }
12
+ setEnvironmentMap(envMap) {
13
+ if (this.envMap == envMap) {
14
+ return this;
15
+ }
16
+ this.envMap = envMap;
17
+ this.traverse(child => {
18
+ if (child.isMesh) {
19
+ child.material.envMap = this.envMap;
20
+ child.material.needsUpdate = true;
21
+ }
22
+ });
23
+ return this;
24
+ }
25
+
26
+ /**
27
+ * Polls data from the XRInputSource and updates the model's components to match
28
+ * the real world data
29
+ *
30
+ * @param {boolean} force
31
+ */
32
+ updateMatrixWorld(force) {
33
+ super.updateMatrixWorld(force);
34
+ if (!this.motionController) return;
35
+
36
+ // Cause the MotionController to poll the Gamepad for data
37
+ this.motionController.updateFromGamepad();
38
+
39
+ // Update the 3D model to reflect the button, thumbstick, and touchpad state
40
+ Object.values(this.motionController.components).forEach(component => {
41
+ // Update node data based on the visual responses' current states
42
+ Object.values(component.visualResponses).forEach(visualResponse => {
43
+ const {
44
+ valueNode,
45
+ minNode,
46
+ maxNode,
47
+ value,
48
+ valueNodeProperty
49
+ } = visualResponse;
50
+
51
+ // Skip if the visual response node is not found. No error is needed,
52
+ // because it will have been reported at load time.
53
+ if (!valueNode) return;
54
+
55
+ // Calculate the new properties based on the weight supplied
56
+ if (valueNodeProperty === MotionControllerConstants.VisualResponseProperty.VISIBILITY) {
57
+ valueNode.visible = value;
58
+ } else if (valueNodeProperty === MotionControllerConstants.VisualResponseProperty.TRANSFORM) {
59
+ valueNode.quaternion.slerpQuaternions(minNode.quaternion, maxNode.quaternion, value);
60
+ valueNode.position.lerpVectors(minNode.position, maxNode.position, value);
61
+ }
62
+ });
63
+ });
64
+ }
65
+ }
66
+
67
+ /**
68
+ * Walks the model's tree to find the nodes needed to animate the components and
69
+ * saves them to the motionController components for use in the frame loop. When
70
+ * touchpads are found, attaches a touch dot to them.
71
+ *
72
+ * @param {MotionController} motionController
73
+ * @param {Object3D} scene
74
+ */
75
+ function findNodes(motionController, scene) {
76
+ // Loop through the components and find the nodes needed for each components' visual responses
77
+ Object.values(motionController.components).forEach(component => {
78
+ const {
79
+ type,
80
+ touchPointNodeName,
81
+ visualResponses
82
+ } = component;
83
+ if (type === MotionControllerConstants.ComponentType.TOUCHPAD) {
84
+ component.touchPointNode = scene.getObjectByName(touchPointNodeName);
85
+ if (component.touchPointNode) {
86
+ // Attach a touch dot to the touchpad.
87
+ const sphereGeometry = new SphereGeometry(0.001);
88
+ const material = new MeshBasicMaterial({
89
+ color: 0x0000FF
90
+ });
91
+ const sphere = new Mesh(sphereGeometry, material);
92
+ component.touchPointNode.add(sphere);
93
+ } else {
94
+ console.warn(`Could not find touch dot, ${component.touchPointNodeName}, in touchpad component ${component.id}`);
95
+ }
96
+ }
97
+
98
+ // Loop through all the visual responses to be applied to this component
99
+ Object.values(visualResponses).forEach(visualResponse => {
100
+ const {
101
+ valueNodeName,
102
+ minNodeName,
103
+ maxNodeName,
104
+ valueNodeProperty
105
+ } = visualResponse;
106
+
107
+ // If animating a transform, find the two nodes to be interpolated between.
108
+ if (valueNodeProperty === MotionControllerConstants.VisualResponseProperty.TRANSFORM) {
109
+ visualResponse.minNode = scene.getObjectByName(minNodeName);
110
+ visualResponse.maxNode = scene.getObjectByName(maxNodeName);
111
+
112
+ // If the extents cannot be found, skip this animation
113
+ if (!visualResponse.minNode) {
114
+ console.warn(`Could not find ${minNodeName} in the model`);
115
+ return;
116
+ }
117
+ if (!visualResponse.maxNode) {
118
+ console.warn(`Could not find ${maxNodeName} in the model`);
119
+ return;
120
+ }
121
+ }
122
+
123
+ // If the target node cannot be found, skip this animation
124
+ visualResponse.valueNode = scene.getObjectByName(valueNodeName);
125
+ if (!visualResponse.valueNode) {
126
+ console.warn(`Could not find ${valueNodeName} in the model`);
127
+ }
128
+ });
129
+ });
130
+ }
131
+ function addAssetSceneToControllerModel(controllerModel, scene) {
132
+ // Find the nodes needed for animation and cache them on the motionController.
133
+ findNodes(controllerModel.motionController, scene);
134
+
135
+ // Apply any environment map that the mesh already has set.
136
+ if (controllerModel.envMap) {
137
+ scene.traverse(child => {
138
+ if (child.isMesh) {
139
+ child.material.envMap = controllerModel.envMap;
140
+ child.material.needsUpdate = true;
141
+ }
142
+ });
143
+ }
144
+
145
+ // Add the glTF scene to the controllerModel.
146
+ controllerModel.add(scene);
147
+ }
148
+ class XRControllerModelFactory {
149
+ constructor() {
150
+ let gltfLoader = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
151
+ let onLoad = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
152
+ this.gltfLoader = gltfLoader;
153
+ this.path = DEFAULT_PROFILES_PATH;
154
+ this._assetCache = {};
155
+ this.onLoad = onLoad;
156
+
157
+ // If a GLTFLoader wasn't supplied to the constructor create a new one.
158
+ if (!this.gltfLoader) {
159
+ this.gltfLoader = new GLTFLoader();
160
+ }
161
+ }
162
+ setPath(path) {
163
+ this.path = path;
164
+ return this;
165
+ }
166
+ createControllerModel(controller) {
167
+ const controllerModel = new XRControllerModel();
168
+ let scene = null;
169
+ controller.addEventListener('connected', event => {
170
+ const xrInputSource = event.data;
171
+ if (xrInputSource.targetRayMode !== 'tracked-pointer' || !xrInputSource.gamepad || xrInputSource.hand) return;
172
+ fetchProfile(xrInputSource, this.path, DEFAULT_PROFILE).then(_ref => {
173
+ let {
174
+ profile,
175
+ assetPath
176
+ } = _ref;
177
+ controllerModel.motionController = new MotionController(xrInputSource, profile, assetPath);
178
+ const cachedAsset = this._assetCache[controllerModel.motionController.assetUrl];
179
+ if (cachedAsset) {
180
+ scene = cachedAsset.scene.clone();
181
+ addAssetSceneToControllerModel(controllerModel, scene);
182
+ if (this.onLoad) this.onLoad(scene);
183
+ } else {
184
+ if (!this.gltfLoader) {
185
+ throw new Error('GLTFLoader not set.');
186
+ }
187
+ this.gltfLoader.setPath('');
188
+ this.gltfLoader.load(controllerModel.motionController.assetUrl, asset => {
189
+ this._assetCache[controllerModel.motionController.assetUrl] = asset;
190
+ scene = asset.scene.clone();
191
+ addAssetSceneToControllerModel(controllerModel, scene);
192
+ if (this.onLoad) this.onLoad(scene);
193
+ }, null, () => {
194
+ throw new Error(`Asset ${controllerModel.motionController.assetUrl} missing or malformed.`);
195
+ });
196
+ }
197
+ }).catch(err => {
198
+ console.warn(err);
199
+ });
200
+ });
201
+ controller.addEventListener('disconnected', () => {
202
+ controllerModel.motionController = null;
203
+ controllerModel.remove(scene);
204
+ scene = null;
205
+ });
206
+ return controllerModel;
207
+ }
208
+ }
209
+ export { XRControllerModelFactory };
@@ -0,0 +1,132 @@
1
+ export function getLookAtFromMath(view: any, camera: any): false | THREE.Vector3;
2
+ export function getRig(camera: any): any;
3
+ declare namespace _default {
4
+ let defaultStopPlaceOnGroundAtEnd: boolean;
5
+ let Easing: Readonly<{
6
+ Linear: Readonly<{
7
+ In: (amount: number) => number;
8
+ Out: (amount: number) => number;
9
+ InOut: (amount: number) => number;
10
+ } & {
11
+ None: (amount: number) => number;
12
+ }>;
13
+ Quadratic: Readonly<{
14
+ In: (amount: number) => number;
15
+ Out: (amount: number) => number;
16
+ InOut: (amount: number) => number;
17
+ }>;
18
+ Cubic: Readonly<{
19
+ In: (amount: number) => number;
20
+ Out: (amount: number) => number;
21
+ InOut: (amount: number) => number;
22
+ }>;
23
+ Quartic: Readonly<{
24
+ In: (amount: number) => number;
25
+ Out: (amount: number) => number;
26
+ InOut: (amount: number) => number;
27
+ }>;
28
+ Quintic: Readonly<{
29
+ In: (amount: number) => number;
30
+ Out: (amount: number) => number;
31
+ InOut: (amount: number) => number;
32
+ }>;
33
+ Sinusoidal: Readonly<{
34
+ In: (amount: number) => number;
35
+ Out: (amount: number) => number;
36
+ InOut: (amount: number) => number;
37
+ }>;
38
+ Exponential: Readonly<{
39
+ In: (amount: number) => number;
40
+ Out: (amount: number) => number;
41
+ InOut: (amount: number) => number;
42
+ }>;
43
+ Circular: Readonly<{
44
+ In: (amount: number) => number;
45
+ Out: (amount: number) => number;
46
+ InOut: (amount: number) => number;
47
+ }>;
48
+ Elastic: Readonly<{
49
+ In: (amount: number) => number;
50
+ Out: (amount: number) => number;
51
+ InOut: (amount: number) => number;
52
+ }>;
53
+ Back: Readonly<{
54
+ In: (amount: number) => number;
55
+ Out: (amount: number) => number;
56
+ InOut: (amount: number) => number;
57
+ }>;
58
+ Bounce: Readonly<{
59
+ In: (amount: number) => number;
60
+ Out: (amount: number) => number;
61
+ InOut: (amount: number) => number;
62
+ }>;
63
+ generatePow(power?: number): {
64
+ In: (amount: number) => number;
65
+ Out: (amount: number) => number;
66
+ InOut: (amount: number) => number;
67
+ };
68
+ }>;
69
+ /**
70
+ * Stop camera's animation
71
+ *
72
+ * @param {View} view The camera view
73
+ * @param {Camera} camera The camera to stop animation
74
+ */
75
+ function stop(view: View, camera: Camera): void;
76
+ /**
77
+ * Gets the current parameters transform camera looking at target.
78
+ *
79
+ * @param {View} view The camera view
80
+ * @param {Camera} camera The camera to get transform
81
+ * @param {THREE.Vector3} [target] - The optional target
82
+ * @return {CameraUtils~CameraTransformOptions} The transform camera looking at target
83
+ */
84
+ function getTransformCameraLookingAtTarget(view: View, camera: Camera, target?: THREE.Vector3): CameraUtils;
85
+ /**
86
+ * Apply transform to camera
87
+ *
88
+ * @param {View} view The camera view
89
+ * @param {Camera} camera The camera to transform
90
+ * @param {CameraUtils~CameraTransformOptions|Extent} params The parameters
91
+ * @return {Promise} promise with resolve final CameraUtils~CameraTransformOptions
92
+ */
93
+ function transformCameraToLookAtTarget(view: View, camera: Camera, params?: {}): Promise<any>;
94
+ /**
95
+ * Compute the CameraTransformOptions that allow a given camera to display a given extent in its entirety.
96
+ *
97
+ * @param {View} view The camera view
98
+ * @param {THREE.Camera} camera The camera to get the CameraTransformOptions from
99
+ * @param {Extent} extent The extent the camera must display
100
+ *
101
+ * @return {CameraUtils~CameraTransformOptions} The CameraTransformOptions allowing camera to display the extent.
102
+ */
103
+ function getCameraTransformOptionsFromExtent(view: View, camera: THREE.Camera, extent: Extent): CameraUtils;
104
+ /**
105
+ * Apply transform to camera with animation
106
+ *
107
+ * @param {View} view The camera view
108
+ * @param {Camera} camera The camera to animate
109
+ * @param {CameraUtils~CameraTransformOptions} params The parameters
110
+ * @return {Promise} promise with resolve final CameraUtils~CameraTransformOptions
111
+ */
112
+ function animateCameraToLookAtTarget(view: View, camera: Camera, params?: {}): Promise<any>;
113
+ /**
114
+ * chain animation transform to camera
115
+ *
116
+ * @param {View} view The camera view
117
+ * @param {Camera} camera The camera to animate
118
+ * @param {CameraUtils~CameraTransformOptions[]} params array parameters, each parameters transforms are apply to camera, in serial
119
+ * @return {Promise} promise with resolve final CameraUtils~CameraTransformOptions
120
+ */
121
+ function sequenceAnimationsToLookAtTarget(view: View, camera: Camera, params?: {}[]): Promise<any>;
122
+ /**
123
+ * Gets the difference camera transformation
124
+ *
125
+ * @param {CameraUtils~CameraTransformOptions} first param to compare with the second
126
+ * @param {CameraUtils~CameraTransformOptions} second param to compare with the first
127
+ * @return {object} The difference parameters
128
+ */
129
+ function getDiffParams(first: any, second: any): object;
130
+ }
131
+ export default _default;
132
+ import * as THREE from 'three';