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 @@
1
+ export * from "./OBJLoaderPlugin.js";
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Default data access strategy for {@link STLLoaderPlugin}.
3
+ *
4
+ * This implementation simply loads STL files using XMLHttpRequest.
5
+ */
6
+ class STLDefaultDataSource {
7
+
8
+ /**
9
+ * Gets STL data.
10
+ *
11
+ * @param {String|Number} src Identifies the STL file.
12
+ * @param {Function} ok Fired on successful loading of the STL file.
13
+ * @param {Function} error Fired on error while loading the STL file.
14
+ */
15
+ getSTL(src, ok, error) {
16
+ const request = new XMLHttpRequest();
17
+ request.overrideMimeType("application/json");
18
+ request.open('GET', src, true);
19
+ request.responseType = 'arraybuffer';
20
+ request.onreadystatechange = function () {
21
+ if (request.readyState === 4) {
22
+ if (request.status === 200) {
23
+ ok(request.response);
24
+ } else {
25
+ error(request.statusText);
26
+ }
27
+ }
28
+ };
29
+ request.send(null);
30
+ }
31
+ }
32
+
33
+ export {STLDefaultDataSource};
@@ -0,0 +1,273 @@
1
+ import {Node} from "../../viewer/scene/nodes/Node.js";
2
+ import {Plugin} from "../../viewer/Plugin.js";
3
+ import {STLSceneGraphLoader} from "./STLSceneGraphLoader.js";
4
+ import {utils} from "../../viewer/scene/utils.js";
5
+ import {STLDefaultDataSource} from "./STLDefaultDataSource.js";
6
+
7
+ /**
8
+ * {@link Viewer} plugin that loads models from <a href="https://en.wikipedia.org/wiki/STL_(file_format)">STL</a> files.
9
+ *
10
+ * ## Overview
11
+ *
12
+ * * Creates an {@link Entity} representing each model it loads, which will have {@link Entity#isModel} set ````true```` and will be registered by {@link Entity#id} in {@link Scene#models}.
13
+ * * Creates an {@link Entity} for each object within the model, which will have {@link Entity#isObject} set ````true```` and will be registered by {@link Entity#id} in {@link Scene#objects}.
14
+ * * When loading, can set the World-space position, scale and rotation of each model within World space, along with initial properties for all the model's {@link Entity}s.
15
+ * * Supports both binary and ASCII formats.
16
+ * * Supports double-precision vertex positions.
17
+ * * Supports custom data source configuration.
18
+ *
19
+ * ## Smoothing STL Normals
20
+ *
21
+ * STL models are normally flat-shaded, however providing a ````smoothNormals```` parameter when loading gives a smooth
22
+ * appearance. Triangles in STL are disjoint, where each triangle has its own separate vertex positions, normals and
23
+ * (optionally) colors. This means that you can have gaps between triangles in an STL model. Normals for each triangle
24
+ * are perpendicular to the triangle's surface, which gives the model a faceted appearance by default.
25
+ *
26
+ * The ```smoothNormals``` parameter causes the plugin to recalculate the STL normals, so that each normal's direction is
27
+ * the average of the orientations of the triangles adjacent to its vertex. When smoothing, each vertex normal is set to
28
+ * the average of the orientations of all other triangles that have a vertex at the same position, excluding those triangles
29
+ * whose direction deviates from the direction of the vertice's triangle by a threshold given in
30
+ * the ````smoothNormalsAngleThreshold```` loading parameter. This makes smoothing robust for hard edges.
31
+ *
32
+ * ## Creating Entities for Objects
33
+ *
34
+ * An STL model is normally a single mesh, however providing a ````splitMeshes```` parameter when loading
35
+ * will create a separate object {@link Entity} for each group of faces that share the same vertex colors. This option
36
+ * only works with binary STL files.
37
+ *
38
+ * See the {@link STLLoaderPlugin#load} method for more info on loading options.
39
+ *
40
+ * ## Usage
41
+ *
42
+ * In the example below, we'll use an STLLoaderPlugin to load an STL model of a spur gear. When the model has loaded,
43
+ * we'll use the {@link CameraFlightAnimation} to fly the {@link Camera} to look at boundary of the model. We'll
44
+ * then get the model's {@link Entity} from the {@link Scene} and highlight the whole model.
45
+ *
46
+ * * [[Run this example](https://yjkkit.github.io/yjkkit-sdk/examples/#loading_STL_SpurGear)]
47
+ *
48
+ * ````javascript
49
+ * // Create a yjkkit Viewer
50
+ * const viewer = new Viewer({
51
+ * canvasId: "myCanvas"
52
+ * });
53
+ *
54
+ * // Add an STLLoaderPlugin to the Viewer
55
+ * var plugin = new STLLoaderPlugin(viewer);
56
+ *
57
+ * // Load the STL model
58
+ * var model = plugin.load({ // Model is an Entity
59
+ * id: "myModel",
60
+ * src: "./models/stl/binary/spurGear.stl",
61
+ * scale: [0.1, 0.1, 0.1],
62
+ * rotate: [90, 0, 0],
63
+ * translate: [100,0,0],
64
+ * edges: true,
65
+ * smoothNormals: true, // Default
66
+ * smoothNormalsAngleThreshold: 20, // Default
67
+ * splitMeshes: true // Default
68
+ * });
69
+ *
70
+ * // When the model has loaded, fit it to view
71
+ * model.on("loaded", function() { // Model is an Entity
72
+ * viewer.cameraFlight.flyTo(model);
73
+ * });
74
+ *
75
+ * // Find the model Entity by ID
76
+ * model = viewer.scene.models["myModel"];
77
+ *
78
+ * // Update properties of the model Entity
79
+ * model.highlight = [1,0,0];
80
+ *
81
+ * // Destroy the model Entity
82
+ * model.destroy();
83
+ * ````
84
+ *
85
+ * ## Loading from a Pre-Loaded STL File
86
+ *
87
+ * If we already have our STL file in memory (perhaps pre-loaded, or even generated in-client), then we can just pass that
88
+ * file data straight into the {@link STLLoaderPlugin#load} method. In the example below, to show how it's done, we'll pre-load
89
+ * our STL file data, then pass it straight into that method.
90
+ *
91
+ * * [[Run this example](https://yjkkit.github.io/yjkkit-sdk/examples/#loading_STL_dataAsParam)]
92
+ *
93
+ * ````javascript
94
+ * loadSTL("./models/stl/binary/spurGear.stl", (stlData) =>{
95
+ *
96
+ * const model = stlLoader.load({
97
+ * id: "myModel",
98
+ * stl: stlData,
99
+ * smoothNormals: true
100
+ * });
101
+ *
102
+ * model.on("loaded", () => {
103
+ * viewer.cameraFlight.jumpTo(model);
104
+ * viewer.scene.on("tick", () => {
105
+ * viewer.camera.orbitYaw(0.4);
106
+ * })
107
+ * });
108
+ * })
109
+ *
110
+ * function loadSTL(src, ok, error) {
111
+ * const request = new XMLHttpRequest();
112
+ * request.overrideMimeType("application/json");
113
+ * request.open('GET', src, true);
114
+ * request.responseType = 'arraybuffer';
115
+ * request.onreadystatechange = function () {
116
+ * if (request.readyState === 4) {
117
+ * if (request.status === 200) {
118
+ * ok(request.response);
119
+ * } else if (error) {
120
+ * error(request.statusText);
121
+ * }
122
+ * }
123
+ * };
124
+ * request.send(null);
125
+ * }
126
+ *````
127
+ *
128
+ * ## Configuring a Custom Data Source
129
+ *
130
+ * In the example below, we'll create the STLLoaderPlugin again, this time configuring it with a
131
+ * custom data source object, through which it can load STL files. For this example, our data source just loads
132
+ * them via HTTP, for simplicity. Once we've created the STLLoaderPlugin, we'll load our STL file as before.
133
+ *
134
+ * * [[Run this example](https://yjkkit.github.io/yjkkit-sdk/examples/#loading_STL_dataSource)]
135
+ *
136
+ * ````javascript
137
+ * // Our custom STL data access strategy - implementation happens to be the same as STLDefaultDataSource
138
+ *
139
+ * class MyDataSource {
140
+ * getSTL(src, ok, error) {
141
+ * const request = new XMLHttpRequest();
142
+ * request.overrideMimeType("application/json");
143
+ * request.open('GET', src, true);
144
+ * request.responseType = 'arraybuffer';
145
+ * request.onreadystatechange = function () {
146
+ * if (request.readyState === 4) {
147
+ * if (request.status === 200) {
148
+ * ok(request.response);
149
+ * } else {
150
+ * error(request.statusText);
151
+ * }
152
+ * }
153
+ * };
154
+ * request.send(null);
155
+ * }
156
+ * }
157
+ *
158
+ * const stlLoader = new STLLoaderPlugin(viewer, {
159
+ * dataSource: new MyDataSource()
160
+ * });
161
+ *
162
+ * // Load the STL model as before
163
+ * var model = plugin.load({
164
+ * id: "myModel",
165
+ * src: "./models/stl/binary/spurGear.stl",
166
+ * scale: [0.1, 0.1, 0.1],
167
+ * rotate: [90, 0, 0],
168
+ * translate: [100,0,0],
169
+ * edges: true,
170
+ * smoothNormals: true, // Default
171
+ * smoothNormalsAngleThreshold: 20, // Default
172
+ * splitMeshes: true // Default
173
+ * });
174
+ *
175
+ * //...
176
+ *````
177
+ *
178
+ * @class STLLoaderPlugin
179
+ */
180
+ class STLLoaderPlugin extends Plugin {
181
+
182
+ /**
183
+ * @constructor
184
+ *
185
+ * @param {Viewer} viewer The Viewer.
186
+ * @param {Object} [cfg] Plugin configuration.
187
+ * @param {String} [cfg.id="STLLoader"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.
188
+ * @param {Object} [cfg.dataSource] A custom data source through which the STLLoaderPlugin can load STL files. Defaults to an instance of {@link STLDefaultDataSource}, which loads over HTTP.
189
+ */
190
+ constructor(viewer, cfg = {}) {
191
+
192
+ super("STLLoader", viewer, cfg);
193
+
194
+ /**
195
+ * @private
196
+ */
197
+ this._sceneGraphLoader = new STLSceneGraphLoader();
198
+
199
+ this.dataSource = cfg.dataSource;
200
+ }
201
+
202
+ /**
203
+ * Sets a custom data source through which the STLLoaderPlugin can load STL files.
204
+ *
205
+ * Default value is {@link STLDefaultDataSource}, which loads via an XMLHttpRequest.
206
+ *
207
+ * @type {Object}
208
+ */
209
+ set dataSource(value) {
210
+ this._dataSource = value || new STLDefaultDataSource();
211
+ }
212
+
213
+ /**
214
+ * Gets the custom data source through which the STLLoaderPlugin can load STL files.
215
+ *
216
+ * Default value is {@link STLDefaultDataSource}, which loads via an XMLHttpRequest.
217
+ *
218
+ * @type {Object}
219
+ */
220
+ get dataSource() {
221
+ return this._dataSource;
222
+ }
223
+
224
+ /**
225
+ * Loads an STL model from a file into this STLLoaderPlugin's {@link Viewer}.
226
+ *
227
+ * @param {*} params Loading parameters.
228
+ * @param {String} params.id ID to assign to the model's root {@link Entity}, unique among all components in the Viewer's {@link Scene}.
229
+ * @param {String} [params.src] Path to an STL file. Overrides the ````stl```` parameter.
230
+ * @param {String} [params.stl] Contents of an STL file, either binary of ASCII. Overridden by the ````src```` parameter.
231
+ * @param {Boolean} [params.edges=false] Whether or not to renders the model with edges emphasized.
232
+ * @param {Number[]} [params.position=[0,0,0]] The model World-space 3D position.
233
+ * @param {Number[]} [params.scale=[1,1,1]] The model's World-space scale.
234
+ * @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.
235
+ * @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.
236
+ * @param {Boolean} [params.backfaces=false] When true, allows visible backfaces, wherever specified in the STL. When false, ignores backfaces.
237
+ * @param {Boolean} [params.smoothNormals=true] When true, automatically converts face-oriented normals to vertex normals for a smooth appearance.
238
+ * @param {Number} [params.smoothNormalsAngleThreshold=20] When xraying, highlighting, selecting or edging, this is the threshold angle between normals of adjacent triangles, below which their shared wireframe edge is not drawn.
239
+ * @param {Number} [params.edgeThreshold=20] When xraying, highlighting, selecting or edging, this is the threshold angle between normals of adjacent triangles, below which their shared wireframe edge is not drawn.
240
+ * @param {Boolean} [params.splitMeshes=true] When true, creates a separate {@link Mesh} for each group of faces that share the same vertex colors. Only works with binary STL.
241
+ * @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}
242
+ */
243
+ load(params) {
244
+
245
+ if (params.id && this.viewer.scene.components[params.id]) {
246
+ this.error("Component with this ID already exists in viewer: " + params.id + " - will autogenerate this ID");
247
+ delete params.id;
248
+ }
249
+
250
+ const modelNode = new Node(this.viewer.scene, utils.apply(params, {
251
+ isModel: true
252
+ }));
253
+
254
+ const src = params.src;
255
+ const stl = params.stl;
256
+
257
+ if (!src && !stl) {
258
+ this.error("load() param expected: either 'src' or 'stl'");
259
+ return modelNode;
260
+ }
261
+
262
+ if (src) {
263
+ this._sceneGraphLoader.load(this, modelNode, src, params);
264
+ } else {
265
+ this._sceneGraphLoader.parse(this, modelNode, stl, params);
266
+ }
267
+
268
+ return modelNode;
269
+ }
270
+ }
271
+
272
+
273
+ export {STLLoaderPlugin}
@@ -0,0 +1,313 @@
1
+ import {Mesh} from "../../viewer/scene/mesh/Mesh.js";
2
+ import {ReadableGeometry} from "../../viewer/scene/geometry/ReadableGeometry.js";
3
+ import {MetallicMaterial} from "../../viewer/scene/materials/MetallicMaterial.js";
4
+ import {math} from "../../viewer/scene/math/math.js";
5
+ import {worldToRTCPositions} from "../../viewer/scene/math/rtcCoords.js";
6
+ import {core} from "../../viewer/scene/core.js";
7
+
8
+ const tempVec3a = math.vec3();
9
+
10
+ /**
11
+ * @private
12
+ */
13
+ class STLSceneGraphLoader {
14
+
15
+ load(plugin, modelNode, src, options, ok, error) {
16
+
17
+ options = options || {};
18
+
19
+ const spinner = plugin.viewer.scene.canvas.spinner;
20
+ spinner.processes++;
21
+
22
+ plugin.dataSource.getSTL(src, function (data) { // OK
23
+ parse(plugin, modelNode, data, options);
24
+ try {
25
+ const binData = ensureBinary(data);
26
+ if (isBinary(binData)) {
27
+ parseBinary(plugin, binData, modelNode, options);
28
+ } else {
29
+ parseASCII(plugin, ensureString(data), modelNode, options);
30
+ }
31
+ spinner.processes--;
32
+ core.scheduleTask(function () {
33
+ modelNode.fire("loaded", true, false);
34
+ });
35
+ if (ok) {
36
+ ok();
37
+ }
38
+ } catch (e) {
39
+ spinner.processes--;
40
+ plugin.error(e);
41
+ if (error) {
42
+ error(e);
43
+ }
44
+ modelNode.fire("error", e);
45
+ }
46
+ },
47
+ function (msg) {
48
+ spinner.processes--;
49
+ plugin.error(msg);
50
+ if (error) {
51
+ error(msg);
52
+ }
53
+ modelNode.fire("error", msg);
54
+ });
55
+ }
56
+
57
+ parse(plugin, modelNode, data, options) {
58
+ const spinner = plugin.viewer.scene.canvas.spinner;
59
+ spinner.processes++;
60
+ try {
61
+ const binData = ensureBinary(data);
62
+ if (isBinary(binData)) {
63
+ parseBinary(plugin, binData, modelNode, options);
64
+ } else {
65
+ parseASCII(plugin, ensureString(data), modelNode, options);
66
+ }
67
+ spinner.processes--;
68
+ core.scheduleTask(function () {
69
+ modelNode.fire("loaded", true, false);
70
+ });
71
+ } catch (e) {
72
+ spinner.processes--;
73
+ modelNode.fire("error", e);
74
+ }
75
+ }
76
+ }
77
+
78
+ function parse(plugin, modelNode, data, options) {
79
+ try {
80
+ const binData = ensureBinary(data);
81
+ if (isBinary(binData)) {
82
+ parseBinary(plugin, binData, modelNode, options);
83
+ } else {
84
+ parseASCII(plugin, ensureString(data), modelNode, options);
85
+ }
86
+ } catch (e) {
87
+ modelNode.fire("error", e);
88
+ }
89
+ }
90
+
91
+ function isBinary(data) {
92
+ const reader = new DataView(data);
93
+ const numFaces = reader.getUint32(80, true);
94
+ const faceSize = (32 / 8 * 3) + ((32 / 8 * 3) * 3) + (16 / 8);
95
+ const numExpectedBytes = 80 + (32 / 8) + (numFaces * faceSize);
96
+ if (numExpectedBytes === reader.byteLength) {
97
+ return true;
98
+ }
99
+ const solid = [115, 111, 108, 105, 100];
100
+ for (var i = 0; i < 5; i++) {
101
+ if (solid[i] !== reader.getUint8(i, false)) {
102
+ return true;
103
+ }
104
+ }
105
+ return false;
106
+ }
107
+
108
+ function parseBinary(plugin, data, modelNode, options) {
109
+ const reader = new DataView(data);
110
+ const faces = reader.getUint32(80, true);
111
+ let r;
112
+ let g;
113
+ let b;
114
+ let hasColors = false;
115
+ let colors;
116
+ let defaultR;
117
+ let defaultG;
118
+ let defaultB;
119
+ let lastR = null;
120
+ let lastG = null;
121
+ let lastB = null;
122
+ let newMesh = false;
123
+ let alpha;
124
+ for (let index = 0; index < 80 - 10; index++) {
125
+ if ((reader.getUint32(index, false) === 0x434F4C4F /*COLO*/) &&
126
+ (reader.getUint8(index + 4) === 0x52 /*'R'*/) &&
127
+ (reader.getUint8(index + 5) === 0x3D /*'='*/)) {
128
+ hasColors = true;
129
+ colors = [];
130
+ defaultR = reader.getUint8(index + 6) / 255;
131
+ defaultG = reader.getUint8(index + 7) / 255;
132
+ defaultB = reader.getUint8(index + 8) / 255;
133
+ alpha = reader.getUint8(index + 9) / 255;
134
+ }
135
+ }
136
+ const material = new MetallicMaterial(modelNode, { // Share material with all meshes
137
+ roughness: 0.5
138
+ });
139
+ // var material = new PhongMaterial(modelNode, { // Share material with all meshes
140
+ // diffuse: [0.4, 0.4, 0.4],
141
+ // reflectivity: 1,
142
+ // specular: [0.5, 0.5, 1.0]
143
+ // });
144
+ let dataOffset = 84;
145
+ let faceLength = 12 * 4 + 2;
146
+ let positions = [];
147
+ let normals = [];
148
+ let splitMeshes = options.splitMeshes;
149
+ for (let face = 0; face < faces; face++) {
150
+ let start = dataOffset + face * faceLength;
151
+ let normalX = reader.getFloat32(start, true);
152
+ let normalY = reader.getFloat32(start + 4, true);
153
+ let normalZ = reader.getFloat32(start + 8, true);
154
+ if (hasColors) {
155
+ let packedColor = reader.getUint16(start + 48, true);
156
+ if ((packedColor & 0x8000) === 0) {
157
+ r = (packedColor & 0x1F) / 31;
158
+ g = ((packedColor >> 5) & 0x1F) / 31;
159
+ b = ((packedColor >> 10) & 0x1F) / 31;
160
+ } else {
161
+ r = defaultR;
162
+ g = defaultG;
163
+ b = defaultB;
164
+ }
165
+ if (splitMeshes && r !== lastR || g !== lastG || b !== lastB) {
166
+ if (lastR !== null) {
167
+ newMesh = true;
168
+ }
169
+ lastR = r;
170
+ lastG = g;
171
+ lastB = b;
172
+ }
173
+ }
174
+ for (let i = 1; i <= 3; i++) {
175
+ let vertexstart = start + i * 12;
176
+ positions.push(reader.getFloat32(vertexstart, true));
177
+ positions.push(reader.getFloat32(vertexstart + 4, true));
178
+ positions.push(reader.getFloat32(vertexstart + 8, true));
179
+ normals.push(normalX, normalY, normalZ);
180
+ if (hasColors) {
181
+ colors.push(r, g, b, 1); // TODO: handle alpha
182
+ }
183
+ }
184
+ if (splitMeshes && newMesh) {
185
+ addMesh(modelNode, positions, normals, colors, material, options);
186
+ positions = [];
187
+ normals = [];
188
+ colors = colors ? [] : null;
189
+ newMesh = false;
190
+ }
191
+ }
192
+ if (positions.length > 0) {
193
+ addMesh(modelNode, positions, normals, colors, material, options);
194
+ }
195
+ }
196
+
197
+ function parseASCII(plugin, data, modelNode, options) {
198
+ const faceRegex = /facet([\s\S]*?)endfacet/g;
199
+ let faceCounter = 0;
200
+ const floatRegex = /[\s]+([+-]?(?:\d+.\d+|\d+.|\d+|.\d+)(?:[eE][+-]?\d+)?)/.source;
201
+ const vertexRegex = new RegExp('vertex' + floatRegex + floatRegex + floatRegex, 'g');
202
+ const normalRegex = new RegExp('normal' + floatRegex + floatRegex + floatRegex, 'g');
203
+ const positions = [];
204
+ const normals = [];
205
+ const colors = null;
206
+ let normalx;
207
+ let normaly;
208
+ let normalz;
209
+ let result;
210
+ let verticesPerFace;
211
+ let normalsPerFace;
212
+ let text;
213
+ while ((result = faceRegex.exec(data)) !== null) {
214
+ verticesPerFace = 0;
215
+ normalsPerFace = 0;
216
+ text = result[0];
217
+ while ((result = normalRegex.exec(text)) !== null) {
218
+ normalx = parseFloat(result[1]);
219
+ normaly = parseFloat(result[2]);
220
+ normalz = parseFloat(result[3]);
221
+ normalsPerFace++;
222
+ }
223
+ while ((result = vertexRegex.exec(text)) !== null) {
224
+ positions.push(parseFloat(result[1]), parseFloat(result[2]), parseFloat(result[3]));
225
+ normals.push(normalx, normaly, normalz);
226
+ verticesPerFace++;
227
+ }
228
+ if (normalsPerFace !== 1) {
229
+ plugin.error("Error in normal of face " + faceCounter);
230
+ }
231
+ if (verticesPerFace !== 3) {
232
+ plugin.error("Error in positions of face " + faceCounter);
233
+ }
234
+ faceCounter++;
235
+ }
236
+ const material = new MetallicMaterial(modelNode, {
237
+ roughness: 0.5
238
+ });
239
+ // var material = new PhongMaterial(modelNode, {
240
+ // diffuse: [0.4, 0.4, 0.4],
241
+ // reflectivity: 1,
242
+ // specular: [0.5, 0.5, 1.0]
243
+ // });
244
+ addMesh(modelNode, positions, normals, colors, material, options);
245
+ }
246
+
247
+ function addMesh(modelNode, positions, normals, colors, material, options) {
248
+
249
+ const indices = new Int32Array(positions.length / 3);
250
+ for (let ni = 0, len = indices.length; ni < len; ni++) {
251
+ indices[ni] = ni;
252
+ }
253
+
254
+ normals = normals && normals.length > 0 ? normals : null;
255
+ colors = colors && colors.length > 0 ? colors : null;
256
+
257
+ if (options.smoothNormals) {
258
+ math.faceToVertexNormals(positions, normals, options);
259
+ }
260
+
261
+ const rtcCenter = tempVec3a;
262
+
263
+ worldToRTCPositions(positions, positions, rtcCenter);
264
+
265
+ const geometry = new ReadableGeometry(modelNode, {
266
+ primitive: "triangles",
267
+ positions: positions,
268
+ normals: normals,
269
+ colors: colors,
270
+ indices: indices
271
+ });
272
+
273
+ const mesh = new Mesh(modelNode, {
274
+ rtcCenter: (rtcCenter[0] !== 0 || rtcCenter[1] !== 0 || rtcCenter[2] !== 0) ? rtcCenter : null,
275
+ geometry: geometry,
276
+ material: material,
277
+ edges: options.edges
278
+ });
279
+
280
+ modelNode.addChild(mesh);
281
+ }
282
+
283
+ function ensureString(buffer) {
284
+ if (typeof buffer !== 'string') {
285
+ return decodeText(new Uint8Array(buffer));
286
+ }
287
+ return buffer;
288
+ }
289
+
290
+ function ensureBinary(buffer) {
291
+ if (typeof buffer === 'string') {
292
+ const arrayBuffer = new Uint8Array(buffer.length);
293
+ for (let i = 0; i < buffer.length; i++) {
294
+ arrayBuffer[i] = buffer.charCodeAt(i) & 0xff; // implicitly assumes little-endian
295
+ }
296
+ return arrayBuffer.buffer || arrayBuffer;
297
+ } else {
298
+ return buffer;
299
+ }
300
+ }
301
+
302
+ function decodeText(array) {
303
+ if (typeof TextDecoder !== 'undefined') {
304
+ return new TextDecoder().decode(array);
305
+ }
306
+ let s = '';
307
+ for (let i = 0, il = array.length; i < il; i++) {
308
+ s += String.fromCharCode(array[i]); // Implicitly assumes little-endian.
309
+ }
310
+ return decodeURIComponent(escape(s));
311
+ }
312
+
313
+ export {STLSceneGraphLoader}
@@ -0,0 +1,2 @@
1
+ export * from "./STLDefaultDataSource.js";
2
+ export * from "./STLLoaderPlugin.js";