csyjk 1.1.1 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (323) hide show
  1. package/.babelrc +7 -0
  2. package/.idea/modules.xml +8 -0
  3. package/.idea/xx.iml +12 -0
  4. package/dist/app.js +43 -0
  5. package/{index.html → dist/index.html} +0 -0
  6. package/{style.css → dist/style.css} +1 -1
  7. package/package.json +40 -5
  8. package/public/gltf.js +2241 -0
  9. package/public/index.html +10 -0
  10. package/src/index.js +3 -0
  11. package/src/lib/gltf/assets/check.jpg +0 -0
  12. package/src/lib/gltf/assets/iconfont/iconfont.css +358 -0
  13. package/src/lib/gltf/assets/iconfont/iconfont.eot +0 -0
  14. package/src/lib/gltf/assets/iconfont/iconfont.js +1 -0
  15. package/src/lib/gltf/assets/iconfont/iconfont.json +604 -0
  16. package/src/lib/gltf/assets/iconfont/iconfont.svg +189 -0
  17. package/src/lib/gltf/assets/iconfont/iconfont.ttf +0 -0
  18. package/src/lib/gltf/assets/iconfont/iconfont.woff +0 -0
  19. package/src/lib/gltf/assets/iconfont/iconfont.woff2 +0 -0
  20. package/src/lib/gltf/assets/yjkkit-sdk/index.js +0 -0
  21. package/src/lib/gltf/assets/yjkkit-sdk/package.json +15 -0
  22. package/src/lib/gltf/assets/yjkkit-sdk/src/extras/ContextMenu/ContextMenu.js +863 -0
  23. package/src/lib/gltf/assets/yjkkit-sdk/src/extras/ContextMenu/index.js +1 -0
  24. package/src/lib/gltf/assets/yjkkit-sdk/src/extras/index.js +1 -0
  25. package/src/lib/gltf/assets/yjkkit-sdk/src/index.js +3 -0
  26. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AngleMeasurementsPlugin/AngleMeasurement.js +462 -0
  27. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsControl.js +279 -0
  28. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsPlugin.js +262 -0
  29. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AngleMeasurementsPlugin/index.js +1 -0
  30. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AnnotationsPlugin/Annotation.js +362 -0
  31. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AnnotationsPlugin/AnnotationsPlugin.js +575 -0
  32. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AnnotationsPlugin/index.js +1 -0
  33. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AxisGizmoPlugin/AxisGizmoPlugin.js +333 -0
  34. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AxisGizmoPlugin/index.js +1 -0
  35. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/BCFViewpointsPlugin/BCFViewpointsPlugin.js +777 -0
  36. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/BCFViewpointsPlugin/index.js +1 -0
  37. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js +525 -0
  38. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsControl.js +242 -0
  39. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsPlugin.js +297 -0
  40. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/DistanceMeasurementsPlugin/index.js +1 -0
  41. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/FastNavPlugin/FastNavPlugin.js +345 -0
  42. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/FastNavPlugin/index.js +1 -0
  43. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/GLTFLoaderPlugin/GLTFDefaultDataSource.js +122 -0
  44. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/GLTFLoaderPlugin/GLTFLoaderPlugin.js +462 -0
  45. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/GLTFLoaderPlugin/GLTFPerformanceModelLoader.js +508 -0
  46. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/GLTFLoaderPlugin/GLTFSceneGraphLoader.js +922 -0
  47. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/GLTFLoaderPlugin/index.js +2 -0
  48. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/NavCubePlugin/CubeTextureCanvas.js +273 -0
  49. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/NavCubePlugin/NavCubePlugin.js +687 -0
  50. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/NavCubePlugin/index.js +1 -0
  51. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/OBJLoaderPlugin/OBJLoaderPlugin.js +145 -0
  52. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/OBJLoaderPlugin/OBJSceneGraphLoader.js +777 -0
  53. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/OBJLoaderPlugin/index.js +1 -0
  54. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/STLLoaderPlugin/STLDefaultDataSource.js +33 -0
  55. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/STLLoaderPlugin/STLLoaderPlugin.js +273 -0
  56. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/STLLoaderPlugin/STLSceneGraphLoader.js +313 -0
  57. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/STLLoaderPlugin/index.js +2 -0
  58. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/SectionPlanesPlugin/Control.js +1328 -0
  59. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/SectionPlanesPlugin/Overview.js +249 -0
  60. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/SectionPlanesPlugin/Plane.js +169 -0
  61. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/SectionPlanesPlugin/SectionPlanesPlugin.js +403 -0
  62. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/SectionPlanesPlugin/index.js +1 -0
  63. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/SkyboxesPlugin/SkyboxesPlugin.js +134 -0
  64. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/SkyboxesPlugin/index.js +1 -0
  65. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/StoreyViewsPlugin/IFCStoreyPlanObjectStates.js +77 -0
  66. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/StoreyViewsPlugin/Storey.js +61 -0
  67. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/StoreyViewsPlugin/StoreyMap.js +57 -0
  68. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/StoreyViewsPlugin/StoreyViewsPlugin.js +822 -0
  69. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/StoreyViewsPlugin/index.js +1 -0
  70. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/TreeViewPlugin/ModelTreeView.js +888 -0
  71. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/TreeViewPlugin/TreeViewNode.js +88 -0
  72. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/TreeViewPlugin/TreeViewPlugin.js +624 -0
  73. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/TreeViewPlugin/index.js +1 -0
  74. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/TreeViewPlugin/modelValidation.js +87 -0
  75. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/ViewCullPlugin/ViewCullPlugin.js +295 -0
  76. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/ViewCullPlugin/index.js +1 -0
  77. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/XKTDefaultDataSource.js +78 -0
  78. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js +847 -0
  79. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/index.js +2 -0
  80. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV1.js +167 -0
  81. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV2.js +228 -0
  82. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV3.js +220 -0
  83. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV4.js +279 -0
  84. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV5.js +244 -0
  85. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV6.js +301 -0
  86. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV7.js +426 -0
  87. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV8.js +479 -0
  88. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/lib/pako.js +6818 -0
  89. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/XML3DLoaderPlugin.js +238 -0
  90. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/XML3DSceneGraphLoader.js +1279 -0
  91. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/index.js +1 -0
  92. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/.jshintrc +11 -0
  93. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/deflate.js +2060 -0
  94. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/inflate.js +2155 -0
  95. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/mime-types.js +1002 -0
  96. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/pako/codecs.js +64 -0
  97. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/z-worker.js +153 -0
  98. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/zip-ext.js +267 -0
  99. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/zip-fs.js +553 -0
  100. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/zip.js +991 -0
  101. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/zlib-asm/codecs.js +49 -0
  102. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/index.js +17 -0
  103. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/lib/culling/ObjectCullStates.js +205 -0
  104. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/lib/html/Dot.js +78 -0
  105. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/lib/html/Label.js +97 -0
  106. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/lib/html/Wire.js +95 -0
  107. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/Plugin.js +112 -0
  108. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/Viewer.js +372 -0
  109. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/index.js +3 -0
  110. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/metadata/IFCObjectDefaultColors.js +162 -0
  111. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/metadata/IFCObjectDefaults.js +39 -0
  112. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/metadata/MetaModel.js +145 -0
  113. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/metadata/MetaObject.js +215 -0
  114. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/metadata/MetaScene.js +311 -0
  115. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/CameraControl.js +1669 -0
  116. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/cc.js +0 -0
  117. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/CameraUpdater.js +312 -0
  118. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/controllers/PanController.js +112 -0
  119. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/controllers/PickController.js +193 -0
  120. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/controllers/PivotController.js +289 -0
  121. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/cu.js +0 -0
  122. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/KeyboardAxisViewHandler.js +122 -0
  123. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/KeyboardPanRotateDollyHandler.js +186 -0
  124. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/MouseMiscHandler.js +68 -0
  125. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/MousePanRotateDollyHandler.js +439 -0
  126. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/MousePickHandler.js +361 -0
  127. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/TouchPanRotateAndDollyHandler.js +258 -0
  128. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/TouchPickHandler.js +197 -0
  129. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/mouspan.js +498 -0
  130. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/Component.js +908 -0
  131. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/Entity.js +475 -0
  132. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/ImagePlane/ImagePlane.js +570 -0
  133. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/ImagePlane/index.js +1 -0
  134. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/PerformanceModel.js +2623 -0
  135. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/index.js +1 -0
  136. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/ENTITY_FLAGS.js +21 -0
  137. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/PerformanceMesh.js +262 -0
  138. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/PerformanceNode.js +697 -0
  139. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/RENDER_PASSES.js +34 -0
  140. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/ScratchMemory.js +63 -0
  141. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/compression.js +183 -0
  142. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesBatching/LinesBatchingBuffer.js +33 -0
  143. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesBatching/LinesBatchingLayer.js +736 -0
  144. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesBatching/LinesBatchingRenderers.js +68 -0
  145. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesBatching/renderers/LinesBatchingColorRenderer.js +295 -0
  146. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesBatching/renderers/LinesBatchingSilhouetteRenderer.js +327 -0
  147. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesInstancing/LinesInstancingLayer.js +698 -0
  148. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesInstancing/LinesInstancingRenderers.js +68 -0
  149. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesInstancing/renderers/LinesInstancingColorRenderer.js +364 -0
  150. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesInstancing/renderers/LinesInstancingSilhouetteRenderer.js +356 -0
  151. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/PointsBatchingBuffer.js +33 -0
  152. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/PointsBatchingLayer.js +776 -0
  153. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/PointsBatchingRenderers.js +113 -0
  154. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/renderers/PointsBatchingColorRenderer.js +340 -0
  155. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/renderers/PointsBatchingOcclusionRenderer.js +312 -0
  156. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/renderers/PointsBatchingPickDepthRenderer.js +343 -0
  157. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/renderers/PointsBatchingPickMeshRenderer.js +331 -0
  158. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/renderers/PointsBatchingShadowRenderer.js +242 -0
  159. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/renderers/PointsBatchingSilhouetteRenderer.js +348 -0
  160. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/PointsInstancingLayer.js +737 -0
  161. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/PointsInstancingRenderers.js +143 -0
  162. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/renderers/PointsInstancingColorRenderer.js +373 -0
  163. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/renderers/PointsInstancingDepthRenderer.js +366 -0
  164. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/renderers/PointsInstancingOcclusionRenderer.js +370 -0
  165. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/renderers/PointsInstancingPickDepthRenderer.js +386 -0
  166. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/renderers/PointsInstancingPickMeshRenderer.js +376 -0
  167. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/renderers/PointsInstancingShadowRenderer.js +293 -0
  168. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/renderers/PointsInstancingSilhouetteRenderer.js +382 -0
  169. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/TrianglesBatchingBuffer.js +37 -0
  170. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/TrianglesBatchingLayer.js +1017 -0
  171. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/TrianglesBatchingRenderers.js +246 -0
  172. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingColorQualityRenderer.js +809 -0
  173. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingColorRenderer.js +504 -0
  174. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingDepthRenderer.js +297 -0
  175. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingEdgesColorRenderer.js +300 -0
  176. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingEdgesRenderer.js +322 -0
  177. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingNormalsRenderer.js +311 -0
  178. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingOcclusionRenderer.js +291 -0
  179. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingPickDepthRenderer.js +319 -0
  180. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingPickMeshRenderer.js +305 -0
  181. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingPickNormalsRenderer.js +300 -0
  182. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingShadowRenderer.js +242 -0
  183. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingSilhouetteRenderer.js +323 -0
  184. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/TrianglesInstancingLayer.js +969 -0
  185. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/TrianglesInstancingRenderers.js +246 -0
  186. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingColorQualityRenderer.js +859 -0
  187. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingColorRenderer.js +557 -0
  188. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingDepthRenderer.js +341 -0
  189. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingEdgesColorRenderer.js +338 -0
  190. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingEdgesRenderer.js +356 -0
  191. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingNormalsRenderer.js +354 -0
  192. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingOcclusionRenderer.js +329 -0
  193. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingPickDepthRenderer.js +358 -0
  194. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingPickMeshRenderer.js +349 -0
  195. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingPickNormalsRenderer.js +363 -0
  196. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingShadowRenderer.js +284 -0
  197. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingSilhouetteRenderer.js +354 -0
  198. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/Camera.js +880 -0
  199. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/CameraFlightAnimation.js +669 -0
  200. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/CameraPath.js +194 -0
  201. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/CameraPathAnimation.js +326 -0
  202. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/CustomProjection.js +149 -0
  203. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/Frustum.js +316 -0
  204. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/Ortho.js +286 -0
  205. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/Perspective.js +302 -0
  206. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/index.js +2 -0
  207. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/canvas/Canvas.js +464 -0
  208. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/canvas/Spinner.js +323 -0
  209. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/core.js +234 -0
  210. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/Geometry.js +33 -0
  211. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/ReadableGeometry.js +689 -0
  212. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/VBOGeometry.js +327 -0
  213. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildBoxGeometry.js +238 -0
  214. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildBoxLinesGeometry.js +106 -0
  215. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildCylinderGeometry.js +271 -0
  216. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildGridGeometry.js +102 -0
  217. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildPlaneGeometry.js +168 -0
  218. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildSphereGeometry.js +161 -0
  219. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildTorusGeometry.js +172 -0
  220. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildVectorTextGeometry.js +1721 -0
  221. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/index.js +8 -0
  222. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/index.js +4 -0
  223. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/loaders/index.js +2 -0
  224. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/loaders/load3DSGeometry.js +103 -0
  225. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/loaders/loadOBJGeometry.js +130 -0
  226. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/index.js +18 -0
  227. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/input/Input.js +1475 -0
  228. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/libs/canvas2image.js +218 -0
  229. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/libs/k3d.js +1032 -0
  230. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/AmbientLight.js +175 -0
  231. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/CubeTexture.js +156 -0
  232. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/DirLight.js +314 -0
  233. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/Light.js +29 -0
  234. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/LightMap.js +77 -0
  235. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/PointLight.js +395 -0
  236. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/ReflectionMap.js +79 -0
  237. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/Shadow.js +138 -0
  238. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/index.js +5 -0
  239. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/marker/Marker.js +382 -0
  240. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/marker/index.js +1 -0
  241. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/EdgeMaterial.js +359 -0
  242. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/EmphasisMaterial.js +577 -0
  243. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/Fresnel.js +222 -0
  244. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/LambertMaterial.js +378 -0
  245. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/LinesMaterial.js +169 -0
  246. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/Material.js +39 -0
  247. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/MetallicMaterial.js +820 -0
  248. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/PhongMaterial.js +860 -0
  249. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/PointsMaterial.js +320 -0
  250. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/SpecularMaterial.js +807 -0
  251. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/Texture.js +522 -0
  252. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/index.js +8 -0
  253. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/math/Frustum.js +118 -0
  254. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/math/buildEdgeIndices.js +162 -0
  255. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/math/geometryCompressionUtils.js +353 -0
  256. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/math/index.js +1 -0
  257. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/math/math.js +5302 -0
  258. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/math/rtcCoords.js +132 -0
  259. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mementos/CameraMemento.js +200 -0
  260. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mementos/ModelMemento.js +272 -0
  261. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mementos/ObjectsMemento.js +259 -0
  262. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mementos/index.js +3 -0
  263. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/Mesh.js +2165 -0
  264. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/draw/DrawRenderer.js +978 -0
  265. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/draw/DrawShaderSource.js +1566 -0
  266. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/emphasis/EmphasisEdgesRenderer.js +249 -0
  267. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/emphasis/EmphasisEdgesShaderSource.js +163 -0
  268. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/emphasis/EmphasisFillRenderer.js +276 -0
  269. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/emphasis/EmphasisFillShaderSource.js +269 -0
  270. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/index.js +1 -0
  271. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/occlusion/OcclusionRenderer.js +207 -0
  272. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/occlusion/OcclusionShaderSource.js +156 -0
  273. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/pick/PickMeshRenderer.js +210 -0
  274. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/pick/PickMeshShaderSource.js +146 -0
  275. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/pick/PickTriangleRenderer.js +186 -0
  276. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/pick/PickTriangleShaderSource.js +120 -0
  277. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/shadow/ShadowRenderer.js +214 -0
  278. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/shadow/ShadowShaderSource.js +96 -0
  279. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/metriqs/Metriqs.js +259 -0
  280. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/nodes/Node.js +1356 -0
  281. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/nodes/index.js +1 -0
  282. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/paths/CubicBezierCurve.js +194 -0
  283. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/paths/Curve.js +183 -0
  284. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/paths/Path.js +239 -0
  285. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/paths/QuadraticBezierCurve.js +161 -0
  286. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/paths/SplineCurve.js +133 -0
  287. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/paths/index.js +5 -0
  288. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/postfx/SAO.js +547 -0
  289. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/scene/Scene.js +2481 -0
  290. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/sectionPlane/SectionPlane.js +194 -0
  291. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/sectionPlane/index.js +1 -0
  292. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/skybox/Skybox.js +119 -0
  293. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/skybox/index.js +1 -0
  294. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/stats.js +45 -0
  295. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/utils/Map.js +45 -0
  296. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/utils/Queue.js +56 -0
  297. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/utils/index.js +2 -0
  298. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/utils.js +452 -0
  299. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/viewport/Viewport.js +212 -0
  300. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/ArrayBuf.js +121 -0
  301. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Attribute.js +23 -0
  302. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Drawable.js +270 -0
  303. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/FrameContext.js +259 -0
  304. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/PickResult.js +317 -0
  305. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Pickable.js +69 -0
  306. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Program.js +179 -0
  307. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/RenderBuffer.js +315 -0
  308. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/RenderFlags.js +203 -0
  309. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/RenderState.js +40 -0
  310. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Renderer.js +1300 -0
  311. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Sampler.js +18 -0
  312. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Shader.js +49 -0
  313. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Texture2D.js +217 -0
  314. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/occlusion/OcclusionLayer.js +214 -0
  315. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/occlusion/OcclusionTester.js +432 -0
  316. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/sao/SAODepthLimitedBlurRenderer.js +326 -0
  317. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/sao/SAOOcclusionRenderer.js +375 -0
  318. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/webglEnums.js +61 -0
  319. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webglInfo.js +48 -0
  320. package/src/lib/gltf/gltf.css +392 -0
  321. package/src/lib/gltf/gltf.js +2241 -0
  322. package/webpack.config.js +70 -0
  323. package/app.js +0 -43
