csyjk 1.1.1 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- package/.babelrc +7 -0
- package/.idea/modules.xml +8 -0
- package/.idea/xx.iml +12 -0
- package/dist/app.js +43 -0
- package/{index.html → dist/index.html} +0 -0
- package/{style.css → dist/style.css} +1 -1
- package/package.json +40 -5
- package/public/gltf.js +2241 -0
- package/public/index.html +10 -0
- package/src/index.js +3 -0
- package/src/lib/gltf/assets/check.jpg +0 -0
- package/src/lib/gltf/assets/iconfont/iconfont.css +358 -0
- package/src/lib/gltf/assets/iconfont/iconfont.eot +0 -0
- package/src/lib/gltf/assets/iconfont/iconfont.js +1 -0
- package/src/lib/gltf/assets/iconfont/iconfont.json +604 -0
- package/src/lib/gltf/assets/iconfont/iconfont.svg +189 -0
- package/src/lib/gltf/assets/iconfont/iconfont.ttf +0 -0
- package/src/lib/gltf/assets/iconfont/iconfont.woff +0 -0
- package/src/lib/gltf/assets/iconfont/iconfont.woff2 +0 -0
- package/src/lib/gltf/assets/yjkkit-sdk/index.js +0 -0
- package/src/lib/gltf/assets/yjkkit-sdk/package.json +15 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/extras/ContextMenu/ContextMenu.js +863 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/extras/ContextMenu/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/extras/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/index.js +3 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AngleMeasurementsPlugin/AngleMeasurement.js +462 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsControl.js +279 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsPlugin.js +262 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AngleMeasurementsPlugin/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AnnotationsPlugin/Annotation.js +362 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AnnotationsPlugin/AnnotationsPlugin.js +575 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AnnotationsPlugin/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AxisGizmoPlugin/AxisGizmoPlugin.js +333 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AxisGizmoPlugin/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/BCFViewpointsPlugin/BCFViewpointsPlugin.js +777 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/BCFViewpointsPlugin/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js +525 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsControl.js +242 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsPlugin.js +297 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/DistanceMeasurementsPlugin/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/FastNavPlugin/FastNavPlugin.js +345 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/FastNavPlugin/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/GLTFLoaderPlugin/GLTFDefaultDataSource.js +122 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/GLTFLoaderPlugin/GLTFLoaderPlugin.js +462 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/GLTFLoaderPlugin/GLTFPerformanceModelLoader.js +508 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/GLTFLoaderPlugin/GLTFSceneGraphLoader.js +922 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/GLTFLoaderPlugin/index.js +2 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/NavCubePlugin/CubeTextureCanvas.js +273 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/NavCubePlugin/NavCubePlugin.js +687 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/NavCubePlugin/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/OBJLoaderPlugin/OBJLoaderPlugin.js +145 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/OBJLoaderPlugin/OBJSceneGraphLoader.js +777 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/OBJLoaderPlugin/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/STLLoaderPlugin/STLDefaultDataSource.js +33 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/STLLoaderPlugin/STLLoaderPlugin.js +273 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/STLLoaderPlugin/STLSceneGraphLoader.js +313 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/STLLoaderPlugin/index.js +2 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/SectionPlanesPlugin/Control.js +1328 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/SectionPlanesPlugin/Overview.js +249 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/SectionPlanesPlugin/Plane.js +169 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/SectionPlanesPlugin/SectionPlanesPlugin.js +403 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/SectionPlanesPlugin/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/SkyboxesPlugin/SkyboxesPlugin.js +134 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/SkyboxesPlugin/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/StoreyViewsPlugin/IFCStoreyPlanObjectStates.js +77 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/StoreyViewsPlugin/Storey.js +61 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/StoreyViewsPlugin/StoreyMap.js +57 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/StoreyViewsPlugin/StoreyViewsPlugin.js +822 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/StoreyViewsPlugin/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/TreeViewPlugin/ModelTreeView.js +888 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/TreeViewPlugin/TreeViewNode.js +88 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/TreeViewPlugin/TreeViewPlugin.js +624 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/TreeViewPlugin/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/TreeViewPlugin/modelValidation.js +87 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/ViewCullPlugin/ViewCullPlugin.js +295 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/ViewCullPlugin/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/XKTDefaultDataSource.js +78 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js +847 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/index.js +2 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV1.js +167 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV2.js +228 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV3.js +220 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV4.js +279 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV5.js +244 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV6.js +301 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV7.js +426 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV8.js +479 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/lib/pako.js +6818 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/XML3DLoaderPlugin.js +238 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/XML3DSceneGraphLoader.js +1279 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/.jshintrc +11 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/deflate.js +2060 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/inflate.js +2155 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/mime-types.js +1002 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/pako/codecs.js +64 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/z-worker.js +153 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/zip-ext.js +267 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/zip-fs.js +553 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/zip.js +991 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/zlib-asm/codecs.js +49 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/index.js +17 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/lib/culling/ObjectCullStates.js +205 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/lib/html/Dot.js +78 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/lib/html/Label.js +97 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/lib/html/Wire.js +95 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/Plugin.js +112 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/Viewer.js +372 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/index.js +3 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/metadata/IFCObjectDefaultColors.js +162 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/metadata/IFCObjectDefaults.js +39 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/metadata/MetaModel.js +145 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/metadata/MetaObject.js +215 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/metadata/MetaScene.js +311 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/CameraControl.js +1669 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/cc.js +0 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/CameraUpdater.js +312 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/controllers/PanController.js +112 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/controllers/PickController.js +193 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/controllers/PivotController.js +289 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/cu.js +0 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/KeyboardAxisViewHandler.js +122 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/KeyboardPanRotateDollyHandler.js +186 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/MouseMiscHandler.js +68 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/MousePanRotateDollyHandler.js +439 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/MousePickHandler.js +361 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/TouchPanRotateAndDollyHandler.js +258 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/TouchPickHandler.js +197 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/mouspan.js +498 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/Component.js +908 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/Entity.js +475 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/ImagePlane/ImagePlane.js +570 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/ImagePlane/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/PerformanceModel.js +2623 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/ENTITY_FLAGS.js +21 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/PerformanceMesh.js +262 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/PerformanceNode.js +697 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/RENDER_PASSES.js +34 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/ScratchMemory.js +63 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/compression.js +183 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesBatching/LinesBatchingBuffer.js +33 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesBatching/LinesBatchingLayer.js +736 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesBatching/LinesBatchingRenderers.js +68 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesBatching/renderers/LinesBatchingColorRenderer.js +295 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesBatching/renderers/LinesBatchingSilhouetteRenderer.js +327 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesInstancing/LinesInstancingLayer.js +698 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesInstancing/LinesInstancingRenderers.js +68 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesInstancing/renderers/LinesInstancingColorRenderer.js +364 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesInstancing/renderers/LinesInstancingSilhouetteRenderer.js +356 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/PointsBatchingBuffer.js +33 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/PointsBatchingLayer.js +776 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/PointsBatchingRenderers.js +113 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/renderers/PointsBatchingColorRenderer.js +340 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/renderers/PointsBatchingOcclusionRenderer.js +312 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/renderers/PointsBatchingPickDepthRenderer.js +343 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/renderers/PointsBatchingPickMeshRenderer.js +331 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/renderers/PointsBatchingShadowRenderer.js +242 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/renderers/PointsBatchingSilhouetteRenderer.js +348 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/PointsInstancingLayer.js +737 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/PointsInstancingRenderers.js +143 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/renderers/PointsInstancingColorRenderer.js +373 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/renderers/PointsInstancingDepthRenderer.js +366 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/renderers/PointsInstancingOcclusionRenderer.js +370 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/renderers/PointsInstancingPickDepthRenderer.js +386 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/renderers/PointsInstancingPickMeshRenderer.js +376 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/renderers/PointsInstancingShadowRenderer.js +293 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/renderers/PointsInstancingSilhouetteRenderer.js +382 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/TrianglesBatchingBuffer.js +37 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/TrianglesBatchingLayer.js +1017 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/TrianglesBatchingRenderers.js +246 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingColorQualityRenderer.js +809 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingColorRenderer.js +504 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingDepthRenderer.js +297 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingEdgesColorRenderer.js +300 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingEdgesRenderer.js +322 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingNormalsRenderer.js +311 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingOcclusionRenderer.js +291 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingPickDepthRenderer.js +319 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingPickMeshRenderer.js +305 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingPickNormalsRenderer.js +300 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingShadowRenderer.js +242 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingSilhouetteRenderer.js +323 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/TrianglesInstancingLayer.js +969 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/TrianglesInstancingRenderers.js +246 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingColorQualityRenderer.js +859 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingColorRenderer.js +557 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingDepthRenderer.js +341 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingEdgesColorRenderer.js +338 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingEdgesRenderer.js +356 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingNormalsRenderer.js +354 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingOcclusionRenderer.js +329 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingPickDepthRenderer.js +358 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingPickMeshRenderer.js +349 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingPickNormalsRenderer.js +363 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingShadowRenderer.js +284 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingSilhouetteRenderer.js +354 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/Camera.js +880 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/CameraFlightAnimation.js +669 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/CameraPath.js +194 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/CameraPathAnimation.js +326 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/CustomProjection.js +149 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/Frustum.js +316 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/Ortho.js +286 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/Perspective.js +302 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/index.js +2 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/canvas/Canvas.js +464 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/canvas/Spinner.js +323 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/core.js +234 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/Geometry.js +33 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/ReadableGeometry.js +689 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/VBOGeometry.js +327 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildBoxGeometry.js +238 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildBoxLinesGeometry.js +106 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildCylinderGeometry.js +271 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildGridGeometry.js +102 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildPlaneGeometry.js +168 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildSphereGeometry.js +161 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildTorusGeometry.js +172 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildVectorTextGeometry.js +1721 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/index.js +8 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/index.js +4 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/loaders/index.js +2 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/loaders/load3DSGeometry.js +103 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/loaders/loadOBJGeometry.js +130 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/index.js +18 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/input/Input.js +1475 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/libs/canvas2image.js +218 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/libs/k3d.js +1032 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/AmbientLight.js +175 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/CubeTexture.js +156 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/DirLight.js +314 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/Light.js +29 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/LightMap.js +77 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/PointLight.js +395 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/ReflectionMap.js +79 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/Shadow.js +138 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/index.js +5 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/marker/Marker.js +382 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/marker/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/EdgeMaterial.js +359 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/EmphasisMaterial.js +577 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/Fresnel.js +222 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/LambertMaterial.js +378 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/LinesMaterial.js +169 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/Material.js +39 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/MetallicMaterial.js +820 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/PhongMaterial.js +860 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/PointsMaterial.js +320 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/SpecularMaterial.js +807 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/Texture.js +522 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/index.js +8 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/math/Frustum.js +118 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/math/buildEdgeIndices.js +162 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/math/geometryCompressionUtils.js +353 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/math/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/math/math.js +5302 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/math/rtcCoords.js +132 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mementos/CameraMemento.js +200 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mementos/ModelMemento.js +272 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mementos/ObjectsMemento.js +259 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mementos/index.js +3 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/Mesh.js +2165 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/draw/DrawRenderer.js +978 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/draw/DrawShaderSource.js +1566 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/emphasis/EmphasisEdgesRenderer.js +249 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/emphasis/EmphasisEdgesShaderSource.js +163 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/emphasis/EmphasisFillRenderer.js +276 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/emphasis/EmphasisFillShaderSource.js +269 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/occlusion/OcclusionRenderer.js +207 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/occlusion/OcclusionShaderSource.js +156 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/pick/PickMeshRenderer.js +210 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/pick/PickMeshShaderSource.js +146 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/pick/PickTriangleRenderer.js +186 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/pick/PickTriangleShaderSource.js +120 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/shadow/ShadowRenderer.js +214 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/shadow/ShadowShaderSource.js +96 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/metriqs/Metriqs.js +259 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/nodes/Node.js +1356 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/nodes/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/paths/CubicBezierCurve.js +194 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/paths/Curve.js +183 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/paths/Path.js +239 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/paths/QuadraticBezierCurve.js +161 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/paths/SplineCurve.js +133 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/paths/index.js +5 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/postfx/SAO.js +547 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/scene/Scene.js +2481 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/sectionPlane/SectionPlane.js +194 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/sectionPlane/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/skybox/Skybox.js +119 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/skybox/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/stats.js +45 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/utils/Map.js +45 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/utils/Queue.js +56 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/utils/index.js +2 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/utils.js +452 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/viewport/Viewport.js +212 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/ArrayBuf.js +121 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Attribute.js +23 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Drawable.js +270 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/FrameContext.js +259 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/PickResult.js +317 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Pickable.js +69 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Program.js +179 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/RenderBuffer.js +315 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/RenderFlags.js +203 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/RenderState.js +40 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Renderer.js +1300 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Sampler.js +18 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Shader.js +49 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Texture2D.js +217 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/occlusion/OcclusionLayer.js +214 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/occlusion/OcclusionTester.js +432 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/sao/SAODepthLimitedBlurRenderer.js +326 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/sao/SAOOcclusionRenderer.js +375 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/webglEnums.js +61 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webglInfo.js +48 -0
- package/src/lib/gltf/gltf.css +392 -0
- package/src/lib/gltf/gltf.js +2241 -0
- package/webpack.config.js +70 -0
- package/app.js +0 -43
@@ -0,0 +1,737 @@
|
|
1
|
+
import {ENTITY_FLAGS} from '../../ENTITY_FLAGS.js';
|
2
|
+
import {RENDER_PASSES} from '../../RENDER_PASSES.js';
|
3
|
+
|
4
|
+
import {math} from "../../../../math/math.js";
|
5
|
+
import {RenderState} from "../../../../webgl/RenderState.js";
|
6
|
+
import {ArrayBuf} from "../../../../webgl/ArrayBuf.js";
|
7
|
+
import {geometryCompressionUtils} from "../../../../math/geometryCompressionUtils.js";
|
8
|
+
import {getPointsInstancingRenderers} from "./PointsInstancingRenderers.js";
|
9
|
+
import {quantizePositions} from "../../compression.js";
|
10
|
+
|
11
|
+
const tempUint8Vec4 = new Uint8Array(4);
|
12
|
+
const tempVec4a = math.vec4([0, 0, 0, 1]);
|
13
|
+
const tempVec4b = math.vec4([0, 0, 0, 1]);
|
14
|
+
const tempVec4c = math.vec4([0, 0, 0, 1]);
|
15
|
+
const tempVec3fa = new Float32Array(3);
|
16
|
+
|
17
|
+
/**
|
18
|
+
* @private
|
19
|
+
*/
|
20
|
+
class PointsInstancingLayer {
|
21
|
+
|
22
|
+
/**
|
23
|
+
* @param model
|
24
|
+
* @param cfg
|
25
|
+
* @param cfg.layerIndex
|
26
|
+
* @param cfg.positions Flat float Local-space positions array.
|
27
|
+
* @param cfg.rtcCenter
|
28
|
+
*/
|
29
|
+
constructor(model, cfg) {
|
30
|
+
|
31
|
+
/**
|
32
|
+
* State sorting key.
|
33
|
+
* @type {string}
|
34
|
+
*/
|
35
|
+
this.sortId = "PointsInstancingLayer";
|
36
|
+
|
37
|
+
/**
|
38
|
+
* Index of this InstancingLayer in PerformanceModel#_layerList
|
39
|
+
* @type {Number}
|
40
|
+
*/
|
41
|
+
this.layerIndex = cfg.layerIndex;
|
42
|
+
|
43
|
+
this._pointsInstancingRenderers = getPointsInstancingRenderers(model.scene);
|
44
|
+
this.model = model;
|
45
|
+
this._aabb = math.collapseAABB3();
|
46
|
+
|
47
|
+
const gl = model.scene.canvas.gl;
|
48
|
+
|
49
|
+
const stateCfg = {
|
50
|
+
positionsDecodeMatrix: math.mat4(),
|
51
|
+
numInstances: 0,
|
52
|
+
obb: math.OBB3(),
|
53
|
+
rtcCenter: null
|
54
|
+
};
|
55
|
+
|
56
|
+
const preCompressed = (!!cfg.positionsDecodeMatrix);
|
57
|
+
|
58
|
+
if (cfg.positions) {
|
59
|
+
|
60
|
+
if (preCompressed) {
|
61
|
+
|
62
|
+
let normalized = false;
|
63
|
+
stateCfg.positionsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, cfg.positions, cfg.positions.length, 3, gl.STATIC_DRAW, normalized);
|
64
|
+
stateCfg.positionsDecodeMatrix.set(cfg.positionsDecodeMatrix);
|
65
|
+
|
66
|
+
let localAABB = math.collapseAABB3();
|
67
|
+
math.expandAABB3Points3(localAABB, cfg.positions);
|
68
|
+
geometryCompressionUtils.decompressAABB(localAABB, stateCfg.positionsDecodeMatrix);
|
69
|
+
math.AABB3ToOBB3(localAABB, stateCfg.obb);
|
70
|
+
|
71
|
+
} else {
|
72
|
+
|
73
|
+
let lenPositions = cfg.positions.length;
|
74
|
+
let localAABB = math.collapseAABB3();
|
75
|
+
math.expandAABB3Points3(localAABB, cfg.positions);
|
76
|
+
math.AABB3ToOBB3(localAABB, stateCfg.obb);
|
77
|
+
const quantizedPositions = quantizePositions(cfg.positions, localAABB, stateCfg.positionsDecodeMatrix);
|
78
|
+
let normalized = false;
|
79
|
+
stateCfg.positionsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, quantizedPositions, lenPositions, 3, gl.STATIC_DRAW, normalized);
|
80
|
+
}
|
81
|
+
}
|
82
|
+
|
83
|
+
if (cfg.colors) {
|
84
|
+
const colors = cfg.colors;
|
85
|
+
const compressedColors = new Uint8Array((colors.length / 3) * 4);
|
86
|
+
for (let i = 0, j = 0, len = colors.length; i < len; i += 3, j += 4) {
|
87
|
+
compressedColors[i + 0] = colors[j + 0] * 255;
|
88
|
+
compressedColors[j + 1] = colors[i + 1] * 255;
|
89
|
+
compressedColors[j + 2] = colors[i + 2] * 255;
|
90
|
+
compressedColors[j + 3] = 255;
|
91
|
+
}
|
92
|
+
let notNormalized = false;
|
93
|
+
stateCfg.colorsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, compressedColors, compressedColors.length, 4, gl.STATIC_DRAW, notNormalized);
|
94
|
+
}
|
95
|
+
|
96
|
+
this._state = new RenderState(stateCfg);
|
97
|
+
|
98
|
+
// These counts are used to avoid unnecessary render passes
|
99
|
+
this._numPortions = 0;
|
100
|
+
this._numVisibleLayerPortions = 0;
|
101
|
+
this._numTransparentLayerPortions = 0;
|
102
|
+
this._numXRayedLayerPortions = 0;
|
103
|
+
this._numHighlightedLayerPortions = 0;
|
104
|
+
this._numSelectedLayerPortions = 0;
|
105
|
+
this._numClippableLayerPortions = 0;
|
106
|
+
this._numEdgesLayerPortions = 0;
|
107
|
+
this._numPickableLayerPortions = 0;
|
108
|
+
this._numCulledLayerPortions = 0;
|
109
|
+
|
110
|
+
// Vertex arrays
|
111
|
+
this._pickColors = [];
|
112
|
+
this._offsets = [];
|
113
|
+
|
114
|
+
// Modeling matrix per instance, array for each column
|
115
|
+
this._modelMatrixCol0 = [];
|
116
|
+
this._modelMatrixCol1 = [];
|
117
|
+
this._modelMatrixCol2 = [];
|
118
|
+
|
119
|
+
this._portions = [];
|
120
|
+
|
121
|
+
if (cfg.rtcCenter) {
|
122
|
+
this._state.rtcCenter = math.vec3(cfg.rtcCenter);
|
123
|
+
}
|
124
|
+
|
125
|
+
this._finalized = false;
|
126
|
+
|
127
|
+
/**
|
128
|
+
* The axis-aligned World-space boundary of this InstancingLayer's positions.
|
129
|
+
* @type {*|Float64Array}
|
130
|
+
*/
|
131
|
+
this.aabb = math.collapseAABB3();
|
132
|
+
}
|
133
|
+
|
134
|
+
/**
|
135
|
+
* Creates a new portion within this InstancingLayer, returns the new portion ID.
|
136
|
+
*
|
137
|
+
* The portion will instance this InstancingLayer's geometry.
|
138
|
+
*
|
139
|
+
* Gives the portion the specified color and matrix.
|
140
|
+
*
|
141
|
+
* @param cfg Portion params
|
142
|
+
* @param cfg.meshMatrix Flat float 4x4 matrix.
|
143
|
+
* @param [cfg.worldMatrix] Flat float 4x4 matrix.
|
144
|
+
* @param cfg.aabb Flat float AABB.
|
145
|
+
* @param cfg.pickColor Quantized pick color
|
146
|
+
* @returns {number} Portion ID.
|
147
|
+
*/
|
148
|
+
createPortion(cfg) {
|
149
|
+
|
150
|
+
const meshMatrix = cfg.meshMatrix;
|
151
|
+
const worldMatrix = cfg.worldMatrix;
|
152
|
+
const worldAABB = cfg.aabb;
|
153
|
+
const pickColor = cfg.pickColor;
|
154
|
+
|
155
|
+
if (this._finalized) {
|
156
|
+
throw "Already finalized";
|
157
|
+
}
|
158
|
+
|
159
|
+
if (this.model.scene.entityOffsetsEnabled) {
|
160
|
+
this._offsets.push(0);
|
161
|
+
this._offsets.push(0);
|
162
|
+
this._offsets.push(0);
|
163
|
+
}
|
164
|
+
|
165
|
+
this._modelMatrixCol0.push(meshMatrix[0]);
|
166
|
+
this._modelMatrixCol0.push(meshMatrix[4]);
|
167
|
+
this._modelMatrixCol0.push(meshMatrix[8]);
|
168
|
+
this._modelMatrixCol0.push(meshMatrix[12]);
|
169
|
+
|
170
|
+
this._modelMatrixCol1.push(meshMatrix[1]);
|
171
|
+
this._modelMatrixCol1.push(meshMatrix[5]);
|
172
|
+
this._modelMatrixCol1.push(meshMatrix[9]);
|
173
|
+
this._modelMatrixCol1.push(meshMatrix[13]);
|
174
|
+
|
175
|
+
this._modelMatrixCol2.push(meshMatrix[2]);
|
176
|
+
this._modelMatrixCol2.push(meshMatrix[6]);
|
177
|
+
this._modelMatrixCol2.push(meshMatrix[10]);
|
178
|
+
this._modelMatrixCol2.push(meshMatrix[14]);
|
179
|
+
|
180
|
+
// Per-vertex pick colors
|
181
|
+
|
182
|
+
this._pickColors.push(pickColor[0]);
|
183
|
+
this._pickColors.push(pickColor[1]);
|
184
|
+
this._pickColors.push(pickColor[2]);
|
185
|
+
this._pickColors.push(pickColor[3]);
|
186
|
+
|
187
|
+
// Expand AABB
|
188
|
+
|
189
|
+
math.collapseAABB3(worldAABB);
|
190
|
+
const obb = this._state.obb;
|
191
|
+
const lenPositions = obb.length;
|
192
|
+
for (let i = 0; i < lenPositions; i += 4) {
|
193
|
+
tempVec4a[0] = obb[i + 0];
|
194
|
+
tempVec4a[1] = obb[i + 1];
|
195
|
+
tempVec4a[2] = obb[i + 2];
|
196
|
+
math.transformPoint4(meshMatrix, tempVec4a, tempVec4b);
|
197
|
+
if (worldMatrix) {
|
198
|
+
math.transformPoint4(worldMatrix, tempVec4b, tempVec4c);
|
199
|
+
math.expandAABB3Point3(worldAABB, tempVec4c);
|
200
|
+
} else {
|
201
|
+
math.expandAABB3Point3(worldAABB, tempVec4b);
|
202
|
+
}
|
203
|
+
}
|
204
|
+
|
205
|
+
if (this._state.rtcCenter) {
|
206
|
+
const rtcCenter = this._state.rtcCenter;
|
207
|
+
worldAABB[0] += rtcCenter[0];
|
208
|
+
worldAABB[1] += rtcCenter[1];
|
209
|
+
worldAABB[2] += rtcCenter[2];
|
210
|
+
worldAABB[3] += rtcCenter[0];
|
211
|
+
worldAABB[4] += rtcCenter[1];
|
212
|
+
worldAABB[5] += rtcCenter[2];
|
213
|
+
}
|
214
|
+
|
215
|
+
math.expandAABB3(this.aabb, worldAABB);
|
216
|
+
|
217
|
+
this._state.numInstances++;
|
218
|
+
|
219
|
+
const portionId = this._portions.length;
|
220
|
+
this._portions.push({});
|
221
|
+
|
222
|
+
this._numPortions++;
|
223
|
+
this.model.numPortions++;
|
224
|
+
|
225
|
+
return portionId;
|
226
|
+
}
|
227
|
+
|
228
|
+
finalize() {
|
229
|
+
if (this._finalized) {
|
230
|
+
throw "Already finalized";
|
231
|
+
}
|
232
|
+
const gl = this.model.scene.canvas.gl;
|
233
|
+
const flagsLength = this._pickColors.length;
|
234
|
+
if (flagsLength > 0) {
|
235
|
+
// Because we only build flags arrays here,
|
236
|
+
// get their length from the colors array
|
237
|
+
let notNormalized = false;
|
238
|
+
let normalized = true;
|
239
|
+
this._state.flagsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, new Uint8Array(flagsLength), flagsLength, 4, gl.DYNAMIC_DRAW, notNormalized);
|
240
|
+
this._state.flags2Buf = new ArrayBuf(gl, gl.ARRAY_BUFFER, new Uint8Array(flagsLength), flagsLength, 4, gl.DYNAMIC_DRAW, normalized);
|
241
|
+
}
|
242
|
+
if (this.model.scene.entityOffsetsEnabled) {
|
243
|
+
if (this._offsets.length > 0) {
|
244
|
+
const notNormalized = false;
|
245
|
+
this._state.offsetsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, new Float32Array(this._offsets), this._offsets.length, 3, gl.DYNAMIC_DRAW, notNormalized);
|
246
|
+
this._offsets = []; // Release memory
|
247
|
+
}
|
248
|
+
}
|
249
|
+
if (this._modelMatrixCol0.length > 0) {
|
250
|
+
const normalized = false;
|
251
|
+
this._state.modelMatrixCol0Buf = new ArrayBuf(gl, gl.ARRAY_BUFFER, new Float32Array(this._modelMatrixCol0), this._modelMatrixCol0.length, 4, gl.STATIC_DRAW, normalized);
|
252
|
+
this._state.modelMatrixCol1Buf = new ArrayBuf(gl, gl.ARRAY_BUFFER, new Float32Array(this._modelMatrixCol1), this._modelMatrixCol1.length, 4, gl.STATIC_DRAW, normalized);
|
253
|
+
this._state.modelMatrixCol2Buf = new ArrayBuf(gl, gl.ARRAY_BUFFER, new Float32Array(this._modelMatrixCol2), this._modelMatrixCol2.length, 4, gl.STATIC_DRAW, normalized);
|
254
|
+
this._modelMatrixCol0 = [];
|
255
|
+
this._modelMatrixCol1 = [];
|
256
|
+
this._modelMatrixCol2 = [];
|
257
|
+
}
|
258
|
+
if (this._pickColors.length > 0) {
|
259
|
+
const normalized = false;
|
260
|
+
this._state.pickColorsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, new Uint8Array(this._pickColors), this._pickColors.length, 4, gl.STATIC_DRAW, normalized);
|
261
|
+
this._pickColors = []; // Release memory
|
262
|
+
}
|
263
|
+
this._finalized = true;
|
264
|
+
}
|
265
|
+
|
266
|
+
// The following setters are called by PerformanceMesh, in turn called by PerformanceNode, only after the layer is finalized.
|
267
|
+
// It's important that these are called after finalize() in order to maintain integrity of counts like _numVisibleLayerPortions etc.
|
268
|
+
|
269
|
+
initFlags(portionId, flags, meshTransparent) {
|
270
|
+
if (flags & ENTITY_FLAGS.VISIBLE) {
|
271
|
+
this._numVisibleLayerPortions++;
|
272
|
+
this.model.numVisibleLayerPortions++;
|
273
|
+
}
|
274
|
+
if (flags & ENTITY_FLAGS.HIGHLIGHTED) {
|
275
|
+
this._numHighlightedLayerPortions++;
|
276
|
+
this.model.numHighlightedLayerPortions++;
|
277
|
+
}
|
278
|
+
if (flags & ENTITY_FLAGS.XRAYED) {
|
279
|
+
this._numXRayedLayerPortions++;
|
280
|
+
this.model.numXRayedLayerPortions++;
|
281
|
+
}
|
282
|
+
if (flags & ENTITY_FLAGS.SELECTED) {
|
283
|
+
this._numSelectedLayerPortions++;
|
284
|
+
this.model.numSelectedLayerPortions++;
|
285
|
+
}
|
286
|
+
if (flags & ENTITY_FLAGS.CLIPPABLE) {
|
287
|
+
this._numClippableLayerPortions++;
|
288
|
+
this.model.numClippableLayerPortions++;
|
289
|
+
}
|
290
|
+
if (flags & ENTITY_FLAGS.EDGES) {
|
291
|
+
this._numEdgesLayerPortions++;
|
292
|
+
this.model.numEdgesLayerPortions++;
|
293
|
+
}
|
294
|
+
if (flags & ENTITY_FLAGS.PICKABLE) {
|
295
|
+
this._numPickableLayerPortions++;
|
296
|
+
this.model.numPickableLayerPortions++;
|
297
|
+
}
|
298
|
+
if (flags & ENTITY_FLAGS.CULLED) {
|
299
|
+
this._numCulledLayerPortions++;
|
300
|
+
this.model.numCulledLayerPortions++;
|
301
|
+
}
|
302
|
+
if (meshTransparent) {
|
303
|
+
this._numTransparentLayerPortions++;
|
304
|
+
this.model.numTransparentLayerPortions++;
|
305
|
+
}
|
306
|
+
this._setFlags(portionId, flags, meshTransparent);
|
307
|
+
this._setFlags2(portionId, flags);
|
308
|
+
}
|
309
|
+
|
310
|
+
setVisible(portionId, flags, meshTransparent) {
|
311
|
+
if (!this._finalized) {
|
312
|
+
throw "Not finalized";
|
313
|
+
}
|
314
|
+
if (flags & ENTITY_FLAGS.VISIBLE) {
|
315
|
+
this._numVisibleLayerPortions++;
|
316
|
+
this.model.numVisibleLayerPortions++;
|
317
|
+
} else {
|
318
|
+
this._numVisibleLayerPortions--;
|
319
|
+
this.model.numVisibleLayerPortions--;
|
320
|
+
}
|
321
|
+
this._setFlags(portionId, flags, meshTransparent);
|
322
|
+
}
|
323
|
+
|
324
|
+
setHighlighted(portionId, flags, meshTransparent) {
|
325
|
+
if (!this._finalized) {
|
326
|
+
throw "Not finalized";
|
327
|
+
}
|
328
|
+
if (flags & ENTITY_FLAGS.HIGHLIGHTED) {
|
329
|
+
this._numHighlightedLayerPortions++;
|
330
|
+
this.model.numHighlightedLayerPortions++;
|
331
|
+
} else {
|
332
|
+
this._numHighlightedLayerPortions--;
|
333
|
+
this.model.numHighlightedLayerPortions--;
|
334
|
+
}
|
335
|
+
this._setFlags(portionId, flags, meshTransparent);
|
336
|
+
}
|
337
|
+
|
338
|
+
setXRayed(portionId, flags, meshTransparent) {
|
339
|
+
if (!this._finalized) {
|
340
|
+
throw "Not finalized";
|
341
|
+
}
|
342
|
+
if (flags & ENTITY_FLAGS.XRAYED) {
|
343
|
+
this._numXRayedLayerPortions++;
|
344
|
+
this.model.numXRayedLayerPortions++;
|
345
|
+
} else {
|
346
|
+
this._numXRayedLayerPortions--;
|
347
|
+
this.model.numXRayedLayerPortions--;
|
348
|
+
}
|
349
|
+
this._setFlags(portionId, flags, meshTransparent);
|
350
|
+
}
|
351
|
+
|
352
|
+
setSelected(portionId, flags, meshTransparent) {
|
353
|
+
if (!this._finalized) {
|
354
|
+
throw "Not finalized";
|
355
|
+
}
|
356
|
+
if (flags & ENTITY_FLAGS.SELECTED) {
|
357
|
+
this._numSelectedLayerPortions++;
|
358
|
+
this.model.numSelectedLayerPortions++;
|
359
|
+
} else {
|
360
|
+
this._numSelectedLayerPortions--;
|
361
|
+
this.model.numSelectedLayerPortions--;
|
362
|
+
}
|
363
|
+
this._setFlags(portionId, flags, meshTransparent);
|
364
|
+
}
|
365
|
+
|
366
|
+
setEdges(portionId, flags, meshTransparent) {
|
367
|
+
if (!this._finalized) {
|
368
|
+
throw "Not finalized";
|
369
|
+
}
|
370
|
+
if (flags & ENTITY_FLAGS.EDGES) {
|
371
|
+
this._numEdgesLayerPortions++;
|
372
|
+
this.model.numEdgesLayerPortions++;
|
373
|
+
} else {
|
374
|
+
this._numEdgesLayerPortions--;
|
375
|
+
this.model.numEdgesLayerPortions--;
|
376
|
+
}
|
377
|
+
this._setFlags(portionId, flags, meshTransparent);
|
378
|
+
}
|
379
|
+
|
380
|
+
setClippable(portionId, flags) {
|
381
|
+
if (!this._finalized) {
|
382
|
+
throw "Not finalized";
|
383
|
+
}
|
384
|
+
if (flags & ENTITY_FLAGS.CLIPPABLE) {
|
385
|
+
this._numClippableLayerPortions++;
|
386
|
+
this.model.numClippableLayerPortions++;
|
387
|
+
} else {
|
388
|
+
this._numClippableLayerPortions--;
|
389
|
+
this.model.numClippableLayerPortions--;
|
390
|
+
}
|
391
|
+
this._setFlags2(portionId, flags);
|
392
|
+
}
|
393
|
+
|
394
|
+
setCollidable(portionId, flags) {
|
395
|
+
if (!this._finalized) {
|
396
|
+
throw "Not finalized";
|
397
|
+
}
|
398
|
+
}
|
399
|
+
|
400
|
+
setPickable(portionId, flags, meshTransparent) {
|
401
|
+
if (!this._finalized) {
|
402
|
+
throw "Not finalized";
|
403
|
+
}
|
404
|
+
if (flags & ENTITY_FLAGS.PICKABLE) {
|
405
|
+
this._numPickableLayerPortions++;
|
406
|
+
this.model.numPickableLayerPortions++;
|
407
|
+
} else {
|
408
|
+
this._numPickableLayerPortions--;
|
409
|
+
this.model.numPickableLayerPortions--;
|
410
|
+
}
|
411
|
+
this._setFlags2(portionId, flags, meshTransparent);
|
412
|
+
}
|
413
|
+
|
414
|
+
setCulled(portionId, flags, meshTransparent) {
|
415
|
+
if (!this._finalized) {
|
416
|
+
throw "Not finalized";
|
417
|
+
}
|
418
|
+
if (flags & ENTITY_FLAGS.CULLED) {
|
419
|
+
this._numCulledLayerPortions++;
|
420
|
+
this.model.numCulledLayerPortions++;
|
421
|
+
} else {
|
422
|
+
this._numCulledLayerPortions--;
|
423
|
+
this.model.numCulledLayerPortions--;
|
424
|
+
}
|
425
|
+
this._setFlags(portionId, flags, meshTransparent);
|
426
|
+
}
|
427
|
+
|
428
|
+
setColor(portionId, color) { // RGBA color is normalized as ints
|
429
|
+
if (!this._finalized) {
|
430
|
+
throw "Not finalized";
|
431
|
+
}
|
432
|
+
tempUint8Vec4[0] = color[0];
|
433
|
+
tempUint8Vec4[1] = color[1];
|
434
|
+
tempUint8Vec4[2] = color[2];
|
435
|
+
tempUint8Vec4[3] = color[3];
|
436
|
+
this._state.colorsBuf.setData(tempUint8Vec4, portionId * 4, 4);
|
437
|
+
}
|
438
|
+
|
439
|
+
setTransparent(portionId, flags, transparent) {
|
440
|
+
if (transparent) {
|
441
|
+
this._numTransparentLayerPortions++;
|
442
|
+
this.model.numTransparentLayerPortions++;
|
443
|
+
} else {
|
444
|
+
this._numTransparentLayerPortions--;
|
445
|
+
this.model.numTransparentLayerPortions--;
|
446
|
+
}
|
447
|
+
this._setFlags(portionId, flags, transparent);
|
448
|
+
}
|
449
|
+
|
450
|
+
// setMatrix(portionId, matrix) {
|
451
|
+
//
|
452
|
+
// if (!this._finalized) {
|
453
|
+
// throw "Not finalized";
|
454
|
+
// }
|
455
|
+
//
|
456
|
+
// var offset = portionId * 4;
|
457
|
+
//
|
458
|
+
// tempFloat32Vec4[0] = matrix[0];
|
459
|
+
// tempFloat32Vec4[1] = matrix[4];
|
460
|
+
// tempFloat32Vec4[2] = matrix[8];
|
461
|
+
// tempFloat32Vec4[3] = matrix[12];
|
462
|
+
//
|
463
|
+
// this._state.modelMatrixCol0Buf.setData(tempFloat32Vec4, offset, 4);
|
464
|
+
//
|
465
|
+
// tempFloat32Vec4[0] = matrix[1];
|
466
|
+
// tempFloat32Vec4[1] = matrix[5];
|
467
|
+
// tempFloat32Vec4[2] = matrix[9];
|
468
|
+
// tempFloat32Vec4[3] = matrix[13];
|
469
|
+
//
|
470
|
+
// this._state.modelMatrixCol1Buf.setData(tempFloat32Vec4, offset, 4);
|
471
|
+
//
|
472
|
+
// tempFloat32Vec4[0] = matrix[2];
|
473
|
+
// tempFloat32Vec4[1] = matrix[6];
|
474
|
+
// tempFloat32Vec4[2] = matrix[10];
|
475
|
+
// tempFloat32Vec4[3] = matrix[14];
|
476
|
+
//
|
477
|
+
// this._state.modelMatrixCol2Buf.setData(tempFloat32Vec4, offset, 4);
|
478
|
+
// }
|
479
|
+
|
480
|
+
_setFlags(portionId, flags, meshTransparent) {
|
481
|
+
|
482
|
+
if (!this._finalized) {
|
483
|
+
throw "Not finalized";
|
484
|
+
}
|
485
|
+
|
486
|
+
const visible = !!(flags & ENTITY_FLAGS.VISIBLE);
|
487
|
+
const xrayed = !!(flags & ENTITY_FLAGS.XRAYED);
|
488
|
+
const highlighted = !!(flags & ENTITY_FLAGS.HIGHLIGHTED);
|
489
|
+
const selected = !!(flags & ENTITY_FLAGS.SELECTED);
|
490
|
+
const edges = !!(flags & ENTITY_FLAGS.EDGES);
|
491
|
+
const pickable = !!(flags & ENTITY_FLAGS.PICKABLE);
|
492
|
+
const culled = !!(flags & ENTITY_FLAGS.CULLED);
|
493
|
+
|
494
|
+
// Normal fill
|
495
|
+
|
496
|
+
let f0;
|
497
|
+
if (!visible || culled || xrayed) {
|
498
|
+
f0 = RENDER_PASSES.NOT_RENDERED;
|
499
|
+
} else {
|
500
|
+
if (meshTransparent) {
|
501
|
+
f0 = RENDER_PASSES.COLOR_TRANSPARENT;
|
502
|
+
} else {
|
503
|
+
f0 = RENDER_PASSES.COLOR_OPAQUE;
|
504
|
+
}
|
505
|
+
}
|
506
|
+
|
507
|
+
// Emphasis fill
|
508
|
+
|
509
|
+
let f1;
|
510
|
+
if (!visible || culled) {
|
511
|
+
f1 = RENDER_PASSES.NOT_RENDERED;
|
512
|
+
} else if (selected) {
|
513
|
+
f1 = RENDER_PASSES.SILHOUETTE_SELECTED;
|
514
|
+
} else if (highlighted) {
|
515
|
+
f1 = RENDER_PASSES.SILHOUETTE_HIGHLIGHTED;
|
516
|
+
} else if (xrayed) {
|
517
|
+
f1 = RENDER_PASSES.SILHOUETTE_XRAYED;
|
518
|
+
} else {
|
519
|
+
f1 = RENDER_PASSES.NOT_RENDERED;
|
520
|
+
}
|
521
|
+
|
522
|
+
// Edges
|
523
|
+
|
524
|
+
let f2 = 0;
|
525
|
+
if (!visible || culled) {
|
526
|
+
f2 = RENDER_PASSES.NOT_RENDERED;
|
527
|
+
} else if (selected) {
|
528
|
+
f2 = RENDER_PASSES.EDGES_SELECTED;
|
529
|
+
} else if (highlighted) {
|
530
|
+
f2 = RENDER_PASSES.EDGES_HIGHLIGHTED;
|
531
|
+
} else if (xrayed) {
|
532
|
+
f2 = RENDER_PASSES.EDGES_XRAYED;
|
533
|
+
} else if (edges) {
|
534
|
+
if (meshTransparent) {
|
535
|
+
f2 = RENDER_PASSES.EDGES_COLOR_TRANSPARENT;
|
536
|
+
} else {
|
537
|
+
f2 = RENDER_PASSES.EDGES_COLOR_OPAQUE;
|
538
|
+
}
|
539
|
+
} else {
|
540
|
+
f2 = RENDER_PASSES.NOT_RENDERED;
|
541
|
+
}
|
542
|
+
|
543
|
+
// Pick
|
544
|
+
|
545
|
+
let f3 = (visible && !culled && pickable) ? RENDER_PASSES.PICK : RENDER_PASSES.NOT_RENDERED;
|
546
|
+
|
547
|
+
tempUint8Vec4[0] = f0; // x - normal fill
|
548
|
+
tempUint8Vec4[1] = f1; // y - emphasis fill
|
549
|
+
tempUint8Vec4[2] = f2; // z - edges
|
550
|
+
tempUint8Vec4[3] = f3; // w - pick
|
551
|
+
|
552
|
+
this._state.flagsBuf.setData(tempUint8Vec4, portionId * 4, 4);
|
553
|
+
}
|
554
|
+
|
555
|
+
_setFlags2(portionId, flags) {
|
556
|
+
|
557
|
+
if (!this._finalized) {
|
558
|
+
throw "Not finalized";
|
559
|
+
}
|
560
|
+
|
561
|
+
const clippable = !!(flags & ENTITY_FLAGS.CLIPPABLE) ? 255 : 0;
|
562
|
+
tempUint8Vec4[0] = clippable;
|
563
|
+
|
564
|
+
this._state.flags2Buf.setData(tempUint8Vec4, portionId * 4, 4);
|
565
|
+
}
|
566
|
+
|
567
|
+
setOffset(portionId, offset) {
|
568
|
+
if (!this._finalized) {
|
569
|
+
throw "Not finalized";
|
570
|
+
}
|
571
|
+
if (!this.model.scene.entityOffsetsEnabled) {
|
572
|
+
this.model.error("Entity#offset not enabled for this Viewer"); // See Viewer entityOffsetsEnabled
|
573
|
+
return;
|
574
|
+
}
|
575
|
+
tempVec3fa[0] = offset[0];
|
576
|
+
tempVec3fa[1] = offset[1];
|
577
|
+
tempVec3fa[2] = offset[2];
|
578
|
+
this._state.offsetsBuf.setData(tempVec3fa, portionId * 3, 3);
|
579
|
+
}
|
580
|
+
|
581
|
+
// ---------------------- NORMAL RENDERING -----------------------------------
|
582
|
+
|
583
|
+
drawColorOpaque(renderFlags, frameCtx) {
|
584
|
+
if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0 || this._numTransparentLayerPortions === this._numPortions || this._numXRayedLayerPortions === this._numPortions) {
|
585
|
+
return;
|
586
|
+
}
|
587
|
+
if (this._pointsInstancingRenderers.colorRenderer) {
|
588
|
+
this._pointsInstancingRenderers.colorRenderer.drawLayer(frameCtx, this, RENDER_PASSES.COLOR_OPAQUE);
|
589
|
+
}
|
590
|
+
}
|
591
|
+
|
592
|
+
drawColorTransparent(renderFlags, frameCtx) {
|
593
|
+
if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0 || this._numTransparentLayerPortions === 0 || this._numXRayedLayerPortions === this._numPortions) {
|
594
|
+
return;
|
595
|
+
}
|
596
|
+
if (this._pointsInstancingRenderers.colorRenderer) {
|
597
|
+
this._pointsInstancingRenderers.colorRenderer.drawLayer(frameCtx, this, RENDER_PASSES.COLOR_TRANSPARENT);
|
598
|
+
}
|
599
|
+
}
|
600
|
+
|
601
|
+
// -- RENDERING SAO POST EFFECT TARGETS ----------------------------------------------------------------------------
|
602
|
+
|
603
|
+
drawDepth(renderFlags, frameCtx) {
|
604
|
+
}
|
605
|
+
|
606
|
+
drawNormals(renderFlags, frameCtx) {
|
607
|
+
}
|
608
|
+
|
609
|
+
// ---------------------- EMPHASIS RENDERING -----------------------------------
|
610
|
+
|
611
|
+
drawSilhouetteXRayed(renderFlags, frameCtx) {
|
612
|
+
if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0 || this._numXRayedLayerPortions === 0) {
|
613
|
+
return;
|
614
|
+
}
|
615
|
+
if (this._pointsInstancingRenderers.silhouetteRenderer) {
|
616
|
+
this._pointsInstancingRenderers.silhouetteRenderer.drawLayer(frameCtx, this, RENDER_PASSES.SILHOUETTE_XRAYED);
|
617
|
+
}
|
618
|
+
}
|
619
|
+
|
620
|
+
drawSilhouetteHighlighted(renderFlags, frameCtx) {
|
621
|
+
if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0 || this._numHighlightedLayerPortions === 0) {
|
622
|
+
return;
|
623
|
+
}
|
624
|
+
if (this._pointsInstancingRenderers.silhouetteRenderer) {
|
625
|
+
this._pointsInstancingRenderers.silhouetteRenderer.drawLayer(frameCtx, this, RENDER_PASSES.SILHOUETTE_HIGHLIGHTED);
|
626
|
+
}
|
627
|
+
}
|
628
|
+
|
629
|
+
drawSilhouetteSelected(renderFlags, frameCtx) {
|
630
|
+
if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0 || this._numSelectedLayerPortions === 0) {
|
631
|
+
return;
|
632
|
+
}
|
633
|
+
if (this._pointsInstancingRenderers.silhouetteRenderer) {
|
634
|
+
this._pointsInstancingRenderers.silhouetteRenderer.drawLayer(frameCtx, this, RENDER_PASSES.SILHOUETTE_SELECTED);
|
635
|
+
}
|
636
|
+
}
|
637
|
+
|
638
|
+
//-- EDGES RENDERING -----------------------------------------------------------------------------------------------
|
639
|
+
|
640
|
+
drawEdgesColorOpaque(renderFlags, frameCtx) {
|
641
|
+
}
|
642
|
+
|
643
|
+
drawEdgesColorTransparent(renderFlags, frameCtx) {
|
644
|
+
}
|
645
|
+
|
646
|
+
drawEdgesHighlighted(renderFlags, frameCtx) {
|
647
|
+
}
|
648
|
+
|
649
|
+
drawEdgesSelected(renderFlags, frameCtx) {
|
650
|
+
}
|
651
|
+
|
652
|
+
drawEdgesXRayed(renderFlags, frameCtx) {
|
653
|
+
}
|
654
|
+
|
655
|
+
// ---------------------- OCCLUSION CULL RENDERING -----------------------------------
|
656
|
+
|
657
|
+
drawOcclusion(renderFlags, frameCtx) {
|
658
|
+
if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0) {
|
659
|
+
return;
|
660
|
+
}
|
661
|
+
if (this._pointsInstancingRenderers.occlusionRenderer) {
|
662
|
+
// Only opaque, filled objects can be occluders
|
663
|
+
this._pointsInstancingRenderers.occlusionRenderer.drawLayer(frameCtx, this, RENDER_PASSES.COLOR_OPAQUE);
|
664
|
+
}
|
665
|
+
}
|
666
|
+
|
667
|
+
// ---------------------- SHADOW BUFFER RENDERING -----------------------------------
|
668
|
+
|
669
|
+
drawShadow(renderFlags, frameCtx) {
|
670
|
+
}
|
671
|
+
|
672
|
+
//---- PICKING ----------------------------------------------------------------------------------------------------
|
673
|
+
|
674
|
+
drawPickMesh(renderFlags, frameCtx) {
|
675
|
+
if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0) {
|
676
|
+
return;
|
677
|
+
}
|
678
|
+
if (this._pointsInstancingRenderers.pickMeshRenderer) {
|
679
|
+
this._pointsInstancingRenderers.pickMeshRenderer.drawLayer(frameCtx, this, RENDER_PASSES.PICK);
|
680
|
+
}
|
681
|
+
}
|
682
|
+
|
683
|
+
drawPickDepths(renderFlags, frameCtx) {
|
684
|
+
if (this._numCulledLayerPortions === this._numPortions || this._numVisibleLayerPortions === 0) {
|
685
|
+
return;
|
686
|
+
}
|
687
|
+
if (this._pointsInstancingRenderers.pickDepthRenderer) {
|
688
|
+
this._pointsInstancingRenderers.pickDepthRenderer.drawLayer(frameCtx, this, RENDER_PASSES.PICK);
|
689
|
+
}
|
690
|
+
}
|
691
|
+
|
692
|
+
drawPickNormals(renderFlags, frameCtx) {
|
693
|
+
}
|
694
|
+
|
695
|
+
destroy() {
|
696
|
+
const state = this._state;
|
697
|
+
if (state.positionsBuf) {
|
698
|
+
state.positionsBuf.destroy();
|
699
|
+
state.positionsBuf = null;
|
700
|
+
}
|
701
|
+
if (state.colorsBuf) {
|
702
|
+
state.colorsBuf.destroy();
|
703
|
+
state.colorsBuf = null;
|
704
|
+
}
|
705
|
+
if (state.flagsBuf) {
|
706
|
+
state.flagsBuf.destroy();
|
707
|
+
state.flagsBuf = null;
|
708
|
+
}
|
709
|
+
if (state.flags2Buf) {
|
710
|
+
state.flags2Buf.destroy();
|
711
|
+
state.flags2Buf = null;
|
712
|
+
}
|
713
|
+
if (state.offsetsBuf) {
|
714
|
+
state.offsetsBuf.destroy();
|
715
|
+
state.offsetsBuf = null;
|
716
|
+
}
|
717
|
+
if (state.modelMatrixCol0Buf) {
|
718
|
+
state.modelMatrixCol0Buf.destroy();
|
719
|
+
state.modelMatrixCol0Buf = null;
|
720
|
+
}
|
721
|
+
if (state.modelMatrixCol1Buf) {
|
722
|
+
state.modelMatrixCol1Buf.destroy();
|
723
|
+
state.modelMatrixCol1Buf = null;
|
724
|
+
}
|
725
|
+
if (state.modelMatrixCol2Buf) {
|
726
|
+
state.modelMatrixCol2Buf.destroy();
|
727
|
+
state.modelMatrixCol2Buf = null;
|
728
|
+
}
|
729
|
+
if (state.pickColorsBuf) {
|
730
|
+
state.pickColorsBuf.destroy();
|
731
|
+
state.pickColorsBuf = null;
|
732
|
+
}
|
733
|
+
state.destroy();
|
734
|
+
}
|
735
|
+
}
|
736
|
+
|
737
|
+
export {PointsInstancingLayer};
|