@xeokit/xeokit-sdk 2.4.0-alpha-81 → 2.4.0-alpha-83

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 (390) hide show
  1. package/dist/xeokit-sdk.cjs.js +5 -1
  2. package/dist/xeokit-sdk.es.js +5 -1
  3. package/dist/xeokit-sdk.es5.js +1 -1
  4. package/dist/xeokit-sdk.min.cjs.js +1 -1
  5. package/dist/xeokit-sdk.min.es.js +1 -1
  6. package/dist/xeokit-sdk.min.es5.js +1 -1
  7. package/package.json +2 -1
  8. package/src/extras/ContextMenu/ContextMenu.js +907 -0
  9. package/src/extras/ContextMenu/index.js +1 -0
  10. package/src/extras/index.js +1 -0
  11. package/src/index.js +3 -0
  12. package/src/plugins/AngleMeasurementsPlugin/AngleMeasurement.js +658 -0
  13. package/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsControl.js +418 -0
  14. package/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsPlugin.js +400 -0
  15. package/src/plugins/AngleMeasurementsPlugin/index.js +1 -0
  16. package/src/plugins/AnnotationsPlugin/Annotation.js +368 -0
  17. package/src/plugins/AnnotationsPlugin/AnnotationsPlugin.js +583 -0
  18. package/src/plugins/AnnotationsPlugin/index.js +1 -0
  19. package/src/plugins/AxisGizmoPlugin/AxisGizmoPlugin.js +333 -0
  20. package/src/plugins/AxisGizmoPlugin/index.js +1 -0
  21. package/src/plugins/BCFViewpointsPlugin/BCFViewpointsPlugin.js +955 -0
  22. package/src/plugins/BCFViewpointsPlugin/index.js +1 -0
  23. package/src/plugins/CityJSONLoaderPlugin/CityJSONDefaultDataSource.js +29 -0
  24. package/src/plugins/CityJSONLoaderPlugin/CityJSONLoaderPlugin.js +751 -0
  25. package/src/plugins/CityJSONLoaderPlugin/index.js +1 -0
  26. package/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js +870 -0
  27. package/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsControl.js +376 -0
  28. package/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsPlugin.js +454 -0
  29. package/src/plugins/DistanceMeasurementsPlugin/index.js +1 -0
  30. package/src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesControl.js +639 -0
  31. package/src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesPlugin.js +436 -0
  32. package/src/plugins/FaceAlignedSectionPlanesPlugin/Overview.js +247 -0
  33. package/src/plugins/FaceAlignedSectionPlanesPlugin/Plane.js +167 -0
  34. package/src/plugins/FaceAlignedSectionPlanesPlugin/index.js +1 -0
  35. package/src/plugins/FastNavPlugin/FastNavPlugin.js +429 -0
  36. package/src/plugins/FastNavPlugin/index.js +1 -0
  37. package/src/plugins/GLTFLoaderPlugin/GLTFDefaultDataSource.js +139 -0
  38. package/src/plugins/GLTFLoaderPlugin/GLTFLoaderPlugin.js +421 -0
  39. package/src/plugins/GLTFLoaderPlugin/GLTFSceneModelLoader.js +669 -0
  40. package/src/plugins/GLTFLoaderPlugin/index.js +2 -0
  41. package/src/plugins/LASLoaderPlugin/LASDefaultDataSource.js +58 -0
  42. package/src/plugins/LASLoaderPlugin/LASLoaderPlugin.js +518 -0
  43. package/src/plugins/LASLoaderPlugin/index.js +1 -0
  44. package/src/plugins/LASLoaderPlugin/loadLASHeader.js +183 -0
  45. package/src/plugins/NavCubePlugin/CubeTextureCanvas.js +289 -0
  46. package/src/plugins/NavCubePlugin/NavCubePlugin.js +752 -0
  47. package/src/plugins/NavCubePlugin/index.js +1 -0
  48. package/src/plugins/OBJLoaderPlugin/OBJLoaderPlugin.js +145 -0
  49. package/src/plugins/OBJLoaderPlugin/OBJSceneGraphLoader.js +777 -0
  50. package/src/plugins/OBJLoaderPlugin/index.js +1 -0
  51. package/src/plugins/STLLoaderPlugin/STLDefaultDataSource.js +33 -0
  52. package/src/plugins/STLLoaderPlugin/STLLoaderPlugin.js +274 -0
  53. package/src/plugins/STLLoaderPlugin/STLSceneGraphLoader.js +313 -0
  54. package/src/plugins/STLLoaderPlugin/index.js +2 -0
  55. package/src/plugins/SectionPlanesPlugin/Control.js +1328 -0
  56. package/src/plugins/SectionPlanesPlugin/Overview.js +249 -0
  57. package/src/plugins/SectionPlanesPlugin/Plane.js +169 -0
  58. package/src/plugins/SectionPlanesPlugin/SectionPlanesPlugin.js +404 -0
  59. package/src/plugins/SectionPlanesPlugin/index.js +1 -0
  60. package/src/plugins/SkyboxesPlugin/SkyboxesPlugin.js +134 -0
  61. package/src/plugins/SkyboxesPlugin/index.js +1 -0
  62. package/src/plugins/StoreyViewsPlugin/IFCStoreyPlanObjectStates.js +77 -0
  63. package/src/plugins/StoreyViewsPlugin/Storey.js +61 -0
  64. package/src/plugins/StoreyViewsPlugin/StoreyMap.js +57 -0
  65. package/src/plugins/StoreyViewsPlugin/StoreyViewsPlugin.js +825 -0
  66. package/src/plugins/StoreyViewsPlugin/index.js +1 -0
  67. package/src/plugins/TreeViewPlugin/TreeViewNode.js +97 -0
  68. package/src/plugins/TreeViewPlugin/TreeViewPlugin.js +1424 -0
  69. package/src/plugins/TreeViewPlugin/index.js +1 -0
  70. package/src/plugins/ViewCullPlugin/ViewCullPlugin.js +295 -0
  71. package/src/plugins/ViewCullPlugin/index.js +1 -0
  72. package/src/plugins/WebIFCLoaderPlugin/WebIFCDefaultDataSource.js +58 -0
  73. package/src/plugins/WebIFCLoaderPlugin/WebIFCLoaderPlugin.js +942 -0
  74. package/src/plugins/WebIFCLoaderPlugin/index.js +1 -0
  75. package/src/plugins/XKTLoaderPlugin/XKTDefaultDataSource.js +95 -0
  76. package/src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js +1107 -0
  77. package/src/plugins/XKTLoaderPlugin/index.js +2 -0
  78. package/src/plugins/XKTLoaderPlugin/parsers/ParserV1.js +169 -0
  79. package/src/plugins/XKTLoaderPlugin/parsers/ParserV10.js +656 -0
  80. package/src/plugins/XKTLoaderPlugin/parsers/ParserV2.js +230 -0
  81. package/src/plugins/XKTLoaderPlugin/parsers/ParserV3.js +223 -0
  82. package/src/plugins/XKTLoaderPlugin/parsers/ParserV4.js +283 -0
  83. package/src/plugins/XKTLoaderPlugin/parsers/ParserV5.js +246 -0
  84. package/src/plugins/XKTLoaderPlugin/parsers/ParserV6.js +301 -0
  85. package/src/plugins/XKTLoaderPlugin/parsers/ParserV7.js +439 -0
  86. package/src/plugins/XKTLoaderPlugin/parsers/ParserV8.js +563 -0
  87. package/src/plugins/XKTLoaderPlugin/parsers/ParserV9.js +518 -0
  88. package/src/plugins/XKTLoaderPlugin/parsers/lib/pako.js +2 -0
  89. package/src/plugins/XML3DLoaderPlugin/XML3DLoaderPlugin.js +238 -0
  90. package/src/plugins/XML3DLoaderPlugin/XML3DSceneGraphLoader.js +1279 -0
  91. package/src/plugins/XML3DLoaderPlugin/index.js +1 -0
  92. package/src/plugins/XML3DLoaderPlugin/zipjs/.jshintrc +11 -0
  93. package/src/plugins/XML3DLoaderPlugin/zipjs/deflate.js +2060 -0
  94. package/src/plugins/XML3DLoaderPlugin/zipjs/inflate.js +2155 -0
  95. package/src/plugins/XML3DLoaderPlugin/zipjs/mime-types.js +1002 -0
  96. package/src/plugins/XML3DLoaderPlugin/zipjs/pako/codecs.js +64 -0
  97. package/src/plugins/XML3DLoaderPlugin/zipjs/z-worker.js +153 -0
  98. package/src/plugins/XML3DLoaderPlugin/zipjs/zip-ext.js +267 -0
  99. package/src/plugins/XML3DLoaderPlugin/zipjs/zip-fs.js +553 -0
  100. package/src/plugins/XML3DLoaderPlugin/zipjs/zip.js +991 -0
  101. package/src/plugins/XML3DLoaderPlugin/zipjs/zlib-asm/codecs.js +49 -0
  102. package/src/plugins/index.js +21 -0
  103. package/src/plugins/lib/culling/ObjectCullStates.js +208 -0
  104. package/src/plugins/lib/earcut.js +677 -0
  105. package/src/plugins/lib/html/Dot.js +145 -0
  106. package/src/plugins/lib/html/Label.js +156 -0
  107. package/src/plugins/lib/html/Wire.js +191 -0
  108. package/src/viewer/Configs.js +79 -0
  109. package/src/viewer/Plugin.js +224 -0
  110. package/src/viewer/Viewer.js +535 -0
  111. package/src/viewer/index.js +5 -0
  112. package/src/viewer/localization/LocaleService.js +475 -0
  113. package/src/viewer/metadata/IFCObjectDefaultColors.js +162 -0
  114. package/src/viewer/metadata/IFCObjectDefaults.js +17 -0
  115. package/src/viewer/metadata/MetaModel.js +389 -0
  116. package/src/viewer/metadata/MetaObject.js +218 -0
  117. package/src/viewer/metadata/MetaScene.js +336 -0
  118. package/src/viewer/metadata/Property.js +55 -0
  119. package/src/viewer/metadata/PropertySet.js +77 -0
  120. package/src/viewer/scene/Bitmap/Bitmap.js +470 -0
  121. package/src/viewer/scene/Bitmap/index.js +1 -0
  122. package/src/viewer/scene/CameraControl/CameraControl.js +1737 -0
  123. package/src/viewer/scene/CameraControl/lib/CameraUpdater.js +312 -0
  124. package/src/viewer/scene/CameraControl/lib/controllers/PanController.js +112 -0
  125. package/src/viewer/scene/CameraControl/lib/controllers/PickController.js +264 -0
  126. package/src/viewer/scene/CameraControl/lib/controllers/PivotController.js +384 -0
  127. package/src/viewer/scene/CameraControl/lib/handlers/KeyboardAxisViewHandler.js +122 -0
  128. package/src/viewer/scene/CameraControl/lib/handlers/KeyboardPanRotateDollyHandler.js +183 -0
  129. package/src/viewer/scene/CameraControl/lib/handlers/MouseMiscHandler.js +68 -0
  130. package/src/viewer/scene/CameraControl/lib/handlers/MousePanRotateDollyHandler.js +345 -0
  131. package/src/viewer/scene/CameraControl/lib/handlers/MousePickHandler.js +372 -0
  132. package/src/viewer/scene/CameraControl/lib/handlers/TouchPanRotateAndDollyHandler.js +269 -0
  133. package/src/viewer/scene/CameraControl/lib/handlers/TouchPickHandler.js +235 -0
  134. package/src/viewer/scene/Component.js +907 -0
  135. package/src/viewer/scene/Entity.js +502 -0
  136. package/src/viewer/scene/ImagePlane/ImagePlane.js +570 -0
  137. package/src/viewer/scene/ImagePlane/index.js +1 -0
  138. package/src/viewer/scene/LineSet/LineSet.js +164 -0
  139. package/src/viewer/scene/LineSet/index.js +1 -0
  140. package/src/viewer/scene/camera/Camera.js +912 -0
  141. package/src/viewer/scene/camera/CameraFlightAnimation.js +669 -0
  142. package/src/viewer/scene/camera/CameraPath.js +194 -0
  143. package/src/viewer/scene/camera/CameraPathAnimation.js +326 -0
  144. package/src/viewer/scene/camera/CustomProjection.js +149 -0
  145. package/src/viewer/scene/camera/Frustum.js +316 -0
  146. package/src/viewer/scene/camera/Ortho.js +286 -0
  147. package/src/viewer/scene/camera/Perspective.js +304 -0
  148. package/src/viewer/scene/camera/index.js +2 -0
  149. package/src/viewer/scene/canvas/Canvas.js +492 -0
  150. package/src/viewer/scene/canvas/Spinner.js +323 -0
  151. package/src/viewer/scene/constants/constants.js +371 -0
  152. package/src/viewer/scene/core.js +233 -0
  153. package/src/viewer/scene/geometry/Geometry.js +33 -0
  154. package/src/viewer/scene/geometry/ReadableGeometry.js +682 -0
  155. package/src/viewer/scene/geometry/VBOGeometry.js +319 -0
  156. package/src/viewer/scene/geometry/builders/buildBoxGeometry.js +238 -0
  157. package/src/viewer/scene/geometry/builders/buildBoxLinesGeometry.js +106 -0
  158. package/src/viewer/scene/geometry/builders/buildCylinderGeometry.js +271 -0
  159. package/src/viewer/scene/geometry/builders/buildGridGeometry.js +102 -0
  160. package/src/viewer/scene/geometry/builders/buildPlaneGeometry.js +168 -0
  161. package/src/viewer/scene/geometry/builders/buildSphereGeometry.js +161 -0
  162. package/src/viewer/scene/geometry/builders/buildTorusGeometry.js +172 -0
  163. package/src/viewer/scene/geometry/builders/buildVectorTextGeometry.js +1721 -0
  164. package/src/viewer/scene/geometry/builders/index.js +8 -0
  165. package/src/viewer/scene/geometry/index.js +4 -0
  166. package/src/viewer/scene/geometry/loaders/index.js +2 -0
  167. package/src/viewer/scene/geometry/loaders/load3DSGeometry.js +103 -0
  168. package/src/viewer/scene/geometry/loaders/loadOBJGeometry.js +130 -0
  169. package/src/viewer/scene/index.js +23 -0
  170. package/src/viewer/scene/input/Input.js +1325 -0
  171. package/src/viewer/scene/libs/k3d.js +1032 -0
  172. package/src/viewer/scene/lights/AmbientLight.js +175 -0
  173. package/src/viewer/scene/lights/CubeTexture.js +156 -0
  174. package/src/viewer/scene/lights/DirLight.js +314 -0
  175. package/src/viewer/scene/lights/Light.js +29 -0
  176. package/src/viewer/scene/lights/LightMap.js +77 -0
  177. package/src/viewer/scene/lights/PointLight.js +395 -0
  178. package/src/viewer/scene/lights/ReflectionMap.js +79 -0
  179. package/src/viewer/scene/lights/Shadow.js +138 -0
  180. package/src/viewer/scene/lights/index.js +5 -0
  181. package/src/viewer/scene/lod/LOD.js +162 -0
  182. package/src/viewer/scene/lod/LODCullingManager.js +83 -0
  183. package/src/viewer/scene/lod/LODState.js +125 -0
  184. package/src/viewer/scene/lod/index.js +1 -0
  185. package/src/viewer/scene/marker/Marker.js +383 -0
  186. package/src/viewer/scene/marker/SpriteMarker.js +356 -0
  187. package/src/viewer/scene/marker/index.js +2 -0
  188. package/src/viewer/scene/materials/EdgeMaterial.js +359 -0
  189. package/src/viewer/scene/materials/EmphasisMaterial.js +613 -0
  190. package/src/viewer/scene/materials/Fresnel.js +222 -0
  191. package/src/viewer/scene/materials/LambertMaterial.js +378 -0
  192. package/src/viewer/scene/materials/LinesMaterial.js +169 -0
  193. package/src/viewer/scene/materials/Material.js +39 -0
  194. package/src/viewer/scene/materials/MetallicMaterial.js +820 -0
  195. package/src/viewer/scene/materials/PhongMaterial.js +860 -0
  196. package/src/viewer/scene/materials/PointsMaterial.js +409 -0
  197. package/src/viewer/scene/materials/SpecularMaterial.js +807 -0
  198. package/src/viewer/scene/materials/Texture.js +513 -0
  199. package/src/viewer/scene/materials/index.js +8 -0
  200. package/src/viewer/scene/math/Frustum.js +118 -0
  201. package/src/viewer/scene/math/buildEdgeIndices.js +162 -0
  202. package/src/viewer/scene/math/geometryCompressionUtils.js +365 -0
  203. package/src/viewer/scene/math/index.js +3 -0
  204. package/src/viewer/scene/math/math.js +5363 -0
  205. package/src/viewer/scene/math/rtcCoords.js +139 -0
  206. package/src/viewer/scene/mementos/CameraMemento.js +200 -0
  207. package/src/viewer/scene/mementos/ModelMemento.js +263 -0
  208. package/src/viewer/scene/mementos/ObjectsMemento.js +259 -0
  209. package/src/viewer/scene/mementos/index.js +3 -0
  210. package/src/viewer/scene/mesh/Mesh.js +2202 -0
  211. package/src/viewer/scene/mesh/draw/DrawRenderer.js +986 -0
  212. package/src/viewer/scene/mesh/draw/DrawShaderSource.js +1570 -0
  213. package/src/viewer/scene/mesh/emphasis/EmphasisEdgesRenderer.js +249 -0
  214. package/src/viewer/scene/mesh/emphasis/EmphasisEdgesShaderSource.js +158 -0
  215. package/src/viewer/scene/mesh/emphasis/EmphasisFillRenderer.js +276 -0
  216. package/src/viewer/scene/mesh/emphasis/EmphasisFillShaderSource.js +261 -0
  217. package/src/viewer/scene/mesh/index.js +1 -0
  218. package/src/viewer/scene/mesh/occlusion/OcclusionRenderer.js +207 -0
  219. package/src/viewer/scene/mesh/occlusion/OcclusionShaderSource.js +156 -0
  220. package/src/viewer/scene/mesh/pick/PickMeshRenderer.js +210 -0
  221. package/src/viewer/scene/mesh/pick/PickMeshShaderSource.js +142 -0
  222. package/src/viewer/scene/mesh/pick/PickTriangleRenderer.js +186 -0
  223. package/src/viewer/scene/mesh/pick/PickTriangleShaderSource.js +116 -0
  224. package/src/viewer/scene/mesh/shadow/ShadowRenderer.js +214 -0
  225. package/src/viewer/scene/mesh/shadow/ShadowShaderSource.js +98 -0
  226. package/src/viewer/scene/metriqs/Metriqs.js +259 -0
  227. package/src/viewer/scene/model/ENTITY_FLAGS.js +21 -0
  228. package/src/viewer/scene/model/PerformanceModel.js +26 -0
  229. package/src/viewer/scene/model/RENDER_PASSES.js +34 -0
  230. package/src/viewer/scene/model/SceneModel.js +3817 -0
  231. package/src/viewer/scene/model/SceneModelEntity.js +478 -0
  232. package/src/viewer/scene/model/SceneModelMesh.js +160 -0
  233. package/src/viewer/scene/model/SceneModelTexture.js +17 -0
  234. package/src/viewer/scene/model/SceneModelTextureSet.js +17 -0
  235. package/src/viewer/scene/model/VBOSceneModel.js +26 -0
  236. package/src/viewer/scene/model/compression.js +227 -0
  237. package/src/viewer/scene/model/dtx/triangles/BindableDataTexture.js +31 -0
  238. package/src/viewer/scene/model/dtx/triangles/DataTextureGenerator.js +631 -0
  239. package/src/viewer/scene/model/dtx/triangles/DataTextureState.js +288 -0
  240. package/src/viewer/scene/model/dtx/triangles/TrianglesDataTextureBuffer.js +31 -0
  241. package/src/viewer/scene/model/dtx/triangles/TrianglesDataTextureLayer.js +1329 -0
  242. package/src/viewer/scene/model/dtx/triangles/TrianglesDataTextureRenderers.js +278 -0
  243. package/src/viewer/scene/model/dtx/triangles/calculateUniquePositions.js +126 -0
  244. package/src/viewer/scene/model/dtx/triangles/dataTextureRamStats.js +54 -0
  245. package/src/viewer/scene/model/dtx/triangles/rebucketPositions.js +347 -0
  246. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTextureColorRenderer.js +633 -0
  247. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTextureDepthRenderer.js +475 -0
  248. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTextureEdgesColorRenderer.js +426 -0
  249. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTextureEdgesRenderer.js +430 -0
  250. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTextureNormalsRenderer.js +341 -0
  251. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTextureOcclusionRenderer.js +442 -0
  252. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTexturePickDepthRenderer.js +451 -0
  253. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTexturePickMeshRenderer.js +436 -0
  254. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTexturePickNormalsFlatRenderer.js +502 -0
  255. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTexturePickNormalsRenderer.js +430 -0
  256. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTextureSilhouetteRenderer.js +469 -0
  257. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTextureSnapDepthBufInitRenderer.js +451 -0
  258. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTextureSnapDepthRenderer.js +424 -0
  259. package/src/viewer/scene/model/index.js +3 -0
  260. package/src/viewer/scene/model/vbo/ScratchMemory.js +63 -0
  261. package/src/viewer/scene/model/vbo/VBOSceneModelRenderers.js +805 -0
  262. package/src/viewer/scene/model/vbo/float16.js +760 -0
  263. package/src/viewer/scene/model/vbo/linesBatching/LinesBatchingBuffer.js +21 -0
  264. package/src/viewer/scene/model/vbo/linesBatching/LinesBatchingLayer.js +744 -0
  265. package/src/viewer/scene/model/vbo/linesBatching/LinesBatchingRenderers.js +71 -0
  266. package/src/viewer/scene/model/vbo/linesBatching/renderers/LinesBatchingColorRenderer.js +116 -0
  267. package/src/viewer/scene/model/vbo/linesBatching/renderers/LinesBatchingSilhouetteRenderer.js +126 -0
  268. package/src/viewer/scene/model/vbo/linesInstancing/LinesInstancingLayer.js +653 -0
  269. package/src/viewer/scene/model/vbo/linesInstancing/LinesInstancingRenderers.js +71 -0
  270. package/src/viewer/scene/model/vbo/linesInstancing/renderers/LinesInstancingColorRenderer.js +150 -0
  271. package/src/viewer/scene/model/vbo/linesInstancing/renderers/LinesInstancingSilhouetteRenderer.js +128 -0
  272. package/src/viewer/scene/model/vbo/pointsBatching/PointsBatchingBuffer.js +22 -0
  273. package/src/viewer/scene/model/vbo/pointsBatching/PointsBatchingLayer.js +753 -0
  274. package/src/viewer/scene/model/vbo/pointsBatching/PointsBatchingRenderers.js +116 -0
  275. package/src/viewer/scene/model/vbo/pointsBatching/renderers/PointsBatchingColorRenderer.js +167 -0
  276. package/src/viewer/scene/model/vbo/pointsBatching/renderers/PointsBatchingOcclusionRenderer.js +135 -0
  277. package/src/viewer/scene/model/vbo/pointsBatching/renderers/PointsBatchingPickDepthRenderer.js +154 -0
  278. package/src/viewer/scene/model/vbo/pointsBatching/renderers/PointsBatchingPickMeshRenderer.js +146 -0
  279. package/src/viewer/scene/model/vbo/pointsBatching/renderers/PointsBatchingShadowRenderer.js +108 -0
  280. package/src/viewer/scene/model/vbo/pointsBatching/renderers/PointsBatchingSilhouetteRenderer.js +147 -0
  281. package/src/viewer/scene/model/vbo/pointsInstancing/PointsInstancingLayer.js +684 -0
  282. package/src/viewer/scene/model/vbo/pointsInstancing/PointsInstancingRenderers.js +146 -0
  283. package/src/viewer/scene/model/vbo/pointsInstancing/renderers/PointsInstancingColorRenderer.js +174 -0
  284. package/src/viewer/scene/model/vbo/pointsInstancing/renderers/PointsInstancingDepthRenderer.js +156 -0
  285. package/src/viewer/scene/model/vbo/pointsInstancing/renderers/PointsInstancingOcclusionRenderer.js +151 -0
  286. package/src/viewer/scene/model/vbo/pointsInstancing/renderers/PointsInstancingPickDepthRenderer.js +167 -0
  287. package/src/viewer/scene/model/vbo/pointsInstancing/renderers/PointsInstancingPickMeshRenderer.js +151 -0
  288. package/src/viewer/scene/model/vbo/pointsInstancing/renderers/PointsInstancingShadowRenderer.js +121 -0
  289. package/src/viewer/scene/model/vbo/pointsInstancing/renderers/PointsInstancingSilhouetteRenderer.js +156 -0
  290. package/src/viewer/scene/model/vbo/snapBatching/SnapBatchingDepthBufInitRenderer.js +351 -0
  291. package/src/viewer/scene/model/vbo/snapBatching/SnapBatchingDepthRenderer.js +365 -0
  292. package/src/viewer/scene/model/vbo/snapBatching/SnapBatchingRenderers.js +71 -0
  293. package/src/viewer/scene/model/vbo/snapInstancing/SnapInstancingDepthBufInitRenderer.js +381 -0
  294. package/src/viewer/scene/model/vbo/snapInstancing/SnapInstancingDepthRenderer.js +374 -0
  295. package/src/viewer/scene/model/vbo/snapInstancing/SnapInstancingRenderers.js +71 -0
  296. package/src/viewer/scene/model/vbo/trianglesBatching/TrianglesBatchingBuffer.js +26 -0
  297. package/src/viewer/scene/model/vbo/trianglesBatching/TrianglesBatchingLayer.js +1322 -0
  298. package/src/viewer/scene/model/vbo/trianglesBatching/TrianglesBatchingRenderers.js +322 -0
  299. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingColorRenderer.js +240 -0
  300. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingColorTextureRenderer.js +271 -0
  301. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingDepthRenderer.js +127 -0
  302. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingEdgesColorRenderer.js +129 -0
  303. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingEdgesRenderer.js +134 -0
  304. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingFlatColorRenderer.js +237 -0
  305. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingNormalsRenderer.js +139 -0
  306. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingOcclusionRenderer.js +127 -0
  307. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingPBRRenderer.js +563 -0
  308. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingPickDepthRenderer.js +143 -0
  309. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingPickMeshRenderer.js +130 -0
  310. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingPickNormalsFlatRenderer.js +119 -0
  311. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingPickNormalsRenderer.js +129 -0
  312. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingShadowRenderer.js +108 -0
  313. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingSilhouetteRenderer.js +137 -0
  314. package/src/viewer/scene/model/vbo/trianglesInstancing/TrianglesInstancingLayer.js +1167 -0
  315. package/src/viewer/scene/model/vbo/trianglesInstancing/TrianglesInstancingRenderers.js +322 -0
  316. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingColorRenderer.js +253 -0
  317. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingColorTextureRenderer.js +278 -0
  318. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingDepthRenderer.js +125 -0
  319. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingEdgesColorRenderer.js +131 -0
  320. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingEdgesRenderer.js +134 -0
  321. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingFlatColorRenderer.js +244 -0
  322. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingFlatNormalsRenderer.js +130 -0
  323. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingNormalsRenderer.js +140 -0
  324. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingOcclusionRenderer.js +130 -0
  325. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingPBRRenderer.js +563 -0
  326. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingPickDepthRenderer.js +148 -0
  327. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingPickMeshRenderer.js +135 -0
  328. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingPickNormalsFlatRenderer.js +130 -0
  329. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingPickNormalsRenderer.js +144 -0
  330. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingShadowRenderer.js +113 -0
  331. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingSilhouetteRenderer.js +141 -0
  332. package/src/viewer/scene/nodes/Node.js +1383 -0
  333. package/src/viewer/scene/nodes/index.js +1 -0
  334. package/src/viewer/scene/paths/CubicBezierCurve.js +194 -0
  335. package/src/viewer/scene/paths/Curve.js +183 -0
  336. package/src/viewer/scene/paths/Path.js +239 -0
  337. package/src/viewer/scene/paths/QuadraticBezierCurve.js +161 -0
  338. package/src/viewer/scene/paths/SplineCurve.js +133 -0
  339. package/src/viewer/scene/paths/index.js +5 -0
  340. package/src/viewer/scene/postfx/SAO.js +543 -0
  341. package/src/viewer/scene/scene/Scene.js +2627 -0
  342. package/src/viewer/scene/sectionPlane/SectionPlane.js +194 -0
  343. package/src/viewer/scene/sectionPlane/index.js +1 -0
  344. package/src/viewer/scene/skybox/Skybox.js +123 -0
  345. package/src/viewer/scene/skybox/index.js +1 -0
  346. package/src/viewer/scene/stats.js +44 -0
  347. package/src/viewer/scene/utils/Cache.js +29 -0
  348. package/src/viewer/scene/utils/FileLoader.js +160 -0
  349. package/src/viewer/scene/utils/Loader.js +55 -0
  350. package/src/viewer/scene/utils/LoadingManager.js +86 -0
  351. package/src/viewer/scene/utils/Map.js +45 -0
  352. package/src/viewer/scene/utils/Queue.js +56 -0
  353. package/src/viewer/scene/utils/WorkerPool.js +73 -0
  354. package/src/viewer/scene/utils/index.js +6 -0
  355. package/src/viewer/scene/utils/textureTranscoders/KTX2TextureTranscoder/KTX2TextureTranscoder.js +650 -0
  356. package/src/viewer/scene/utils/textureTranscoders/KTX2TextureTranscoder/index.js +1 -0
  357. package/src/viewer/scene/utils/textureTranscoders/TextureTranscoder.js +31 -0
  358. package/src/viewer/scene/utils/textureTranscoders/index.js +2 -0
  359. package/src/viewer/scene/utils.js +452 -0
  360. package/src/viewer/scene/vfc/VFC.js +82 -0
  361. package/src/viewer/scene/vfc/VFCManager.js +54 -0
  362. package/src/viewer/scene/vfc/VFCState.js +391 -0
  363. package/src/viewer/scene/vfc/cluster-helper.js +134 -0
  364. package/src/viewer/scene/vfc/index.js +1 -0
  365. package/src/viewer/scene/vfc/rbush3d.js +848 -0
  366. package/src/viewer/scene/vfc/xeokit-cluster.js +418 -0
  367. package/src/viewer/scene/viewport/Viewport.js +212 -0
  368. package/src/viewer/scene/webgl/ArrayBuf.js +121 -0
  369. package/src/viewer/scene/webgl/Attribute.js +23 -0
  370. package/src/viewer/scene/webgl/Drawable.js +270 -0
  371. package/src/viewer/scene/webgl/FrameContext.js +313 -0
  372. package/src/viewer/scene/webgl/PickResult.js +339 -0
  373. package/src/viewer/scene/webgl/Pickable.js +69 -0
  374. package/src/viewer/scene/webgl/Program.js +181 -0
  375. package/src/viewer/scene/webgl/RenderBuffer.js +350 -0
  376. package/src/viewer/scene/webgl/RenderBufferManager.js +34 -0
  377. package/src/viewer/scene/webgl/RenderFlags.js +203 -0
  378. package/src/viewer/scene/webgl/RenderState.js +40 -0
  379. package/src/viewer/scene/webgl/Renderer.js +1654 -0
  380. package/src/viewer/scene/webgl/Sampler.js +18 -0
  381. package/src/viewer/scene/webgl/Shader.js +49 -0
  382. package/src/viewer/scene/webgl/Texture2D.js +442 -0
  383. package/src/viewer/scene/webgl/convertConstant.js +244 -0
  384. package/src/viewer/scene/webgl/getExtension.js +32 -0
  385. package/src/viewer/scene/webgl/occlusion/OcclusionLayer.js +214 -0
  386. package/src/viewer/scene/webgl/occlusion/OcclusionTester.js +426 -0
  387. package/src/viewer/scene/webgl/sao/SAODepthLimitedBlurRenderer.js +324 -0
  388. package/src/viewer/scene/webgl/sao/SAOOcclusionRenderer.js +376 -0
  389. package/src/viewer/scene/webgl/webglEnums.js +61 -0
  390. package/src/viewer/scene/webglInfo.js +47 -0
