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

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 (384) hide show
  1. package/package.json +2 -1
  2. package/src/extras/ContextMenu/ContextMenu.js +907 -0
  3. package/src/extras/ContextMenu/index.js +1 -0
  4. package/src/extras/index.js +1 -0
  5. package/src/index.js +3 -0
  6. package/src/plugins/AngleMeasurementsPlugin/AngleMeasurement.js +658 -0
  7. package/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsControl.js +418 -0
  8. package/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsPlugin.js +400 -0
  9. package/src/plugins/AngleMeasurementsPlugin/index.js +1 -0
  10. package/src/plugins/AnnotationsPlugin/Annotation.js +368 -0
  11. package/src/plugins/AnnotationsPlugin/AnnotationsPlugin.js +583 -0
  12. package/src/plugins/AnnotationsPlugin/index.js +1 -0
  13. package/src/plugins/AxisGizmoPlugin/AxisGizmoPlugin.js +333 -0
  14. package/src/plugins/AxisGizmoPlugin/index.js +1 -0
  15. package/src/plugins/BCFViewpointsPlugin/BCFViewpointsPlugin.js +955 -0
  16. package/src/plugins/BCFViewpointsPlugin/index.js +1 -0
  17. package/src/plugins/CityJSONLoaderPlugin/CityJSONDefaultDataSource.js +29 -0
  18. package/src/plugins/CityJSONLoaderPlugin/CityJSONLoaderPlugin.js +751 -0
  19. package/src/plugins/CityJSONLoaderPlugin/index.js +1 -0
  20. package/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js +870 -0
  21. package/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsControl.js +376 -0
  22. package/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsPlugin.js +454 -0
  23. package/src/plugins/DistanceMeasurementsPlugin/index.js +1 -0
  24. package/src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesControl.js +639 -0
  25. package/src/plugins/FaceAlignedSectionPlanesPlugin/FaceAlignedSectionPlanesPlugin.js +436 -0
  26. package/src/plugins/FaceAlignedSectionPlanesPlugin/Overview.js +247 -0
  27. package/src/plugins/FaceAlignedSectionPlanesPlugin/Plane.js +167 -0
  28. package/src/plugins/FaceAlignedSectionPlanesPlugin/index.js +1 -0
  29. package/src/plugins/FastNavPlugin/FastNavPlugin.js +429 -0
  30. package/src/plugins/FastNavPlugin/index.js +1 -0
  31. package/src/plugins/GLTFLoaderPlugin/GLTFDefaultDataSource.js +139 -0
  32. package/src/plugins/GLTFLoaderPlugin/GLTFLoaderPlugin.js +421 -0
  33. package/src/plugins/GLTFLoaderPlugin/GLTFSceneModelLoader.js +669 -0
  34. package/src/plugins/GLTFLoaderPlugin/index.js +2 -0
  35. package/src/plugins/LASLoaderPlugin/LASDefaultDataSource.js +58 -0
  36. package/src/plugins/LASLoaderPlugin/LASLoaderPlugin.js +518 -0
  37. package/src/plugins/LASLoaderPlugin/index.js +1 -0
  38. package/src/plugins/LASLoaderPlugin/loadLASHeader.js +183 -0
  39. package/src/plugins/NavCubePlugin/CubeTextureCanvas.js +289 -0
  40. package/src/plugins/NavCubePlugin/NavCubePlugin.js +752 -0
  41. package/src/plugins/NavCubePlugin/index.js +1 -0
  42. package/src/plugins/OBJLoaderPlugin/OBJLoaderPlugin.js +145 -0
  43. package/src/plugins/OBJLoaderPlugin/OBJSceneGraphLoader.js +777 -0
  44. package/src/plugins/OBJLoaderPlugin/index.js +1 -0
  45. package/src/plugins/STLLoaderPlugin/STLDefaultDataSource.js +33 -0
  46. package/src/plugins/STLLoaderPlugin/STLLoaderPlugin.js +274 -0
  47. package/src/plugins/STLLoaderPlugin/STLSceneGraphLoader.js +313 -0
  48. package/src/plugins/STLLoaderPlugin/index.js +2 -0
  49. package/src/plugins/SectionPlanesPlugin/Control.js +1328 -0
  50. package/src/plugins/SectionPlanesPlugin/Overview.js +249 -0
  51. package/src/plugins/SectionPlanesPlugin/Plane.js +169 -0
  52. package/src/plugins/SectionPlanesPlugin/SectionPlanesPlugin.js +404 -0
  53. package/src/plugins/SectionPlanesPlugin/index.js +1 -0
  54. package/src/plugins/SkyboxesPlugin/SkyboxesPlugin.js +134 -0
  55. package/src/plugins/SkyboxesPlugin/index.js +1 -0
  56. package/src/plugins/StoreyViewsPlugin/IFCStoreyPlanObjectStates.js +77 -0
  57. package/src/plugins/StoreyViewsPlugin/Storey.js +61 -0
  58. package/src/plugins/StoreyViewsPlugin/StoreyMap.js +57 -0
  59. package/src/plugins/StoreyViewsPlugin/StoreyViewsPlugin.js +825 -0
  60. package/src/plugins/StoreyViewsPlugin/index.js +1 -0
  61. package/src/plugins/TreeViewPlugin/TreeViewNode.js +97 -0
  62. package/src/plugins/TreeViewPlugin/TreeViewPlugin.js +1424 -0
  63. package/src/plugins/TreeViewPlugin/index.js +1 -0
  64. package/src/plugins/ViewCullPlugin/ViewCullPlugin.js +295 -0
  65. package/src/plugins/ViewCullPlugin/index.js +1 -0
  66. package/src/plugins/WebIFCLoaderPlugin/WebIFCDefaultDataSource.js +58 -0
  67. package/src/plugins/WebIFCLoaderPlugin/WebIFCLoaderPlugin.js +942 -0
  68. package/src/plugins/WebIFCLoaderPlugin/index.js +1 -0
  69. package/src/plugins/XKTLoaderPlugin/XKTDefaultDataSource.js +95 -0
  70. package/src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js +1107 -0
  71. package/src/plugins/XKTLoaderPlugin/index.js +2 -0
  72. package/src/plugins/XKTLoaderPlugin/parsers/ParserV1.js +169 -0
  73. package/src/plugins/XKTLoaderPlugin/parsers/ParserV10.js +656 -0
  74. package/src/plugins/XKTLoaderPlugin/parsers/ParserV2.js +230 -0
  75. package/src/plugins/XKTLoaderPlugin/parsers/ParserV3.js +223 -0
  76. package/src/plugins/XKTLoaderPlugin/parsers/ParserV4.js +283 -0
  77. package/src/plugins/XKTLoaderPlugin/parsers/ParserV5.js +246 -0
  78. package/src/plugins/XKTLoaderPlugin/parsers/ParserV6.js +301 -0
  79. package/src/plugins/XKTLoaderPlugin/parsers/ParserV7.js +439 -0
  80. package/src/plugins/XKTLoaderPlugin/parsers/ParserV8.js +563 -0
  81. package/src/plugins/XKTLoaderPlugin/parsers/ParserV9.js +514 -0
  82. package/src/plugins/XKTLoaderPlugin/parsers/lib/pako.js +2 -0
  83. package/src/plugins/XML3DLoaderPlugin/XML3DLoaderPlugin.js +238 -0
  84. package/src/plugins/XML3DLoaderPlugin/XML3DSceneGraphLoader.js +1279 -0
  85. package/src/plugins/XML3DLoaderPlugin/index.js +1 -0
  86. package/src/plugins/XML3DLoaderPlugin/zipjs/.jshintrc +11 -0
  87. package/src/plugins/XML3DLoaderPlugin/zipjs/deflate.js +2060 -0
  88. package/src/plugins/XML3DLoaderPlugin/zipjs/inflate.js +2155 -0
  89. package/src/plugins/XML3DLoaderPlugin/zipjs/mime-types.js +1002 -0
  90. package/src/plugins/XML3DLoaderPlugin/zipjs/pako/codecs.js +64 -0
  91. package/src/plugins/XML3DLoaderPlugin/zipjs/z-worker.js +153 -0
  92. package/src/plugins/XML3DLoaderPlugin/zipjs/zip-ext.js +267 -0
  93. package/src/plugins/XML3DLoaderPlugin/zipjs/zip-fs.js +553 -0
  94. package/src/plugins/XML3DLoaderPlugin/zipjs/zip.js +991 -0
  95. package/src/plugins/XML3DLoaderPlugin/zipjs/zlib-asm/codecs.js +49 -0
  96. package/src/plugins/index.js +21 -0
  97. package/src/plugins/lib/culling/ObjectCullStates.js +208 -0
  98. package/src/plugins/lib/earcut.js +677 -0
  99. package/src/plugins/lib/html/Dot.js +145 -0
  100. package/src/plugins/lib/html/Label.js +156 -0
  101. package/src/plugins/lib/html/Wire.js +191 -0
  102. package/src/viewer/Configs.js +79 -0
  103. package/src/viewer/Plugin.js +224 -0
  104. package/src/viewer/Viewer.js +535 -0
  105. package/src/viewer/index.js +5 -0
  106. package/src/viewer/localization/LocaleService.js +475 -0
  107. package/src/viewer/metadata/IFCObjectDefaultColors.js +162 -0
  108. package/src/viewer/metadata/IFCObjectDefaults.js +17 -0
  109. package/src/viewer/metadata/MetaModel.js +389 -0
  110. package/src/viewer/metadata/MetaObject.js +218 -0
  111. package/src/viewer/metadata/MetaScene.js +336 -0
  112. package/src/viewer/metadata/Property.js +55 -0
  113. package/src/viewer/metadata/PropertySet.js +77 -0
  114. package/src/viewer/scene/Bitmap/Bitmap.js +470 -0
  115. package/src/viewer/scene/Bitmap/index.js +1 -0
  116. package/src/viewer/scene/CameraControl/CameraControl.js +1737 -0
  117. package/src/viewer/scene/CameraControl/lib/CameraUpdater.js +312 -0
  118. package/src/viewer/scene/CameraControl/lib/controllers/PanController.js +112 -0
  119. package/src/viewer/scene/CameraControl/lib/controllers/PickController.js +264 -0
  120. package/src/viewer/scene/CameraControl/lib/controllers/PivotController.js +384 -0
  121. package/src/viewer/scene/CameraControl/lib/handlers/KeyboardAxisViewHandler.js +122 -0
  122. package/src/viewer/scene/CameraControl/lib/handlers/KeyboardPanRotateDollyHandler.js +183 -0
  123. package/src/viewer/scene/CameraControl/lib/handlers/MouseMiscHandler.js +68 -0
  124. package/src/viewer/scene/CameraControl/lib/handlers/MousePanRotateDollyHandler.js +345 -0
  125. package/src/viewer/scene/CameraControl/lib/handlers/MousePickHandler.js +372 -0
  126. package/src/viewer/scene/CameraControl/lib/handlers/TouchPanRotateAndDollyHandler.js +269 -0
  127. package/src/viewer/scene/CameraControl/lib/handlers/TouchPickHandler.js +235 -0
  128. package/src/viewer/scene/Component.js +907 -0
  129. package/src/viewer/scene/Entity.js +502 -0
  130. package/src/viewer/scene/ImagePlane/ImagePlane.js +570 -0
  131. package/src/viewer/scene/ImagePlane/index.js +1 -0
  132. package/src/viewer/scene/LineSet/LineSet.js +164 -0
  133. package/src/viewer/scene/LineSet/index.js +1 -0
  134. package/src/viewer/scene/camera/Camera.js +912 -0
  135. package/src/viewer/scene/camera/CameraFlightAnimation.js +669 -0
  136. package/src/viewer/scene/camera/CameraPath.js +194 -0
  137. package/src/viewer/scene/camera/CameraPathAnimation.js +326 -0
  138. package/src/viewer/scene/camera/CustomProjection.js +149 -0
  139. package/src/viewer/scene/camera/Frustum.js +316 -0
  140. package/src/viewer/scene/camera/Ortho.js +286 -0
  141. package/src/viewer/scene/camera/Perspective.js +304 -0
  142. package/src/viewer/scene/camera/index.js +2 -0
  143. package/src/viewer/scene/canvas/Canvas.js +492 -0
  144. package/src/viewer/scene/canvas/Spinner.js +323 -0
  145. package/src/viewer/scene/constants/constants.js +371 -0
  146. package/src/viewer/scene/core.js +233 -0
  147. package/src/viewer/scene/geometry/Geometry.js +33 -0
  148. package/src/viewer/scene/geometry/ReadableGeometry.js +682 -0
  149. package/src/viewer/scene/geometry/VBOGeometry.js +319 -0
  150. package/src/viewer/scene/geometry/builders/buildBoxGeometry.js +238 -0
  151. package/src/viewer/scene/geometry/builders/buildBoxLinesGeometry.js +106 -0
  152. package/src/viewer/scene/geometry/builders/buildCylinderGeometry.js +271 -0
  153. package/src/viewer/scene/geometry/builders/buildGridGeometry.js +102 -0
  154. package/src/viewer/scene/geometry/builders/buildPlaneGeometry.js +168 -0
  155. package/src/viewer/scene/geometry/builders/buildSphereGeometry.js +161 -0
  156. package/src/viewer/scene/geometry/builders/buildTorusGeometry.js +172 -0
  157. package/src/viewer/scene/geometry/builders/buildVectorTextGeometry.js +1721 -0
  158. package/src/viewer/scene/geometry/builders/index.js +8 -0
  159. package/src/viewer/scene/geometry/index.js +4 -0
  160. package/src/viewer/scene/geometry/loaders/index.js +2 -0
  161. package/src/viewer/scene/geometry/loaders/load3DSGeometry.js +103 -0
  162. package/src/viewer/scene/geometry/loaders/loadOBJGeometry.js +130 -0
  163. package/src/viewer/scene/index.js +23 -0
  164. package/src/viewer/scene/input/Input.js +1325 -0
  165. package/src/viewer/scene/libs/k3d.js +1032 -0
  166. package/src/viewer/scene/lights/AmbientLight.js +175 -0
  167. package/src/viewer/scene/lights/CubeTexture.js +156 -0
  168. package/src/viewer/scene/lights/DirLight.js +314 -0
  169. package/src/viewer/scene/lights/Light.js +29 -0
  170. package/src/viewer/scene/lights/LightMap.js +77 -0
  171. package/src/viewer/scene/lights/PointLight.js +395 -0
  172. package/src/viewer/scene/lights/ReflectionMap.js +79 -0
  173. package/src/viewer/scene/lights/Shadow.js +138 -0
  174. package/src/viewer/scene/lights/index.js +5 -0
  175. package/src/viewer/scene/lod/LOD.js +162 -0
  176. package/src/viewer/scene/lod/LODCullingManager.js +83 -0
  177. package/src/viewer/scene/lod/LODState.js +125 -0
  178. package/src/viewer/scene/lod/index.js +1 -0
  179. package/src/viewer/scene/marker/Marker.js +383 -0
  180. package/src/viewer/scene/marker/SpriteMarker.js +356 -0
  181. package/src/viewer/scene/marker/index.js +2 -0
  182. package/src/viewer/scene/materials/EdgeMaterial.js +359 -0
  183. package/src/viewer/scene/materials/EmphasisMaterial.js +613 -0
  184. package/src/viewer/scene/materials/Fresnel.js +222 -0
  185. package/src/viewer/scene/materials/LambertMaterial.js +378 -0
  186. package/src/viewer/scene/materials/LinesMaterial.js +169 -0
  187. package/src/viewer/scene/materials/Material.js +39 -0
  188. package/src/viewer/scene/materials/MetallicMaterial.js +820 -0
  189. package/src/viewer/scene/materials/PhongMaterial.js +860 -0
  190. package/src/viewer/scene/materials/PointsMaterial.js +409 -0
  191. package/src/viewer/scene/materials/SpecularMaterial.js +807 -0
  192. package/src/viewer/scene/materials/Texture.js +513 -0
  193. package/src/viewer/scene/materials/index.js +8 -0
  194. package/src/viewer/scene/math/Frustum.js +118 -0
  195. package/src/viewer/scene/math/buildEdgeIndices.js +162 -0
  196. package/src/viewer/scene/math/geometryCompressionUtils.js +365 -0
  197. package/src/viewer/scene/math/index.js +3 -0
  198. package/src/viewer/scene/math/math.js +5363 -0
  199. package/src/viewer/scene/math/rtcCoords.js +139 -0
  200. package/src/viewer/scene/mementos/CameraMemento.js +200 -0
  201. package/src/viewer/scene/mementos/ModelMemento.js +263 -0
  202. package/src/viewer/scene/mementos/ObjectsMemento.js +259 -0
  203. package/src/viewer/scene/mementos/index.js +3 -0
  204. package/src/viewer/scene/mesh/Mesh.js +2202 -0
  205. package/src/viewer/scene/mesh/draw/DrawRenderer.js +986 -0
  206. package/src/viewer/scene/mesh/draw/DrawShaderSource.js +1570 -0
  207. package/src/viewer/scene/mesh/emphasis/EmphasisEdgesRenderer.js +249 -0
  208. package/src/viewer/scene/mesh/emphasis/EmphasisEdgesShaderSource.js +158 -0
  209. package/src/viewer/scene/mesh/emphasis/EmphasisFillRenderer.js +276 -0
  210. package/src/viewer/scene/mesh/emphasis/EmphasisFillShaderSource.js +261 -0
  211. package/src/viewer/scene/mesh/index.js +1 -0
  212. package/src/viewer/scene/mesh/occlusion/OcclusionRenderer.js +207 -0
  213. package/src/viewer/scene/mesh/occlusion/OcclusionShaderSource.js +156 -0
  214. package/src/viewer/scene/mesh/pick/PickMeshRenderer.js +210 -0
  215. package/src/viewer/scene/mesh/pick/PickMeshShaderSource.js +142 -0
  216. package/src/viewer/scene/mesh/pick/PickTriangleRenderer.js +186 -0
  217. package/src/viewer/scene/mesh/pick/PickTriangleShaderSource.js +116 -0
  218. package/src/viewer/scene/mesh/shadow/ShadowRenderer.js +214 -0
  219. package/src/viewer/scene/mesh/shadow/ShadowShaderSource.js +98 -0
  220. package/src/viewer/scene/metriqs/Metriqs.js +259 -0
  221. package/src/viewer/scene/model/ENTITY_FLAGS.js +21 -0
  222. package/src/viewer/scene/model/PerformanceModel.js +26 -0
  223. package/src/viewer/scene/model/RENDER_PASSES.js +34 -0
  224. package/src/viewer/scene/model/SceneModel.js +3817 -0
  225. package/src/viewer/scene/model/SceneModelEntity.js +478 -0
  226. package/src/viewer/scene/model/SceneModelMesh.js +160 -0
  227. package/src/viewer/scene/model/SceneModelTexture.js +17 -0
  228. package/src/viewer/scene/model/SceneModelTextureSet.js +17 -0
  229. package/src/viewer/scene/model/VBOSceneModel.js +26 -0
  230. package/src/viewer/scene/model/compression.js +227 -0
  231. package/src/viewer/scene/model/dtx/triangles/BindableDataTexture.js +31 -0
  232. package/src/viewer/scene/model/dtx/triangles/DataTextureGenerator.js +631 -0
  233. package/src/viewer/scene/model/dtx/triangles/DataTextureState.js +288 -0
  234. package/src/viewer/scene/model/dtx/triangles/TrianglesDataTextureBuffer.js +31 -0
  235. package/src/viewer/scene/model/dtx/triangles/TrianglesDataTextureLayer.js +1329 -0
  236. package/src/viewer/scene/model/dtx/triangles/TrianglesDataTextureRenderers.js +278 -0
  237. package/src/viewer/scene/model/dtx/triangles/calculateUniquePositions.js +126 -0
  238. package/src/viewer/scene/model/dtx/triangles/dataTextureRamStats.js +54 -0
  239. package/src/viewer/scene/model/dtx/triangles/rebucketPositions.js +347 -0
  240. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTextureColorRenderer.js +633 -0
  241. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTextureDepthRenderer.js +475 -0
  242. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTextureEdgesColorRenderer.js +426 -0
  243. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTextureEdgesRenderer.js +430 -0
  244. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTextureNormalsRenderer.js +341 -0
  245. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTextureOcclusionRenderer.js +442 -0
  246. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTexturePickDepthRenderer.js +451 -0
  247. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTexturePickMeshRenderer.js +436 -0
  248. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTexturePickNormalsFlatRenderer.js +502 -0
  249. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTexturePickNormalsRenderer.js +430 -0
  250. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTextureSilhouetteRenderer.js +469 -0
  251. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTextureSnapDepthBufInitRenderer.js +451 -0
  252. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTextureSnapDepthRenderer.js +424 -0
  253. package/src/viewer/scene/model/index.js +3 -0
  254. package/src/viewer/scene/model/vbo/ScratchMemory.js +63 -0
  255. package/src/viewer/scene/model/vbo/VBOSceneModelRenderers.js +805 -0
  256. package/src/viewer/scene/model/vbo/float16.js +760 -0
  257. package/src/viewer/scene/model/vbo/linesBatching/LinesBatchingBuffer.js +21 -0
  258. package/src/viewer/scene/model/vbo/linesBatching/LinesBatchingLayer.js +744 -0
  259. package/src/viewer/scene/model/vbo/linesBatching/LinesBatchingRenderers.js +71 -0
  260. package/src/viewer/scene/model/vbo/linesBatching/renderers/LinesBatchingColorRenderer.js +116 -0
  261. package/src/viewer/scene/model/vbo/linesBatching/renderers/LinesBatchingSilhouetteRenderer.js +126 -0
  262. package/src/viewer/scene/model/vbo/linesInstancing/LinesInstancingLayer.js +653 -0
  263. package/src/viewer/scene/model/vbo/linesInstancing/LinesInstancingRenderers.js +71 -0
  264. package/src/viewer/scene/model/vbo/linesInstancing/renderers/LinesInstancingColorRenderer.js +150 -0
  265. package/src/viewer/scene/model/vbo/linesInstancing/renderers/LinesInstancingSilhouetteRenderer.js +128 -0
  266. package/src/viewer/scene/model/vbo/pointsBatching/PointsBatchingBuffer.js +22 -0
  267. package/src/viewer/scene/model/vbo/pointsBatching/PointsBatchingLayer.js +753 -0
  268. package/src/viewer/scene/model/vbo/pointsBatching/PointsBatchingRenderers.js +116 -0
  269. package/src/viewer/scene/model/vbo/pointsBatching/renderers/PointsBatchingColorRenderer.js +167 -0
  270. package/src/viewer/scene/model/vbo/pointsBatching/renderers/PointsBatchingOcclusionRenderer.js +135 -0
  271. package/src/viewer/scene/model/vbo/pointsBatching/renderers/PointsBatchingPickDepthRenderer.js +154 -0
  272. package/src/viewer/scene/model/vbo/pointsBatching/renderers/PointsBatchingPickMeshRenderer.js +146 -0
  273. package/src/viewer/scene/model/vbo/pointsBatching/renderers/PointsBatchingShadowRenderer.js +108 -0
  274. package/src/viewer/scene/model/vbo/pointsBatching/renderers/PointsBatchingSilhouetteRenderer.js +147 -0
  275. package/src/viewer/scene/model/vbo/pointsInstancing/PointsInstancingLayer.js +684 -0
  276. package/src/viewer/scene/model/vbo/pointsInstancing/PointsInstancingRenderers.js +146 -0
  277. package/src/viewer/scene/model/vbo/pointsInstancing/renderers/PointsInstancingColorRenderer.js +174 -0
  278. package/src/viewer/scene/model/vbo/pointsInstancing/renderers/PointsInstancingDepthRenderer.js +156 -0
  279. package/src/viewer/scene/model/vbo/pointsInstancing/renderers/PointsInstancingOcclusionRenderer.js +151 -0
  280. package/src/viewer/scene/model/vbo/pointsInstancing/renderers/PointsInstancingPickDepthRenderer.js +167 -0
  281. package/src/viewer/scene/model/vbo/pointsInstancing/renderers/PointsInstancingPickMeshRenderer.js +151 -0
  282. package/src/viewer/scene/model/vbo/pointsInstancing/renderers/PointsInstancingShadowRenderer.js +121 -0
  283. package/src/viewer/scene/model/vbo/pointsInstancing/renderers/PointsInstancingSilhouetteRenderer.js +156 -0
  284. package/src/viewer/scene/model/vbo/snapBatching/SnapBatchingDepthBufInitRenderer.js +351 -0
  285. package/src/viewer/scene/model/vbo/snapBatching/SnapBatchingDepthRenderer.js +365 -0
  286. package/src/viewer/scene/model/vbo/snapBatching/SnapBatchingRenderers.js +71 -0
  287. package/src/viewer/scene/model/vbo/snapInstancing/SnapInstancingDepthBufInitRenderer.js +381 -0
  288. package/src/viewer/scene/model/vbo/snapInstancing/SnapInstancingDepthRenderer.js +374 -0
  289. package/src/viewer/scene/model/vbo/snapInstancing/SnapInstancingRenderers.js +71 -0
  290. package/src/viewer/scene/model/vbo/trianglesBatching/TrianglesBatchingBuffer.js +26 -0
  291. package/src/viewer/scene/model/vbo/trianglesBatching/TrianglesBatchingLayer.js +1322 -0
  292. package/src/viewer/scene/model/vbo/trianglesBatching/TrianglesBatchingRenderers.js +322 -0
  293. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingColorRenderer.js +240 -0
  294. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingColorTextureRenderer.js +271 -0
  295. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingDepthRenderer.js +127 -0
  296. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingEdgesColorRenderer.js +129 -0
  297. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingEdgesRenderer.js +134 -0
  298. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingFlatColorRenderer.js +237 -0
  299. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingNormalsRenderer.js +139 -0
  300. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingOcclusionRenderer.js +127 -0
  301. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingPBRRenderer.js +563 -0
  302. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingPickDepthRenderer.js +143 -0
  303. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingPickMeshRenderer.js +130 -0
  304. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingPickNormalsFlatRenderer.js +119 -0
  305. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingPickNormalsRenderer.js +129 -0
  306. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingShadowRenderer.js +108 -0
  307. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingSilhouetteRenderer.js +137 -0
  308. package/src/viewer/scene/model/vbo/trianglesInstancing/TrianglesInstancingLayer.js +1167 -0
  309. package/src/viewer/scene/model/vbo/trianglesInstancing/TrianglesInstancingRenderers.js +322 -0
  310. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingColorRenderer.js +253 -0
  311. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingColorTextureRenderer.js +278 -0
  312. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingDepthRenderer.js +125 -0
  313. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingEdgesColorRenderer.js +131 -0
  314. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingEdgesRenderer.js +134 -0
  315. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingFlatColorRenderer.js +244 -0
  316. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingFlatNormalsRenderer.js +130 -0
  317. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingNormalsRenderer.js +140 -0
  318. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingOcclusionRenderer.js +130 -0
  319. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingPBRRenderer.js +563 -0
  320. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingPickDepthRenderer.js +148 -0
  321. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingPickMeshRenderer.js +135 -0
  322. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingPickNormalsFlatRenderer.js +130 -0
  323. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingPickNormalsRenderer.js +144 -0
  324. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingShadowRenderer.js +113 -0
  325. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingSilhouetteRenderer.js +141 -0
  326. package/src/viewer/scene/nodes/Node.js +1383 -0
  327. package/src/viewer/scene/nodes/index.js +1 -0
  328. package/src/viewer/scene/paths/CubicBezierCurve.js +194 -0
  329. package/src/viewer/scene/paths/Curve.js +183 -0
  330. package/src/viewer/scene/paths/Path.js +239 -0
  331. package/src/viewer/scene/paths/QuadraticBezierCurve.js +161 -0
  332. package/src/viewer/scene/paths/SplineCurve.js +133 -0
  333. package/src/viewer/scene/paths/index.js +5 -0
  334. package/src/viewer/scene/postfx/SAO.js +543 -0
  335. package/src/viewer/scene/scene/Scene.js +2627 -0
  336. package/src/viewer/scene/sectionPlane/SectionPlane.js +194 -0
  337. package/src/viewer/scene/sectionPlane/index.js +1 -0
  338. package/src/viewer/scene/skybox/Skybox.js +123 -0
  339. package/src/viewer/scene/skybox/index.js +1 -0
  340. package/src/viewer/scene/stats.js +44 -0
  341. package/src/viewer/scene/utils/Cache.js +29 -0
  342. package/src/viewer/scene/utils/FileLoader.js +160 -0
  343. package/src/viewer/scene/utils/Loader.js +55 -0
  344. package/src/viewer/scene/utils/LoadingManager.js +86 -0
  345. package/src/viewer/scene/utils/Map.js +45 -0
  346. package/src/viewer/scene/utils/Queue.js +56 -0
  347. package/src/viewer/scene/utils/WorkerPool.js +73 -0
  348. package/src/viewer/scene/utils/index.js +6 -0
  349. package/src/viewer/scene/utils/textureTranscoders/KTX2TextureTranscoder/KTX2TextureTranscoder.js +650 -0
  350. package/src/viewer/scene/utils/textureTranscoders/KTX2TextureTranscoder/index.js +1 -0
  351. package/src/viewer/scene/utils/textureTranscoders/TextureTranscoder.js +31 -0
  352. package/src/viewer/scene/utils/textureTranscoders/index.js +2 -0
  353. package/src/viewer/scene/utils.js +452 -0
  354. package/src/viewer/scene/vfc/VFC.js +82 -0
  355. package/src/viewer/scene/vfc/VFCManager.js +54 -0
  356. package/src/viewer/scene/vfc/VFCState.js +391 -0
  357. package/src/viewer/scene/vfc/cluster-helper.js +134 -0
  358. package/src/viewer/scene/vfc/index.js +1 -0
  359. package/src/viewer/scene/vfc/rbush3d.js +848 -0
  360. package/src/viewer/scene/vfc/xeokit-cluster.js +418 -0
  361. package/src/viewer/scene/viewport/Viewport.js +212 -0
  362. package/src/viewer/scene/webgl/ArrayBuf.js +121 -0
  363. package/src/viewer/scene/webgl/Attribute.js +23 -0
  364. package/src/viewer/scene/webgl/Drawable.js +270 -0
  365. package/src/viewer/scene/webgl/FrameContext.js +313 -0
  366. package/src/viewer/scene/webgl/PickResult.js +339 -0
  367. package/src/viewer/scene/webgl/Pickable.js +69 -0
  368. package/src/viewer/scene/webgl/Program.js +181 -0
  369. package/src/viewer/scene/webgl/RenderBuffer.js +350 -0
  370. package/src/viewer/scene/webgl/RenderBufferManager.js +34 -0
  371. package/src/viewer/scene/webgl/RenderFlags.js +203 -0
  372. package/src/viewer/scene/webgl/RenderState.js +40 -0
  373. package/src/viewer/scene/webgl/Renderer.js +1654 -0
  374. package/src/viewer/scene/webgl/Sampler.js +18 -0
  375. package/src/viewer/scene/webgl/Shader.js +49 -0
  376. package/src/viewer/scene/webgl/Texture2D.js +442 -0
  377. package/src/viewer/scene/webgl/convertConstant.js +244 -0
  378. package/src/viewer/scene/webgl/getExtension.js +32 -0
  379. package/src/viewer/scene/webgl/occlusion/OcclusionLayer.js +214 -0
  380. package/src/viewer/scene/webgl/occlusion/OcclusionTester.js +426 -0
  381. package/src/viewer/scene/webgl/sao/SAODepthLimitedBlurRenderer.js +324 -0
  382. package/src/viewer/scene/webgl/sao/SAOOcclusionRenderer.js +376 -0
  383. package/src/viewer/scene/webgl/webglEnums.js +61 -0
  384. package/src/viewer/scene/webglInfo.js +47 -0
