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,689 @@
1
+ import {Geometry} from './Geometry.js';
2
+ import {RenderState} from '../webgl/RenderState.js';
3
+ import {ArrayBuf} from '../webgl/ArrayBuf.js';
4
+ import {math} from '../math/math.js';
5
+ import {stats} from '../stats.js';
6
+ import {WEBGL_INFO} from '../webglInfo.js';
7
+ import {buildEdgeIndices} from '../math/buildEdgeIndices.js';
8
+ import {geometryCompressionUtils} from '../math/geometryCompressionUtils.js';
9
+
10
+ const memoryStats = stats.memory;
11
+ const bigIndicesSupported = WEBGL_INFO.SUPPORTED_EXTENSIONS["OES_element_index_uint"];
12
+ const IndexArrayType = bigIndicesSupported ? Uint32Array : Uint16Array;
13
+ const tempAABB = math.AABB3();
14
+
15
+ /**
16
+ * @desc A {@link Geometry} that keeps its geometry data in both browser and GPU memory.
17
+ *
18
+ * ReadableGeometry uses more memory than {@link VBOGeometry}, which only stores its geometry data in GPU memory.
19
+ *
20
+ * ## Usage
21
+ *
22
+ * Creating a {@link Mesh} with a ReadableGeometry that defines a single triangle, plus a {@link PhongMaterial} with diffuse {@link Texture}:
23
+ *
24
+ * [[Run this example](http://yjkkit.github.io/yjkkit-sdk/examples/#geometry_ReadableGeometry)]
25
+ *
26
+ * ````javascript
27
+ * import {Viewer, Mesh, ReadableGeometry, PhongMaterial, Texture} from "yjkkit-sdk.es.js";
28
+ *
29
+ * const viewer = new Viewer({
30
+ * canvasId: "myCanvas"
31
+ * });
32
+ *
33
+ * const myMesh = new Mesh(viewer.scene, {
34
+ * geometry: new ReadableGeometry(viewer.scene, {
35
+ * primitive: "triangles",
36
+ * positions: [0.0, 3, 0.0, -3, -3, 0.0, 3, -3, 0.0],
37
+ * normals: [0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0],
38
+ * uv: [0.0, 0.0, 0.5, 1.0, 1.0, 0.0],
39
+ * indices: [0, 1, 2]
40
+ * }),
41
+ * material: new PhongMaterial(viewer.scene, {
42
+ * diffuseMap: new Texture(viewer.scene, {
43
+ * src: "textures/diffuse/uvGrid2.jpg"
44
+ * }),
45
+ * backfaces: true
46
+ * })
47
+ * });
48
+ *
49
+ * // Get geometry data from browser memory:
50
+ *
51
+ * const positions = myMesh.geometry.positions; // Flat arrays
52
+ * const normals = myMesh.geometry.normals;
53
+ * const uv = myMesh.geometry.uv;
54
+ * const indices = myMesh.geometry.indices;
55
+ *
56
+ * ````
57
+ */
58
+ class ReadableGeometry extends Geometry {
59
+
60
+ /**
61
+ @private
62
+ */
63
+ get type() {
64
+ return "ReadableGeometry";
65
+ }
66
+
67
+ /**
68
+ * @private
69
+ * @returns {boolean}
70
+ */
71
+ get isReadableGeometry() {
72
+ return true;
73
+ }
74
+
75
+ /**
76
+ *
77
+ @class ReadableGeometry
78
+ @module yjkkit
79
+ @submodule geometry
80
+ @constructor
81
+ @param {Component} owner Owner component. When destroyed, the owner will destroy this component as well.
82
+ @param {*} [cfg] Configs
83
+ @param {String} [cfg.id] Optional ID, unique among all components in the parent {@link Scene},
84
+ generated automatically when omitted.
85
+ @param {String:Object} [cfg.meta] Optional map of user-defined metadata to attach to this Geometry.
86
+ @param [cfg.primitive="triangles"] {String} The primitive type. Accepted values are 'points', 'lines', 'line-loop', 'line-strip', 'triangles', 'triangle-strip' and 'triangle-fan'.
87
+ @param [cfg.positions] {Number[]} Positions array.
88
+ @param [cfg.normals] {Number[]} Vertex normal vectors array.
89
+ @param [cfg.uv] {Number[]} UVs array.
90
+ @param [cfg.colors] {Number[]} Vertex colors.
91
+ @param [cfg.indices] {Number[]} Indices array.
92
+ @param [cfg.autoVertexNormals=false] {Boolean} Set true to automatically generate normal vectors from the positions and
93
+ indices, if those are supplied.
94
+ @param [cfg.compressGeometry=false] {Boolean} Stores positions, colors, normals and UVs in compressGeometry and oct-encoded formats
95
+ for reduced memory footprint and GPU bus usage.
96
+ @param [cfg.edgeThreshold=10] {Number} When a {@link Mesh} renders this Geometry as wireframe,
97
+ this indicates the threshold angle (in degrees) between the face normals of adjacent triangles below which the edge is discarded.
98
+ @extends Component
99
+ * @param owner
100
+ * @param cfg
101
+ */
102
+ constructor(owner, cfg = {}) {
103
+
104
+ super(owner, cfg);
105
+
106
+ this._state = new RenderState({ // Arrays for emphasis effects are got from yjkkit.Geometry friend methods
107
+ compressGeometry: !!cfg.compressGeometry,
108
+ primitive: null, // WebGL enum
109
+ primitiveName: null, // String
110
+ positions: null, // Uint16Array when compressGeometry == true, else Float32Array
111
+ normals: null, // Uint8Array when compressGeometry == true, else Float32Array
112
+ colors: null,
113
+ uv: null, // Uint8Array when compressGeometry == true, else Float32Array
114
+ indices: null,
115
+ positionsDecodeMatrix: null, // Set when compressGeometry == true
116
+ uvDecodeMatrix: null, // Set when compressGeometry == true
117
+ positionsBuf: null,
118
+ normalsBuf: null,
119
+ colorsbuf: null,
120
+ uvBuf: null,
121
+ indicesBuf: null,
122
+ hash: ""
123
+ });
124
+
125
+ this._numTriangles = 0;
126
+
127
+ this._edgeThreshold = cfg.edgeThreshold || 10.0;
128
+
129
+ // Lazy-generated VBOs
130
+
131
+ this._edgeIndicesBuf = null;
132
+ this._pickTrianglePositionsBuf = null;
133
+ this._pickTriangleColorsBuf = null;
134
+
135
+ // Local-space Boundary3D
136
+
137
+ this._aabbDirty = true;
138
+
139
+ this._boundingSphere = true;
140
+ this._aabb = null;
141
+ this._aabbDirty = true;
142
+
143
+ this._obb = null;
144
+ this._obbDirty = true;
145
+
146
+ const state = this._state;
147
+ const gl = this.scene.canvas.gl;
148
+
149
+ // Primitive type
150
+
151
+ cfg.primitive = cfg.primitive || "triangles";
152
+ switch (cfg.primitive) {
153
+ case "points":
154
+ state.primitive = gl.POINTS;
155
+ state.primitiveName = cfg.primitive;
156
+ break;
157
+ case "lines":
158
+ state.primitive = gl.LINES;
159
+ state.primitiveName = cfg.primitive;
160
+ break;
161
+ case "line-loop":
162
+ state.primitive = gl.LINE_LOOP;
163
+ state.primitiveName = cfg.primitive;
164
+ break;
165
+ case "line-strip":
166
+ state.primitive = gl.LINE_STRIP;
167
+ state.primitiveName = cfg.primitive;
168
+ break;
169
+ case "triangles":
170
+ state.primitive = gl.TRIANGLES;
171
+ state.primitiveName = cfg.primitive;
172
+ break;
173
+ case "triangle-strip":
174
+ state.primitive = gl.TRIANGLE_STRIP;
175
+ state.primitiveName = cfg.primitive;
176
+ break;
177
+ case "triangle-fan":
178
+ state.primitive = gl.TRIANGLE_FAN;
179
+ state.primitiveName = cfg.primitive;
180
+ break;
181
+ default:
182
+ this.error("Unsupported value for 'primitive': '" + cfg.primitive +
183
+ "' - supported values are 'points', 'lines', 'line-loop', 'line-strip', 'triangles', " +
184
+ "'triangle-strip' and 'triangle-fan'. Defaulting to 'triangles'.");
185
+ state.primitive = gl.TRIANGLES;
186
+ state.primitiveName = cfg.primitive;
187
+ }
188
+
189
+ if (cfg.positions) {
190
+ if (this._state.compressGeometry) {
191
+ const bounds = geometryCompressionUtils.getPositionsBounds(cfg.positions);
192
+ const result = geometryCompressionUtils.compressPositions(cfg.positions, bounds.min, bounds.max);
193
+ state.positions = result.quantized;
194
+ state.positionsDecodeMatrix = result.decodeMatrix;
195
+ } else {
196
+ state.positions = cfg.positions.constructor === Float32Array ? cfg.positions : new Float32Array(cfg.positions);
197
+ }
198
+ }
199
+ if (cfg.colors) {
200
+ state.colors = cfg.colors.constructor === Float32Array ? cfg.colors : new Float32Array(cfg.colors);
201
+ }
202
+ if (cfg.uv) {
203
+ if (this._state.compressGeometry) {
204
+ const bounds = geometryCompressionUtils.getUVBounds(cfg.uv);
205
+ const result = geometryCompressionUtils.compressUVs(cfg.uv, bounds.min, bounds.max);
206
+ state.uv = result.quantized;
207
+ state.uvDecodeMatrix = result.decodeMatrix;
208
+ } else {
209
+ state.uv = cfg.uv.constructor === Float32Array ? cfg.uv : new Float32Array(cfg.uv);
210
+ }
211
+ }
212
+ if (cfg.normals) {
213
+ if (this._state.compressGeometry) {
214
+ state.normals = geometryCompressionUtils.compressNormals(cfg.normals);
215
+ } else {
216
+ state.normals = cfg.normals.constructor === Float32Array ? cfg.normals : new Float32Array(cfg.normals);
217
+ }
218
+ }
219
+ if (cfg.indices) {
220
+ if (!bigIndicesSupported && cfg.indices.constructor === Uint32Array) {
221
+ this.error("This WebGL implementation does not support Uint32Array");
222
+ return;
223
+ }
224
+ state.indices = (cfg.indices.constructor === Uint32Array || cfg.indices.constructor === Uint16Array) ? cfg.indices : new IndexArrayType(cfg.indices);
225
+ if (this._state.primitiveName === "triangles") {
226
+ this._numTriangles = (cfg.indices.length / 3);
227
+ }
228
+ }
229
+
230
+ this._buildHash();
231
+
232
+ memoryStats.meshes++;
233
+
234
+ this._buildVBOs();
235
+ }
236
+
237
+ _buildVBOs() {
238
+ const state = this._state;
239
+ const gl = this.scene.canvas.gl;
240
+ if (state.indices) {
241
+ state.indicesBuf = new ArrayBuf(gl, gl.ELEMENT_ARRAY_BUFFER, state.indices, state.indices.length, 1, gl.STATIC_DRAW);
242
+ memoryStats.indices += state.indicesBuf.numItems;
243
+ }
244
+ if (state.positions) {
245
+ state.positionsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, state.positions, state.positions.length, 3, gl.STATIC_DRAW);
246
+ memoryStats.positions += state.positionsBuf.numItems;
247
+ }
248
+ if (state.normals) {
249
+ let normalized = state.compressGeometry;
250
+ state.normalsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, state.normals, state.normals.length, 3, gl.STATIC_DRAW, normalized);
251
+ memoryStats.normals += state.normalsBuf.numItems;
252
+ }
253
+ if (state.colors) {
254
+ state.colorsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, state.colors, state.colors.length, 4, gl.STATIC_DRAW);
255
+ memoryStats.colors += state.colorsBuf.numItems;
256
+ }
257
+ if (state.uv) {
258
+ state.uvBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, state.uv, state.uv.length, 2, gl.STATIC_DRAW);
259
+ memoryStats.uvs += state.uvBuf.numItems;
260
+ }
261
+ }
262
+
263
+ _buildHash() {
264
+ const state = this._state;
265
+ const hash = ["/g"];
266
+ hash.push("/" + state.primitive + ";");
267
+ if (state.positions) {
268
+ hash.push("p");
269
+ }
270
+ if (state.colors) {
271
+ hash.push("c");
272
+ }
273
+ if (state.normals || state.autoVertexNormals) {
274
+ hash.push("n");
275
+ }
276
+ if (state.uv) {
277
+ hash.push("u");
278
+ }
279
+ if (state.compressGeometry) {
280
+ hash.push("cp");
281
+ }
282
+ hash.push(";");
283
+ state.hash = hash.join("");
284
+ }
285
+
286
+ _getEdgeIndices() {
287
+ if (!this._edgeIndicesBuf) {
288
+ this._buildEdgeIndices();
289
+ }
290
+ return this._edgeIndicesBuf;
291
+ }
292
+
293
+ _getPickTrianglePositions() {
294
+ if (!this._pickTrianglePositionsBuf) {
295
+ this._buildPickTriangleVBOs();
296
+ }
297
+ return this._pickTrianglePositionsBuf;
298
+ }
299
+
300
+ _getPickTriangleColors() {
301
+ if (!this._pickTriangleColorsBuf) {
302
+ this._buildPickTriangleVBOs();
303
+ }
304
+ return this._pickTriangleColorsBuf;
305
+ }
306
+
307
+ _buildEdgeIndices() { // FIXME: Does not adjust indices after other objects are deleted from vertex buffer!!
308
+ const state = this._state;
309
+ if (!state.positions || !state.indices) {
310
+ return;
311
+ }
312
+ const gl = this.scene.canvas.gl;
313
+ const edgeIndices = buildEdgeIndices(state.positions, state.indices, state.positionsDecodeMatrix, this._edgeThreshold);
314
+ this._edgeIndicesBuf = new ArrayBuf(gl, gl.ELEMENT_ARRAY_BUFFER, edgeIndices, edgeIndices.length, 1, gl.STATIC_DRAW);
315
+ memoryStats.indices += this._edgeIndicesBuf.numItems;
316
+ }
317
+
318
+ _buildPickTriangleVBOs() { // Builds positions and indices arrays that allow each triangle to have a unique color
319
+ const state = this._state;
320
+ if (!state.positions || !state.indices) {
321
+ return;
322
+ }
323
+ const gl = this.scene.canvas.gl;
324
+ const arrays = math.buildPickTriangles(state.positions, state.indices, state.compressGeometry);
325
+ const positions = arrays.positions;
326
+ const colors = arrays.colors;
327
+ this._pickTrianglePositionsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, positions, positions.length, 3, gl.STATIC_DRAW);
328
+ this._pickTriangleColorsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, colors, colors.length, 4, gl.STATIC_DRAW, true);
329
+ memoryStats.positions += this._pickTrianglePositionsBuf.numItems;
330
+ memoryStats.colors += this._pickTriangleColorsBuf.numItems;
331
+ }
332
+
333
+ _buildPickVertexVBOs() {
334
+ // var state = this._state;
335
+ // if (!state.positions || !state.indices) {
336
+ // return;
337
+ // }
338
+ // var gl = this.scene.canvas.gl;
339
+ // var arrays = math.buildPickVertices(state.positions, state.indices, state.compressGeometry);
340
+ // var pickVertexPositions = arrays.positions;
341
+ // var pickColors = arrays.colors;
342
+ // this._pickVertexPositionsBuf = new yjkkit.renderer.ArrayBuf(gl, gl.ARRAY_BUFFER, pickVertexPositions, pickVertexPositions.length, 3, gl.STATIC_DRAW);
343
+ // this._pickVertexColorsBuf = new yjkkit.renderer.ArrayBuf(gl, gl.ARRAY_BUFFER, pickColors, pickColors.length, 4, gl.STATIC_DRAW, true);
344
+ // memoryStats.positions += this._pickVertexPositionsBuf.numItems;
345
+ // memoryStats.colors += this._pickVertexColorsBuf.numItems;
346
+ }
347
+
348
+ _webglContextLost() {
349
+ if (this._sceneVertexBufs) {
350
+ this._sceneVertexBufs.webglContextLost();
351
+ }
352
+ }
353
+
354
+ _webglContextRestored() {
355
+ if (this._sceneVertexBufs) {
356
+ this._sceneVertexBufs.webglContextRestored();
357
+ }
358
+ this._buildVBOs();
359
+ this._edgeIndicesBuf = null;
360
+ this._pickVertexPositionsBuf = null;
361
+ this._pickTrianglePositionsBuf = null;
362
+ this._pickTriangleColorsBuf = null;
363
+ this._pickVertexPositionsBuf = null;
364
+ this._pickVertexColorsBuf = null;
365
+ }
366
+
367
+ /**
368
+ * Gets the Geometry's primitive type.
369
+
370
+ Valid types are: 'points', 'lines', 'line-loop', 'line-strip', 'triangles', 'triangle-strip' and 'triangle-fan'.
371
+
372
+ @property primitive
373
+ @default "triangles"
374
+ @type {String}
375
+ */
376
+ get primitive() {
377
+ return this._state.primitiveName;
378
+ }
379
+
380
+ /**
381
+ Indicates if this Geometry is quantized.
382
+
383
+ Compression is an internally-performed optimization which stores positions, colors, normals and UVs
384
+ in quantized and oct-encoded formats for reduced memory footprint and GPU bus usage.
385
+
386
+ Quantized geometry may not be updated.
387
+
388
+ @property compressGeometry
389
+ @default false
390
+ @type {Boolean}
391
+ @final
392
+ */
393
+ get compressGeometry() {
394
+ return this._state.compressGeometry;
395
+ }
396
+
397
+ /**
398
+ The Geometry's vertex positions.
399
+
400
+ @property positions
401
+ @default null
402
+ @type {Number[]}
403
+ */
404
+ get positions() {
405
+ if (!this._state.positions) {
406
+ return null;
407
+ }
408
+ if (!this._state.compressGeometry) {
409
+ return this._state.positions;
410
+ }
411
+ if (!this._decompressedPositions) {
412
+ this._decompressedPositions = new Float32Array(this._state.positions.length);
413
+ geometryCompressionUtils.decompressPositions(this._state.positions, this._state.positionsDecodeMatrix, this._decompressedPositions);
414
+ }
415
+ return this._decompressedPositions;
416
+ }
417
+
418
+ set positions(newPositions) {
419
+ const state = this._state;
420
+ const positions = state.positions;
421
+ if (!positions) {
422
+ this.error("can't update geometry positions - geometry has no positions");
423
+ return;
424
+ }
425
+ if (positions.length !== newPositions.length) {
426
+ this.error("can't update geometry positions - new positions are wrong length");
427
+ return;
428
+ }
429
+ if (this._state.compressGeometry) {
430
+ const bounds = geometryCompressionUtils.getPositionsBounds(newPositions);
431
+ const result = geometryCompressionUtils.compressPositions(newPositions, bounds.min, bounds.max);
432
+ newPositions = result.quantized; // TODO: Copy in-place
433
+ state.positionsDecodeMatrix = result.decodeMatrix;
434
+ }
435
+ positions.set(newPositions);
436
+ if (state.positionsBuf) {
437
+ state.positionsBuf.setData(positions);
438
+ }
439
+ this._setAABBDirty();
440
+ this.glRedraw();
441
+ }
442
+
443
+ /**
444
+ The Geometry's vertex normals.
445
+
446
+ @property normals
447
+ @default null
448
+ @type {Number[]}
449
+ */
450
+ get normals() {
451
+ if (!this._state.normals) {
452
+ return;
453
+ }
454
+ if (!this._state.compressGeometry) {
455
+ return this._state.normals;
456
+ }
457
+ if (!this._decompressedNormals) {
458
+ const lenCompressed = this._state.normals.length;
459
+ const lenDecompressed = lenCompressed + (lenCompressed / 2); // 2 -> 3
460
+ this._decompressedNormals = new Float32Array(lenDecompressed);
461
+ geometryCompressionUtils.decompressNormals(this._state.normals, this._decompressedNormals);
462
+ }
463
+ return this._decompressedNormals;
464
+ }
465
+
466
+ set normals(newNormals) {
467
+ if (this._state.compressGeometry) {
468
+ this.error("can't update geometry normals - quantized geometry is immutable"); // But will be eventually
469
+ return;
470
+ }
471
+ const state = this._state;
472
+ const normals = state.normals;
473
+ if (!normals) {
474
+ this.error("can't update geometry normals - geometry has no normals");
475
+ return;
476
+ }
477
+ if (normals.length !== newNormals.length) {
478
+ this.error("can't update geometry normals - new normals are wrong length");
479
+ return;
480
+ }
481
+ normals.set(newNormals);
482
+ if (state.normalsBuf) {
483
+ state.normalsBuf.setData(normals);
484
+ }
485
+ this.glRedraw();
486
+ }
487
+
488
+
489
+ /**
490
+ The Geometry's UV coordinates.
491
+
492
+ @property uv
493
+ @default null
494
+ @type {Number[]}
495
+ */
496
+ get uv() {
497
+ if (!this._state.uv) {
498
+ return null;
499
+ }
500
+ if (!this._state.compressGeometry) {
501
+ return this._state.uv;
502
+ }
503
+ if (!this._decompressedUV) {
504
+ this._decompressedUV = new Float32Array(this._state.uv.length);
505
+ geometryCompressionUtils.decompressUVs(this._state.uv, this._state.uvDecodeMatrix, this._decompressedUV);
506
+ }
507
+ return this._decompressedUV;
508
+ }
509
+
510
+ set uv(newUV) {
511
+ if (this._state.compressGeometry) {
512
+ this.error("can't update geometry UVs - quantized geometry is immutable"); // But will be eventually
513
+ return;
514
+ }
515
+ const state = this._state;
516
+ const uv = state.uv;
517
+ if (!uv) {
518
+ this.error("can't update geometry UVs - geometry has no UVs");
519
+ return;
520
+ }
521
+ if (uv.length !== newUV.length) {
522
+ this.error("can't update geometry UVs - new UVs are wrong length");
523
+ return;
524
+ }
525
+ uv.set(newUV);
526
+ if (state.uvBuf) {
527
+ state.uvBuf.setData(uv);
528
+ }
529
+ this.glRedraw();
530
+ }
531
+
532
+ /**
533
+ The Geometry's vertex colors.
534
+
535
+ @property colors
536
+ @default null
537
+ @type {Number[]}
538
+ */
539
+ get colors() {
540
+ return this._state.colors;
541
+ }
542
+
543
+ set colors(newColors) {
544
+ if (this._state.compressGeometry) {
545
+ this.error("can't update geometry colors - quantized geometry is immutable"); // But will be eventually
546
+ return;
547
+ }
548
+ const state = this._state;
549
+ const colors = state.colors;
550
+ if (!colors) {
551
+ this.error("can't update geometry colors - geometry has no colors");
552
+ return;
553
+ }
554
+ if (colors.length !== newColors.length) {
555
+ this.error("can't update geometry colors - new colors are wrong length");
556
+ return;
557
+ }
558
+ colors.set(newColors);
559
+ if (state.colorsBuf) {
560
+ state.colorsBuf.setData(colors);
561
+ }
562
+ this.glRedraw();
563
+ }
564
+
565
+ /**
566
+ The Geometry's indices.
567
+
568
+ If ````yjkkit.WEBGL_INFO.SUPPORTED_EXTENSIONS["OES_element_index_uint"]```` is true, then this can be
569
+ a ````Uint32Array````, otherwise it needs to be a ````Uint16Array````.
570
+
571
+ @property indices
572
+ @default null
573
+ @type Uint16Array | Uint32Array
574
+ @final
575
+ */
576
+ get indices() {
577
+ return this._state.indices;
578
+ }
579
+
580
+ /**
581
+ * Local-space axis-aligned 3D boundary (AABB) of this geometry.
582
+ *
583
+ * The AABB is represented by a six-element Float64Array containing the min/max extents of the
584
+ * axis-aligned volume, ie. ````[xmin, ymin,zmin,xmax,ymax, zmax]````.
585
+ *
586
+ * @property aabb
587
+ * @final
588
+ * @type {Number[]}
589
+ */
590
+ get aabb() {
591
+ if (this._aabbDirty) {
592
+ if (!this._aabb) {
593
+ this._aabb = math.AABB3();
594
+ }
595
+ math.positions3ToAABB3(this._state.positions, this._aabb, this._state.positionsDecodeMatrix);
596
+ this._aabbDirty = false;
597
+ }
598
+ return this._aabb;
599
+ }
600
+
601
+ /**
602
+ * Local-space oriented 3D boundary (OBB) of this geometry.
603
+ *
604
+ * The OBB is represented by a 32-element Float64Array containing the eight vertices of the box,
605
+ * where each vertex is a homogeneous coordinate having [x,y,z,w] elements.
606
+ *
607
+ * @property obb
608
+ * @final
609
+ * @type {Number[]}
610
+ */
611
+ get obb() {
612
+ if (this._obbDirty) {
613
+ if (!this._obb) {
614
+ this._obb = math.OBB3();
615
+ }
616
+ math.positions3ToAABB3(this._state.positions, tempAABB, this._state.positionsDecodeMatrix);
617
+ math.AABB3ToOBB3(tempAABB, this._obb);
618
+ this._obbDirty = false;
619
+ }
620
+ return this._obb;
621
+ }
622
+
623
+ /**
624
+ * Approximate number of triangles in this ReadableGeometry.
625
+ *
626
+ * Will be zero if {@link ReadableGeometry#primitive} is not 'triangles', 'triangle-strip' or 'triangle-fan'.
627
+ *
628
+ * @type {Number}
629
+ */
630
+ get numTriangles() {
631
+ return this._numTriangles;
632
+ }
633
+
634
+ _setAABBDirty() {
635
+ if (this._aabbDirty) {
636
+ return;
637
+ }
638
+ this._aabbDirty = true;
639
+ this._aabbDirty = true;
640
+ this._obbDirty = true;
641
+ }
642
+
643
+ _getState() {
644
+ return this._state;
645
+ }
646
+
647
+ /**
648
+ * Destroys this ReadableGeometry
649
+ */
650
+ destroy() {
651
+ super.destroy();
652
+ const state = this._state;
653
+ if (state.indicesBuf) {
654
+ state.indicesBuf.destroy();
655
+ }
656
+ if (state.positionsBuf) {
657
+ state.positionsBuf.destroy();
658
+ }
659
+ if (state.normalsBuf) {
660
+ state.normalsBuf.destroy();
661
+ }
662
+ if (state.uvBuf) {
663
+ state.uvBuf.destroy();
664
+ }
665
+ if (state.colorsBuf) {
666
+ state.colorsBuf.destroy();
667
+ }
668
+ if (this._edgeIndicesBuf) {
669
+ this._edgeIndicesBuf.destroy();
670
+ }
671
+ if (this._pickTrianglePositionsBuf) {
672
+ this._pickTrianglePositionsBuf.destroy();
673
+ }
674
+ if (this._pickTriangleColorsBuf) {
675
+ this._pickTriangleColorsBuf.destroy();
676
+ }
677
+ if (this._pickVertexPositionsBuf) {
678
+ this._pickVertexPositionsBuf.destroy();
679
+ }
680
+ if (this._pickVertexColorsBuf) {
681
+ this._pickVertexColorsBuf.destroy();
682
+ }
683
+ state.destroy();
684
+ memoryStats.meshes--;
685
+ }
686
+ }
687
+
688
+
689
+ export {ReadableGeometry};