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,777 @@
|
|
1
|
+
import {Plugin} from "../../viewer/Plugin.js";
|
2
|
+
import {SectionPlane} from "../../viewer/scene/sectionPlane/SectionPlane.js";
|
3
|
+
import {math} from "../../viewer/scene/math/math.js";
|
4
|
+
|
5
|
+
const tempVec3 = math.vec3();
|
6
|
+
|
7
|
+
/**
|
8
|
+
* {@link Viewer} plugin that saves and loads BCF viewpoints as JSON objects.
|
9
|
+
*
|
10
|
+
* BCF is a format for managing issues on a BIM project. This plugin's viewpoints conform to
|
11
|
+
* the <a href="https://github.com/buildingSMART/BCF-API">BCF Version 2.1</a> specification.
|
12
|
+
*
|
13
|
+
* ## Saving a BCF Viewpoint
|
14
|
+
*
|
15
|
+
* In the example below we'll create a {@link Viewer}, load an ````.XKT```` model into it using an {@link XKTLoaderPlugin},
|
16
|
+
* slice the model in half using a {@link SectionPlanesPlugin}, then use a {@link BCFViewpointsPlugin#getViewpoint}
|
17
|
+
* to save a viewpoint to JSON, which we'll log to the JavaScript developer console.
|
18
|
+
*
|
19
|
+
* * [[Run this example](http://yjkkit.github.io/yjkkit-sdk/examples/#BCF_SaveViewpoint)]
|
20
|
+
*
|
21
|
+
* ````javascript
|
22
|
+
* import {Viewer, XKTLoaderPlugin, SectionPlanesPlugin, BCFViewpointsPlugin} from "yjkkit-sdk.es.js";
|
23
|
+
*
|
24
|
+
* // Create a Viewer
|
25
|
+
* const viewer = new Viewer({
|
26
|
+
* canvasId: "myCanvas",
|
27
|
+
* transparent: true
|
28
|
+
* });
|
29
|
+
*
|
30
|
+
* // Add a XKTLoaderPlugin
|
31
|
+
* const xktLoader = new XKTLoaderPlugin(viewer);
|
32
|
+
*
|
33
|
+
* // Add a SectionPlanesPlugin
|
34
|
+
* const sectionPlanes = new SectionPlanesPlugin(viewer);
|
35
|
+
*
|
36
|
+
* // Add a BCFViewpointsPlugin
|
37
|
+
* const bcfViewpoints = new BCFViewpointsPlugin(viewer);
|
38
|
+
*
|
39
|
+
* // Load an .XKT model
|
40
|
+
* const modelNode = xktLoader.load({
|
41
|
+
* id: "myModel",
|
42
|
+
* src: "./models/xkt/Schependomlaan.xkt",
|
43
|
+
* edges: true // Emphasise edges
|
44
|
+
* });
|
45
|
+
*
|
46
|
+
* // Slice it in half
|
47
|
+
* sectionPlanes.createSectionPlane({
|
48
|
+
* id: "myClip",
|
49
|
+
* pos: [0, 0, 0],
|
50
|
+
* dir: [0.5, 0.0, 0.5]
|
51
|
+
* });
|
52
|
+
*
|
53
|
+
* // When model is loaded, set camera, select some objects and capture a BCF viewpoint to the console
|
54
|
+
* modelNode.on("loaded", () => {
|
55
|
+
*
|
56
|
+
* const scene = viewer.scene;
|
57
|
+
* const camera = scene.camera;
|
58
|
+
*
|
59
|
+
* camera.eye = [-2.37, 18.97, -26.12];
|
60
|
+
* camera.look = [10.97, 5.82, -11.22];
|
61
|
+
* camera.up = [0.36, 0.83, 0.40];
|
62
|
+
*
|
63
|
+
* scene.setObjectsSelected([
|
64
|
+
* "3b2U496P5Ebhz5FROhTwFH",
|
65
|
+
* "2MGtJUm9nD$Re1_MDIv0g2",
|
66
|
+
* "3IbuwYOm5EV9Q6cXmwVWqd",
|
67
|
+
* "3lhisrBxL8xgLCRdxNG$2v",
|
68
|
+
* "1uDn0xT8LBkP15zQc9MVDW"
|
69
|
+
* ], true);
|
70
|
+
*
|
71
|
+
* const viewpoint = bcfViewpoints.getViewpoint();
|
72
|
+
* const viewpointStr = JSON.stringify(viewpoint, null, 4);
|
73
|
+
*
|
74
|
+
* console.log(viewpointStr);
|
75
|
+
* });
|
76
|
+
* ````
|
77
|
+
*
|
78
|
+
* ## Saving View Setup Hints
|
79
|
+
*
|
80
|
+
* BCFViewpointsPlugin can optionally save hints in the viewpoint, which indicate how to set up the view when
|
81
|
+
* loading it again.
|
82
|
+
*
|
83
|
+
* Here's the {@link BCFViewpointsPlugin#getViewpoint} call again, this time saving some hints:
|
84
|
+
*
|
85
|
+
* ````javascript
|
86
|
+
* const viewpoint = bcfViewpoints.getViewpoint({ // Options
|
87
|
+
* spacesVisible: true, // Force IfcSpace types visible in the viewpoint (default is false)
|
88
|
+
* spaceBoundariesVisible: false, // Show IfcSpace boundaries in the viewpoint (default is false)
|
89
|
+
* openingsVisible: true // Force IfcOpening types visible in the viewpoint (default is false)
|
90
|
+
* });
|
91
|
+
* ````
|
92
|
+
*
|
93
|
+
* ## Loading a BCF Viewpoint
|
94
|
+
*
|
95
|
+
* Assuming that we have our BCF viewpoint in a JSON object, let's now restore it with {@link BCFViewpointsPlugin#setViewpoint}:
|
96
|
+
*
|
97
|
+
* ````javascript
|
98
|
+
* bcfViewpoints.setViewpoint(viewpoint);
|
99
|
+
* ````
|
100
|
+
*
|
101
|
+
* ## Handling BCF Incompatibility with yjkkit's Camera
|
102
|
+
*
|
103
|
+
* yjkkit's {@link Camera#look} is the current 3D *point-of-interest* (POI).
|
104
|
+
*
|
105
|
+
* A BCF viewpoint, however, has a direction vector instead of a POI, and so {@link BCFViewpointsPlugin#getViewpoint} saves
|
106
|
+
* yjkkit's POI as a normalized vector from {@link Camera#eye} to {@link Camera#look}, which unfortunately loses
|
107
|
+
* that positional information. Loading the viewpoint with {@link BCFViewpointsPlugin#setViewpoint} will restore {@link Camera#look} to
|
108
|
+
* the viewpoint's camera position, offset by the normalized vector.
|
109
|
+
*
|
110
|
+
* As shown below, providing a ````rayCast```` option to ````setViewpoint```` will set {@link Camera#look} to the closest
|
111
|
+
* surface intersection on the direction vector. Internally, ````setViewpoint```` supports this option by firing a ray
|
112
|
+
* along the vector, and if that hits an {@link Entity}, sets {@link Camera#look} to ray's intersection point with the
|
113
|
+
* Entity's surface.
|
114
|
+
*
|
115
|
+
* ````javascript
|
116
|
+
* bcfViewpoints.setViewpoint(viewpoint, {
|
117
|
+
* rayCast: true // <<--------------- Attempt to set Camera#look to surface intersection point (default)
|
118
|
+
* });
|
119
|
+
* ````
|
120
|
+
*
|
121
|
+
* ## Dealing With Loaded Models That Are Not in the Viewpoint
|
122
|
+
*
|
123
|
+
* If, for example, we load model "duplex", hide some objects, then save a BCF viewpoint with
|
124
|
+
* ````BCFViewpointsPlugin#getViewpoint````, then load another model, "schependomlaan", then load the viewpoint again
|
125
|
+
* with ````BCFViewpointsPlugin#setViewpoint````, then sometimes all of the objects in model "schependomlaan" become
|
126
|
+
* visible, along with the visible objects in the viewpoint, which belong to model "duplex".
|
127
|
+
*
|
128
|
+
* The reason is that, when saving a BCF viewpoint, BCF logic works like the following pseudo code:
|
129
|
+
*
|
130
|
+
* ````
|
131
|
+
* If numVisibleObjects < numInvisibleObjects
|
132
|
+
* save IDs of visible objects in BCF
|
133
|
+
* exceptions = "visible objects"
|
134
|
+
* else
|
135
|
+
* save IDS of invisible objects in BCF
|
136
|
+
* exceptions = "invisible objects"
|
137
|
+
* ````
|
138
|
+
*
|
139
|
+
* When loading the viewpoint again:
|
140
|
+
*
|
141
|
+
* ````
|
142
|
+
* If exceptions = "visible objects"
|
143
|
+
* hide all objects
|
144
|
+
* show visible objects in BCF
|
145
|
+
* else
|
146
|
+
* show all objects
|
147
|
+
* hide invisible objects in BCF
|
148
|
+
* ````
|
149
|
+
*
|
150
|
+
* When the exception is "visible objects", loading the viewpoint shows all the objects in the first, which includes
|
151
|
+
* objects in "schependomlaan", which can be confusing, because those were not even loaded when we first
|
152
|
+
* saved the viewpoint..
|
153
|
+
*
|
154
|
+
* To solve this, we can supply a ````defaultInvisible```` option to {@link BCFViewpointsPlugin#getViewpoint}, which
|
155
|
+
* will force the plugin to save the IDs of all visible objects while making invisible objects the exception.
|
156
|
+
*
|
157
|
+
* That way, when we load the viewpoint again, after loading model "schependomlaan", the plugin will hide all objects
|
158
|
+
* in the scene first (which will include objects belonging to model "schependomlaan"), then make the objects in the
|
159
|
+
* viewpoint visible (which will only be those of object "duplex").
|
160
|
+
*
|
161
|
+
* ````javascript
|
162
|
+
* const viewpoint = bcfViewpoints.getViewpoint({ // Options
|
163
|
+
* //..
|
164
|
+
* defaultInvisible: true
|
165
|
+
* });
|
166
|
+
* ````
|
167
|
+
*
|
168
|
+
* [[Run an example](http://yjkkit.github.io/yjkkit-sdk/examples/#BCF_LoadViewpoint_defaultInvisible)]
|
169
|
+
*
|
170
|
+
* ## Behaviour with XKTLoaderPlugin globalizeObjectIds
|
171
|
+
*
|
172
|
+
* Whenever we use {@link XKTLoaderPlugin} to load duplicate copies of the same model, after configuring
|
173
|
+
* {@link XKTLoaderPlugin#globalizeObjectIds} ````true```` to avoid ````Entity```` ID clashes, this has consequences
|
174
|
+
* for BCF viewpoints created by {@link BCFViewpointsPlugin#getViewpoint}.
|
175
|
+
*
|
176
|
+
* When no duplicate copies of a model are loaded like this, viewpoints created by {@link BCFViewpointsPlugin#getViewpoint} will
|
177
|
+
* continue to load as usual in other BIM viewers. Conversely, a viewpoint created for a single model in other BIM viewers
|
178
|
+
* will continue to load as usual with ````BCFViewpointsPlugin````.
|
179
|
+
*
|
180
|
+
* When duplicate copies of a model are loaded, however, viewpoints created by {@link BCFViewpointsPlugin#getViewpoint}
|
181
|
+
* will contain certain changes that will affect the viewpoint's portability, however. Such viewpoints will
|
182
|
+
* use ````authoring_tool_id```` fields to save the globalized ````Entity#id```` values, which enables the viewpoints to
|
183
|
+
* capture the states of the individual ````Entitys```` that represent the duplicate IFC elements. Take a look at the
|
184
|
+
* following two examples to learn more.
|
185
|
+
*
|
186
|
+
* * [Example: Saving a BCF viewpoint containing duplicate models](https://yjkkit.github.io/yjkkit-sdk/examples/#BCF_SaveViewpoint_MultipleModels)
|
187
|
+
* * [Example: Loading a BCF viewpoint containing duplicate models](https://yjkkit.github.io/yjkkit-sdk/examples/#BCF_LoadViewpoint_MultipleModels)
|
188
|
+
*
|
189
|
+
* **Caveat:** when loading a BCF viewpoint, we always assume that we have loaded in our target BIM viewer the same models that were
|
190
|
+
* loaded in the viewpoint's original authoring application when the viewpoint was created. In the case of multi-model
|
191
|
+
* viewpoints, the target BIM viewer, whether it be yjkkit or another BIM viewer, will need to first have those exact
|
192
|
+
* models loaded, with their objects having globalized IDs, following the same prefixing scheme we're using in
|
193
|
+
* yjkkit. Then, the viewpoint's ````authoring_tool_id```` fields will be able to resolve to their objects within the
|
194
|
+
* target viewer.
|
195
|
+
*
|
196
|
+
* @class BCFViewpointsPlugin
|
197
|
+
*/
|
198
|
+
class BCFViewpointsPlugin extends Plugin {
|
199
|
+
|
200
|
+
/**
|
201
|
+
* @constructor
|
202
|
+
* @param {Viewer} viewer The Viewer.
|
203
|
+
* @param {Object} cfg Plugin configuration.
|
204
|
+
* @param {String} [cfg.id="BCFViewpoints"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.
|
205
|
+
* @param {String} [cfg.originatingSystem] Identifies the originating system for BCF records.
|
206
|
+
* @param {String} [cfg.authoringTool] Identifies the authoring tool for BCF records.
|
207
|
+
*/
|
208
|
+
constructor(viewer, cfg = {}) {
|
209
|
+
|
210
|
+
super("BCFViewpoints", viewer, cfg);
|
211
|
+
|
212
|
+
/**
|
213
|
+
* Identifies the originating system to include in BCF viewpoints saved by this plugin.
|
214
|
+
* @property originatingSystem
|
215
|
+
* @type {string}
|
216
|
+
*/
|
217
|
+
this.originatingSystem = cfg.originatingSystem || "yjkkit.io";
|
218
|
+
|
219
|
+
/**
|
220
|
+
* Identifies the authoring tool to include in BCF viewpoints saved by this plugin.
|
221
|
+
* @property authoringTool
|
222
|
+
* @type {string}
|
223
|
+
*/
|
224
|
+
this.authoringTool = cfg.authoringTool || "yjkkit.io";
|
225
|
+
}
|
226
|
+
|
227
|
+
/**
|
228
|
+
* Saves viewer state to a BCF viewpoint.
|
229
|
+
*
|
230
|
+
* Note that yjkkit's {@link Camera#look} is the **point-of-interest**, whereas the BCF ````camera_direction```` is a
|
231
|
+
* direction vector. Therefore, we save ````camera_direction```` as the vector from {@link Camera#eye} to {@link Camera#look}.
|
232
|
+
*
|
233
|
+
* @param {*} [options] Options for getting the viewpoint.
|
234
|
+
* @param {Boolean} [options.spacesVisible=false] Indicates whether ````IfcSpace```` types should be forced visible in the viewpoint.
|
235
|
+
* @param {Boolean} [options.openingsVisible=false] Indicates whether ````IfcOpening```` types should be forced visible in the viewpoint.
|
236
|
+
* @param {Boolean} [options.spaceBoundariesVisible=false] Indicates whether the boundaries of ````IfcSpace```` types should be visible in the viewpoint.
|
237
|
+
* @param {Boolean} [options.snapshot=true] Indicates whether the snapshot should be included in the viewpoint.
|
238
|
+
* @param {Boolean} [options.defaultInvisible=false] When ````true````, will save the default visibility of all objects
|
239
|
+
* as ````false````. This means that when we load the viewpoint again, and there are additional models loaded that
|
240
|
+
* were not saved in the viewpoint, those models will be hidden when we load the viewpoint, and that only the
|
241
|
+
* objects in the viewpoint will be visible.
|
242
|
+
* @param {Boolean} [options.reverseClippingPlanes=false] When ````true````, clipping planes are reversed (https://github.com/buildingSMART/BCF-XML/issues/193)
|
243
|
+
* @returns {*} BCF JSON viewpoint object
|
244
|
+
* @example
|
245
|
+
*
|
246
|
+
* const viewer = new Viewer();
|
247
|
+
*
|
248
|
+
* const bcfPlugin = new BCFPlugin(viewer, {
|
249
|
+
* //...
|
250
|
+
* });
|
251
|
+
*
|
252
|
+
* const viewpoint = bcfPlugin.getViewpoint({ // Options - see constructor
|
253
|
+
* spacesVisible: false, // Default
|
254
|
+
* spaceBoundariesVisible: false, // Default
|
255
|
+
* openingsVisible: false // Default
|
256
|
+
* });
|
257
|
+
*
|
258
|
+
* // viewpoint will resemble the following:
|
259
|
+
*
|
260
|
+
* {
|
261
|
+
* perspective_camera: {
|
262
|
+
* camera_view_point: {
|
263
|
+
* x: 0.0,
|
264
|
+
* y: 0.0,
|
265
|
+
* z: 0.0
|
266
|
+
* },
|
267
|
+
* camera_direction: {
|
268
|
+
* x: 1.0,
|
269
|
+
* y: 1.0,
|
270
|
+
* z: 2.0
|
271
|
+
* },
|
272
|
+
* camera_up_vector: {
|
273
|
+
* x: 0.0,
|
274
|
+
* y: 0.0,
|
275
|
+
* z: 1.0
|
276
|
+
* },
|
277
|
+
* field_of_view: 90.0
|
278
|
+
* },
|
279
|
+
* lines: [],
|
280
|
+
* clipping_planes: [{
|
281
|
+
* location: {
|
282
|
+
* x: 0.5,
|
283
|
+
* y: 0.5,
|
284
|
+
* z: 0.5
|
285
|
+
* },
|
286
|
+
* direction: {
|
287
|
+
* x: 1.0,
|
288
|
+
* y: 0.0,
|
289
|
+
* z: 0.0
|
290
|
+
* }
|
291
|
+
* }],
|
292
|
+
* bitmaps: [],
|
293
|
+
* snapshot: {
|
294
|
+
* snapshot_type: png,
|
295
|
+
* snapshot_data: "data:image/png;base64,......"
|
296
|
+
* },
|
297
|
+
* components: {
|
298
|
+
* visibility: {
|
299
|
+
* default_visibility: false,
|
300
|
+
* exceptions: [{
|
301
|
+
* ifc_guid: 4$cshxZO9AJBebsni$z9Yk,
|
302
|
+
* originating_system: yjkkit.io,
|
303
|
+
* authoring_tool_id: yjkkit/v1.0
|
304
|
+
* }]
|
305
|
+
* },
|
306
|
+
* selection: [{
|
307
|
+
* ifc_guid: "4$cshxZO9AJBebsni$z9Yk",
|
308
|
+
* }]
|
309
|
+
* }
|
310
|
+
* }
|
311
|
+
*/
|
312
|
+
getViewpoint(options = {}) {
|
313
|
+
const scene = this.viewer.scene;
|
314
|
+
const camera = scene.camera;
|
315
|
+
const realWorldOffset = scene.realWorldOffset;
|
316
|
+
const reverseClippingPlanes = (options.reverseClippingPlanes === true);
|
317
|
+
let bcfViewpoint = {};
|
318
|
+
|
319
|
+
// Camera
|
320
|
+
let lookDirection = math.normalizeVec3(math.subVec3(camera.look, camera.eye, math.vec3()));
|
321
|
+
let eye = camera.eye;
|
322
|
+
let up = camera.up;
|
323
|
+
|
324
|
+
if (camera.yUp) {
|
325
|
+
// BCF is Z up
|
326
|
+
lookDirection = YToZ(lookDirection);
|
327
|
+
eye = YToZ(eye);
|
328
|
+
up = YToZ(up);
|
329
|
+
}
|
330
|
+
|
331
|
+
const camera_view_point = xyzArrayToObject(math.addVec3(eye, realWorldOffset));
|
332
|
+
|
333
|
+
if (camera.projection === "ortho") {
|
334
|
+
bcfViewpoint.orthogonal_camera = {
|
335
|
+
camera_view_point: camera_view_point,
|
336
|
+
camera_direction: xyzArrayToObject(lookDirection),
|
337
|
+
camera_up_vector: xyzArrayToObject(up),
|
338
|
+
view_to_world_scale: camera.ortho.scale,
|
339
|
+
};
|
340
|
+
} else {
|
341
|
+
bcfViewpoint.perspective_camera = {
|
342
|
+
camera_view_point: camera_view_point,
|
343
|
+
camera_direction: xyzArrayToObject(lookDirection),
|
344
|
+
camera_up_vector: xyzArrayToObject(up),
|
345
|
+
field_of_view: camera.perspective.fov,
|
346
|
+
};
|
347
|
+
}
|
348
|
+
|
349
|
+
// Clipping planes
|
350
|
+
|
351
|
+
const sectionPlanes = scene.sectionPlanes;
|
352
|
+
for (let id in sectionPlanes) {
|
353
|
+
if (sectionPlanes.hasOwnProperty(id)) {
|
354
|
+
let sectionPlane = sectionPlanes[id];
|
355
|
+
|
356
|
+
let location = sectionPlane.pos;
|
357
|
+
|
358
|
+
let direction;
|
359
|
+
if (reverseClippingPlanes) {
|
360
|
+
direction = math.negateVec3(sectionPlane.dir, math.vec3());
|
361
|
+
} else {
|
362
|
+
direction = sectionPlane.dir;
|
363
|
+
}
|
364
|
+
|
365
|
+
if (camera.yUp) {
|
366
|
+
// BCF is Z up
|
367
|
+
location = YToZ(location);
|
368
|
+
direction = YToZ(direction);
|
369
|
+
}
|
370
|
+
math.addVec3(location, realWorldOffset);
|
371
|
+
|
372
|
+
location = xyzArrayToObject(location);
|
373
|
+
direction = xyzArrayToObject(direction);
|
374
|
+
if (!bcfViewpoint.clipping_planes) {
|
375
|
+
bcfViewpoint.clipping_planes = [];
|
376
|
+
}
|
377
|
+
bcfViewpoint.clipping_planes.push({location, direction});
|
378
|
+
}
|
379
|
+
}
|
380
|
+
|
381
|
+
// Entity states
|
382
|
+
|
383
|
+
bcfViewpoint.components = {
|
384
|
+
visibility: {
|
385
|
+
view_setup_hints: {
|
386
|
+
spaces_visible: !!options.spacesVisible,
|
387
|
+
space_boundaries_visible: !!options.spaceBoundariesVisible,
|
388
|
+
openings_visible: !!options.openingsVisible
|
389
|
+
}
|
390
|
+
}
|
391
|
+
};
|
392
|
+
|
393
|
+
const opacityObjectIds = new Set(scene.opacityObjectIds);
|
394
|
+
const xrayedObjectIds = new Set(scene.xrayedObjectIds);
|
395
|
+
const colorizedObjectIds = new Set(scene.colorizedObjectIds);
|
396
|
+
|
397
|
+
const originalSystemColoringMap = {};
|
398
|
+
|
399
|
+
const coloringMap = Object.values(scene.objects)
|
400
|
+
.filter(entity => opacityObjectIds.has(entity.id) || colorizedObjectIds.has(entity.id) || xrayedObjectIds.has(entity.id))
|
401
|
+
.reduce((coloringMap, entity) => {
|
402
|
+
|
403
|
+
let color = colorizeToRGB(entity.colorize);
|
404
|
+
let alpha;
|
405
|
+
|
406
|
+
if (entity.xrayed) {
|
407
|
+
if (scene.xrayMaterial.fillAlpha === 0.0 && scene.xrayMaterial.edgeAlpha !== 0.0) {
|
408
|
+
// BCF can't deal with edges. If xRay is implemented only with edges, set an arbitrary opacity
|
409
|
+
alpha = 0.1;
|
410
|
+
} else {
|
411
|
+
alpha = scene.xrayMaterial.fillAlpha;
|
412
|
+
}
|
413
|
+
alpha = Math.round(alpha * 255).toString(16).padStart(2, "0");
|
414
|
+
color = alpha + color;
|
415
|
+
} else if (opacityObjectIds.has(entity.id)) {
|
416
|
+
alpha = Math.round(entity.opacity * 255).toString(16).padStart(2, "0");
|
417
|
+
color = alpha + color;
|
418
|
+
}
|
419
|
+
|
420
|
+
if (!coloringMap[color]) {
|
421
|
+
coloringMap[color] = [];
|
422
|
+
}
|
423
|
+
|
424
|
+
const objectId = entity.id;
|
425
|
+
const originalSystemId = entity.originalSystemId;
|
426
|
+
const component = {
|
427
|
+
ifc_guid: originalSystemId,
|
428
|
+
originating_system: this.originatingSystem
|
429
|
+
};
|
430
|
+
if (originalSystemId !== objectId) {
|
431
|
+
component.authoring_tool_id = objectId;
|
432
|
+
}
|
433
|
+
|
434
|
+
coloringMap[color].push(component);
|
435
|
+
|
436
|
+
return coloringMap;
|
437
|
+
|
438
|
+
}, {});
|
439
|
+
|
440
|
+
const coloringArray = Object.entries(coloringMap).map(([color, components]) => {
|
441
|
+
return {color, components};
|
442
|
+
});
|
443
|
+
|
444
|
+
bcfViewpoint.components.coloring = coloringArray;
|
445
|
+
|
446
|
+
const objectIds = scene.objectIds;
|
447
|
+
const visibleObjects = scene.visibleObjects;
|
448
|
+
const visibleObjectIds = scene.visibleObjectIds;
|
449
|
+
const invisibleObjectIds = objectIds.filter(id => !visibleObjects[id]);
|
450
|
+
const selectedObjectIds = scene.selectedObjectIds;
|
451
|
+
|
452
|
+
if (options.defaultInvisible || visibleObjectIds.length < invisibleObjectIds.length) {
|
453
|
+
bcfViewpoint.components.visibility.exceptions = this._createBCFComponents(visibleObjectIds);
|
454
|
+
bcfViewpoint.components.visibility.default_visibility = false;
|
455
|
+
} else {
|
456
|
+
bcfViewpoint.components.visibility.exceptions = this._createBCFComponents(invisibleObjectIds);
|
457
|
+
bcfViewpoint.components.visibility.default_visibility = true;
|
458
|
+
}
|
459
|
+
|
460
|
+
bcfViewpoint.components.selection = this._createBCFComponents(selectedObjectIds);
|
461
|
+
|
462
|
+
if (options.snapshot !== false) {
|
463
|
+
bcfViewpoint.snapshot = {
|
464
|
+
snapshot_type: "png",
|
465
|
+
snapshot_data: this.viewer.getSnapshot({format: "png"})
|
466
|
+
};
|
467
|
+
}
|
468
|
+
|
469
|
+
return bcfViewpoint;
|
470
|
+
}
|
471
|
+
|
472
|
+
_createBCFComponents(objectIds) {
|
473
|
+
const scene = this.viewer.scene;
|
474
|
+
const components = [];
|
475
|
+
for (let i = 0, len = objectIds.length; i < len; i++) {
|
476
|
+
const objectId = objectIds[i];
|
477
|
+
const entity = scene.objects[objectId];
|
478
|
+
if (entity) {
|
479
|
+
const component = {
|
480
|
+
ifc_guid: entity.originalSystemId,
|
481
|
+
originating_system: this.originatingSystem
|
482
|
+
};
|
483
|
+
if (entity.originalSystemId !== objectId) {
|
484
|
+
component.authoring_tool_id = objectId;
|
485
|
+
}
|
486
|
+
components.push(component);
|
487
|
+
}
|
488
|
+
}
|
489
|
+
return components;
|
490
|
+
}
|
491
|
+
|
492
|
+
/**
|
493
|
+
* Sets viewer state to the given BCF viewpoint.
|
494
|
+
*
|
495
|
+
* Note that yjkkit's {@link Camera#look} is the **point-of-interest**, whereas the BCF ````camera_direction```` is a
|
496
|
+
* direction vector. Therefore, when loading a BCF viewpoint, we set {@link Camera#look} to the absolute position
|
497
|
+
* obtained by offsetting the BCF ````camera_view_point```` along ````camera_direction````.
|
498
|
+
*
|
499
|
+
* When loading a viewpoint, we also have the option to find {@link Camera#look} as the closest point of intersection
|
500
|
+
* (on the surface of any visible and pickable {@link Entity}) with a 3D ray fired from ````camera_view_point```` in
|
501
|
+
* the direction of ````camera_direction````.
|
502
|
+
*
|
503
|
+
* @param {*} bcfViewpoint BCF JSON viewpoint object,
|
504
|
+
* shows default visible entities and restores camera to initial default position.
|
505
|
+
* @param {*} [options] Options for setting the viewpoint.
|
506
|
+
* @param {Boolean} [options.rayCast=true] When ````true```` (default), will attempt to set {@link Camera#look} to the closest
|
507
|
+
* point of surface intersection with a ray fired from the BCF ````camera_view_point```` in the direction of ````camera_direction````.
|
508
|
+
* @param {Boolean} [options.immediate=true] When ````true```` (default), immediately set camera position.
|
509
|
+
* @param {Boolean} [options.duration] Flight duration in seconds. Overrides {@link CameraFlightAnimation#duration}. Only applies when ````immediate```` is ````false````.
|
510
|
+
* @param {Boolean} [options.reset=true] When ````true```` (default), set {@link Entity#xrayed} and {@link Entity#highlighted} ````false```` on all scene objects.
|
511
|
+
* @param {Boolean} [options.reverseClippingPlanes=false] When ````true````, clipping planes are reversed (https://github.com/buildingSMART/BCF-XML/issues/193)
|
512
|
+
* @param {Boolean} [options.updateCompositeObjects=false] When ````true````, then when visibility and selection updates refer to composite objects (eg. an IfcBuildingStorey),
|
513
|
+
* then this method will apply the updates to objects within those composites.
|
514
|
+
*/
|
515
|
+
setViewpoint(bcfViewpoint, options = {}) {
|
516
|
+
if (!bcfViewpoint) {
|
517
|
+
return;
|
518
|
+
}
|
519
|
+
|
520
|
+
const viewer = this.viewer;
|
521
|
+
const scene = viewer.scene;
|
522
|
+
const camera = scene.camera;
|
523
|
+
const rayCast = (options.rayCast !== false);
|
524
|
+
const immediate = (options.immediate !== false);
|
525
|
+
const reset = (options.reset !== false);
|
526
|
+
const realWorldOffset = scene.realWorldOffset;
|
527
|
+
const reverseClippingPlanes = (options.reverseClippingPlanes === true);
|
528
|
+
|
529
|
+
scene.clearSectionPlanes();
|
530
|
+
|
531
|
+
if (bcfViewpoint.clipping_planes) {
|
532
|
+
bcfViewpoint.clipping_planes.forEach(function (e) {
|
533
|
+
let pos = xyzObjectToArray(e.location, tempVec3);
|
534
|
+
let dir = xyzObjectToArray(e.direction, tempVec3);
|
535
|
+
|
536
|
+
if (reverseClippingPlanes) {
|
537
|
+
math.negateVec3(dir);
|
538
|
+
}
|
539
|
+
math.subVec3(pos, realWorldOffset);
|
540
|
+
|
541
|
+
if (camera.yUp) {
|
542
|
+
pos = ZToY(pos);
|
543
|
+
dir = ZToY(dir);
|
544
|
+
}
|
545
|
+
new SectionPlane(scene, {pos, dir});
|
546
|
+
});
|
547
|
+
}
|
548
|
+
|
549
|
+
if (reset) {
|
550
|
+
scene.setObjectsXRayed(scene.xrayedObjectIds, false);
|
551
|
+
scene.setObjectsHighlighted(scene.highlightedObjectIds, false);
|
552
|
+
scene.setObjectsSelected(scene.selectedObjectIds, false);
|
553
|
+
}
|
554
|
+
|
555
|
+
if (bcfViewpoint.components) {
|
556
|
+
|
557
|
+
if (bcfViewpoint.components.visibility) {
|
558
|
+
|
559
|
+
if (!bcfViewpoint.components.visibility.default_visibility) {
|
560
|
+
scene.setObjectsVisible(scene.objectIds, false);
|
561
|
+
if (bcfViewpoint.components.visibility.exceptions) {
|
562
|
+
bcfViewpoint.components.visibility.exceptions.forEach((component) => this._withBCFComponent(options, component, entity => entity.visible = true));
|
563
|
+
}
|
564
|
+
} else {
|
565
|
+
scene.setObjectsVisible(scene.objectIds, true);
|
566
|
+
if (bcfViewpoint.components.visibility.exceptions) {
|
567
|
+
bcfViewpoint.components.visibility.exceptions.forEach((component) => this._withBCFComponent(options, component, entity => entity.visible = false));
|
568
|
+
}
|
569
|
+
}
|
570
|
+
|
571
|
+
const view_setup_hints = bcfViewpoint.components.visibility.view_setup_hints;
|
572
|
+
if (view_setup_hints) {
|
573
|
+
if (view_setup_hints.spaces_visible === false) {
|
574
|
+
scene.setObjectsVisible(viewer.metaScene.getObjectIDsByType("IfcSpace"), false);
|
575
|
+
}
|
576
|
+
if (view_setup_hints.openings_visible === false) {
|
577
|
+
scene.setObjectsVisible(viewer.metaScene.getObjectIDsByType("IfcOpening"), false);
|
578
|
+
}
|
579
|
+
if (view_setup_hints.space_boundaries_visible !== undefined) {
|
580
|
+
// TODO: Ability to show boundaries
|
581
|
+
}
|
582
|
+
}
|
583
|
+
}
|
584
|
+
|
585
|
+
if (bcfViewpoint.components.selection) {
|
586
|
+
scene.setObjectsSelected(scene.selectedObjectIds, false);
|
587
|
+
bcfViewpoint.components.selection.forEach(component => this._withBCFComponent(options, component, entity => entity.selected = true));
|
588
|
+
|
589
|
+
}
|
590
|
+
|
591
|
+
if (bcfViewpoint.components.coloring) {
|
592
|
+
bcfViewpoint.components.coloring.forEach(coloring => {
|
593
|
+
|
594
|
+
let color = coloring.color;
|
595
|
+
let alpha = 0;
|
596
|
+
let alphaDefined = false;
|
597
|
+
|
598
|
+
if (color.length === 8) {
|
599
|
+
alpha = parseInt(color.substring(0, 2), 16) / 256;
|
600
|
+
if (alpha <= 1.0 && alpha >= 0.95) {
|
601
|
+
alpha = 1.0;
|
602
|
+
}
|
603
|
+
color = color.substring(2);
|
604
|
+
alphaDefined = true;
|
605
|
+
}
|
606
|
+
|
607
|
+
const colorize = [
|
608
|
+
parseInt(color.substring(0, 2), 16) / 256,
|
609
|
+
parseInt(color.substring(2, 4), 16) / 256,
|
610
|
+
parseInt(color.substring(4, 6), 16) / 256
|
611
|
+
];
|
612
|
+
|
613
|
+
coloring.components.map(component =>
|
614
|
+
this._withBCFComponent(options, component, entity => {
|
615
|
+
entity.colorize = colorize;
|
616
|
+
if (alphaDefined) {
|
617
|
+
entity.opacity = alpha;
|
618
|
+
}
|
619
|
+
}));
|
620
|
+
});
|
621
|
+
}
|
622
|
+
}
|
623
|
+
|
624
|
+
if (bcfViewpoint.perspective_camera || bcfViewpoint.orthogonal_camera) {
|
625
|
+
let eye;
|
626
|
+
let look;
|
627
|
+
let up;
|
628
|
+
let projection;
|
629
|
+
|
630
|
+
if (bcfViewpoint.perspective_camera) {
|
631
|
+
eye = xyzObjectToArray(bcfViewpoint.perspective_camera.camera_view_point, tempVec3);
|
632
|
+
look = xyzObjectToArray(bcfViewpoint.perspective_camera.camera_direction, tempVec3);
|
633
|
+
up = xyzObjectToArray(bcfViewpoint.perspective_camera.camera_up_vector, tempVec3);
|
634
|
+
|
635
|
+
camera.perspective.fov = bcfViewpoint.perspective_camera.field_of_view;
|
636
|
+
|
637
|
+
projection = "perspective";
|
638
|
+
} else {
|
639
|
+
eye = xyzObjectToArray(bcfViewpoint.orthogonal_camera.camera_view_point, tempVec3);
|
640
|
+
look = xyzObjectToArray(bcfViewpoint.orthogonal_camera.camera_direction, tempVec3);
|
641
|
+
up = xyzObjectToArray(bcfViewpoint.orthogonal_camera.camera_up_vector, tempVec3);
|
642
|
+
|
643
|
+
camera.ortho.scale = bcfViewpoint.orthogonal_camera.view_to_world_scale;
|
644
|
+
|
645
|
+
projection = "ortho";
|
646
|
+
}
|
647
|
+
|
648
|
+
math.subVec3(eye, realWorldOffset);
|
649
|
+
|
650
|
+
if (camera.yUp) {
|
651
|
+
eye = ZToY(eye);
|
652
|
+
look = ZToY(look);
|
653
|
+
up = ZToY(up);
|
654
|
+
}
|
655
|
+
|
656
|
+
if (rayCast) {
|
657
|
+
const hit = scene.pick({
|
658
|
+
pickSurface: true, // <<------ This causes picking to find the intersection point on the entity
|
659
|
+
origin: eye,
|
660
|
+
direction: look
|
661
|
+
});
|
662
|
+
look = (hit ? hit.worldPos : math.addVec3(eye, look, tempVec3));
|
663
|
+
} else {
|
664
|
+
look = math.addVec3(eye, look, tempVec3);
|
665
|
+
}
|
666
|
+
|
667
|
+
if (immediate) {
|
668
|
+
camera.eye = eye;
|
669
|
+
camera.look = look;
|
670
|
+
camera.up = up;
|
671
|
+
camera.projection = projection;
|
672
|
+
} else {
|
673
|
+
viewer.cameraFlight.flyTo({eye, look, up, duration: options.duration, projection});
|
674
|
+
}
|
675
|
+
}
|
676
|
+
}
|
677
|
+
|
678
|
+
_withBCFComponent(options, component, callback) {
|
679
|
+
|
680
|
+
const viewer = this.viewer;
|
681
|
+
const scene = viewer.scene;
|
682
|
+
|
683
|
+
if (component.authoring_tool_id && component.originating_system === this.originatingSystem) {
|
684
|
+
|
685
|
+
const id = component.authoring_tool_id;
|
686
|
+
const entity = scene.objects[id];
|
687
|
+
|
688
|
+
if (entity) {
|
689
|
+
callback(entity);
|
690
|
+
return
|
691
|
+
}
|
692
|
+
|
693
|
+
if (options.updateCompositeObjects) {
|
694
|
+
const metaObject = viewer.metaScene.metaObjects[id];
|
695
|
+
if (metaObject) {
|
696
|
+
scene.withObjects(viewer.metaScene.getObjectIDsInSubtree(id), callback);
|
697
|
+
return;
|
698
|
+
}
|
699
|
+
}
|
700
|
+
}
|
701
|
+
|
702
|
+
if (component.ifc_guid) {
|
703
|
+
|
704
|
+
const originalSystemId = component.ifc_guid;
|
705
|
+
const entity = scene.objects[originalSystemId];
|
706
|
+
|
707
|
+
if (entity) {
|
708
|
+
callback(entity);
|
709
|
+
return;
|
710
|
+
}
|
711
|
+
|
712
|
+
if (options.updateCompositeObjects) {
|
713
|
+
const metaObject = viewer.metaScene.metaObjects[originalSystemId];
|
714
|
+
if (metaObject) {
|
715
|
+
scene.withObjects(viewer.metaScene.getObjectIDsInSubtree(originalSystemId), callback);
|
716
|
+
return;
|
717
|
+
}
|
718
|
+
}
|
719
|
+
|
720
|
+
Object.keys(scene.models).forEach((modelId) => {
|
721
|
+
|
722
|
+
const id = math.globalizeObjectId(modelId, originalSystemId);
|
723
|
+
const entity = scene.objects[id];
|
724
|
+
|
725
|
+
if (entity) {
|
726
|
+
callback(entity);
|
727
|
+
return;
|
728
|
+
}
|
729
|
+
|
730
|
+
if (options.updateCompositeObjects) {
|
731
|
+
const metaObject = viewer.metaScene.metaObjects[id];
|
732
|
+
if (metaObject) {
|
733
|
+
scene.withObjects(viewer.metaScene.getObjectIDsInSubtree(id), callback);
|
734
|
+
return;
|
735
|
+
}
|
736
|
+
}
|
737
|
+
});
|
738
|
+
}
|
739
|
+
}
|
740
|
+
|
741
|
+
/**
|
742
|
+
* Destroys this BCFViewpointsPlugin.
|
743
|
+
*/
|
744
|
+
destroy() {
|
745
|
+
super.destroy();
|
746
|
+
}
|
747
|
+
}
|
748
|
+
|
749
|
+
function xyzArrayToObject(arr) {
|
750
|
+
return {"x": arr[0], "y": arr[1], "z": arr[2]};
|
751
|
+
}
|
752
|
+
|
753
|
+
function xyzObjectToArray(xyz, arry) {
|
754
|
+
arry = new Float64Array(3);
|
755
|
+
arry[0] = xyz.x;
|
756
|
+
arry[1] = xyz.y;
|
757
|
+
arry[2] = xyz.z;
|
758
|
+
return arry;
|
759
|
+
}
|
760
|
+
|
761
|
+
function YToZ(vec) {
|
762
|
+
return new Float64Array([vec[0], -vec[2], vec[1]]);
|
763
|
+
}
|
764
|
+
|
765
|
+
function ZToY(vec) {
|
766
|
+
return new Float64Array([vec[0], vec[2], -vec[1]]);
|
767
|
+
}
|
768
|
+
|
769
|
+
function colorizeToRGB(color) {
|
770
|
+
let rgb = "";
|
771
|
+
rgb += Math.round(color[0] * 255).toString(16).padStart(2, "0");
|
772
|
+
rgb += Math.round(color[1] * 255).toString(16).padStart(2, "0");
|
773
|
+
rgb += Math.round(color[2] * 255).toString(16).padStart(2, "0");
|
774
|
+
return rgb;
|
775
|
+
}
|
776
|
+
|
777
|
+
export {BCFViewpointsPlugin};
|