@@ -0,0 +1,653 @@
1
+ import {ENTITY_FLAGS} from '../../ENTITY_FLAGS.js';
2
+ import {RENDER_PASSES} from '../../RENDER_PASSES.js';
3
+
4
+ import {math} from "../../../math/math.js";
5
+ import {RenderState} from "../../../webgl/RenderState.js";
6
+ import {ArrayBuf} from "../../../webgl/ArrayBuf.js";
7
+ import {getInstancingRenderers} from "./LinesInstancingRenderers.js";
8
+
9
+ const tempUint8Vec4 = new Uint8Array(4);
10
+ const tempFloat32 = new Float32Array(1);
11
+
12
+ const tempVec4a = math.vec4([0, 0, 0, 1]);
13
+ const tempVec4b = math.vec4([0, 0, 0, 1]);
14
+ const tempVec4c = math.vec4([0, 0, 0, 1]);
15
+
16
+ const tempVec3fa = new Float32Array(3);
17
+
18
+ /**
19
+ * @private
20
+ */
21
+ class LinesInstancingLayer {
22
+
23
+ /**
24
+ * @param cfg
25
+ * @param cfg.layerIndex
26
+ * @param cfg.model
27
+ * @param cfg.geometry
28
+ * @param cfg.material
29
+ * @param cfg.origin
30
+ */
31
+ constructor(cfg) {
32
+
33
+ /**
34
+ * Owner model
35
+ * @type {VBOSceneModel}
36
+ */
37
+ this.model = cfg.model;
38
+
39
+ /**
40
+ * Shared material
41
+ * @type {VBOSceneModelGeometry}
42
+ */
43
+ this.material = cfg.material;
44
+
45
+ /**
46
+ * State sorting key.
47
+ * @type {string}
48
+ */
49
+ this.sortId = "LinesInstancingLayer";
50
+
51
+ /**
52
+ * Index of this InstancingLayer in VBOSceneModel#_layerList
53
+ * @type {Number}
54
+ */
55
+ this.layerIndex = cfg.layerIndex;
56
+
57
+ this._linesInstancingRenderers = getInstancingRenderers(cfg.model.scene);
58
+
59
+ this._aabb = math.collapseAABB3();
60
+
61
+ this._state = new RenderState({
62
+ obb: math.OBB3(),
63
+ numInstances: 0,
64
+ origin: null,
65
+ geometry: cfg.geometry,
66
+ positionsDecodeMatrix: cfg.geometry.positionsDecodeMatrix, // So we can null the geometry for GC
67
+ positionsBuf: null,
68
+ colorsBuf: null,
69
+ flagsBuf: null,
70
+ offsetsBuf: null,
71
+ modelMatrixCol0Buf: null,
72
+ modelMatrixCol1Buf: null,
73
+ modelMatrixCol2Buf: null
74
+ });
75
+
76
+ // These counts are used to avoid unnecessary render passes
77
+ this._numPortions = 0;
78
+ this._numVisibleLayerPortions = 0;
79
+ this._numTransparentLayerPortions = 0;
80
+ this._numXRayedLayerPortions = 0;
81
+ this._numHighlightedLayerPortions = 0;
82
+ this._numSelectedLayerPortions = 0;
83
+ this._numClippableLayerPortions = 0;
84
+ this._numEdgesLayerPortions = 0;
85
+ this._numPickableLayerPortions = 0;
86
+ this._numCulledLayerPortions = 0;
87
+
88
+ /** @private */
89
+ this.numIndices = cfg.geometry.numIndices;
90
+
91
+ // Vertex arrays
92
+ this._colors = [];
93
+ this._offsets = [];
94
+
95
+ // Modeling matrix per instance, array for each column
96
+ this._modelMatrixCol0 = [];
97
+ this._modelMatrixCol1 = [];
98
+ this._modelMatrixCol2 = [];
99
+
100
+ this._portions = [];
101
+
102
+ if (cfg.origin) {
103
+ this._state.origin = math.vec3(cfg.origin);
104
+ }
105
+
106
+ this._finalized = false;
107
+
108
+ /**
109
+ * The axis-aligned World-space boundary of this InstancingLayer's positions.
110
+ * @type {*|Float64Array}
111
+ */
112
+ this.aabb = math.collapseAABB3();
113
+ }
114
+
115
+ /**
116
+ * Creates a new portion within this InstancingLayer, returns the new portion ID.
117
+ *
118
+ * The portion will instance this InstancingLayer's geometry.
119
+ *
120
+ * Gives the portion the specified color and matrix.
121
+ *
122
+ * @param cfg Portion params
123
+ * @param cfg.color Color [0..255,0..255,0..255]
124
+ * @param cfg.opacity Opacity [0..255].
125
+ * @param cfg.meshMatrix Flat float 4x4 matrix.
126
+ * @param cfg.aabb Flat float AABB.
127
+ * @returns {number} Portion ID.
128
+ */
129
+ createPortion(cfg) {
130
+
131
+ const color = cfg.color;
132
+ const opacity = cfg.opacity;
133
+ const meshMatrix = cfg.meshMatrix;
134
+ const worldAABB = cfg.aabb;
135
+
136
+ if (this._finalized) {
137
+ throw "Already finalized";
138
+ }
139
+
140
+ // TODO: find AABB for portion by transforming the geometry local AABB by the given meshMatrix?
141
+
142
+ const r = color[0]; // Color is pre-quantized by VBOSceneModel
143
+ const g = color[1];
144
+ const b = color[2];
145
+ const a = color[3];
146
+
147
+ this._colors.push(r);
148
+ this._colors.push(g);
149
+ this._colors.push(b);
150
+ this._colors.push(opacity);
151
+
152
+ if (this.model.scene.entityOffsetsEnabled) {
153
+ this._offsets.push(0);
154
+ this._offsets.push(0);
155
+ this._offsets.push(0);
156
+ }
157
+
158
+ this._modelMatrixCol0.push(meshMatrix[0]);
159
+ this._modelMatrixCol0.push(meshMatrix[4]);
160
+ this._modelMatrixCol0.push(meshMatrix[8]);
161
+ this._modelMatrixCol0.push(meshMatrix[12]);
162
+
163
+ this._modelMatrixCol1.push(meshMatrix[1]);
164
+ this._modelMatrixCol1.push(meshMatrix[5]);
165
+ this._modelMatrixCol1.push(meshMatrix[9]);
166
+ this._modelMatrixCol1.push(meshMatrix[13]);
167
+
168
+ this._modelMatrixCol2.push(meshMatrix[2]);
169
+ this._modelMatrixCol2.push(meshMatrix[6]);
170
+ this._modelMatrixCol2.push(meshMatrix[10]);
171
+ this._modelMatrixCol2.push(meshMatrix[14]);
172
+
173
+ // Expand AABB
174
+
175
+ math.collapseAABB3(worldAABB);
176
+ const obb = this._state.obb;
177
+ const lenPositions = obb.length;
178
+ for (let i = 0; i < lenPositions; i += 4) {
179
+ tempVec4a[0] = obb[i + 0];
180
+ tempVec4a[1] = obb[i + 1];
181
+ tempVec4a[2] = obb[i + 2];
182
+ math.transformPoint4(meshMatrix, tempVec4a, tempVec4b);
183
+ math.expandAABB3Point3(worldAABB, tempVec4b);
184
+ }
185
+
186
+ if (this._state.origin) {
187
+ const origin = this._state.origin;
188
+ worldAABB[0] += origin[0];
189
+ worldAABB[1] += origin[1];
190
+ worldAABB[2] += origin[2];
191
+ worldAABB[3] += origin[0];
192
+ worldAABB[4] += origin[1];
193
+ worldAABB[5] += origin[2];
194
+ }
195
+
196
+ math.expandAABB3(this.aabb, worldAABB);
197
+
198
+ this._state.numInstances++;
199
+
200
+ const portionId = this._portions.length;
201
+ this._portions.push({});
202
+
203
+ this._numPortions++;
204
+ this.model.numPortions++;
205
+
206
+ return portionId;
207
+ }
208
+
209
+ finalize() {
210
+ if (this._finalized) {
211
+ throw "Already finalized";
212
+ }
213
+ const gl = this.model.scene.canvas.gl;
214
+ const colorsLength = this._colors.length;
215
+ const flagsLength = colorsLength / 4;
216
+ if (colorsLength > 0) {
217
+ let notNormalized = false;
218
+ this._state.colorsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, new Uint8Array(this._colors), this._colors.length, 4, gl.DYNAMIC_DRAW, notNormalized);
219
+ this._colors = []; // Release memory
220
+ }
221
+ if (flagsLength > 0) {
222
+ // Because we only build flags arrays here,
223
+ // get their length from the colors array
224
+ let notNormalized = false;
225
+ this._state.flagsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, new Float32Array(flagsLength), flagsLength, 1, gl.DYNAMIC_DRAW, notNormalized);
226
+ }
227
+ if (this.model.scene.entityOffsetsEnabled) {
228
+ if (this._offsets.length > 0) {
229
+ const notNormalized = false;
230
+ this._state.offsetsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, new Float32Array(this._offsets), this._offsets.length, 3, gl.DYNAMIC_DRAW, notNormalized);
231
+ this._offsets = []; // Release memory
232
+ }
233
+ }
234
+ if (this._modelMatrixCol0.length > 0) {
235
+ const normalized = false;
236
+ this._state.modelMatrixCol0Buf = new ArrayBuf(gl, gl.ARRAY_BUFFER, new Float32Array(this._modelMatrixCol0), this._modelMatrixCol0.length, 4, gl.STATIC_DRAW, normalized);
237
+ this._state.modelMatrixCol1Buf = new ArrayBuf(gl, gl.ARRAY_BUFFER, new Float32Array(this._modelMatrixCol1), this._modelMatrixCol1.length, 4, gl.STATIC_DRAW, normalized);
238
+ this._state.modelMatrixCol2Buf = new ArrayBuf(gl, gl.ARRAY_BUFFER, new Float32Array(this._modelMatrixCol2), this._modelMatrixCol2.length, 4, gl.STATIC_DRAW, normalized);
239
+ this._modelMatrixCol0 = [];
240
+ this._modelMatrixCol1 = [];
241
+ this._modelMatrixCol2 = [];
242
+ }
243
+ this._state.geometry = null;
244
+ this._finalized = true;
245
+ }
246
+
247
+ // The following setters are called by VBOSceneModelMesh, in turn called by VBOSceneModelNode, only after the layer is finalized.
248
+ // It's important that these are called after finalize() in order to maintain integrity of counts like _numVisibleLayerPortions etc.
249
+
250
+ initFlags(portionId, flags, meshTransparent) {
251
+ if (flags & ENTITY_FLAGS.VISIBLE) {
252
+ this._numVisibleLayerPortions++;
253
+ this.model.numVisibleLayerPortions++;
254
+ }
255
+ if (flags & ENTITY_FLAGS.HIGHLIGHTED) {
256
+ this._numHighlightedLayerPortions++;
257
+ this.model.numHighlightedLayerPortions++;
258
+ }
259
+ if (flags & ENTITY_FLAGS.XRAYED) {
260
+ this._numXRayedLayerPortions++;
261
+ this.model.numXRayedLayerPortions++;
262
+ }
263
+ if (flags & ENTITY_FLAGS.SELECTED) {
264
+ this._numSelectedLayerPortions++;
265
+ this.model.numSelectedLayerPortions++;
266
+ }
267
+ if (flags & ENTITY_FLAGS.CLIPPABLE) {
268
+ this._numClippableLayerPortions++;
269
+ this.model.numClippableLayerPortions++;
270
+ }
271
+ if (flags & ENTITY_FLAGS.EDGES) {
272
+ this._numEdgesLayerPortions++;
273
+ this.model.numEdgesLayerPortions++;
274
+ }
275
+ if (flags & ENTITY_FLAGS.PICKABLE) {
276
+ this._numPickableLayerPortions++;
277
+ this.model.numPickableLayerPortions++;
278
+ }
279
+ if (flags & ENTITY_FLAGS.CULLED) {
280
+ this._numCulledLayerPortions++;
281
+ this.model.numCulledLayerPortions++;
282
+ }
283
+ if (meshTransparent) {
284
+ this._numTransparentLayerPortions++;
285
+ this.model.numTransparentLayerPortions++;
286
+ }
287
+ this._setFlags(portionId, flags, meshTransparent);
288
+ }
289
+
290
+ setVisible(portionId, flags, meshTransparent) {
291
+ if (!this._finalized) {
292
+ throw "Not finalized";
293
+ }
294
+ if (flags & ENTITY_FLAGS.VISIBLE) {
295
+ this._numVisibleLayerPortions++;
296
+ this.model.numVisibleLayerPortions++;
297
+ } else {
298
+ this._numVisibleLayerPortions--;
299
+ this.model.numVisibleLayerPortions--;
300
+ }
301
+ this._setFlags(portionId, flags, meshTransparent);
302
+ }
303
+
304
+ setHighlighted(portionId, flags, meshTransparent) {
305
+ if (!this._finalized) {
306
+ throw "Not finalized";
307
+ }
308
+ if (flags & ENTITY_FLAGS.HIGHLIGHTED) {
309
+ this._numHighlightedLayerPortions++;
310
+ this.model.numHighlightedLayerPortions++;
311
+ } else {
312
+ this._numHighlightedLayerPortions--;
313
+ this.model.numHighlightedLayerPortions--;
314
+ }
315
+ this._setFlags(portionId, flags, meshTransparent);
316
+ }
317
+
318
+ setXRayed(portionId, flags, meshTransparent) {
319
+ if (!this._finalized) {
320
+ throw "Not finalized";
321
+ }
322
+ if (flags & ENTITY_FLAGS.XRAYED) {
323
+ this._numXRayedLayerPortions++;
324
+ this.model.numXRayedLayerPortions++;
325
+ } else {
326
+ this._numXRayedLayerPortions--;
327
+ this.model.numXRayedLayerPortions--;
328
+ }
329
+ this._setFlags(portionId, flags, meshTransparent);
330
+ }
331
+
332
+ setSelected(portionId, flags, meshTransparent) {
333
+ if (!this._finalized) {
334
+ throw "Not finalized";
335
+ }
336
+ if (flags & ENTITY_FLAGS.SELECTED) {
337
+ this._numSelectedLayerPortions++;
338
+ this.model.numSelectedLayerPortions++;
339
+ } else {
340
+ this._numSelectedLayerPortions--;
341
+ this.model.numSelectedLayerPortions--;
342
+ }
343
+ this._setFlags(portionId, flags, meshTransparent);
344
+ }
345
+
346
+ setEdges(portionId, flags, meshTransparent) {
347
+ if (!this._finalized) {
348
+ throw "Not finalized";
349
+ }
350
+ if (flags & ENTITY_FLAGS.EDGES) {
351
+ this._numEdgesLayerPortions++;
352
+ this.model.numEdgesLayerPortions++;
353
+ } else {
354
+ this._numEdgesLayerPortions--;
355
+ this.model.numEdgesLayerPortions--;
356
+ }
357
+ this._setFlags(portionId, flags, meshTransparent);
358
+ }
359
+
360
+ setClippable(portionId, flags) {
361
+ if (!this._finalized) {
362
+ throw "Not finalized";
363
+ }
364
+ if (flags & ENTITY_FLAGS.CLIPPABLE) {
365
+ this._numClippableLayerPortions++;
366
+ this.model.numClippableLayerPortions++;
367
+ } else {
368
+ this._numClippableLayerPortions--;
369
+ this.model.numClippableLayerPortions--;
370
+ }
371
+ this._setFlags(portionId, flags);
372
+ }
373
+
374
+ setCollidable(portionId, flags) {
375
+ if (!this._finalized) {
376
+ throw "Not finalized";
377
+ }
378
+ }
379
+
380
+ setPickable(portionId, flags, meshTransparent) {
381
+ if (!this._finalized) {
382
+ throw "Not finalized";
383
+ }
384
+ if (flags & ENTITY_FLAGS.PICKABLE) {
385
+ this._numPickableLayerPortions++;
386
+ this.model.numPickableLayerPortions++;
387
+ } else {
388
+ this._numPickableLayerPortions--;
389
+ this.model.numPickableLayerPortions--;
390
+ }
391
+ this._setFlags(portionId, flags, meshTransparent);
392
+ }
393
+
394
+ setCulled(portionId, flags, meshTransparent) {
395
+ if (!this._finalized) {
396
+ throw "Not finalized";
397
+ }
398
+ if (flags & ENTITY_FLAGS.CULLED) {
399
+ this._numCulledLayerPortions++;
400
+ this.model.numCulledLayerPortions++;
401
+ } else {
402
+ this._numCulledLayerPortions--;
403
+ this.model.numCulledLayerPortions--;
404
+ }
405
+ this._setFlags(portionId, flags, meshTransparent);
406
+ }
407
+
408
+ setColor(portionId, color) { // RGBA color is normalized as ints
409
+ if (!this._finalized) {
410
+ throw "Not finalized";
411
+ }
412
+ tempUint8Vec4[0] = color[0];
413
+ tempUint8Vec4[1] = color[1];
414
+ tempUint8Vec4[2] = color[2];
415
+ tempUint8Vec4[3] = color[3];
416
+ this._state.colorsBuf.setData(tempUint8Vec4, portionId * 4, 4);
417
+ }
418
+
419
+ setTransparent(portionId, flags, transparent) {
420
+ if (transparent) {
421
+ this._numTransparentLayerPortions++;
422
+ this.model.numTransparentLayerPortions++;
423
+ } else {
424
+ this._numTransparentLayerPortions--;
425
+ this.model.numTransparentLayerPortions--;
426
+ }
427
+ this._setFlags(portionId, flags, transparent);
428
+ }
429
+
430
+ /**
431
+ * flags are 4bits values encoded on a 32bit base. color flag on the first 4 bits, silhouette flag on the next 4 bits and so on for edge, pick and clippable.
432
+ */
433
+ _setFlags(portionId, flags, meshTransparent) {
434
+
435
+ if (!this._finalized) {
436
+ throw "Not finalized";
437
+ }
438
+
439
+ const visible = !!(flags & ENTITY_FLAGS.VISIBLE);
440
+ const xrayed = !!(flags & ENTITY_FLAGS.XRAYED);
441
+ const highlighted = !!(flags & ENTITY_FLAGS.HIGHLIGHTED);
442
+ const selected = !!(flags & ENTITY_FLAGS.SELECTED);
443
+ const edges = !!(flags & ENTITY_FLAGS.EDGES);
444
+ const pickable = !!(flags & ENTITY_FLAGS.PICKABLE);
445
+ const culled = !!(flags & ENTITY_FLAGS.CULLED);
446
+
447
+ let colorFlag;
448
+ if (!visible || culled || xrayed
449
+ || (highlighted && !this.model.scene.highlightMaterial.glowThrough)
450
+ || (selected && !this.model.scene.selectedMaterial.glowThrough)) {
451
+ colorFlag = RENDER_PASSES.NOT_RENDERED;
452
+ } else {
453
+ if (meshTransparent) {
454
+ colorFlag = RENDER_PASSES.COLOR_TRANSPARENT;
455
+ } else {
456
+ colorFlag = RENDER_PASSES.COLOR_OPAQUE;
457
+ }
458
+ }
459
+
460
+ let silhouetteFlag;
461
+ if (!visible || culled) {
462
+ silhouetteFlag = RENDER_PASSES.NOT_RENDERED;
463
+ } else if (selected) {
464
+ silhouetteFlag = RENDER_PASSES.SILHOUETTE_SELECTED;
465
+ } else if (highlighted) {
466
+ silhouetteFlag = RENDER_PASSES.SILHOUETTE_HIGHLIGHTED;
467
+ } else if (xrayed) {
468
+ silhouetteFlag = RENDER_PASSES.SILHOUETTE_XRAYED;
469
+ } else {
470
+ silhouetteFlag = RENDER_PASSES.NOT_RENDERED;
471
+ }
472
+
473
+ let edgeFlag = 0;
474
+ if (!visible || culled) {
475
+ edgeFlag = RENDER_PASSES.NOT_RENDERED;
476
+ } else if (selected) {
477
+ edgeFlag = RENDER_PASSES.EDGES_SELECTED;
478
+ } else if (highlighted) {
479
+ edgeFlag = RENDER_PASSES.EDGES_HIGHLIGHTED;
480
+ } else if (xrayed) {
481
+ edgeFlag = RENDER_PASSES.EDGES_XRAYED;
482
+ } else if (edges) {
483
+ if (meshTransparent) {
484
+ edgeFlag = RENDER_PASSES.EDGES_COLOR_TRANSPARENT;
485
+ } else {
486
+ edgeFlag = RENDER_PASSES.EDGES_COLOR_OPAQUE;
487
+ }
488
+ } else {
489
+ edgeFlag = RENDER_PASSES.NOT_RENDERED;
490
+ }
491
+
492
+ let pickFlag = (visible && !culled && pickable) ? RENDER_PASSES.PICK : RENDER_PASSES.NOT_RENDERED;
493
+
494
+ const clippableFlag = !!(flags & ENTITY_FLAGS.CLIPPABLE) ? 255 : 0;
495
+
496
+ let vertFlag = 0;
497
+ vertFlag |= colorFlag;
498
+ vertFlag |= silhouetteFlag << 4;
499
+ vertFlag |= edgeFlag << 8;
500
+ vertFlag |= pickFlag << 12;
501
+ vertFlag |= clippableFlag << 16;
502
+
503
+ tempFloat32[0] = vertFlag;
504
+
505
+ this._state.flagsBuf.setData(tempFloat32, portionId);
506
+ }
507
+
508
+ setOffset(portionId, offset) {
509
+ if (!this._finalized) {
510
+ throw "Not finalized";
511
+ }
512
+ if (!this.model.scene.entityOffsetsEnabled) {
513
+ this.model.error("Entity#offset not enabled for this Viewer"); // See Viewer entityOffsetsEnabled
514
+ return;
515
+ }
516
+ tempVec3fa[0] = offset[0];
517
+ tempVec3fa[1] = offset[1];
518
+ tempVec3fa[2] = offset[2];
519
+ this._state.offsetsBuf.setData(tempVec3fa, portionId * 3, 3);
520
+ }
521
+
522
+ // ---------------------- NORMAL RENDERING -----------------------------------
523
+
524
+ drawColorOpaque(renderFlags, frameCtx) {
525
+ if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0 || this._numTransparentLayerPortions === this._numPortions || this._numXRayedLayerPortions === this._numPortions) {
526
+ return;
527
+ }
528
+
529
+ if (this._linesInstancingRenderers.colorRenderer) {
530
+ this._linesInstancingRenderers.colorRenderer.drawLayer(frameCtx, this, RENDER_PASSES.COLOR_OPAQUE);
531
+ }
532
+ }
533
+
534
+ drawColorTransparent(renderFlags, frameCtx) {
535
+ if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0 || this._numTransparentLayerPortions === 0 || this._numXRayedLayerPortions === this._numPortions) {
536
+ return;
537
+ }
538
+ if (this._linesInstancingRenderers.colorRenderer) {
539
+ this._linesInstancingRenderers.colorRenderer.drawLayer(frameCtx, this, RENDER_PASSES.COLOR_TRANSPARENT);
540
+ }
541
+ }
542
+
543
+ // ---------------------- RENDERING SAO POST EFFECT TARGETS --------------
544
+
545
+ drawDepth(renderFlags, frameCtx) {
546
+ }
547
+
548
+ drawNormals(renderFlags, frameCtx) {
549
+ }
550
+
551
+ // ---------------------- EMPHASIS RENDERING -----------------------------------
552
+
553
+ drawSilhouetteXRayed(renderFlags, frameCtx) {
554
+ if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0 || this._numXRayedLayerPortions === 0) {
555
+ return;
556
+ }
557
+ if (this._linesInstancingRenderers.silhouetteRenderer) {
558
+ this._linesInstancingRenderers.silhouetteRenderer.drawLayer(frameCtx, this, RENDER_PASSES.SILHOUETTE_XRAYED);
559
+ }
560
+ }
561
+
562
+ drawSilhouetteHighlighted(renderFlags, frameCtx) {
563
+ if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0 || this._numHighlightedLayerPortions === 0) {
564
+ return;
565
+ }
566
+ if (this._linesInstancingRenderers.silhouetteRenderer) {
567
+ this._linesInstancingRenderers.silhouetteRenderer.drawLayer(frameCtx, this, RENDER_PASSES.SILHOUETTE_HIGHLIGHTED);
568
+ }
569
+ }
570
+
571
+ drawSilhouetteSelected(renderFlags, frameCtx) {
572
+ if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0 || this._numSelectedLayerPortions === 0) {
573
+ return;
574
+ }
575
+ if (this._linesInstancingRenderers.silhouetteRenderer) {
576
+ this._linesInstancingRenderers.silhouetteRenderer.drawLayer(frameCtx, this, RENDER_PASSES.SILHOUETTE_SELECTED);
577
+ }
578
+ }
579
+
580
+ // ---------------------- EDGES RENDERING -----------------------------------
581
+
582
+ drawEdgesColorOpaque(renderFlags, frameCtx) {
583
+ }
584
+
585
+ drawEdgesColorTransparent(renderFlags, frameCtx) {
586
+ }
587
+
588
+ drawEdgesXRayed(renderFlags, frameCtx) {
589
+ }
590
+
591
+ drawEdgesHighlighted(renderFlags, frameCtx) {
592
+ }
593
+
594
+ drawEdgesSelected(renderFlags, frameCtx) {
595
+ }
596
+
597
+ // ---------------------- OCCLUSION CULL RENDERING -----------------------------------
598
+
599
+ drawOcclusion(renderFlags, frameCtx) {
600
+ }
601
+
602
+ // ---------------------- SHADOW BUFFER RENDERING -----------------------------------
603
+
604
+ drawShadow(renderFlags, frameCtx) {
605
+ }
606
+
607
+ //---- PICKING ----------------------------------------------------------------------------------------------------
608
+
609
+ drawPickMesh(renderFlags, frameCtx) {
610
+ }
611
+
612
+ drawPickDepths(renderFlags, frameCtx) {
613
+ }
614
+
615
+ drawPickNormals(renderFlags, frameCtx) {
616
+ }
617
+
618
+
619
+ destroy() {
620
+ const state = this._state;
621
+ if (state.positionsBuf) {
622
+ state.positionsBuf.destroy();
623
+ state.positionsBuf = null;
624
+ }
625
+ if (state.colorsBuf) {
626
+ state.colorsBuf.destroy();
627
+ state.colorsBuf = null;
628
+ }
629
+ if (state.flagsBuf) {
630
+ state.flagsBuf.destroy();
631
+ state.flagsBuf = null;
632
+ }
633
+ if (state.offsetsBuf) {
634
+ state.offsetsBuf.destroy();
635
+ state.offsetsBuf = null;
636
+ }
637
+ if (state.modelMatrixCol0Buf) {
638
+ state.modelMatrixCol0Buf.destroy();
639
+ state.modelMatrixCol0Buf = null;
640
+ }
641
+ if (state.modelMatrixCol1Buf) {
642
+ state.modelMatrixCol1Buf.destroy();
643
+ state.modelMatrixCol1Buf = null;
644
+ }
645
+ if (state.modelMatrixCol2Buf) {
646
+ state.modelMatrixCol2Buf.destroy();
647
+ state.modelMatrixCol2Buf = null;
648
+ }
649
+ state.destroy();
650
+ }
651
+ }
652
+
653
+ export {LinesInstancingLayer};