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,978 @@
1
+ /**
2
+ * @author yjklabs / https://github.com/yjklabs
3
+ */
4
+
5
+ import {Map} from "../../utils/Map.js";
6
+ import {DrawShaderSource} from "./DrawShaderSource.js";
7
+ import {Program} from "../../webgl/Program.js";
8
+ import {stats} from '../../stats.js';
9
+ import {WEBGL_INFO} from '../../webglInfo.js';
10
+ import {math} from "../../math/math.js";
11
+ import {getPlaneRTCPos} from "../../math/rtcCoords.js";
12
+
13
+ const tempVec3a = math.vec3();
14
+
15
+ const ids = new Map({});
16
+
17
+ /**
18
+ * @private
19
+ */
20
+ const DrawRenderer = function (hash, mesh) {
21
+ this.id = ids.addItem({});
22
+ this._hash = hash;
23
+ this._scene = mesh.scene;
24
+ this._useCount = 0;
25
+ this._shaderSource = new DrawShaderSource(mesh);
26
+ this._allocate(mesh);
27
+ };
28
+
29
+ const drawRenderers = {};
30
+
31
+ DrawRenderer.get = function (mesh) {
32
+ const scene = mesh.scene;
33
+ const hash = [
34
+ scene.canvas.canvas.id,
35
+ (scene.gammaInput ? "gi;" : ";") + (scene.gammaOutput ? "go" : ""),
36
+ scene._lightsState.getHash(),
37
+ scene._sectionPlanesState.getHash(),
38
+ mesh._geometry._state.hash,
39
+ mesh._material._state.hash,
40
+ mesh._state.drawHash
41
+ ].join(";");
42
+ let renderer = drawRenderers[hash];
43
+ if (!renderer) {
44
+ renderer = new DrawRenderer(hash, mesh);
45
+ if (renderer.errors) {
46
+ console.log(renderer.errors.join("\n"));
47
+ return null;
48
+ }
49
+ drawRenderers[hash] = renderer;
50
+ stats.memory.programs++;
51
+ }
52
+ renderer._useCount++;
53
+ return renderer;
54
+ };
55
+
56
+ DrawRenderer.prototype.put = function () {
57
+ if (--this._useCount === 0) {
58
+ ids.removeItem(this.id);
59
+ if (this._program) {
60
+ this._program.destroy();
61
+ }
62
+ delete drawRenderers[this._hash];
63
+ stats.memory.programs--;
64
+ }
65
+ };
66
+
67
+ DrawRenderer.prototype.webglContextRestored = function () {
68
+ this._program = null;
69
+ };
70
+
71
+ DrawRenderer.prototype.drawMesh = function (frameCtx, mesh) {
72
+
73
+ if (!this._program) {
74
+ this._allocate(mesh);
75
+ }
76
+
77
+ const maxTextureUnits = WEBGL_INFO.MAX_TEXTURE_UNITS;
78
+ const scene = mesh.scene;
79
+ const material = mesh._material;
80
+ const gl = scene.canvas.gl;
81
+ const program = this._program;
82
+ const meshState = mesh._state;
83
+ const materialState = mesh._material._state;
84
+ const geometryState = mesh._geometry._state;
85
+ const camera = scene.camera;
86
+ const rtcCenter = mesh.rtcCenter;
87
+
88
+ if (frameCtx.lastProgramId !== this._program.id) {
89
+ frameCtx.lastProgramId = this._program.id;
90
+ this._bindProgram(frameCtx);
91
+ }
92
+
93
+ gl.uniformMatrix4fv(this._uViewMatrix, false, rtcCenter ? frameCtx.getRTCViewMatrix(meshState.rtcCenterHash, rtcCenter) : camera.viewMatrix);
94
+ gl.uniformMatrix4fv(this._uViewNormalMatrix, false, camera.viewNormalMatrix);
95
+
96
+ if (meshState.clippable) {
97
+ const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
98
+ if (numSectionPlanes > 0) {
99
+ const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
100
+ const renderFlags = mesh.renderFlags;
101
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
102
+ const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
103
+ if (sectionPlaneUniforms) {
104
+ const active = renderFlags.sectionPlanesActivePerLayer[sectionPlaneIndex];
105
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
106
+ if (active) {
107
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
108
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcCenter ? getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, rtcCenter, tempVec3a) : sectionPlane.pos);
109
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
110
+ }
111
+ }
112
+ }
113
+ }
114
+ }
115
+
116
+ if (materialState.id !== this._lastMaterialId) {
117
+
118
+ frameCtx.textureUnit = this._baseTextureUnit;
119
+
120
+ const backfaces = materialState.backfaces;
121
+ if (frameCtx.backfaces !== backfaces) {
122
+ if (backfaces) {
123
+ gl.disable(gl.CULL_FACE);
124
+ } else {
125
+ gl.enable(gl.CULL_FACE);
126
+ }
127
+ frameCtx.backfaces = backfaces;
128
+ }
129
+
130
+ const frontface = materialState.frontface;
131
+ if (frameCtx.frontface !== frontface) {
132
+ if (frontface) {
133
+ gl.frontFace(gl.CCW);
134
+ } else {
135
+ gl.frontFace(gl.CW);
136
+ }
137
+ frameCtx.frontface = frontface;
138
+ }
139
+
140
+ if (frameCtx.lineWidth !== materialState.lineWidth) {
141
+ gl.lineWidth(materialState.lineWidth);
142
+ frameCtx.lineWidth = materialState.lineWidth;
143
+ }
144
+
145
+ if (this._uPointSize) {
146
+ gl.uniform1f(this._uPointSize, materialState.pointSize);
147
+ }
148
+
149
+ switch (materialState.type) {
150
+ case "LambertMaterial":
151
+ if (this._uMaterialAmbient) {
152
+ gl.uniform3fv(this._uMaterialAmbient, materialState.ambient);
153
+ }
154
+ if (this._uMaterialColor) {
155
+ gl.uniform4f(this._uMaterialColor, materialState.color[0], materialState.color[1], materialState.color[2], materialState.alpha);
156
+ }
157
+ if (this._uMaterialEmissive) {
158
+ gl.uniform3fv(this._uMaterialEmissive, materialState.emissive);
159
+ }
160
+ break;
161
+
162
+ case "PhongMaterial":
163
+ if (this._uMaterialShininess) {
164
+ gl.uniform1f(this._uMaterialShininess, materialState.shininess);
165
+ }
166
+ if (this._uMaterialAmbient) {
167
+ gl.uniform3fv(this._uMaterialAmbient, materialState.ambient);
168
+ }
169
+ if (this._uMaterialDiffuse) {
170
+ gl.uniform3fv(this._uMaterialDiffuse, materialState.diffuse);
171
+ }
172
+ if (this._uMaterialSpecular) {
173
+ gl.uniform3fv(this._uMaterialSpecular, materialState.specular);
174
+ }
175
+ if (this._uMaterialEmissive) {
176
+ gl.uniform3fv(this._uMaterialEmissive, materialState.emissive);
177
+ }
178
+ if (this._uAlphaModeCutoff) {
179
+ gl.uniform4f(
180
+ this._uAlphaModeCutoff,
181
+ 1.0 * materialState.alpha,
182
+ materialState.alphaMode === 1 ? 1.0 : 0.0,
183
+ materialState.alphaCutoff,
184
+ 0);
185
+ }
186
+ if (material._ambientMap && material._ambientMap._state.texture && this._uMaterialAmbientMap) {
187
+ program.bindTexture(this._uMaterialAmbientMap, material._ambientMap._state.texture, frameCtx.textureUnit);
188
+ frameCtx.textureUnit = (frameCtx.textureUnit + 1) % maxTextureUnits;
189
+ frameCtx.bindTexture++;
190
+ if (this._uMaterialAmbientMapMatrix) {
191
+ gl.uniformMatrix4fv(this._uMaterialAmbientMapMatrix, false, material._ambientMap._state.matrix);
192
+ }
193
+ }
194
+ if (material._diffuseMap && material._diffuseMap._state.texture && this._uDiffuseMap) {
195
+ program.bindTexture(this._uDiffuseMap, material._diffuseMap._state.texture, frameCtx.textureUnit);
196
+ frameCtx.textureUnit = (frameCtx.textureUnit + 1) % maxTextureUnits;
197
+ frameCtx.bindTexture++;
198
+ if (this._uDiffuseMapMatrix) {
199
+ gl.uniformMatrix4fv(this._uDiffuseMapMatrix, false, material._diffuseMap._state.matrix);
200
+ }
201
+ }
202
+ if (material._specularMap && material._specularMap._state.texture && this._uSpecularMap) {
203
+ program.bindTexture(this._uSpecularMap, material._specularMap._state.texture, frameCtx.textureUnit);
204
+ frameCtx.textureUnit = (frameCtx.textureUnit + 1) % maxTextureUnits;
205
+ frameCtx.bindTexture++;
206
+ if (this._uSpecularMapMatrix) {
207
+ gl.uniformMatrix4fv(this._uSpecularMapMatrix, false, material._specularMap._state.matrix);
208
+ }
209
+ }
210
+ if (material._emissiveMap && material._emissiveMap._state.texture && this._uEmissiveMap) {
211
+ program.bindTexture(this._uEmissiveMap, material._emissiveMap._state.texture, frameCtx.textureUnit);
212
+ frameCtx.textureUnit = (frameCtx.textureUnit + 1) % maxTextureUnits;
213
+ frameCtx.bindTexture++;
214
+ if (this._uEmissiveMapMatrix) {
215
+ gl.uniformMatrix4fv(this._uEmissiveMapMatrix, false, material._emissiveMap._state.matrix);
216
+ }
217
+ }
218
+ if (material._alphaMap && material._alphaMap._state.texture && this._uAlphaMap) {
219
+ program.bindTexture(this._uAlphaMap, material._alphaMap._state.texture, frameCtx.textureUnit);
220
+ frameCtx.textureUnit = (frameCtx.textureUnit + 1) % maxTextureUnits;
221
+ frameCtx.bindTexture++;
222
+ if (this._uAlphaMapMatrix) {
223
+ gl.uniformMatrix4fv(this._uAlphaMapMatrix, false, material._alphaMap._state.matrix);
224
+ }
225
+ }
226
+ if (material._reflectivityMap && material._reflectivityMap._state.texture && this._uReflectivityMap) {
227
+ program.bindTexture(this._uReflectivityMap, material._reflectivityMap._state.texture, frameCtx.textureUnit);
228
+ frameCtx.textureUnit = (frameCtx.textureUnit + 1) % maxTextureUnits;
229
+ if (this._uReflectivityMapMatrix) {
230
+ gl.uniformMatrix4fv(this._uReflectivityMapMatrix, false, material._reflectivityMap._state.matrix);
231
+ }
232
+ }
233
+ if (material._normalMap && material._normalMap._state.texture && this._uNormalMap) {
234
+ program.bindTexture(this._uNormalMap, material._normalMap._state.texture, frameCtx.textureUnit);
235
+ frameCtx.textureUnit = (frameCtx.textureUnit + 1) % maxTextureUnits;
236
+ frameCtx.bindTexture++;
237
+ if (this._uNormalMapMatrix) {
238
+ gl.uniformMatrix4fv(this._uNormalMapMatrix, false, material._normalMap._state.matrix);
239
+ }
240
+ }
241
+ if (material._occlusionMap && material._occlusionMap._state.texture && this._uOcclusionMap) {
242
+ program.bindTexture(this._uOcclusionMap, material._occlusionMap._state.texture, frameCtx.textureUnit);
243
+ frameCtx.textureUnit = (frameCtx.textureUnit + 1) % maxTextureUnits;
244
+ frameCtx.bindTexture++;
245
+ if (this._uOcclusionMapMatrix) {
246
+ gl.uniformMatrix4fv(this._uOcclusionMapMatrix, false, material._occlusionMap._state.matrix);
247
+ }
248
+ }
249
+ if (material._diffuseFresnel) {
250
+ if (this._uDiffuseFresnelEdgeBias) {
251
+ gl.uniform1f(this._uDiffuseFresnelEdgeBias, material._diffuseFresnel.edgeBias);
252
+ }
253
+ if (this._uDiffuseFresnelCenterBias) {
254
+ gl.uniform1f(this._uDiffuseFresnelCenterBias, material._diffuseFresnel.centerBias);
255
+ }
256
+ if (this._uDiffuseFresnelEdgeColor) {
257
+ gl.uniform3fv(this._uDiffuseFresnelEdgeColor, material._diffuseFresnel.edgeColor);
258
+ }
259
+ if (this._uDiffuseFresnelCenterColor) {
260
+ gl.uniform3fv(this._uDiffuseFresnelCenterColor, material._diffuseFresnel.centerColor);
261
+ }
262
+ if (this._uDiffuseFresnelPower) {
263
+ gl.uniform1f(this._uDiffuseFresnelPower, material._diffuseFresnel.power);
264
+ }
265
+ }
266
+ if (material._specularFresnel) {
267
+ if (this._uSpecularFresnelEdgeBias) {
268
+ gl.uniform1f(this._uSpecularFresnelEdgeBias, material._specularFresnel.edgeBias);
269
+ }
270
+ if (this._uSpecularFresnelCenterBias) {
271
+ gl.uniform1f(this._uSpecularFresnelCenterBias, material._specularFresnel.centerBias);
272
+ }
273
+ if (this._uSpecularFresnelEdgeColor) {
274
+ gl.uniform3fv(this._uSpecularFresnelEdgeColor, material._specularFresnel.edgeColor);
275
+ }
276
+ if (this._uSpecularFresnelCenterColor) {
277
+ gl.uniform3fv(this._uSpecularFresnelCenterColor, material._specularFresnel.centerColor);
278
+ }
279
+ if (this._uSpecularFresnelPower) {
280
+ gl.uniform1f(this._uSpecularFresnelPower, material._specularFresnel.power);
281
+ }
282
+ }
283
+ if (material._alphaFresnel) {
284
+ if (this._uAlphaFresnelEdgeBias) {
285
+ gl.uniform1f(this._uAlphaFresnelEdgeBias, material._alphaFresnel.edgeBias);
286
+ }
287
+ if (this._uAlphaFresnelCenterBias) {
288
+ gl.uniform1f(this._uAlphaFresnelCenterBias, material._alphaFresnel.centerBias);
289
+ }
290
+ if (this._uAlphaFresnelEdgeColor) {
291
+ gl.uniform3fv(this._uAlphaFresnelEdgeColor, material._alphaFresnel.edgeColor);
292
+ }
293
+ if (this._uAlphaFresnelCenterColor) {
294
+ gl.uniform3fv(this._uAlphaFresnelCenterColor, material._alphaFresnel.centerColor);
295
+ }
296
+ if (this._uAlphaFresnelPower) {
297
+ gl.uniform1f(this._uAlphaFresnelPower, material._alphaFresnel.power);
298
+ }
299
+ }
300
+ if (material._reflectivityFresnel) {
301
+ if (this._uReflectivityFresnelEdgeBias) {
302
+ gl.uniform1f(this._uReflectivityFresnelEdgeBias, material._reflectivityFresnel.edgeBias);
303
+ }
304
+ if (this._uReflectivityFresnelCenterBias) {
305
+ gl.uniform1f(this._uReflectivityFresnelCenterBias, material._reflectivityFresnel.centerBias);
306
+ }
307
+ if (this._uReflectivityFresnelEdgeColor) {
308
+ gl.uniform3fv(this._uReflectivityFresnelEdgeColor, material._reflectivityFresnel.edgeColor);
309
+ }
310
+ if (this._uReflectivityFresnelCenterColor) {
311
+ gl.uniform3fv(this._uReflectivityFresnelCenterColor, material._reflectivityFresnel.centerColor);
312
+ }
313
+ if (this._uReflectivityFresnelPower) {
314
+ gl.uniform1f(this._uReflectivityFresnelPower, material._reflectivityFresnel.power);
315
+ }
316
+ }
317
+ if (material._emissiveFresnel) {
318
+ if (this._uEmissiveFresnelEdgeBias) {
319
+ gl.uniform1f(this._uEmissiveFresnelEdgeBias, material._emissiveFresnel.edgeBias);
320
+ }
321
+ if (this._uEmissiveFresnelCenterBias) {
322
+ gl.uniform1f(this._uEmissiveFresnelCenterBias, material._emissiveFresnel.centerBias);
323
+ }
324
+ if (this._uEmissiveFresnelEdgeColor) {
325
+ gl.uniform3fv(this._uEmissiveFresnelEdgeColor, material._emissiveFresnel.edgeColor);
326
+ }
327
+ if (this._uEmissiveFresnelCenterColor) {
328
+ gl.uniform3fv(this._uEmissiveFresnelCenterColor, material._emissiveFresnel.centerColor);
329
+ }
330
+ if (this._uEmissiveFresnelPower) {
331
+ gl.uniform1f(this._uEmissiveFresnelPower, material._emissiveFresnel.power);
332
+ }
333
+ }
334
+ break;
335
+
336
+ case "MetallicMaterial":
337
+ if (this._uBaseColor) {
338
+ gl.uniform3fv(this._uBaseColor, materialState.baseColor);
339
+ }
340
+ if (this._uMaterialMetallic) {
341
+ gl.uniform1f(this._uMaterialMetallic, materialState.metallic);
342
+ }
343
+ if (this._uMaterialRoughness) {
344
+ gl.uniform1f(this._uMaterialRoughness, materialState.roughness);
345
+ }
346
+ if (this._uMaterialSpecularF0) {
347
+ gl.uniform1f(this._uMaterialSpecularF0, materialState.specularF0);
348
+ }
349
+ if (this._uMaterialEmissive) {
350
+ gl.uniform3fv(this._uMaterialEmissive, materialState.emissive);
351
+ }
352
+ if (this._uAlphaModeCutoff) {
353
+ gl.uniform4f(
354
+ this._uAlphaModeCutoff,
355
+ 1.0 * materialState.alpha,
356
+ materialState.alphaMode === 1 ? 1.0 : 0.0,
357
+ materialState.alphaCutoff,
358
+ 0.0);
359
+ }
360
+ const baseColorMap = material._baseColorMap;
361
+ if (baseColorMap && baseColorMap._state.texture && this._uBaseColorMap) {
362
+ program.bindTexture(this._uBaseColorMap, baseColorMap._state.texture, frameCtx.textureUnit);
363
+ frameCtx.textureUnit = (frameCtx.textureUnit + 1) % maxTextureUnits;
364
+ frameCtx.bindTexture++;
365
+ if (this._uBaseColorMapMatrix) {
366
+ gl.uniformMatrix4fv(this._uBaseColorMapMatrix, false, baseColorMap._state.matrix);
367
+ }
368
+ }
369
+ const metallicMap = material._metallicMap;
370
+ if (metallicMap && metallicMap._state.texture && this._uMetallicMap) {
371
+ program.bindTexture(this._uMetallicMap, metallicMap._state.texture, frameCtx.textureUnit);
372
+ frameCtx.textureUnit = (frameCtx.textureUnit + 1) % maxTextureUnits;
373
+ frameCtx.bindTexture++;
374
+ if (this._uMetallicMapMatrix) {
375
+ gl.uniformMatrix4fv(this._uMetallicMapMatrix, false, metallicMap._state.matrix);
376
+ }
377
+ }
378
+ const roughnessMap = material._roughnessMap;
379
+ if (roughnessMap && roughnessMap._state.texture && this._uRoughnessMap) {
380
+ program.bindTexture(this._uRoughnessMap, roughnessMap._state.texture, frameCtx.textureUnit);
381
+ frameCtx.textureUnit = (frameCtx.textureUnit + 1) % maxTextureUnits;
382
+ frameCtx.bindTexture++;
383
+ if (this._uRoughnessMapMatrix) {
384
+ gl.uniformMatrix4fv(this._uRoughnessMapMatrix, false, roughnessMap._state.matrix);
385
+ }
386
+ }
387
+ const metallicRoughnessMap = material._metallicRoughnessMap;
388
+ if (metallicRoughnessMap && metallicRoughnessMap._state.texture && this._uMetallicRoughnessMap) {
389
+ program.bindTexture(this._uMetallicRoughnessMap, metallicRoughnessMap._state.texture, frameCtx.textureUnit);
390
+ frameCtx.textureUnit = (frameCtx.textureUnit + 1) % maxTextureUnits;
391
+ frameCtx.bindTexture++;
392
+ if (this._uMetallicRoughnessMapMatrix) {
393
+ gl.uniformMatrix4fv(this._uMetallicRoughnessMapMatrix, false, metallicRoughnessMap._state.matrix);
394
+ }
395
+ }
396
+ var emissiveMap = material._emissiveMap;
397
+ if (emissiveMap && emissiveMap._state.texture && this._uEmissiveMap) {
398
+ program.bindTexture(this._uEmissiveMap, emissiveMap._state.texture, frameCtx.textureUnit);
399
+ frameCtx.textureUnit = (frameCtx.textureUnit + 1) % maxTextureUnits;
400
+ frameCtx.bindTexture++;
401
+ if (this._uEmissiveMapMatrix) {
402
+ gl.uniformMatrix4fv(this._uEmissiveMapMatrix, false, emissiveMap._state.matrix);
403
+ }
404
+ }
405
+ var occlusionMap = material._occlusionMap;
406
+ if (occlusionMap && material._occlusionMap._state.texture && this._uOcclusionMap) {
407
+ program.bindTexture(this._uOcclusionMap, occlusionMap._state.texture, frameCtx.textureUnit);
408
+ frameCtx.textureUnit = (frameCtx.textureUnit + 1) % maxTextureUnits;
409
+ frameCtx.bindTexture++;
410
+ if (this._uOcclusionMapMatrix) {
411
+ gl.uniformMatrix4fv(this._uOcclusionMapMatrix, false, occlusionMap._state.matrix);
412
+ }
413
+ }
414
+ var alphaMap = material._alphaMap;
415
+ if (alphaMap && alphaMap._state.texture && this._uAlphaMap) {
416
+ program.bindTexture(this._uAlphaMap, alphaMap._state.texture, frameCtx.textureUnit);
417
+ frameCtx.textureUnit = (frameCtx.textureUnit + 1) % maxTextureUnits;
418
+ frameCtx.bindTexture++;
419
+ if (this._uAlphaMapMatrix) {
420
+ gl.uniformMatrix4fv(this._uAlphaMapMatrix, false, alphaMap._state.matrix);
421
+ }
422
+ }
423
+ var normalMap = material._normalMap;
424
+ if (normalMap && normalMap._state.texture && this._uNormalMap) {
425
+ program.bindTexture(this._uNormalMap, normalMap._state.texture, frameCtx.textureUnit);
426
+ frameCtx.textureUnit = (frameCtx.textureUnit + 1) % maxTextureUnits;
427
+ frameCtx.bindTexture++;
428
+ if (this._uNormalMapMatrix) {
429
+ gl.uniformMatrix4fv(this._uNormalMapMatrix, false, normalMap._state.matrix);
430
+ }
431
+ }
432
+ break;
433
+
434
+ case "SpecularMaterial":
435
+ if (this._uMaterialDiffuse) {
436
+ gl.uniform3fv(this._uMaterialDiffuse, materialState.diffuse);
437
+ }
438
+ if (this._uMaterialSpecular) {
439
+ gl.uniform3fv(this._uMaterialSpecular, materialState.specular);
440
+ }
441
+ if (this._uMaterialGlossiness) {
442
+ gl.uniform1f(this._uMaterialGlossiness, materialState.glossiness);
443
+ }
444
+ if (this._uMaterialReflectivity) {
445
+ gl.uniform1f(this._uMaterialReflectivity, materialState.reflectivity);
446
+ }
447
+ if (this._uMaterialEmissive) {
448
+ gl.uniform3fv(this._uMaterialEmissive, materialState.emissive);
449
+ }
450
+ if (this._uAlphaModeCutoff) {
451
+ gl.uniform4f(
452
+ this._uAlphaModeCutoff,
453
+ 1.0 * materialState.alpha,
454
+ materialState.alphaMode === 1 ? 1.0 : 0.0,
455
+ materialState.alphaCutoff,
456
+ 0.0);
457
+ }
458
+ const diffuseMap = material._diffuseMap;
459
+ if (diffuseMap && diffuseMap._state.texture && this._uDiffuseMap) {
460
+ program.bindTexture(this._uDiffuseMap, diffuseMap._state.texture, frameCtx.textureUnit);
461
+ frameCtx.textureUnit = (frameCtx.textureUnit + 1) % maxTextureUnits;
462
+ frameCtx.bindTexture++;
463
+ if (this._uDiffuseMapMatrix) {
464
+ gl.uniformMatrix4fv(this._uDiffuseMapMatrix, false, diffuseMap._state.matrix);
465
+ }
466
+ }
467
+ const specularMap = material._specularMap;
468
+ if (specularMap && specularMap._state.texture && this._uSpecularMap) {
469
+ program.bindTexture(this._uSpecularMap, specularMap._state.texture, frameCtx.textureUnit);
470
+ frameCtx.textureUnit = (frameCtx.textureUnit + 1) % maxTextureUnits;
471
+ frameCtx.bindTexture++;
472
+ if (this._uSpecularMapMatrix) {
473
+ gl.uniformMatrix4fv(this._uSpecularMapMatrix, false, specularMap._state.matrix);
474
+ }
475
+ }
476
+ const glossinessMap = material._glossinessMap;
477
+ if (glossinessMap && glossinessMap._state.texture && this._uGlossinessMap) {
478
+ program.bindTexture(this._uGlossinessMap, glossinessMap._state.texture, frameCtx.textureUnit);
479
+ frameCtx.textureUnit = (frameCtx.textureUnit + 1) % maxTextureUnits;
480
+ frameCtx.bindTexture++;
481
+ if (this._uGlossinessMapMatrix) {
482
+ gl.uniformMatrix4fv(this._uGlossinessMapMatrix, false, glossinessMap._state.matrix);
483
+ }
484
+ }
485
+ const specularGlossinessMap = material._specularGlossinessMap;
486
+ if (specularGlossinessMap && specularGlossinessMap._state.texture && this._uSpecularGlossinessMap) {
487
+ program.bindTexture(this._uSpecularGlossinessMap, specularGlossinessMap._state.texture, frameCtx.textureUnit);
488
+ frameCtx.textureUnit = (frameCtx.textureUnit + 1) % maxTextureUnits;
489
+ frameCtx.bindTexture++;
490
+ if (this._uSpecularGlossinessMapMatrix) {
491
+ gl.uniformMatrix4fv(this._uSpecularGlossinessMapMatrix, false, specularGlossinessMap._state.matrix);
492
+ }
493
+ }
494
+ var emissiveMap = material._emissiveMap;
495
+ if (emissiveMap && emissiveMap._state.texture && this._uEmissiveMap) {
496
+ program.bindTexture(this._uEmissiveMap, emissiveMap._state.texture, frameCtx.textureUnit);
497
+ frameCtx.textureUnit = (frameCtx.textureUnit + 1) % maxTextureUnits;
498
+ frameCtx.bindTexture++;
499
+ if (this._uEmissiveMapMatrix) {
500
+ gl.uniformMatrix4fv(this._uEmissiveMapMatrix, false, emissiveMap._state.matrix);
501
+ }
502
+ }
503
+ var occlusionMap = material._occlusionMap;
504
+ if (occlusionMap && occlusionMap._state.texture && this._uOcclusionMap) {
505
+ program.bindTexture(this._uOcclusionMap, occlusionMap._state.texture, frameCtx.textureUnit);
506
+ frameCtx.textureUnit = (frameCtx.textureUnit + 1) % maxTextureUnits;
507
+ frameCtx.bindTexture++;
508
+ if (this._uOcclusionMapMatrix) {
509
+ gl.uniformMatrix4fv(this._uOcclusionMapMatrix, false, occlusionMap._state.matrix);
510
+ }
511
+ }
512
+ var alphaMap = material._alphaMap;
513
+ if (alphaMap && alphaMap._state.texture && this._uAlphaMap) {
514
+ program.bindTexture(this._uAlphaMap, alphaMap._state.texture, frameCtx.textureUnit);
515
+ frameCtx.textureUnit = (frameCtx.textureUnit + 1) % maxTextureUnits;
516
+ frameCtx.bindTexture++;
517
+ if (this._uAlphaMapMatrix) {
518
+ gl.uniformMatrix4fv(this._uAlphaMapMatrix, false, alphaMap._state.matrix);
519
+ }
520
+ }
521
+ var normalMap = material._normalMap;
522
+ if (normalMap && normalMap._state.texture && this._uNormalMap) {
523
+ program.bindTexture(this._uNormalMap, normalMap._state.texture, frameCtx.textureUnit);
524
+ frameCtx.textureUnit = (frameCtx.textureUnit + 1) % maxTextureUnits;
525
+ frameCtx.bindTexture++;
526
+ if (this._uNormalMapMatrix) {
527
+ gl.uniformMatrix4fv(this._uNormalMapMatrix, false, normalMap._state.matrix);
528
+ }
529
+ }
530
+ break;
531
+ }
532
+ this._lastMaterialId = materialState.id;
533
+ }
534
+
535
+ gl.uniformMatrix4fv(this._uModelMatrix, gl.FALSE, mesh.worldMatrix);
536
+ if (this._uModelNormalMatrix) {
537
+ gl.uniformMatrix4fv(this._uModelNormalMatrix, gl.FALSE, mesh.worldNormalMatrix);
538
+ }
539
+
540
+ if (this._uClippable) {
541
+ gl.uniform1i(this._uClippable, meshState.clippable);
542
+ }
543
+
544
+ if (this._uColorize) {
545
+ const colorize = meshState.colorize;
546
+ const lastColorize = this._lastColorize;
547
+ if (lastColorize[0] !== colorize[0] ||
548
+ lastColorize[1] !== colorize[1] ||
549
+ lastColorize[2] !== colorize[2] ||
550
+ lastColorize[3] !== colorize[3]) {
551
+ gl.uniform4fv(this._uColorize, colorize);
552
+ lastColorize[0] = colorize[0];
553
+ lastColorize[1] = colorize[1];
554
+ lastColorize[2] = colorize[2];
555
+ lastColorize[3] = colorize[3];
556
+ }
557
+ }
558
+
559
+ gl.uniform3fv(this._uOffset, meshState.offset);
560
+
561
+ // Bind VBOs
562
+
563
+ if (geometryState.id !== this._lastGeometryId) {
564
+ if (this._uPositionsDecodeMatrix) {
565
+ gl.uniformMatrix4fv(this._uPositionsDecodeMatrix, false, geometryState.positionsDecodeMatrix);
566
+ }
567
+ if (this._uUVDecodeMatrix) {
568
+ gl.uniformMatrix3fv(this._uUVDecodeMatrix, false, geometryState.uvDecodeMatrix);
569
+ }
570
+ if (this._aPosition) {
571
+ this._aPosition.bindArrayBuffer(geometryState.positionsBuf);
572
+ frameCtx.bindArray++;
573
+ }
574
+ if (this._aNormal) {
575
+ this._aNormal.bindArrayBuffer(geometryState.normalsBuf);
576
+ frameCtx.bindArray++;
577
+ }
578
+ if (this._aUV) {
579
+ this._aUV.bindArrayBuffer(geometryState.uvBuf);
580
+ frameCtx.bindArray++;
581
+ }
582
+ if (this._aColor) {
583
+ this._aColor.bindArrayBuffer(geometryState.colorsBuf);
584
+ frameCtx.bindArray++;
585
+ }
586
+ if (this._aFlags) {
587
+ this._aFlags.bindArrayBuffer(geometryState.flagsBuf);
588
+ frameCtx.bindArray++;
589
+ }
590
+ if (geometryState.indicesBuf) {
591
+ geometryState.indicesBuf.bind();
592
+ frameCtx.bindArray++;
593
+ }
594
+ this._lastGeometryId = geometryState.id;
595
+ }
596
+
597
+ // Draw (indices bound in prev step)
598
+
599
+ if (geometryState.indicesBuf) {
600
+ gl.drawElements(geometryState.primitive, geometryState.indicesBuf.numItems, geometryState.indicesBuf.itemType, 0);
601
+ frameCtx.drawElements++;
602
+ } else if (geometryState.positions) {
603
+ gl.drawArrays(gl.TRIANGLES, 0, geometryState.positions.numItems);
604
+ frameCtx.drawArrays++;
605
+ }
606
+ };
607
+
608
+ DrawRenderer.prototype._allocate = function (mesh) {
609
+ const scene = mesh.scene;
610
+ const gl = scene.canvas.gl;
611
+ const material = mesh._material;
612
+ const lightsState = scene._lightsState;
613
+ const sectionPlanesState = scene._sectionPlanesState;
614
+ const materialState = mesh._material._state;
615
+
616
+ this._program = new Program(gl, this._shaderSource);
617
+ if (this._program.errors) {
618
+ this.errors = this._program.errors;
619
+ return;
620
+ }
621
+ const program = this._program;
622
+ this._uPositionsDecodeMatrix = program.getLocation("positionsDecodeMatrix");
623
+ this._uUVDecodeMatrix = program.getLocation("uvDecodeMatrix");
624
+ this._uModelMatrix = program.getLocation("modelMatrix");
625
+ this._uModelNormalMatrix = program.getLocation("modelNormalMatrix");
626
+ this._uViewMatrix = program.getLocation("viewMatrix");
627
+ this._uViewNormalMatrix = program.getLocation("viewNormalMatrix");
628
+ this._uProjMatrix = program.getLocation("projMatrix");
629
+ this._uGammaFactor = program.getLocation("gammaFactor");
630
+ this._uLightAmbient = [];
631
+ this._uLightColor = [];
632
+ this._uLightDir = [];
633
+ this._uLightPos = [];
634
+ this._uLightAttenuation = [];
635
+ this._uShadowViewMatrix = [];
636
+ this._uShadowProjMatrix = [];
637
+
638
+ if (scene.logarithmicDepthBufferEnabled) {
639
+ this._uLogDepthBufFC = program.getLocation("logDepthBufFC");
640
+ }
641
+
642
+ const lights = lightsState.lights;
643
+ let light;
644
+
645
+ for (var i = 0, len = lights.length; i < len; i++) {
646
+ light = lights[i];
647
+ switch (light.type) {
648
+
649
+ case "ambient":
650
+ this._uLightAmbient[i] = program.getLocation("lightAmbient");
651
+ break;
652
+
653
+ case "dir":
654
+ this._uLightColor[i] = program.getLocation("lightColor" + i);
655
+ this._uLightPos[i] = null;
656
+ this._uLightDir[i] = program.getLocation("lightDir" + i);
657
+ break;
658
+
659
+ case "point":
660
+ this._uLightColor[i] = program.getLocation("lightColor" + i);
661
+ this._uLightPos[i] = program.getLocation("lightPos" + i);
662
+ this._uLightDir[i] = null;
663
+ this._uLightAttenuation[i] = program.getLocation("lightAttenuation" + i);
664
+ break;
665
+
666
+ case "spot":
667
+ this._uLightColor[i] = program.getLocation("lightColor" + i);
668
+ this._uLightPos[i] = program.getLocation("lightPos" + i);
669
+ this._uLightDir[i] = program.getLocation("lightDir" + i);
670
+ this._uLightAttenuation[i] = program.getLocation("lightAttenuation" + i);
671
+ break;
672
+ }
673
+
674
+ if (light.castsShadow) {
675
+ this._uShadowViewMatrix[i] = program.getLocation("shadowViewMatrix" + i);
676
+ this._uShadowProjMatrix[i] = program.getLocation("shadowProjMatrix" + i);
677
+ }
678
+ }
679
+
680
+ if (lightsState.lightMaps.length > 0) {
681
+ this._uLightMap = "lightMap";
682
+ }
683
+
684
+ if (lightsState.reflectionMaps.length > 0) {
685
+ this._uReflectionMap = "reflectionMap";
686
+ }
687
+
688
+ this._uSectionPlanes = [];
689
+ const sectionPlanes = sectionPlanesState.sectionPlanes;
690
+ for (var i = 0, len = sectionPlanes.length; i < len; i++) {
691
+ this._uSectionPlanes.push({
692
+ active: program.getLocation("sectionPlaneActive" + i),
693
+ pos: program.getLocation("sectionPlanePos" + i),
694
+ dir: program.getLocation("sectionPlaneDir" + i)
695
+ });
696
+ }
697
+
698
+ this._uPointSize = program.getLocation("pointSize");
699
+
700
+ switch (materialState.type) {
701
+ case "LambertMaterial":
702
+ this._uMaterialColor = program.getLocation("materialColor");
703
+ this._uMaterialEmissive = program.getLocation("materialEmissive");
704
+ this._uAlphaModeCutoff = program.getLocation("materialAlphaModeCutoff");
705
+ break;
706
+
707
+ case "PhongMaterial":
708
+ this._uMaterialAmbient = program.getLocation("materialAmbient");
709
+ this._uMaterialDiffuse = program.getLocation("materialDiffuse");
710
+ this._uMaterialSpecular = program.getLocation("materialSpecular");
711
+ this._uMaterialEmissive = program.getLocation("materialEmissive");
712
+ this._uAlphaModeCutoff = program.getLocation("materialAlphaModeCutoff");
713
+ this._uMaterialShininess = program.getLocation("materialShininess");
714
+ if (material._ambientMap) {
715
+ this._uMaterialAmbientMap = "ambientMap";
716
+ this._uMaterialAmbientMapMatrix = program.getLocation("ambientMapMatrix");
717
+ }
718
+ if (material._diffuseMap) {
719
+ this._uDiffuseMap = "diffuseMap";
720
+ this._uDiffuseMapMatrix = program.getLocation("diffuseMapMatrix");
721
+ }
722
+ if (material._specularMap) {
723
+ this._uSpecularMap = "specularMap";
724
+ this._uSpecularMapMatrix = program.getLocation("specularMapMatrix");
725
+ }
726
+ if (material._emissiveMap) {
727
+ this._uEmissiveMap = "emissiveMap";
728
+ this._uEmissiveMapMatrix = program.getLocation("emissiveMapMatrix");
729
+ }
730
+ if (material._alphaMap) {
731
+ this._uAlphaMap = "alphaMap";
732
+ this._uAlphaMapMatrix = program.getLocation("alphaMapMatrix");
733
+ }
734
+ if (material._reflectivityMap) {
735
+ this._uReflectivityMap = "reflectivityMap";
736
+ this._uReflectivityMapMatrix = program.getLocation("reflectivityMapMatrix");
737
+ }
738
+ if (material._normalMap) {
739
+ this._uNormalMap = "normalMap";
740
+ this._uNormalMapMatrix = program.getLocation("normalMapMatrix");
741
+ }
742
+ if (material._occlusionMap) {
743
+ this._uOcclusionMap = "occlusionMap";
744
+ this._uOcclusionMapMatrix = program.getLocation("occlusionMapMatrix");
745
+ }
746
+ if (material._diffuseFresnel) {
747
+ this._uDiffuseFresnelEdgeBias = program.getLocation("diffuseFresnelEdgeBias");
748
+ this._uDiffuseFresnelCenterBias = program.getLocation("diffuseFresnelCenterBias");
749
+ this._uDiffuseFresnelEdgeColor = program.getLocation("diffuseFresnelEdgeColor");
750
+ this._uDiffuseFresnelCenterColor = program.getLocation("diffuseFresnelCenterColor");
751
+ this._uDiffuseFresnelPower = program.getLocation("diffuseFresnelPower");
752
+ }
753
+ if (material._specularFresnel) {
754
+ this._uSpecularFresnelEdgeBias = program.getLocation("specularFresnelEdgeBias");
755
+ this._uSpecularFresnelCenterBias = program.getLocation("specularFresnelCenterBias");
756
+ this._uSpecularFresnelEdgeColor = program.getLocation("specularFresnelEdgeColor");
757
+ this._uSpecularFresnelCenterColor = program.getLocation("specularFresnelCenterColor");
758
+ this._uSpecularFresnelPower = program.getLocation("specularFresnelPower");
759
+ }
760
+ if (material._alphaFresnel) {
761
+ this._uAlphaFresnelEdgeBias = program.getLocation("alphaFresnelEdgeBias");
762
+ this._uAlphaFresnelCenterBias = program.getLocation("alphaFresnelCenterBias");
763
+ this._uAlphaFresnelEdgeColor = program.getLocation("alphaFresnelEdgeColor");
764
+ this._uAlphaFresnelCenterColor = program.getLocation("alphaFresnelCenterColor");
765
+ this._uAlphaFresnelPower = program.getLocation("alphaFresnelPower");
766
+ }
767
+ if (material._reflectivityFresnel) {
768
+ this._uReflectivityFresnelEdgeBias = program.getLocation("reflectivityFresnelEdgeBias");
769
+ this._uReflectivityFresnelCenterBias = program.getLocation("reflectivityFresnelCenterBias");
770
+ this._uReflectivityFresnelEdgeColor = program.getLocation("reflectivityFresnelEdgeColor");
771
+ this._uReflectivityFresnelCenterColor = program.getLocation("reflectivityFresnelCenterColor");
772
+ this._uReflectivityFresnelPower = program.getLocation("reflectivityFresnelPower");
773
+ }
774
+ if (material._emissiveFresnel) {
775
+ this._uEmissiveFresnelEdgeBias = program.getLocation("emissiveFresnelEdgeBias");
776
+ this._uEmissiveFresnelCenterBias = program.getLocation("emissiveFresnelCenterBias");
777
+ this._uEmissiveFresnelEdgeColor = program.getLocation("emissiveFresnelEdgeColor");
778
+ this._uEmissiveFresnelCenterColor = program.getLocation("emissiveFresnelCenterColor");
779
+ this._uEmissiveFresnelPower = program.getLocation("emissiveFresnelPower");
780
+ }
781
+ break;
782
+
783
+ case "MetallicMaterial":
784
+ this._uBaseColor = program.getLocation("materialBaseColor");
785
+ this._uMaterialMetallic = program.getLocation("materialMetallic");
786
+ this._uMaterialRoughness = program.getLocation("materialRoughness");
787
+ this._uMaterialSpecularF0 = program.getLocation("materialSpecularF0");
788
+ this._uMaterialEmissive = program.getLocation("materialEmissive");
789
+ this._uAlphaModeCutoff = program.getLocation("materialAlphaModeCutoff");
790
+ if (material._baseColorMap) {
791
+ this._uBaseColorMap = "baseColorMap";
792
+ this._uBaseColorMapMatrix = program.getLocation("baseColorMapMatrix");
793
+ }
794
+ if (material._metallicMap) {
795
+ this._uMetallicMap = "metallicMap";
796
+ this._uMetallicMapMatrix = program.getLocation("metallicMapMatrix");
797
+ }
798
+ if (material._roughnessMap) {
799
+ this._uRoughnessMap = "roughnessMap";
800
+ this._uRoughnessMapMatrix = program.getLocation("roughnessMapMatrix");
801
+ }
802
+ if (material._metallicRoughnessMap) {
803
+ this._uMetallicRoughnessMap = "metallicRoughnessMap";
804
+ this._uMetallicRoughnessMapMatrix = program.getLocation("metallicRoughnessMapMatrix");
805
+ }
806
+ if (material._emissiveMap) {
807
+ this._uEmissiveMap = "emissiveMap";
808
+ this._uEmissiveMapMatrix = program.getLocation("emissiveMapMatrix");
809
+ }
810
+ if (material._occlusionMap) {
811
+ this._uOcclusionMap = "occlusionMap";
812
+ this._uOcclusionMapMatrix = program.getLocation("occlusionMapMatrix");
813
+ }
814
+ if (material._alphaMap) {
815
+ this._uAlphaMap = "alphaMap";
816
+ this._uAlphaMapMatrix = program.getLocation("alphaMapMatrix");
817
+ }
818
+ if (material._normalMap) {
819
+ this._uNormalMap = "normalMap";
820
+ this._uNormalMapMatrix = program.getLocation("normalMapMatrix");
821
+ }
822
+ break;
823
+
824
+ case "SpecularMaterial":
825
+ this._uMaterialDiffuse = program.getLocation("materialDiffuse");
826
+ this._uMaterialSpecular = program.getLocation("materialSpecular");
827
+ this._uMaterialGlossiness = program.getLocation("materialGlossiness");
828
+ this._uMaterialReflectivity = program.getLocation("reflectivityFresnel");
829
+ this._uMaterialEmissive = program.getLocation("materialEmissive");
830
+ this._uAlphaModeCutoff = program.getLocation("materialAlphaModeCutoff");
831
+ if (material._diffuseMap) {
832
+ this._uDiffuseMap = "diffuseMap";
833
+ this._uDiffuseMapMatrix = program.getLocation("diffuseMapMatrix");
834
+ }
835
+ if (material._specularMap) {
836
+ this._uSpecularMap = "specularMap";
837
+ this._uSpecularMapMatrix = program.getLocation("specularMapMatrix");
838
+ }
839
+ if (material._glossinessMap) {
840
+ this._uGlossinessMap = "glossinessMap";
841
+ this._uGlossinessMapMatrix = program.getLocation("glossinessMapMatrix");
842
+ }
843
+ if (material._specularGlossinessMap) {
844
+ this._uSpecularGlossinessMap = "materialSpecularGlossinessMap";
845
+ this._uSpecularGlossinessMapMatrix = program.getLocation("materialSpecularGlossinessMapMatrix");
846
+ }
847
+ if (material._emissiveMap) {
848
+ this._uEmissiveMap = "emissiveMap";
849
+ this._uEmissiveMapMatrix = program.getLocation("emissiveMapMatrix");
850
+ }
851
+ if (material._occlusionMap) {
852
+ this._uOcclusionMap = "occlusionMap";
853
+ this._uOcclusionMapMatrix = program.getLocation("occlusionMapMatrix");
854
+ }
855
+ if (material._alphaMap) {
856
+ this._uAlphaMap = "alphaMap";
857
+ this._uAlphaMapMatrix = program.getLocation("alphaMapMatrix");
858
+ }
859
+ if (material._normalMap) {
860
+ this._uNormalMap = "normalMap";
861
+ this._uNormalMapMatrix = program.getLocation("normalMapMatrix");
862
+ }
863
+ break;
864
+ }
865
+
866
+ this._aPosition = program.getAttribute("position");
867
+ this._aNormal = program.getAttribute("normal");
868
+ this._aUV = program.getAttribute("uv");
869
+ this._aColor = program.getAttribute("color");
870
+ this._aFlags = program.getAttribute("flags");
871
+
872
+ this._uClippable = program.getLocation("clippable");
873
+ this._uColorize = program.getLocation("colorize");
874
+ this._uOffset = program.getLocation("offset");
875
+
876
+ this._lastMaterialId = null;
877
+ this._lastVertexBufsId = null;
878
+ this._lastGeometryId = null;
879
+
880
+ this._lastColorize = new Float32Array(4);
881
+
882
+ this._baseTextureUnit = 0;
883
+
884
+ };
885
+
886
+ DrawRenderer.prototype._bindProgram = function (frameCtx) {
887
+
888
+ const maxTextureUnits = WEBGL_INFO.MAX_TEXTURE_UNITS;
889
+ const scene = this._scene;
890
+ const gl = scene.canvas.gl;
891
+ const lightsState = scene._lightsState;
892
+ const project = scene.camera.project;
893
+ let light;
894
+
895
+ const program = this._program;
896
+
897
+ program.bind();
898
+
899
+ frameCtx.useProgram++;
900
+ frameCtx.textureUnit = 0;
901
+
902
+ this._lastMaterialId = null;
903
+ this._lastVertexBufsId = null;
904
+ this._lastGeometryId = null;
905
+
906
+ this._lastColorize[0] = -1;
907
+ this._lastColorize[1] = -1;
908
+ this._lastColorize[2] = -1;
909
+ this._lastColorize[3] = -1;
910
+
911
+ gl.uniformMatrix4fv(this._uProjMatrix, false, project.matrix);
912
+
913
+ if (scene.logarithmicDepthBufferEnabled) {
914
+ const logDepthBufFC = 2.0 / (Math.log(project.far + 1.0) / Math.LN2);
915
+ gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);
916
+ }
917
+
918
+ for (var i = 0, len = lightsState.lights.length; i < len; i++) {
919
+
920
+ light = lightsState.lights[i];
921
+
922
+ if (this._uLightAmbient[i]) {
923
+ gl.uniform4f(this._uLightAmbient[i], light.color[0], light.color[1], light.color[2], light.intensity);
924
+
925
+ } else {
926
+
927
+ if (this._uLightColor[i]) {
928
+ gl.uniform4f(this._uLightColor[i], light.color[0], light.color[1], light.color[2], light.intensity);
929
+ }
930
+
931
+ if (this._uLightPos[i]) {
932
+ gl.uniform3fv(this._uLightPos[i], light.pos);
933
+ if (this._uLightAttenuation[i]) {
934
+ gl.uniform1f(this._uLightAttenuation[i], light.attenuation);
935
+ }
936
+ }
937
+
938
+ if (this._uLightDir[i]) {
939
+ gl.uniform3fv(this._uLightDir[i], light.dir);
940
+ }
941
+
942
+ if (light.castsShadow) {
943
+ if (this._uShadowViewMatrix[i]) {
944
+ gl.uniformMatrix4fv(this._uShadowViewMatrix[i], false, light.getShadowViewMatrix());
945
+ }
946
+ if (this._uShadowProjMatrix[i]) {
947
+ gl.uniformMatrix4fv(this._uShadowProjMatrix[i], false, light.getShadowProjMatrix());
948
+ }
949
+ const shadowRenderBuf = light.getShadowRenderBuf();
950
+ if (shadowRenderBuf) {
951
+ program.bindTexture("shadowMap" + i, shadowRenderBuf.getTexture(), frameCtx.textureUnit);
952
+ frameCtx.textureUnit = (frameCtx.textureUnit + 1) % maxTextureUnits;
953
+ frameCtx.bindTexture++;
954
+ }
955
+ }
956
+ }
957
+ }
958
+
959
+ if (lightsState.lightMaps.length > 0 && lightsState.lightMaps[0].texture && this._uLightMap) {
960
+ program.bindTexture(this._uLightMap, lightsState.lightMaps[0].texture, frameCtx.textureUnit);
961
+ frameCtx.textureUnit = (frameCtx.textureUnit + 1) % maxTextureUnits;
962
+ frameCtx.bindTexture++;
963
+ }
964
+
965
+ if (lightsState.reflectionMaps.length > 0 && lightsState.reflectionMaps[0].texture && this._uReflectionMap) {
966
+ program.bindTexture(this._uReflectionMap, lightsState.reflectionMaps[0].texture, frameCtx.textureUnit);
967
+ frameCtx.textureUnit = (frameCtx.textureUnit + 1) % maxTextureUnits;
968
+ frameCtx.bindTexture++;
969
+ }
970
+
971
+ if (this._uGammaFactor) {
972
+ gl.uniform1f(this._uGammaFactor, scene.gammaFactor);
973
+ }
974
+
975
+ this._baseTextureUnit = frameCtx.textureUnit;
976
+ };
977
+
978
+ export {DrawRenderer};