@@ -0,0 +1,313 @@
1
+ import {math} from "../math/math.js";
2
+ import {createRTCViewMat} from "../math/rtcCoords.js";
3
+
4
+ /**
5
+ * @desc Provides rendering context to {@link Drawable"}s as xeokit renders them for a frame.
6
+ *
7
+ * Also creates RTC viewing and picking matrices, caching and reusing matrices within each frame.
8
+ *
9
+ * @private
10
+ */
11
+ class FrameContext {
12
+
13
+ constructor(scene) {
14
+
15
+ this._scene = scene;
16
+
17
+ this._matPool = [];
18
+ this._matPoolNextFreeIndex = 0;
19
+
20
+ this._rtcViewMats = {};
21
+ this._rtcPickViewMats = {};
22
+
23
+ this.reset();
24
+ }
25
+
26
+ /**
27
+ * Called by the renderer before each frame.
28
+ * @private
29
+ */
30
+ reset() {
31
+
32
+ this._matPoolNextFreeIndex = 0;
33
+ this._rtcViewMats = {};
34
+ this._rtcPickViewMats = {};
35
+
36
+ /**
37
+ * The WebGL rendering context.
38
+ * @type {WebGLRenderingContext}
39
+ */
40
+ this.gl = this._scene.canvas.gl;
41
+
42
+ /**
43
+ * ID of the last {@link WebGLProgram} that was bound during the current frame.
44
+ * @property lastProgramId
45
+ * @type {Number}
46
+ */
47
+ this.lastProgramId = null;
48
+
49
+ /**
50
+ * Whether to render a physically-based representation for triangle surfaces.
51
+ *
52
+ * When ````false````, we'll render them with a fast vertex-shaded Gouraud-shaded representation, which
53
+ * is great for zillions of objects.
54
+ *
55
+ * When ````true````, we'll render them at a better visual quality, using smooth, per-fragment shading
56
+ * and a more realistic lighting model.
57
+ *
58
+ * @property quality
59
+ * @default false
60
+ * @type {Boolean}
61
+ */
62
+ this.pbrEnabled = false;
63
+
64
+ /**
65
+ * Whether to render color textures for triangle surfaces.
66
+ *
67
+ * @property quality
68
+ * @default false
69
+ * @type {Boolean}
70
+ */
71
+ this.colorTextureEnabled = false;
72
+
73
+ /**
74
+ * Whether SAO is currently enabled during the current frame.
75
+ * @property withSAO
76
+ * @default false
77
+ * @type {Boolean}
78
+ */
79
+ this.withSAO = false;
80
+
81
+ /**
82
+ * Whether backfaces are currently enabled during the current frame.
83
+ * @property backfaces
84
+ * @default false
85
+ * @type {Boolean}
86
+ */
87
+ this.backfaces = false;
88
+
89
+ /**
90
+ * The vertex winding order for what we currently consider to be a backface during current
91
+ * frame: true == "cw", false == "ccw".
92
+ * @property frontFace
93
+ * @default true
94
+ * @type {Boolean}
95
+ */
96
+ this.frontface = true;
97
+
98
+ /**
99
+ * The next available texture unit to bind a {@link Texture} to.
100
+ * @defauilt 0
101
+ * @property textureUnit
102
+ * @type {number}
103
+ */
104
+ this.textureUnit = 0;
105
+
106
+ /**
107
+ * Performance statistic that counts how many times the renderer has called ````gl.drawElements()```` has been
108
+ * called so far within the current frame.
109
+ * @default 0
110
+ * @property drawElements
111
+ * @type {number}
112
+ */
113
+ this.drawElements = 0;
114
+
115
+ /**
116
+ * Performance statistic that counts how many times ````gl.drawArrays()```` has been called so far within
117
+ * the current frame.
118
+ * @default 0
119
+ * @property drawArrays
120
+ * @type {number}
121
+ */
122
+ this.drawArrays = 0;
123
+
124
+ /**
125
+ * Performance statistic that counts how many times ````gl.useProgram()```` has been called so far within
126
+ * the current frame.
127
+ * @default 0
128
+ * @property useProgram
129
+ * @type {number}
130
+ */
131
+ this.useProgram = 0;
132
+
133
+ /**
134
+ * Statistic that counts how many times ````gl.bindTexture()```` has been called so far within the current frame.
135
+ * @default 0
136
+ * @property bindTexture
137
+ * @type {number}
138
+ */
139
+ this.bindTexture = 0;
140
+
141
+ /**
142
+ * Counts how many times the renderer has called ````gl.bindArray()```` so far within the current frame.
143
+ * @defaulr 0
144
+ * @property bindArray
145
+ * @type {number}
146
+ */
147
+ this.bindArray = 0;
148
+
149
+ /**
150
+ * Indicates which pass the renderer is currently rendering.
151
+ *
152
+ * See {@link Scene/passes:property"}}Scene#passes{{/crossLink}}, which configures how many passes we render
153
+ * per frame, which typically set to ````2```` when rendering a stereo view.
154
+ *
155
+ * @property pass
156
+ * @type {number}
157
+ */
158
+ this.pass = 0;
159
+
160
+ /**
161
+ * The 4x4 viewing transform matrix the renderer is currently using when rendering castsShadows.
162
+ *
163
+ * This sets the viewpoint to look from the point of view of each {@link DirLight}
164
+ * or {@link PointLight} that casts a shadow.
165
+ *
166
+ * @property shadowViewMatrix
167
+ * @type {Number[]}
168
+ */
169
+ this.shadowViewMatrix = null;
170
+
171
+ /**
172
+ * The 4x4 viewing projection matrix the renderer is currently using when rendering shadows.
173
+ *
174
+ * @property shadowProjMatrix
175
+ * @type {Number[]}
176
+ */
177
+ this.shadowProjMatrix = null;
178
+
179
+ /**
180
+ * The 4x4 viewing transform matrix the renderer is currently using when rendering a ray-pick.
181
+ *
182
+ * This sets the viewpoint to look along the ray given to {@link Scene/pick:method"}}Scene#pick(){{/crossLink}}
183
+ * when picking with a ray.
184
+ *
185
+ * @property pickViewMatrix
186
+ * @type {Number[]}
187
+ */
188
+ this.pickViewMatrix = null;
189
+
190
+ /**
191
+ * The 4x4 orthographic projection transform matrix the renderer is currently using when rendering a ray-pick.
192
+ *
193
+ * @property pickProjMatrix
194
+ * @type {Number[]}
195
+ */
196
+ this.pickProjMatrix = null;
197
+
198
+ /**
199
+ * Distance to the near clipping plane when rendering depth fragments for GPU-accelerated 3D picking.
200
+ *
201
+ * @property pickZNear
202
+ * @type {Number|*}
203
+ */
204
+ this.pickZNear = 0.01;
205
+
206
+ /**
207
+ * Distance to the far clipping plane when rendering depth fragments for GPU-accelerated 3D picking.
208
+ *
209
+ * @property pickZFar
210
+ * @type {Number|*}
211
+ */
212
+ this.pickZFar = 5000;
213
+
214
+ /**
215
+ * Whether or not the renderer is currently picking invisible objects.
216
+ *
217
+ * @property pickInvisible
218
+ * @type {Number}
219
+ */
220
+ this.pickInvisible = false;
221
+
222
+ /**
223
+ * Used to draw only requested elements / indices.
224
+ *
225
+ * @property pickElementsCount
226
+ * @type {Number}
227
+ */
228
+ this.pickElementsCount = null;
229
+
230
+ /**
231
+ * Used to draw only requested elements / indices.
232
+ *
233
+ * @property pickElementsOffset
234
+ * @type {Number}
235
+ */
236
+ this.pickElementsOffset = null;
237
+
238
+ /** The current line width.
239
+ *
240
+ * @property lineWidth
241
+ * @type Number
242
+ */
243
+ this.lineWidth = 1;
244
+
245
+ /**
246
+ * Collects info from SceneModel.drawSnapInitDepthBuf and SceneModel.drawSnapDepths,
247
+ * which is then used in Renderer to determine snap-picking results.
248
+ *
249
+ * @type {{}}
250
+ */
251
+ this.snapPickLayerParams = {};
252
+
253
+ /**
254
+ * Collects info from SceneModel.drawSnapInitDepthBuf and SceneModel.drawSnapDepths,
255
+ * which is then used in Renderer to determine snap-picking results.
256
+ * @type {number}
257
+ */
258
+ this.snapPickLayerNumber = 0;
259
+
260
+ /**
261
+ * Collects info from SceneModel.drawSnapInitDepthBuf and SceneModel.drawSnapDepths,
262
+ * which is then used in Renderer to determine snap-picking results.
263
+ * @type {Number[]}
264
+ */
265
+ this.snapPickCoordinateScale = math.vec3();
266
+
267
+ /**
268
+ * Collects info from SceneModel.drawSnapInitDepthBuf and SceneModel.drawSnapDepths,
269
+ * which is then used in Renderer to determine snap-picking results.
270
+ * @type {Number[]}
271
+ */
272
+ this.snapPickOrigin = math.vec3();
273
+ }
274
+
275
+ /**
276
+ * Get View matrix for the given RTC center.
277
+ */
278
+ getRTCViewMatrix(originHash, origin) {
279
+ let rtcViewMat = this._rtcViewMats[originHash];
280
+ if (!rtcViewMat) {
281
+ rtcViewMat = this._getNewMat();
282
+ createRTCViewMat(this._scene.camera.viewMatrix, origin, rtcViewMat);
283
+ this._rtcViewMats[originHash] = rtcViewMat;
284
+ }
285
+ return rtcViewMat;
286
+ }
287
+
288
+ /**
289
+ * Get picking View RTC matrix for the given RTC center.
290
+ */
291
+ getRTCPickViewMatrix(originHash, origin) {
292
+ let rtcPickViewMat = this._rtcPickViewMats[originHash];
293
+ if (!rtcPickViewMat) {
294
+ rtcPickViewMat = this._getNewMat();
295
+ const pickViewMat = this.pickViewMatrix || this._scene.camera.viewMatrix;
296
+ createRTCViewMat(pickViewMat, origin, rtcPickViewMat);
297
+ this._rtcPickViewMats[originHash] = rtcPickViewMat;
298
+ }
299
+ return rtcPickViewMat;
300
+ }
301
+
302
+ _getNewMat() {
303
+ let mat = this._matPool[this._matPoolNextFreeIndex];
304
+ if (!mat) {
305
+ mat = math.mat4();
306
+ this._matPool[this._matPoolNextFreeIndex] = mat;
307
+ }
308
+ this._matPoolNextFreeIndex++;
309
+ return mat;
310
+ }
311
+ }
312
+
313
+ export {FrameContext};
@@ -0,0 +1,339 @@
1
+ /**
2
+ * @desc Pick result returned by {@link Scene#pick}.
3
+ *
4
+ */
5
+ class PickResult {
6
+
7
+ /**
8
+ * @private
9
+ */
10
+ constructor() {
11
+
12
+ /**
13
+ * Picked entity.
14
+ * Null when no entity was picked.
15
+ * @property entity
16
+ * @type {Entity|*}
17
+ */
18
+ this.entity = null;
19
+
20
+ /**
21
+ * Type of primitive that was picked - usually "triangle".
22
+ * Null when no primitive was picked.
23
+ * @property primitive
24
+ * @type {String}
25
+ */
26
+ this.primitive = null;
27
+
28
+ /**
29
+ * Index of primitive that was picked.
30
+ * -1 when no entity was picked.
31
+ * @property primIndex
32
+ * @type {number}
33
+ */
34
+ this.primIndex = -1;
35
+
36
+ /**
37
+ * True when the picked surface position is full precision.
38
+ * When false, the picked surface position should be regarded as approximate.
39
+ * Full-precision surface picking is performed with the {@link Scene#pick} method's ````pickSurfacePrecision```` option.
40
+ * @property pickSurfacePrecision
41
+ * @type {Boolean}
42
+ */
43
+ this.pickSurfacePrecision = false;
44
+
45
+ /**
46
+ * True when picked from touch input, else false when from mouse input.
47
+ * @type {boolean}
48
+ */
49
+ this.touchInput = false;
50
+
51
+ /**
52
+ * True when snapped to the nearest vertex position.
53
+ * @type {boolean}
54
+ */
55
+ this.snappedToVertex = false;
56
+
57
+ /**
58
+ * True when snapped to the nearest edge.
59
+ * @type {boolean}
60
+ */
61
+ this.snappedToEdge = false;
62
+
63
+ this._canvasPos = new Int16Array([0, 0]);
64
+ this._origin = new Float64Array([0, 0, 0]);
65
+ this._direction = new Float64Array([0, 0, 0]);
66
+ this._indices = new Int32Array(3);
67
+ this._localPos = new Float64Array([0, 0, 0]);
68
+ this._worldPos = new Float64Array([0, 0, 0]);
69
+ this._viewPos = new Float64Array([0, 0, 0]);
70
+ this._bary = new Float64Array([0, 0, 0]);
71
+ this._worldNormal = new Float64Array([0, 0, 0]);
72
+ this._uv = new Float64Array([0, 0]);
73
+
74
+ this.reset();
75
+ }
76
+
77
+ /**
78
+ * Canvas coordinates when picking with a 2D pointer.
79
+ * @property canvasPos
80
+ * @type {Number[]}
81
+ */
82
+ get canvasPos() {
83
+ return this._gotCanvasPos ? this._canvasPos : null;
84
+ }
85
+
86
+ /**
87
+ * @private
88
+ * @param value
89
+ */
90
+ set canvasPos(value) {
91
+ if (value) {
92
+ this._canvasPos[0] = value[0];
93
+ this._canvasPos[1] = value[1];
94
+ this._gotCanvasPos = true;
95
+ } else {
96
+ this._gotCanvasPos = false;
97
+ }
98
+ }
99
+
100
+ /**
101
+ * World-space 3D ray origin when raypicked.
102
+ * @property origin
103
+ * @type {Number[]}
104
+ */
105
+ get origin() {
106
+ return this._gotOrigin ? this._origin : null;
107
+ }
108
+
109
+ /**
110
+ * @private
111
+ * @param value
112
+ */
113
+ set origin(value) {
114
+ if (value) {
115
+ this._origin[0] = value[0];
116
+ this._origin[1] = value[1];
117
+ this._origin[2] = value[2];
118
+ this._gotOrigin = true;
119
+ } else {
120
+ this._gotOrigin = false;
121
+ }
122
+ }
123
+
124
+ /**
125
+ * World-space 3D ray direction when raypicked.
126
+ * @property direction
127
+ * @type {Number[]}
128
+ */
129
+ get direction() {
130
+ return this._gotDirection ? this._direction : null;
131
+ }
132
+
133
+ /**
134
+ * @private
135
+ * @param value
136
+ */
137
+ set direction(value) {
138
+ if (value) {
139
+ this._direction[0] = value[0];
140
+ this._direction[1] = value[1];
141
+ this._direction[2] = value[2];
142
+ this._gotDirection = true;
143
+ } else {
144
+ this._gotDirection = false;
145
+ }
146
+ }
147
+
148
+ /**
149
+ * Picked triangle's vertex indices.
150
+ * @property indices
151
+ * @type {Int32Array}
152
+ */
153
+ get indices() {
154
+ return this.entity && this._gotIndices ? this._indices : null;
155
+ }
156
+
157
+ /**
158
+ * @private
159
+ * @param value
160
+ */
161
+ set indices(value) {
162
+ if (value) {
163
+ this._indices[0] = value[0];
164
+ this._indices[1] = value[1];
165
+ this._indices[2] = value[2];
166
+ this._gotIndices = true;
167
+ } else {
168
+ this._gotIndices = false;
169
+ }
170
+ }
171
+
172
+ /**
173
+ * Picked Local-space point.
174
+ * @property localPos
175
+ * @type {Number[]}
176
+ */
177
+ get localPos() {
178
+ return this.entity && this._gotLocalPos ? this._localPos : null;
179
+ }
180
+
181
+ /**
182
+ * @private
183
+ * @param value
184
+ */
185
+ set localPos(value) {
186
+ if (value) {
187
+ this._localPos[0] = value[0];
188
+ this._localPos[1] = value[1];
189
+ this._localPos[2] = value[2];
190
+ this._gotLocalPos = true;
191
+ } else {
192
+ this._gotLocalPos = false;
193
+ }
194
+ }
195
+
196
+ /**
197
+ * Picked World-space point.
198
+ * @property worldPos
199
+ * @type {Number[]}
200
+ */
201
+ get worldPos() {
202
+ return this._gotWorldPos ? this._worldPos : null;
203
+ }
204
+
205
+ /**
206
+ * @private
207
+ * @param value
208
+ */
209
+ set worldPos(value) {
210
+ if (value) {
211
+ this._worldPos[0] = value[0];
212
+ this._worldPos[1] = value[1];
213
+ this._worldPos[2] = value[2];
214
+ this._gotWorldPos = true;
215
+ } else {
216
+ this._gotWorldPos = false;
217
+ }
218
+ }
219
+
220
+ /**
221
+ * Picked View-space point.
222
+ * @property viewPos
223
+ * @type {Number[]}
224
+ */
225
+ get viewPos() {
226
+ return this.entity && this._gotViewPos ? this._viewPos : null;
227
+ }
228
+
229
+ /**
230
+ * @private
231
+ * @param value
232
+ */
233
+ set viewPos(value) {
234
+ if (value) {
235
+ this._viewPos[0] = value[0];
236
+ this._viewPos[1] = value[1];
237
+ this._viewPos[2] = value[2];
238
+ this._gotViewPos = true;
239
+ } else {
240
+ this._gotViewPos = false;
241
+ }
242
+ }
243
+
244
+ /**
245
+ * Barycentric coordinate within picked triangle.
246
+ * @property bary
247
+ * @type {Number[]}
248
+ */
249
+ get bary() {
250
+ return this.entity && this._gotBary ? this._bary : null;
251
+ }
252
+
253
+ /**
254
+ * @private
255
+ * @param value
256
+ */
257
+ set bary(value) {
258
+ if (value) {
259
+ this._bary[0] = value[0];
260
+ this._bary[1] = value[1];
261
+ this._bary[2] = value[2];
262
+ this._gotBary = true;
263
+ } else {
264
+ this._gotBary = false;
265
+ }
266
+ }
267
+
268
+ /**
269
+ * Normal vector at picked position on surface.
270
+ * @property worldNormal
271
+ * @type {Number[]}
272
+ */
273
+ get worldNormal() {
274
+ return this.entity && this._gotWorldNormal ? this._worldNormal : null;
275
+ }
276
+
277
+ /**
278
+ * @private
279
+ * @param value
280
+ */
281
+ set worldNormal(value) {
282
+ if (value) {
283
+ this._worldNormal[0] = value[0];
284
+ this._worldNormal[1] = value[1];
285
+ this._worldNormal[2] = value[2];
286
+ this._gotWorldNormal = true;
287
+ } else {
288
+ this._gotWorldNormal = false;
289
+ }
290
+ }
291
+
292
+ /**
293
+ * UV coordinates at picked position on surface.
294
+ * @property uv
295
+ * @type {Number[]}
296
+ */
297
+ get uv() {
298
+ return this.entity && this._gotUV ? this._uv : null;
299
+ }
300
+
301
+ /**
302
+ * @private
303
+ * @param value
304
+ */
305
+ set uv(value) {
306
+ if (value) {
307
+ this._uv[0] = value[0];
308
+ this._uv[1] = value[1];
309
+ this._gotUV = true;
310
+ } else {
311
+ this._gotUV = false;
312
+ }
313
+ }
314
+
315
+ /**
316
+ * @private
317
+ */
318
+ reset() {
319
+ this.entity = null;
320
+ this.primIndex = -1;
321
+ this.primitive = null;
322
+ this.pickSurfacePrecision = false;
323
+ this._gotCanvasPos = false;
324
+ this._gotOrigin = false;
325
+ this._gotDirection = false;
326
+ this._gotIndices = false;
327
+ this._gotLocalPos = false;
328
+ this._gotWorldPos = false;
329
+ this._gotViewPos = false;
330
+ this._gotBary = false;
331
+ this._gotWorldNormal = false;
332
+ this._gotUV = false;
333
+ this.touchInput = false;
334
+ this.snappedToVertex = false;
335
+ this.snappedToEdge = false;
336
+ }
337
+ }
338
+
339
+ export {PickResult};
@@ -0,0 +1,69 @@
1
+ /**
2
+ * @desc A pickable {@link Scene} element.
3
+ *
4
+ * @interface
5
+ * @abstract
6
+ * @private
7
+ */
8
+ class Pickable {
9
+
10
+ /**
11
+ * Called by xeokit to get if it's possible to pick a triangle on the surface of this Drawable.
12
+ */
13
+ canPickTriangle() {
14
+ }
15
+
16
+ /**
17
+ * Picks a triangle on this Pickable.
18
+ */
19
+ drawPickTriangles(renderFlags, frameCtx) {
20
+ }
21
+
22
+ /**
23
+ * Given a {@link PickResult} that contains a {@link PickResult#primIndex}, which indicates that a primitive was picked on the Pickable, then add more information to the PickResult about the picked position on the surface of the Pickable.
24
+ *
25
+ * Architecturally, this delegates collection of that Pickable-specific info to the Pickable, allowing it to provide whatever info it's able to.
26
+ *
27
+ * @param {PickResult} pickResult The PickResult to augment with pick intersection information specific to this Mesh.
28
+ * @param [pickResult.primIndex] Index of the primitive that was picked on this Mesh.
29
+ * @param [pickResult.canvasPos] Canvas coordinates, provided when picking through the Canvas.
30
+ * @param [pickResult.origin] World-space 3D ray origin, when ray picking.
31
+ * @param [pickResult.direction] World-space 3D ray direction, provided when ray picking.
32
+ */
33
+ pickTriangleSurface(pickResult) {
34
+ }
35
+
36
+ /**
37
+ * Called by xeokit to get if it's possible to pick a 3D point on the surface of this Pickable.
38
+ * Returns false if canPickTriangle returns true, and vice-versa.
39
+ */
40
+ canPickWorldPos() {
41
+ }
42
+
43
+ /**
44
+ * Renders color-encoded fragment depths of this Pickable.
45
+ * @param frameCtx
46
+ */
47
+ drawPickDepths(renderFlags, frameCtx) {
48
+ }
49
+
50
+ /**
51
+ * Delegates an {@link Entity} as representing what was actually picked in place of this Pickable.
52
+ * @returns {PerformanceNode}
53
+ */
54
+ delegatePickedEntity() {
55
+ return this.parent;
56
+ }
57
+
58
+ /**
59
+ * 3D origin of the Pickable's vertex positions, if they are in relative-to-center (RTC) coordinates.
60
+ *
61
+ * When this is defined, then the positions are RTC, which means that they are relative to this position.
62
+ *
63
+ * @type {Float64Array}
64
+ */
65
+ get origin() {
66
+ }
67
+ }
68
+
69
+ export {Pickable};