@xeokit/xeokit-sdk 2.5.2-beta-11 → 2.5.2-beta-16

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 (463) hide show
  1. package/dist/xeokit-sdk.cjs.js +176 -141
  2. package/dist/xeokit-sdk.es.js +176 -141
  3. package/dist/xeokit-sdk.es5.js +151 -149
  4. package/dist/xeokit-sdk.min.cjs.js +2 -2
  5. package/dist/xeokit-sdk.min.es.js +2 -2
  6. package/dist/xeokit-sdk.min.es5.js +2 -2
  7. package/package.json +1 -1
  8. package/src/viewer/metadata/MetaModel.js +15 -0
  9. package/src/viewer/metadata/MetaScene.js +15 -9
  10. package/src/viewer/scene/model/SceneModel.js +1 -1
  11. package/src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js +1 -1
  12. package/src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js +1 -1
  13. package/src/viewer/scene/webgl/Renderer.js +20 -19
  14. package/src/plugins/XKTLoaderPlugin/parsers/ParserV11.js +0 -663
  15. package/src/src/extras/ContextMenu/ContextMenu.js +0 -907
  16. package/src/src/extras/ContextMenu/index.js +0 -1
  17. package/src/src/extras/MarqueePicker/MarqueePicker.js +0 -352
  18. package/src/src/extras/MarqueePicker/MarqueePickerMouseControl.js +0 -174
  19. package/src/src/extras/MarqueePicker/index.js +0 -2
  20. package/src/src/extras/PointerLens/PointerLens.js +0 -312
  21. package/src/src/extras/PointerLens/index.js +0 -1
  22. package/src/src/extras/collision/ObjectsKdTree3.js +0 -149
  23. package/src/src/extras/collision/index.js +0 -1
  24. package/src/src/extras/index.js +0 -4
  25. package/src/src/index.js +0 -3
  26. package/src/src/plugins/AngleMeasurementsPlugin/AngleMeasurement.js +0 -731
  27. package/src/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsControl.js +0 -84
  28. package/src/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js +0 -435
  29. package/src/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsPlugin.js +0 -406
  30. package/src/src/plugins/AngleMeasurementsPlugin/index.js +0 -3
  31. package/src/src/plugins/AnnotationsPlugin/Annotation.js +0 -368
  32. package/src/src/plugins/AnnotationsPlugin/AnnotationsPlugin.js +0 -583
  33. package/src/src/plugins/AnnotationsPlugin/index.js +0 -1
  34. package/src/src/plugins/AxisGizmoPlugin/AxisGizmoPlugin.js +0 -333
  35. package/src/src/plugins/AxisGizmoPlugin/index.js +0 -1
  36. package/src/src/plugins/BCFViewpointsPlugin/BCFViewpointsPlugin.js +0 -977
  37. package/src/src/plugins/BCFViewpointsPlugin/index.js +0 -1
  38. package/src/src/plugins/CityJSONLoaderPlugin/CityJSONDefaultDataSource.js +0 -29
  39. package/src/src/plugins/CityJSONLoaderPlugin/CityJSONLoaderPlugin.js +0 -751
  40. package/src/src/plugins/CityJSONLoaderPlugin/index.js +0 -1
  41. package/src/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js +0 -963
  42. package/src/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsControl.js +0 -84
  43. package/src/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js +0 -399
  44. package/src/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsPlugin.js +0 -505
  45. package/src/src/plugins/DistanceMeasurementsPlugin/index.js +0 -3
  46. package/src/src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesControl.js +0 -639
  47. package/src/src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesPlugin.js +0 -436
  48. package/src/src/plugins/FaceAlignedSectionPlanesPlugin/Overview.js +0 -247
  49. package/src/src/plugins/FaceAlignedSectionPlanesPlugin/Plane.js +0 -167
  50. package/src/src/plugins/FaceAlignedSectionPlanesPlugin/index.js +0 -1
  51. package/src/src/plugins/FastNavPlugin/FastNavPlugin.js +0 -429
  52. package/src/src/plugins/FastNavPlugin/index.js +0 -1
  53. package/src/src/plugins/GLTFLoaderPlugin/GLTFDefaultDataSource.js +0 -140
  54. package/src/src/plugins/GLTFLoaderPlugin/GLTFLoaderPlugin.js +0 -421
  55. package/src/src/plugins/GLTFLoaderPlugin/GLTFSceneModelLoader.js +0 -669
  56. package/src/src/plugins/GLTFLoaderPlugin/index.js +0 -2
  57. package/src/src/plugins/LASLoaderPlugin/LASDefaultDataSource.js +0 -58
  58. package/src/src/plugins/LASLoaderPlugin/LASLoaderPlugin.js +0 -563
  59. package/src/src/plugins/LASLoaderPlugin/index.js +0 -1
  60. package/src/src/plugins/LASLoaderPlugin/loadLASHeader.js +0 -183
  61. package/src/src/plugins/NavCubePlugin/CubeTextureCanvas.js +0 -290
  62. package/src/src/plugins/NavCubePlugin/NavCubePlugin.js +0 -753
  63. package/src/src/plugins/NavCubePlugin/index.js +0 -1
  64. package/src/src/plugins/OBJLoaderPlugin/OBJLoaderPlugin.js +0 -145
  65. package/src/src/plugins/OBJLoaderPlugin/OBJSceneGraphLoader.js +0 -777
  66. package/src/src/plugins/OBJLoaderPlugin/index.js +0 -1
  67. package/src/src/plugins/STLLoaderPlugin/STLDefaultDataSource.js +0 -33
  68. package/src/src/plugins/STLLoaderPlugin/STLLoaderPlugin.js +0 -274
  69. package/src/src/plugins/STLLoaderPlugin/STLSceneGraphLoader.js +0 -313
  70. package/src/src/plugins/STLLoaderPlugin/index.js +0 -2
  71. package/src/src/plugins/SectionPlanesPlugin/Control.js +0 -1328
  72. package/src/src/plugins/SectionPlanesPlugin/Overview.js +0 -249
  73. package/src/src/plugins/SectionPlanesPlugin/Plane.js +0 -169
  74. package/src/src/plugins/SectionPlanesPlugin/SectionPlanesPlugin.js +0 -404
  75. package/src/src/plugins/SectionPlanesPlugin/index.js +0 -1
  76. package/src/src/plugins/SkyboxesPlugin/SkyboxesPlugin.js +0 -134
  77. package/src/src/plugins/SkyboxesPlugin/index.js +0 -1
  78. package/src/src/plugins/StoreyViewsPlugin/Storey.js +0 -84
  79. package/src/src/plugins/StoreyViewsPlugin/StoreyMap.js +0 -57
  80. package/src/src/plugins/StoreyViewsPlugin/StoreyViewsPlugin.js +0 -773
  81. package/src/src/plugins/StoreyViewsPlugin/index.js +0 -1
  82. package/src/src/plugins/TreeViewPlugin/RenderService.js +0 -169
  83. package/src/src/plugins/TreeViewPlugin/TreeViewNode.js +0 -101
  84. package/src/src/plugins/TreeViewPlugin/TreeViewPlugin.js +0 -1370
  85. package/src/src/plugins/TreeViewPlugin/index.js +0 -1
  86. package/src/src/plugins/ViewCullPlugin/ViewCullPlugin.js +0 -295
  87. package/src/src/plugins/ViewCullPlugin/index.js +0 -1
  88. package/src/src/plugins/WebIFCLoaderPlugin/WebIFCDefaultDataSource.js +0 -58
  89. package/src/src/plugins/WebIFCLoaderPlugin/WebIFCLoaderPlugin.js +0 -942
  90. package/src/src/plugins/WebIFCLoaderPlugin/index.js +0 -1
  91. package/src/src/plugins/XKTLoaderPlugin/XKTDefaultDataSource.js +0 -95
  92. package/src/src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js +0 -1194
  93. package/src/src/plugins/XKTLoaderPlugin/index.js +0 -2
  94. package/src/src/plugins/XKTLoaderPlugin/parsers/ParserV1.js +0 -169
  95. package/src/src/plugins/XKTLoaderPlugin/parsers/ParserV10.js +0 -660
  96. package/src/src/plugins/XKTLoaderPlugin/parsers/ParserV11.js +0 -663
  97. package/src/src/plugins/XKTLoaderPlugin/parsers/ParserV2.js +0 -230
  98. package/src/src/plugins/XKTLoaderPlugin/parsers/ParserV3.js +0 -223
  99. package/src/src/plugins/XKTLoaderPlugin/parsers/ParserV4.js +0 -283
  100. package/src/src/plugins/XKTLoaderPlugin/parsers/ParserV5.js +0 -246
  101. package/src/src/plugins/XKTLoaderPlugin/parsers/ParserV6.js +0 -301
  102. package/src/src/plugins/XKTLoaderPlugin/parsers/ParserV7.js +0 -439
  103. package/src/src/plugins/XKTLoaderPlugin/parsers/ParserV8.js +0 -563
  104. package/src/src/plugins/XKTLoaderPlugin/parsers/ParserV9.js +0 -518
  105. package/src/src/plugins/XKTLoaderPlugin/parsers/lib/pako.js +0 -2
  106. package/src/src/plugins/XML3DLoaderPlugin/XML3DLoaderPlugin.js +0 -238
  107. package/src/src/plugins/XML3DLoaderPlugin/XML3DSceneGraphLoader.js +0 -1279
  108. package/src/src/plugins/XML3DLoaderPlugin/index.js +0 -1
  109. package/src/src/plugins/XML3DLoaderPlugin/zipjs/.jshintrc +0 -11
  110. package/src/src/plugins/XML3DLoaderPlugin/zipjs/deflate.js +0 -2060
  111. package/src/src/plugins/XML3DLoaderPlugin/zipjs/inflate.js +0 -2155
  112. package/src/src/plugins/XML3DLoaderPlugin/zipjs/mime-types.js +0 -1002
  113. package/src/src/plugins/XML3DLoaderPlugin/zipjs/pako/codecs.js +0 -64
  114. package/src/src/plugins/XML3DLoaderPlugin/zipjs/z-worker.js +0 -153
  115. package/src/src/plugins/XML3DLoaderPlugin/zipjs/zip-ext.js +0 -267
  116. package/src/src/plugins/XML3DLoaderPlugin/zipjs/zip-fs.js +0 -553
  117. package/src/src/plugins/XML3DLoaderPlugin/zipjs/zip.js +0 -991
  118. package/src/src/plugins/XML3DLoaderPlugin/zipjs/zlib-asm/codecs.js +0 -49
  119. package/src/src/plugins/index.js +0 -21
  120. package/src/src/plugins/lib/culling/ObjectCullStates.js +0 -208
  121. package/src/src/plugins/lib/earcut.js +0 -677
  122. package/src/src/plugins/lib/html/Dot.js +0 -179
  123. package/src/src/plugins/lib/html/Label.js +0 -174
  124. package/src/src/plugins/lib/html/Wire.js +0 -220
  125. package/src/src/viewer/Configs.js +0 -127
  126. package/src/src/viewer/Plugin.js +0 -233
  127. package/src/src/viewer/Viewer.js +0 -542
  128. package/src/src/viewer/index.js +0 -5
  129. package/src/src/viewer/localization/LocaleService.js +0 -475
  130. package/src/src/viewer/metadata/IFCObjectDefaultColors.js +0 -163
  131. package/src/src/viewer/metadata/IFCObjectDefaults.js +0 -17
  132. package/src/src/viewer/metadata/MetaModel.js +0 -414
  133. package/src/src/viewer/metadata/MetaObject.js +0 -223
  134. package/src/src/viewer/metadata/MetaScene.js +0 -336
  135. package/src/src/viewer/metadata/Property.js +0 -55
  136. package/src/src/viewer/metadata/PropertySet.js +0 -77
  137. package/src/src/viewer/scene/Bitmap/Bitmap.js +0 -473
  138. package/src/src/viewer/scene/Bitmap/index.js +0 -1
  139. package/src/src/viewer/scene/CameraControl/CameraControl.js +0 -1750
  140. package/src/src/viewer/scene/CameraControl/lib/CameraUpdater.js +0 -312
  141. package/src/src/viewer/scene/CameraControl/lib/controllers/PanController.js +0 -112
  142. package/src/src/viewer/scene/CameraControl/lib/controllers/PickController.js +0 -265
  143. package/src/src/viewer/scene/CameraControl/lib/controllers/PivotController.js +0 -384
  144. package/src/src/viewer/scene/CameraControl/lib/handlers/KeyboardAxisViewHandler.js +0 -122
  145. package/src/src/viewer/scene/CameraControl/lib/handlers/KeyboardPanRotateDollyHandler.js +0 -183
  146. package/src/src/viewer/scene/CameraControl/lib/handlers/MouseMiscHandler.js +0 -68
  147. package/src/src/viewer/scene/CameraControl/lib/handlers/MousePanRotateDollyHandler.js +0 -345
  148. package/src/src/viewer/scene/CameraControl/lib/handlers/MousePickHandler.js +0 -376
  149. package/src/src/viewer/scene/CameraControl/lib/handlers/TouchPanRotateAndDollyHandler.js +0 -288
  150. package/src/src/viewer/scene/CameraControl/lib/handlers/TouchPickHandler.js +0 -235
  151. package/src/src/viewer/scene/Component.js +0 -915
  152. package/src/src/viewer/scene/Entity.js +0 -502
  153. package/src/src/viewer/scene/ImagePlane/ImagePlane.js +0 -570
  154. package/src/src/viewer/scene/ImagePlane/index.js +0 -1
  155. package/src/src/viewer/scene/LineSet/LineSet.js +0 -163
  156. package/src/src/viewer/scene/LineSet/index.js +0 -1
  157. package/src/src/viewer/scene/camera/Camera.js +0 -912
  158. package/src/src/viewer/scene/camera/CameraFlightAnimation.js +0 -669
  159. package/src/src/viewer/scene/camera/CameraPath.js +0 -194
  160. package/src/src/viewer/scene/camera/CameraPathAnimation.js +0 -326
  161. package/src/src/viewer/scene/camera/CustomProjection.js +0 -149
  162. package/src/src/viewer/scene/camera/Frustum.js +0 -316
  163. package/src/src/viewer/scene/camera/Ortho.js +0 -286
  164. package/src/src/viewer/scene/camera/Perspective.js +0 -304
  165. package/src/src/viewer/scene/camera/index.js +0 -2
  166. package/src/src/viewer/scene/canvas/Canvas.js +0 -490
  167. package/src/src/viewer/scene/canvas/Spinner.js +0 -323
  168. package/src/src/viewer/scene/constants/constants.js +0 -371
  169. package/src/src/viewer/scene/core.js +0 -268
  170. package/src/src/viewer/scene/geometry/Geometry.js +0 -33
  171. package/src/src/viewer/scene/geometry/ReadableGeometry.js +0 -682
  172. package/src/src/viewer/scene/geometry/VBOGeometry.js +0 -319
  173. package/src/src/viewer/scene/geometry/builders/buildBoxGeometry.js +0 -238
  174. package/src/src/viewer/scene/geometry/builders/buildBoxLinesGeometry.js +0 -106
  175. package/src/src/viewer/scene/geometry/builders/buildCylinderGeometry.js +0 -271
  176. package/src/src/viewer/scene/geometry/builders/buildGridGeometry.js +0 -102
  177. package/src/src/viewer/scene/geometry/builders/buildPlaneGeometry.js +0 -168
  178. package/src/src/viewer/scene/geometry/builders/buildSphereGeometry.js +0 -161
  179. package/src/src/viewer/scene/geometry/builders/buildTorusGeometry.js +0 -172
  180. package/src/src/viewer/scene/geometry/builders/buildVectorTextGeometry.js +0 -1721
  181. package/src/src/viewer/scene/geometry/builders/index.js +0 -8
  182. package/src/src/viewer/scene/geometry/index.js +0 -4
  183. package/src/src/viewer/scene/geometry/loaders/index.js +0 -2
  184. package/src/src/viewer/scene/geometry/loaders/load3DSGeometry.js +0 -103
  185. package/src/src/viewer/scene/geometry/loaders/loadOBJGeometry.js +0 -130
  186. package/src/src/viewer/scene/index.js +0 -21
  187. package/src/src/viewer/scene/input/Input.js +0 -1333
  188. package/src/src/viewer/scene/libs/k3d.js +0 -1032
  189. package/src/src/viewer/scene/lights/AmbientLight.js +0 -175
  190. package/src/src/viewer/scene/lights/CubeTexture.js +0 -156
  191. package/src/src/viewer/scene/lights/DirLight.js +0 -314
  192. package/src/src/viewer/scene/lights/Light.js +0 -29
  193. package/src/src/viewer/scene/lights/LightMap.js +0 -77
  194. package/src/src/viewer/scene/lights/PointLight.js +0 -395
  195. package/src/src/viewer/scene/lights/ReflectionMap.js +0 -79
  196. package/src/src/viewer/scene/lights/Shadow.js +0 -138
  197. package/src/src/viewer/scene/lights/index.js +0 -5
  198. package/src/src/viewer/scene/marker/Marker.js +0 -383
  199. package/src/src/viewer/scene/marker/SpriteMarker.js +0 -356
  200. package/src/src/viewer/scene/marker/index.js +0 -2
  201. package/src/src/viewer/scene/materials/EdgeMaterial.js +0 -359
  202. package/src/src/viewer/scene/materials/EmphasisMaterial.js +0 -613
  203. package/src/src/viewer/scene/materials/Fresnel.js +0 -222
  204. package/src/src/viewer/scene/materials/LambertMaterial.js +0 -378
  205. package/src/src/viewer/scene/materials/LinesMaterial.js +0 -169
  206. package/src/src/viewer/scene/materials/Material.js +0 -39
  207. package/src/src/viewer/scene/materials/MetallicMaterial.js +0 -820
  208. package/src/src/viewer/scene/materials/PhongMaterial.js +0 -860
  209. package/src/src/viewer/scene/materials/PointsMaterial.js +0 -409
  210. package/src/src/viewer/scene/materials/SpecularMaterial.js +0 -807
  211. package/src/src/viewer/scene/materials/Texture.js +0 -513
  212. package/src/src/viewer/scene/materials/index.js +0 -8
  213. package/src/src/viewer/scene/math/Frustum.js +0 -118
  214. package/src/src/viewer/scene/math/buildEdgeIndices.js +0 -162
  215. package/src/src/viewer/scene/math/geometryCompressionUtils.js +0 -365
  216. package/src/src/viewer/scene/math/index.js +0 -3
  217. package/src/src/viewer/scene/math/math.js +0 -5386
  218. package/src/src/viewer/scene/math/rtcCoords.js +0 -139
  219. package/src/src/viewer/scene/mementos/CameraMemento.js +0 -200
  220. package/src/src/viewer/scene/mementos/ModelMemento.js +0 -263
  221. package/src/src/viewer/scene/mementos/ObjectsMemento.js +0 -259
  222. package/src/src/viewer/scene/mementos/index.js +0 -3
  223. package/src/src/viewer/scene/mesh/Mesh.js +0 -2202
  224. package/src/src/viewer/scene/mesh/draw/DrawRenderer.js +0 -996
  225. package/src/src/viewer/scene/mesh/draw/DrawShaderSource.js +0 -1570
  226. package/src/src/viewer/scene/mesh/emphasis/EmphasisEdgesRenderer.js +0 -259
  227. package/src/src/viewer/scene/mesh/emphasis/EmphasisEdgesShaderSource.js +0 -159
  228. package/src/src/viewer/scene/mesh/emphasis/EmphasisFillRenderer.js +0 -286
  229. package/src/src/viewer/scene/mesh/emphasis/EmphasisFillShaderSource.js +0 -262
  230. package/src/src/viewer/scene/mesh/index.js +0 -1
  231. package/src/src/viewer/scene/mesh/occlusion/OcclusionRenderer.js +0 -217
  232. package/src/src/viewer/scene/mesh/occlusion/OcclusionShaderSource.js +0 -157
  233. package/src/src/viewer/scene/mesh/pick/PickMeshRenderer.js +0 -223
  234. package/src/src/viewer/scene/mesh/pick/PickMeshShaderSource.js +0 -151
  235. package/src/src/viewer/scene/mesh/pick/PickTriangleRenderer.js +0 -200
  236. package/src/src/viewer/scene/mesh/pick/PickTriangleShaderSource.js +0 -124
  237. package/src/src/viewer/scene/mesh/shadow/ShadowRenderer.js +0 -214
  238. package/src/src/viewer/scene/mesh/shadow/ShadowShaderSource.js +0 -98
  239. package/src/src/viewer/scene/metriqs/Metriqs.js +0 -259
  240. package/src/src/viewer/scene/model/ENTITY_FLAGS.js +0 -21
  241. package/src/src/viewer/scene/model/PerformanceModel.js +0 -26
  242. package/src/src/viewer/scene/model/RENDER_PASSES.js +0 -34
  243. package/src/src/viewer/scene/model/SceneModel.js +0 -4018
  244. package/src/src/viewer/scene/model/SceneModelEntity.js +0 -715
  245. package/src/src/viewer/scene/model/SceneModelMesh.js +0 -341
  246. package/src/src/viewer/scene/model/SceneModelTexture.js +0 -38
  247. package/src/src/viewer/scene/model/SceneModelTextureSet.js +0 -59
  248. package/src/src/viewer/scene/model/SceneModelTransform.js +0 -404
  249. package/src/src/viewer/scene/model/VBOSceneModel.js +0 -26
  250. package/src/src/viewer/scene/model/calculateUniquePositions.js +0 -126
  251. package/src/src/viewer/scene/model/compression.js +0 -227
  252. package/src/src/viewer/scene/model/dtx/BindableDataTexture.js +0 -31
  253. package/src/src/viewer/scene/model/dtx/lines/DTXLinesBuffer.js +0 -27
  254. package/src/src/viewer/scene/model/dtx/lines/DTXLinesLayer.js +0 -891
  255. package/src/src/viewer/scene/model/dtx/lines/DTXLinesState.js +0 -46
  256. package/src/src/viewer/scene/model/dtx/lines/DTXLinesTextureFactory.js +0 -411
  257. package/src/src/viewer/scene/model/dtx/lines/dataTextureRamStats.js +0 -49
  258. package/src/src/viewer/scene/model/dtx/lines/rebucketPositions.js +0 -208
  259. package/src/src/viewer/scene/model/dtx/lines/renderers/DTXLinesColorRenderer.js +0 -389
  260. package/src/src/viewer/scene/model/dtx/lines/renderers/DTXLinesRenderers.js +0 -65
  261. package/src/src/viewer/scene/model/dtx/triangles/DTXTrianglesLayer.js +0 -1322
  262. package/src/src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesBuffer.js +0 -46
  263. package/src/src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesState.js +0 -250
  264. package/src/src/viewer/scene/model/dtx/triangles/lib/DTXTrianglesTextureFactory.js +0 -518
  265. package/src/src/viewer/scene/model/dtx/triangles/lib/dataTextureRamStats.js +0 -54
  266. package/src/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesColorRenderer.js +0 -619
  267. package/src/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesDepthRenderer.js +0 -464
  268. package/src/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesColorRenderer.js +0 -414
  269. package/src/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesRenderer.js +0 -422
  270. package/src/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesNormalsRenderer.js +0 -345
  271. package/src/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesOcclusionRenderer.js +0 -436
  272. package/src/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickDepthRenderer.js +0 -462
  273. package/src/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickMeshRenderer.js +0 -436
  274. package/src/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsFlatRenderer.js +0 -455
  275. package/src/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsRenderer.js +0 -440
  276. package/src/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesRenderers.js +0 -307
  277. package/src/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSilhouetteRenderer.js +0 -465
  278. package/src/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapInitRenderer.js +0 -466
  279. package/src/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapRenderer.js +0 -427
  280. package/src/src/viewer/scene/model/index.js +0 -5
  281. package/src/src/viewer/scene/model/rebucketPositions.js +0 -354
  282. package/src/src/viewer/scene/model/vbo/ScratchMemory.js +0 -63
  283. package/src/src/viewer/scene/model/vbo/VBORenderer.js +0 -646
  284. package/src/src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js +0 -699
  285. package/src/src/viewer/scene/model/vbo/batching/lines/lib/VBOBatchingLinesBuffer.js +0 -19
  286. package/src/src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLineSnapInitRenderer.js +0 -316
  287. package/src/src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesColorRenderer.js +0 -114
  288. package/src/src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesRenderers.js +0 -99
  289. package/src/src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSilhouetteRenderer.js +0 -124
  290. package/src/src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapInitRenderer.js +0 -311
  291. package/src/src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapRenderer.js +0 -309
  292. package/src/src/viewer/scene/model/vbo/batching/lines/renderers/VBOSceneModelLineBatchingRenderer.js +0 -24
  293. package/src/src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsBuffer.js +0 -20
  294. package/src/src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js +0 -718
  295. package/src/src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsRenderer.js +0 -24
  296. package/src/src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsColorRenderer.js +0 -168
  297. package/src/src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsOcclusionRenderer.js +0 -136
  298. package/src/src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsPickDepthRenderer.js +0 -156
  299. package/src/src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsPickMeshRenderer.js +0 -148
  300. package/src/src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsRenderers.js +0 -144
  301. package/src/src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsShadowRenderer.js +0 -107
  302. package/src/src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSilhouetteRenderer.js +0 -146
  303. package/src/src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapInitRenderer.js +0 -309
  304. package/src/src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapRenderer.js +0 -303
  305. package/src/src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesBuffer.js +0 -24
  306. package/src/src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js +0 -1257
  307. package/src/src/viewer/scene/model/vbo/batching/triangles/renderers/EdgesColorRenderer.js +0 -131
  308. package/src/src/viewer/scene/model/vbo/batching/triangles/renderers/EdgesEmphasisRenderer.js +0 -135
  309. package/src/src/viewer/scene/model/vbo/batching/triangles/renderers/EdgesRenderer.js +0 -12
  310. package/src/src/viewer/scene/model/vbo/batching/triangles/renderers/Renderers.js +0 -375
  311. package/src/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesBatchingRenderer.js +0 -34
  312. package/src/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesColorRenderer.js +0 -238
  313. package/src/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesColorTextureRenderer.js +0 -270
  314. package/src/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesDepthRenderer.js +0 -126
  315. package/src/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesFlatColorRenderer.js +0 -235
  316. package/src/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesNormalsRenderer.js +0 -139
  317. package/src/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesOcclusionRenderer.js +0 -125
  318. package/src/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesPBRRenderer.js +0 -561
  319. package/src/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesPickDepthRenderer.js +0 -144
  320. package/src/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesPickMeshRenderer.js +0 -130
  321. package/src/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesPickNormalsFlatRenderer.js +0 -121
  322. package/src/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesPickNormalsRenderer.js +0 -131
  323. package/src/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesShadowRenderer.js +0 -107
  324. package/src/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSilhouetteRenderer.js +0 -136
  325. package/src/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js +0 -311
  326. package/src/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapRenderer.js +0 -308
  327. package/src/src/viewer/scene/model/vbo/float16.js +0 -760
  328. package/src/src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js +0 -704
  329. package/src/src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesColorRenderer.js +0 -148
  330. package/src/src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesRenderer.js +0 -26
  331. package/src/src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesRenderers.js +0 -139
  332. package/src/src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSilhouetteRenderer.js +0 -127
  333. package/src/src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapInitRenderer.js +0 -331
  334. package/src/src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapRenderer.js +0 -316
  335. package/src/src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js +0 -728
  336. package/src/src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsColorRenderer.js +0 -174
  337. package/src/src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsDepthRenderer.js +0 -156
  338. package/src/src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsOcclusionRenderer.js +0 -149
  339. package/src/src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsPickDepthRenderer.js +0 -170
  340. package/src/src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsPickMeshRenderer.js +0 -152
  341. package/src/src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsRenderer.js +0 -26
  342. package/src/src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsRenderers.js +0 -174
  343. package/src/src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsShadowRenderer.js +0 -119
  344. package/src/src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSilhouetteRenderer.js +0 -154
  345. package/src/src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapInitRenderer.js +0 -330
  346. package/src/src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapRenderer.js +0 -311
  347. package/src/src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingTrianglesRenderer.js +0 -150
  348. package/src/src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js +0 -1190
  349. package/src/src/viewer/scene/model/vbo/instancing/triangles/renderers/EdgesColorRenderer.js +0 -136
  350. package/src/src/viewer/scene/model/vbo/instancing/triangles/renderers/EdgesEmphasisRenderer.js +0 -137
  351. package/src/src/viewer/scene/model/vbo/instancing/triangles/renderers/EdgesRenderer.js +0 -12
  352. package/src/src/viewer/scene/model/vbo/instancing/triangles/renderers/Renderers.js +0 -376
  353. package/src/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesColorRenderer.js +0 -253
  354. package/src/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesColorTextureRenderer.js +0 -278
  355. package/src/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesDepthRenderer.js +0 -126
  356. package/src/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesFlatColorRenderer.js +0 -244
  357. package/src/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesFlatNormalsRenderer.js +0 -130
  358. package/src/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesInstancingRenderer.js +0 -29
  359. package/src/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesNormalsRenderer.js +0 -138
  360. package/src/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesOcclusionRenderer.js +0 -128
  361. package/src/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesPBRRenderer.js +0 -561
  362. package/src/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesPickDepthRenderer.js +0 -149
  363. package/src/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesPickMeshRenderer.js +0 -136
  364. package/src/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesPickNormalsFlatRenderer.js +0 -130
  365. package/src/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesPickNormalsRenderer.js +0 -145
  366. package/src/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesShadowRenderer.js +0 -113
  367. package/src/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSilhouetteRenderer.js +0 -139
  368. package/src/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapInitRenderer.js +0 -342
  369. package/src/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapRenderer.js +0 -325
  370. package/src/src/viewer/scene/nodes/Node.js +0 -1383
  371. package/src/src/viewer/scene/nodes/index.js +0 -1
  372. package/src/src/viewer/scene/paths/CubicBezierCurve.js +0 -194
  373. package/src/src/viewer/scene/paths/Curve.js +0 -183
  374. package/src/src/viewer/scene/paths/Path.js +0 -239
  375. package/src/src/viewer/scene/paths/QuadraticBezierCurve.js +0 -161
  376. package/src/src/viewer/scene/paths/SplineCurve.js +0 -133
  377. package/src/src/viewer/scene/paths/index.js +0 -5
  378. package/src/src/viewer/scene/postfx/SAO.js +0 -543
  379. package/src/src/viewer/scene/scene/Scene.js +0 -2802
  380. package/src/src/viewer/scene/sectionPlane/SectionPlane.js +0 -198
  381. package/src/src/viewer/scene/sectionPlane/SectionPlaneCache.js +0 -101
  382. package/src/src/viewer/scene/sectionPlane/index.js +0 -1
  383. package/src/src/viewer/scene/skybox/Skybox.js +0 -123
  384. package/src/src/viewer/scene/skybox/index.js +0 -1
  385. package/src/src/viewer/scene/stats.js +0 -44
  386. package/src/src/viewer/scene/utils/Cache.js +0 -29
  387. package/src/src/viewer/scene/utils/FileLoader.js +0 -161
  388. package/src/src/viewer/scene/utils/Loader.js +0 -55
  389. package/src/src/viewer/scene/utils/LoadingManager.js +0 -86
  390. package/src/src/viewer/scene/utils/Map.js +0 -45
  391. package/src/src/viewer/scene/utils/Queue.js +0 -56
  392. package/src/src/viewer/scene/utils/WorkerPool.js +0 -73
  393. package/src/src/viewer/scene/utils/index.js +0 -6
  394. package/src/src/viewer/scene/utils/textureTranscoders/KTX2TextureTranscoder/KTX2TextureTranscoder.js +0 -650
  395. package/src/src/viewer/scene/utils/textureTranscoders/KTX2TextureTranscoder/index.js +0 -1
  396. package/src/src/viewer/scene/utils/textureTranscoders/TextureTranscoder.js +0 -31
  397. package/src/src/viewer/scene/utils/textureTranscoders/index.js +0 -2
  398. package/src/src/viewer/scene/utils.js +0 -453
  399. package/src/src/viewer/scene/viewport/Viewport.js +0 -212
  400. package/src/src/viewer/scene/webgl/ArrayBuf.js +0 -121
  401. package/src/src/viewer/scene/webgl/Attribute.js +0 -23
  402. package/src/src/viewer/scene/webgl/Drawable.js +0 -270
  403. package/src/src/viewer/scene/webgl/FrameContext.js +0 -313
  404. package/src/src/viewer/scene/webgl/PickResult.js +0 -364
  405. package/src/src/viewer/scene/webgl/Pickable.js +0 -69
  406. package/src/src/viewer/scene/webgl/Program.js +0 -181
  407. package/src/src/viewer/scene/webgl/RenderBuffer.js +0 -378
  408. package/src/src/viewer/scene/webgl/RenderBufferManager.js +0 -34
  409. package/src/src/viewer/scene/webgl/RenderFlags.js +0 -203
  410. package/src/src/viewer/scene/webgl/RenderState.js +0 -40
  411. package/src/src/viewer/scene/webgl/Renderer.js +0 -1781
  412. package/src/src/viewer/scene/webgl/Sampler.js +0 -18
  413. package/src/src/viewer/scene/webgl/Shader.js +0 -49
  414. package/src/src/viewer/scene/webgl/Texture2D.js +0 -442
  415. package/src/src/viewer/scene/webgl/convertConstant.js +0 -244
  416. package/src/src/viewer/scene/webgl/getExtension.js +0 -32
  417. package/src/src/viewer/scene/webgl/occlusion/OcclusionLayer.js +0 -214
  418. package/src/src/viewer/scene/webgl/occlusion/OcclusionTester.js +0 -426
  419. package/src/src/viewer/scene/webgl/sao/SAODepthLimitedBlurRenderer.js +0 -324
  420. package/src/src/viewer/scene/webgl/sao/SAOOcclusionRenderer.js +0 -376
  421. package/src/src/viewer/scene/webgl/webglEnums.js +0 -61
  422. package/src/src/viewer/scene/webglInfo.js +0 -47
  423. package/src/viewer/scene/model/vbo/batching/triangles/renderers/VBOBatchingTrianglesColorRenderer.js +0 -238
  424. package/src/viewer/scene/model/vbo/batching/triangles/renderers/VBOBatchingTrianglesColorTextureRenderer.js +0 -270
  425. package/src/viewer/scene/model/vbo/batching/triangles/renderers/VBOBatchingTrianglesDepthRenderer.js +0 -126
  426. package/src/viewer/scene/model/vbo/batching/triangles/renderers/VBOBatchingTrianglesEdgesColorRenderer.js +0 -127
  427. package/src/viewer/scene/model/vbo/batching/triangles/renderers/VBOBatchingTrianglesEdgesRenderer.js +0 -133
  428. package/src/viewer/scene/model/vbo/batching/triangles/renderers/VBOBatchingTrianglesFlatColorRenderer.js +0 -235
  429. package/src/viewer/scene/model/vbo/batching/triangles/renderers/VBOBatchingTrianglesNormalsRenderer.js +0 -139
  430. package/src/viewer/scene/model/vbo/batching/triangles/renderers/VBOBatchingTrianglesOcclusionRenderer.js +0 -125
  431. package/src/viewer/scene/model/vbo/batching/triangles/renderers/VBOBatchingTrianglesPBRRenderer.js +0 -561
  432. package/src/viewer/scene/model/vbo/batching/triangles/renderers/VBOBatchingTrianglesPickDepthRenderer.js +0 -144
  433. package/src/viewer/scene/model/vbo/batching/triangles/renderers/VBOBatchingTrianglesPickMeshRenderer.js +0 -130
  434. package/src/viewer/scene/model/vbo/batching/triangles/renderers/VBOBatchingTrianglesPickNormalsFlatRenderer.js +0 -121
  435. package/src/viewer/scene/model/vbo/batching/triangles/renderers/VBOBatchingTrianglesPickNormalsRenderer.js +0 -131
  436. package/src/viewer/scene/model/vbo/batching/triangles/renderers/VBOBatchingTrianglesRenderer.js +0 -33
  437. package/src/viewer/scene/model/vbo/batching/triangles/renderers/VBOBatchingTrianglesRenderers.js +0 -375
  438. package/src/viewer/scene/model/vbo/batching/triangles/renderers/VBOBatchingTrianglesShadowRenderer.js +0 -107
  439. package/src/viewer/scene/model/vbo/batching/triangles/renderers/VBOBatchingTrianglesSilhouetteRenderer.js +0 -136
  440. package/src/viewer/scene/model/vbo/batching/triangles/renderers/VBOBatchingTrianglesSnapInitRenderer.js +0 -311
  441. package/src/viewer/scene/model/vbo/batching/triangles/renderers/VBOBatchingTrianglesSnapRenderer.js +0 -308
  442. package/src/viewer/scene/model/vbo/batching/triangles/renderers/VBOSceneModelTriangleBatchingEdgesRenderer.js +0 -12
  443. package/src/viewer/scene/model/vbo/instancing/triangles/renderers/VBOInstancingTrianglesColorRenderer.js +0 -253
  444. package/src/viewer/scene/model/vbo/instancing/triangles/renderers/VBOInstancingTrianglesColorTextureRenderer.js +0 -278
  445. package/src/viewer/scene/model/vbo/instancing/triangles/renderers/VBOInstancingTrianglesDepthRenderer.js +0 -126
  446. package/src/viewer/scene/model/vbo/instancing/triangles/renderers/VBOInstancingTrianglesEdgesColorRenderer.js +0 -132
  447. package/src/viewer/scene/model/vbo/instancing/triangles/renderers/VBOInstancingTrianglesEdgesRenderer.js +0 -134
  448. package/src/viewer/scene/model/vbo/instancing/triangles/renderers/VBOInstancingTrianglesFlatColorRenderer.js +0 -244
  449. package/src/viewer/scene/model/vbo/instancing/triangles/renderers/VBOInstancingTrianglesFlatNormalsRenderer.js +0 -130
  450. package/src/viewer/scene/model/vbo/instancing/triangles/renderers/VBOInstancingTrianglesNormalsRenderer.js +0 -138
  451. package/src/viewer/scene/model/vbo/instancing/triangles/renderers/VBOInstancingTrianglesOcclusionRenderer.js +0 -128
  452. package/src/viewer/scene/model/vbo/instancing/triangles/renderers/VBOInstancingTrianglesPBRRenderer.js +0 -561
  453. package/src/viewer/scene/model/vbo/instancing/triangles/renderers/VBOInstancingTrianglesPickDepthRenderer.js +0 -149
  454. package/src/viewer/scene/model/vbo/instancing/triangles/renderers/VBOInstancingTrianglesPickMeshRenderer.js +0 -136
  455. package/src/viewer/scene/model/vbo/instancing/triangles/renderers/VBOInstancingTrianglesPickNormalsFlatRenderer.js +0 -130
  456. package/src/viewer/scene/model/vbo/instancing/triangles/renderers/VBOInstancingTrianglesPickNormalsRenderer.js +0 -145
  457. package/src/viewer/scene/model/vbo/instancing/triangles/renderers/VBOInstancingTrianglesRenderers.js +0 -376
  458. package/src/viewer/scene/model/vbo/instancing/triangles/renderers/VBOInstancingTrianglesShadowRenderer.js +0 -113
  459. package/src/viewer/scene/model/vbo/instancing/triangles/renderers/VBOInstancingTrianglesSilhouetteRenderer.js +0 -139
  460. package/src/viewer/scene/model/vbo/instancing/triangles/renderers/VBOInstancingTrianglesSnapInitRenderer.js +0 -342
  461. package/src/viewer/scene/model/vbo/instancing/triangles/renderers/VBOInstancingTrianglesSnapRenderer.js +0 -325
  462. package/src/viewer/scene/model/vbo/instancing/triangles/renderers/VBOSceneModelTriangleInstancingEdgesRenderer.js +0 -12
  463. package/src/viewer/scene/model/vbo/instancing/triangles/renderers/VBOSceneModelTriangleInstancingRenderer.js +0 -29
