csyjk 1.2.2 → 2.2.2
Sign up to get free protection for your applications and to get access to all the features.
- package/{dist/app.js → app.js} +0 -0
- package/{dist/index.html → index.html} +0 -0
- package/package.json +5 -40
- package/{dist/style.css → style.css} +0 -0
- package/.babelrc +0 -7
- package/.idea/modules.xml +0 -8
- package/.idea/xx.iml +0 -12
- package/public/gltf.js +0 -2241
- package/public/index.html +0 -10
- package/src/index.js +0 -3
- package/src/lib/gltf/assets/check.jpg +0 -0
- package/src/lib/gltf/assets/iconfont/iconfont.css +0 -358
- package/src/lib/gltf/assets/iconfont/iconfont.eot +0 -0
- package/src/lib/gltf/assets/iconfont/iconfont.js +0 -1
- package/src/lib/gltf/assets/iconfont/iconfont.json +0 -604
- package/src/lib/gltf/assets/iconfont/iconfont.svg +0 -189
- 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 +0 -15
- package/src/lib/gltf/assets/yjkkit-sdk/src/extras/ContextMenu/ContextMenu.js +0 -863
- package/src/lib/gltf/assets/yjkkit-sdk/src/extras/ContextMenu/index.js +0 -1
- package/src/lib/gltf/assets/yjkkit-sdk/src/extras/index.js +0 -1
- package/src/lib/gltf/assets/yjkkit-sdk/src/index.js +0 -3
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AngleMeasurementsPlugin/AngleMeasurement.js +0 -462
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsControl.js +0 -279
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsPlugin.js +0 -262
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AngleMeasurementsPlugin/index.js +0 -1
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AnnotationsPlugin/Annotation.js +0 -362
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AnnotationsPlugin/AnnotationsPlugin.js +0 -575
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AnnotationsPlugin/index.js +0 -1
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AxisGizmoPlugin/AxisGizmoPlugin.js +0 -333
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AxisGizmoPlugin/index.js +0 -1
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/BCFViewpointsPlugin/BCFViewpointsPlugin.js +0 -777
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/BCFViewpointsPlugin/index.js +0 -1
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js +0 -525
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsControl.js +0 -242
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsPlugin.js +0 -297
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/DistanceMeasurementsPlugin/index.js +0 -1
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/FastNavPlugin/FastNavPlugin.js +0 -345
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/FastNavPlugin/index.js +0 -1
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/GLTFLoaderPlugin/GLTFDefaultDataSource.js +0 -122
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/GLTFLoaderPlugin/GLTFLoaderPlugin.js +0 -462
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/GLTFLoaderPlugin/GLTFPerformanceModelLoader.js +0 -508
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/GLTFLoaderPlugin/GLTFSceneGraphLoader.js +0 -922
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/GLTFLoaderPlugin/index.js +0 -2
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/NavCubePlugin/CubeTextureCanvas.js +0 -273
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/NavCubePlugin/NavCubePlugin.js +0 -687
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/NavCubePlugin/index.js +0 -1
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/OBJLoaderPlugin/OBJLoaderPlugin.js +0 -145
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/OBJLoaderPlugin/OBJSceneGraphLoader.js +0 -777
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/OBJLoaderPlugin/index.js +0 -1
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/STLLoaderPlugin/STLDefaultDataSource.js +0 -33
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/STLLoaderPlugin/STLLoaderPlugin.js +0 -273
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/STLLoaderPlugin/STLSceneGraphLoader.js +0 -313
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/STLLoaderPlugin/index.js +0 -2
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/SectionPlanesPlugin/Control.js +0 -1328
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/SectionPlanesPlugin/Overview.js +0 -249
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/SectionPlanesPlugin/Plane.js +0 -169
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/SectionPlanesPlugin/SectionPlanesPlugin.js +0 -403
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/SectionPlanesPlugin/index.js +0 -1
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/SkyboxesPlugin/SkyboxesPlugin.js +0 -134
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/SkyboxesPlugin/index.js +0 -1
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/StoreyViewsPlugin/IFCStoreyPlanObjectStates.js +0 -77
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/StoreyViewsPlugin/Storey.js +0 -61
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/StoreyViewsPlugin/StoreyMap.js +0 -57
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/StoreyViewsPlugin/StoreyViewsPlugin.js +0 -822
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/StoreyViewsPlugin/index.js +0 -1
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/TreeViewPlugin/ModelTreeView.js +0 -888
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/TreeViewPlugin/TreeViewNode.js +0 -88
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/TreeViewPlugin/TreeViewPlugin.js +0 -624
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/TreeViewPlugin/index.js +0 -1
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/TreeViewPlugin/modelValidation.js +0 -87
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/ViewCullPlugin/ViewCullPlugin.js +0 -295
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/ViewCullPlugin/index.js +0 -1
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/XKTDefaultDataSource.js +0 -78
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js +0 -847
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/index.js +0 -2
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV1.js +0 -167
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV2.js +0 -228
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV3.js +0 -220
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV4.js +0 -279
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV5.js +0 -244
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV6.js +0 -301
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV7.js +0 -426
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV8.js +0 -479
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/lib/pako.js +0 -6818
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/XML3DLoaderPlugin.js +0 -238
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/XML3DSceneGraphLoader.js +0 -1279
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/index.js +0 -1
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/.jshintrc +0 -11
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/deflate.js +0 -2060
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/inflate.js +0 -2155
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/mime-types.js +0 -1002
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/pako/codecs.js +0 -64
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/z-worker.js +0 -153
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/zip-ext.js +0 -267
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/zip-fs.js +0 -553
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/zip.js +0 -991
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/zlib-asm/codecs.js +0 -49
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/index.js +0 -17
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/lib/culling/ObjectCullStates.js +0 -205
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/lib/html/Dot.js +0 -78
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/lib/html/Label.js +0 -97
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/lib/html/Wire.js +0 -95
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/Plugin.js +0 -112
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/Viewer.js +0 -372
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/index.js +0 -3
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/metadata/IFCObjectDefaultColors.js +0 -162
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/metadata/IFCObjectDefaults.js +0 -39
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/metadata/MetaModel.js +0 -145
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/metadata/MetaObject.js +0 -215
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/metadata/MetaScene.js +0 -311
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/CameraControl.js +0 -1669
- 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 +0 -312
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/controllers/PanController.js +0 -112
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/controllers/PickController.js +0 -193
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/controllers/PivotController.js +0 -289
- 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 +0 -122
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/KeyboardPanRotateDollyHandler.js +0 -186
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/MouseMiscHandler.js +0 -68
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/MousePanRotateDollyHandler.js +0 -439
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/MousePickHandler.js +0 -361
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/TouchPanRotateAndDollyHandler.js +0 -258
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/TouchPickHandler.js +0 -197
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/mouspan.js +0 -498
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/Component.js +0 -908
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/Entity.js +0 -475
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/ImagePlane/ImagePlane.js +0 -570
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/ImagePlane/index.js +0 -1
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/PerformanceModel.js +0 -2623
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/index.js +0 -1
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/ENTITY_FLAGS.js +0 -21
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/PerformanceMesh.js +0 -262
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/PerformanceNode.js +0 -697
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/RENDER_PASSES.js +0 -34
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/ScratchMemory.js +0 -63
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/compression.js +0 -183
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesBatching/LinesBatchingBuffer.js +0 -33
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesBatching/LinesBatchingLayer.js +0 -736
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesBatching/LinesBatchingRenderers.js +0 -68
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesBatching/renderers/LinesBatchingColorRenderer.js +0 -295
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesBatching/renderers/LinesBatchingSilhouetteRenderer.js +0 -327
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesInstancing/LinesInstancingLayer.js +0 -698
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesInstancing/LinesInstancingRenderers.js +0 -68
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesInstancing/renderers/LinesInstancingColorRenderer.js +0 -364
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesInstancing/renderers/LinesInstancingSilhouetteRenderer.js +0 -356
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/PointsBatchingBuffer.js +0 -33
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/PointsBatchingLayer.js +0 -776
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/PointsBatchingRenderers.js +0 -113
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/renderers/PointsBatchingColorRenderer.js +0 -340
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/renderers/PointsBatchingOcclusionRenderer.js +0 -312
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/renderers/PointsBatchingPickDepthRenderer.js +0 -343
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/renderers/PointsBatchingPickMeshRenderer.js +0 -331
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/renderers/PointsBatchingShadowRenderer.js +0 -242
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/renderers/PointsBatchingSilhouetteRenderer.js +0 -348
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/PointsInstancingLayer.js +0 -737
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/PointsInstancingRenderers.js +0 -143
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/renderers/PointsInstancingColorRenderer.js +0 -373
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/renderers/PointsInstancingDepthRenderer.js +0 -366
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/renderers/PointsInstancingOcclusionRenderer.js +0 -370
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/renderers/PointsInstancingPickDepthRenderer.js +0 -386
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/renderers/PointsInstancingPickMeshRenderer.js +0 -376
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/renderers/PointsInstancingShadowRenderer.js +0 -293
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/renderers/PointsInstancingSilhouetteRenderer.js +0 -382
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/TrianglesBatchingBuffer.js +0 -37
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/TrianglesBatchingLayer.js +0 -1017
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/TrianglesBatchingRenderers.js +0 -246
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingColorQualityRenderer.js +0 -809
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingColorRenderer.js +0 -504
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingDepthRenderer.js +0 -297
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingEdgesColorRenderer.js +0 -300
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingEdgesRenderer.js +0 -322
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingNormalsRenderer.js +0 -311
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingOcclusionRenderer.js +0 -291
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingPickDepthRenderer.js +0 -319
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingPickMeshRenderer.js +0 -305
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingPickNormalsRenderer.js +0 -300
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingShadowRenderer.js +0 -242
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingSilhouetteRenderer.js +0 -323
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/TrianglesInstancingLayer.js +0 -969
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/TrianglesInstancingRenderers.js +0 -246
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingColorQualityRenderer.js +0 -859
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingColorRenderer.js +0 -557
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingDepthRenderer.js +0 -341
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingEdgesColorRenderer.js +0 -338
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingEdgesRenderer.js +0 -356
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingNormalsRenderer.js +0 -354
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingOcclusionRenderer.js +0 -329
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingPickDepthRenderer.js +0 -358
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingPickMeshRenderer.js +0 -349
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingPickNormalsRenderer.js +0 -363
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingShadowRenderer.js +0 -284
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingSilhouetteRenderer.js +0 -354
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/Camera.js +0 -880
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/CameraFlightAnimation.js +0 -669
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/CameraPath.js +0 -194
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/CameraPathAnimation.js +0 -326
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/CustomProjection.js +0 -149
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/Frustum.js +0 -316
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/Ortho.js +0 -286
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/Perspective.js +0 -302
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/index.js +0 -2
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/canvas/Canvas.js +0 -464
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/canvas/Spinner.js +0 -323
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/core.js +0 -234
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/Geometry.js +0 -33
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/ReadableGeometry.js +0 -689
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/VBOGeometry.js +0 -327
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildBoxGeometry.js +0 -238
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildBoxLinesGeometry.js +0 -106
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildCylinderGeometry.js +0 -271
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildGridGeometry.js +0 -102
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildPlaneGeometry.js +0 -168
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildSphereGeometry.js +0 -161
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildTorusGeometry.js +0 -172
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildVectorTextGeometry.js +0 -1721
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/index.js +0 -8
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/index.js +0 -4
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/loaders/index.js +0 -2
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/loaders/load3DSGeometry.js +0 -103
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/loaders/loadOBJGeometry.js +0 -130
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/index.js +0 -18
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/input/Input.js +0 -1475
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/libs/canvas2image.js +0 -218
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/libs/k3d.js +0 -1032
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/AmbientLight.js +0 -175
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/CubeTexture.js +0 -156
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/DirLight.js +0 -314
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/Light.js +0 -29
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/LightMap.js +0 -77
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/PointLight.js +0 -395
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/ReflectionMap.js +0 -79
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/Shadow.js +0 -138
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/index.js +0 -5
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/marker/Marker.js +0 -382
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/marker/index.js +0 -1
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/EdgeMaterial.js +0 -359
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/EmphasisMaterial.js +0 -577
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/Fresnel.js +0 -222
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/LambertMaterial.js +0 -378
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/LinesMaterial.js +0 -169
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/Material.js +0 -39
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/MetallicMaterial.js +0 -820
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/PhongMaterial.js +0 -860
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/PointsMaterial.js +0 -320
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/SpecularMaterial.js +0 -807
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/Texture.js +0 -522
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/index.js +0 -8
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/math/Frustum.js +0 -118
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/math/buildEdgeIndices.js +0 -162
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/math/geometryCompressionUtils.js +0 -353
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/math/index.js +0 -1
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/math/math.js +0 -5302
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/math/rtcCoords.js +0 -132
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mementos/CameraMemento.js +0 -200
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mementos/ModelMemento.js +0 -272
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mementos/ObjectsMemento.js +0 -259
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mementos/index.js +0 -3
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/Mesh.js +0 -2165
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/draw/DrawRenderer.js +0 -978
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/draw/DrawShaderSource.js +0 -1566
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/emphasis/EmphasisEdgesRenderer.js +0 -249
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/emphasis/EmphasisEdgesShaderSource.js +0 -163
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/emphasis/EmphasisFillRenderer.js +0 -276
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/emphasis/EmphasisFillShaderSource.js +0 -269
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/index.js +0 -1
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/occlusion/OcclusionRenderer.js +0 -207
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/occlusion/OcclusionShaderSource.js +0 -156
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/pick/PickMeshRenderer.js +0 -210
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/pick/PickMeshShaderSource.js +0 -146
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/pick/PickTriangleRenderer.js +0 -186
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/pick/PickTriangleShaderSource.js +0 -120
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/shadow/ShadowRenderer.js +0 -214
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/shadow/ShadowShaderSource.js +0 -96
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/metriqs/Metriqs.js +0 -259
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/nodes/Node.js +0 -1356
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/nodes/index.js +0 -1
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/paths/CubicBezierCurve.js +0 -194
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/paths/Curve.js +0 -183
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/paths/Path.js +0 -239
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/paths/QuadraticBezierCurve.js +0 -161
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/paths/SplineCurve.js +0 -133
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/paths/index.js +0 -5
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/postfx/SAO.js +0 -547
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/scene/Scene.js +0 -2481
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/sectionPlane/SectionPlane.js +0 -194
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/sectionPlane/index.js +0 -1
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/skybox/Skybox.js +0 -119
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/skybox/index.js +0 -1
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/stats.js +0 -45
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/utils/Map.js +0 -45
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/utils/Queue.js +0 -56
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/utils/index.js +0 -2
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/utils.js +0 -452
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/viewport/Viewport.js +0 -212
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/ArrayBuf.js +0 -121
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Attribute.js +0 -23
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Drawable.js +0 -270
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/FrameContext.js +0 -259
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/PickResult.js +0 -317
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Pickable.js +0 -69
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Program.js +0 -179
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/RenderBuffer.js +0 -315
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/RenderFlags.js +0 -203
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/RenderState.js +0 -40
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Renderer.js +0 -1300
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Sampler.js +0 -18
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Shader.js +0 -49
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Texture2D.js +0 -217
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/occlusion/OcclusionLayer.js +0 -214
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/occlusion/OcclusionTester.js +0 -432
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/sao/SAODepthLimitedBlurRenderer.js +0 -326
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/sao/SAOOcclusionRenderer.js +0 -375
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/webglEnums.js +0 -61
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webglInfo.js +0 -48
- package/src/lib/gltf/gltf.css +0 -392
- package/src/lib/gltf/gltf.js +0 -2241
- package/webpack.config.js +0 -70
@@ -1,1328 +0,0 @@
|
|
1
|
-
import {math} from "../../viewer/scene/math/math.js";
|
2
|
-
|
3
|
-
import {buildCylinderGeometry} from "../../viewer/scene/geometry/builders/buildCylinderGeometry.js";
|
4
|
-
import {buildTorusGeometry} from "../../viewer/scene/geometry/builders/buildTorusGeometry.js";
|
5
|
-
|
6
|
-
import {ReadableGeometry} from "../../viewer/scene/geometry/ReadableGeometry.js";
|
7
|
-
import {PhongMaterial} from "../../viewer/scene/materials/PhongMaterial.js";
|
8
|
-
import {EmphasisMaterial} from "../../viewer/scene/materials/EmphasisMaterial.js";
|
9
|
-
import {Node} from "../../viewer/scene/nodes/Node.js";
|
10
|
-
import {Mesh} from "../../viewer/scene/mesh/Mesh.js";
|
11
|
-
import {buildSphereGeometry} from "../../viewer/scene/geometry/builders/buildSphereGeometry.js";
|
12
|
-
import {worldToRTCPos} from "../../viewer/scene/math/rtcCoords.js";
|
13
|
-
|
14
|
-
const zeroVec = new Float64Array([0, 0, 1]);
|
15
|
-
const quat = new Float64Array(4);
|
16
|
-
|
17
|
-
/**
|
18
|
-
* Controls a {@link SectionPlane} with mouse and touch input.
|
19
|
-
*
|
20
|
-
* @private
|
21
|
-
*/
|
22
|
-
class Control {
|
23
|
-
|
24
|
-
/** @private */
|
25
|
-
constructor(plugin) {
|
26
|
-
|
27
|
-
/**
|
28
|
-
* ID of this Control.
|
29
|
-
*
|
30
|
-
* SectionPlaneControls are mapped by this ID in {@link SectionPlanesPlugin#sectionPlaneControls}.
|
31
|
-
*
|
32
|
-
* @property id
|
33
|
-
* @type {String|Number}
|
34
|
-
*/
|
35
|
-
this.id = null;
|
36
|
-
|
37
|
-
this._viewer = plugin.viewer;
|
38
|
-
|
39
|
-
this._visible = false;
|
40
|
-
this._pos = math.vec3(); // Full-precision position of the center of the Control
|
41
|
-
this._rtcCenter = math.vec3();
|
42
|
-
this._rtcPos = math.vec3();
|
43
|
-
|
44
|
-
this._baseDir = math.vec3(); // Saves direction of clip plane when we start dragging an arrow or ring.
|
45
|
-
this._rootNode = null; // Root of Node graph that represents this control in the 3D scene
|
46
|
-
this._displayMeshes = null; // Meshes that are always visible
|
47
|
-
this._affordanceMeshes = null; // Meshes displayed momentarily for affordance
|
48
|
-
|
49
|
-
this._ignoreNextSectionPlaneDirUpdate = false;
|
50
|
-
|
51
|
-
this._createNodes();
|
52
|
-
this._bindEvents();
|
53
|
-
}
|
54
|
-
|
55
|
-
/**
|
56
|
-
* Called by SectionPlanesPlugin to assign this Control to a SectionPlane.
|
57
|
-
* SectionPlanesPlugin keeps SectionPlaneControls in a reuse pool.
|
58
|
-
* Call with a null or undefined value to disconnect the Control ffrom whatever SectionPlane it was assigned to.
|
59
|
-
* @private
|
60
|
-
*/
|
61
|
-
_setSectionPlane(sectionPlane) {
|
62
|
-
if (this._sectionPlane) {
|
63
|
-
this._sectionPlane.off(this._onSectionPlanePos);
|
64
|
-
this._sectionPlane.off(this._onSectionPlaneDir);
|
65
|
-
this._onSectionPlanePos = null;
|
66
|
-
this._onSectionPlaneDir = null;
|
67
|
-
this._sectionPlane = null;
|
68
|
-
}
|
69
|
-
if (sectionPlane) {
|
70
|
-
this.id = sectionPlane.id;
|
71
|
-
this._setPos(sectionPlane.pos);
|
72
|
-
this._setDir(sectionPlane.dir);
|
73
|
-
this._sectionPlane = sectionPlane;
|
74
|
-
this._onSectionPlanePos = sectionPlane.on("pos", () => {
|
75
|
-
this._setPos(this._sectionPlane.pos);
|
76
|
-
});
|
77
|
-
this._onSectionPlaneDir = sectionPlane.on("dir", () => {
|
78
|
-
if (!this._ignoreNextSectionPlaneDirUpdate) {
|
79
|
-
this._setDir(this._sectionPlane.dir);
|
80
|
-
} else {
|
81
|
-
this._ignoreNextSectionPlaneDirUpdate = false;
|
82
|
-
}
|
83
|
-
});
|
84
|
-
}
|
85
|
-
}
|
86
|
-
|
87
|
-
/**
|
88
|
-
* Gets the {@link SectionPlane} controlled by this Control.
|
89
|
-
* @returns {SectionPlane} The SectionPlane.
|
90
|
-
*/
|
91
|
-
get sectionPlane() {
|
92
|
-
return this._sectionPlane;
|
93
|
-
}
|
94
|
-
|
95
|
-
/** @private */
|
96
|
-
_setPos(xyz) {
|
97
|
-
|
98
|
-
this._pos.set(xyz);
|
99
|
-
|
100
|
-
worldToRTCPos(this._pos, this._rtcCenter, this._rtcPos);
|
101
|
-
|
102
|
-
this._rootNode.rtcCenter = this._rtcCenter;
|
103
|
-
this._rootNode.position = this._rtcPos;
|
104
|
-
}
|
105
|
-
|
106
|
-
/** @private */
|
107
|
-
_setDir(xyz) {
|
108
|
-
this._baseDir.set(xyz);
|
109
|
-
this._rootNode.quaternion = math.vec3PairToQuaternion(zeroVec, xyz, quat);
|
110
|
-
}
|
111
|
-
|
112
|
-
_setSectionPlaneDir(dir) {
|
113
|
-
if (this._sectionPlane) {
|
114
|
-
this._ignoreNextSectionPlaneDirUpdate = true;
|
115
|
-
this._sectionPlane.dir = dir;
|
116
|
-
}
|
117
|
-
}
|
118
|
-
|
119
|
-
/**
|
120
|
-
* Sets if this Control is visible.
|
121
|
-
*
|
122
|
-
* @type {Boolean}
|
123
|
-
*/
|
124
|
-
setVisible(visible = true) {
|
125
|
-
if (this._visible === visible) {
|
126
|
-
return;
|
127
|
-
}
|
128
|
-
this._visible = visible;
|
129
|
-
var id;
|
130
|
-
for (id in this._displayMeshes) {
|
131
|
-
if (this._displayMeshes.hasOwnProperty(id)) {
|
132
|
-
this._displayMeshes[id].visible = visible;
|
133
|
-
}
|
134
|
-
}
|
135
|
-
if (!visible) {
|
136
|
-
for (id in this._affordanceMeshes) {
|
137
|
-
if (this._affordanceMeshes.hasOwnProperty(id)) {
|
138
|
-
this._affordanceMeshes[id].visible = visible;
|
139
|
-
}
|
140
|
-
}
|
141
|
-
}
|
142
|
-
}
|
143
|
-
|
144
|
-
/**
|
145
|
-
* Gets if this Control is visible.
|
146
|
-
*
|
147
|
-
* @type {Boolean}
|
148
|
-
*/
|
149
|
-
getVisible() {
|
150
|
-
return this._visible;
|
151
|
-
}
|
152
|
-
|
153
|
-
/**
|
154
|
-
* Sets if this Control is culled. This is called by SectionPlanesPlugin to
|
155
|
-
* temporarily hide the Control while a snapshot is being taken by Viewer#getSnapshot().
|
156
|
-
* @param culled
|
157
|
-
*/
|
158
|
-
setCulled(culled) {
|
159
|
-
var id;
|
160
|
-
for (id in this._displayMeshes) {
|
161
|
-
if (this._displayMeshes.hasOwnProperty(id)) {
|
162
|
-
this._displayMeshes[id].culled = culled;
|
163
|
-
}
|
164
|
-
}
|
165
|
-
if (!culled) {
|
166
|
-
for (id in this._affordanceMeshes) {
|
167
|
-
if (this._affordanceMeshes.hasOwnProperty(id)) {
|
168
|
-
this._affordanceMeshes[id].culled = culled;
|
169
|
-
}
|
170
|
-
}
|
171
|
-
}
|
172
|
-
}
|
173
|
-
|
174
|
-
/**
|
175
|
-
* Builds the Entities that represent this Control.
|
176
|
-
* @private
|
177
|
-
*/
|
178
|
-
_createNodes() {
|
179
|
-
|
180
|
-
const NO_STATE_INHERIT = false;
|
181
|
-
const scene = this._viewer.scene;
|
182
|
-
const radius = 1.0;
|
183
|
-
const handleTubeRadius = 0.06;
|
184
|
-
const hoopRadius = radius - 0.2;
|
185
|
-
const tubeRadius = 0.01;
|
186
|
-
const arrowRadius = 0.07;
|
187
|
-
|
188
|
-
this._rootNode = new Node(scene, {
|
189
|
-
position: [0, 0, 0],
|
190
|
-
scale: [5, 5, 5]
|
191
|
-
});
|
192
|
-
|
193
|
-
const rootNode = this._rootNode;
|
194
|
-
|
195
|
-
const shapes = {// Reusable geometries
|
196
|
-
|
197
|
-
arrowHead: new ReadableGeometry(rootNode, buildCylinderGeometry({
|
198
|
-
radiusTop: 0.001,
|
199
|
-
radiusBottom: arrowRadius,
|
200
|
-
radialSegments: 32,
|
201
|
-
heightSegments: 1,
|
202
|
-
height: 0.2,
|
203
|
-
openEnded: false
|
204
|
-
})),
|
205
|
-
|
206
|
-
arrowHeadBig: new ReadableGeometry(rootNode, buildCylinderGeometry({
|
207
|
-
radiusTop: 0.001,
|
208
|
-
radiusBottom: 0.09,
|
209
|
-
radialSegments: 32,
|
210
|
-
heightSegments: 1,
|
211
|
-
height: 0.25,
|
212
|
-
openEnded: false
|
213
|
-
})),
|
214
|
-
|
215
|
-
arrowHeadHandle: new ReadableGeometry(rootNode, buildCylinderGeometry({
|
216
|
-
radiusTop: 0.09,
|
217
|
-
radiusBottom: 0.09,
|
218
|
-
radialSegments: 8,
|
219
|
-
heightSegments: 1,
|
220
|
-
height: 0.37,
|
221
|
-
openEnded: false
|
222
|
-
})),
|
223
|
-
|
224
|
-
curve: new ReadableGeometry(rootNode, buildTorusGeometry({
|
225
|
-
radius: hoopRadius,
|
226
|
-
tube: tubeRadius,
|
227
|
-
radialSegments: 64,
|
228
|
-
tubeSegments: 14,
|
229
|
-
arc: (Math.PI * 2.0) / 4.0
|
230
|
-
})),
|
231
|
-
|
232
|
-
curveHandle: new ReadableGeometry(rootNode, buildTorusGeometry({
|
233
|
-
radius: hoopRadius,
|
234
|
-
tube: handleTubeRadius,
|
235
|
-
radialSegments: 64,
|
236
|
-
tubeSegments: 14,
|
237
|
-
arc: (Math.PI * 2.0) / 4.0
|
238
|
-
})),
|
239
|
-
|
240
|
-
hoop: new ReadableGeometry(rootNode, buildTorusGeometry({
|
241
|
-
radius: hoopRadius,
|
242
|
-
tube: tubeRadius,
|
243
|
-
radialSegments: 64,
|
244
|
-
tubeSegments: 8,
|
245
|
-
arc: (Math.PI * 2.0)
|
246
|
-
})),
|
247
|
-
|
248
|
-
axis: new ReadableGeometry(rootNode, buildCylinderGeometry({
|
249
|
-
radiusTop: tubeRadius,
|
250
|
-
radiusBottom: tubeRadius,
|
251
|
-
radialSegments: 20,
|
252
|
-
heightSegments: 1,
|
253
|
-
height: radius,
|
254
|
-
openEnded: false
|
255
|
-
})),
|
256
|
-
|
257
|
-
axisHandle: new ReadableGeometry(rootNode, buildCylinderGeometry({
|
258
|
-
radiusTop: 0.08,
|
259
|
-
radiusBottom: 0.08,
|
260
|
-
radialSegments: 20,
|
261
|
-
heightSegments: 1,
|
262
|
-
height: radius,
|
263
|
-
openEnded: false
|
264
|
-
}))
|
265
|
-
};
|
266
|
-
|
267
|
-
const materials = { // Reusable materials
|
268
|
-
|
269
|
-
pickable: new PhongMaterial(rootNode, { // Invisible material for pickable handles, which define a pickable 3D area
|
270
|
-
diffuse: [1, 1, 0],
|
271
|
-
alpha: 0, // Invisible
|
272
|
-
alphaMode: "blend"
|
273
|
-
}),
|
274
|
-
|
275
|
-
red: new PhongMaterial(rootNode, {
|
276
|
-
diffuse: [1, 0.0, 0.0],
|
277
|
-
emissive: [1, 0.0, 0.0],
|
278
|
-
ambient: [0.0, 0.0, 0.0],
|
279
|
-
specular: [.6, .6, .3],
|
280
|
-
shininess: 80,
|
281
|
-
lineWidth: 2
|
282
|
-
}),
|
283
|
-
|
284
|
-
highlightRed: new EmphasisMaterial(rootNode, { // Emphasis for red rotation affordance hoop
|
285
|
-
edges: false,
|
286
|
-
fill: true,
|
287
|
-
fillColor: [1, 0, 0],
|
288
|
-
fillAlpha: 0.6
|
289
|
-
}),
|
290
|
-
|
291
|
-
green: new PhongMaterial(rootNode, {
|
292
|
-
diffuse: [0.0, 1, 0.0],
|
293
|
-
emissive: [0.0, 1, 0.0],
|
294
|
-
ambient: [0.0, 0.0, 0.0],
|
295
|
-
specular: [.6, .6, .3],
|
296
|
-
shininess: 80,
|
297
|
-
lineWidth: 2
|
298
|
-
}),
|
299
|
-
|
300
|
-
highlightGreen: new EmphasisMaterial(rootNode, { // Emphasis for green rotation affordance hoop
|
301
|
-
edges: false,
|
302
|
-
fill: true,
|
303
|
-
fillColor: [0, 1, 0],
|
304
|
-
fillAlpha: 0.6
|
305
|
-
}),
|
306
|
-
|
307
|
-
blue: new PhongMaterial(rootNode, {
|
308
|
-
diffuse: [0.0, 0.0, 1],
|
309
|
-
emissive: [0.0, 0.0, 1],
|
310
|
-
ambient: [0.0, 0.0, 0.0],
|
311
|
-
specular: [.6, .6, .3],
|
312
|
-
shininess: 80,
|
313
|
-
lineWidth: 2
|
314
|
-
}),
|
315
|
-
|
316
|
-
highlightBlue: new EmphasisMaterial(rootNode, { // Emphasis for blue rotation affordance hoop
|
317
|
-
edges: false,
|
318
|
-
fill: true,
|
319
|
-
fillColor: [0, 0, 1],
|
320
|
-
fillAlpha: 0.2
|
321
|
-
}),
|
322
|
-
|
323
|
-
center: new PhongMaterial(rootNode, {
|
324
|
-
diffuse: [0.0, 0.0, 0.0],
|
325
|
-
emissive: [0, 0, 0],
|
326
|
-
ambient: [0.0, 0.0, 0.0],
|
327
|
-
specular: [.6, .6, .3],
|
328
|
-
shininess: 80
|
329
|
-
}),
|
330
|
-
|
331
|
-
highlightBall: new EmphasisMaterial(rootNode, {
|
332
|
-
edges: false,
|
333
|
-
fill: true,
|
334
|
-
fillColor: [0.5, 0.5, 0.5],
|
335
|
-
fillAlpha: 0.5,
|
336
|
-
vertices: false
|
337
|
-
}),
|
338
|
-
|
339
|
-
highlightPlane: new EmphasisMaterial(rootNode, {
|
340
|
-
edges: true,
|
341
|
-
edgeWidth: 3,
|
342
|
-
fill: false,
|
343
|
-
fillColor: [0.5, 0.5, .5],
|
344
|
-
fillAlpha: 0.5,
|
345
|
-
vertices: false
|
346
|
-
})
|
347
|
-
};
|
348
|
-
|
349
|
-
this._displayMeshes = {
|
350
|
-
|
351
|
-
plane: rootNode.addChild(new Mesh(rootNode, {
|
352
|
-
geometry: new ReadableGeometry(rootNode, {
|
353
|
-
primitive: "triangles",
|
354
|
-
positions: [
|
355
|
-
0.5, 0.5, 0.0, 0.5, -0.5, 0.0, // 0
|
356
|
-
-0.5, -0.5, 0.0, -0.5, 0.5, 0.0, // 1
|
357
|
-
0.5, 0.5, -0.0, 0.5, -0.5, -0.0, // 2
|
358
|
-
-0.5, -0.5, -0.0, -0.5, 0.5, -0.0 // 3
|
359
|
-
],
|
360
|
-
indices: [0, 1, 2, 2, 3, 0]
|
361
|
-
}),
|
362
|
-
material: new PhongMaterial(rootNode, {
|
363
|
-
emissive: [0, 0.0, 0],
|
364
|
-
diffuse: [0, 0, 0],
|
365
|
-
backfaces: true
|
366
|
-
}),
|
367
|
-
opacity: 0.6,
|
368
|
-
ghosted: true,
|
369
|
-
ghostMaterial: new EmphasisMaterial(rootNode, {
|
370
|
-
edges: false,
|
371
|
-
filled: true,
|
372
|
-
fillColor: [1, 1, 0],
|
373
|
-
edgeColor: [0, 0, 0],
|
374
|
-
fillAlpha: 0.1,
|
375
|
-
backfaces: true
|
376
|
-
}),
|
377
|
-
pickable: false,
|
378
|
-
collidable: true,
|
379
|
-
clippable: false,
|
380
|
-
visible: false,
|
381
|
-
scale: [2.4, 2.4, 1]
|
382
|
-
}), NO_STATE_INHERIT),
|
383
|
-
|
384
|
-
planeFrame: rootNode.addChild(new Mesh(rootNode, { // Visible frame
|
385
|
-
geometry: new ReadableGeometry(rootNode, buildTorusGeometry({
|
386
|
-
center: [0, 0, 0],
|
387
|
-
radius: 1.7,
|
388
|
-
tube: tubeRadius * 2,
|
389
|
-
radialSegments: 4,
|
390
|
-
tubeSegments: 4,
|
391
|
-
arc: Math.PI * 2.0
|
392
|
-
})),
|
393
|
-
material: new PhongMaterial(rootNode, {
|
394
|
-
emissive: [0, 0, 0],
|
395
|
-
diffuse: [0, 0, 0],
|
396
|
-
specular: [0, 0, 0],
|
397
|
-
shininess: 0
|
398
|
-
}),
|
399
|
-
//highlighted: true,
|
400
|
-
highlightMaterial: new EmphasisMaterial(rootNode, {
|
401
|
-
edges: false,
|
402
|
-
edgeColor: [0.0, 0.0, 0.0],
|
403
|
-
filled: true,
|
404
|
-
fillColor: [0.8, 0.8, 0.8],
|
405
|
-
fillAlpha: 1.0
|
406
|
-
}),
|
407
|
-
pickable: false,
|
408
|
-
collidable: false,
|
409
|
-
clippable: false,
|
410
|
-
visible: false,
|
411
|
-
scale: [1, 1, .1],
|
412
|
-
rotation: [0, 0, 45]
|
413
|
-
}), NO_STATE_INHERIT),
|
414
|
-
|
415
|
-
//----------------------------------------------------------------------------------------------------------
|
416
|
-
//
|
417
|
-
//----------------------------------------------------------------------------------------------------------
|
418
|
-
|
419
|
-
xCurve: rootNode.addChild(new Mesh(rootNode, { // Red hoop about Y-axis
|
420
|
-
geometry: shapes.curve,
|
421
|
-
material: materials.red,
|
422
|
-
matrix: (function () {
|
423
|
-
const rotate2 = math.rotationMat4v(90 * math.DEGTORAD, [0, 1, 0], math.identityMat4());
|
424
|
-
const rotate1 = math.rotationMat4v(270 * math.DEGTORAD, [1, 0, 0], math.identityMat4());
|
425
|
-
return math.mulMat4(rotate1, rotate2, math.identityMat4());
|
426
|
-
})(),
|
427
|
-
pickable: false,
|
428
|
-
collidable: true,
|
429
|
-
clippable: false,
|
430
|
-
backfaces: true,
|
431
|
-
visible: false
|
432
|
-
}), NO_STATE_INHERIT),
|
433
|
-
|
434
|
-
xCurveHandle: rootNode.addChild(new Mesh(rootNode, { // Red hoop about Y-axis
|
435
|
-
geometry: shapes.curveHandle,
|
436
|
-
material: materials.pickable,
|
437
|
-
matrix: (function () {
|
438
|
-
const rotate2 = math.rotationMat4v(90 * math.DEGTORAD, [0, 1, 0], math.identityMat4());
|
439
|
-
const rotate1 = math.rotationMat4v(270 * math.DEGTORAD, [1, 0, 0], math.identityMat4());
|
440
|
-
return math.mulMat4(rotate1, rotate2, math.identityMat4());
|
441
|
-
})(),
|
442
|
-
pickable: true,
|
443
|
-
collidable: true,
|
444
|
-
clippable: false,
|
445
|
-
backfaces: true,
|
446
|
-
visible: false
|
447
|
-
}), NO_STATE_INHERIT),
|
448
|
-
|
449
|
-
xCurveArrow1: rootNode.addChild(new Mesh(rootNode, {
|
450
|
-
geometry: shapes.arrowHead,
|
451
|
-
material: materials.red,
|
452
|
-
matrix: (function () {
|
453
|
-
const translate = math.translateMat4c(0., -0.07, -0.8, math.identityMat4());
|
454
|
-
const scale = math.scaleMat4v([0.6, 0.6, 0.6], math.identityMat4());
|
455
|
-
const rotate = math.rotationMat4v(0 * math.DEGTORAD, [0, 0, 1], math.identityMat4());
|
456
|
-
return math.mulMat4(math.mulMat4(translate, scale, math.identityMat4()), rotate, math.identityMat4());
|
457
|
-
})(),
|
458
|
-
pickable: true,
|
459
|
-
collidable: true,
|
460
|
-
clippable: false,
|
461
|
-
visible: false
|
462
|
-
}), NO_STATE_INHERIT),
|
463
|
-
|
464
|
-
xCurveArrow2: rootNode.addChild(new Mesh(rootNode, {
|
465
|
-
geometry: shapes.arrowHead,
|
466
|
-
material: materials.red,
|
467
|
-
matrix: (function () {
|
468
|
-
const translate = math.translateMat4c(0.0, -0.8, -0.07, math.identityMat4());
|
469
|
-
const scale = math.scaleMat4v([0.6, 0.6, 0.6], math.identityMat4());
|
470
|
-
const rotate = math.rotationMat4v(90 * math.DEGTORAD, [1, 0, 0], math.identityMat4());
|
471
|
-
return math.mulMat4(math.mulMat4(translate, scale, math.identityMat4()), rotate, math.identityMat4());
|
472
|
-
})(),
|
473
|
-
pickable: true,
|
474
|
-
collidable: true,
|
475
|
-
clippable: false,
|
476
|
-
visible: false
|
477
|
-
}), NO_STATE_INHERIT),
|
478
|
-
|
479
|
-
//----------------------------------------------------------------------------------------------------------
|
480
|
-
//
|
481
|
-
//----------------------------------------------------------------------------------------------------------
|
482
|
-
|
483
|
-
yCurve: rootNode.addChild(new Mesh(rootNode, {
|
484
|
-
geometry: shapes.curve,
|
485
|
-
material: materials.green,
|
486
|
-
rotation: [-90, 0, 0],
|
487
|
-
pickable: false,
|
488
|
-
collidable: true,
|
489
|
-
clippable: false,
|
490
|
-
backfaces: true,
|
491
|
-
visible: false
|
492
|
-
}), NO_STATE_INHERIT),
|
493
|
-
|
494
|
-
yCurveHandle: rootNode.addChild(new Mesh(rootNode, {
|
495
|
-
geometry: shapes.curveHandle,
|
496
|
-
material: materials.pickable,
|
497
|
-
rotation: [-90, 0, 0],
|
498
|
-
pickable: true,
|
499
|
-
collidable: true,
|
500
|
-
clippable: false,
|
501
|
-
backfaces: true,
|
502
|
-
visible: false
|
503
|
-
}), NO_STATE_INHERIT),
|
504
|
-
|
505
|
-
yCurveArrow1: rootNode.addChild(new Mesh(rootNode, {
|
506
|
-
geometry: shapes.arrowHead,
|
507
|
-
material: materials.green,
|
508
|
-
matrix: (function () {
|
509
|
-
const translate = math.translateMat4c(0.07, 0, -0.8, math.identityMat4());
|
510
|
-
const scale = math.scaleMat4v([0.6, 0.6, 0.6], math.identityMat4());
|
511
|
-
const rotate = math.rotationMat4v(90 * math.DEGTORAD, [0, 0, 1], math.identityMat4());
|
512
|
-
return math.mulMat4(math.mulMat4(translate, scale, math.identityMat4()), rotate, math.identityMat4());
|
513
|
-
})(),
|
514
|
-
pickable: true,
|
515
|
-
collidable: true,
|
516
|
-
clippable: false,
|
517
|
-
visible: false
|
518
|
-
}), NO_STATE_INHERIT),
|
519
|
-
|
520
|
-
yCurveArrow2: rootNode.addChild(new Mesh(rootNode, {
|
521
|
-
geometry: shapes.arrowHead,
|
522
|
-
material: materials.green,
|
523
|
-
matrix: (function () {
|
524
|
-
const translate = math.translateMat4c(0.8, 0.0, -0.07, math.identityMat4());
|
525
|
-
const scale = math.scaleMat4v([0.6, 0.6, 0.6], math.identityMat4());
|
526
|
-
const rotate = math.rotationMat4v(90 * math.DEGTORAD, [1, 0, 0], math.identityMat4());
|
527
|
-
return math.mulMat4(math.mulMat4(translate, scale, math.identityMat4()), rotate, math.identityMat4());
|
528
|
-
})(),
|
529
|
-
pickable: true,
|
530
|
-
collidable: true,
|
531
|
-
clippable: false,
|
532
|
-
visible: false
|
533
|
-
}), NO_STATE_INHERIT),
|
534
|
-
|
535
|
-
//----------------------------------------------------------------------------------------------------------
|
536
|
-
//
|
537
|
-
//----------------------------------------------------------------------------------------------------------
|
538
|
-
|
539
|
-
zCurve: rootNode.addChild(new Mesh(rootNode, { // Blue hoop about Z-axis
|
540
|
-
geometry: shapes.curve,
|
541
|
-
material: materials.blue,
|
542
|
-
matrix: math.rotationMat4v(180 * math.DEGTORAD, [1, 0, 0], math.identityMat4()),
|
543
|
-
pickable: false,
|
544
|
-
collidable: true,
|
545
|
-
clippable: false,
|
546
|
-
visible: false
|
547
|
-
}), NO_STATE_INHERIT),
|
548
|
-
|
549
|
-
zCurveHandle: rootNode.addChild(new Mesh(rootNode, {
|
550
|
-
geometry: shapes.curveHandle,
|
551
|
-
material: materials.pickable,
|
552
|
-
matrix: math.rotationMat4v(180 * math.DEGTORAD, [1, 0, 0], math.identityMat4()),
|
553
|
-
pickable: true,
|
554
|
-
collidable: true,
|
555
|
-
clippable: false,
|
556
|
-
visible: false
|
557
|
-
}), NO_STATE_INHERIT),
|
558
|
-
|
559
|
-
zCurveCurveArrow1: rootNode.addChild(new Mesh(rootNode, {
|
560
|
-
geometry: shapes.arrowHead,
|
561
|
-
material: materials.blue,
|
562
|
-
matrix: (function () {
|
563
|
-
const translate = math.translateMat4c(.8, -0.07, 0, math.identityMat4());
|
564
|
-
const scale = math.scaleMat4v([0.6, 0.6, 0.6], math.identityMat4());
|
565
|
-
return math.mulMat4(translate, scale, math.identityMat4());
|
566
|
-
})(),
|
567
|
-
pickable: true,
|
568
|
-
collidable: true,
|
569
|
-
clippable: false,
|
570
|
-
visible: false
|
571
|
-
}), NO_STATE_INHERIT),
|
572
|
-
|
573
|
-
zCurveArrow2: rootNode.addChild(new Mesh(rootNode, {
|
574
|
-
geometry: shapes.arrowHead,
|
575
|
-
material: materials.blue,
|
576
|
-
matrix: (function () {
|
577
|
-
const translate = math.translateMat4c(.05, -0.8, 0, math.identityMat4());
|
578
|
-
const scale = math.scaleMat4v([0.6, 0.6, 0.6], math.identityMat4());
|
579
|
-
const rotate = math.rotationMat4v(90 * math.DEGTORAD, [0, 0, 1], math.identityMat4());
|
580
|
-
return math.mulMat4(math.mulMat4(translate, scale, math.identityMat4()), rotate, math.identityMat4());
|
581
|
-
})(),
|
582
|
-
pickable: true,
|
583
|
-
collidable: true,
|
584
|
-
clippable: false,
|
585
|
-
visible: false
|
586
|
-
}), NO_STATE_INHERIT),
|
587
|
-
|
588
|
-
//----------------------------------------------------------------------------------------------------------
|
589
|
-
//
|
590
|
-
//----------------------------------------------------------------------------------------------------------
|
591
|
-
|
592
|
-
center: rootNode.addChild(new Mesh(rootNode, {
|
593
|
-
geometry: new ReadableGeometry(rootNode, buildSphereGeometry({
|
594
|
-
radius: 0.05
|
595
|
-
})),
|
596
|
-
material: materials.center,
|
597
|
-
pickable: false,
|
598
|
-
collidable: true,
|
599
|
-
clippable: false,
|
600
|
-
visible: false
|
601
|
-
}), NO_STATE_INHERIT),
|
602
|
-
|
603
|
-
//----------------------------------------------------------------------------------------------------------
|
604
|
-
//
|
605
|
-
//----------------------------------------------------------------------------------------------------------
|
606
|
-
|
607
|
-
xAxisArrow: rootNode.addChild(new Mesh(rootNode, {
|
608
|
-
geometry: shapes.arrowHead,
|
609
|
-
material: materials.red,
|
610
|
-
matrix: (function () {
|
611
|
-
const translate = math.translateMat4c(0, radius + .1, 0, math.identityMat4());
|
612
|
-
const rotate = math.rotationMat4v(-90 * math.DEGTORAD, [0, 0, 1], math.identityMat4());
|
613
|
-
return math.mulMat4(rotate, translate, math.identityMat4());
|
614
|
-
})(),
|
615
|
-
pickable: false,
|
616
|
-
collidable: true,
|
617
|
-
clippable: false,
|
618
|
-
visible: false
|
619
|
-
}), NO_STATE_INHERIT),
|
620
|
-
|
621
|
-
xAxisArrowHandle: rootNode.addChild(new Mesh(rootNode, {
|
622
|
-
geometry: shapes.arrowHeadHandle,
|
623
|
-
material: materials.pickable,
|
624
|
-
matrix: (function () {
|
625
|
-
const translate = math.translateMat4c(0, radius + .1, 0, math.identityMat4());
|
626
|
-
const rotate = math.rotationMat4v(-90 * math.DEGTORAD, [0, 0, 1], math.identityMat4());
|
627
|
-
return math.mulMat4(rotate, translate, math.identityMat4());
|
628
|
-
})(),
|
629
|
-
pickable: true,
|
630
|
-
collidable: true,
|
631
|
-
clippable: false,
|
632
|
-
visible: false
|
633
|
-
}), NO_STATE_INHERIT),
|
634
|
-
|
635
|
-
xAxis: rootNode.addChild(new Mesh(rootNode, {
|
636
|
-
geometry: shapes.axis,
|
637
|
-
material: materials.red,
|
638
|
-
matrix: (function () {
|
639
|
-
const translate = math.translateMat4c(0, radius / 2, 0, math.identityMat4());
|
640
|
-
const rotate = math.rotationMat4v(-90 * math.DEGTORAD, [0, 0, 1], math.identityMat4());
|
641
|
-
return math.mulMat4(rotate, translate, math.identityMat4());
|
642
|
-
})(),
|
643
|
-
pickable: false,
|
644
|
-
collidable: true,
|
645
|
-
clippable: false,
|
646
|
-
visible: false
|
647
|
-
}), NO_STATE_INHERIT),
|
648
|
-
|
649
|
-
xAxisHandle: rootNode.addChild(new Mesh(rootNode, {
|
650
|
-
geometry: shapes.axisHandle,
|
651
|
-
material: materials.pickable,
|
652
|
-
matrix: (function () {
|
653
|
-
const translate = math.translateMat4c(0, radius / 2, 0, math.identityMat4());
|
654
|
-
const rotate = math.rotationMat4v(-90 * math.DEGTORAD, [0, 0, 1], math.identityMat4());
|
655
|
-
return math.mulMat4(rotate, translate, math.identityMat4());
|
656
|
-
})(),
|
657
|
-
pickable: true,
|
658
|
-
collidable: true,
|
659
|
-
clippable: false,
|
660
|
-
visible: false
|
661
|
-
}), NO_STATE_INHERIT),
|
662
|
-
|
663
|
-
//----------------------------------------------------------------------------------------------------------
|
664
|
-
//
|
665
|
-
//----------------------------------------------------------------------------------------------------------
|
666
|
-
|
667
|
-
yAxisArrow: rootNode.addChild(new Mesh(rootNode, {
|
668
|
-
geometry: shapes.arrowHead,
|
669
|
-
material: materials.green,
|
670
|
-
matrix: (function () {
|
671
|
-
const translate = math.translateMat4c(0, radius + .1, 0, math.identityMat4());
|
672
|
-
const rotate = math.rotationMat4v(180 * math.DEGTORAD, [1, 0, 0], math.identityMat4());
|
673
|
-
return math.mulMat4(rotate, translate, math.identityMat4());
|
674
|
-
})(),
|
675
|
-
pickable: false,
|
676
|
-
collidable: true,
|
677
|
-
clippable: false,
|
678
|
-
visible: false
|
679
|
-
}), NO_STATE_INHERIT),
|
680
|
-
|
681
|
-
yAxisArrowHandle: rootNode.addChild(new Mesh(rootNode, {
|
682
|
-
geometry: shapes.arrowHeadHandle,
|
683
|
-
material: materials.pickable,
|
684
|
-
matrix: (function () {
|
685
|
-
const translate = math.translateMat4c(0, radius + .1, 0, math.identityMat4());
|
686
|
-
const rotate = math.rotationMat4v(180 * math.DEGTORAD, [1, 0, 0], math.identityMat4());
|
687
|
-
return math.mulMat4(rotate, translate, math.identityMat4());
|
688
|
-
})(),
|
689
|
-
pickable: true,
|
690
|
-
collidable: true,
|
691
|
-
clippable: false,
|
692
|
-
visible: false,
|
693
|
-
opacity: 0.2
|
694
|
-
}), NO_STATE_INHERIT),
|
695
|
-
|
696
|
-
yShaft: rootNode.addChild(new Mesh(rootNode, {
|
697
|
-
geometry: shapes.axis,
|
698
|
-
material: materials.green,
|
699
|
-
position: [0, -radius / 2, 0],
|
700
|
-
pickable: false,
|
701
|
-
collidable: true,
|
702
|
-
clippable: false,
|
703
|
-
visible: false
|
704
|
-
}), NO_STATE_INHERIT),
|
705
|
-
|
706
|
-
yShaftHandle: rootNode.addChild(new Mesh(rootNode, {
|
707
|
-
geometry: shapes.axisHandle,
|
708
|
-
material: materials.pickable,
|
709
|
-
position: [0, -radius / 2, 0],
|
710
|
-
pickable: true,
|
711
|
-
collidable: true,
|
712
|
-
clippable: false,
|
713
|
-
visible: false
|
714
|
-
}), NO_STATE_INHERIT),
|
715
|
-
|
716
|
-
//----------------------------------------------------------------------------------------------------------
|
717
|
-
//
|
718
|
-
//----------------------------------------------------------------------------------------------------------
|
719
|
-
|
720
|
-
zAxisArrow: rootNode.addChild(new Mesh(rootNode, {
|
721
|
-
geometry: shapes.arrowHead,
|
722
|
-
material: materials.blue,
|
723
|
-
matrix: (function () {
|
724
|
-
const translate = math.translateMat4c(0, radius + .1, 0, math.identityMat4());
|
725
|
-
const rotate = math.rotationMat4v(-90 * math.DEGTORAD, [0.8, 0, 0], math.identityMat4());
|
726
|
-
return math.mulMat4(rotate, translate, math.identityMat4());
|
727
|
-
})(),
|
728
|
-
pickable: false,
|
729
|
-
collidable: true,
|
730
|
-
clippable: false,
|
731
|
-
visible: false
|
732
|
-
}), NO_STATE_INHERIT),
|
733
|
-
|
734
|
-
zAxisArrowHandle: rootNode.addChild(new Mesh(rootNode, {
|
735
|
-
geometry: shapes.arrowHeadHandle,
|
736
|
-
material: materials.pickable,
|
737
|
-
matrix: (function () {
|
738
|
-
const translate = math.translateMat4c(0, radius + .1, 0, math.identityMat4());
|
739
|
-
const rotate = math.rotationMat4v(-90 * math.DEGTORAD, [0.8, 0, 0], math.identityMat4());
|
740
|
-
return math.mulMat4(rotate, translate, math.identityMat4());
|
741
|
-
})(),
|
742
|
-
pickable: true,
|
743
|
-
collidable: true,
|
744
|
-
clippable: false,
|
745
|
-
visible: false
|
746
|
-
}), NO_STATE_INHERIT),
|
747
|
-
|
748
|
-
|
749
|
-
zShaft: rootNode.addChild(new Mesh(rootNode, {
|
750
|
-
geometry: shapes.axis,
|
751
|
-
material: materials.blue,
|
752
|
-
matrix: (function () {
|
753
|
-
const translate = math.translateMat4c(0, radius / 2, 0, math.identityMat4());
|
754
|
-
const rotate = math.rotationMat4v(-90 * math.DEGTORAD, [1, 0, 0], math.identityMat4());
|
755
|
-
return math.mulMat4(rotate, translate, math.identityMat4());
|
756
|
-
})(),
|
757
|
-
clippable: false,
|
758
|
-
pickable: false,
|
759
|
-
collidable: true,
|
760
|
-
visible: false
|
761
|
-
}), NO_STATE_INHERIT),
|
762
|
-
|
763
|
-
zAxisHandle: rootNode.addChild(new Mesh(rootNode, {
|
764
|
-
geometry: shapes.axisHandle,
|
765
|
-
material: materials.pickable,
|
766
|
-
matrix: (function () {
|
767
|
-
const translate = math.translateMat4c(0, radius / 2, 0, math.identityMat4());
|
768
|
-
const rotate = math.rotationMat4v(-90 * math.DEGTORAD, [1, 0, 0], math.identityMat4());
|
769
|
-
return math.mulMat4(rotate, translate, math.identityMat4());
|
770
|
-
})(),
|
771
|
-
clippable: false,
|
772
|
-
pickable: true,
|
773
|
-
collidable: true,
|
774
|
-
visible: false
|
775
|
-
}), NO_STATE_INHERIT)
|
776
|
-
};
|
777
|
-
|
778
|
-
this._affordanceMeshes = {
|
779
|
-
|
780
|
-
planeFrame: rootNode.addChild(new Mesh(rootNode, {
|
781
|
-
geometry: new ReadableGeometry(rootNode, buildTorusGeometry({
|
782
|
-
center: [0, 0, 0],
|
783
|
-
radius: 2,
|
784
|
-
tube: tubeRadius,
|
785
|
-
radialSegments: 4,
|
786
|
-
tubeSegments: 4,
|
787
|
-
arc: Math.PI * 2.0
|
788
|
-
})),
|
789
|
-
material: new PhongMaterial(rootNode, {
|
790
|
-
ambient: [1, 1, 1],
|
791
|
-
diffuse: [0, 0, 0],
|
792
|
-
emissive: [1, 1, 0]
|
793
|
-
}),
|
794
|
-
highlighted: true,
|
795
|
-
highlightMaterial: new EmphasisMaterial(rootNode, {
|
796
|
-
edges: false,
|
797
|
-
filled: true,
|
798
|
-
fillColor: [1, 1, 0],
|
799
|
-
fillAlpha: 1.0
|
800
|
-
}),
|
801
|
-
pickable: false,
|
802
|
-
collidable: false,
|
803
|
-
clippable: false,
|
804
|
-
visible: false,
|
805
|
-
scale: [1, 1, 1],
|
806
|
-
rotation: [0, 0, 45]
|
807
|
-
}), NO_STATE_INHERIT),
|
808
|
-
|
809
|
-
xHoop: rootNode.addChild(new Mesh(rootNode, { // Full
|
810
|
-
geometry: shapes.hoop,
|
811
|
-
material: materials.red,
|
812
|
-
highlighted: true,
|
813
|
-
highlightMaterial: materials.highlightRed,
|
814
|
-
matrix: (function () {
|
815
|
-
const rotate2 = math.rotationMat4v(90 * math.DEGTORAD, [0, 1, 0], math.identityMat4());
|
816
|
-
const rotate1 = math.rotationMat4v(270 * math.DEGTORAD, [1, 0, 0], math.identityMat4());
|
817
|
-
return math.mulMat4(rotate1, rotate2, math.identityMat4());
|
818
|
-
})(),
|
819
|
-
pickable: false,
|
820
|
-
collidable: true,
|
821
|
-
clippable: false,
|
822
|
-
visible: false
|
823
|
-
}), NO_STATE_INHERIT),
|
824
|
-
|
825
|
-
yHoop: rootNode.addChild(new Mesh(rootNode, {
|
826
|
-
geometry: shapes.hoop,
|
827
|
-
material: materials.green,
|
828
|
-
highlighted: true,
|
829
|
-
highlightMaterial: materials.highlightGreen,
|
830
|
-
rotation: [-90, 0, 0],
|
831
|
-
pickable: false,
|
832
|
-
collidable: true,
|
833
|
-
clippable: false,
|
834
|
-
visible: false
|
835
|
-
}), NO_STATE_INHERIT),
|
836
|
-
|
837
|
-
zHoop: rootNode.addChild(new Mesh(rootNode, { // Blue hoop about Z-axis
|
838
|
-
geometry: shapes.hoop,
|
839
|
-
material: materials.blue,
|
840
|
-
highlighted: true,
|
841
|
-
highlightMaterial: materials.highlightBlue,
|
842
|
-
matrix: math.rotationMat4v(180 * math.DEGTORAD, [1, 0, 0], math.identityMat4()),
|
843
|
-
pickable: false,
|
844
|
-
collidable: true,
|
845
|
-
clippable: false,
|
846
|
-
backfaces: true,
|
847
|
-
visible: false
|
848
|
-
}), NO_STATE_INHERIT),
|
849
|
-
|
850
|
-
xAxisArrow: rootNode.addChild(new Mesh(rootNode, {
|
851
|
-
geometry: shapes.arrowHeadBig,
|
852
|
-
material: materials.red,
|
853
|
-
matrix: (function () {
|
854
|
-
const translate = math.translateMat4c(0, radius + .1, 0, math.identityMat4());
|
855
|
-
const rotate = math.rotationMat4v(-90 * math.DEGTORAD, [0, 0, 1], math.identityMat4());
|
856
|
-
return math.mulMat4(rotate, translate, math.identityMat4());
|
857
|
-
})(),
|
858
|
-
pickable: false,
|
859
|
-
collidable: true,
|
860
|
-
clippable: false,
|
861
|
-
visible: false
|
862
|
-
}), NO_STATE_INHERIT),
|
863
|
-
|
864
|
-
yAxisArrow: rootNode.addChild(new Mesh(rootNode, {
|
865
|
-
geometry: shapes.arrowHeadBig,
|
866
|
-
material: materials.green,
|
867
|
-
matrix: (function () {
|
868
|
-
const translate = math.translateMat4c(0, radius + .1, 0, math.identityMat4());
|
869
|
-
const rotate = math.rotationMat4v(180 * math.DEGTORAD, [1, 0, 0], math.identityMat4());
|
870
|
-
return math.mulMat4(rotate, translate, math.identityMat4());
|
871
|
-
})(),
|
872
|
-
pickable: false,
|
873
|
-
collidable: true,
|
874
|
-
clippable: false,
|
875
|
-
visible: false
|
876
|
-
}), NO_STATE_INHERIT),
|
877
|
-
|
878
|
-
zAxisArrow: rootNode.addChild(new Mesh(rootNode, {
|
879
|
-
geometry: shapes.arrowHeadBig,
|
880
|
-
material: materials.blue,
|
881
|
-
matrix: (function () {
|
882
|
-
const translate = math.translateMat4c(0, radius + .1, 0, math.identityMat4());
|
883
|
-
const rotate = math.rotationMat4v(-90 * math.DEGTORAD, [0.8, 0, 0], math.identityMat4());
|
884
|
-
return math.mulMat4(rotate, translate, math.identityMat4());
|
885
|
-
})(),
|
886
|
-
pickable: false,
|
887
|
-
collidable: true,
|
888
|
-
clippable: false,
|
889
|
-
visible: false
|
890
|
-
}), NO_STATE_INHERIT)
|
891
|
-
};
|
892
|
-
}
|
893
|
-
|
894
|
-
_bindEvents() {
|
895
|
-
|
896
|
-
const self = this;
|
897
|
-
|
898
|
-
var grabbed = false;
|
899
|
-
|
900
|
-
const DRAG_ACTIONS = {
|
901
|
-
none: -1,
|
902
|
-
xTranslate: 0,
|
903
|
-
yTranslate: 1,
|
904
|
-
zTranslate: 2,
|
905
|
-
xRotate: 3,
|
906
|
-
yRotate: 4,
|
907
|
-
zRotate: 5
|
908
|
-
};
|
909
|
-
|
910
|
-
const rootNode = this._rootNode;
|
911
|
-
|
912
|
-
var nextDragAction = null; // As we hover grabbed an arrow or hoop, self is the action we would do if we then dragged it.
|
913
|
-
var dragAction = null; // Action we're doing while we drag an arrow or hoop.
|
914
|
-
const lastCanvasPos = math.vec2();
|
915
|
-
|
916
|
-
const xBaseAxis = math.vec3([1, 0, 0]);
|
917
|
-
const yBaseAxis = math.vec3([0, 1, 0]);
|
918
|
-
const zBaseAxis = math.vec3([0, 0, 1]);
|
919
|
-
|
920
|
-
const canvas = this._viewer.scene.canvas.canvas;
|
921
|
-
const camera = this._viewer.camera;
|
922
|
-
const scene = this._viewer.scene;
|
923
|
-
|
924
|
-
{ // Keep gizmo screen size constant
|
925
|
-
|
926
|
-
const tempVec3a = math.vec3([0, 0, 0]);
|
927
|
-
|
928
|
-
let distDirty = true;
|
929
|
-
let lastDist = -1;
|
930
|
-
|
931
|
-
this._onCameraViewMatrix = scene.camera.on("viewMatrix", () => {
|
932
|
-
distDirty = true;
|
933
|
-
});
|
934
|
-
|
935
|
-
this._onCameraProjMatrix = scene.camera.on("projMatrix", () => {
|
936
|
-
distDirty = true;
|
937
|
-
});
|
938
|
-
|
939
|
-
this._onSceneTick = scene.on("tick", () => {
|
940
|
-
|
941
|
-
const dist = Math.abs(math.lenVec3(math.subVec3(scene.camera.eye, this._pos, tempVec3a)));
|
942
|
-
|
943
|
-
if (dist !== lastDist) {
|
944
|
-
if (camera.projection === "perspective") {
|
945
|
-
const worldSize = (Math.tan(camera.perspective.fov * math.DEGTORAD)) * dist;
|
946
|
-
const size = 0.07 * worldSize;
|
947
|
-
rootNode.scale = [size, size, size];
|
948
|
-
lastDist = dist;
|
949
|
-
}
|
950
|
-
}
|
951
|
-
|
952
|
-
if (camera.projection === "ortho") {
|
953
|
-
const worldSize = camera.ortho.scale / 10;
|
954
|
-
const size = worldSize;
|
955
|
-
rootNode.scale = [size, size, size];
|
956
|
-
lastDist = dist;
|
957
|
-
}
|
958
|
-
});
|
959
|
-
}
|
960
|
-
|
961
|
-
const getClickCoordsWithinElement = (function () {
|
962
|
-
const canvasPos = new Float64Array(2);
|
963
|
-
return function (event) {
|
964
|
-
if (!event) {
|
965
|
-
event = window.event;
|
966
|
-
canvasPos[0] = event.x;
|
967
|
-
canvasPos[1] = event.y;
|
968
|
-
} else {
|
969
|
-
var element = event.target;
|
970
|
-
var totalOffsetLeft = 0;
|
971
|
-
var totalOffsetTop = 0;
|
972
|
-
|
973
|
-
while (element.offsetParent) {
|
974
|
-
totalOffsetLeft += element.offsetLeft;
|
975
|
-
totalOffsetTop += element.offsetTop;
|
976
|
-
element = element.offsetParent;
|
977
|
-
}
|
978
|
-
canvasPos[0] = event.pageX - totalOffsetLeft;
|
979
|
-
canvasPos[1] = event.pageY - totalOffsetTop;
|
980
|
-
}
|
981
|
-
return canvasPos;
|
982
|
-
};
|
983
|
-
})();
|
984
|
-
|
985
|
-
const localToWorldVec = (function () {
|
986
|
-
const mat = math.mat4();
|
987
|
-
return function (localVec, worldVec) {
|
988
|
-
math.quaternionToMat4(self._rootNode.quaternion, mat);
|
989
|
-
math.transformVec3(mat, localVec, worldVec);
|
990
|
-
math.normalizeVec3(worldVec);
|
991
|
-
return worldVec;
|
992
|
-
};
|
993
|
-
})();
|
994
|
-
|
995
|
-
var getTranslationPlane = (function () {
|
996
|
-
const planeNormal = math.vec3();
|
997
|
-
return function (worldAxis) {
|
998
|
-
const absX = Math.abs(worldAxis[0]);
|
999
|
-
if (absX > Math.abs(worldAxis[1]) && absX > Math.abs(worldAxis[2])) {
|
1000
|
-
math.cross3Vec3(worldAxis, [0, 1, 0], planeNormal);
|
1001
|
-
} else {
|
1002
|
-
math.cross3Vec3(worldAxis, [1, 0, 0], planeNormal);
|
1003
|
-
}
|
1004
|
-
math.cross3Vec3(planeNormal, worldAxis, planeNormal);
|
1005
|
-
math.normalizeVec3(planeNormal);
|
1006
|
-
return planeNormal;
|
1007
|
-
}
|
1008
|
-
})();
|
1009
|
-
|
1010
|
-
const dragTranslateSectionPlane = (function () {
|
1011
|
-
const p1 = math.vec3();
|
1012
|
-
const p2 = math.vec3();
|
1013
|
-
const worldAxis = math.vec4();
|
1014
|
-
return function (baseAxis, fromMouse, toMouse) {
|
1015
|
-
localToWorldVec(baseAxis, worldAxis);
|
1016
|
-
const planeNormal = getTranslationPlane(worldAxis, fromMouse, toMouse);
|
1017
|
-
getPointerPlaneIntersect(fromMouse, planeNormal, p1);
|
1018
|
-
getPointerPlaneIntersect(toMouse, planeNormal, p2);
|
1019
|
-
math.subVec3(p2, p1);
|
1020
|
-
const dot = math.dotVec3(p2, worldAxis);
|
1021
|
-
self._pos[0] += worldAxis[0] * dot;
|
1022
|
-
self._pos[1] += worldAxis[1] * dot;
|
1023
|
-
self._pos[2] += worldAxis[2] * dot;
|
1024
|
-
self._rootNode.position = self._pos;
|
1025
|
-
if (self._sectionPlane) {
|
1026
|
-
self._sectionPlane.pos = self._pos;
|
1027
|
-
}
|
1028
|
-
}
|
1029
|
-
})();
|
1030
|
-
|
1031
|
-
var dragRotateSectionPlane = (function () {
|
1032
|
-
const p1 = math.vec4();
|
1033
|
-
const p2 = math.vec4();
|
1034
|
-
const c = math.vec4();
|
1035
|
-
const worldAxis = math.vec4();
|
1036
|
-
return function (baseAxis, fromMouse, toMouse) {
|
1037
|
-
localToWorldVec(baseAxis, worldAxis);
|
1038
|
-
const hasData = getPointerPlaneIntersect(fromMouse, worldAxis, p1) && getPointerPlaneIntersect(toMouse, worldAxis, p2);
|
1039
|
-
if (!hasData) { // Find intersections with view plane and project down to origin
|
1040
|
-
const planeNormal = getTranslationPlane(worldAxis, fromMouse, toMouse);
|
1041
|
-
getPointerPlaneIntersect(fromMouse, planeNormal, p1, 1); // Ensure plane moves closer to camera so angles become workable
|
1042
|
-
getPointerPlaneIntersect(toMouse, planeNormal, p2, 1);
|
1043
|
-
var dot = math.dotVec3(p1, worldAxis);
|
1044
|
-
p1[0] -= dot * worldAxis[0];
|
1045
|
-
p1[1] -= dot * worldAxis[1];
|
1046
|
-
p1[2] -= dot * worldAxis[2];
|
1047
|
-
dot = math.dotVec3(p2, worldAxis);
|
1048
|
-
p2[0] -= dot * worldAxis[0];
|
1049
|
-
p2[1] -= dot * worldAxis[1];
|
1050
|
-
p2[2] -= dot * worldAxis[2];
|
1051
|
-
}
|
1052
|
-
math.normalizeVec3(p1);
|
1053
|
-
math.normalizeVec3(p2);
|
1054
|
-
dot = math.dotVec3(p1, p2);
|
1055
|
-
dot = math.clamp(dot, -1.0, 1.0); // Rounding errors cause dot to exceed allowed range
|
1056
|
-
var incDegrees = Math.acos(dot) * math.RADTODEG;
|
1057
|
-
math.cross3Vec3(p1, p2, c);
|
1058
|
-
if (math.dotVec3(c, worldAxis) < 0.0) {
|
1059
|
-
incDegrees = -incDegrees;
|
1060
|
-
}
|
1061
|
-
self._rootNode.rotate(baseAxis, incDegrees);
|
1062
|
-
rotateSectionPlane();
|
1063
|
-
}
|
1064
|
-
})();
|
1065
|
-
|
1066
|
-
var getPointerPlaneIntersect = (function () {
|
1067
|
-
const dir = math.vec4([0, 0, 0, 1]);
|
1068
|
-
const matrix = math.mat4();
|
1069
|
-
return function (mouse, axis, dest, offset) {
|
1070
|
-
offset = offset || 0;
|
1071
|
-
dir[0] = mouse[0] / canvas.width * 2.0 - 1.0;
|
1072
|
-
dir[1] = -(mouse[1] / canvas.height * 2.0 - 1.0);
|
1073
|
-
dir[2] = 0.0;
|
1074
|
-
dir[3] = 1.0;
|
1075
|
-
math.mulMat4(camera.projMatrix, camera.viewMatrix, matrix); // Unproject norm device coords to view coords
|
1076
|
-
math.inverseMat4(matrix);
|
1077
|
-
math.transformVec4(matrix, dir, dir);
|
1078
|
-
math.mulVec4Scalar(dir, 1.0 / dir[3]); // This is now point A on the ray in world space
|
1079
|
-
var rayO = camera.eye; // The direction
|
1080
|
-
math.subVec4(dir, rayO, dir);
|
1081
|
-
const origin = self._sectionPlane.pos; // Plane origin:
|
1082
|
-
var d = -math.dotVec3(origin, axis) - offset;
|
1083
|
-
var dot = math.dotVec3(axis, dir);
|
1084
|
-
if (Math.abs(dot) > 0.005) {
|
1085
|
-
var t = -(math.dotVec3(axis, rayO) + d) / dot;
|
1086
|
-
math.mulVec3Scalar(dir, t, dest);
|
1087
|
-
math.addVec3(dest, rayO);
|
1088
|
-
math.subVec3(dest, origin, dest);
|
1089
|
-
return true;
|
1090
|
-
}
|
1091
|
-
return false;
|
1092
|
-
}
|
1093
|
-
})();
|
1094
|
-
|
1095
|
-
const rotateSectionPlane = (function () {
|
1096
|
-
const dir = math.vec3();
|
1097
|
-
const mat = math.mat4();
|
1098
|
-
return function () {
|
1099
|
-
if (self.sectionPlane) {
|
1100
|
-
math.quaternionToMat4(rootNode.quaternion, mat); // << ---
|
1101
|
-
math.transformVec3(mat, [0, 0, 1], dir);
|
1102
|
-
self._setSectionPlaneDir(dir);
|
1103
|
-
}
|
1104
|
-
};
|
1105
|
-
})();
|
1106
|
-
|
1107
|
-
{
|
1108
|
-
var mouseDownLeft;
|
1109
|
-
var mouseDownMiddle;
|
1110
|
-
var mouseDownRight;
|
1111
|
-
var down = false;
|
1112
|
-
var lastAffordanceMesh;
|
1113
|
-
|
1114
|
-
this._onCameraControlHover = this._viewer.cameraControl.on("hoverEnter", (hit) => {
|
1115
|
-
if (!this._visible) {
|
1116
|
-
return;
|
1117
|
-
}
|
1118
|
-
if (down) {
|
1119
|
-
return;
|
1120
|
-
}
|
1121
|
-
grabbed = false;
|
1122
|
-
if (lastAffordanceMesh) {
|
1123
|
-
lastAffordanceMesh.visible = false;
|
1124
|
-
}
|
1125
|
-
var affordanceMesh;
|
1126
|
-
const meshId = hit.entity.id;
|
1127
|
-
switch (meshId) {
|
1128
|
-
|
1129
|
-
case this._displayMeshes.xAxisArrowHandle.id:
|
1130
|
-
affordanceMesh = this._affordanceMeshes.xAxisArrow;
|
1131
|
-
nextDragAction = DRAG_ACTIONS.xTranslate;
|
1132
|
-
break;
|
1133
|
-
|
1134
|
-
case this._displayMeshes.xAxisHandle.id:
|
1135
|
-
affordanceMesh = this._affordanceMeshes.xAxisArrow;
|
1136
|
-
nextDragAction = DRAG_ACTIONS.xTranslate;
|
1137
|
-
break;
|
1138
|
-
|
1139
|
-
case this._displayMeshes.yAxisArrowHandle.id:
|
1140
|
-
affordanceMesh = this._affordanceMeshes.yAxisArrow;
|
1141
|
-
nextDragAction = DRAG_ACTIONS.yTranslate;
|
1142
|
-
break;
|
1143
|
-
|
1144
|
-
case this._displayMeshes.yShaftHandle.id:
|
1145
|
-
affordanceMesh = this._affordanceMeshes.yAxisArrow;
|
1146
|
-
nextDragAction = DRAG_ACTIONS.yTranslate;
|
1147
|
-
break;
|
1148
|
-
|
1149
|
-
case this._displayMeshes.zAxisArrowHandle.id:
|
1150
|
-
affordanceMesh = this._affordanceMeshes.zAxisArrow;
|
1151
|
-
nextDragAction = DRAG_ACTIONS.zTranslate;
|
1152
|
-
break;
|
1153
|
-
|
1154
|
-
case this._displayMeshes.zAxisHandle.id:
|
1155
|
-
affordanceMesh = this._affordanceMeshes.zAxisArrow;
|
1156
|
-
nextDragAction = DRAG_ACTIONS.zTranslate;
|
1157
|
-
break;
|
1158
|
-
|
1159
|
-
case this._displayMeshes.xCurveHandle.id:
|
1160
|
-
affordanceMesh = this._affordanceMeshes.xHoop;
|
1161
|
-
nextDragAction = DRAG_ACTIONS.xRotate;
|
1162
|
-
break;
|
1163
|
-
|
1164
|
-
case this._displayMeshes.yCurveHandle.id:
|
1165
|
-
affordanceMesh = this._affordanceMeshes.yHoop;
|
1166
|
-
nextDragAction = DRAG_ACTIONS.yRotate;
|
1167
|
-
break;
|
1168
|
-
|
1169
|
-
case this._displayMeshes.zCurveHandle.id:
|
1170
|
-
affordanceMesh = this._affordanceMeshes.zHoop;
|
1171
|
-
nextDragAction = DRAG_ACTIONS.zRotate;
|
1172
|
-
break;
|
1173
|
-
|
1174
|
-
default:
|
1175
|
-
nextDragAction = DRAG_ACTIONS.none;
|
1176
|
-
return; // Not clicked an arrow or hoop
|
1177
|
-
}
|
1178
|
-
if (affordanceMesh) {
|
1179
|
-
affordanceMesh.visible = true;
|
1180
|
-
}
|
1181
|
-
lastAffordanceMesh = affordanceMesh;
|
1182
|
-
grabbed = true;
|
1183
|
-
});
|
1184
|
-
|
1185
|
-
this._onCameraControlHoverLeave = this._viewer.cameraControl.on("hoverOut", (hit) => {
|
1186
|
-
if (!this._visible) {
|
1187
|
-
return;
|
1188
|
-
}
|
1189
|
-
if (lastAffordanceMesh) {
|
1190
|
-
lastAffordanceMesh.visible = false;
|
1191
|
-
}
|
1192
|
-
lastAffordanceMesh = null;
|
1193
|
-
nextDragAction = DRAG_ACTIONS.none;
|
1194
|
-
});
|
1195
|
-
|
1196
|
-
canvas.addEventListener("mousedown", this._canvasMouseDownListener = (e) => {
|
1197
|
-
e.preventDefault();
|
1198
|
-
if (!this._visible) {
|
1199
|
-
return;
|
1200
|
-
}
|
1201
|
-
if (!grabbed) {
|
1202
|
-
return;
|
1203
|
-
}
|
1204
|
-
this._viewer.cameraControl.pointerEnabled = false;
|
1205
|
-
switch (e.which) {
|
1206
|
-
case 1: // Left button
|
1207
|
-
mouseDownLeft = true;
|
1208
|
-
down = true;
|
1209
|
-
var canvasPos = getClickCoordsWithinElement(e);
|
1210
|
-
dragAction = nextDragAction;
|
1211
|
-
lastCanvasPos[0] = canvasPos[0];
|
1212
|
-
lastCanvasPos[1] = canvasPos[1];
|
1213
|
-
break;
|
1214
|
-
|
1215
|
-
default:
|
1216
|
-
break;
|
1217
|
-
}
|
1218
|
-
});
|
1219
|
-
|
1220
|
-
canvas.addEventListener("mousemove", this._canvasMouseMoveListener = (e) => {
|
1221
|
-
if (!this._visible) {
|
1222
|
-
return;
|
1223
|
-
}
|
1224
|
-
if (!down) {
|
1225
|
-
return;
|
1226
|
-
}
|
1227
|
-
var canvasPos = getClickCoordsWithinElement(e);
|
1228
|
-
const x = canvasPos[0];
|
1229
|
-
const y = canvasPos[1];
|
1230
|
-
|
1231
|
-
switch (dragAction) {
|
1232
|
-
case DRAG_ACTIONS.xTranslate:
|
1233
|
-
dragTranslateSectionPlane(xBaseAxis, lastCanvasPos, canvasPos);
|
1234
|
-
break;
|
1235
|
-
case DRAG_ACTIONS.yTranslate:
|
1236
|
-
dragTranslateSectionPlane(yBaseAxis, lastCanvasPos, canvasPos);
|
1237
|
-
break;
|
1238
|
-
case DRAG_ACTIONS.zTranslate:
|
1239
|
-
dragTranslateSectionPlane(zBaseAxis, lastCanvasPos, canvasPos);
|
1240
|
-
break;
|
1241
|
-
case DRAG_ACTIONS.xRotate:
|
1242
|
-
dragRotateSectionPlane(xBaseAxis, lastCanvasPos, canvasPos);
|
1243
|
-
break;
|
1244
|
-
case DRAG_ACTIONS.yRotate:
|
1245
|
-
dragRotateSectionPlane(yBaseAxis, lastCanvasPos, canvasPos);
|
1246
|
-
break;
|
1247
|
-
case DRAG_ACTIONS.zRotate:
|
1248
|
-
dragRotateSectionPlane(zBaseAxis, lastCanvasPos, canvasPos);
|
1249
|
-
break;
|
1250
|
-
}
|
1251
|
-
|
1252
|
-
lastCanvasPos[0] = x;
|
1253
|
-
lastCanvasPos[1] = y;
|
1254
|
-
});
|
1255
|
-
|
1256
|
-
canvas.addEventListener("mouseup", this._canvasMouseUpListener = (e) => {
|
1257
|
-
if (!this._visible) {
|
1258
|
-
return;
|
1259
|
-
}
|
1260
|
-
this._viewer.cameraControl.pointerEnabled = true;
|
1261
|
-
if (!down) {
|
1262
|
-
return;
|
1263
|
-
}
|
1264
|
-
switch (e.which) {
|
1265
|
-
case 1: // Left button
|
1266
|
-
mouseDownLeft = false;
|
1267
|
-
break;
|
1268
|
-
case 2: // Middle/both buttons
|
1269
|
-
mouseDownMiddle = false;
|
1270
|
-
break;
|
1271
|
-
case 3: // Right button
|
1272
|
-
mouseDownRight = false;
|
1273
|
-
break;
|
1274
|
-
default:
|
1275
|
-
break;
|
1276
|
-
}
|
1277
|
-
down = false;
|
1278
|
-
grabbed = false;
|
1279
|
-
});
|
1280
|
-
|
1281
|
-
canvas.addEventListener("wheel", this._canvasWheelListener = (e) => {
|
1282
|
-
if (!this._visible) {
|
1283
|
-
return;
|
1284
|
-
}
|
1285
|
-
var delta = Math.max(-1, Math.min(1, -e.deltaY * 40));
|
1286
|
-
if (delta === 0) {
|
1287
|
-
return;
|
1288
|
-
}
|
1289
|
-
});
|
1290
|
-
}
|
1291
|
-
}
|
1292
|
-
|
1293
|
-
_destroy() {
|
1294
|
-
this._unbindEvents();
|
1295
|
-
this._destroyNodes();
|
1296
|
-
}
|
1297
|
-
|
1298
|
-
_unbindEvents() {
|
1299
|
-
|
1300
|
-
const viewer = this._viewer;
|
1301
|
-
const scene = viewer.scene;
|
1302
|
-
const canvas = scene.canvas.canvas;
|
1303
|
-
const camera = viewer.camera;
|
1304
|
-
const cameraControl = viewer.cameraControl;
|
1305
|
-
|
1306
|
-
scene.off(this._onSceneTick);
|
1307
|
-
|
1308
|
-
canvas.removeEventListener("mousedown", this._canvasMouseDownListener);
|
1309
|
-
canvas.removeEventListener("mousemove", this._canvasMouseMoveListener);
|
1310
|
-
canvas.removeEventListener("mouseup", this._canvasMouseUpListener);
|
1311
|
-
canvas.removeEventListener("wheel", this._canvasWheelListener);
|
1312
|
-
|
1313
|
-
camera.off(this._onCameraViewMatrix);
|
1314
|
-
camera.off(this._onCameraProjMatrix);
|
1315
|
-
|
1316
|
-
cameraControl.off(this._onCameraControlHover);
|
1317
|
-
cameraControl.off(this._onCameraControlHoverLeave);
|
1318
|
-
}
|
1319
|
-
|
1320
|
-
_destroyNodes() {
|
1321
|
-
this._setSectionPlane(null);
|
1322
|
-
this._rootNode.destroy();
|
1323
|
-
this._displayMeshes = {};
|
1324
|
-
this._affordanceMeshes = {};
|
1325
|
-
}
|
1326
|
-
}
|
1327
|
-
|
1328
|
-
export {Control};
|