csyjk 1.2.2 → 2.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,1356 +0,0 @@
|
|
|
1
|
-
import {utils} from '../utils.js';
|
|
2
|
-
import {Component} from '../Component.js';
|
|
3
|
-
import {math} from '../math/math.js';
|
|
4
|
-
|
|
5
|
-
const angleAxis = math.vec4(4);
|
|
6
|
-
const q1 = math.vec4();
|
|
7
|
-
const q2 = math.vec4();
|
|
8
|
-
const xAxis = math.vec3([1, 0, 0]);
|
|
9
|
-
const yAxis = math.vec3([0, 1, 0]);
|
|
10
|
-
const zAxis = math.vec3([0, 0, 1]);
|
|
11
|
-
|
|
12
|
-
const veca = math.vec3(3);
|
|
13
|
-
const vecb = math.vec3(3);
|
|
14
|
-
|
|
15
|
-
const identityMat = math.identityMat4();
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @desc An {@link Entity} that is a scene graph node that can have child Nodes and {@link Mesh}es.
|
|
19
|
-
*
|
|
20
|
-
* ## Usage
|
|
21
|
-
*
|
|
22
|
-
* The example below is the same as the one given for {@link Mesh}, since the two classes work together. In this example,
|
|
23
|
-
* we'll create a scene graph in which a root Node represents a group and the {@link Mesh}s are leaves. Since Node
|
|
24
|
-
* implements {@link Entity}, we can designate the root Node as a model, causing it to be registered by its ID in {@link Scene#models}.
|
|
25
|
-
*
|
|
26
|
-
* Since {@link Mesh} also implements {@link Entity}, we can designate the leaf {@link Mesh}es as objects, causing them to
|
|
27
|
-
* be registered by their IDs in {@link Scene#objects}.
|
|
28
|
-
*
|
|
29
|
-
* We can then find those {@link Entity} types in {@link Scene#models} and {@link Scene#objects}.
|
|
30
|
-
*
|
|
31
|
-
* We can also update properties of our object-Meshes via calls to {@link Scene#setObjectsHighlighted} etc.
|
|
32
|
-
*
|
|
33
|
-
* [[Run this example](http://yjkkit.github.io/yjkkit-sdk/examples/#sceneRepresentation_SceneGraph)]
|
|
34
|
-
*
|
|
35
|
-
* ````javascript
|
|
36
|
-
* import {Viewer, Mesh, Node, PhongMaterial} from "yjkkit-sdk.es.js";
|
|
37
|
-
*
|
|
38
|
-
* const viewer = new Viewer({
|
|
39
|
-
* canvasId: "myCanvas"
|
|
40
|
-
* });
|
|
41
|
-
*
|
|
42
|
-
* viewer.scene.camera.eye = [-21.80, 4.01, 6.56];
|
|
43
|
-
* viewer.scene.camera.look = [0, -5.75, 0];
|
|
44
|
-
* viewer.scene.camera.up = [0.37, 0.91, -0.11];
|
|
45
|
-
*
|
|
46
|
-
* new Node(viewer.scene, {
|
|
47
|
-
* id: "table",
|
|
48
|
-
* isModel: true, // <---------- Node represents a model, so is registered by ID in viewer.scene.models
|
|
49
|
-
* rotation: [0, 50, 0],
|
|
50
|
-
* position: [0, 0, 0],
|
|
51
|
-
* scale: [1, 1, 1],
|
|
52
|
-
*
|
|
53
|
-
* children: [
|
|
54
|
-
*
|
|
55
|
-
* new Mesh(viewer.scene, { // Red table leg
|
|
56
|
-
* id: "redLeg",
|
|
57
|
-
* isObject: true, // <------ Node represents an object, so is registered by ID in viewer.scene.objects
|
|
58
|
-
* position: [-4, -6, -4],
|
|
59
|
-
* scale: [1, 3, 1],
|
|
60
|
-
* rotation: [0, 0, 0],
|
|
61
|
-
* material: new PhongMaterial(viewer.scene, {
|
|
62
|
-
* diffuse: [1, 0.3, 0.3]
|
|
63
|
-
* })
|
|
64
|
-
* }),
|
|
65
|
-
*
|
|
66
|
-
* new Mesh(viewer.scene, { // Green table leg
|
|
67
|
-
* id: "greenLeg",
|
|
68
|
-
* isObject: true, // <------ Node represents an object, so is registered by ID in viewer.scene.objects
|
|
69
|
-
* position: [4, -6, -4],
|
|
70
|
-
* scale: [1, 3, 1],
|
|
71
|
-
* rotation: [0, 0, 0],
|
|
72
|
-
* material: new PhongMaterial(viewer.scene, {
|
|
73
|
-
* diffuse: [0.3, 1.0, 0.3]
|
|
74
|
-
* })
|
|
75
|
-
* }),
|
|
76
|
-
*
|
|
77
|
-
* new Mesh(viewer.scene, {// Blue table leg
|
|
78
|
-
* id: "blueLeg",
|
|
79
|
-
* isObject: true, // <------ Node represents an object, so is registered by ID in viewer.scene.objects
|
|
80
|
-
* position: [4, -6, 4],
|
|
81
|
-
* scale: [1, 3, 1],
|
|
82
|
-
* rotation: [0, 0, 0],
|
|
83
|
-
* material: new PhongMaterial(viewer.scene, {
|
|
84
|
-
* diffuse: [0.3, 0.3, 1.0]
|
|
85
|
-
* })
|
|
86
|
-
* }),
|
|
87
|
-
*
|
|
88
|
-
* new Mesh(viewer.scene, { // Yellow table leg
|
|
89
|
-
* id: "yellowLeg",
|
|
90
|
-
* isObject: true, // <------ Node represents an object, so is registered by ID in viewer.scene.objects
|
|
91
|
-
* position: [-4, -6, 4],
|
|
92
|
-
* scale: [1, 3, 1],
|
|
93
|
-
* rotation: [0, 0, 0],
|
|
94
|
-
* material: new PhongMaterial(viewer.scene, {
|
|
95
|
-
* diffuse: [1.0, 1.0, 0.0]
|
|
96
|
-
* })
|
|
97
|
-
* }),
|
|
98
|
-
*
|
|
99
|
-
* new Mesh(viewer.scene, { // Purple table top
|
|
100
|
-
* id: "tableTop",
|
|
101
|
-
* isObject: true, // <------ Node represents an object, so is registered by ID in viewer.scene.objects
|
|
102
|
-
* position: [0, -3, 0],
|
|
103
|
-
* scale: [6, 0.5, 6],
|
|
104
|
-
* rotation: [0, 0, 0],
|
|
105
|
-
* material: new PhongMaterial(viewer.scene, {
|
|
106
|
-
* diffuse: [1.0, 0.3, 1.0]
|
|
107
|
-
* })
|
|
108
|
-
* })
|
|
109
|
-
* ]
|
|
110
|
-
* });
|
|
111
|
-
*
|
|
112
|
-
* // Find Nodes and Meshes by their IDs
|
|
113
|
-
*
|
|
114
|
-
* var table = viewer.scene.models["table"]; // Since table Node has isModel == true
|
|
115
|
-
*
|
|
116
|
-
* var redLeg = viewer.scene.objects["redLeg"]; // Since the Meshes have isObject == true
|
|
117
|
-
* var greenLeg = viewer.scene.objects["greenLeg"];
|
|
118
|
-
* var blueLeg = viewer.scene.objects["blueLeg"];
|
|
119
|
-
*
|
|
120
|
-
* // Highlight one of the table leg Meshes
|
|
121
|
-
*
|
|
122
|
-
* viewer.scene.setObjectsHighlighted(["redLeg"], true); // Since the Meshes have isObject == true
|
|
123
|
-
*
|
|
124
|
-
* // Periodically update transforms on our Nodes and Meshes
|
|
125
|
-
*
|
|
126
|
-
* viewer.scene.on("tick", function () {
|
|
127
|
-
*
|
|
128
|
-
* // Rotate legs
|
|
129
|
-
* redLeg.rotateY(0.5);
|
|
130
|
-
* greenLeg.rotateY(0.5);
|
|
131
|
-
* blueLeg.rotateY(0.5);
|
|
132
|
-
*
|
|
133
|
-
* // Rotate table
|
|
134
|
-
* table.rotateY(0.5);
|
|
135
|
-
* table.rotateX(0.3);
|
|
136
|
-
* });
|
|
137
|
-
* ````
|
|
138
|
-
*
|
|
139
|
-
* ## Metadata
|
|
140
|
-
*
|
|
141
|
-
* As mentioned, we can also associate {@link MetaModel}s and {@link MetaObject}s with our Nodes and {@link Mesh}es,
|
|
142
|
-
* within a {@link MetaScene}. See {@link MetaScene} for an example.
|
|
143
|
-
*
|
|
144
|
-
* @implements {Entity}
|
|
145
|
-
*/
|
|
146
|
-
class Node extends Component {
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
* @constructor
|
|
150
|
-
* @param {Component} owner Owner component. When destroyed, the owner will destroy this component as well.
|
|
151
|
-
* @param {*} [cfg] Configs
|
|
152
|
-
* @param {String} [cfg.id] Optional ID, unique among all components in the parent scene, generated automatically when omitted.
|
|
153
|
-
* @param {Boolean} [cfg.isModel] Specify ````true```` if this Mesh represents a model, in which case the Mesh will be registered by {@link Mesh#id} in {@link Scene#models} and may also have a corresponding {@link MetaModel} with matching {@link MetaModel#id}, registered by that ID in {@link MetaScene#metaModels}.
|
|
154
|
-
* @param {Boolean} [cfg.isObject] Specify ````true```` if this Mesh represents an object, in which case the Mesh will be registered by {@link Mesh#id} in {@link Scene#objects} and may also have a corresponding {@link MetaObject} with matching {@link MetaObject#id}, registered by that ID in {@link MetaScene#metaObjects}.
|
|
155
|
-
* @param {Node} [cfg.parent] The parent Node.
|
|
156
|
-
* @param {Number[]} [cfg.rtcCenter] Relative-to-center (RTC) coordinate system center for this Node.
|
|
157
|
-
* @param {Number[]} [cfg.position=[0,0,0]] Local 3D position.
|
|
158
|
-
* @param {Number[]} [cfg.scale=[1,1,1]] Local scale.
|
|
159
|
-
* @param {Number[]} [cfg.rotation=[0,0,0]] Local rotation, as Euler angles given in degrees, for each of the X, Y and Z axis.
|
|
160
|
-
* @param {Number[]} [cfg.matrix=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1] Local modelling transform matrix. Overrides the position, scale and rotation parameters.
|
|
161
|
-
* @param {Number[]} [cfg.offset=[0,0,0]] World-space 3D translation offset. Translates the Node in World space, after modelling transforms.
|
|
162
|
-
* @param {Boolean} [cfg.visible=true] Indicates if the Node is initially visible.
|
|
163
|
-
* @param {Boolean} [cfg.culled=false] Indicates if the Node is initially culled from view.
|
|
164
|
-
* @param {Boolean} [cfg.pickable=true] Indicates if the Node is initially pickable.
|
|
165
|
-
* @param {Boolean} [cfg.clippable=true] Indicates if the Node is initially clippable.
|
|
166
|
-
* @param {Boolean} [cfg.collidable=true] Indicates if the Node is initially included in boundary calculations.
|
|
167
|
-
* @param {Boolean} [cfg.castsShadow=true] Indicates if the Node initially casts shadows.
|
|
168
|
-
* @param {Boolean} [cfg.receivesShadow=true] Indicates if the Node initially receives shadows.
|
|
169
|
-
* @param {Boolean} [cfg.xrayed=false] Indicates if the Node is initially xrayed.
|
|
170
|
-
* @param {Boolean} [cfg.highlighted=false] Indicates if the Node is initially highlighted.
|
|
171
|
-
* @param {Boolean} [cfg.selected=false] Indicates if the Mesh is initially selected.
|
|
172
|
-
* @param {Boolean} [cfg.edges=false] Indicates if the Node's edges are initially emphasized.
|
|
173
|
-
* @param {Number[]} [cfg.colorize=[1.0,1.0,1.0]] Node's initial RGB colorize color, multiplies by the rendered fragment colors.
|
|
174
|
-
* @param {Number} [cfg.opacity=1.0] Node's initial opacity factor, multiplies by the rendered fragment alpha.
|
|
175
|
-
* @param {Array} [cfg.children] Child Nodes or {@link Mesh}es to add initially. Children must be in the same {@link Scene} and will be removed first from whatever parents they may already have.
|
|
176
|
-
* @param {Boolean} [cfg.inheritStates=true] Indicates if children given to this constructor should inherit rendering state from this parent as they are added. Rendering state includes {@link Node#visible}, {@link Node#culled}, {@link Node#pickable}, {@link Node#clippable}, {@link Node#castsShadow}, {@link Node#receivesShadow}, {@link Node#selected}, {@link Node#highlighted}, {@link Node#colorize} and {@link Node#opacity}.
|
|
177
|
-
*/
|
|
178
|
-
constructor(owner, cfg = {}) {
|
|
179
|
-
|
|
180
|
-
super(owner, cfg);
|
|
181
|
-
|
|
182
|
-
this._parentNode = null;
|
|
183
|
-
this._children = [];
|
|
184
|
-
|
|
185
|
-
this._aabb = null;
|
|
186
|
-
this._aabbDirty = true;
|
|
187
|
-
|
|
188
|
-
this.scene._aabbDirty = true;
|
|
189
|
-
|
|
190
|
-
this._numTriangles = 0;
|
|
191
|
-
|
|
192
|
-
this._scale = math.vec3();
|
|
193
|
-
this._quaternion = math.identityQuaternion();
|
|
194
|
-
this._rotation = math.vec3();
|
|
195
|
-
this._position = math.vec3();
|
|
196
|
-
this._offset = math.vec3();
|
|
197
|
-
|
|
198
|
-
this._localMatrix = math.identityMat4();
|
|
199
|
-
this._worldMatrix = math.identityMat4();
|
|
200
|
-
|
|
201
|
-
this._localMatrixDirty = true;
|
|
202
|
-
this._worldMatrixDirty = true;
|
|
203
|
-
|
|
204
|
-
if (cfg.matrix) {
|
|
205
|
-
this.matrix = cfg.matrix;
|
|
206
|
-
} else {
|
|
207
|
-
this.scale = cfg.scale;
|
|
208
|
-
this.position = cfg.position;
|
|
209
|
-
if (cfg.quaternion) {
|
|
210
|
-
} else {
|
|
211
|
-
this.rotation = cfg.rotation;
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
this._isModel = cfg.isModel;
|
|
216
|
-
if (this._isModel) {
|
|
217
|
-
this.scene._registerModel(this);
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
this._isObject = cfg.isObject;
|
|
221
|
-
if (this._isObject) {
|
|
222
|
-
this.scene._registerObject(this);
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
this.rtcCenter = cfg.rtcCenter;
|
|
226
|
-
this.visible = cfg.visible;
|
|
227
|
-
this.culled = cfg.culled;
|
|
228
|
-
this.pickable = cfg.pickable;
|
|
229
|
-
this.clippable = cfg.clippable;
|
|
230
|
-
this.collidable = cfg.collidable;
|
|
231
|
-
this.castsShadow = cfg.castsShadow;
|
|
232
|
-
this.receivesShadow = cfg.receivesShadow;
|
|
233
|
-
this.xrayed = cfg.xrayed;
|
|
234
|
-
this.highlighted = cfg.highlighted;
|
|
235
|
-
this.selected = cfg.selected;
|
|
236
|
-
this.edges = cfg.edges;
|
|
237
|
-
this.colorize = cfg.colorize;
|
|
238
|
-
this.opacity = cfg.opacity;
|
|
239
|
-
this.offset = cfg.offset;
|
|
240
|
-
|
|
241
|
-
// Add children, which inherit state from this Node
|
|
242
|
-
|
|
243
|
-
if (cfg.children) {
|
|
244
|
-
const children = cfg.children;
|
|
245
|
-
for (let i = 0, len = children.length; i < len; i++) {
|
|
246
|
-
this.addChild(children[i], cfg.inheritStates);
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
if (cfg.parentId) {
|
|
251
|
-
const parentNode = this.scene.components[cfg.parentId];
|
|
252
|
-
if (!parentNode) {
|
|
253
|
-
this.error("Parent not found: '" + cfg.parentId + "'");
|
|
254
|
-
} else if (!parentNode.isNode) {
|
|
255
|
-
this.error("Parent is not a Node: '" + cfg.parentId + "'");
|
|
256
|
-
} else {
|
|
257
|
-
parentNode.addChild(this);
|
|
258
|
-
}
|
|
259
|
-
} else if (cfg.parent) {
|
|
260
|
-
if (!cfg.parent.isNode) {
|
|
261
|
-
this.error("Parent is not a Node");
|
|
262
|
-
}
|
|
263
|
-
cfg.parent.addChild(this);
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
//------------------------------------------------------------------------------------------------------------------
|
|
268
|
-
// Entity members
|
|
269
|
-
//------------------------------------------------------------------------------------------------------------------
|
|
270
|
-
|
|
271
|
-
/**
|
|
272
|
-
* Returns true to indicate that this Component is an Entity.
|
|
273
|
-
* @type {Boolean}
|
|
274
|
-
*/
|
|
275
|
-
get isEntity() {
|
|
276
|
-
return true;
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
/**
|
|
280
|
-
* Returns ````true```` if this Mesh represents a model.
|
|
281
|
-
*
|
|
282
|
-
* When this returns ````true````, the Mesh will be registered by {@link Mesh#id} in {@link Scene#models} and
|
|
283
|
-
* may also have a corresponding {@link MetaModel}.
|
|
284
|
-
*
|
|
285
|
-
* @type {Boolean}
|
|
286
|
-
*/
|
|
287
|
-
get isModel() {
|
|
288
|
-
return this._isModel;
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
/**
|
|
292
|
-
* Returns ````true```` if this Node represents an object.
|
|
293
|
-
*
|
|
294
|
-
* When ````true```` the Node will be registered by {@link Node#id} in
|
|
295
|
-
* {@link Scene#objects} and may also have a {@link MetaObject} with matching {@link MetaObject#id}.
|
|
296
|
-
*
|
|
297
|
-
* @type {Boolean}
|
|
298
|
-
* @abstract
|
|
299
|
-
*/
|
|
300
|
-
get isObject() {
|
|
301
|
-
return this._isObject;
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
/**
|
|
305
|
-
* Gets the Node's World-space 3D axis-aligned bounding box.
|
|
306
|
-
*
|
|
307
|
-
* Represented by a six-element Float64Array containing the min/max extents of the
|
|
308
|
-
* axis-aligned volume, ie. ````[xmin, ymin,zmin,xmax,ymax, zmax]````.
|
|
309
|
-
*
|
|
310
|
-
* @type {Number[]}
|
|
311
|
-
*/
|
|
312
|
-
get aabb() {
|
|
313
|
-
if (this._aabbDirty) {
|
|
314
|
-
this._updateAABB();
|
|
315
|
-
}
|
|
316
|
-
return this._aabb;
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
/**
|
|
320
|
-
* Sets the center of the relative-to-center (RTC) coordinate system for this Node and all child Nodes and {@link Mesh}s.
|
|
321
|
-
*
|
|
322
|
-
* @type {Float64Array}
|
|
323
|
-
*/
|
|
324
|
-
set rtcCenter(rtcCenter) {
|
|
325
|
-
if (rtcCenter) {
|
|
326
|
-
if (!this._rtcCenter) {
|
|
327
|
-
this._rtcCenter = math.vec3();
|
|
328
|
-
}
|
|
329
|
-
this._rtcCenter.set(rtcCenter);
|
|
330
|
-
} else {
|
|
331
|
-
if (this._rtcCenter) {
|
|
332
|
-
this._rtcCenter = null;
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
for (let i = 0, len = this._children.length; i < len; i++) {
|
|
336
|
-
this._children[i].rtcCenter = rtcCenter;
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
/**
|
|
341
|
-
* Gets the center of the relative-to-center (RTC) coordinate system for this Node and all child Nodes and {@link Mesh}s.
|
|
342
|
-
*
|
|
343
|
-
* @type {Float64Array}
|
|
344
|
-
*/
|
|
345
|
-
get rtcCenter() {
|
|
346
|
-
return this._rtcCenter;
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
/**
|
|
350
|
-
* The number of triangles in this Node.
|
|
351
|
-
*
|
|
352
|
-
* @type {Number}
|
|
353
|
-
*/
|
|
354
|
-
get numTriangles() {
|
|
355
|
-
return this._numTriangles;
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
/**
|
|
359
|
-
* Sets if this Node and all child Nodes and {@link Mesh}es are visible.
|
|
360
|
-
*
|
|
361
|
-
* Only rendered both {@link Node#visible} is ````true```` and {@link Node#culled} is ````false````.
|
|
362
|
-
*
|
|
363
|
-
* When {@link Node#isObject} and {@link Node#visible} are both ````true```` the Node will be
|
|
364
|
-
* registered by {@link Node#id} in {@link Scene#visibleObjects}.
|
|
365
|
-
*
|
|
366
|
-
* @type {Boolean}
|
|
367
|
-
*/
|
|
368
|
-
set visible(visible) {
|
|
369
|
-
visible = visible !== false;
|
|
370
|
-
this._visible = visible;
|
|
371
|
-
for (let i = 0, len = this._children.length; i < len; i++) {
|
|
372
|
-
this._children[i].visible = visible;
|
|
373
|
-
}
|
|
374
|
-
if (this._isObject) {
|
|
375
|
-
this.scene._objectVisibilityUpdated(this, visible);
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
/**
|
|
380
|
-
* Gets if this Node is visible.
|
|
381
|
-
*
|
|
382
|
-
* Child Nodes and {@link Mesh}es may have different values for this property.
|
|
383
|
-
*
|
|
384
|
-
* When {@link Node#isObject} and {@link Node#visible} are both ````true```` the Node will be
|
|
385
|
-
* registered by {@link Node#id} in {@link Scene#visibleObjects}.
|
|
386
|
-
*
|
|
387
|
-
* @type {Boolean}
|
|
388
|
-
*/
|
|
389
|
-
get visible() {
|
|
390
|
-
return this._visible;
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
/**
|
|
394
|
-
* Sets if this Node and all child Nodes and {@link Mesh}es are xrayed.
|
|
395
|
-
*
|
|
396
|
-
* When {@link Node#isObject} and {@link Node#xrayed} are both ````true```` the Node will be
|
|
397
|
-
* registered by {@link Node#id} in {@link Scene#xrayedObjects}.
|
|
398
|
-
*
|
|
399
|
-
* @type {Boolean}
|
|
400
|
-
*/
|
|
401
|
-
set xrayed(xrayed) {
|
|
402
|
-
xrayed = !!xrayed;
|
|
403
|
-
this._xrayed = xrayed;
|
|
404
|
-
for (let i = 0, len = this._children.length; i < len; i++) {
|
|
405
|
-
this._children[i].xrayed = xrayed;
|
|
406
|
-
}
|
|
407
|
-
if (this._isObject) {
|
|
408
|
-
this.scene._objectXRayedUpdated(this, xrayed);
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
/**
|
|
413
|
-
* Gets if this Node is xrayed.
|
|
414
|
-
*
|
|
415
|
-
* When {@link Node#isObject} and {@link Node#xrayed} are both ````true```` the Node will be
|
|
416
|
-
* registered by {@link Node#id} in {@link Scene#xrayedObjects}.
|
|
417
|
-
*
|
|
418
|
-
* Child Nodes and {@link Mesh}es may have different values for this property.
|
|
419
|
-
*
|
|
420
|
-
* @type {Boolean}
|
|
421
|
-
*/
|
|
422
|
-
get xrayed() {
|
|
423
|
-
return this._xrayed;
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
/**
|
|
427
|
-
* Sets if this Node and all child Nodes and {@link Mesh}es are highlighted.
|
|
428
|
-
*
|
|
429
|
-
* When {@link Node#isObject} and {@link Node#highlighted} are both ````true```` the Node will be
|
|
430
|
-
* registered by {@link Node#id} in {@link Scene#highlightedObjects}.
|
|
431
|
-
*
|
|
432
|
-
* @type {Boolean}
|
|
433
|
-
*/
|
|
434
|
-
set highlighted(highlighted) {
|
|
435
|
-
highlighted = !!highlighted;
|
|
436
|
-
this._highlighted = highlighted;
|
|
437
|
-
for (let i = 0, len = this._children.length; i < len; i++) {
|
|
438
|
-
this._children[i].highlighted = highlighted;
|
|
439
|
-
}
|
|
440
|
-
if (this._isObject) {
|
|
441
|
-
this.scene._objectHighlightedUpdated(this, highlighted);
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
/**
|
|
446
|
-
* Gets if this Node is highlighted.
|
|
447
|
-
*
|
|
448
|
-
* When {@link Node#isObject} and {@link Node#highlighted} are both ````true```` the Node will be
|
|
449
|
-
* registered by {@link Node#id} in {@link Scene#highlightedObjects}.
|
|
450
|
-
*
|
|
451
|
-
* Child Nodes and {@link Mesh}es may have different values for this property.
|
|
452
|
-
*
|
|
453
|
-
* @type {Boolean}
|
|
454
|
-
*/
|
|
455
|
-
get highlighted() {
|
|
456
|
-
return this._highlighted;
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
/**
|
|
460
|
-
* Sets if this Node and all child Nodes and {@link Mesh}es are selected.
|
|
461
|
-
*
|
|
462
|
-
* When {@link Node#isObject} and {@link Node#selected} are both ````true```` the Node will be
|
|
463
|
-
* registered by {@link Node#id} in {@link Scene#selectedObjects}.
|
|
464
|
-
*
|
|
465
|
-
* @type {Boolean}
|
|
466
|
-
*/
|
|
467
|
-
set selected(selected) {
|
|
468
|
-
selected = !!selected;
|
|
469
|
-
this._selected = selected;
|
|
470
|
-
for (let i = 0, len = this._children.length; i < len; i++) {
|
|
471
|
-
this._children[i].selected = selected;
|
|
472
|
-
}
|
|
473
|
-
if (this._isObject) {
|
|
474
|
-
this.scene._objectSelectedUpdated(this, selected);
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
/**
|
|
479
|
-
* Gets if this Node is selected.
|
|
480
|
-
*
|
|
481
|
-
* When {@link Node#isObject} and {@link Node#selected} are both ````true```` the Node will be
|
|
482
|
-
* registered by {@link Node#id} in {@link Scene#selectedObjects}.
|
|
483
|
-
*
|
|
484
|
-
* Child Nodes and {@link Mesh}es may have different values for this property.
|
|
485
|
-
*
|
|
486
|
-
* @type {Boolean}
|
|
487
|
-
*/
|
|
488
|
-
get selected() {
|
|
489
|
-
return this._selected;
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
/**
|
|
493
|
-
* Sets if this Node and all child Nodes and {@link Mesh}es are edge-enhanced.
|
|
494
|
-
*
|
|
495
|
-
* @type {Boolean}
|
|
496
|
-
*/
|
|
497
|
-
set edges(edges) {
|
|
498
|
-
edges = !!edges;
|
|
499
|
-
this._edges = edges;
|
|
500
|
-
for (let i = 0, len = this._children.length; i < len; i++) {
|
|
501
|
-
this._children[i].edges = edges;
|
|
502
|
-
}
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
/**
|
|
506
|
-
* Gets if this Node's edges are enhanced.
|
|
507
|
-
*
|
|
508
|
-
* Child Nodes and {@link Mesh}es may have different values for this property.
|
|
509
|
-
*
|
|
510
|
-
* @type {Boolean}
|
|
511
|
-
*/
|
|
512
|
-
get edges() {
|
|
513
|
-
return this._edges;
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
/**
|
|
517
|
-
* Sets if this Node and all child Nodes and {@link Mesh}es are culled.
|
|
518
|
-
*
|
|
519
|
-
* @type {Boolean}
|
|
520
|
-
*/
|
|
521
|
-
set culled(culled) {
|
|
522
|
-
culled = !!culled;
|
|
523
|
-
this._culled = culled;
|
|
524
|
-
for (let i = 0, len = this._children.length; i < len; i++) {
|
|
525
|
-
this._children[i].culled = culled;
|
|
526
|
-
}
|
|
527
|
-
}
|
|
528
|
-
|
|
529
|
-
/**
|
|
530
|
-
* Gets if this Node is culled.
|
|
531
|
-
*
|
|
532
|
-
* @type {Boolean}
|
|
533
|
-
*/
|
|
534
|
-
get culled() {
|
|
535
|
-
return this._culled;
|
|
536
|
-
}
|
|
537
|
-
|
|
538
|
-
/**
|
|
539
|
-
* Sets if this Node and all child Nodes and {@link Mesh}es are clippable.
|
|
540
|
-
*
|
|
541
|
-
* Clipping is done by the {@link SectionPlane}s in {@link Scene#clips}.
|
|
542
|
-
*
|
|
543
|
-
* @type {Boolean}
|
|
544
|
-
*/
|
|
545
|
-
set clippable(clippable) {
|
|
546
|
-
clippable = clippable !== false;
|
|
547
|
-
this._clippable = clippable;
|
|
548
|
-
for (let i = 0, len = this._children.length; i < len; i++) {
|
|
549
|
-
this._children[i].clippable = clippable;
|
|
550
|
-
}
|
|
551
|
-
}
|
|
552
|
-
|
|
553
|
-
/**
|
|
554
|
-
* Gets if this Node is clippable.
|
|
555
|
-
*
|
|
556
|
-
* Clipping is done by the {@link SectionPlane}s in {@link Scene#clips}.
|
|
557
|
-
*
|
|
558
|
-
* Child Nodes and {@link Mesh}es may have different values for this property.
|
|
559
|
-
*
|
|
560
|
-
* @type {Boolean}
|
|
561
|
-
*/
|
|
562
|
-
get clippable() {
|
|
563
|
-
return this._clippable;
|
|
564
|
-
}
|
|
565
|
-
|
|
566
|
-
/**
|
|
567
|
-
* Sets if this Node and all child Nodes and {@link Mesh}es are included in boundary calculations.
|
|
568
|
-
*
|
|
569
|
-
* @type {Boolean}
|
|
570
|
-
*/
|
|
571
|
-
set collidable(collidable) {
|
|
572
|
-
collidable = collidable !== false;
|
|
573
|
-
this._collidable = collidable;
|
|
574
|
-
for (let i = 0, len = this._children.length; i < len; i++) {
|
|
575
|
-
this._children[i].collidable = collidable;
|
|
576
|
-
}
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
/**
|
|
580
|
-
* Gets if this Node is included in boundary calculations.
|
|
581
|
-
*
|
|
582
|
-
* Child Nodes and {@link Mesh}es may have different values for this property.
|
|
583
|
-
*
|
|
584
|
-
* @type {Boolean}
|
|
585
|
-
*/
|
|
586
|
-
get collidable() {
|
|
587
|
-
return this._collidable;
|
|
588
|
-
}
|
|
589
|
-
|
|
590
|
-
/**
|
|
591
|
-
* Sets if this Node and all child Nodes and {@link Mesh}es are pickable.
|
|
592
|
-
*
|
|
593
|
-
* Picking is done via calls to {@link Scene#pick}.
|
|
594
|
-
*
|
|
595
|
-
* @type {Boolean}
|
|
596
|
-
*/
|
|
597
|
-
set pickable(pickable) {
|
|
598
|
-
pickable = pickable !== false;
|
|
599
|
-
this._pickable = pickable;
|
|
600
|
-
for (let i = 0, len = this._children.length; i < len; i++) {
|
|
601
|
-
this._children[i].pickable = pickable;
|
|
602
|
-
}
|
|
603
|
-
}
|
|
604
|
-
|
|
605
|
-
/**
|
|
606
|
-
* Gets if to this Node is pickable.
|
|
607
|
-
*
|
|
608
|
-
* Picking is done via calls to {@link Scene#pick}.
|
|
609
|
-
*
|
|
610
|
-
* Child Nodes and {@link Mesh}es may have different values for this property.
|
|
611
|
-
*
|
|
612
|
-
* @type {Boolean}
|
|
613
|
-
*/
|
|
614
|
-
get pickable() {
|
|
615
|
-
return this._pickable;
|
|
616
|
-
}
|
|
617
|
-
|
|
618
|
-
/**
|
|
619
|
-
* Sets the RGB colorize color for this Node and all child Nodes and {@link Mesh}es}.
|
|
620
|
-
*
|
|
621
|
-
* Multiplies by rendered fragment colors.
|
|
622
|
-
*
|
|
623
|
-
* Each element of the color is in range ````[0..1]````.
|
|
624
|
-
*
|
|
625
|
-
* @type {Number[]}
|
|
626
|
-
*/
|
|
627
|
-
set colorize(rgb) {
|
|
628
|
-
let colorize = this._colorize;
|
|
629
|
-
if (!colorize) {
|
|
630
|
-
colorize = this._colorize = new Float32Array(4);
|
|
631
|
-
colorize[3] = 1.0;
|
|
632
|
-
}
|
|
633
|
-
if (rgb) {
|
|
634
|
-
colorize[0] = rgb[0];
|
|
635
|
-
colorize[1] = rgb[1];
|
|
636
|
-
colorize[2] = rgb[2];
|
|
637
|
-
} else {
|
|
638
|
-
colorize[0] = 1;
|
|
639
|
-
colorize[1] = 1;
|
|
640
|
-
colorize[2] = 1;
|
|
641
|
-
}
|
|
642
|
-
for (let i = 0, len = this._children.length; i < len; i++) {
|
|
643
|
-
this._children[i].colorize = colorize;
|
|
644
|
-
}
|
|
645
|
-
if (this._isObject) {
|
|
646
|
-
const colorized = (!!rgb);
|
|
647
|
-
this.scene._objectColorizeUpdated(this, colorized);
|
|
648
|
-
}
|
|
649
|
-
}
|
|
650
|
-
|
|
651
|
-
/**
|
|
652
|
-
* Gets the RGB colorize color for this Node.
|
|
653
|
-
*
|
|
654
|
-
* Each element of the color is in range ````[0..1]````.
|
|
655
|
-
*
|
|
656
|
-
* Child Nodes and {@link Mesh}es may have different values for this property.
|
|
657
|
-
*
|
|
658
|
-
* @type {Number[]}
|
|
659
|
-
*/
|
|
660
|
-
get colorize() {
|
|
661
|
-
return this._colorize.slice(0, 3);
|
|
662
|
-
}
|
|
663
|
-
|
|
664
|
-
/**
|
|
665
|
-
* Sets the opacity factor for this Node and all child Nodes and {@link Mesh}es.
|
|
666
|
-
*
|
|
667
|
-
* This is a factor in range ````[0..1]```` which multiplies by the rendered fragment alphas.
|
|
668
|
-
*
|
|
669
|
-
* @type {Number}
|
|
670
|
-
*/
|
|
671
|
-
set opacity(opacity) {
|
|
672
|
-
let colorize = this._colorize;
|
|
673
|
-
if (!colorize) {
|
|
674
|
-
colorize = this._colorize = new Float32Array(4);
|
|
675
|
-
colorize[0] = 1;
|
|
676
|
-
colorize[1] = 1;
|
|
677
|
-
colorize[2] = 1;
|
|
678
|
-
}
|
|
679
|
-
colorize[3] = opacity !== null && opacity !== undefined ? opacity : 1.0;
|
|
680
|
-
for (let i = 0, len = this._children.length; i < len; i++) {
|
|
681
|
-
this._children[i].opacity = opacity;
|
|
682
|
-
}
|
|
683
|
-
if (this._isObject) {
|
|
684
|
-
const opacityUpdated = (opacity !== null && opacity !== undefined);
|
|
685
|
-
this.scene._objectOpacityUpdated(this, opacityUpdated);
|
|
686
|
-
}
|
|
687
|
-
}
|
|
688
|
-
|
|
689
|
-
/**
|
|
690
|
-
* Gets this Node's opacity factor.
|
|
691
|
-
*
|
|
692
|
-
* This is a factor in range ````[0..1]```` which multiplies by the rendered fragment alphas.
|
|
693
|
-
*
|
|
694
|
-
* Child Nodes and {@link Mesh}es may have different values for this property.
|
|
695
|
-
*
|
|
696
|
-
* @type {Number}
|
|
697
|
-
*/
|
|
698
|
-
get opacity() {
|
|
699
|
-
return this._colorize[3];
|
|
700
|
-
}
|
|
701
|
-
|
|
702
|
-
/**
|
|
703
|
-
* Sets if this Node and all child Nodes and {@link Mesh}es cast shadows.
|
|
704
|
-
*
|
|
705
|
-
* @type {Boolean}
|
|
706
|
-
*/
|
|
707
|
-
set castsShadow(castsShadow) {
|
|
708
|
-
castsShadow = !!castsShadow;
|
|
709
|
-
this._castsShadow = castsShadow;
|
|
710
|
-
for (let i = 0, len = this._children.length; i < len; i++) {
|
|
711
|
-
this._children[i].castsShadow = castsShadow;
|
|
712
|
-
}
|
|
713
|
-
}
|
|
714
|
-
|
|
715
|
-
/**
|
|
716
|
-
* Gets if this Node casts shadows.
|
|
717
|
-
*
|
|
718
|
-
* Child Nodes and {@link Mesh}es may have different values for this property.
|
|
719
|
-
*
|
|
720
|
-
* @type {Boolean}
|
|
721
|
-
*/
|
|
722
|
-
get castsShadow() {
|
|
723
|
-
return this._castsShadow;
|
|
724
|
-
}
|
|
725
|
-
|
|
726
|
-
/**
|
|
727
|
-
* Sets if this Node and all child Nodes and {@link Mesh}es can have shadows cast upon them.
|
|
728
|
-
*
|
|
729
|
-
* @type {Boolean}
|
|
730
|
-
*/
|
|
731
|
-
set receivesShadow(receivesShadow) {
|
|
732
|
-
receivesShadow = !!receivesShadow;
|
|
733
|
-
this._receivesShadow = receivesShadow;
|
|
734
|
-
for (let i = 0, len = this._children.length; i < len; i++) {
|
|
735
|
-
this._children[i].receivesShadow = receivesShadow;
|
|
736
|
-
}
|
|
737
|
-
}
|
|
738
|
-
|
|
739
|
-
/**
|
|
740
|
-
* Whether or not to this Node can have shadows cast upon it.
|
|
741
|
-
*
|
|
742
|
-
* Child Nodes and {@link Mesh}es may have different values for this property.
|
|
743
|
-
*
|
|
744
|
-
* @type {Boolean}
|
|
745
|
-
*/
|
|
746
|
-
get receivesShadow() {
|
|
747
|
-
return this._receivesShadow;
|
|
748
|
-
}
|
|
749
|
-
|
|
750
|
-
/**
|
|
751
|
-
* Gets if this Node can have Scalable Ambient Obscurance (SAO) applied to it.
|
|
752
|
-
*
|
|
753
|
-
* SAO is configured by {@link SAO}.
|
|
754
|
-
*
|
|
755
|
-
* @type {Boolean}
|
|
756
|
-
* @abstract
|
|
757
|
-
*/
|
|
758
|
-
get saoEnabled() {
|
|
759
|
-
return false; // TODO: Support SAO on Nodes
|
|
760
|
-
}
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
/**
|
|
764
|
-
* Sets the 3D World-space offset for this Node and all child Nodes and {@link Mesh}es}.
|
|
765
|
-
*
|
|
766
|
-
* The offset dynamically translates those components in World-space.
|
|
767
|
-
*
|
|
768
|
-
* Default value is ````[0, 0, 0]````.
|
|
769
|
-
*
|
|
770
|
-
* Note that child Nodes and {@link Mesh}es may subsequently be given different values for this property.
|
|
771
|
-
*
|
|
772
|
-
* @type {Number[]}
|
|
773
|
-
*/
|
|
774
|
-
set offset(offset) {
|
|
775
|
-
if (offset) {
|
|
776
|
-
this._offset[0] = offset[0];
|
|
777
|
-
this._offset[1] = offset[1];
|
|
778
|
-
this._offset[2] = offset[2];
|
|
779
|
-
} else {
|
|
780
|
-
this._offset[0] = 0;
|
|
781
|
-
this._offset[1] = 0;
|
|
782
|
-
this._offset[2] = 0;
|
|
783
|
-
}
|
|
784
|
-
for (let i = 0, len = this._children.length; i < len; i++) {
|
|
785
|
-
this._children[i].offset = this._offset;
|
|
786
|
-
}
|
|
787
|
-
if (this._isObject) {
|
|
788
|
-
this.scene._objectOffsetUpdated(this, offset);
|
|
789
|
-
}
|
|
790
|
-
}
|
|
791
|
-
|
|
792
|
-
/**
|
|
793
|
-
* Gets the Node's 3D World-space offset.
|
|
794
|
-
*
|
|
795
|
-
* Default value is ````[0, 0, 0]````.
|
|
796
|
-
*
|
|
797
|
-
* Child Nodes and {@link Mesh}es may have different values for this property.
|
|
798
|
-
*
|
|
799
|
-
* @type {Number[]}
|
|
800
|
-
*/
|
|
801
|
-
get offset() {
|
|
802
|
-
return this._offset;
|
|
803
|
-
}
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
//------------------------------------------------------------------------------------------------------------------
|
|
807
|
-
// Node members
|
|
808
|
-
//------------------------------------------------------------------------------------------------------------------
|
|
809
|
-
|
|
810
|
-
/**
|
|
811
|
-
* Returns true to indicate that this Component is a Node.
|
|
812
|
-
* @type {Boolean}
|
|
813
|
-
*/
|
|
814
|
-
get isNode() {
|
|
815
|
-
return true;
|
|
816
|
-
}
|
|
817
|
-
|
|
818
|
-
_setLocalMatrixDirty() {
|
|
819
|
-
this._localMatrixDirty = true;
|
|
820
|
-
this._setWorldMatrixDirty();
|
|
821
|
-
}
|
|
822
|
-
|
|
823
|
-
_setWorldMatrixDirty() {
|
|
824
|
-
this._worldMatrixDirty = true;
|
|
825
|
-
for (let i = 0, len = this._children.length; i < len; i++) {
|
|
826
|
-
this._children[i]._setWorldMatrixDirty();
|
|
827
|
-
}
|
|
828
|
-
}
|
|
829
|
-
|
|
830
|
-
_buildWorldMatrix() {
|
|
831
|
-
const localMatrix = this.matrix;
|
|
832
|
-
if (!this._parentNode) {
|
|
833
|
-
for (let i = 0, len = localMatrix.length; i < len; i++) {
|
|
834
|
-
this._worldMatrix[i] = localMatrix[i];
|
|
835
|
-
}
|
|
836
|
-
} else {
|
|
837
|
-
math.mulMat4(this._parentNode.worldMatrix, localMatrix, this._worldMatrix);
|
|
838
|
-
}
|
|
839
|
-
this._worldMatrixDirty = false;
|
|
840
|
-
}
|
|
841
|
-
|
|
842
|
-
_setSubtreeAABBsDirty(node) {
|
|
843
|
-
node._aabbDirty = true;
|
|
844
|
-
if (node._children) {
|
|
845
|
-
for (let i = 0, len = node._children.length; i < len; i++) {
|
|
846
|
-
this._setSubtreeAABBsDirty(node._children[i]);
|
|
847
|
-
}
|
|
848
|
-
}
|
|
849
|
-
}
|
|
850
|
-
|
|
851
|
-
_setAABBDirty() {
|
|
852
|
-
this._setSubtreeAABBsDirty(this);
|
|
853
|
-
if (this.collidable) {
|
|
854
|
-
for (let node = this; node; node = node._parentNode) {
|
|
855
|
-
node._aabbDirty = true;
|
|
856
|
-
}
|
|
857
|
-
}
|
|
858
|
-
}
|
|
859
|
-
|
|
860
|
-
_updateAABB() {
|
|
861
|
-
this.scene._aabbDirty = true;
|
|
862
|
-
if (!this._aabb) {
|
|
863
|
-
this._aabb = math.AABB3();
|
|
864
|
-
}
|
|
865
|
-
if (this._buildAABB) {
|
|
866
|
-
this._buildAABB(this.worldMatrix, this._aabb); // Mesh or PerformanceModel
|
|
867
|
-
} else { // Node | Node | Model
|
|
868
|
-
math.collapseAABB3(this._aabb);
|
|
869
|
-
let node;
|
|
870
|
-
for (let i = 0, len = this._children.length; i < len; i++) {
|
|
871
|
-
node = this._children[i];
|
|
872
|
-
if (!node.collidable) {
|
|
873
|
-
continue;
|
|
874
|
-
}
|
|
875
|
-
math.expandAABB3(this._aabb, node.aabb);
|
|
876
|
-
}
|
|
877
|
-
}
|
|
878
|
-
this._aabbDirty = false;
|
|
879
|
-
}
|
|
880
|
-
|
|
881
|
-
/**
|
|
882
|
-
* Adds a child Node or {@link Mesh}.
|
|
883
|
-
*
|
|
884
|
-
* The child must be a Node or {@link Mesh} in the same {@link Scene}.
|
|
885
|
-
*
|
|
886
|
-
* If the child already has a parent, will be removed from that parent first.
|
|
887
|
-
*
|
|
888
|
-
* Does nothing if already a child.
|
|
889
|
-
*
|
|
890
|
-
* @param {Node|Mesh|String} child Instance or ID of the child to add.
|
|
891
|
-
* @param [inheritStates=false] Indicates if the child should inherit rendering states from this parent as it is added. Rendering state includes {@link Node#visible}, {@link Node#culled}, {@link Node#pickable}, {@link Node#clippable}, {@link Node#castsShadow}, {@link Node#receivesShadow}, {@link Node#selected}, {@link Node#highlighted}, {@link Node#colorize} and {@link Node#opacity}.
|
|
892
|
-
* @returns {Node|Mesh} The child.
|
|
893
|
-
*/
|
|
894
|
-
addChild(child, inheritStates) {
|
|
895
|
-
if (utils.isNumeric(child) || utils.isString(child)) {
|
|
896
|
-
const nodeId = child;
|
|
897
|
-
child = this.scene.component[nodeId];
|
|
898
|
-
if (!child) {
|
|
899
|
-
this.warn("Component not found: " + utils.inQuotes(nodeId));
|
|
900
|
-
return;
|
|
901
|
-
}
|
|
902
|
-
if (!child.isNode && !child.isMesh) {
|
|
903
|
-
this.error("Not a Node or Mesh: " + nodeId);
|
|
904
|
-
return;
|
|
905
|
-
}
|
|
906
|
-
} else {
|
|
907
|
-
if (!child.isNode && !child.isMesh) {
|
|
908
|
-
this.error("Not a Node or Mesh: " + child.id);
|
|
909
|
-
return;
|
|
910
|
-
}
|
|
911
|
-
if (child._parentNode) {
|
|
912
|
-
if (child._parentNode.id === this.id) {
|
|
913
|
-
this.warn("Already a child: " + child.id);
|
|
914
|
-
return;
|
|
915
|
-
}
|
|
916
|
-
child._parentNode.removeChild(child);
|
|
917
|
-
}
|
|
918
|
-
}
|
|
919
|
-
const id = child.id;
|
|
920
|
-
if (child.scene.id !== this.scene.id) {
|
|
921
|
-
this.error("Child not in same Scene: " + child.id);
|
|
922
|
-
return;
|
|
923
|
-
}
|
|
924
|
-
this._children.push(child);
|
|
925
|
-
child._parentNode = this;
|
|
926
|
-
if (!!inheritStates) {
|
|
927
|
-
child.visible = this.visible;
|
|
928
|
-
child.culled = this.culled;
|
|
929
|
-
child.xrayed = this.xrayed;
|
|
930
|
-
child.highlited = this.highlighted;
|
|
931
|
-
child.selected = this.selected;
|
|
932
|
-
child.edges = this.edges;
|
|
933
|
-
child.clippable = this.clippable;
|
|
934
|
-
child.pickable = this.pickable;
|
|
935
|
-
child.collidable = this.collidable;
|
|
936
|
-
child.castsShadow = this.castsShadow;
|
|
937
|
-
child.receivesShadow = this.receivesShadow;
|
|
938
|
-
child.colorize = this.colorize;
|
|
939
|
-
child.opacity = this.opacity;
|
|
940
|
-
child.offset = this.offset;
|
|
941
|
-
}
|
|
942
|
-
child._setWorldMatrixDirty();
|
|
943
|
-
child._setAABBDirty();
|
|
944
|
-
this._numTriangles += child.numTriangles;
|
|
945
|
-
return child;
|
|
946
|
-
}
|
|
947
|
-
|
|
948
|
-
/**
|
|
949
|
-
* Removes the given child Node or {@link Mesh}.
|
|
950
|
-
*
|
|
951
|
-
* @param {Node|Mesh} child Child to remove.
|
|
952
|
-
*/
|
|
953
|
-
removeChild(child) {
|
|
954
|
-
for (let i = 0, len = this._children.length; i < len; i++) {
|
|
955
|
-
if (this._children[i].id === child.id) {
|
|
956
|
-
child._parentNode = null;
|
|
957
|
-
this._children = this._children.splice(i, 1);
|
|
958
|
-
child._setWorldMatrixDirty();
|
|
959
|
-
child._setAABBDirty();
|
|
960
|
-
this._setAABBDirty();
|
|
961
|
-
this._numTriangles -= child.numTriangles;
|
|
962
|
-
return;
|
|
963
|
-
}
|
|
964
|
-
}
|
|
965
|
-
}
|
|
966
|
-
|
|
967
|
-
/**
|
|
968
|
-
* Removes all child Nodes and {@link Mesh}es.
|
|
969
|
-
*/
|
|
970
|
-
removeChildren() {
|
|
971
|
-
let child;
|
|
972
|
-
for (let i = 0, len = this._children.length; i < len; i++) {
|
|
973
|
-
child = this._children[i];
|
|
974
|
-
child._parentNode = null;
|
|
975
|
-
child._setWorldMatrixDirty();
|
|
976
|
-
child._setAABBDirty();
|
|
977
|
-
this._numTriangles -= child.numTriangles;
|
|
978
|
-
}
|
|
979
|
-
this._children = [];
|
|
980
|
-
this._setAABBDirty();
|
|
981
|
-
}
|
|
982
|
-
|
|
983
|
-
/**
|
|
984
|
-
* Number of child Nodes or {@link Mesh}es.
|
|
985
|
-
*
|
|
986
|
-
* @type {Number}
|
|
987
|
-
*/
|
|
988
|
-
get numChildren() {
|
|
989
|
-
return this._children.length;
|
|
990
|
-
}
|
|
991
|
-
|
|
992
|
-
/**
|
|
993
|
-
* Array of child Nodes or {@link Mesh}es.
|
|
994
|
-
*
|
|
995
|
-
* @type {Array}
|
|
996
|
-
*/
|
|
997
|
-
get children() {
|
|
998
|
-
return this._children;
|
|
999
|
-
}
|
|
1000
|
-
|
|
1001
|
-
/**
|
|
1002
|
-
* The parent Node.
|
|
1003
|
-
*
|
|
1004
|
-
* The parent Node may also be set by passing the Node to the parent's {@link Node#addChild} method.
|
|
1005
|
-
*
|
|
1006
|
-
* @type {Node}
|
|
1007
|
-
*/
|
|
1008
|
-
set parent(node) {
|
|
1009
|
-
if (utils.isNumeric(node) || utils.isString(node)) {
|
|
1010
|
-
const nodeId = node;
|
|
1011
|
-
node = this.scene.components[nodeId];
|
|
1012
|
-
if (!node) {
|
|
1013
|
-
this.warn("Node not found: " + utils.inQuotes(nodeId));
|
|
1014
|
-
return;
|
|
1015
|
-
}
|
|
1016
|
-
if (!node.isNode) {
|
|
1017
|
-
this.error("Not a Node: " + node.id);
|
|
1018
|
-
return;
|
|
1019
|
-
}
|
|
1020
|
-
}
|
|
1021
|
-
if (node.scene.id !== this.scene.id) {
|
|
1022
|
-
this.error("Node not in same Scene: " + node.id);
|
|
1023
|
-
return;
|
|
1024
|
-
}
|
|
1025
|
-
if (this._parentNode && this._parentNode.id === node.id) {
|
|
1026
|
-
this.warn("Already a child of Node: " + node.id);
|
|
1027
|
-
return;
|
|
1028
|
-
}
|
|
1029
|
-
node.addChild(this);
|
|
1030
|
-
}
|
|
1031
|
-
|
|
1032
|
-
/**
|
|
1033
|
-
* The parent Node.
|
|
1034
|
-
*
|
|
1035
|
-
* @type {Node}
|
|
1036
|
-
*/
|
|
1037
|
-
get parent() {
|
|
1038
|
-
return this._parentNode;
|
|
1039
|
-
}
|
|
1040
|
-
|
|
1041
|
-
/**
|
|
1042
|
-
* Sets the Node's local translation.
|
|
1043
|
-
*
|
|
1044
|
-
* Default value is ````[0,0,0]````.
|
|
1045
|
-
*
|
|
1046
|
-
* @type {Number[]}
|
|
1047
|
-
*/
|
|
1048
|
-
set position(value) {
|
|
1049
|
-
this._position.set(value || [0, 0, 0]);
|
|
1050
|
-
this._setLocalMatrixDirty();
|
|
1051
|
-
this._setAABBDirty();
|
|
1052
|
-
this.glRedraw();
|
|
1053
|
-
}
|
|
1054
|
-
|
|
1055
|
-
/**
|
|
1056
|
-
* Gets the Node's local translation.
|
|
1057
|
-
*
|
|
1058
|
-
* Default value is ````[0,0,0]````.
|
|
1059
|
-
*
|
|
1060
|
-
* @type {Number[]}
|
|
1061
|
-
*/
|
|
1062
|
-
get position() {
|
|
1063
|
-
return this._position;
|
|
1064
|
-
}
|
|
1065
|
-
|
|
1066
|
-
/**
|
|
1067
|
-
* Sets the Node's local rotation, as Euler angles given in degrees, for each of the X, Y and Z axis.
|
|
1068
|
-
*
|
|
1069
|
-
* Default value is ````[0,0,0]````.
|
|
1070
|
-
*
|
|
1071
|
-
* @type {Number[]}
|
|
1072
|
-
*/
|
|
1073
|
-
set rotation(value) {
|
|
1074
|
-
this._rotation.set(value || [0, 0, 0]);
|
|
1075
|
-
math.eulerToQuaternion(this._rotation, "XYZ", this._quaternion);
|
|
1076
|
-
this._setLocalMatrixDirty();
|
|
1077
|
-
this._setAABBDirty();
|
|
1078
|
-
this.glRedraw();
|
|
1079
|
-
}
|
|
1080
|
-
|
|
1081
|
-
/**
|
|
1082
|
-
* Gets the Node's local rotation, as Euler angles given in degrees, for each of the X, Y and Z axis.
|
|
1083
|
-
*
|
|
1084
|
-
* Default value is ````[0,0,0]````.
|
|
1085
|
-
*
|
|
1086
|
-
* @type {Number[]}
|
|
1087
|
-
*/
|
|
1088
|
-
get rotation() {
|
|
1089
|
-
return this._rotation;
|
|
1090
|
-
}
|
|
1091
|
-
|
|
1092
|
-
/**
|
|
1093
|
-
* Sets the Node's local rotation quaternion.
|
|
1094
|
-
*
|
|
1095
|
-
* Default value is ````[0,0,0,1]````.
|
|
1096
|
-
*
|
|
1097
|
-
* @type {Number[]}
|
|
1098
|
-
*/
|
|
1099
|
-
set quaternion(value) {
|
|
1100
|
-
this._quaternion.set(value || [0, 0, 0, 1]);
|
|
1101
|
-
math.quaternionToEuler(this._quaternion, "XYZ", this._rotation);
|
|
1102
|
-
this._setLocalMatrixDirty();
|
|
1103
|
-
this._setAABBDirty();
|
|
1104
|
-
this.glRedraw();
|
|
1105
|
-
}
|
|
1106
|
-
|
|
1107
|
-
/**
|
|
1108
|
-
* Gets the Node's local rotation quaternion.
|
|
1109
|
-
*
|
|
1110
|
-
* Default value is ````[0,0,0,1]````.
|
|
1111
|
-
*
|
|
1112
|
-
* @type {Number[]}
|
|
1113
|
-
*/
|
|
1114
|
-
get quaternion() {
|
|
1115
|
-
return this._quaternion;
|
|
1116
|
-
}
|
|
1117
|
-
|
|
1118
|
-
/**
|
|
1119
|
-
* Sets the Node's local scale.
|
|
1120
|
-
*
|
|
1121
|
-
* Default value is ````[1,1,1]````.
|
|
1122
|
-
*
|
|
1123
|
-
* @type {Number[]}
|
|
1124
|
-
*/
|
|
1125
|
-
set scale(value) {
|
|
1126
|
-
this._scale.set(value || [1, 1, 1]);
|
|
1127
|
-
this._setLocalMatrixDirty();
|
|
1128
|
-
this._setAABBDirty();
|
|
1129
|
-
this.glRedraw();
|
|
1130
|
-
}
|
|
1131
|
-
|
|
1132
|
-
/**
|
|
1133
|
-
* Gets the Node's local scale.
|
|
1134
|
-
*
|
|
1135
|
-
* Default value is ````[1,1,1]````.
|
|
1136
|
-
*
|
|
1137
|
-
* @type {Number[]}
|
|
1138
|
-
*/
|
|
1139
|
-
get scale() {
|
|
1140
|
-
return this._scale;
|
|
1141
|
-
}
|
|
1142
|
-
|
|
1143
|
-
/**
|
|
1144
|
-
* Sets the Node's local modeling transform matrix.
|
|
1145
|
-
*
|
|
1146
|
-
* Default value is ````[1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]````.
|
|
1147
|
-
*
|
|
1148
|
-
* @type {Number[]}
|
|
1149
|
-
*/
|
|
1150
|
-
set matrix(value) {
|
|
1151
|
-
if (!this._localMatrix) {
|
|
1152
|
-
this._localMatrix = math.identityMat4();
|
|
1153
|
-
}
|
|
1154
|
-
this._localMatrix.set(value || identityMat);
|
|
1155
|
-
math.decomposeMat4(this._localMatrix, this._position, this._quaternion, this._scale);
|
|
1156
|
-
this._localMatrixDirty = false;
|
|
1157
|
-
this._setWorldMatrixDirty();
|
|
1158
|
-
this._setAABBDirty();
|
|
1159
|
-
this.glRedraw();
|
|
1160
|
-
}
|
|
1161
|
-
|
|
1162
|
-
/**
|
|
1163
|
-
* Gets the Node's local modeling transform matrix.
|
|
1164
|
-
*
|
|
1165
|
-
* Default value is ````[1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]````.
|
|
1166
|
-
*
|
|
1167
|
-
* @type {Number[]}
|
|
1168
|
-
*/
|
|
1169
|
-
get matrix() {
|
|
1170
|
-
if (this._localMatrixDirty) {
|
|
1171
|
-
if (!this._localMatrix) {
|
|
1172
|
-
this._localMatrix = math.identityMat4();
|
|
1173
|
-
}
|
|
1174
|
-
math.composeMat4(this._position, this._quaternion, this._scale, this._localMatrix);
|
|
1175
|
-
this._localMatrixDirty = false;
|
|
1176
|
-
}
|
|
1177
|
-
return this._localMatrix;
|
|
1178
|
-
}
|
|
1179
|
-
|
|
1180
|
-
/**
|
|
1181
|
-
* Gets the Node's World matrix.
|
|
1182
|
-
*
|
|
1183
|
-
* @property worldMatrix
|
|
1184
|
-
* @type {Number[]}
|
|
1185
|
-
*/
|
|
1186
|
-
get worldMatrix() {
|
|
1187
|
-
if (this._worldMatrixDirty) {
|
|
1188
|
-
this._buildWorldMatrix();
|
|
1189
|
-
}
|
|
1190
|
-
return this._worldMatrix;
|
|
1191
|
-
}
|
|
1192
|
-
|
|
1193
|
-
/**
|
|
1194
|
-
* Rotates the Node about the given local axis by the given increment.
|
|
1195
|
-
*
|
|
1196
|
-
* @param {Number[]} axis Local axis about which to rotate.
|
|
1197
|
-
* @param {Number} angle Angle increment in degrees.
|
|
1198
|
-
*/
|
|
1199
|
-
rotate(axis, angle) {
|
|
1200
|
-
angleAxis[0] = axis[0];
|
|
1201
|
-
angleAxis[1] = axis[1];
|
|
1202
|
-
angleAxis[2] = axis[2];
|
|
1203
|
-
angleAxis[3] = angle * math.DEGTORAD;
|
|
1204
|
-
math.angleAxisToQuaternion(angleAxis, q1);
|
|
1205
|
-
math.mulQuaternions(this.quaternion, q1, q2);
|
|
1206
|
-
this.quaternion = q2;
|
|
1207
|
-
this._setLocalMatrixDirty();
|
|
1208
|
-
this._setAABBDirty();
|
|
1209
|
-
this.glRedraw();
|
|
1210
|
-
return this;
|
|
1211
|
-
}
|
|
1212
|
-
|
|
1213
|
-
/**
|
|
1214
|
-
* Rotates the Node about the given World-space axis by the given increment.
|
|
1215
|
-
*
|
|
1216
|
-
* @param {Number[]} axis Local axis about which to rotate.
|
|
1217
|
-
* @param {Number} angle Angle increment in degrees.
|
|
1218
|
-
*/
|
|
1219
|
-
rotateOnWorldAxis(axis, angle) {
|
|
1220
|
-
angleAxis[0] = axis[0];
|
|
1221
|
-
angleAxis[1] = axis[1];
|
|
1222
|
-
angleAxis[2] = axis[2];
|
|
1223
|
-
angleAxis[3] = angle * math.DEGTORAD;
|
|
1224
|
-
math.angleAxisToQuaternion(angleAxis, q1);
|
|
1225
|
-
math.mulQuaternions(q1, this.quaternion, q1);
|
|
1226
|
-
//this.quaternion.premultiply(q1);
|
|
1227
|
-
return this;
|
|
1228
|
-
}
|
|
1229
|
-
|
|
1230
|
-
/**
|
|
1231
|
-
* Rotates the Node about the local X-axis by the given increment.
|
|
1232
|
-
*
|
|
1233
|
-
* @param {Number} angle Angle increment in degrees.
|
|
1234
|
-
*/
|
|
1235
|
-
rotateX(angle) {
|
|
1236
|
-
return this.rotate(xAxis, angle);
|
|
1237
|
-
}
|
|
1238
|
-
|
|
1239
|
-
/**
|
|
1240
|
-
* Rotates the Node about the local Y-axis by the given increment.
|
|
1241
|
-
*
|
|
1242
|
-
* @param {Number} angle Angle increment in degrees.
|
|
1243
|
-
*/
|
|
1244
|
-
rotateY(angle) {
|
|
1245
|
-
return this.rotate(yAxis, angle);
|
|
1246
|
-
}
|
|
1247
|
-
|
|
1248
|
-
/**
|
|
1249
|
-
* Rotates the Node about the local Z-axis by the given increment.
|
|
1250
|
-
*
|
|
1251
|
-
* @param {Number} angle Angle increment in degrees.
|
|
1252
|
-
*/
|
|
1253
|
-
rotateZ(angle) {
|
|
1254
|
-
return this.rotate(zAxis, angle);
|
|
1255
|
-
}
|
|
1256
|
-
|
|
1257
|
-
/**
|
|
1258
|
-
* Translates the Node along local space vector by the given increment.
|
|
1259
|
-
*
|
|
1260
|
-
* @param {Number[]} axis Normalized local space 3D vector along which to translate.
|
|
1261
|
-
* @param {Number} distance Distance to translate along the vector.
|
|
1262
|
-
*/
|
|
1263
|
-
translate(axis, distance) {
|
|
1264
|
-
math.vec3ApplyQuaternion(this.quaternion, axis, veca);
|
|
1265
|
-
math.mulVec3Scalar(veca, distance, vecb);
|
|
1266
|
-
math.addVec3(this.position, vecb, this.position);
|
|
1267
|
-
this._setLocalMatrixDirty();
|
|
1268
|
-
this._setAABBDirty();
|
|
1269
|
-
this.glRedraw();
|
|
1270
|
-
return this;
|
|
1271
|
-
}
|
|
1272
|
-
|
|
1273
|
-
/**
|
|
1274
|
-
* Translates the Node along the local X-axis by the given increment.
|
|
1275
|
-
*
|
|
1276
|
-
* @param {Number} distance Distance to translate along the X-axis.
|
|
1277
|
-
*/
|
|
1278
|
-
translateX(distance) {
|
|
1279
|
-
return this.translate(xAxis, distance);
|
|
1280
|
-
}
|
|
1281
|
-
|
|
1282
|
-
/**
|
|
1283
|
-
* Translates the Node along the local Y-axis by the given increment.
|
|
1284
|
-
*
|
|
1285
|
-
* @param {Number} distance Distance to translate along the Y-axis.
|
|
1286
|
-
*/
|
|
1287
|
-
translateY(distance) {
|
|
1288
|
-
return this.translate(yAxis, distance);
|
|
1289
|
-
}
|
|
1290
|
-
|
|
1291
|
-
/**
|
|
1292
|
-
* Translates the Node along the local Z-axis by the given increment.
|
|
1293
|
-
*
|
|
1294
|
-
* @param {Number} distance Distance to translate along the Z-axis.
|
|
1295
|
-
*/
|
|
1296
|
-
translateZ(distance) {
|
|
1297
|
-
return this.translate(zAxis, distance);
|
|
1298
|
-
}
|
|
1299
|
-
|
|
1300
|
-
//------------------------------------------------------------------------------------------------------------------
|
|
1301
|
-
// Component members
|
|
1302
|
-
//------------------------------------------------------------------------------------------------------------------
|
|
1303
|
-
|
|
1304
|
-
/**
|
|
1305
|
-
@private
|
|
1306
|
-
*/
|
|
1307
|
-
get type() {
|
|
1308
|
-
return "Node";
|
|
1309
|
-
}
|
|
1310
|
-
|
|
1311
|
-
/**
|
|
1312
|
-
* Destroys this Node.
|
|
1313
|
-
*/
|
|
1314
|
-
destroy() {
|
|
1315
|
-
super.destroy();
|
|
1316
|
-
if (this._parentNode) {
|
|
1317
|
-
this._parentNode.removeChild(this);
|
|
1318
|
-
}
|
|
1319
|
-
if (this._isObject) {
|
|
1320
|
-
this.scene._deregisterObject(this);
|
|
1321
|
-
if (this._visible) {
|
|
1322
|
-
this.scene._objectVisibilityUpdated(this, false);
|
|
1323
|
-
}
|
|
1324
|
-
if (this._xrayed) {
|
|
1325
|
-
this.scene._objectXRayedUpdated(this, false);
|
|
1326
|
-
}
|
|
1327
|
-
if (this._selected) {
|
|
1328
|
-
this.scene._objectSelectedUpdated(this, false);
|
|
1329
|
-
}
|
|
1330
|
-
if (this._highlighted) {
|
|
1331
|
-
this.scene._objectHighlightedUpdated(this, false);
|
|
1332
|
-
}
|
|
1333
|
-
this.scene._objectColorizeUpdated(this, false);
|
|
1334
|
-
this.scene._objectOpacityUpdated(this, false);
|
|
1335
|
-
this.scene._objectOffsetUpdated(this, false);
|
|
1336
|
-
}
|
|
1337
|
-
if (this._isModel) {
|
|
1338
|
-
this.scene._deregisterModel(this);
|
|
1339
|
-
}
|
|
1340
|
-
if (this._children.length) {
|
|
1341
|
-
// Clone the _children before iterating, so our children don't mess us up when calling removeChild().
|
|
1342
|
-
const tempChildList = this._children.splice();
|
|
1343
|
-
let child;
|
|
1344
|
-
for (let i = 0, len = tempChildList.length; i < len; i++) {
|
|
1345
|
-
child = tempChildList[i];
|
|
1346
|
-
child.destroy();
|
|
1347
|
-
}
|
|
1348
|
-
}
|
|
1349
|
-
this._children = [];
|
|
1350
|
-
this._setAABBDirty();
|
|
1351
|
-
this.scene._aabbDirty = true;
|
|
1352
|
-
}
|
|
1353
|
-
|
|
1354
|
-
}
|
|
1355
|
-
|
|
1356
|
-
export {Node};
|