@@ -1,1750 +0,0 @@
1
- import {Component} from '../Component.js';
2
-
3
- import {CameraFlightAnimation} from './../camera/CameraFlightAnimation.js';
4
- import {PanController} from "./lib/controllers/PanController.js";
5
- import {PivotController} from "./lib/controllers/PivotController.js";
6
- import {PickController} from "./lib/controllers/PickController.js";
7
- import {MousePanRotateDollyHandler} from "./lib/handlers/MousePanRotateDollyHandler.js";
8
- import {KeyboardAxisViewHandler} from "./lib/handlers/KeyboardAxisViewHandler.js";
9
- import {MousePickHandler} from "./lib/handlers/MousePickHandler.js";
10
- import {KeyboardPanRotateDollyHandler} from "./lib/handlers/KeyboardPanRotateDollyHandler.js";
11
- import {CameraUpdater} from "./lib/CameraUpdater.js";
12
- import {MouseMiscHandler} from "./lib/handlers/MouseMiscHandler.js";
13
- import {TouchPanRotateAndDollyHandler} from "./lib/handlers/TouchPanRotateAndDollyHandler.js";
14
- import {utils} from "../utils.js";
15
- import {math} from "../math/math.js";
16
- import {TouchPickHandler} from "./lib/handlers/TouchPickHandler.js";
17
-
18
- const DEFAULT_SNAP_PICK_RADIUS = 30;
19
- const DEFAULT_SNAP_VERTEX = true;
20
- const DEFAULT_SNAP_EDGE = true;
21
-
22
- /**
23
- * @desc Controls the {@link Camera} with user input, and fires events when the user interacts with pickable {@link Entity}s.
24
- *
25
- * # Contents
26
- *
27
- * * [Overview](#overview)
28
- * * [Examples](#examples)
29
- * * [Orbit Mode](#orbit-mode)
30
- * + [Following the Pointer in Orbit Mode](#--following-the-pointer-in-orbit-mode--)
31
- * + [Showing the Pivot Position](#--showing-the-pivot-position--)
32
- * + [Axis-Aligned Views in Orbit Mode](#--axis-aligned-views-in-orbit-mode--)
33
- * + [View-Fitting Entitys in Orbit Mode](#--view-fitting-entitys-in-orbit-mode--)
34
- * * [First-Person Mode](#first-person-mode)
35
- * + [Following the Pointer in First-Person Mode](#--following-the-pointer-in-first-person-mode--)
36
- * + [Constraining Vertical Position in First-Person Mode](#--constraining-vertical-position-in-first-person-mode--)
37
- * + [Axis-Aligned Views in First-Person Mode](#--axis-aligned-views-in-first-person-mode--)
38
- * + [View-Fitting Entitys in First-Person Mode](#--view-fitting-entitys-in-first-person-mode--)
39
- * * [Plan-View Mode](#plan-view-mode)
40
- * + [Following the Pointer in Plan-View Mode](#--following-the-pointer-in-plan-view-mode--)
41
- * + [Axis-Aligned Views in Plan-View Mode](#--axis-aligned-views-in-plan-view-mode--)
42
- * * [CameraControl Events](#cameracontrol-events)
43
- * + ["hover"](#---hover---)
44
- * + ["hoverOff"](#---hoveroff---)
45
- * + ["hoverEnter"](#---hoverenter---)
46
- * + ["hoverOut"](#---hoverout---)
47
- * + ["picked"](#---picked---)
48
- * + ["pickedSurface"](#---pickedsurface---)
49
- * + ["pickedNothing"](#---pickednothing---)
50
- * + ["doublePicked"](#---doublepicked---)
51
- * + ["doublePickedSurface"](#---doublepickedsurface---)
52
- * + ["doublePickedNothing"](#---doublepickednothing---)
53
- * + ["rightClick"](#---rightclick---)
54
- * * [Custom Keyboard Mappings](#custom-keyboard-mappings)
55
- *
56
- * <br><br>
57
- *
58
- * # Overview
59
- *
60
- * * Each {@link Viewer} has a ````CameraControl````, located at {@link Viewer#cameraControl}.
61
- * * {@link CameraControl#navMode} selects the navigation mode:
62
- * * ````"orbit"```` rotates the {@link Camera} position about the target.
63
- * * ````"firstPerson"```` rotates the World about the Camera position.
64
- * * ````"planView"```` never rotates, but still allows to pan and dolly, typically for an axis-aligned view.
65
- * * {@link CameraControl#followPointer} makes the Camera follow the mouse or touch pointer.
66
- * * {@link CameraControl#constrainVertical} locks the Camera to its current height when in first-person mode.
67
- * * ````CameraControl```` fires pick events when we hover, click or tap on an {@link Entity}.
68
- * <br><br>
69
- *
70
- * # Examples
71
- *
72
- * * [Orbit Navigation - Duplex Model](https://xeokit.github.io/xeokit-sdk/examples/#CameraControl_orbit_Duplex)
73
- * * [Orbit Navigation - Holter Tower Model](https://xeokit.github.io/xeokit-sdk/examples/#CameraControl_orbit_HolterTower)
74
- * * [First-Person Navigation - Duplex Model](https://xeokit.github.io/xeokit-sdk/examples/#CameraControl_firstPerson_Duplex)
75
- * * [First-Person Navigation - Holter Tower Model](https://xeokit.github.io/xeokit-sdk/examples/#CameraControl_firstPerson_HolterTower)
76
- * * [Plan-view Navigation - Schependomlaan Model](https://xeokit.github.io/xeokit-sdk/examples/#CameraControl_planView_Schependomlaan)
77
- * * [Custom Keyboard Mapping](https://xeokit.github.io/xeokit-sdk/examples/#CameraControl_keyMap)
78
- * <br><br>
79
- *
80
- * # Orbit Mode
81
- *
82
- * In orbit mode, ````CameraControl```` orbits the {@link Camera} about the target.
83
- *
84
- * To enable orbit mode:
85
- *
86
- * ````javascript
87
- * const cameraControl = myViewer.cameraControl;
88
- * cameraControl.navMode = "orbit";
89
- * ````
90
- *
91
- * Then orbit by:
92
- *
93
- * * left-dragging the mouse,
94
- * * tap-dragging the touch pad, and
95
- * * pressing arrow keys, or ````Q```` and ````E```` on a QWERTY keyboard, or ````A```` and ````E```` on an AZERTY keyboard.
96
- * <br><br>
97
- *
98
- * Dolly forwards and backwards by:
99
- *
100
- * * spinning the mouse wheel,
101
- * * pinching on the touch pad, and
102
- * * pressing the ````+```` and ````-```` keys, or ````W```` and ````S```` on a QWERTY keyboard, or ````Z```` and ````S```` for AZERTY.
103
- * <br><br>
104
- *
105
- * Pan horizontally and vertically by:
106
- *
107
- * * right-dragging the mouse,
108
- * * left-dragging the mouse with the SHIFT key down,
109
- * * tap-dragging the touch pad with SHIFT down,
110
- * * pressing the ````A````, ````D````, ````Z```` and ````X```` keys on a QWERTY keyboard, and
111
- * * pressing the ````Q````, ````D````, ````W```` and ````X```` keys on an AZERTY keyboard,
112
- * <br><br>
113
- *
114
- * ## Following the Pointer in Orbit Mode
115
- *
116
- * When {@link CameraControl#followPointer} is ````true````in orbiting mode, the mouse or touch pointer will dynamically
117
- * indicate the target that the {@link Camera} will orbit, as well as dolly to and from.
118
- *
119
- * Lets ensure that we're in orbit mode, then enable the {@link Camera} to follow the pointer:
120
- *
121
- * ````javascript
122
- * cameraControl.navMode = "orbit";
123
- * cameraControl.followPointer = true;
124
- * ````
125
- *
126
- * ## Smart Pivoting
127
- *
128
- * TODO
129
- *
130
- * ## Showing the Pivot Position
131
- *
132
- * We can configure {@link CameraControl#pivotElement} with an HTML element to indicate the current
133
- * pivot position. The indicator will appear momentarily each time we move the {@link Camera} while in orbit mode with
134
- * {@link CameraControl#followPointer} set ````true````.
135
- *
136
- * First we'll define some CSS to style our pivot indicator as a black dot with a white border:
137
- *
138
- * ````css
139
- * .camera-pivot-marker {
140
- * color: #ffffff;
141
- * position: absolute;
142
- * width: 25px;
143
- * height: 25px;
144
- * border-radius: 15px;
145
- * border: 2px solid #ebebeb;
146
- * background: black;
147
- * visibility: hidden;
148
- * box-shadow: 5px 5px 15px 1px #000000;
149
- * z-index: 10000;
150
- * pointer-events: none;
151
- * }
152
- * ````
153
- *
154
- * Then we'll attach our pivot indicator's HTML element to the ````CameraControl````:
155
- *
156
- * ````javascript
157
- * const pivotElement = document.createRange().createContextualFragment("<div class='camera-pivot-marker'></div>").firstChild;
158
- *
159
- * document.body.appendChild(pivotElement);
160
- *
161
- * cameraControl.pivotElement = pivotElement;
162
- * ````
163
- *
164
- * ## Axis-Aligned Views in Orbit Mode
165
- *
166
- * In orbit mode, we can use keys 1-6 to position the {@link Camera} to look at the center of the {@link Scene} from along each of the
167
- * six World-space axis. Pressing one of these keys will fly the {@link Camera} to the corresponding axis-aligned view.
168
- *
169
- * ## View-Fitting Entitys in Orbit Mode
170
- *
171
- * When {@link CameraControl#doublePickFlyTo} is ````true````, we can left-double-click or
172
- * double-tap (ie. "double-pick") an {@link Entity} to fit it to view. This will cause the {@link Camera}
173
- * to fly to that Entity. Our target then becomes the center of that Entity. If we are currently pivoting,
174
- * then our pivot position is then also set to the Entity center.
175
- *
176
- * Disable that behaviour by setting {@link CameraControl#doublePickFlyTo} ````false````.
177
- *
178
- * # First-Person Mode
179
- *
180
- * In first-person mode, ````CameraControl```` rotates the World about the {@link Camera} position.
181
- *
182
- * To enable first-person mode:
183
- *
184
- * ````javascript
185
- * cameraControl.navMode = "firstPerson";
186
- * ````
187
- *
188
- * Then rotate by:
189
- *
190
- * * left-dragging the mouse,
191
- * * tap-dragging the touch pad,
192
- * * pressing arrow keys, or ````Q```` and ````E```` on a QWERTY keyboard, or ````A```` and ````E```` on an AZERTY keyboard.
193
- * <br><br>
194
- *
195
- * Dolly forwards and backwards by:
196
- *
197
- * * spinning the mouse wheel,
198
- * * pinching on the touch pad, and
199
- * * pressing the ````+```` and ````-```` keys, or ````W```` and ````S```` on a QWERTY keyboard, or ````Z```` and ````S```` for AZERTY.
200
- * <br><br>
201
- *
202
- * Pan left, right, up and down by:
203
- *
204
- * * left-dragging or right-dragging the mouse, and
205
- * * tap-dragging the touch pad with SHIFT down.
206
- *
207
- * Pan forwards, backwards, left, right, up and down by pressing the ````WSADZX```` keys on a QWERTY keyboard,
208
- * or ````WSQDWX```` keys on an AZERTY keyboard.
209
- * <br><br>
210
- *
211
- * ## Following the Pointer in First-Person Mode
212
- *
213
- * When {@link CameraControl#followPointer} is ````true```` in first-person mode, the mouse or touch pointer will dynamically
214
- * indicate the target to which the {@link Camera} will dolly to and from. In first-person mode, however, the World will always rotate
215
- * about the {@link Camera} position.
216
- *
217
- * Lets ensure that we're in first-person mode, then enable the {@link Camera} to follow the pointer:
218
- *
219
- * ````javascript
220
- * cameraControl.navMode = "firstPerson";
221
- * cameraControl.followPointer = true;
222
- * ````
223
- *
224
- * When the pointer is over empty space, the target will remain the last object that the pointer was over.
225
- *
226
- * ## Constraining Vertical Position in First-Person Mode
227
- *
228
- * In first-person mode, we can lock the {@link Camera} to its current position on the vertical World axis, which is useful for walk-through navigation:
229
- *
230
- * ````javascript
231
- * cameraControl.constrainVertical = true;
232
- * ````
233
- *
234
- * ## Axis-Aligned Views in First-Person Mode
235
- *
236
- * In first-person mode we can use keys 1-6 to position the {@link Camera} to look at the center of
237
- * the {@link Scene} from along each of the six World-space axis. Pressing one of these keys will fly the {@link Camera} to the
238
- * corresponding axis-aligned view.
239
- *
240
- * ## View-Fitting Entitys in First-Person Mode
241
- *
242
- * As in orbit mode, when in first-person mode and {@link CameraControl#doublePickFlyTo} is ````true````, we can double-click
243
- * or double-tap an {@link Entity} (ie. "double-picking") to fit it in view. This will cause the {@link Camera} to fly to
244
- * that Entity. Our target then becomes the center of that Entity.
245
- *
246
- * Disable that behaviour by setting {@link CameraControl#doublePickFlyTo} ````false````.
247
- *
248
- * # Plan-View Mode
249
- *
250
- * In plan-view mode, ````CameraControl```` pans and rotates the {@link Camera}, without rotating it.
251
- *
252
- * To enable plan-view mode:
253
- *
254
- * ````javascript
255
- * cameraControl.navMode = "planView";
256
- * ````
257
- *
258
- * Dolly forwards and backwards by:
259
- *
260
- * * spinning the mouse wheel,
261
- * * pinching on the touch pad, and
262
- * * pressing the ````+```` and ````-```` keys.
263
- *
264
- * <br>
265
- * Pan left, right, up and down by:
266
- *
267
- * * left-dragging or right-dragging the mouse, and
268
- * * tap-dragging the touch pad with SHIFT down.
269
- *
270
- * Pan forwards, backwards, left, right, up and down by pressing the ````WSADZX```` keys on a QWERTY keyboard,
271
- * or ````WSQDWX```` keys on an AZERTY keyboard.
272
- * <br><br>
273
- *
274
- * ## Following the Pointer in Plan-View Mode
275
- *
276
- * When {@link CameraControl#followPointer} is ````true```` in plan-view mode, the mouse or touch pointer will dynamically
277
- * indicate the target to which the {@link Camera} will dolly to and from. In plan-view mode, however, the {@link Camera} cannot rotate.
278
- *
279
- * Lets ensure that we're in plan-view mode, then enable the {@link Camera} to follow the pointer:
280
- *
281
- * ````javascript
282
- * cameraControl.navMode = "planView";
283
- * cameraControl.followPointer = true; // Default
284
- * ````
285
- *
286
- * When the pointer is over empty space, the target will remain the last object that the pointer was over.
287
- *
288
- * ## Axis-Aligned Views in Plan-View Mode
289
- *
290
- * As in orbit and first-person modes, in plan-view mode we can use keys 1-6 to position the {@link Camera} to look at the center of
291
- * the {@link Scene} from along each of the six World-space axis. Pressing one of these keys will fly the {@link Camera} to the
292
- * corresponding axis-aligned view.
293
- *
294
- * # CameraControl Events
295
- *
296
- * ````CameraControl```` fires events as we interact with {@link Entity}s using mouse or touch input.
297
- *
298
- * The following examples demonstrate how to subscribe to those events.
299
- *
300
- * The first example shows how to save a handle to a subscription, which we can later use to unsubscribe.
301
- *
302
- * ## "hover"
303
- *
304
- * Event fired when the pointer moves while hovering over an Entity.
305
- *
306
- * ````javascript
307
- * const onHover = cameraControl.on("hover", (e) => {
308
- * const entity = e.entity; // Entity
309
- * const canvasPos = e.canvasPos; // 2D canvas position
310
- * });
311
- * ````
312
- *
313
- * To unsubscribe from the event:
314
- *
315
- * ````javascript
316
- * cameraControl.off(onHover);
317
- * ````
318
- *
319
- * ## "hoverOff"
320
- *
321
- * Event fired when the pointer moves while hovering over empty space.
322
- *
323
- * ````javascript
324
- * cameraControl.on("hoverOff", (e) => {
325
- * const canvasPos = e.canvasPos;
326
- * });
327
- * ````
328
- *
329
- * ## "hoverEnter"
330
- *
331
- * Event fired when the pointer moves onto an Entity.
332
- *
333
- * ````javascript
334
- * cameraControl.on("hoverEnter", (e) => {
335
- * const entity = e.entity;
336
- * const canvasPos = e.canvasPos;
337
- * });
338
- * ````
339
- *
340
- * ## "hoverOut"
341
- *
342
- * Event fired when the pointer moves off an Entity.
343
- *
344
- * ````javascript
345
- * cameraControl.on("hoverOut", (e) => {
346
- * const entity = e.entity;
347
- * const canvasPos = e.canvasPos;
348
- * });
349
- * ````
350
- *
351
- * ## "picked"
352
- *
353
- * Event fired when we left-click or tap on an Entity.
354
- *
355
- * ````javascript
356
- * cameraControl.on("picked", (e) => {
357
- * const entity = e.entity;
358
- * const canvasPos = e.canvasPos;
359
- * });
360
- * ````
361
- *
362
- * ## "pickedSurface"
363
- *
364
- * Event fired when we left-click or tap on the surface of an Entity.
365
- *
366
- * ````javascript
367
- * cameraControl.on("picked", (e) => {
368
- * const entity = e.entity;
369
- * const canvasPos = e.canvasPos;
370
- * const worldPos = e.worldPos; // 3D World-space position
371
- * const viewPos = e.viewPos; // 3D View-space position
372
- * const worldNormal = e.worldNormal; // 3D World-space normal vector
373
- * });
374
- * ````
375
- *
376
- * ## "pickedNothing"
377
- *
378
- * Event fired when we left-click or tap on empty space.
379
- *
380
- * ````javascript
381
- * cameraControl.on("pickedNothing", (e) => {
382
- * const canvasPos = e.canvasPos;
383
- * });
384
- * ````
385
- *
386
- * ## "doublePicked"
387
- *
388
- * Event fired wwhen we left-double-click or double-tap on an Entity.
389
- *
390
- * ````javascript
391
- * cameraControl.on("doublePicked", (e) => {
392
- * const entity = e.entity;
393
- * const canvasPos = e.canvasPos;
394
- * });
395
- * ````
396
- *
397
- * ## "doublePickedSurface"
398
- *
399
- * Event fired when we left-double-click or double-tap on the surface of an Entity.
400
- *
401
- * ````javascript
402
- * cameraControl.on("doublePickedSurface", (e) => {
403
- * const entity = e.entity;
404
- * const canvasPos = e.canvasPos;
405
- * const worldPos = e.worldPos;
406
- * const viewPos = e.viewPos;
407
- * const worldNormal = e.worldNormal;
408
- * });
409
- * ````
410
- *
411
- * ## "doublePickedNothing"
412
- *
413
- * Event fired when we left-double-click or double-tap on empty space.
414
- *
415
- * ````javascript
416
- * cameraControl.on("doublePickedNothing", (e) => {
417
- * const canvasPos = e.canvasPos;
418
- * });
419
- * ````
420
- *
421
- * ## "rightClick"
422
- *
423
- * Event fired when we right-click on the canvas.
424
- *
425
- * ````javascript
426
- * cameraControl.on("rightClick", (e) => {
427
- * const event = e.event; // Mouse event
428
- * const canvasPos = e.canvasPos;
429
- * });
430
- * ````
431
- *
432
- * ## Custom Keyboard Mappings
433
- *
434
- * We can customize````CameraControl```` key bindings as shown below.
435
- *
436
- * In this example, we'll just set the default bindings for a QWERTY keyboard.
437
- *
438
- * ````javascript
439
- * const input = myViewer.scene.input;
440
- *
441
- * cameraControl.navMode = "orbit";
442
- * cameraControl.followPointer = true;
443
- *
444
- * const keyMap = {};
445
- *
446
- * keyMap[cameraControl.PAN_LEFT] = [input.KEY_A];
447
- * keyMap[cameraControl.PAN_RIGHT] = [input.KEY_D];
448
- * keyMap[cameraControl.PAN_UP] = [input.KEY_Z];
449
- * keyMap[cameraControl.PAN_DOWN] = [input.KEY_X];
450
- * keyMap[cameraControl.DOLLY_FORWARDS] = [input.KEY_W, input.KEY_ADD];
451
- * keyMap[cameraControl.DOLLY_BACKWARDS] = [input.KEY_S, input.KEY_SUBTRACT];
452
- * keyMap[cameraControl.ROTATE_X_POS] = [input.KEY_DOWN_ARROW];
453
- * keyMap[cameraControl.ROTATE_X_NEG] = [input.KEY_UP_ARROW];
454
- * keyMap[cameraControl.ROTATE_Y_POS] = [input.KEY_LEFT_ARROW];
455
- * keyMap[cameraControl.ROTATE_Y_NEG] = [input.KEY_RIGHT_ARROW];
456
- * keyMap[cameraControl.AXIS_VIEW_RIGHT] = [input.KEY_NUM_1];
457
- * keyMap[cameraControl.AXIS_VIEW_BACK] = [input.KEY_NUM_2];
458
- * keyMap[cameraControl.AXIS_VIEW_LEFT] = [input.KEY_NUM_3];
459
- * keyMap[cameraControl.AXIS_VIEW_FRONT] = [input.KEY_NUM_4];
460
- * keyMap[cameraControl.AXIS_VIEW_TOP] = [input.KEY_NUM_5];
461
- * keyMap[cameraControl.AXIS_VIEW_BOTTOM] = [input.KEY_NUM_6];
462
- *
463
- * cameraControl.keyMap = keyMap;
464
- * ````
465
- *
466
- * We can also just configure default bindings for a specified keyboard layout, like this:
467
- *
468
- * ````javascript
469
- * cameraControl.keyMap = "qwerty";
470
- * ````
471
- *
472
- * Then, ````CameraControl```` will internally set {@link CameraControl#keyMap} to the default key map for the QWERTY
473
- * layout (which is the same set of mappings we set in the previous example). In other words, if we subsequently
474
- * read {@link CameraControl#keyMap}, it will now be a key map, instead of the "qwerty" string value we set it to.
475
- *
476
- * Supported layouts are, so far:
477
- *
478
- * * ````"qwerty"````
479
- * * ````"azerty"````
480
- */
481
- class CameraControl extends Component {
482
-
483
- /**
484
- * @private
485
- * @constructor
486
- */
487
- constructor(owner, cfg = {}) {
488
-
489
- super(owner, cfg);
490
-
491
- /**
492
- * Identifies the XX action.
493
- * @final
494
- * @type {Number}
495
- */
496
- this.PAN_LEFT = 0;
497
-
498
- /**
499
- * Identifies the XX action.
500
- * @final
501
- * @type {Number}
502
- */
503
- this.PAN_RIGHT = 1;
504
-
505
- /**
506
- * Identifies the XX action.
507
- * @final
508
- * @type {Number}
509
- */
510
- this.PAN_UP = 2;
511
-
512
- /**
513
- * Identifies the XX action.
514
- * @final
515
- * @type {Number}
516
- */
517
- this.PAN_DOWN = 3;
518
-
519
- /**
520
- * Identifies the XX action.
521
- * @final
522
- * @type {Number}
523
- */
524
- this.PAN_FORWARDS = 4;
525
-
526
- /**
527
- * Identifies the XX action.
528
- * @final
529
- * @type {Number}
530
- */
531
- this.PAN_BACKWARDS = 5;
532
-
533
- /**
534
- * Identifies the XX action.
535
- * @final
536
- * @type {Number}
537
- */
538
- this.ROTATE_X_POS = 6;
539
-
540
- /**
541
- * Identifies the XX action.
542
- * @final
543
- * @type {Number}
544
- */
545
- this.ROTATE_X_NEG = 7;
546
-
547
- /**
548
- * Identifies the XX action.
549
- * @final
550
- * @type {Number}
551
- */
552
- this.ROTATE_Y_POS = 8;
553
-
554
- /**
555
- * Identifies the XX action.
556
- * @final
557
- * @type {Number}
558
- */
559
- this.ROTATE_Y_NEG = 9;
560
-
561
- /**
562
- * Identifies the XX action.
563
- * @final
564
- * @type {Number}
565
- */
566
- this.DOLLY_FORWARDS = 10;
567
-
568
- /**
569
- * Identifies the XX action.
570
- * @final
571
- * @type {Number}
572
- */
573
- this.DOLLY_BACKWARDS = 11;
574
-
575
- /**
576
- * Identifies the XX action.
577
- * @final
578
- * @type {Number}
579
- */
580
- this.AXIS_VIEW_RIGHT = 12;
581
-
582
- /**
583
- * Identifies the XX action.
584
- * @final
585
- * @type {Number}
586
- */
587
- this.AXIS_VIEW_BACK = 13;
588
-
589
- /**
590
- * Identifies the XX action.
591
- * @final
592
- * @type {Number}
593
- */
594
- this.AXIS_VIEW_LEFT = 14;
595
-
596
- /**
597
- * Identifies the XX action.
598
- * @final
599
- * @type {Number}
600
- */
601
- this.AXIS_VIEW_FRONT = 15;
602
-
603
- /**
604
- * Identifies the XX action.
605
- * @final
606
- * @type {Number}
607
- */
608
- this.AXIS_VIEW_TOP = 16;
609
-
610
- /**
611
- * Identifies the XX action.
612
- * @final
613
- * @type {Number}
614
- */
615
- this.AXIS_VIEW_BOTTOM = 17;
616
-
617
- this._keyMap = {}; // Maps key codes to the above actions
618
-
619
- this.scene.canvas.canvas.oncontextmenu = (e) => {
620
- e.preventDefault();
621
- };
622
-
623
- // User-settable CameraControl configurations
624
-
625
- this._configs = {
626
-
627
- // Private
628
-
629
- longTapTimeout: 600, // Millisecs
630
- longTapRadius: 5, // Pixels
631
-
632
- // General
633
-
634
- active: true,
635
- keyboardLayout: "qwerty",
636
- navMode: "orbit",
637
- planView: false,
638
- firstPerson: false,
639
- followPointer: true,
640
- doublePickFlyTo: true,
641
- panRightClick: true,
642
- showPivot: false,
643
- pointerEnabled: true,
644
- constrainVertical: false,
645
- smartPivot: false,
646
- doubleClickTimeFrame: 250,
647
-
648
- snapToVertex: DEFAULT_SNAP_VERTEX,
649
- snapToEdge: DEFAULT_SNAP_EDGE,
650
- snapRadius: DEFAULT_SNAP_PICK_RADIUS,
651
-
652
- // Rotation
653
-
654
- dragRotationRate: 360.0,
655
- keyboardRotationRate: 90.0,
656
- rotationInertia: 0.0,
657
-
658
- // Panning
659
-
660
- keyboardPanRate: 1.0,
661
- touchPanRate: 1.0,
662
- panInertia: 0.5,
663
-
664
- // Dollying
665
-
666
- keyboardDollyRate: 10,
667
- mouseWheelDollyRate: 100,
668
- touchDollyRate: 0.2,
669
- dollyInertia: 0,
670
- dollyProximityThreshold: 30.0,
671
- dollyMinSpeed: 0.04
672
- };
673
-
674
- // Current runtime state of the CameraControl
675
-
676
- this._states = {
677
- pointerCanvasPos: math.vec2(),
678
- mouseover: false,
679
- followPointerDirty: true,
680
- mouseDownClientX: 0,
681
- mouseDownClientY: 0,
682
- mouseDownCursorX: 0,
683
- mouseDownCursorY: 0,
684
- touchStartTime: null,
685
- activeTouches: [],
686
- tapStartPos: math.vec2(),
687
- tapStartTime: -1,
688
- lastTapTime: -1,
689
- longTouchTimeout: null
690
- };
691
-
692
- // Updates for CameraUpdater to process on next Scene "tick" event
693
-
694
- this._updates = {
695
- rotateDeltaX: 0,
696
- rotateDeltaY: 0,
697
- panDeltaX: 0,
698
- panDeltaY: 0,
699
- panDeltaZ: 0,
700
- dollyDelta: 0
701
- };
702
-
703
- // Controllers to assist input event handlers with controlling the Camera
704
-
705
- const scene = this.scene;
706
-
707
- this._controllers = {
708
- cameraControl: this,
709
- pickController: new PickController(this, this._configs),
710
- pivotController: new PivotController(scene, this._configs),
711
- panController: new PanController(scene),
712
- cameraFlight: new CameraFlightAnimation(this, {
713
- duration: 0.5
714
- })
715
- };
716
-
717
- // Input event handlers
718
-
719
- this._handlers = [
720
- new MouseMiscHandler(this.scene, this._controllers, this._configs, this._states, this._updates),
721
- new TouchPanRotateAndDollyHandler(this.scene, this._controllers, this._configs, this._states, this._updates),
722
- new MousePanRotateDollyHandler(this.scene, this._controllers, this._configs, this._states, this._updates),
723
- new KeyboardAxisViewHandler(this.scene, this._controllers, this._configs, this._states, this._updates),
724
- new MousePickHandler(this.scene, this._controllers, this._configs, this._states, this._updates),
725
- new TouchPickHandler(this.scene, this._controllers, this._configs, this._states, this._updates),
726
- new KeyboardPanRotateDollyHandler(this.scene, this._controllers, this._configs, this._states, this._updates)
727
- ];
728
-
729
- // Applies scheduled updates to the Camera on each Scene "tick" event
730
-
731
- this._cameraUpdater = new CameraUpdater(this.scene, this._controllers, this._configs, this._states, this._updates);
732
-
733
- // Set initial user configurations
734
-
735
- this.navMode = cfg.navMode;
736
- if (cfg.planView) {
737
- this.planView = cfg.planView;
738
- }
739
- this.constrainVertical = cfg.constrainVertical;
740
- if (cfg.keyboardLayout) {
741
- this.keyboardLayout = cfg.keyboardLayout; // Deprecated
742
- } else {
743
- this.keyMap = cfg.keyMap;
744
- }
745
- this.doublePickFlyTo = cfg.doublePickFlyTo;
746
- this.panRightClick = cfg.panRightClick;
747
- this.active = cfg.active;
748
- this.followPointer = cfg.followPointer;
749
- this.rotationInertia = cfg.rotationInertia;
750
- this.keyboardPanRate = cfg.keyboardPanRate;
751
- this.touchPanRate = cfg.touchPanRate;
752
- this.keyboardRotationRate = cfg.keyboardRotationRate;
753
- this.dragRotationRate = cfg.dragRotationRate;
754
- this.touchDollyRate = cfg.touchDollyRate;
755
- this.dollyInertia = cfg.dollyInertia;
756
- this.dollyProximityThreshold = cfg.dollyProximityThreshold;
757
- this.dollyMinSpeed = cfg.dollyMinSpeed;
758
- this.panInertia = cfg.panInertia;
759
- this.pointerEnabled = true;
760
- this.keyboardDollyRate = cfg.keyboardDollyRate;
761
- this.mouseWheelDollyRate = cfg.mouseWheelDollyRate;
762
- }
763
-
764
- /**
765
- * Sets custom mappings of keys to ````CameraControl```` actions.
766
- *
767
- * See class docs for usage.
768
- *
769
- * @param {{Number:Number}|String} value Either a set of new key mappings, or a string to select a keyboard layout,
770
- * which causes ````CameraControl```` to use the default key mappings for that layout.
771
- */
772
- set keyMap(value) {
773
- value = value || "qwerty";
774
- if (utils.isString(value)) {
775
- const input = this.scene.input;
776
- const keyMap = {};
777
-
778
- switch (value) {
779
-
780
- default:
781
- this.error("Unsupported value for 'keyMap': " + value + " defaulting to 'qwerty'");
782
- // Intentional fall-through to "qwerty"
783
- case "qwerty":
784
- keyMap[this.PAN_LEFT] = [input.KEY_A];
785
- keyMap[this.PAN_RIGHT] = [input.KEY_D];
786
- keyMap[this.PAN_UP] = [input.KEY_Z];
787
- keyMap[this.PAN_DOWN] = [input.KEY_X];
788
- keyMap[this.PAN_BACKWARDS] = [];
789
- keyMap[this.PAN_FORWARDS] = [];
790
- keyMap[this.DOLLY_FORWARDS] = [input.KEY_W, input.KEY_ADD];
791
- keyMap[this.DOLLY_BACKWARDS] = [input.KEY_S, input.KEY_SUBTRACT];
792
- keyMap[this.ROTATE_X_POS] = [input.KEY_DOWN_ARROW];
793
- keyMap[this.ROTATE_X_NEG] = [input.KEY_UP_ARROW];
794
- keyMap[this.ROTATE_Y_POS] = [input.KEY_Q, input.KEY_LEFT_ARROW];
795
- keyMap[this.ROTATE_Y_NEG] = [input.KEY_E, input.KEY_RIGHT_ARROW];
796
- keyMap[this.AXIS_VIEW_RIGHT] = [input.KEY_NUM_1];
797
- keyMap[this.AXIS_VIEW_BACK] = [input.KEY_NUM_2];
798
- keyMap[this.AXIS_VIEW_LEFT] = [input.KEY_NUM_3];
799
- keyMap[this.AXIS_VIEW_FRONT] = [input.KEY_NUM_4];
800
- keyMap[this.AXIS_VIEW_TOP] = [input.KEY_NUM_5];
801
- keyMap[this.AXIS_VIEW_BOTTOM] = [input.KEY_NUM_6];
802
- break;
803
-
804
- case "azerty":
805
- keyMap[this.PAN_LEFT] = [input.KEY_Q];
806
- keyMap[this.PAN_RIGHT] = [input.KEY_D];
807
- keyMap[this.PAN_UP] = [input.KEY_W];
808
- keyMap[this.PAN_DOWN] = [input.KEY_X];
809
- keyMap[this.PAN_BACKWARDS] = [];
810
- keyMap[this.PAN_FORWARDS] = [];
811
- keyMap[this.DOLLY_FORWARDS] = [input.KEY_Z, input.KEY_ADD];
812
- keyMap[this.DOLLY_BACKWARDS] = [input.KEY_S, input.KEY_SUBTRACT];
813
- keyMap[this.ROTATE_X_POS] = [input.KEY_DOWN_ARROW];
814
- keyMap[this.ROTATE_X_NEG] = [input.KEY_UP_ARROW];
815
- keyMap[this.ROTATE_Y_POS] = [input.KEY_A, input.KEY_LEFT_ARROW];
816
- keyMap[this.ROTATE_Y_NEG] = [input.KEY_E, input.KEY_RIGHT_ARROW];
817
- keyMap[this.AXIS_VIEW_RIGHT] = [input.KEY_NUM_1];
818
- keyMap[this.AXIS_VIEW_BACK] = [input.KEY_NUM_2];
819
- keyMap[this.AXIS_VIEW_LEFT] = [input.KEY_NUM_3];
820
- keyMap[this.AXIS_VIEW_FRONT] = [input.KEY_NUM_4];
821
- keyMap[this.AXIS_VIEW_TOP] = [input.KEY_NUM_5];
822
- keyMap[this.AXIS_VIEW_BOTTOM] = [input.KEY_NUM_6];
823
- break;
824
- }
825
-
826
- this._keyMap = keyMap;
827
- } else {
828
- const keyMap = value;
829
- this._keyMap = keyMap;
830
- }
831
- }
832
-
833
- /**
834
- * Gets custom mappings of keys to {@link CameraControl} actions.
835
- *
836
- * @returns {{Number:Number}} Current key mappings.
837
- */
838
- get keyMap() {
839
- return this._keyMap;
840
- }
841
-
842
- /**
843
- * Returns true if any keys configured for the given action are down.
844
- * @param action
845
- * @param keyDownMap
846
- * @private
847
- */
848
- _isKeyDownForAction(action, keyDownMap) {
849
- const keys = this._keyMap[action];
850
- if (!keys) {
851
- return false;
852
- }
853
- if (!keyDownMap) {
854
- keyDownMap = this.scene.input.keyDown;
855
- }
856
- for (let i = 0, len = keys.length; i < len; i++) {
857
- const key = keys[i];
858
- if (keyDownMap[key]) {
859
- return true;
860
- }
861
- }
862
- return false;
863
- }
864
-
865
- /**
866
- * Sets the HTMl element to represent the pivot point when {@link CameraControl#followPointer} is true.
867
- *
868
- * See class comments for an example.
869
- *
870
- * @param {HTMLElement} element HTML element representing the pivot point.
871
- */
872
- set pivotElement(element) {
873
- this._controllers.pivotController.setPivotElement(element);
874
- }
875
-
876
- /**
877
- * Sets if this ````CameraControl```` is active or not.
878
- *
879
- * When inactive, the ````CameraControl```` will not react to input.
880
- *
881
- * Default is ````true````.
882
- *
883
- * @param {Boolean} value Set ````true```` to activate this ````CameraControl````.
884
- */
885
- set active(value) {
886
- value = value !== false;
887
- this._configs.active = value;
888
- this._handlers[1]._active = value;
889
- this._handlers[5]._active = value;
890
- }
891
-
892
- /**
893
- * Gets if this ````CameraControl```` is active or not.
894
- *
895
- * When inactive, the ````CameraControl```` will not react to input.
896
- *
897
- * Default is ````true````.
898
- *
899
- * @returns {Boolean} Returns ````true```` if this ````CameraControl```` is active.
900
- */
901
- get active() {
902
- return this._configs.active;
903
- }
904
-
905
- /**
906
- * Sets whether the pointer snap to vertex.
907
- *
908
- * @param {boolean} snapToVertex
909
- */
910
- set snapToVertex(snapToVertex) {
911
- this._configs.snapToVertex = !!snapToVertex;
912
- }
913
-
914
- /**
915
- * Gets whether the pointer snap to vertex.
916
- *
917
- * @returns {boolean}
918
- */
919
- get snapToVertex() {
920
- return this._configs.snapToVertex;
921
- }
922
-
923
- /**
924
- * Sets whether the pointer snap to edge.
925
- *
926
- * @param {boolean} snapToEdge
927
- */
928
- set snapToEdge(snapToEdge) {
929
- this._configs.snapToEdge = !!snapToEdge;
930
- }
931
-
932
- /**
933
- * Gets whether the pointer snap to edge.
934
- *
935
- * @returns {boolean}
936
- */
937
- get snapToEdge() {
938
- return this._configs.snapToEdge;
939
- }
940
-
941
- /**
942
- * Sets the current snap radius for "hoverSnapOrSurface" events, to specify whether the radius
943
- * within which the pointer snaps to the nearest vertex or the nearest edge.
944
- *
945
- * Default value is 30 pixels.
946
- *
947
- * @param {Number} snapRadius The snap radius.
948
- */
949
- set snapRadius(snapRadius) {
950
- snapRadius = snapRadius || DEFAULT_SNAP_PICK_RADIUS;
951
- this._configs.snapRadius = snapRadius;
952
- }
953
-
954
- /**
955
- * Gets the current snap radius.
956
- *
957
- * @returns {Number} The snap radius.
958
- */
959
- get snapRadius() {
960
- return this._configs.snapRadius;
961
- }
962
-
963
- /**
964
- * Sets the current navigation mode.
965
- *
966
- * Accepted values are:
967
- *
968
- * * "orbit" - rotation orbits about the current target or pivot point,
969
- * * "firstPerson" - rotation is about the current eye position,
970
- * * "planView" - rotation is disabled.
971
- *
972
- * See class comments for more info.
973
- *
974
- * @param {String} navMode The navigation mode: "orbit", "firstPerson" or "planView".
975
- */
976
- set navMode(navMode) {
977
- navMode = navMode || "orbit";
978
- if (navMode !== "firstPerson" && navMode !== "orbit" && navMode !== "planView") {
979
- this.error("Unsupported value for navMode: " + navMode + " - supported values are 'orbit', 'firstPerson' and 'planView' - defaulting to 'orbit'");
980
- navMode = "orbit";
981
- }
982
- this._configs.firstPerson = (navMode === "firstPerson");
983
- this._configs.planView = (navMode === "planView");
984
- if (this._configs.firstPerson || this._configs.planView) {
985
- this._controllers.pivotController.hidePivot();
986
- this._controllers.pivotController.endPivot();
987
- }
988
- this._configs.navMode = navMode;
989
- }
990
-
991
- /**
992
- * Gets the current navigation mode.
993
- *
994
- * @returns {String} The navigation mode: "orbit", "firstPerson" or "planView".
995
- */
996
- get navMode() {
997
- return this._configs.navMode;
998
- }
999
-
1000
- /**
1001
- * Sets whether mouse and touch input is enabled.
1002
- *
1003
- * Default is ````true````.
1004
- *
1005
- * Disabling mouse and touch input on ````CameraControl```` is useful when we want to temporarily use mouse or
1006
- * touch input to interact with some other 3D control, without disturbing the {@link Camera}.
1007
- *
1008
- * @param {Boolean} value Set ````true```` to enable mouse and touch input.
1009
- */
1010
- set pointerEnabled(value) {
1011
- this._reset();
1012
- this._configs.pointerEnabled = !!value;
1013
- }
1014
-
1015
- _reset() {
1016
- for (let i = 0, len = this._handlers.length; i < len; i++) {
1017
- const handler = this._handlers[i];
1018
- if (handler.reset) {
1019
- handler.reset();
1020
- }
1021
- }
1022
-
1023
- this._updates.panDeltaX = 0;
1024
- this._updates.panDeltaY = 0;
1025
- this._updates.rotateDeltaX = 0;
1026
- this._updates.rotateDeltaY = 0;
1027
- this._updates.dolyDelta = 0;
1028
- }
1029
-
1030
- /**
1031
- * Gets whether mouse and touch input is enabled.
1032
- *
1033
- * Default is ````true````.
1034
- *
1035
- * Disabling mouse and touch input on ````CameraControl```` is desirable when we want to temporarily use mouse or
1036
- * touch input to interact with some other 3D control, without interfering with the {@link Camera}.
1037
- *
1038
- * @returns {Boolean} Returns ````true```` if mouse and touch input is enabled.
1039
- */
1040
- get pointerEnabled() {
1041
- return this._configs.pointerEnabled;
1042
- }
1043
-
1044
- /**
1045
- * Sets whether the {@link Camera} follows the mouse/touch pointer.
1046
- *
1047
- * In orbiting mode, the Camera will orbit about the pointer, and will dolly to and from the pointer.
1048
- *
1049
- * In fly-to mode, the Camera will dolly to and from the pointer, however the World will always rotate about the Camera position.
1050
- *
1051
- * In plan-view mode, the Camera will dolly to and from the pointer, however the Camera will not rotate.
1052
- *
1053
- * Default is ````true````.
1054
- *
1055
- * See class comments for more info.
1056
- *
1057
- * @param {Boolean} value Set ````true```` to enable the Camera to follow the pointer.
1058
- */
1059
- set followPointer(value) {
1060
- this._configs.followPointer = (value !== false);
1061
- }
1062
-
1063
- /**
1064
- * Sets whether the {@link Camera} follows the mouse/touch pointer.
1065
- *
1066
- * In orbiting mode, the Camera will orbit about the pointer, and will dolly to and from the pointer.
1067
- *
1068
- * In fly-to mode, the Camera will dolly to and from the pointer, however the World will always rotate about the Camera position.
1069
- *
1070
- * In plan-view mode, the Camera will dolly to and from the pointer, however the Camera will not rotate.
1071
- *
1072
- * Default is ````true````.
1073
- *
1074
- * See class comments for more info.
1075
- *
1076
- * @returns {Boolean} Returns ````true```` if the Camera follows the pointer.
1077
- */
1078
- get followPointer() {
1079
- return this._configs.followPointer;
1080
- }
1081
-
1082
- /**
1083
- * Sets the current World-space 3D target position.
1084
- *
1085
- * Only applies when {@link CameraControl#followPointer} is ````true````.
1086
- *
1087
- * @param {Number[]} worldPos The new World-space 3D target position.
1088
- */
1089
- set pivotPos(worldPos) {
1090
- this._controllers.pivotController.setPivotPos(worldPos);
1091
- }
1092
-
1093
- /**
1094
- * Gets the current World-space 3D pivot position.
1095
- *
1096
- * Only applies when {@link CameraControl#followPointer} is ````true````.
1097
- *
1098
- * @return {Number[]} worldPos The current World-space 3D pivot position.
1099
- */
1100
- get pivotPos() {
1101
- return this._controllers.pivotController.getPivotPos();
1102
- }
1103
-
1104
- /**
1105
- * @deprecated
1106
- * @param {Boolean} value Set ````true```` to enable dolly-to-pointer behaviour.
1107
- */
1108
- set dollyToPointer(value) {
1109
- this.warn("dollyToPointer property is deprecated - replaced with followPointer");
1110
- this.followPointer = value;
1111
- }
1112
-
1113
- /**
1114
- * @deprecated
1115
- * @returns {Boolean} Returns ````true```` if dolly-to-pointer behaviour is enabled.
1116
- */
1117
- get dollyToPointer() {
1118
- this.warn("dollyToPointer property is deprecated - replaced with followPointer");
1119
- return this.followPointer;
1120
- }
1121
-
1122
- /**
1123
- * @deprecated
1124
- * @param {Boolean} value Set ````true```` to enable dolly-to-pointer behaviour.
1125
- */
1126
- set panToPointer(value) {
1127
- this.warn("panToPointer property is deprecated - replaced with followPointer");
1128
- }
1129
-
1130
- /**
1131
- * @deprecated
1132
- * @returns {Boolean} Returns ````true```` if dolly-to-pointer behaviour is enabled.
1133
- */
1134
- get panToPointer() {
1135
- this.warn("panToPointer property is deprecated - replaced with followPointer");
1136
- return false;
1137
- }
1138
-
1139
- /**
1140
- * Sets whether this ````CameraControl```` is in plan-view mode.
1141
- *
1142
- * When in plan-view mode, rotation is disabled.
1143
- *
1144
- * Default is ````false````.
1145
- *
1146
- * Deprecated - use {@link CameraControl#navMode} instead.
1147
- *
1148
- * @param {Boolean} value Set ````true```` to enable plan-view mode.
1149
- * @deprecated
1150
- */
1151
- set planView(value) {
1152
- this._configs.planView = !!value;
1153
- this._configs.firstPerson = false;
1154
- if (this._configs.planView) {
1155
- this._controllers.pivotController.hidePivot();
1156
- this._controllers.pivotController.endPivot();
1157
- }
1158
- this.warn("planView property is deprecated - replaced with navMode");
1159
- }
1160
-
1161
- /**
1162
- * Gets whether this ````CameraControl```` is in plan-view mode.
1163
- *
1164
- * When in plan-view mode, rotation is disabled.
1165
- *
1166
- * Default is ````false````.
1167
- *
1168
- * Deprecated - use {@link CameraControl#navMode} instead.
1169
- *
1170
- * @returns {Boolean} Returns ````true```` if plan-view mode is enabled.
1171
- * @deprecated
1172
- */
1173
- get planView() {
1174
- this.warn("planView property is deprecated - replaced with navMode");
1175
- return this._configs.planView;
1176
- }
1177
-
1178
- /**
1179
- * Sets whether this ````CameraControl```` is in first-person mode.
1180
- *
1181
- * In "first person" mode (disabled by default) the look position rotates about the eye position. Otherwise, {@link Camera#eye} rotates about {@link Camera#look}.
1182
- *
1183
- * Default is ````false````.
1184
- *
1185
- * Deprecated - use {@link CameraControl#navMode} instead.
1186
- *
1187
- * @param {Boolean} value Set ````true```` to enable first-person mode.
1188
- * @deprecated
1189
- */
1190
- set firstPerson(value) {
1191
- this.warn("firstPerson property is deprecated - replaced with navMode");
1192
- this._configs.firstPerson = !!value;
1193
- this._configs.planView = false;
1194
- if (this._configs.firstPerson) {
1195
- this._controllers.pivotController.hidePivot();
1196
- this._controllers.pivotController.endPivot();
1197
- }
1198
- }
1199
-
1200
- /**
1201
- * Gets whether this ````CameraControl```` is in first-person mode.
1202
- *
1203
- * In "first person" mode (disabled by default) the look position rotates about the eye position. Otherwise, {@link Camera#eye} rotates about {@link Camera#look}.
1204
- *
1205
- * Default is ````false````.
1206
- *
1207
- * Deprecated - use {@link CameraControl#navMode} instead.
1208
- *
1209
- * @returns {Boolean} Returns ````true```` if first-person mode is enabled.
1210
- * @deprecated
1211
- */
1212
- get firstPerson() {
1213
- this.warn("firstPerson property is deprecated - replaced with navMode");
1214
- return this._configs.firstPerson;
1215
- }
1216
-
1217
- /**
1218
- * Sets whether to vertically constrain the {@link Camera} position for first-person navigation.
1219
- *
1220
- * When set ````true````, this constrains {@link Camera#eye} to its current vertical position.
1221
- *
1222
- * Only applies when {@link CameraControl#navMode} is ````"firstPerson"````.
1223
- *
1224
- * Default is ````false````.
1225
- *
1226
- * @param {Boolean} value Set ````true```` to vertically constrain the Camera.
1227
- */
1228
- set constrainVertical(value) {
1229
- this._configs.constrainVertical = !!value;
1230
- }
1231
-
1232
- /**
1233
- * Gets whether to vertically constrain the {@link Camera} position for first-person navigation.
1234
- *
1235
- * When set ````true````, this constrains {@link Camera#eye} to its current vertical position.
1236
- *
1237
- * Only applies when {@link CameraControl#navMode} is ````"firstPerson"````.
1238
- *
1239
- * Default is ````false````.
1240
- *
1241
- * @returns {Boolean} ````true```` when Camera is vertically constrained.
1242
- */
1243
- get constrainVertical() {
1244
- return this._configs.constrainVertical;
1245
- }
1246
-
1247
- /**
1248
- * Sets whether double-picking an {@link Entity} causes the {@link Camera} to fly to its boundary.
1249
- *
1250
- * Default is ````false````.
1251
- *
1252
- * @param {Boolean} value Set ````true```` to enable double-pick-fly-to mode.
1253
- */
1254
- set doublePickFlyTo(value) {
1255
- this._configs.doublePickFlyTo = value !== false;
1256
- }
1257
-
1258
- /**
1259
- * Gets whether double-picking an {@link Entity} causes the {@link Camera} to fly to its boundary.
1260
- *
1261
- * Default is ````false````.
1262
- *
1263
- * @returns {Boolean} Returns ````true```` when double-pick-fly-to mode is enabled.
1264
- */
1265
- get doublePickFlyTo() {
1266
- return this._configs.doublePickFlyTo;
1267
- }
1268
-
1269
- /**
1270
- * Sets whether either right-clicking (true) or middle-clicking (false) pans the {@link Camera}.
1271
- *
1272
- * Default is ````true````.
1273
- *
1274
- * @param {Boolean} value Set ````false```` to disable pan on right-click.
1275
- */
1276
- set panRightClick(value) {
1277
- this._configs.panRightClick = value !== false;
1278
- }
1279
-
1280
- /**
1281
- * Gets whether right-clicking pans the {@link Camera}.
1282
- *
1283
- * Default is ````true````.
1284
- *
1285
- * @returns {Boolean} Returns ````false```` when pan on right-click is disabled.
1286
- */
1287
- get panRightClick() {
1288
- return this._configs.panRightClick;
1289
- }
1290
-
1291
- /**
1292
- * Sets a factor in range ````[0..1]```` indicating how much the {@link Camera} keeps moving after you finish rotating it.
1293
- *
1294
- * A value of ````0.0```` causes it to immediately stop, ````0.5```` causes its movement to decay 50% on each tick,
1295
- * while ````1.0```` causes no decay, allowing it continue moving, by the current rate of rotation.
1296
- *
1297
- * You may choose an inertia of zero when you want be able to precisely rotate the Camera,
1298
- * without interference from inertia. Zero inertia can also mean that less frames are rendered while
1299
- * you are rotating the Camera.
1300
- *
1301
- * Default is ````0.0````.
1302
- *
1303
- * Does not apply when {@link CameraControl#navMode} is ````"planView"````, which disallows rotation.
1304
- *
1305
- * @param {Number} rotationInertia New inertial factor.
1306
- */
1307
- set rotationInertia(rotationInertia) {
1308
- this._configs.rotationInertia = (rotationInertia !== undefined && rotationInertia !== null) ? rotationInertia : 0.0;
1309
- }
1310
-
1311
- /**
1312
- * Gets the rotation inertia factor.
1313
- *
1314
- * Default is ````0.0````.
1315
- *
1316
- * Does not apply when {@link CameraControl#navMode} is ````"planView"````, which disallows rotation.
1317
- *
1318
- * @returns {Number} The inertia factor.
1319
- */
1320
- get rotationInertia() {
1321
- return this._configs.rotationInertia;
1322
- }
1323
-
1324
- /**
1325
- * Sets how much the {@link Camera} pans each second with keyboard input.
1326
- *
1327
- * Default is ````5.0````, to pan the Camera ````5.0```` World-space units every second that
1328
- * a panning key is depressed. See the ````CameraControl```` class documentation for which keys control
1329
- * panning.
1330
- *
1331
- * Panning direction is aligned to our Camera's orientation. When we pan horizontally, we pan
1332
- * to our left and right, when we pan vertically, we pan upwards and downwards, and when we pan forwards
1333
- * and backwards, we pan along the direction the Camera is pointing.
1334
- *
1335
- * Unlike dollying when {@link followPointer} is ````true````, panning does not follow the pointer.
1336
- *
1337
- * @param {Number} keyboardPanRate The new keyboard pan rate.
1338
- */
1339
- set keyboardPanRate(keyboardPanRate) {
1340
- this._configs.keyboardPanRate = (keyboardPanRate !== null && keyboardPanRate !== undefined) ? keyboardPanRate : 5.0;
1341
- }
1342
-
1343
-
1344
- /**
1345
- * Sets how fast the camera pans on touch panning
1346
- *
1347
- * @param {Number} touchPanRate The new touch pan rate.
1348
- */
1349
- set touchPanRate(touchPanRate) {
1350
- this._configs.touchPanRate = (touchPanRate !== null && touchPanRate !== undefined) ? touchPanRate : 1.0;
1351
- }
1352
-
1353
- /**
1354
- * Gets how fast the {@link Camera} pans on touch panning
1355
- *
1356
- * Default is ````1.0````.
1357
- *
1358
- * @returns {Number} The current touch pan rate.
1359
- */
1360
- get touchPanRate() {
1361
- return this._configs.touchPanRate;
1362
- }
1363
-
1364
- /**
1365
- * Gets how much the {@link Camera} pans each second with keyboard input.
1366
- *
1367
- * Default is ````5.0````.
1368
- *
1369
- * @returns {Number} The current keyboard pan rate.
1370
- */
1371
- get keyboardPanRate() {
1372
- return this._configs.keyboardPanRate;
1373
- }
1374
-
1375
- /**
1376
- * Sets how many degrees per second the {@link Camera} rotates/orbits with keyboard input.
1377
- *
1378
- * Default is ````90.0````, to rotate/orbit the Camera ````90.0```` degrees every second that
1379
- * a rotation key is depressed. See the ````CameraControl```` class documentation for which keys control
1380
- * rotation/orbit.
1381
- *
1382
- * @param {Number} keyboardRotationRate The new keyboard rotation rate.
1383
- */
1384
- set keyboardRotationRate(keyboardRotationRate) {
1385
- this._configs.keyboardRotationRate = (keyboardRotationRate !== null && keyboardRotationRate !== undefined) ? keyboardRotationRate : 90.0;
1386
- }
1387
-
1388
- /**
1389
- * Sets how many degrees per second the {@link Camera} rotates/orbits with keyboard input.
1390
- *
1391
- * Default is ````90.0````.
1392
- *
1393
- * @returns {Number} The current keyboard rotation rate.
1394
- */
1395
- get keyboardRotationRate() {
1396
- return this._configs.keyboardRotationRate;
1397
- }
1398
-
1399
- /**
1400
- * Sets the current drag rotation rate.
1401
- *
1402
- * This configures how many degrees the {@link Camera} rotates/orbits for a full sweep of the canvas by mouse or touch dragging.
1403
- *
1404
- * For example, a value of ````360.0```` indicates that the ````Camera```` rotates/orbits ````360.0```` degrees horizontally
1405
- * when we sweep the entire width of the canvas.
1406
- *
1407
- * ````CameraControl```` makes vertical rotation half as sensitive as horizontal rotation, so that we don't tend to
1408
- * flip upside-down. Therefore, a value of ````360.0```` rotates/orbits the ````Camera```` through ````180.0```` degrees
1409
- * vertically when we sweep the entire height of the canvas.
1410
- *
1411
- * Default is ````360.0````.
1412
- *
1413
- * @param {Number} dragRotationRate The new drag rotation rate.
1414
- */
1415
- set dragRotationRate(dragRotationRate) {
1416
- this._configs.dragRotationRate = (dragRotationRate !== null && dragRotationRate !== undefined) ? dragRotationRate : 360.0;
1417
- }
1418
-
1419
- /**
1420
- * Gets the current drag rotation rate.
1421
- *
1422
- * Default is ````360.0````.
1423
- *
1424
- * @returns {Number} The current drag rotation rate.
1425
- */
1426
- get dragRotationRate() {
1427
- return this._configs.dragRotationRate;
1428
- }
1429
-
1430
- /**
1431
- * Sets how much the {@link Camera} dollys each second with keyboard input.
1432
- *
1433
- * Default is ````15.0````, to dolly the {@link Camera} ````15.0```` World-space units per second while we hold down
1434
- * the ````+```` and ````-```` keys.
1435
- *
1436
- * @param {Number} keyboardDollyRate The new keyboard dolly rate.
1437
- */
1438
- set keyboardDollyRate(keyboardDollyRate) {
1439
- this._configs.keyboardDollyRate = (keyboardDollyRate !== null && keyboardDollyRate !== undefined) ? keyboardDollyRate : 15.0;
1440
- }
1441
-
1442
- /**
1443
- * Gets how much the {@link Camera} dollys each second with keyboard input.
1444
- *
1445
- * Default is ````15.0````.
1446
- *
1447
- * @returns {Number} The current keyboard dolly rate.
1448
- */
1449
- get keyboardDollyRate() {
1450
- return this._configs.keyboardDollyRate;
1451
- }
1452
-
1453
- /**
1454
- * Sets how much the {@link Camera} dollys with touch input.
1455
- *
1456
- * Default is ````0.2````
1457
- *
1458
- * @param {Number} touchDollyRate The new touch dolly rate.
1459
- */
1460
- set touchDollyRate(touchDollyRate) {
1461
- this._configs.touchDollyRate = (touchDollyRate !== null && touchDollyRate !== undefined) ? touchDollyRate : 0.2;
1462
- }
1463
-
1464
- /**
1465
- * Gets how much the {@link Camera} dollys each second with touch input.
1466
- *
1467
- * Default is ````0.2````.
1468
- *
1469
- * @returns {Number} The current touch dolly rate.
1470
- */
1471
- get touchDollyRate() {
1472
- return this._configs.touchDollyRate;
1473
- }
1474
-
1475
- /**
1476
- * Sets how much the {@link Camera} dollys each second while the mouse wheel is spinning.
1477
- *
1478
- * Default is ````100.0````, to dolly the {@link Camera} ````10.0```` World-space units per second as we spin
1479
- * the mouse wheel.
1480
- *
1481
- * @param {Number} mouseWheelDollyRate The new mouse wheel dolly rate.
1482
- */
1483
- set mouseWheelDollyRate(mouseWheelDollyRate) {
1484
- this._configs.mouseWheelDollyRate = (mouseWheelDollyRate !== null && mouseWheelDollyRate !== undefined) ? mouseWheelDollyRate : 100.0;
1485
- }
1486
-
1487
- /**
1488
- * Gets how much the {@link Camera} dollys each second while the mouse wheel is spinning.
1489
- *
1490
- * Default is ````100.0````.
1491
- *
1492
- * @returns {Number} The current mouseWheel dolly rate.
1493
- */
1494
- get mouseWheelDollyRate() {
1495
- return this._configs.mouseWheelDollyRate;
1496
- }
1497
-
1498
- /**
1499
- * Sets the dolly inertia factor.
1500
- *
1501
- * This factor configures how much the {@link Camera} keeps moving after you finish dollying it.
1502
- *
1503
- * This factor is a value in range ````[0..1]````. A value of ````0.0```` causes dollying to immediately stop,
1504
- * ````0.5```` causes dollying to decay 50% on each animation frame, while ````1.0```` causes no decay, which allows dollying
1505
- * to continue until further input stops it.
1506
- *
1507
- * You might set ````dollyInertia```` to zero when you want be able to precisely position or rotate the Camera,
1508
- * without interference from inertia. This also means that xeokit renders less frames while dollying the Camera,
1509
- * which can improve rendering performance.
1510
- *
1511
- * Default is ````0````.
1512
- *
1513
- * @param {Number} dollyInertia New dolly inertia factor.
1514
- */
1515
- set dollyInertia(dollyInertia) {
1516
- this._configs.dollyInertia = (dollyInertia !== undefined && dollyInertia !== null) ? dollyInertia : 0;
1517
- }
1518
-
1519
- /**
1520
- * Gets the dolly inertia factor.
1521
- *
1522
- * Default is ````0````.
1523
- *
1524
- * @returns {Number} The current dolly inertia factor.
1525
- */
1526
- get dollyInertia() {
1527
- return this._configs.dollyInertia;
1528
- }
1529
-
1530
- /**
1531
- * Sets the proximity to the closest object below which dolly speed decreases, and above which dolly speed increases.
1532
- *
1533
- * Default is ````35.0````.
1534
- *
1535
- * @param {Number} dollyProximityThreshold New dolly proximity threshold.
1536
- */
1537
- set dollyProximityThreshold(dollyProximityThreshold) {
1538
- this._configs.dollyProximityThreshold = (dollyProximityThreshold !== undefined && dollyProximityThreshold !== null) ? dollyProximityThreshold : 35.0;
1539
- }
1540
-
1541
- /**
1542
- * Gets the proximity to the closest object below which dolly speed decreases, and above which dolly speed increases.
1543
- *
1544
- * Default is ````35.0````.
1545
- *
1546
- * @returns {Number} The current dolly proximity threshold.
1547
- */
1548
- get dollyProximityThreshold() {
1549
- return this._configs.dollyProximityThreshold;
1550
- }
1551
-
1552
- /**
1553
- * Sets the minimum dolly speed.
1554
- *
1555
- * Default is ````0.04````.
1556
- *
1557
- * @param {Number} dollyMinSpeed New dolly minimum speed.
1558
- */
1559
- set dollyMinSpeed(dollyMinSpeed) {
1560
- this._configs.dollyMinSpeed = (dollyMinSpeed !== undefined && dollyMinSpeed !== null) ? dollyMinSpeed : 0.04;
1561
- }
1562
-
1563
- /**
1564
- * Gets the minimum dolly speed.
1565
- *
1566
- * Default is ````0.04````.
1567
- *
1568
- * @returns {Number} The current minimum dolly speed.
1569
- */
1570
- get dollyMinSpeed() {
1571
- return this._configs.dollyMinSpeed;
1572
- }
1573
-
1574
- /**
1575
- * Sets the pan inertia factor.
1576
- *
1577
- * This factor configures how much the {@link Camera} keeps moving after you finish panning it.
1578
- *
1579
- * This factor is a value in range ````[0..1]````. A value of ````0.0```` causes panning to immediately stop,
1580
- * ````0.5```` causes panning to decay 50% on each animation frame, while ````1.0```` causes no decay, which allows panning
1581
- * to continue until further input stops it.
1582
- *
1583
- * You might set ````panInertia```` to zero when you want be able to precisely position or rotate the Camera,
1584
- * without interference from inertia. This also means that xeokit renders less frames while panning the Camera,
1585
- * wich can improve rendering performance.
1586
- *
1587
- * Default is ````0.5````.
1588
- *
1589
- * @param {Number} panInertia New pan inertia factor.
1590
- */
1591
- set panInertia(panInertia) {
1592
- this._configs.panInertia = (panInertia !== undefined && panInertia !== null) ? panInertia : 0.5;
1593
- }
1594
-
1595
- /**
1596
- * Gets the pan inertia factor.
1597
- *
1598
- * Default is ````0.5````.
1599
- *
1600
- * @returns {Number} The current pan inertia factor.
1601
- */
1602
- get panInertia() {
1603
- return this._configs.panInertia;
1604
- }
1605
-
1606
- /**
1607
- * Sets the keyboard layout.
1608
- *
1609
- * Supported layouts are:
1610
- *
1611
- * * ````"qwerty"```` (default)
1612
- * * ````"azerty"````
1613
- *
1614
- * @deprecated
1615
- * @param {String} value Selects the keyboard layout.
1616
- */
1617
- set keyboardLayout(value) {
1618
- // this.warn("keyboardLayout property is deprecated - use keyMap property instead");
1619
- value = value || "qwerty";
1620
- if (value !== "qwerty" && value !== "azerty") {
1621
- this.error("Unsupported value for keyboardLayout - defaulting to 'qwerty'");
1622
- value = "qwerty";
1623
- }
1624
- this._configs.keyboardLayout = value;
1625
- this.keyMap = this._configs.keyboardLayout;
1626
- }
1627
-
1628
- /**
1629
- * Gets the keyboard layout.
1630
- *
1631
- * Supported layouts are:
1632
- *
1633
- * * ````"qwerty"```` (default)
1634
- * * ````"azerty"````
1635
- *
1636
- * @deprecated
1637
- * @returns {String} The current keyboard layout.
1638
- */
1639
- get keyboardLayout() {
1640
- return this._configs.keyboardLayout;
1641
- }
1642
-
1643
- /**
1644
- * Sets a sphere as the representation of the pivot position.
1645
- *
1646
- * @param {Object} [cfg] Sphere configuration.
1647
- * @param {String} [cfg.size=1] Optional size factor of the sphere. Defaults to 1.
1648
- * @param {String} [cfg.material=PhongMaterial] Optional size factor of the sphere. Defaults to a red opaque material.
1649
- */
1650
- enablePivotSphere(cfg = {}) {
1651
- this._controllers.pivotController.enablePivotSphere(cfg);
1652
- }
1653
-
1654
- /**
1655
- * Remove the sphere as the representation of the pivot position.
1656
- *
1657
- */
1658
- disablePivotSphere() {
1659
- this._controllers.pivotController.disablePivotSphere();
1660
- }
1661
-
1662
- /**
1663
- * Sets whether smart default pivoting is enabled.
1664
- *
1665
- * When ````true````, we'll pivot by default about the 3D position of the mouse/touch pointer on an
1666
- * imaginary sphere that's centered at {@link Camera#eye} and sized to the {@link Scene} boundary.
1667
- *
1668
- * When ````false````, we'll pivot by default about {@link Camera#look}.
1669
- *
1670
- * Default is ````false````.
1671
- *
1672
- * @param {Boolean} enabled Set ````true```` to pivot by default about the selected point on the virtual sphere, or ````false```` to pivot by default about {@link Camera#look}.
1673
- */
1674
- set smartPivot(enabled) {
1675
- this._configs.smartPivot = (enabled !== false);
1676
- }
1677
-
1678
- /**
1679
- * Gets whether smart default pivoting is enabled.
1680
- *
1681
- * When ````true````, we'll pivot by default about the 3D position of the mouse/touch pointer on an
1682
- * imaginary sphere that's centered at {@link Camera#eye} and sized to the {@link Scene} boundary.
1683
- *
1684
- * When ````false````, we'll pivot by default about {@link Camera#look}.
1685
- *
1686
- * Default is ````false````.
1687
- *
1688
- * @returns {Boolean} Returns ````true```` when pivoting by default about the selected point on the virtual sphere, or ````false```` when pivoting by default about {@link Camera#look}.
1689
- */
1690
- get smartPivot() {
1691
- return this._configs.smartPivot;
1692
- }
1693
-
1694
- /**
1695
- * Sets the double click time frame length in milliseconds.
1696
- *
1697
- * If two mouse click events occur within this time frame, it is considered a double click.
1698
- *
1699
- * Default is ````250````
1700
- *
1701
- * @param {Number} value New double click time frame.
1702
- */
1703
- set doubleClickTimeFrame(value) {
1704
- this._configs.doubleClickTimeFrame = (value !== undefined && value !== null) ? value : 250;
1705
- }
1706
-
1707
- /**
1708
- * Gets the double click time frame length in milliseconds.
1709
- *
1710
- * Default is ````250````
1711
- *
1712
- * @param {Number} value Current double click time frame.
1713
- */
1714
- get doubleClickTimeFrame() {
1715
- return this._configs.doubleClickTimeFrame;
1716
- }
1717
-
1718
- /**
1719
- * Destroys this ````CameraControl````.
1720
- * @private
1721
- */
1722
- destroy() {
1723
- this._destroyHandlers();
1724
- this._destroyControllers();
1725
- this._cameraUpdater.destroy();
1726
- super.destroy();
1727
- }
1728
-
1729
- _destroyHandlers() {
1730
- for (let i = 0, len = this._handlers.length; i < len; i++) {
1731
- const handler = this._handlers[i];
1732
- if (handler.destroy) {
1733
- handler.destroy();
1734
- }
1735
- }
1736
- }
1737
-
1738
- _destroyControllers() {
1739
- for (let i = 0, len = this._controllers.length; i < len; i++) {
1740
- const controller = this._controllers[i];
1741
- if (controller.destroy) {
1742
- controller.destroy();
1743
- }
1744
- }
1745
- }
1746
- }
1747
-
1748
- export {
1749
- CameraControl
1750
- };