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,969 @@
1
+ import {WEBGL_INFO} from "../../../../webglInfo.js";
2
+ import {ENTITY_FLAGS} from '../../ENTITY_FLAGS.js';
3
+ import {RENDER_PASSES} from '../../RENDER_PASSES.js';
4
+
5
+ import {math} from "../../../../math/math.js";
6
+ import {buildEdgeIndices} from '../../../../math/buildEdgeIndices.js';
7
+ import {RenderState} from "../../../../webgl/RenderState.js";
8
+ import {ArrayBuf} from "../../../../webgl/ArrayBuf.js";
9
+ import {geometryCompressionUtils} from "../../../../math/geometryCompressionUtils.js";
10
+ import {getInstancingRenderers} from "./TrianglesInstancingRenderers.js";
11
+ import {quantizePositions, octEncodeNormals} from "../../compression.js";
12
+
13
+ const bigIndicesSupported = WEBGL_INFO.SUPPORTED_EXTENSIONS["OES_element_index_uint"];
14
+
15
+ const tempUint8Vec4 = new Uint8Array(4);
16
+ const tempVec4a = math.vec4([0, 0, 0, 1]);
17
+ const tempVec4b = math.vec4([0, 0, 0, 1]);
18
+ const tempVec4c = math.vec4([0, 0, 0, 1]);
19
+ const tempVec3fa = new Float32Array(3);
20
+
21
+ /**
22
+ * @private
23
+ */
24
+ class TrianglesInstancingLayer {
25
+
26
+ /**
27
+ * @param model
28
+ * @param cfg
29
+ * @param cfg.layerIndex
30
+ * @param cfg.positions Flat float Local-space positions array.
31
+ * @param [cfg.normals] Flat float normals array.
32
+ * @param cfg.indices Flat int indices array.
33
+ * @param [cfg.edgeIndices] Flat int edges indices array.
34
+ * @param cfg.edgeThreshold
35
+ * @param cfg.rtcCenter
36
+ * @params cfg.solid
37
+ */
38
+ constructor(model, cfg) {
39
+
40
+ /**
41
+ * State sorting key.
42
+ * @type {string}
43
+ */
44
+ this.sortId = "TrianglesInstancingLayer" + cfg.solid ? "-solid" : "-surface";
45
+
46
+ /**
47
+ * Index of this InstancingLayer in PerformanceModel#_layerList
48
+ * @type {Number}
49
+ */
50
+ this.layerIndex = cfg.layerIndex;
51
+
52
+ this._instancingRenderers = getInstancingRenderers(model.scene);
53
+ this.model = model;
54
+ this._aabb = math.collapseAABB3();
55
+
56
+ const stateCfg = {
57
+ positionsDecodeMatrix: math.mat4(),
58
+ numInstances: 0,
59
+ obb: math.OBB3(),
60
+ rtcCenter: null
61
+ };
62
+
63
+ const preCompressed = (!!cfg.positionsDecodeMatrix);
64
+ const gl = this.model.scene.canvas.gl;
65
+
66
+ if (cfg.positions) {
67
+
68
+ if (preCompressed) {
69
+
70
+ let normalized = false;
71
+ stateCfg.positionsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, cfg.positions, cfg.positions.length, 3, gl.STATIC_DRAW, normalized);
72
+ stateCfg.positionsDecodeMatrix.set(cfg.positionsDecodeMatrix);
73
+
74
+ let localAABB = math.collapseAABB3();
75
+ math.expandAABB3Points3(localAABB, cfg.positions);
76
+ geometryCompressionUtils.decompressAABB(localAABB, stateCfg.positionsDecodeMatrix);
77
+ math.AABB3ToOBB3(localAABB, stateCfg.obb);
78
+
79
+ } else {
80
+
81
+ let lenPositions = cfg.positions.length;
82
+ let localAABB = math.collapseAABB3();
83
+ math.expandAABB3Points3(localAABB, cfg.positions);
84
+ math.AABB3ToOBB3(localAABB, stateCfg.obb);
85
+ const quantizedPositions = quantizePositions(cfg.positions, localAABB, stateCfg.positionsDecodeMatrix);
86
+ let normalized = false;
87
+ stateCfg.positionsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, quantizedPositions, lenPositions, 3, gl.STATIC_DRAW, normalized);
88
+ }
89
+ }
90
+
91
+ if (cfg.normals) {
92
+
93
+ if (preCompressed) {
94
+
95
+ const normalized = true; // For oct-encoded UInt8
96
+ stateCfg.normalsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, cfg.normals, cfg.normals.length, 3, gl.STATIC_DRAW, normalized);
97
+
98
+ } else {
99
+
100
+ const compressedNormals = octEncodeNormals(cfg.normals);
101
+ const normalized = true; // For oct-encoded UInt8
102
+ stateCfg.normalsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, compressedNormals, compressedNormals.length, 3, gl.STATIC_DRAW, normalized);
103
+ }
104
+ }
105
+
106
+ if (cfg.indices) {
107
+ stateCfg.indicesBuf = new ArrayBuf(gl, gl.ELEMENT_ARRAY_BUFFER, bigIndicesSupported ? new Uint32Array(cfg.indices) : new Uint16Array(cfg.indices), cfg.indices.length, 1, gl.STATIC_DRAW);
108
+ }
109
+
110
+ let edgeIndices = cfg.edgeIndices;
111
+ if (!edgeIndices) {
112
+ edgeIndices = buildEdgeIndices(cfg.positions, cfg.indices, null, cfg.edgeThreshold || 10);
113
+ }
114
+ stateCfg.edgeIndicesBuf = new ArrayBuf(gl, gl.ELEMENT_ARRAY_BUFFER, bigIndicesSupported ? new Uint32Array(edgeIndices) : new Uint16Array(edgeIndices), edgeIndices.length, 1, gl.STATIC_DRAW);
115
+
116
+
117
+ this._state = new RenderState(stateCfg);
118
+
119
+ // These counts are used to avoid unnecessary render passes
120
+ this._numPortions = 0;
121
+ this._numVisibleLayerPortions = 0;
122
+ this._numTransparentLayerPortions = 0;
123
+ this._numXRayedLayerPortions = 0;
124
+ this._numHighlightedLayerPortions = 0;
125
+ this._numSelectedLayerPortions = 0;
126
+ this._numClippableLayerPortions = 0;
127
+ this._numEdgesLayerPortions = 0;
128
+ this._numPickableLayerPortions = 0;
129
+ this._numCulledLayerPortions = 0;
130
+
131
+ /** @private */
132
+ this.numIndices = (cfg.indices) ? cfg.indices.length / 3 : 0;
133
+
134
+ // Vertex arrays
135
+ this._colors = [];
136
+ this._metallicRoughness = [];
137
+ this._pickColors = [];
138
+ this._offsets = [];
139
+
140
+ // Modeling matrix per instance, array for each column
141
+ this._modelMatrixCol0 = [];
142
+ this._modelMatrixCol1 = [];
143
+ this._modelMatrixCol2 = [];
144
+
145
+ // Modeling normal matrix per instance, array for each column
146
+ this._modelNormalMatrixCol0 = [];
147
+ this._modelNormalMatrixCol1 = [];
148
+ this._modelNormalMatrixCol2 = [];
149
+
150
+ this._portions = [];
151
+
152
+ if (cfg.rtcCenter) {
153
+ this._state.rtcCenter = math.vec3(cfg.rtcCenter);
154
+ }
155
+
156
+ this._finalized = false;
157
+
158
+ /**
159
+ * The axis-aligned World-space boundary of this InstancingLayer's positions.
160
+ * @type {*|Float64Array}
161
+ */
162
+ this.aabb = math.collapseAABB3();
163
+
164
+ /**
165
+ * When true, this layer contains solid triangle meshes, otherwise this layer contains surface triangle meshes
166
+ * @type {boolean}
167
+ */
168
+ this.solid = !!cfg.solid;
169
+ }
170
+
171
+ /**
172
+ * Creates a new portion within this InstancingLayer, returns the new portion ID.
173
+ *
174
+ * The portion will instance this InstancingLayer's geometry.
175
+ *
176
+ * Gives the portion the specified color and matrix.
177
+ *
178
+ * @param cfg Portion params
179
+ * @param cfg.color Color [0..255,0..255,0..255]
180
+ * @param cfg.metallic Metalness factor [0..255]
181
+ * @param cfg.roughness Roughness factor [0..255]
182
+ * @param cfg.opacity Opacity [0..255].
183
+ * @param cfg.meshMatrix Flat float 4x4 matrix.
184
+ * @param [cfg.worldMatrix] Flat float 4x4 matrix.
185
+ * @param cfg.worldAABB Flat float AABB.
186
+ * @param cfg.pickColor Quantized pick color
187
+ * @returns {number} Portion ID.
188
+ */
189
+ createPortion(cfg) {
190
+
191
+ const color = cfg.color;
192
+ const metallic = cfg.metallic;
193
+ const roughness = cfg.roughness;
194
+ const opacity = cfg.opacity;
195
+ const meshMatrix = cfg.meshMatrix;
196
+ const worldMatrix = cfg.worldMatrix;
197
+ const worldAABB = cfg.aabb;
198
+ const pickColor = cfg.pickColor;
199
+
200
+ if (this._finalized) {
201
+ throw "Already finalized";
202
+ }
203
+
204
+ // TODO: find AABB for portion by transforming the geometry local AABB by the given meshMatrix?
205
+
206
+ const r = color[0]; // Color is pre-quantized by PerformanceModel
207
+ const g = color[1];
208
+ const b = color[2];
209
+ const a = color[3];
210
+
211
+ this._colors.push(r);
212
+ this._colors.push(g);
213
+ this._colors.push(b);
214
+ this._colors.push(opacity);
215
+
216
+ this._metallicRoughness.push((metallic !== null && metallic !== undefined) ? metallic : 0);
217
+ this._metallicRoughness.push((roughness !== null && roughness !== undefined) ? roughness : 255);
218
+
219
+ if (this.model.scene.entityOffsetsEnabled) {
220
+ this._offsets.push(0);
221
+ this._offsets.push(0);
222
+ this._offsets.push(0);
223
+ }
224
+
225
+ this._modelMatrixCol0.push(meshMatrix[0]);
226
+ this._modelMatrixCol0.push(meshMatrix[4]);
227
+ this._modelMatrixCol0.push(meshMatrix[8]);
228
+ this._modelMatrixCol0.push(meshMatrix[12]);
229
+
230
+ this._modelMatrixCol1.push(meshMatrix[1]);
231
+ this._modelMatrixCol1.push(meshMatrix[5]);
232
+ this._modelMatrixCol1.push(meshMatrix[9]);
233
+ this._modelMatrixCol1.push(meshMatrix[13]);
234
+
235
+ this._modelMatrixCol2.push(meshMatrix[2]);
236
+ this._modelMatrixCol2.push(meshMatrix[6]);
237
+ this._modelMatrixCol2.push(meshMatrix[10]);
238
+ this._modelMatrixCol2.push(meshMatrix[14]);
239
+
240
+ // Note: order of inverse and transpose doesn't matter
241
+
242
+ let transposedMat = math.transposeMat4(meshMatrix, math.mat4()); // TODO: Use cached matrix
243
+ let normalMatrix = math.inverseMat4(transposedMat);
244
+
245
+ this._modelNormalMatrixCol0.push(normalMatrix[0]);
246
+ this._modelNormalMatrixCol0.push(normalMatrix[4]);
247
+ this._modelNormalMatrixCol0.push(normalMatrix[8]);
248
+ this._modelNormalMatrixCol0.push(normalMatrix[12]);
249
+
250
+ this._modelNormalMatrixCol1.push(normalMatrix[1]);
251
+ this._modelNormalMatrixCol1.push(normalMatrix[5]);
252
+ this._modelNormalMatrixCol1.push(normalMatrix[9]);
253
+ this._modelNormalMatrixCol1.push(normalMatrix[13]);
254
+
255
+ this._modelNormalMatrixCol2.push(normalMatrix[2]);
256
+ this._modelNormalMatrixCol2.push(normalMatrix[6]);
257
+ this._modelNormalMatrixCol2.push(normalMatrix[10]);
258
+ this._modelNormalMatrixCol2.push(normalMatrix[14]);
259
+
260
+ // Per-vertex pick colors
261
+
262
+ this._pickColors.push(pickColor[0]);
263
+ this._pickColors.push(pickColor[1]);
264
+ this._pickColors.push(pickColor[2]);
265
+ this._pickColors.push(pickColor[3]);
266
+
267
+ // Expand AABB
268
+
269
+ math.collapseAABB3(worldAABB);
270
+ const obb = this._state.obb;
271
+ const lenPositions = obb.length;
272
+ for (let i = 0; i < lenPositions; i += 4) {
273
+ tempVec4a[0] = obb[i + 0];
274
+ tempVec4a[1] = obb[i + 1];
275
+ tempVec4a[2] = obb[i + 2];
276
+ math.transformPoint4(meshMatrix, tempVec4a, tempVec4b);
277
+ if (worldMatrix) {
278
+ math.transformPoint4(worldMatrix, tempVec4b, tempVec4c);
279
+ math.expandAABB3Point3(worldAABB, tempVec4c);
280
+ } else {
281
+ math.expandAABB3Point3(worldAABB, tempVec4b);
282
+ }
283
+ }
284
+
285
+ if (this._state.rtcCenter) {
286
+ const rtcCenter = this._state.rtcCenter;
287
+ worldAABB[0] += rtcCenter[0];
288
+ worldAABB[1] += rtcCenter[1];
289
+ worldAABB[2] += rtcCenter[2];
290
+ worldAABB[3] += rtcCenter[0];
291
+ worldAABB[4] += rtcCenter[1];
292
+ worldAABB[5] += rtcCenter[2];
293
+ }
294
+
295
+ math.expandAABB3(this.aabb, worldAABB);
296
+
297
+ this._state.numInstances++;
298
+
299
+ const portionId = this._portions.length;
300
+ this._portions.push({});
301
+
302
+ this._numPortions++;
303
+ this.model.numPortions++;
304
+
305
+ return portionId;
306
+ }
307
+
308
+ finalize() {
309
+ if (this._finalized) {
310
+ throw "Already finalized";
311
+ }
312
+ const gl = this.model.scene.canvas.gl;
313
+ const colorsLength = this._colors.length;
314
+ const flagsLength = colorsLength;
315
+ if (colorsLength > 0) {
316
+ let notNormalized = false;
317
+ this._state.colorsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, new Uint8Array(this._colors), this._colors.length, 4, gl.DYNAMIC_DRAW, notNormalized);
318
+ this._colors = []; // Release memory
319
+ }
320
+ if (this._metallicRoughness.length > 0) {
321
+ const metallicRoughness = new Uint8Array(this._metallicRoughness);
322
+ let normalized = false;
323
+ this._state.metallicRoughnessBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, metallicRoughness, this._metallicRoughness.length, 2, gl.STATIC_DRAW, normalized);
324
+ }
325
+ if (flagsLength > 0) {
326
+ // Because we only build flags arrays here,
327
+ // get their length from the colors array
328
+ let notNormalized = false;
329
+ let normalized = true;
330
+ this._state.flagsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, new Uint8Array(flagsLength), flagsLength, 4, gl.DYNAMIC_DRAW, notNormalized);
331
+ this._state.flags2Buf = new ArrayBuf(gl, gl.ARRAY_BUFFER, new Uint8Array(flagsLength), flagsLength, 4, gl.DYNAMIC_DRAW, normalized);
332
+ }
333
+ if (this.model.scene.entityOffsetsEnabled) {
334
+ if (this._offsets.length > 0) {
335
+ const notNormalized = false;
336
+ this._state.offsetsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, new Float32Array(this._offsets), this._offsets.length, 3, gl.DYNAMIC_DRAW, notNormalized);
337
+ this._offsets = []; // Release memory
338
+ }
339
+ }
340
+ if (this._modelMatrixCol0.length > 0) {
341
+
342
+ const normalized = false;
343
+
344
+ this._state.modelMatrixCol0Buf = new ArrayBuf(gl, gl.ARRAY_BUFFER, new Float32Array(this._modelMatrixCol0), this._modelMatrixCol0.length, 4, gl.STATIC_DRAW, normalized);
345
+ this._state.modelMatrixCol1Buf = new ArrayBuf(gl, gl.ARRAY_BUFFER, new Float32Array(this._modelMatrixCol1), this._modelMatrixCol1.length, 4, gl.STATIC_DRAW, normalized);
346
+ this._state.modelMatrixCol2Buf = new ArrayBuf(gl, gl.ARRAY_BUFFER, new Float32Array(this._modelMatrixCol2), this._modelMatrixCol2.length, 4, gl.STATIC_DRAW, normalized);
347
+ this._modelMatrixCol0 = [];
348
+ this._modelMatrixCol1 = [];
349
+ this._modelMatrixCol2 = [];
350
+
351
+ this._state.modelNormalMatrixCol0Buf = new ArrayBuf(gl, gl.ARRAY_BUFFER, new Float32Array(this._modelNormalMatrixCol0), this._modelNormalMatrixCol0.length, 4, gl.STATIC_DRAW, normalized);
352
+ this._state.modelNormalMatrixCol1Buf = new ArrayBuf(gl, gl.ARRAY_BUFFER, new Float32Array(this._modelNormalMatrixCol1), this._modelNormalMatrixCol1.length, 4, gl.STATIC_DRAW, normalized);
353
+ this._state.modelNormalMatrixCol2Buf = new ArrayBuf(gl, gl.ARRAY_BUFFER, new Float32Array(this._modelNormalMatrixCol2), this._modelNormalMatrixCol2.length, 4, gl.STATIC_DRAW, normalized);
354
+ this._modelNormalMatrixCol0 = [];
355
+ this._modelNormalMatrixCol1 = [];
356
+ this._modelNormalMatrixCol2 = [];
357
+ }
358
+ if (this._pickColors.length > 0) {
359
+ const normalized = false;
360
+ this._state.pickColorsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, new Uint8Array(this._pickColors), this._pickColors.length, 4, gl.STATIC_DRAW, normalized);
361
+ this._pickColors = []; // Release memory
362
+ }
363
+ this._finalized = true;
364
+ }
365
+
366
+ // The following setters are called by PerformanceMesh, in turn called by PerformanceNode, only after the layer is finalized.
367
+ // It's important that these are called after finalize() in order to maintain integrity of counts like _numVisibleLayerPortions etc.
368
+
369
+ initFlags(portionId, flags, meshTransparent) {
370
+ if (flags & ENTITY_FLAGS.VISIBLE) {
371
+ this._numVisibleLayerPortions++;
372
+ this.model.numVisibleLayerPortions++;
373
+ }
374
+ if (flags & ENTITY_FLAGS.HIGHLIGHTED) {
375
+ this._numHighlightedLayerPortions++;
376
+ this.model.numHighlightedLayerPortions++;
377
+ }
378
+ if (flags & ENTITY_FLAGS.XRAYED) {
379
+ this._numXRayedLayerPortions++;
380
+ this.model.numXRayedLayerPortions++;
381
+ }
382
+ if (flags & ENTITY_FLAGS.SELECTED) {
383
+ this._numSelectedLayerPortions++;
384
+ this.model.numSelectedLayerPortions++;
385
+ }
386
+ if (flags & ENTITY_FLAGS.CLIPPABLE) {
387
+ this._numClippableLayerPortions++;
388
+ this.model.numClippableLayerPortions++;
389
+ }
390
+ if (flags & ENTITY_FLAGS.EDGES) {
391
+ this._numEdgesLayerPortions++;
392
+ this.model.numEdgesLayerPortions++;
393
+ }
394
+ if (flags & ENTITY_FLAGS.PICKABLE) {
395
+ this._numPickableLayerPortions++;
396
+ this.model.numPickableLayerPortions++;
397
+ }
398
+ if (flags & ENTITY_FLAGS.CULLED) {
399
+ this._numCulledLayerPortions++;
400
+ this.model.numCulledLayerPortions++;
401
+ }
402
+ if (meshTransparent) {
403
+ this._numTransparentLayerPortions++;
404
+ this.model.numTransparentLayerPortions++;
405
+ }
406
+ this._setFlags(portionId, flags, meshTransparent);
407
+ this._setFlags2(portionId, flags);
408
+ }
409
+
410
+ setVisible(portionId, flags, meshTransparent) {
411
+ if (!this._finalized) {
412
+ throw "Not finalized";
413
+ }
414
+ if (flags & ENTITY_FLAGS.VISIBLE) {
415
+ this._numVisibleLayerPortions++;
416
+ this.model.numVisibleLayerPortions++;
417
+ } else {
418
+ this._numVisibleLayerPortions--;
419
+ this.model.numVisibleLayerPortions--;
420
+ }
421
+ this._setFlags(portionId, flags, meshTransparent);
422
+ }
423
+
424
+ setHighlighted(portionId, flags, meshTransparent) {
425
+ if (!this._finalized) {
426
+ throw "Not finalized";
427
+ }
428
+ if (flags & ENTITY_FLAGS.HIGHLIGHTED) {
429
+ this._numHighlightedLayerPortions++;
430
+ this.model.numHighlightedLayerPortions++;
431
+ } else {
432
+ this._numHighlightedLayerPortions--;
433
+ this.model.numHighlightedLayerPortions--;
434
+ }
435
+ this._setFlags(portionId, flags, meshTransparent);
436
+ }
437
+
438
+ setXRayed(portionId, flags, meshTransparent) {
439
+ if (!this._finalized) {
440
+ throw "Not finalized";
441
+ }
442
+ if (flags & ENTITY_FLAGS.XRAYED) {
443
+ this._numXRayedLayerPortions++;
444
+ this.model.numXRayedLayerPortions++;
445
+ } else {
446
+ this._numXRayedLayerPortions--;
447
+ this.model.numXRayedLayerPortions--;
448
+ }
449
+ this._setFlags(portionId, flags, meshTransparent);
450
+ }
451
+
452
+ setSelected(portionId, flags, meshTransparent) {
453
+ if (!this._finalized) {
454
+ throw "Not finalized";
455
+ }
456
+ if (flags & ENTITY_FLAGS.SELECTED) {
457
+ this._numSelectedLayerPortions++;
458
+ this.model.numSelectedLayerPortions++;
459
+ } else {
460
+ this._numSelectedLayerPortions--;
461
+ this.model.numSelectedLayerPortions--;
462
+ }
463
+ this._setFlags(portionId, flags, meshTransparent);
464
+ }
465
+
466
+ setEdges(portionId, flags, meshTransparent) {
467
+ if (!this._finalized) {
468
+ throw "Not finalized";
469
+ }
470
+ if (flags & ENTITY_FLAGS.EDGES) {
471
+ this._numEdgesLayerPortions++;
472
+ this.model.numEdgesLayerPortions++;
473
+ } else {
474
+ this._numEdgesLayerPortions--;
475
+ this.model.numEdgesLayerPortions--;
476
+ }
477
+ this._setFlags(portionId, flags, meshTransparent);
478
+ }
479
+
480
+ setClippable(portionId, flags) {
481
+ if (!this._finalized) {
482
+ throw "Not finalized";
483
+ }
484
+ if (flags & ENTITY_FLAGS.CLIPPABLE) {
485
+ this._numClippableLayerPortions++;
486
+ this.model.numClippableLayerPortions++;
487
+ } else {
488
+ this._numClippableLayerPortions--;
489
+ this.model.numClippableLayerPortions--;
490
+ }
491
+ this._setFlags2(portionId, flags);
492
+ }
493
+
494
+ setCollidable(portionId, flags) {
495
+ if (!this._finalized) {
496
+ throw "Not finalized";
497
+ }
498
+ }
499
+
500
+ setPickable(portionId, flags, meshTransparent) {
501
+ if (!this._finalized) {
502
+ throw "Not finalized";
503
+ }
504
+ if (flags & ENTITY_FLAGS.PICKABLE) {
505
+ this._numPickableLayerPortions++;
506
+ this.model.numPickableLayerPortions++;
507
+ } else {
508
+ this._numPickableLayerPortions--;
509
+ this.model.numPickableLayerPortions--;
510
+ }
511
+ this._setFlags2(portionId, flags, meshTransparent);
512
+ }
513
+
514
+ setCulled(portionId, flags, meshTransparent) {
515
+ if (!this._finalized) {
516
+ throw "Not finalized";
517
+ }
518
+ if (flags & ENTITY_FLAGS.CULLED) {
519
+ this._numCulledLayerPortions++;
520
+ this.model.numCulledLayerPortions++;
521
+ } else {
522
+ this._numCulledLayerPortions--;
523
+ this.model.numCulledLayerPortions--;
524
+ }
525
+ this._setFlags(portionId, flags, meshTransparent);
526
+ }
527
+
528
+ setColor(portionId, color) { // RGBA color is normalized as ints
529
+ if (!this._finalized) {
530
+ throw "Not finalized";
531
+ }
532
+ tempUint8Vec4[0] = color[0];
533
+ tempUint8Vec4[1] = color[1];
534
+ tempUint8Vec4[2] = color[2];
535
+ tempUint8Vec4[3] = color[3];
536
+ this._state.colorsBuf.setData(tempUint8Vec4, portionId * 4, 4);
537
+ }
538
+
539
+ setTransparent(portionId, flags, transparent) {
540
+ if (transparent) {
541
+ this._numTransparentLayerPortions++;
542
+ this.model.numTransparentLayerPortions++;
543
+ } else {
544
+ this._numTransparentLayerPortions--;
545
+ this.model.numTransparentLayerPortions--;
546
+ }
547
+ this._setFlags(portionId, flags, transparent);
548
+ }
549
+
550
+ // setMatrix(portionId, matrix) {
551
+ //
552
+ // if (!this._finalized) {
553
+ // throw "Not finalized";
554
+ // }
555
+ //
556
+ // var offset = portionId * 4;
557
+ //
558
+ // tempFloat32Vec4[0] = matrix[0];
559
+ // tempFloat32Vec4[1] = matrix[4];
560
+ // tempFloat32Vec4[2] = matrix[8];
561
+ // tempFloat32Vec4[3] = matrix[12];
562
+ //
563
+ // this._state.modelMatrixCol0Buf.setData(tempFloat32Vec4, offset, 4);
564
+ //
565
+ // tempFloat32Vec4[0] = matrix[1];
566
+ // tempFloat32Vec4[1] = matrix[5];
567
+ // tempFloat32Vec4[2] = matrix[9];
568
+ // tempFloat32Vec4[3] = matrix[13];
569
+ //
570
+ // this._state.modelMatrixCol1Buf.setData(tempFloat32Vec4, offset, 4);
571
+ //
572
+ // tempFloat32Vec4[0] = matrix[2];
573
+ // tempFloat32Vec4[1] = matrix[6];
574
+ // tempFloat32Vec4[2] = matrix[10];
575
+ // tempFloat32Vec4[3] = matrix[14];
576
+ //
577
+ // this._state.modelMatrixCol2Buf.setData(tempFloat32Vec4, offset, 4);
578
+ // }
579
+
580
+ _setFlags(portionId, flags, meshTransparent) {
581
+
582
+ if (!this._finalized) {
583
+ throw "Not finalized";
584
+ }
585
+
586
+ const visible = !!(flags & ENTITY_FLAGS.VISIBLE);
587
+ const xrayed = !!(flags & ENTITY_FLAGS.XRAYED);
588
+ const highlighted = !!(flags & ENTITY_FLAGS.HIGHLIGHTED);
589
+ const selected = !!(flags & ENTITY_FLAGS.SELECTED);
590
+ const edges = !!(flags & ENTITY_FLAGS.EDGES);
591
+ const pickable = !!(flags & ENTITY_FLAGS.PICKABLE);
592
+ const culled = !!(flags & ENTITY_FLAGS.CULLED);
593
+
594
+ // Normal fill
595
+
596
+ let f0;
597
+ if (!visible || culled || xrayed) { // Highlight & select are layered on top of color - not mutually exclusive
598
+ f0 = RENDER_PASSES.NOT_RENDERED;
599
+ } else {
600
+ if (meshTransparent) {
601
+ f0 = RENDER_PASSES.COLOR_TRANSPARENT;
602
+ } else {
603
+ f0 = RENDER_PASSES.COLOR_OPAQUE;
604
+ }
605
+ }
606
+
607
+ // Emphasis fill
608
+
609
+ let f1;
610
+ if (!visible || culled) {
611
+ f1 = RENDER_PASSES.NOT_RENDERED;
612
+ } else if (selected) {
613
+ f1 = RENDER_PASSES.SILHOUETTE_SELECTED;
614
+ } else if (highlighted) {
615
+ f1 = RENDER_PASSES.SILHOUETTE_HIGHLIGHTED;
616
+ } else if (xrayed) {
617
+ f1 = RENDER_PASSES.SILHOUETTE_XRAYED;
618
+ } else {
619
+ f1 = RENDER_PASSES.NOT_RENDERED;
620
+ }
621
+
622
+ // Edges
623
+
624
+ let f2 = 0;
625
+ if (!visible || culled) {
626
+ f2 = RENDER_PASSES.NOT_RENDERED;
627
+ } else if (selected) {
628
+ f2 = RENDER_PASSES.EDGES_SELECTED;
629
+ } else if (highlighted) {
630
+ f2 = RENDER_PASSES.EDGES_HIGHLIGHTED;
631
+ } else if (xrayed) {
632
+ f2 = RENDER_PASSES.EDGES_XRAYED;
633
+ } else if (edges) {
634
+ if (meshTransparent) {
635
+ f2 = RENDER_PASSES.EDGES_COLOR_TRANSPARENT;
636
+ } else {
637
+ f2 = RENDER_PASSES.EDGES_COLOR_OPAQUE;
638
+ }
639
+ } else {
640
+ f2 = RENDER_PASSES.NOT_RENDERED;
641
+ }
642
+
643
+ // Pick
644
+
645
+ let f3 = (visible && !culled && pickable) ? RENDER_PASSES.PICK : RENDER_PASSES.NOT_RENDERED;
646
+
647
+ tempUint8Vec4[0] = f0; // x - normal fill
648
+ tempUint8Vec4[1] = f1; // y - emphasis fill
649
+ tempUint8Vec4[2] = f2; // z - edges
650
+ tempUint8Vec4[3] = f3; // w - pick
651
+
652
+ this._state.flagsBuf.setData(tempUint8Vec4, portionId * 4, 4);
653
+ }
654
+
655
+ _setFlags2(portionId, flags) {
656
+
657
+ if (!this._finalized) {
658
+ throw "Not finalized";
659
+ }
660
+
661
+ const clippable = !!(flags & ENTITY_FLAGS.CLIPPABLE) ? 255 : 0;
662
+ tempUint8Vec4[0] = clippable;
663
+
664
+ this._state.flags2Buf.setData(tempUint8Vec4, portionId * 4, 4);
665
+ }
666
+
667
+ setOffset(portionId, offset) {
668
+ if (!this._finalized) {
669
+ throw "Not finalized";
670
+ }
671
+ if (!this.model.scene.entityOffsetsEnabled) {
672
+ this.model.error("Entity#offset not enabled for this Viewer"); // See Viewer entityOffsetsEnabled
673
+ return;
674
+ }
675
+ tempVec3fa[0] = offset[0];
676
+ tempVec3fa[1] = offset[1];
677
+ tempVec3fa[2] = offset[2];
678
+ this._state.offsetsBuf.setData(tempVec3fa, portionId * 3, 3);
679
+ }
680
+
681
+ // ---------------------- COLOR RENDERING -----------------------------------
682
+
683
+ drawColorOpaque(renderFlags, frameCtx) {
684
+ if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0 || this._numTransparentLayerPortions === this._numPortions || this._numXRayedLayerPortions === this._numPortions) {
685
+ return;
686
+ }
687
+ this._updateBackfaceCull(renderFlags, frameCtx);
688
+ if (frameCtx.withSAO && this.model.saoEnabled) {
689
+ if (frameCtx.pbrEnabled && this.model.pbrEnabled) {
690
+ if (this._instancingRenderers.colorQualityRendererWithSAO) {
691
+ this._instancingRenderers.colorQualityRendererWithSAO.drawLayer(frameCtx, this, RENDER_PASSES.COLOR_OPAQUE);
692
+ }
693
+ } else {
694
+ if (this._instancingRenderers.colorRendererWithSAO) {
695
+ this._instancingRenderers.colorRendererWithSAO.drawLayer(frameCtx, this, RENDER_PASSES.COLOR_OPAQUE);
696
+ }
697
+ }
698
+ } else {
699
+ if (frameCtx.pbrEnabled && this.model.pbrEnabled) {
700
+ if (this._instancingRenderers.colorQualityRenderer) {
701
+ this._instancingRenderers.colorQualityRenderer.drawLayer(frameCtx, this, RENDER_PASSES.COLOR_OPAQUE);
702
+ }
703
+ } else {
704
+ if (this._instancingRenderers.colorRenderer) {
705
+ this._instancingRenderers.colorRenderer.drawLayer(frameCtx, this, RENDER_PASSES.COLOR_OPAQUE);
706
+ }
707
+ }
708
+ }
709
+ }
710
+
711
+ _updateBackfaceCull(renderFlags, frameCtx) {
712
+ const backfaces = this.model.backfaces || (!this.solid) || renderFlags.sectioned;
713
+ if (frameCtx.backfaces !== backfaces) {
714
+ const gl = frameCtx.gl;
715
+ if (backfaces) {
716
+ gl.disable(gl.CULL_FACE);
717
+ } else {
718
+ gl.enable(gl.CULL_FACE);
719
+ }
720
+ frameCtx.backfaces = backfaces;
721
+ }
722
+ }
723
+
724
+ drawColorTransparent(renderFlags, frameCtx) {
725
+ if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0 || this._numTransparentLayerPortions === 0 || this._numXRayedLayerPortions === this._numPortions) {
726
+ return;
727
+ }
728
+ this._updateBackfaceCull(renderFlags, frameCtx);
729
+ if (frameCtx.pbrEnabled && this.model.pbrEnabled) {
730
+ if (this._instancingRenderers.colorQualityRenderer) {
731
+ this._instancingRenderers.colorQualityRenderer.drawLayer(frameCtx, this, RENDER_PASSES.COLOR_TRANSPARENT);
732
+ }
733
+ } else {
734
+ if (this._instancingRenderers.colorRenderer) {
735
+ this._instancingRenderers.colorRenderer.drawLayer(frameCtx, this, RENDER_PASSES.COLOR_TRANSPARENT);
736
+ }
737
+ }
738
+ }
739
+
740
+ // ---------------------- RENDERING SAO POST EFFECT TARGETS --------------
741
+
742
+ drawDepth(renderFlags, frameCtx) {
743
+ if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0 || this._numTransparentLayerPortions === this._numPortions || this._numXRayedLayerPortions === this._numPortions) {
744
+ return;
745
+ }
746
+ this._updateBackfaceCull(renderFlags, frameCtx);
747
+ if (this._instancingRenderers.depthRenderer) {
748
+ this._instancingRenderers.depthRenderer.drawLayer(frameCtx, this, RENDER_PASSES.COLOR_OPAQUE); // Assume whatever post-effect uses depth (eg SAO) does not apply to transparent objects
749
+ }
750
+ }
751
+
752
+ drawNormals(renderFlags, frameCtx) {
753
+ if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0 || this._numTransparentLayerPortions === this._numPortions || this._numXRayedLayerPortions === this._numPortions) {
754
+ return;
755
+ }
756
+ this._updateBackfaceCull(renderFlags, frameCtx);
757
+ if (this._instancingRenderers.normalsRenderer) {
758
+ this._instancingRenderers.normalsRenderer.drawLayer(frameCtx, this, RENDER_PASSES.COLOR_OPAQUE); // Assume whatever post-effect uses normals (eg SAO) does not apply to transparent objects
759
+ }
760
+ }
761
+
762
+ // ---------------------- SILHOUETTE RENDERING -----------------------------------
763
+
764
+ drawSilhouetteXRayed(renderFlags, frameCtx) {
765
+ if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0 || this._numXRayedLayerPortions === 0) {
766
+ return;
767
+ }
768
+ this._updateBackfaceCull(renderFlags, frameCtx);
769
+ if (this._instancingRenderers.silhouetteRenderer) {
770
+ this._instancingRenderers.silhouetteRenderer.drawLayer(frameCtx, this, RENDER_PASSES.SILHOUETTE_XRAYED);
771
+ }
772
+ }
773
+
774
+ drawSilhouetteHighlighted(renderFlags, frameCtx) {
775
+ if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0 || this._numHighlightedLayerPortions === 0) {
776
+ return;
777
+ }
778
+ this._updateBackfaceCull(renderFlags, frameCtx);
779
+ if (this._instancingRenderers.silhouetteRenderer) {
780
+ this._instancingRenderers.silhouetteRenderer.drawLayer(frameCtx, this, RENDER_PASSES.SILHOUETTE_HIGHLIGHTED);
781
+ }
782
+ }
783
+
784
+ drawSilhouetteSelected(renderFlags, frameCtx) {
785
+ if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0 || this._numSelectedLayerPortions === 0) {
786
+ return;
787
+ }
788
+ this._updateBackfaceCull(renderFlags, frameCtx);
789
+ if (this._instancingRenderers.silhouetteRenderer) {
790
+ this._instancingRenderers.silhouetteRenderer.drawLayer(frameCtx, this, RENDER_PASSES.SILHOUETTE_SELECTED);
791
+ }
792
+ }
793
+
794
+ // ---------------------- EDGES RENDERING -----------------------------------
795
+
796
+ drawEdgesColorOpaque(renderFlags, frameCtx) {
797
+ if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0 || this._numEdgesLayerPortions === 0) {
798
+ return;
799
+ }
800
+ if (this._instancingRenderers.edgesColorRenderer) {
801
+ this._instancingRenderers.edgesColorRenderer.drawLayer(frameCtx, this, RENDER_PASSES.EDGES_COLOR_OPAQUE);
802
+ }
803
+ }
804
+
805
+ drawEdgesColorTransparent(renderFlags, frameCtx) {
806
+ if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0 || this._numEdgesLayerPortions === 0) {
807
+ return;
808
+ }
809
+ if (this._instancingRenderers.edgesColorRenderer) {
810
+ this._instancingRenderers.edgesColorRenderer.drawLayer(frameCtx, this, RENDER_PASSES.EDGES_COLOR_TRANSPARENT);
811
+ }
812
+ }
813
+
814
+ drawEdgesXRayed(renderFlags, frameCtx) {
815
+ if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0 || this._numXRayedLayerPortions === 0) {
816
+ return;
817
+ }
818
+ if (this._instancingRenderers.edgesRenderer) {
819
+ this._instancingRenderers.edgesRenderer.drawLayer(frameCtx, this, RENDER_PASSES.EDGES_XRAYED);
820
+ }
821
+ }
822
+
823
+ drawEdgesHighlighted(renderFlags, frameCtx) {
824
+ if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0 || this._numHighlightedLayerPortions === 0) {
825
+ return;
826
+ }
827
+ if (this._instancingRenderers.edgesRenderer) {
828
+ this._instancingRenderers.edgesRenderer.drawLayer(frameCtx, this, RENDER_PASSES.EDGES_HIGHLIGHTED);
829
+ }
830
+ }
831
+
832
+ drawEdgesSelected(renderFlags, frameCtx) {
833
+ if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0 || this._numSelectedLayerPortions === 0) {
834
+ return;
835
+ }
836
+ if (this._instancingRenderers.edgesRenderer) {
837
+ this._instancingRenderers.edgesRenderer.drawLayer(frameCtx, this, RENDER_PASSES.EDGES_SELECTED);
838
+ }
839
+ }
840
+
841
+ // ---------------------- OCCLUSION CULL RENDERING -----------------------------------
842
+
843
+ drawOcclusion(renderFlags, frameCtx) {
844
+ if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0) {
845
+ return;
846
+ }
847
+ this._updateBackfaceCull(renderFlags, frameCtx);
848
+ if (this._instancingRenderers.occlusionRenderer) {
849
+ // Only opaque, filled objects can be occluders
850
+ this._instancingRenderers.occlusionRenderer.drawLayer(frameCtx, this, RENDER_PASSES.COLOR_OPAQUE);
851
+ }
852
+ }
853
+
854
+ // ---------------------- SHADOW BUFFER RENDERING -----------------------------------
855
+
856
+ drawShadow(renderFlags, frameCtx) {
857
+ if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0) {
858
+ return;
859
+ }
860
+ this._updateBackfaceCull(renderFlags, frameCtx);
861
+ if (this._instancingRenderers.shadowRenderer) {
862
+ this._instancingRenderers.shadowRenderer.drawLayer(frameCtx, this, RENDER_PASSES.COLOR_OPAQUE);
863
+ }
864
+ }
865
+
866
+ //---- PICKING ----------------------------------------------------------------------------------------------------
867
+
868
+ drawPickMesh(renderFlags, frameCtx) {
869
+ if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0) {
870
+ return;
871
+ }
872
+ this._updateBackfaceCull(renderFlags, frameCtx);
873
+ if (this._instancingRenderers.pickMeshRenderer) {
874
+ this._instancingRenderers.pickMeshRenderer.drawLayer(frameCtx, this, RENDER_PASSES.PICK);
875
+ }
876
+ }
877
+
878
+ drawPickDepths(renderFlags, frameCtx) {
879
+ if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0) {
880
+ return;
881
+ }
882
+ this._updateBackfaceCull(renderFlags, frameCtx);
883
+ if (this._instancingRenderers.pickDepthRenderer) {
884
+ this._instancingRenderers.pickDepthRenderer.drawLayer(frameCtx, this, RENDER_PASSES.PICK);
885
+ }
886
+ }
887
+
888
+ drawPickNormals(renderFlags, frameCtx) {
889
+ if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0) {
890
+ return;
891
+ }
892
+ this._updateBackfaceCull(renderFlags, frameCtx);
893
+ if (this._instancingRenderers.pickNormalsRenderer) {
894
+ this._instancingRenderers.pickNormalsRenderer.drawLayer(frameCtx, this, RENDER_PASSES.PICK);
895
+ }
896
+ }
897
+
898
+
899
+ destroy() {
900
+ const state = this._state;
901
+ if (state.positionsBuf) {
902
+ state.positionsBuf.destroy();
903
+ state.positionsBuf = null;
904
+ }
905
+ if (state.normalsBuf) {
906
+ state.normalsBuf.destroy();
907
+ state.normalsBuf = null;
908
+ }
909
+ if (state.colorsBuf) {
910
+ state.colorsBuf.destroy();
911
+ state.colorsBuf = null;
912
+ }
913
+ if (state.metallicRoughnessBuf) {
914
+ state.metallicRoughnessBuf.destroy();
915
+ state.metallicRoughnessBuf = null;
916
+ }
917
+ if (state.flagsBuf) {
918
+ state.flagsBuf.destroy();
919
+ state.flagsBuf = null;
920
+ }
921
+ if (state.flags2Buf) {
922
+ state.flags2Buf.destroy();
923
+ state.flags2Buf = null;
924
+ }
925
+ if (state.offsetsBuf) {
926
+ state.offsetsBuf.destroy();
927
+ state.offsetsBuf = null;
928
+ }
929
+ if (state.modelMatrixCol0Buf) {
930
+ state.modelMatrixCol0Buf.destroy();
931
+ state.modelMatrixCol0Buf = null;
932
+ }
933
+ if (state.modelMatrixCol1Buf) {
934
+ state.modelMatrixCol1Buf.destroy();
935
+ state.modelMatrixCol1Buf = null;
936
+ }
937
+ if (state.modelMatrixCol2Buf) {
938
+ state.modelMatrixCol2Buf.destroy();
939
+ state.modelMatrixCol2Buf = null;
940
+ }
941
+ if (state.modelNormalMatrixCol0Buf) {
942
+ state.modelNormalMatrixCol0Buf.destroy();
943
+ state.modelNormalMatrixCol0Buf = null;
944
+ }
945
+ if (state.modelNormalMatrixCol1Buf) {
946
+ state.modelNormalMatrixCol1Buf.destroy();
947
+ state.modelNormalMatrixCol1Buf = null;
948
+ }
949
+ if (state.modelNormalMatrixCol2Buf) {
950
+ state.modelNormalMatrixCol2Buf.destroy();
951
+ state.modelNormalMatrixCol2Buf = null;
952
+ }
953
+ if (state.indicesBuf) {
954
+ state.indicesBuf.destroy();
955
+ state.indicessBuf = null;
956
+ }
957
+ if (state.edgeIndicesBuf) {
958
+ state.edgeIndicesBuf.destroy();
959
+ state.edgeIndicessBuf = null;
960
+ }
961
+ if (state.pickColorsBuf) {
962
+ state.pickColorsBuf.destroy();
963
+ state.pickColorsBuf = null;
964
+ }
965
+ state.destroy();
966
+ }
967
+ }
968
+
969
+ export {TrianglesInstancingLayer};