@@ -0,0 +1,847 @@
1
+ import {utils} from "../../viewer/scene/utils.js"
2
+ import {PerformanceModel} from "../../viewer/scene/PerformanceModel/PerformanceModel.js";
3
+ import {Plugin} from "../../viewer/Plugin.js";
4
+ import {XKTDefaultDataSource} from "./XKTDefaultDataSource.js";
5
+ import {IFCObjectDefaults} from "../../viewer/metadata/IFCObjectDefaults.js";
6
+
7
+ import {ParserV1} from "./parsers/ParserV1.js";
8
+ import {ParserV2} from "./parsers/ParserV2.js";
9
+ import {ParserV3} from "./parsers/ParserV3.js";
10
+ import {ParserV4} from "./parsers/ParserV4.js";
11
+ import {ParserV5} from "./parsers/ParserV5.js";
12
+ import {ParserV6} from "./parsers/ParserV6.js";
13
+ import {ParserV7} from "./parsers/ParserV7.js";
14
+ import {ParserV8} from "./parsers/ParserV8.js";
15
+
16
+ const parsers = {};
17
+
18
+ parsers[ParserV1.version] = ParserV1;
19
+ parsers[ParserV2.version] = ParserV2;
20
+ parsers[ParserV3.version] = ParserV3;
21
+ parsers[ParserV4.version] = ParserV4;
22
+ parsers[ParserV5.version] = ParserV5;
23
+ parsers[ParserV6.version] = ParserV6;
24
+ parsers[ParserV7.version] = ParserV7;
25
+ parsers[ParserV8.version] = ParserV8;
26
+
27
+ /**
28
+ * {@link Viewer} plugin that loads models from yjkkit's optimized *````.XKT````* format.
29
+ *
30
+ * <a href="https://yjkkit.github.io/yjkkit-sdk/examples/#loading_XKT_OTCConferenceCenter"><img src="http://yjkkit.io/img/docs/XKTLoaderPlugin/XKTLoaderPlugin.png"></a>
31
+ *
32
+ * [[Run this example](https://yjkkit.github.io/yjkkit-sdk/examples/#loading_XKT_OTCConferenceCenter)]
33
+ *
34
+ * ## Overview
35
+ *
36
+ * * XKTLoaderPlugin is the most efficient way to load high-detail models into yjkkit.
37
+ * * An *````.XKT````* file is a single BLOB containing a model, compressed using geometry quantization
38
+ * and [pako](https://nodeca.github.io/pako/).
39
+ * * Supports double-precision coordinates, via ````.XKT```` format version 6.
40
+ * * Set the position, scale and rotation of each model as you load it.
41
+ * * Filter which IFC types get loaded.
42
+ * * Configure initial default appearances for IFC types.
43
+ * * Set a custom data source for *````.XKT````* and IFC metadata files.
44
+ * * Option to load multiple copies of the same model, without object ID clashes.
45
+ * * Does not (yet) support textures or physically-based materials.
46
+ *
47
+ * ## Credits
48
+ *
49
+ * XKTLoaderPlugin and the ````yjkkit-gltf-to-xkt```` tool (see below) are based on prototypes
50
+ * by [Toni Marti](https://github.com/tmarti) at [uniZite](https://www.unizite.com/login).
51
+ *
52
+ * ## Creating *````.XKT````* Files and Metadata
53
+ *
54
+ * See [Creating Files for Offline BIM](https://github.com/yjkkit/yjkkit-sdk/wiki/Creating-Files-for-Offline-BIM).
55
+ *
56
+ * ## Scene representation
57
+ *
58
+ * When loading a model, XKTLoaderPlugin creates an {@link Entity} that represents the model, which
59
+ * will have {@link Entity#isModel} set ````true```` and will be registered by {@link Entity#id}
60
+ * in {@link Scene#models}. The XKTLoaderPlugin also creates an {@link Entity} for each object within the
61
+ * model. Those Entities will have {@link Entity#isObject} set ````true```` and will be registered
62
+ * by {@link Entity#id} in {@link Scene#objects}.
63
+ *
64
+ * ## Metadata
65
+ *
66
+ * Since XKT V8, model metadata is included in the XKT file. If the XKT file has metadata, then loading it creates
67
+ * model metadata components within the Viewer, namely a {@link MetaModel} corresponding to the model {@link Entity},
68
+ * and a {@link MetaObject} for each object {@link Entity}.
69
+ *
70
+ * Each {@link MetaObject} has a {@link MetaObject#type}, which indicates the classification of its corresponding
71
+ * {@link Entity}. When loading metadata, we can also configure XKTLoaderPlugin with a custom lookup table of initial
72
+ * values to set on the properties of each type of {@link Entity}. By default, XKTLoaderPlugin uses its own map of
73
+ * default colors and visibilities for IFC element types.
74
+ *
75
+ * For XKT versions prior to V8, we provided the metadata to XKTLoaderPlugin as an accompanying JSON file to load. We can
76
+ * still do that for all XKT versions, and for XKT V8+ it will override any metadata provided within the XKT file.
77
+ *
78
+ * ## Usage
79
+ *
80
+ * In the example below we'll load the Schependomlaan model from a [.XKT file](https://github.com/yjkkit/yjkkit-sdk/tree/master/examples/models/xkt/schependomlaan).
81
+ *
82
+ * This will create a bunch of {@link Entity}s that represents the model and its objects, along with a {@link MetaModel} and {@link MetaObject}s
83
+ * that hold their metadata.
84
+ *
85
+ * Since this model contains IFC types, the XKTLoaderPlugin will set the initial appearance of each object
86
+ * {@link Entity} according to its IFC type in {@link XKTLoaderPlugin#objectDefaults}.
87
+ *
88
+ * Read more about this example in the user guide on [Viewing BIM Models Offline](https://www.notion.so/yjkkit/Viewing-an-IFC-Model-with-yjkkit-c373e48bc4094ff5b6e5c5700ff580ee).
89
+ *
90
+ * * [[Run example](https://yjkkit.github.io/yjkkit-sdk/examples/#BIMOffline_XKT_metadata_Schependomlaan)]
91
+ *
92
+ * ````javascript
93
+ * import {Viewer, XKTLoaderPlugin} from "yjkkit-sdk.es.js";
94
+ *
95
+ * //------------------------------------------------------------------------------------------------------------------
96
+ * // 1. Create a Viewer,
97
+ * // 2. Arrange the camera
98
+ * //------------------------------------------------------------------------------------------------------------------
99
+ *
100
+ * // 1
101
+ * const viewer = new Viewer({
102
+ * canvasId: "myCanvas",
103
+ * transparent: true
104
+ * });
105
+ *
106
+ * // 2
107
+ * viewer.camera.eye = [-2.56, 8.38, 8.27];
108
+ * viewer.camera.look = [13.44, 3.31, -14.83];
109
+ * viewer.camera.up = [0.10, 0.98, -0.14];
110
+ *
111
+ * //------------------------------------------------------------------------------------------------------------------
112
+ * // 1. Create a XKTLoaderPlugin,
113
+ * // 2. Load a building model and JSON IFC metadata
114
+ * //------------------------------------------------------------------------------------------------------------------
115
+ *
116
+ * // 1
117
+ * const xktLoader = new XKTLoaderPlugin(viewer);
118
+ *
119
+ * // 2
120
+ * const model = xktLoader.load({ // Returns an Entity that represents the model
121
+ * id: "myModel",
122
+ * src: "./models/xkt/Schependomlaan.xkt",
123
+ * edges: true
124
+ * });
125
+ *
126
+ * model.on("loaded", () => {
127
+ *
128
+ * //--------------------------------------------------------------------------------------------------------------
129
+ * // 1. Find metadata on the third storey
130
+ * // 2. Select all the objects in the building's third storey
131
+ * // 3. Fit the camera to all the objects on the third storey
132
+ * //--------------------------------------------------------------------------------------------------------------
133
+ *
134
+ * // 1
135
+ * const metaModel = viewer.metaScene.metaModels["myModel"]; // MetaModel with ID "myModel"
136
+ * const metaObject
137
+ * = viewer.metaScene.metaObjects["0u4wgLe6n0ABVaiXyikbkA"]; // MetaObject with ID "0u4wgLe6n0ABVaiXyikbkA"
138
+ *
139
+ * const name = metaObject.name; // "01 eerste verdieping"
140
+ * const type = metaObject.type; // "IfcBuildingStorey"
141
+ * const parent = metaObject.parent; // MetaObject with type "IfcBuilding"
142
+ * const children = metaObject.children; // Array of child MetaObjects
143
+ * const objectId = metaObject.id; // "0u4wgLe6n0ABVaiXyikbkA"
144
+ * const objectIds = viewer.metaScene.getObjectIDsInSubtree(objectId); // IDs of leaf sub-objects
145
+ * const aabb = viewer.scene.getAABB(objectIds); // Axis-aligned boundary of the leaf sub-objects
146
+ *
147
+ * // 2
148
+ * viewer.scene.setObjectsSelected(objectIds, true);
149
+ *
150
+ * // 3
151
+ * viewer.cameraFlight.flyTo(aabb);
152
+ * });
153
+ *
154
+ * // Find the model Entity by ID
155
+ * model = viewer.scene.models["myModel"];
156
+ *
157
+ * // Destroy the model
158
+ * model.destroy();
159
+ * ````
160
+ *
161
+ * ## Transforming
162
+ *
163
+ * We have the option to rotate, scale and translate each *````.XKT````* model as we load it.
164
+ *
165
+ * This lets us load multiple models, or even multiple copies of the same model, and position them apart from each other.
166
+ *
167
+ * In the example below, we'll scale our model to half its size, rotate it 90 degrees about its local X-axis, then
168
+ * translate it 100 units along its X axis.
169
+ *
170
+ * * [[Run example](https://yjkkit.github.io/yjkkit-sdk/examples/#loading_XKT_Duplex_transform)]
171
+ *
172
+ * ````javascript
173
+ * xktLoader.load({
174
+ * src: "./models/xkt/Duplex.xkt",
175
+ * rotation: [90,0,0],
176
+ * scale: [0.5, 0.5, 0.5],
177
+ * position: [100, 0, 0]
178
+ * });
179
+ * ````
180
+ *
181
+ * ## Including and excluding IFC types
182
+ *
183
+ * We can also load only those objects that have the specified IFC types.
184
+ *
185
+ * In the example below, we'll load only the objects that represent walls.
186
+ *
187
+ * * [[Run example](https://yjkkit.github.io/yjkkit-sdk/examples/#BIMOffline_XKT_includeTypes)]
188
+ *
189
+ * ````javascript
190
+ * const model2 = xktLoader.load({
191
+ * id: "myModel2",
192
+ * src: "./models/xkt/OTCConferenceCenter.xkt",
193
+ * includeTypes: ["IfcWallStandardCase"]
194
+ * });
195
+ * ````
196
+ *
197
+ * We can also load only those objects that **don't** have the specified IFC types.
198
+ *
199
+ * In the example below, we'll load only the objects that do not represent empty space.
200
+ *
201
+ * * [[Run example](https://yjkkit.github.io/yjkkit-sdk/examples/#BIMOffline_XKT_excludeTypes)]
202
+ *
203
+ * ````javascript
204
+ * const model3 = xktLoader.load({
205
+ * id: "myModel3",
206
+ * src: "./models/xkt/OTCConferenceCenter.xkt",
207
+ * excludeTypes: ["IfcSpace"]
208
+ * });
209
+ * ````
210
+ *
211
+ * ## Configuring initial IFC object appearances
212
+ *
213
+ * We can specify the custom initial appearance of loaded objects according to their IFC types.
214
+ *
215
+ * This is useful for things like:
216
+ *
217
+ * * setting the colors to our objects according to their IFC types,
218
+ * * automatically hiding ````IfcSpace```` objects, and
219
+ * * ensuring that ````IfcWindow```` objects are always transparent.
220
+ * <br>
221
+ * In the example below, we'll load a model, while configuring ````IfcSpace```` elements to be always initially invisible,
222
+ * and ````IfcWindow```` types to be always translucent blue.
223
+ *
224
+ * * [[Run example](https://yjkkit.github.io/yjkkit-sdk/examples/#BIMOffline_XKT_objectDefaults)]
225
+ *
226
+ * ````javascript
227
+ * const myObjectDefaults = {
228
+ *
229
+ * IfcSpace: {
230
+ * visible: false
231
+ * },
232
+ * IfcWindow: {
233
+ * colorize: [0.337255, 0.303922, 0.870588], // Blue
234
+ * opacity: 0.3
235
+ * },
236
+ *
237
+ * //...
238
+ *
239
+ * DEFAULT: {
240
+ * colorize: [0.5, 0.5, 0.5]
241
+ * }
242
+ * };
243
+ *
244
+ * const model4 = xktLoader.load({
245
+ * id: "myModel4",
246
+ * src: "./models/xkt/Duplex.xkt",
247
+ * objectDefaults: myObjectDefaults // Use our custom initial default states for object Entities
248
+ * });
249
+ * ````
250
+ *
251
+ * When we don't customize the appearance of IFC types, as just above, then IfcSpace elements tend to obscure other
252
+ * elements, which can be confusing.
253
+ *
254
+ * It's often helpful to make IfcSpaces transparent and unpickable, like this:
255
+ *
256
+ * ````javascript
257
+ * const xktLoader = new XKTLoaderPlugin(viewer, {
258
+ * objectDefaults: {
259
+ * IfcSpace: {
260
+ * pickable: false,
261
+ * opacity: 0.2
262
+ * }
263
+ * }
264
+ * });
265
+ * ````
266
+ *
267
+ * Alternatively, we could just make IfcSpaces invisible, which also makes them unpickable:
268
+ *
269
+ * ````javascript
270
+ * const xktLoader = new XKTLoaderPlugin(viewer, {
271
+ * objectDefaults: {
272
+ * IfcSpace: {
273
+ * visible: false
274
+ * }
275
+ * }
276
+ * });
277
+ * ````
278
+ *
279
+ * ## Configuring a custom data source
280
+ *
281
+ * By default, XKTLoaderPlugin will load *````.XKT````* files and metadata JSON over HTTP.
282
+ *
283
+ * In the example below, we'll customize the way XKTLoaderPlugin loads the files by configuring it with our own data source
284
+ * object. For simplicity, our custom data source example also uses HTTP, using a couple of yjkkit utility functions.
285
+ *
286
+ * * [[Run example](https://yjkkit.github.io/yjkkit-sdk/examples/#loading_XKT_dataSource)]
287
+ *
288
+ * ````javascript
289
+ * import {utils} from "yjkkit-sdk.es.js";
290
+ *
291
+ * class MyDataSource {
292
+ *
293
+ * constructor() {
294
+ * }
295
+ *
296
+ * // Gets metamodel JSON
297
+ * getMetaModel(metaModelSrc, ok, error) {
298
+ * console.log("MyDataSource#getMetaModel(" + metaModelSrc + ", ... )");
299
+ * utils.loadJSON(metaModelSrc,
300
+ * (json) => {
301
+ * ok(json);
302
+ * },
303
+ * function (errMsg) {
304
+ * error(errMsg);
305
+ * });
306
+ * }
307
+ *
308
+ * // Gets the contents of the given .XKT file in an arraybuffer
309
+ * getXKT(src, ok, error) {
310
+ * console.log("MyDataSource#getXKT(" + xKTSrc + ", ... )");
311
+ * utils.loadArraybuffer(src,
312
+ * (arraybuffer) => {
313
+ * ok(arraybuffer);
314
+ * },
315
+ * function (errMsg) {
316
+ * error(errMsg);
317
+ * });
318
+ * }
319
+ * }
320
+ *
321
+ * const xktLoader2 = new XKTLoaderPlugin(viewer, {
322
+ * dataSource: new MyDataSource()
323
+ * });
324
+ *
325
+ * const model5 = xktLoader2.load({
326
+ * id: "myModel5",
327
+ * src: "./models/xkt/Duplex.xkt"
328
+ * });
329
+ * ````
330
+ *
331
+ * ## Loading multiple copies of a model, without object ID clashes
332
+ *
333
+ * Sometimes we need to load two or more instances of the same model, without having clashes
334
+ * between the IDs of the equivalent objects in the model instances.
335
+ *
336
+ * As shown in the example below, we do this by setting {@link XKTLoaderPlugin#globalizeObjectIds} ````true```` before we load our models.
337
+ *
338
+ * * [[Run example](https://yjkkit.github.io/yjkkit-sdk/examples/#TreeViewPlugin_Containment_MultipleModels)]
339
+ *
340
+ * ````javascript
341
+ * xktLoader.globalizeObjectIds = true;
342
+ *
343
+ * const model = xktLoader.load({
344
+ * id: "model1",
345
+ * src: "./models/xkt/Schependomlaan.xkt"
346
+ * });
347
+ *
348
+ * const model2 = xktLoader.load({
349
+ * id: "model2",
350
+ * src: "./models/xkt/Schependomlaan.xkt"
351
+ * });
352
+ * ````
353
+ *
354
+ * For each {@link Entity} loaded by these two calls, {@link Entity#id} and {@link MetaObject#id} will get prefixed by
355
+ * the ID of their model, in order to avoid ID clashes between the two models.
356
+ *
357
+ * An Entity belonging to the first model will get an ID like this:
358
+ *
359
+ * ````
360
+ * myModel1#0BTBFw6f90Nfh9rP1dlXrb
361
+ * ````
362
+ *
363
+ * The equivalent Entity in the second model will get an ID like this:
364
+ *
365
+ * ````
366
+ * myModel2#0BTBFw6f90Nfh9rP1dlXrb
367
+ * ````
368
+ *
369
+ * Now, to update the visibility of both of those Entities collectively, using {@link Scene#setObjectsVisible}, we can
370
+ * supply just the IFC product ID part to that method:
371
+ *
372
+ * ````javascript
373
+ * myViewer.scene.setObjectVisibilities("0BTBFw6f90Nfh9rP1dlXrb", true);
374
+ * ````
375
+ *
376
+ * The method, along with {@link Scene#setObjectsXRayed}, {@link Scene#setObjectsHighlighted} etc, will internally expand
377
+ * the given ID to refer to the instances of that Entity in both models.
378
+ *
379
+ * We can also, of course, reference each Entity directly, using its globalized ID:
380
+ *
381
+ * ````javascript
382
+ * myViewer.scene.setObjectVisibilities("myModel1#0BTBFw6f90Nfh9rP1dlXrb", true);
383
+ *````
384
+ *
385
+ * @class XKTLoaderPlugin
386
+ */
387
+ class XKTLoaderPlugin extends Plugin {
388
+
389
+ /**
390
+ * @constructor
391
+ *
392
+ * @param {Viewer} viewer The Viewer.
393
+ * @param {Object} cfg Plugin configuration.
394
+ * @param {String} [cfg.id="XKTLoader"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.
395
+ * @param {Object} [cfg.objectDefaults] Map of initial default states for each loaded {@link Entity} that represents an object. Default value is {@link IFCObjectDefaults}.
396
+ * @param {Object} [cfg.dataSource] A custom data source through which the XKTLoaderPlugin can load model and metadata files. Defaults to an instance of {@link XKTDefaultDataSource}, which loads uover HTTP.
397
+ * @param {String[]} [cfg.includeTypes] When loading metadata, only loads objects that have {@link MetaObject}s with {@link MetaObject#type} values in this list.
398
+ * @param {String[]} [cfg.excludeTypes] When loading metadata, never loads objects that have {@link MetaObject}s with {@link MetaObject#type} values in this list.
399
+ * @param {Boolean} [cfg.excludeUnclassifiedObjects=false] When loading metadata and this is ````true````, will only load {@link Entity}s that have {@link MetaObject}s (that are not excluded). This is useful when we don't want Entitys in the Scene that are not represented within IFC navigation components, such as {@link TreeViewPlugin}.
400
+ * @param {Number} [cfg.maxGeometryBatchSize=50000000] Maximum geometry batch size, as number of vertices. This is optionally supplied
401
+ * to limit the size of the batched geometry arrays that {@link PerformanceModel} internally creates for batched geometries.
402
+ * A low value means less heap allocation/de-allocation while loading batched geometries, but more draw calls and
403
+ * slower rendering speed. A high value means larger heap allocation/de-allocation while loading, but less draw calls
404
+ * and faster rendering speed. It's recommended to keep this somewhere roughly between ````50000```` and ````50000000```.
405
+ */
406
+ constructor(viewer, cfg = {}) {
407
+
408
+ super("XKTLoader", viewer, cfg);
409
+
410
+ this._maxGeometryBatchSize = cfg.maxGeometryBatchSize;
411
+
412
+ this.dataSource = cfg.dataSource;
413
+ this.objectDefaults = cfg.objectDefaults;
414
+ this.includeTypes = cfg.includeTypes;
415
+ this.excludeTypes = cfg.excludeTypes;
416
+ this.excludeUnclassifiedObjects = cfg.excludeUnclassifiedObjects;
417
+ }
418
+
419
+ /**
420
+ * Gets the ````.xkt```` format versions supported by this XKTLoaderPlugin/
421
+ * @returns {string[]}
422
+ */
423
+ get supportedVersions() {
424
+ return Object.keys(parsers);
425
+ }
426
+
427
+ /**
428
+ * Sets a custom data source through which the XKTLoaderPlugin can load models and metadata.
429
+ *
430
+ * Default value is {@link XKTDefaultDataSource}, which loads via HTTP.
431
+ *
432
+ * @type {Object}
433
+ */
434
+ set dataSource(value) {
435
+ this._dataSource = value || new XKTDefaultDataSource();
436
+ }
437
+
438
+ /**
439
+ * Gets the custom data source through which the XKTLoaderPlugin can load models and metadata.
440
+ *
441
+ * Default value is {@link XKTDefaultDataSource}, which loads via HTTP.
442
+ *
443
+ * @type {Object}
444
+ */
445
+ get dataSource() {
446
+ return this._dataSource;
447
+ }
448
+
449
+ /**
450
+ * Sets map of initial default states for each loaded {@link Entity} that represents an object.
451
+ *
452
+ * Default value is {@link IFCObjectDefaults}.
453
+ *
454
+ * @type {{String: Object}}
455
+ */
456
+ set objectDefaults(value) {
457
+ this._objectDefaults = value || IFCObjectDefaults;
458
+ }
459
+
460
+ /**
461
+ * Gets map of initial default states for each loaded {@link Entity} that represents an object.
462
+ *
463
+ * Default value is {@link IFCObjectDefaults}.
464
+ *
465
+ * @type {{String: Object}}
466
+ */
467
+ get objectDefaults() {
468
+ return this._objectDefaults;
469
+ }
470
+
471
+ /**
472
+ * Sets the whitelist of the IFC types loaded by this XKTLoaderPlugin.
473
+ *
474
+ * When loading models with metadata, causes this XKTLoaderPlugin to only load objects whose types are in this
475
+ * list. An object's type is indicated by its {@link MetaObject}'s {@link MetaObject#type}.
476
+ *
477
+ * Default value is ````undefined````.
478
+ *
479
+ * @type {String[]}
480
+ */
481
+ set includeTypes(value) {
482
+ this._includeTypes = value;
483
+ }
484
+
485
+ /**
486
+ * Gets the whitelist of the IFC types loaded by this XKTLoaderPlugin.
487
+ *
488
+ * When loading models with metadata, causes this XKTLoaderPlugin to only load objects whose types are in this
489
+ * list. An object's type is indicated by its {@link MetaObject}'s {@link MetaObject#type}.
490
+ *
491
+ * Default value is ````undefined````.
492
+ *
493
+ * @type {String[]}
494
+ */
495
+ get includeTypes() {
496
+ return this._includeTypes;
497
+ }
498
+
499
+ /**
500
+ * Sets the blacklist of IFC types that are never loaded by this XKTLoaderPlugin.
501
+ *
502
+ * When loading models with metadata, causes this XKTLoaderPlugin to **not** load objects whose types are in this
503
+ * list. An object's type is indicated by its {@link MetaObject}'s {@link MetaObject#type}.
504
+ *
505
+ * Default value is ````undefined````.
506
+ *
507
+ * @type {String[]}
508
+ */
509
+ set excludeTypes(value) {
510
+ this._excludeTypes = value;
511
+ }
512
+
513
+ /**
514
+ * Gets the blacklist of IFC types that are never loaded by this XKTLoaderPlugin.
515
+ *
516
+ * When loading models with metadata, causes this XKTLoaderPlugin to **not** load objects whose types are in this
517
+ * list. An object's type is indicated by its {@link MetaObject}'s {@link MetaObject#type}.
518
+ *
519
+ * Default value is ````undefined````.
520
+ *
521
+ * @type {String[]}
522
+ */
523
+ get excludeTypes() {
524
+ return this._excludeTypes;
525
+ }
526
+
527
+
528
+ /**
529
+ * Sets whether we load objects that don't have IFC types.
530
+ *
531
+ * When loading models with metadata and this is ````true````, XKTLoaderPlugin will not load objects
532
+ * that don't have IFC types.
533
+ *
534
+ * Default value is ````false````.
535
+ *
536
+ * @type {Boolean}
537
+ */
538
+ set excludeUnclassifiedObjects(value) {
539
+ this._excludeUnclassifiedObjects = !!value;
540
+ }
541
+
542
+ /**
543
+ * Gets whether we load objects that don't have IFC types.
544
+ *
545
+ * When loading models with metadata and this is ````true````, XKTLoaderPlugin will not load objects
546
+ * that don't have IFC types.
547
+ *
548
+ * Default value is ````false````.
549
+ *
550
+ * @type {Boolean}
551
+ */
552
+ get excludeUnclassifiedObjects() {
553
+ return this._excludeUnclassifiedObjects;
554
+ }
555
+
556
+ /**
557
+ * Sets whether XKTLoaderPlugin globalizes each {@link Entity#id} and {@link MetaObject#id} as it loads a model.
558
+ *
559
+ * Set this ````true```` when you need to load multiple instances of the same model, to avoid ID clashes
560
+ * between the objects in the different instances.
561
+ *
562
+ * When we load a model with this set ````true````, then each {@link Entity#id} and {@link MetaObject#id} will be
563
+ * prefixed by the ID of the model, ie. ````<modelId>#<objectId>````.
564
+ *
565
+ * {@link Entity#originalSystemId} and {@link MetaObject#originalSystemId} will always hold the original, un-prefixed, ID values.
566
+ *
567
+ * Default value is ````false````.
568
+ *
569
+ * See the main {@link XKTLoaderPlugin} class documentation for usage info.
570
+ *
571
+ * @type {Boolean}
572
+ */
573
+ set globalizeObjectIds(value) {
574
+ this._globalizeObjectIds = !!value;
575
+ }
576
+
577
+ /**
578
+ * Gets whether XKTLoaderPlugin globalizes each {@link Entity#id} and {@link MetaObject#id} as it loads a model.
579
+ *
580
+ * Default value is ````false````.
581
+ *
582
+ * @type {Boolean}
583
+ */
584
+ get globalizeObjectIds() {
585
+ return this._globalizeObjectIds;
586
+ }
587
+
588
+ /**
589
+ * Loads an ````.xkt```` model into this XKTLoaderPlugin's {@link Viewer}.
590
+ *
591
+ * Since yjkkit/yjkkit-sdk 1.9.0, XKTLoaderPlugin has supported XKT 8, which bundles the metamodel
592
+ * data (eg. an IFC element hierarchy) in the XKT file itself. For XKT 8, we therefore no longer need to
593
+ * load the metamodel data from a separate accompanying JSON file, as we did with previous XKT versions.
594
+ * However, if we do choose to specify a separate metamodel JSON file to load (eg. for backward compatibility
595
+ * in data pipelines), then that metamodel will be loaded and the metamodel in the XKT 8 file will be ignored.
596
+ *
597
+ * @param {*} params Loading parameters.
598
+ * @param {String} [params.id] ID to assign to the root {@link Entity#id}, unique among all components in the Viewer's {@link Scene}, generated automatically by default.
599
+ * @param {String} [params.src] Path to a *````.xkt````* file, as an alternative to the ````xkt```` parameter.
600
+ * @param {ArrayBuffer} [params.xkt] The *````.xkt````* file data, as an alternative to the ````src```` parameter.
601
+ * @param {String} [params.metaModelSrc] Path to an optional metadata file, as an alternative to the ````metaModelData```` parameter.
602
+ * @param {*} [params.metaModelData] JSON model metadata, as an alternative to the ````metaModelSrc```` parameter.
603
+ * @param {{String:Object}} [params.objectDefaults] Map of initial default states for each loaded {@link Entity} that represents an object. Default value is {@link IFCObjectDefaults}.
604
+ * @param {String[]} [params.includeTypes] When loading metadata, only loads objects that have {@link MetaObject}s with {@link MetaObject#type} values in this list.
605
+ * @param {String[]} [params.excludeTypes] When loading metadata, never loads objects that have {@link MetaObject}s with {@link MetaObject#type} values in this list.
606
+ * @param {Boolean} [params.edges=false] Whether or not yjkkit renders the model with edges emphasized.
607
+ * @param {Number[]} [params.position=[0,0,0]] The model World-space 3D position.
608
+ * @param {Number[]} [params.scale=[1,1,1]] The model's World-space scale.
609
+ * @param {Number[]} [params.rotation=[0,0,0]] The model's World-space rotation, as Euler angles given in degrees, for each of the X, Y and Z axis.
610
+ * @param {Number[]} [params.matrix=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]] The model's world transform matrix. Overrides the position, scale and rotation parameters.
611
+ * @param {Boolean} [params.edges=false] Indicates if the model's edges are initially emphasized.
612
+ * @param {Boolean} [params.saoEnabled=true] Indicates if Scalable Ambient Obscurance (SAO) will apply to the model. SAO is configured by the Scene's {@link SAO} component. Only works when {@link SAO#enabled} is also ````true````
613
+ * @param {Boolean} [params.pbrEnabled=false] Indicates if physically-based rendering (PBR) will apply to the model. Only works when {@link Scene#pbrEnabled} is also ````true````.
614
+ * @param {Number} [params.backfaces=false] When we set this ````true````, then we force rendering of backfaces for the model. When
615
+ * we leave this ````false````, then we allow the Viewer to decide when to render backfaces. In that case, the
616
+ * Viewer will hide backfaces on watertight meshes, show backfaces on open meshes, and always show backfaces on meshes when we slice them open with {@link SectionPlane}s.
617
+ * @param {Boolean} [params.excludeUnclassifiedObjects=false] When loading metadata and this is ````true````, will only load {@link Entity}s that have {@link MetaObject}s (that are not excluded). This is useful when we don't want Entitys in the Scene that are not represented within IFC navigation components, such as {@link TreeViewPlugin}.
618
+ * @param {Boolean} [params.globalizeObjectIds=false] Indicates whether to globalize each {@link Entity#id} and {@link MetaObject#id}, in case you need to prevent ID clashes with other models. See {@link XKTLoaderPlugin#globalizeObjectIds} for more info.
619
+ * @returns {Entity} Entity representing the model, which will have {@link Entity#isModel} set ````true```` and will be registered by {@link Entity#id} in {@link Scene#models}.
620
+ */
621
+ load(params = {}) {
622
+
623
+ if (params.id && this.viewer.scene.components[params.id]) {
624
+ this.error("Component with this ID already exists in viewer: " + params.id + " - will autogenerate this ID");
625
+ delete params.id;
626
+ }
627
+
628
+ const performanceModel = new PerformanceModel(this.viewer.scene, utils.apply(params, {
629
+ isModel: true,
630
+ maxGeometryBatchSize: this._maxGeometryBatchSize
631
+ }));
632
+
633
+ const modelId = performanceModel.id; // In case ID was auto-generated
634
+
635
+ if (!params.src && !params.xkt) {
636
+ this.error("load() param expected: src or xkt");
637
+ return performanceModel; // Return new empty model
638
+ }
639
+
640
+ const options = {};
641
+ const includeTypes = params.includeTypes || this._includeTypes;
642
+ const excludeTypes = params.excludeTypes || this._excludeTypes;
643
+ const objectDefaults = params.objectDefaults || this._objectDefaults;
644
+
645
+ if (includeTypes) {
646
+ options.includeTypesMap = {};
647
+ for (let i = 0, len = includeTypes.length; i < len; i++) {
648
+ options.includeTypesMap[includeTypes[i]] = true;
649
+ }
650
+ }
651
+
652
+ if (excludeTypes) {
653
+ options.excludeTypesMap = {};
654
+ for (let i = 0, len = excludeTypes.length; i < len; i++) {
655
+ options.excludeTypesMap[excludeTypes[i]] = true;
656
+ }
657
+ }
658
+
659
+ if (objectDefaults) {
660
+ options.objectDefaults = objectDefaults;
661
+ }
662
+
663
+ options.excludeUnclassifiedObjects = (params.excludeUnclassifiedObjects !== undefined) ? (!!params.excludeUnclassifiedObjects) : this._excludeUnclassifiedObjects;
664
+ options.globalizeObjectIds = (params.globalizeObjectIds !== undefined) ? (!!params.globalizeObjectIds) : this._globalizeObjectIds;
665
+
666
+ if (params.metaModelSrc || params.metaModelData) {
667
+
668
+ const processMetaModelData = (metaModelData) => {
669
+
670
+ const metaModel = this.viewer.metaScene.createMetaModel(modelId, metaModelData, {
671
+ includeTypes: includeTypes,
672
+ excludeTypes: excludeTypes,
673
+ globalizeObjectIds: this.globalizeObjectIds
674
+ });
675
+
676
+ if (!metaModel) {
677
+ return false;
678
+ }
679
+
680
+ if (params.src) {
681
+ this._loadModel(params.src, params, options, performanceModel);
682
+ } else {
683
+ this._parseModel(params.xkt, params, options, performanceModel);
684
+ }
685
+
686
+ performanceModel.once("destroyed", () => {
687
+ this.viewer.metaScene.destroyMetaModel(performanceModel.id);
688
+ });
689
+
690
+ return true;
691
+ };
692
+
693
+ if (params.metaModelSrc) {
694
+
695
+ const metaModelSrc = params.metaModelSrc;
696
+
697
+ this.viewer.scene.canvas.spinner.processes++;
698
+
699
+ this._dataSource.getMetaModel(metaModelSrc, (metaModelData) => {
700
+
701
+ if (performanceModel.destroyed) {
702
+ return;
703
+ }
704
+
705
+ if (!processMetaModelData(metaModelData)) {
706
+
707
+ this.error(`load(): Failed to load model metadata for model '${modelId} from '${metaModelSrc}' - metadata not valid`);
708
+
709
+ performanceModel.fire("error", "Metadata not valid");
710
+ }
711
+
712
+ this.viewer.scene.canvas.spinner.processes--;
713
+
714
+ }, (errMsg) => {
715
+
716
+ this.error(`load(): Failed to load model metadata for model '${modelId} from '${metaModelSrc}' - ${errMsg}`);
717
+
718
+ performanceModel.fire("error", `Failed to load model metadata from '${metaModelSrc}' - ${errMsg}`);
719
+
720
+ this.viewer.scene.canvas.spinner.processes--;
721
+ });
722
+
723
+ } else if (params.metaModelData) {
724
+
725
+ if (!processMetaModelData(params.metaModelData)) {
726
+
727
+ this.error(`load(): Failed to load model metadata for model '${modelId} from '${metaModelSrc}' - metadata not valid`);
728
+
729
+ performanceModel.fire("error", "Metadata not valid");
730
+ }
731
+ }
732
+
733
+ } else {
734
+ if (params.src) {
735
+ this._loadModel(params.src, params, options, performanceModel);
736
+ } else {
737
+ this._parseModel(params.xkt, params, options, performanceModel);
738
+ }
739
+ }
740
+
741
+ return performanceModel;
742
+ }
743
+
744
+ _loadModel(src, params, options, performanceModel) {
745
+
746
+ const spinner = this.viewer.scene.canvas.spinner;
747
+
748
+ spinner.processes++;
749
+
750
+ this._dataSource.getXKT(params.src, (arrayBuffer) => {
751
+ this._parseModel(arrayBuffer, params, options, performanceModel);
752
+ spinner.processes--;
753
+ },
754
+ (errMsg) => {
755
+ spinner.processes--;
756
+ this.error(errMsg);
757
+ performanceModel.fire("error", errMsg);
758
+ });
759
+ }
760
+
761
+ _parseModel(arrayBuffer, params, options, performanceModel) {
762
+
763
+ if (performanceModel.destroyed) {
764
+ return;
765
+ }
766
+
767
+ const dataView = new DataView(arrayBuffer);
768
+ const dataArray = new Uint8Array(arrayBuffer);
769
+ const xktVersion = dataView.getUint32(0, true);
770
+ const parser = parsers[xktVersion];
771
+
772
+ if (!parser) {
773
+ this.error("Unsupported .XKT file version: " + xktVersion + " - this XKTLoaderPlugin supports versions " + Object.keys(parsers));
774
+ return;
775
+ }
776
+
777
+ this.log("Loading .xkt V" + xktVersion);
778
+
779
+ const numElements = dataView.getUint32(4, true);
780
+ const elements = [];
781
+ let byteOffset = (numElements + 2) * 4;
782
+ for (let i = 0; i < numElements; i++) {
783
+ const elementSize = dataView.getUint32((i + 2) * 4, true);
784
+ elements.push(dataArray.subarray(byteOffset, byteOffset + elementSize));
785
+ byteOffset += elementSize;
786
+ }
787
+
788
+ parser.parse(this.viewer, options, elements, performanceModel);
789
+
790
+ performanceModel.finalize();
791
+
792
+ this._createDefaultMetaModelIfNeeded(performanceModel, options);
793
+
794
+ performanceModel.scene.once("tick", () => {
795
+ if (performanceModel.destroyed) {
796
+ return;
797
+ }
798
+ performanceModel.scene.fire("modelLoaded", performanceModel.id); // FIXME: Assumes listeners know order of these two events
799
+ performanceModel.fire("loaded", true, false); // Don't forget the event, for late subscribers
800
+ });
801
+ }
802
+
803
+ _createDefaultMetaModelIfNeeded(performanceModel, options) {
804
+
805
+ const metaModelId = performanceModel.id;
806
+
807
+ if (!this.viewer.metaScene.metaModels[metaModelId]) {
808
+
809
+ const metaModelData = {
810
+ metaObjects: []
811
+ };
812
+
813
+ metaModelData.metaObjects.push({
814
+ id: metaModelId,
815
+ type: "default",
816
+ name: metaModelId,
817
+ parent: null
818
+ });
819
+
820
+ const entityList = performanceModel.entityList;
821
+
822
+ for (let i = 0, len = entityList.length; i < len; i++) {
823
+ const entity = entityList[i];
824
+ if (entity.isObject) {
825
+ metaModelData.metaObjects.push({
826
+ id: entity.id,
827
+ type: "default",
828
+ name: entity.id,
829
+ parent: metaModelId
830
+ });
831
+ }
832
+ }
833
+
834
+ this.viewer.metaScene.createMetaModel(metaModelId, metaModelData, {
835
+ includeTypes: options.includeTypes,
836
+ excludeTypes: options.excludeTypes,
837
+ globalizeObjectIds: options.globalizeObjectIds
838
+ });
839
+
840
+ performanceModel.once("destroyed", () => {
841
+ this.viewer.metaScene.destroyMetaModel(metaModelId);
842
+ });
843
+ }
844
+ }
845
+ }
846
+
847
+ export {XKTLoaderPlugin}