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,908 +0,0 @@
|
|
1
|
-
import {core} from "./core.js";
|
2
|
-
import {utils} from './utils.js';
|
3
|
-
import {Map} from "./utils/Map.js";
|
4
|
-
|
5
|
-
/**
|
6
|
-
* @desc Base class for all yjkkit components.
|
7
|
-
*
|
8
|
-
* ## Component IDs
|
9
|
-
*
|
10
|
-
* Every Component has an ID that's unique within the parent {@link Scene}. yjkkit generates
|
11
|
-
* the IDs automatically by default, however you can also specify them yourself. In the example below, we're creating a
|
12
|
-
* scene comprised of {@link Scene}, {@link Material}, {@link ReadableGeometry} and
|
13
|
-
* {@link Mesh} components, while letting yjkkit generate its own ID for
|
14
|
-
* the {@link ReadableGeometry}:
|
15
|
-
*
|
16
|
-
*````JavaScript
|
17
|
-
* import {Viewer, Mesh, buildTorusGeometry, ReadableGeometry, PhongMaterial, Texture, Fresnel} from "yjkkit-sdk.es.js";
|
18
|
-
*
|
19
|
-
* const viewer = new Viewer({
|
20
|
-
* canvasId: "myCanvas"
|
21
|
-
* });
|
22
|
-
*
|
23
|
-
* viewer.scene.camera.eye = [0, 0, 5];
|
24
|
-
* viewer.scene.camera.look = [0, 0, 0];
|
25
|
-
* viewer.scene.camera.up = [0, 1, 0];
|
26
|
-
*
|
27
|
-
* new Mesh(viewer.scene, {
|
28
|
-
* geometry: new ReadableGeometry(viewer.scene, buildTorusGeometry({
|
29
|
-
* center: [0, 0, 0],
|
30
|
-
* radius: 1.5,
|
31
|
-
* tube: 0.5,
|
32
|
-
* radialSegments: 32,
|
33
|
-
* tubeSegments: 24,
|
34
|
-
* arc: Math.PI * 2.0
|
35
|
-
* }),
|
36
|
-
* material: new PhongMaterial(viewer.scene, {
|
37
|
-
* id: "myMaterial",
|
38
|
-
* ambient: [0.9, 0.3, 0.9],
|
39
|
-
* shininess: 30,
|
40
|
-
* diffuseMap: new Texture(viewer.scene, {
|
41
|
-
* src: "textures/diffuse/uvGrid2.jpg"
|
42
|
-
* }),
|
43
|
-
* specularFresnel: new Fresnel(viewer.scene, {
|
44
|
-
* leftColor: [1.0, 1.0, 1.0],
|
45
|
-
* rightColor: [0.0, 0.0, 0.0],
|
46
|
-
* power: 4
|
47
|
-
* })
|
48
|
-
* })
|
49
|
-
* });
|
50
|
-
*````
|
51
|
-
*
|
52
|
-
* We can then find those components like this:
|
53
|
-
*
|
54
|
-
* ````javascript
|
55
|
-
* // Find the Material
|
56
|
-
* var material = viewer.scene.components["myMaterial"];
|
57
|
-
*
|
58
|
-
* // Find all PhongMaterials in the Scene
|
59
|
-
* var phongMaterials = viewer.scene.types["PhongMaterial"];
|
60
|
-
*
|
61
|
-
* // Find our Material within the PhongMaterials
|
62
|
-
* var materialAgain = phongMaterials["myMaterial"];
|
63
|
-
* ````
|
64
|
-
*
|
65
|
-
* ## Restriction on IDs
|
66
|
-
*
|
67
|
-
* Auto-generated IDs are of the form ````"__0"````, ````"__1"````, ````"__2"```` ... and so on.
|
68
|
-
*
|
69
|
-
* Scene maintains a map of these IDs, along with a counter that it increments each time it generates a new ID.
|
70
|
-
*
|
71
|
-
* If Scene has created the IDs listed above, and we then destroy the ````Component```` with ID ````"__1"````,
|
72
|
-
* Scene will mark that ID as available, and will reuse it for the next default ID.
|
73
|
-
*
|
74
|
-
* Therefore, two restrictions your on IDs:
|
75
|
-
*
|
76
|
-
* * don't use IDs that begin with two underscores, and
|
77
|
-
* * don't reuse auto-generated IDs of destroyed Components.
|
78
|
-
*
|
79
|
-
* ## Logging
|
80
|
-
*
|
81
|
-
* Components have methods to log ID-prefixed messages to the JavaScript console:
|
82
|
-
*
|
83
|
-
* ````javascript
|
84
|
-
* material.log("Everything is fine, situation normal.");
|
85
|
-
* material.warn("Wait, whats that red light?");
|
86
|
-
* material.error("Aw, snap!");
|
87
|
-
* ````
|
88
|
-
*
|
89
|
-
* The logged messages will look like this in the console:
|
90
|
-
*
|
91
|
-
* ````text
|
92
|
-
* [LOG] myMaterial: Everything is fine, situation normal.
|
93
|
-
* [WARN] myMaterial: Wait, whats that red light..
|
94
|
-
* [ERROR] myMaterial: Aw, snap!
|
95
|
-
* ````
|
96
|
-
*
|
97
|
-
* ## Destruction
|
98
|
-
*
|
99
|
-
* Get notification of destruction of Components:
|
100
|
-
*
|
101
|
-
* ````javascript
|
102
|
-
* material.once("destroyed", function() {
|
103
|
-
* this.log("Component was destroyed: " + this.id);
|
104
|
-
* });
|
105
|
-
* ````
|
106
|
-
*
|
107
|
-
* Or get notification of destruction of any Component within its {@link Scene}:
|
108
|
-
*
|
109
|
-
* ````javascript
|
110
|
-
* scene.on("componentDestroyed", function(component) {
|
111
|
-
* this.log("Component was destroyed: " + component.id);
|
112
|
-
* });
|
113
|
-
* ````
|
114
|
-
*
|
115
|
-
* Then destroy a component like this:
|
116
|
-
*
|
117
|
-
* ````javascript
|
118
|
-
* material.destroy();
|
119
|
-
* ````
|
120
|
-
*/
|
121
|
-
class Component {
|
122
|
-
|
123
|
-
/**
|
124
|
-
@private
|
125
|
-
*/
|
126
|
-
get type() {
|
127
|
-
return "Component";
|
128
|
-
}
|
129
|
-
|
130
|
-
/**
|
131
|
-
* @private
|
132
|
-
*/
|
133
|
-
get isComponent() {
|
134
|
-
return true;
|
135
|
-
}
|
136
|
-
|
137
|
-
constructor(owner = null, cfg = {}) {
|
138
|
-
|
139
|
-
/**
|
140
|
-
* The parent {@link Scene} that contains this Component.
|
141
|
-
*
|
142
|
-
* @property scene
|
143
|
-
* @type {Scene}
|
144
|
-
* @final
|
145
|
-
*/
|
146
|
-
this.scene = null;
|
147
|
-
|
148
|
-
if (this.type === "Scene") {
|
149
|
-
this.scene = this;
|
150
|
-
/**
|
151
|
-
* The viewer that contains this Scene.
|
152
|
-
* @property viewer
|
153
|
-
* @type {Viewer}
|
154
|
-
*/
|
155
|
-
this.viewer = cfg.viewer;
|
156
|
-
} else {
|
157
|
-
if (owner.type === "Scene") {
|
158
|
-
this.scene = owner;
|
159
|
-
} else if (owner instanceof Component) {
|
160
|
-
this.scene = owner.scene;
|
161
|
-
} else {
|
162
|
-
throw "Invalid param: owner must be a Component"
|
163
|
-
}
|
164
|
-
this._owner = owner;
|
165
|
-
this._renderer = this.scene._renderer;
|
166
|
-
}
|
167
|
-
|
168
|
-
this._dontClear = !!cfg.dontClear; // Prevent Scene#clear from destroying this component
|
169
|
-
|
170
|
-
this._renderer = this.scene._renderer;
|
171
|
-
|
172
|
-
/**
|
173
|
-
Arbitrary, user-defined metadata on this component.
|
174
|
-
|
175
|
-
@property metadata
|
176
|
-
@type Object
|
177
|
-
*/
|
178
|
-
this.meta = cfg.meta || {};
|
179
|
-
|
180
|
-
|
181
|
-
/**
|
182
|
-
* ID of this Component, unique within the {@link Scene}.
|
183
|
-
*
|
184
|
-
* Components are mapped by this ID in {@link Scene#components}.
|
185
|
-
*
|
186
|
-
* @property id
|
187
|
-
* @type {String|Number}
|
188
|
-
*/
|
189
|
-
this.id = cfg.id; // Auto-generated by Scene by default
|
190
|
-
|
191
|
-
/**
|
192
|
-
True as soon as this Component has been destroyed
|
193
|
-
|
194
|
-
@property destroyed
|
195
|
-
@type {Boolean}
|
196
|
-
*/
|
197
|
-
this.destroyed = false;
|
198
|
-
|
199
|
-
this._attached = {}; // Attached components with names.
|
200
|
-
this._attachments = null; // Attached components keyed to IDs - lazy-instantiated
|
201
|
-
this._subIdMap = null; // Subscription subId pool
|
202
|
-
this._subIdEvents = null; // Subscription subIds mapped to event names
|
203
|
-
this._eventSubs = null; // Event names mapped to subscribers
|
204
|
-
this._eventSubsNum = null;
|
205
|
-
this._events = null; // Maps names to events
|
206
|
-
this._eventCallDepth = 0; // Helps us catch stack overflows from recursive events
|
207
|
-
this._ownedComponents = null; // // Components created with #create - lazy-instantiated
|
208
|
-
|
209
|
-
if (this !== this.scene) { // Don't add scene to itself
|
210
|
-
this.scene._addComponent(this); // Assigns this component an automatic ID if not yet assigned
|
211
|
-
}
|
212
|
-
|
213
|
-
this._updateScheduled = false; // True when #_update will be called on next tick
|
214
|
-
|
215
|
-
if (owner) {
|
216
|
-
owner._own(this);
|
217
|
-
}
|
218
|
-
}
|
219
|
-
|
220
|
-
// /**
|
221
|
-
// * Unique ID for this Component within its {@link Scene}.
|
222
|
-
// *
|
223
|
-
// * @property
|
224
|
-
// * @type {String}
|
225
|
-
// */
|
226
|
-
// get id() {
|
227
|
-
// return this._id;
|
228
|
-
// }
|
229
|
-
|
230
|
-
/**
|
231
|
-
Indicates that we need to redraw the scene.
|
232
|
-
|
233
|
-
This is called by certain subclasses after they have made some sort of state update that requires the
|
234
|
-
renderer to perform a redraw.
|
235
|
-
|
236
|
-
For example: a {@link Mesh} calls this on itself whenever you update its
|
237
|
-
{@link Mesh#layer} property, which manually controls its render order in
|
238
|
-
relation to other Meshes.
|
239
|
-
|
240
|
-
If this component has a ````castsShadow```` property that's set ````true````, then this will also indicate
|
241
|
-
that the renderer needs to redraw shadow map associated with this component. Components like
|
242
|
-
{@link DirLight} have that property set when they produce light that creates shadows, while
|
243
|
-
components like {@link Mesh"}}layer{{/crossLink}} have that property set when they cast shadows.
|
244
|
-
|
245
|
-
@protected
|
246
|
-
*/
|
247
|
-
glRedraw() {
|
248
|
-
if (!this._renderer) { // Called from a constructor
|
249
|
-
return;
|
250
|
-
}
|
251
|
-
this._renderer.imageDirty();
|
252
|
-
if (this.castsShadow) { // Light source or object
|
253
|
-
this._renderer.shadowsDirty();
|
254
|
-
}
|
255
|
-
}
|
256
|
-
|
257
|
-
/**
|
258
|
-
Indicates that we need to re-sort the renderer's state-ordered drawables list.
|
259
|
-
|
260
|
-
For efficiency, the renderer keeps its list of drawables ordered so that runs of the same state updates can be
|
261
|
-
combined. This method is called by certain subclasses after they have made some sort of state update that would
|
262
|
-
require re-ordering of the drawables list.
|
263
|
-
|
264
|
-
For example: a {@link DirLight} calls this on itself whenever you update {@link DirLight#dir}.
|
265
|
-
|
266
|
-
@protected
|
267
|
-
*/
|
268
|
-
glResort() {
|
269
|
-
if (!this._renderer) { // Called from a constructor
|
270
|
-
return;
|
271
|
-
}
|
272
|
-
this._renderer.needStateSort();
|
273
|
-
}
|
274
|
-
|
275
|
-
/**
|
276
|
-
* The {@link Component} that owns the lifecycle of this Component, if any.
|
277
|
-
*
|
278
|
-
* When that component is destroyed, this component will be automatically destroyed also.
|
279
|
-
*
|
280
|
-
* Will be null if this Component has no owner.
|
281
|
-
*
|
282
|
-
* @property owner
|
283
|
-
* @type {Component}
|
284
|
-
*/
|
285
|
-
get owner() {
|
286
|
-
return this._owner;
|
287
|
-
}
|
288
|
-
|
289
|
-
/**
|
290
|
-
* Tests if this component is of the given type, or is a subclass of the given type.
|
291
|
-
* @type {Boolean}
|
292
|
-
*/
|
293
|
-
isType(type) {
|
294
|
-
return this.type === type;
|
295
|
-
}
|
296
|
-
|
297
|
-
/**
|
298
|
-
* Fires an event on this component.
|
299
|
-
*
|
300
|
-
* Notifies existing subscribers to the event, optionally retains the event to give to
|
301
|
-
* any subsequent notifications on the event as they are made.
|
302
|
-
*
|
303
|
-
* @param {String} event The event type name
|
304
|
-
* @param {Object} value The event parameters
|
305
|
-
* @param {Boolean} [forget=false] When true, does not retain for subsequent subscribers
|
306
|
-
*/
|
307
|
-
fire(event, value, forget) {
|
308
|
-
if (!this._events) {
|
309
|
-
this._events = {};
|
310
|
-
}
|
311
|
-
if (!this._eventSubs) {
|
312
|
-
this._eventSubs = {};
|
313
|
-
this._eventSubsNum = {};
|
314
|
-
}
|
315
|
-
if (forget !== true) {
|
316
|
-
this._events[event] = value || true; // Save notification
|
317
|
-
}
|
318
|
-
const subs = this._eventSubs[event];
|
319
|
-
let sub;
|
320
|
-
if (subs) { // Notify subscriptions
|
321
|
-
for (const subId in subs) {
|
322
|
-
if (subs.hasOwnProperty(subId)) {
|
323
|
-
sub = subs[subId];
|
324
|
-
this._eventCallDepth++;
|
325
|
-
if (this._eventCallDepth < 300) {
|
326
|
-
sub.callback.call(sub.scope, value);
|
327
|
-
} else {
|
328
|
-
this.error("fire: potential stack overflow from recursive event '" + event + "' - dropping this event");
|
329
|
-
}
|
330
|
-
this._eventCallDepth--;
|
331
|
-
}
|
332
|
-
}
|
333
|
-
}
|
334
|
-
}
|
335
|
-
|
336
|
-
/**
|
337
|
-
* Subscribes to an event on this component.
|
338
|
-
*
|
339
|
-
* The callback is be called with this component as scope.
|
340
|
-
*
|
341
|
-
* @param {String} event The event
|
342
|
-
* @param {Function} callback Called fired on the event
|
343
|
-
* @param {Object} [scope=this] Scope for the callback
|
344
|
-
* @return {String} Handle to the subscription, which may be used to unsubscribe with {@link #off}.
|
345
|
-
*/
|
346
|
-
on(event, callback, scope) {
|
347
|
-
if (!this._events) {
|
348
|
-
this._events = {};
|
349
|
-
}
|
350
|
-
if (!this._subIdMap) {
|
351
|
-
this._subIdMap = new Map(); // Subscription subId pool
|
352
|
-
}
|
353
|
-
if (!this._subIdEvents) {
|
354
|
-
this._subIdEvents = {};
|
355
|
-
}
|
356
|
-
if (!this._eventSubs) {
|
357
|
-
this._eventSubs = {};
|
358
|
-
}
|
359
|
-
if (!this._eventSubsNum) {
|
360
|
-
this._eventSubsNum = {};
|
361
|
-
}
|
362
|
-
let subs = this._eventSubs[event];
|
363
|
-
if (!subs) {
|
364
|
-
subs = {};
|
365
|
-
this._eventSubs[event] = subs;
|
366
|
-
this._eventSubsNum[event] = 1;
|
367
|
-
} else {
|
368
|
-
this._eventSubsNum[event]++;
|
369
|
-
}
|
370
|
-
const subId = this._subIdMap.addItem(); // Create unique subId
|
371
|
-
subs[subId] = {
|
372
|
-
callback: callback,
|
373
|
-
scope: scope || this
|
374
|
-
};
|
375
|
-
this._subIdEvents[subId] = event;
|
376
|
-
const value = this._events[event];
|
377
|
-
if (value !== undefined) { // A publication exists, notify callback immediately
|
378
|
-
callback.call(scope || this, value);
|
379
|
-
}
|
380
|
-
return subId;
|
381
|
-
}
|
382
|
-
|
383
|
-
/**
|
384
|
-
* Cancels an event subscription that was previously made with {@link Component#on} or {@link Component#once}.
|
385
|
-
*
|
386
|
-
* @param {String} subId Subscription ID
|
387
|
-
*/
|
388
|
-
off(subId) {
|
389
|
-
if (subId === undefined || subId === null) {
|
390
|
-
return;
|
391
|
-
}
|
392
|
-
if (!this._subIdEvents) {
|
393
|
-
return;
|
394
|
-
}
|
395
|
-
const event = this._subIdEvents[subId];
|
396
|
-
if (event) {
|
397
|
-
delete this._subIdEvents[subId];
|
398
|
-
const subs = this._eventSubs[event];
|
399
|
-
if (subs) {
|
400
|
-
delete subs[subId];
|
401
|
-
this._eventSubsNum[event]--;
|
402
|
-
}
|
403
|
-
this._subIdMap.removeItem(subId); // Release subId
|
404
|
-
}
|
405
|
-
}
|
406
|
-
|
407
|
-
/**
|
408
|
-
* Subscribes to the next occurrence of the given event, then un-subscribes as soon as the event is subIdd.
|
409
|
-
*
|
410
|
-
* This is equivalent to calling {@link Component#on}, and then calling {@link Component#off} inside the callback function.
|
411
|
-
*
|
412
|
-
* @param {String} event Data event to listen to
|
413
|
-
* @param {Function} callback Called when fresh data is available at the event
|
414
|
-
* @param {Object} [scope=this] Scope for the callback
|
415
|
-
*/
|
416
|
-
once(event, callback, scope) {
|
417
|
-
const self = this;
|
418
|
-
const subId = this.on(event,
|
419
|
-
function (value) {
|
420
|
-
self.off(subId);
|
421
|
-
callback.call(scope || this, value);
|
422
|
-
},
|
423
|
-
scope);
|
424
|
-
}
|
425
|
-
|
426
|
-
/**
|
427
|
-
* Returns true if there are any subscribers to the given event on this component.
|
428
|
-
*
|
429
|
-
* @param {String} event The event
|
430
|
-
* @return {Boolean} True if there are any subscribers to the given event on this component.
|
431
|
-
*/
|
432
|
-
hasSubs(event) {
|
433
|
-
return (this._eventSubsNum && (this._eventSubsNum[event] > 0));
|
434
|
-
}
|
435
|
-
|
436
|
-
/**
|
437
|
-
* Logs a console debugging message for this component.
|
438
|
-
*
|
439
|
-
* The console message will have this format: *````[LOG] [<component type> <component id>: <message>````*
|
440
|
-
*
|
441
|
-
* Also fires the message as a "log" event on the parent {@link Scene}.
|
442
|
-
*
|
443
|
-
* @param {String} message The message to log
|
444
|
-
*/
|
445
|
-
log(message) {
|
446
|
-
message = "[LOG]" + this._message(message);
|
447
|
-
window.console.log(message);
|
448
|
-
this.scene.fire("log", message);
|
449
|
-
}
|
450
|
-
|
451
|
-
_message(message) {
|
452
|
-
return " [" + this.type + " " + utils.inQuotes(this.id) + "]: " + message;
|
453
|
-
}
|
454
|
-
|
455
|
-
/**
|
456
|
-
* Logs a warning for this component to the JavaScript console.
|
457
|
-
*
|
458
|
-
* The console message will have this format: *````[WARN] [<component type> =<component id>: <message>````*
|
459
|
-
*
|
460
|
-
* Also fires the message as a "warn" event on the parent {@link Scene}.
|
461
|
-
*
|
462
|
-
* @param {String} message The message to log
|
463
|
-
*/
|
464
|
-
warn(message) {
|
465
|
-
message = "[WARN]" + this._message(message);
|
466
|
-
window.console.warn(message);
|
467
|
-
this.scene.fire("warn", message);
|
468
|
-
}
|
469
|
-
|
470
|
-
/**
|
471
|
-
* Logs an error for this component to the JavaScript console.
|
472
|
-
*
|
473
|
-
* The console message will have this format: *````[ERROR] [<component type> =<component id>: <message>````*
|
474
|
-
*
|
475
|
-
* Also fires the message as an "error" event on the parent {@link Scene}.
|
476
|
-
*
|
477
|
-
* @param {String} message The message to log
|
478
|
-
*/
|
479
|
-
error(message) {
|
480
|
-
message = "[ERROR]" + this._message(message);
|
481
|
-
window.console.error(message);
|
482
|
-
this.scene.fire("error", message);
|
483
|
-
}
|
484
|
-
|
485
|
-
/**
|
486
|
-
* Adds a child component to this.
|
487
|
-
*
|
488
|
-
* When component not given, attaches the scene's default instance for the given name (if any).
|
489
|
-
* Publishes the new child component on this component, keyed to the given name.
|
490
|
-
*
|
491
|
-
* @param {*} params
|
492
|
-
* @param {String} params.name component name
|
493
|
-
* @param {Component} [params.component] The component
|
494
|
-
* @param {String} [params.type] Optional expected type of base type of the child; when supplied, will
|
495
|
-
* cause an exception if the given child is not the same type or a subtype of this.
|
496
|
-
* @param {Boolean} [params.sceneDefault=false]
|
497
|
-
* @param {Boolean} [params.sceneSingleton=false]
|
498
|
-
* @param {Function} [params.onAttached] Optional callback called when component attached
|
499
|
-
* @param {Function} [params.onAttached.callback] Callback function
|
500
|
-
* @param {Function} [params.onAttached.scope] Optional scope for callback
|
501
|
-
* @param {Function} [params.onDetached] Optional callback called when component is detached
|
502
|
-
* @param {Function} [params.onDetached.callback] Callback function
|
503
|
-
* @param {Function} [params.onDetached.scope] Optional scope for callback
|
504
|
-
* @param {{String:Function}} [params.on] Callbacks to subscribe to properties on component
|
505
|
-
* @param {Boolean} [params.recompiles=true] When true, fires "dirty" events on this component
|
506
|
-
* @private
|
507
|
-
*/
|
508
|
-
_attach(params) {
|
509
|
-
|
510
|
-
const name = params.name;
|
511
|
-
|
512
|
-
if (!name) {
|
513
|
-
this.error("Component 'name' expected");
|
514
|
-
return;
|
515
|
-
}
|
516
|
-
|
517
|
-
let component = params.component;
|
518
|
-
const sceneDefault = params.sceneDefault;
|
519
|
-
const sceneSingleton = params.sceneSingleton;
|
520
|
-
const type = params.type;
|
521
|
-
const on = params.on;
|
522
|
-
const recompiles = params.recompiles !== false;
|
523
|
-
|
524
|
-
// True when child given as config object, where parent manages its instantiation and destruction
|
525
|
-
let managingLifecycle = false;
|
526
|
-
|
527
|
-
if (component) {
|
528
|
-
|
529
|
-
if (utils.isNumeric(component) || utils.isString(component)) {
|
530
|
-
|
531
|
-
// Component ID given
|
532
|
-
// Both numeric and string IDs are supported
|
533
|
-
|
534
|
-
const id = component;
|
535
|
-
|
536
|
-
component = this.scene.components[id];
|
537
|
-
|
538
|
-
if (!component) {
|
539
|
-
|
540
|
-
// Quote string IDs in errors
|
541
|
-
|
542
|
-
this.error("Component not found: " + utils.inQuotes(id));
|
543
|
-
return;
|
544
|
-
}
|
545
|
-
}
|
546
|
-
}
|
547
|
-
|
548
|
-
if (!component) {
|
549
|
-
|
550
|
-
if (sceneSingleton === true) {
|
551
|
-
|
552
|
-
// Using the first instance of the component type we find
|
553
|
-
|
554
|
-
const instances = this.scene.types[type];
|
555
|
-
for (const id2 in instances) {
|
556
|
-
if (instances.hasOwnProperty) {
|
557
|
-
component = instances[id2];
|
558
|
-
break;
|
559
|
-
}
|
560
|
-
}
|
561
|
-
|
562
|
-
if (!component) {
|
563
|
-
this.error("Scene has no default component for '" + name + "'");
|
564
|
-
return null;
|
565
|
-
}
|
566
|
-
|
567
|
-
} else if (sceneDefault === true) {
|
568
|
-
|
569
|
-
// Using a default scene component
|
570
|
-
|
571
|
-
component = this.scene[name];
|
572
|
-
|
573
|
-
if (!component) {
|
574
|
-
this.error("Scene has no default component for '" + name + "'");
|
575
|
-
return null;
|
576
|
-
}
|
577
|
-
}
|
578
|
-
}
|
579
|
-
|
580
|
-
if (component) {
|
581
|
-
|
582
|
-
if (component.scene.id !== this.scene.id) {
|
583
|
-
this.error("Not in same scene: " + component.type + " " + utils.inQuotes(component.id));
|
584
|
-
return;
|
585
|
-
}
|
586
|
-
|
587
|
-
if (type) {
|
588
|
-
|
589
|
-
if (!component.isType(type)) {
|
590
|
-
this.error("Expected a " + type + " type or subtype: " + component.type + " " + utils.inQuotes(component.id));
|
591
|
-
return;
|
592
|
-
}
|
593
|
-
}
|
594
|
-
}
|
595
|
-
|
596
|
-
if (!this._attachments) {
|
597
|
-
this._attachments = {};
|
598
|
-
}
|
599
|
-
|
600
|
-
const oldComponent = this._attached[name];
|
601
|
-
let subs;
|
602
|
-
let i;
|
603
|
-
let len;
|
604
|
-
|
605
|
-
if (oldComponent) {
|
606
|
-
|
607
|
-
if (component && oldComponent.id === component.id) {
|
608
|
-
|
609
|
-
// Reject attempt to reattach same component
|
610
|
-
return;
|
611
|
-
}
|
612
|
-
|
613
|
-
const oldAttachment = this._attachments[oldComponent.id];
|
614
|
-
|
615
|
-
// Unsubscribe from events on old component
|
616
|
-
|
617
|
-
subs = oldAttachment.subs;
|
618
|
-
|
619
|
-
for (i = 0, len = subs.length; i < len; i++) {
|
620
|
-
oldComponent.off(subs[i]);
|
621
|
-
}
|
622
|
-
|
623
|
-
delete this._attached[name];
|
624
|
-
delete this._attachments[oldComponent.id];
|
625
|
-
|
626
|
-
const onDetached = oldAttachment.params.onDetached;
|
627
|
-
if (onDetached) {
|
628
|
-
if (utils.isFunction(onDetached)) {
|
629
|
-
onDetached(oldComponent);
|
630
|
-
} else {
|
631
|
-
onDetached.scope ? onDetached.callback.call(onDetached.scope, oldComponent) : onDetached.callback(oldComponent);
|
632
|
-
}
|
633
|
-
}
|
634
|
-
|
635
|
-
if (oldAttachment.managingLifecycle) {
|
636
|
-
|
637
|
-
// Note that we just unsubscribed from all events fired by the child
|
638
|
-
// component, so destroying it won't fire events back at us now.
|
639
|
-
|
640
|
-
oldComponent.destroy();
|
641
|
-
}
|
642
|
-
}
|
643
|
-
|
644
|
-
if (component) {
|
645
|
-
|
646
|
-
// Set and publish the new component on this component
|
647
|
-
|
648
|
-
const attachment = {
|
649
|
-
params: params,
|
650
|
-
component: component,
|
651
|
-
subs: [],
|
652
|
-
managingLifecycle: managingLifecycle
|
653
|
-
};
|
654
|
-
|
655
|
-
attachment.subs.push(
|
656
|
-
component.once("destroyed",
|
657
|
-
function () {
|
658
|
-
attachment.params.component = null;
|
659
|
-
this._attach(attachment.params);
|
660
|
-
},
|
661
|
-
this));
|
662
|
-
|
663
|
-
if (recompiles) {
|
664
|
-
attachment.subs.push(
|
665
|
-
component.on("dirty",
|
666
|
-
function () {
|
667
|
-
this.fire("dirty", this);
|
668
|
-
},
|
669
|
-
this));
|
670
|
-
}
|
671
|
-
|
672
|
-
this._attached[name] = component;
|
673
|
-
this._attachments[component.id] = attachment;
|
674
|
-
|
675
|
-
// Bind destruct listener to new component to remove it
|
676
|
-
// from this component when destroyed
|
677
|
-
|
678
|
-
const onAttached = params.onAttached;
|
679
|
-
if (onAttached) {
|
680
|
-
if (utils.isFunction(onAttached)) {
|
681
|
-
onAttached(component);
|
682
|
-
} else {
|
683
|
-
onAttached.scope ? onAttached.callback.call(onAttached.scope, component) : onAttached.callback(component);
|
684
|
-
}
|
685
|
-
}
|
686
|
-
|
687
|
-
if (on) {
|
688
|
-
|
689
|
-
let event;
|
690
|
-
let subIdr;
|
691
|
-
let callback;
|
692
|
-
let scope;
|
693
|
-
|
694
|
-
for (event in on) {
|
695
|
-
if (on.hasOwnProperty(event)) {
|
696
|
-
|
697
|
-
subIdr = on[event];
|
698
|
-
|
699
|
-
if (utils.isFunction(subIdr)) {
|
700
|
-
callback = subIdr;
|
701
|
-
scope = null;
|
702
|
-
} else {
|
703
|
-
callback = subIdr.callback;
|
704
|
-
scope = subIdr.scope;
|
705
|
-
}
|
706
|
-
|
707
|
-
if (!callback) {
|
708
|
-
continue;
|
709
|
-
}
|
710
|
-
|
711
|
-
attachment.subs.push(component.on(event, callback, scope));
|
712
|
-
}
|
713
|
-
}
|
714
|
-
}
|
715
|
-
}
|
716
|
-
|
717
|
-
if (recompiles) {
|
718
|
-
this.fire("dirty", this); // FIXME: May trigger spurous mesh recompilations unless able to limit with param?
|
719
|
-
}
|
720
|
-
|
721
|
-
this.fire(name, component); // Component can be null
|
722
|
-
|
723
|
-
return component;
|
724
|
-
}
|
725
|
-
|
726
|
-
_checkComponent(expectedType, component) {
|
727
|
-
if (!component.isComponent) {
|
728
|
-
if (utils.isID(component)) {
|
729
|
-
const id = component;
|
730
|
-
component = this.scene.components[id];
|
731
|
-
if (!component) {
|
732
|
-
this.error("Component not found: " + id);
|
733
|
-
return;
|
734
|
-
}
|
735
|
-
} else {
|
736
|
-
this.error("Expected a Component or ID");
|
737
|
-
return;
|
738
|
-
}
|
739
|
-
}
|
740
|
-
if (expectedType !== component.type) {
|
741
|
-
this.error("Expected a " + expectedType + " Component");
|
742
|
-
return;
|
743
|
-
}
|
744
|
-
if (component.scene.id !== this.scene.id) {
|
745
|
-
this.error("Not in same scene: " + component.type);
|
746
|
-
return;
|
747
|
-
}
|
748
|
-
return component;
|
749
|
-
}
|
750
|
-
|
751
|
-
_checkComponent2(expectedTypes, component) {
|
752
|
-
if (!component.isComponent) {
|
753
|
-
if (utils.isID(component)) {
|
754
|
-
const id = component;
|
755
|
-
component = this.scene.components[id];
|
756
|
-
if (!component) {
|
757
|
-
this.error("Component not found: " + id);
|
758
|
-
return;
|
759
|
-
}
|
760
|
-
} else {
|
761
|
-
this.error("Expected a Component or ID");
|
762
|
-
return;
|
763
|
-
}
|
764
|
-
}
|
765
|
-
if (component.scene.id !== this.scene.id) {
|
766
|
-
this.error("Not in same scene: " + component.type);
|
767
|
-
return;
|
768
|
-
}
|
769
|
-
for (var i = 0, len = expectedTypes.length; i < len; i++) {
|
770
|
-
if (expectedTypes[i] === component.type) {
|
771
|
-
return component;
|
772
|
-
}
|
773
|
-
}
|
774
|
-
this.error("Expected component types: " + expectedTypes);
|
775
|
-
return null;
|
776
|
-
}
|
777
|
-
|
778
|
-
_own(component) {
|
779
|
-
if (!this._ownedComponents) {
|
780
|
-
this._ownedComponents = {};
|
781
|
-
}
|
782
|
-
if (!this._ownedComponents[component.id]) {
|
783
|
-
this._ownedComponents[component.id] = component;
|
784
|
-
}
|
785
|
-
component.once("destroyed", () => {
|
786
|
-
delete this._ownedComponents[component.id];
|
787
|
-
}, this);
|
788
|
-
}
|
789
|
-
|
790
|
-
/**
|
791
|
-
* Protected method, called by sub-classes to queue a call to _update().
|
792
|
-
* @protected
|
793
|
-
* @param {Number} [priority=1]
|
794
|
-
*/
|
795
|
-
_needUpdate(priority) {
|
796
|
-
if (!this._updateScheduled) {
|
797
|
-
this._updateScheduled = true;
|
798
|
-
if (priority === 0) {
|
799
|
-
this._doUpdate();
|
800
|
-
} else {
|
801
|
-
core.scheduleTask(this._doUpdate, this);
|
802
|
-
}
|
803
|
-
}
|
804
|
-
}
|
805
|
-
|
806
|
-
/**
|
807
|
-
* @private
|
808
|
-
*/
|
809
|
-
_doUpdate() {
|
810
|
-
if (this._updateScheduled) {
|
811
|
-
this._updateScheduled = false;
|
812
|
-
if (this._update) {
|
813
|
-
this._update();
|
814
|
-
}
|
815
|
-
}
|
816
|
-
}
|
817
|
-
|
818
|
-
/**
|
819
|
-
* Protected virtual template method, optionally implemented
|
820
|
-
* by sub-classes to perform a scheduled task.
|
821
|
-
*
|
822
|
-
* @protected
|
823
|
-
*/
|
824
|
-
_update() {
|
825
|
-
}
|
826
|
-
|
827
|
-
/**
|
828
|
-
* Destroys all {@link Component}s that are owned by this. These are Components that were instantiated with
|
829
|
-
* this Component as their first constructor argument.
|
830
|
-
*/
|
831
|
-
clear() {
|
832
|
-
if (this._ownedComponents) {
|
833
|
-
for (var id in this._ownedComponents) {
|
834
|
-
if (this._ownedComponents.hasOwnProperty(id)) {
|
835
|
-
const component = this._ownedComponents[id];
|
836
|
-
component.destroy();
|
837
|
-
delete this._ownedComponents[id];
|
838
|
-
}
|
839
|
-
}
|
840
|
-
}
|
841
|
-
}
|
842
|
-
|
843
|
-
/**
|
844
|
-
* Destroys this component.
|
845
|
-
*/
|
846
|
-
destroy() {
|
847
|
-
|
848
|
-
if (this.destroyed) {
|
849
|
-
return;
|
850
|
-
}
|
851
|
-
|
852
|
-
/**
|
853
|
-
* Fired when this Component is destroyed.
|
854
|
-
* @event destroyed
|
855
|
-
*/
|
856
|
-
this.fire("destroyed", this.destroyed = true); // Must fire before we blow away subscription maps, below
|
857
|
-
|
858
|
-
// Unsubscribe from child components and destroy then
|
859
|
-
|
860
|
-
let id;
|
861
|
-
let attachment;
|
862
|
-
let component;
|
863
|
-
let subs;
|
864
|
-
let i;
|
865
|
-
let len;
|
866
|
-
|
867
|
-
if (this._attachments) {
|
868
|
-
for (id in this._attachments) {
|
869
|
-
if (this._attachments.hasOwnProperty(id)) {
|
870
|
-
attachment = this._attachments[id];
|
871
|
-
component = attachment.component;
|
872
|
-
subs = attachment.subs;
|
873
|
-
for (i = 0, len = subs.length; i < len; i++) {
|
874
|
-
component.off(subs[i]);
|
875
|
-
}
|
876
|
-
if (attachment.managingLifecycle) {
|
877
|
-
component.destroy();
|
878
|
-
}
|
879
|
-
}
|
880
|
-
}
|
881
|
-
}
|
882
|
-
|
883
|
-
if (this._ownedComponents) {
|
884
|
-
for (id in this._ownedComponents) {
|
885
|
-
if (this._ownedComponents.hasOwnProperty(id)) {
|
886
|
-
component = this._ownedComponents[id];
|
887
|
-
component.destroy();
|
888
|
-
delete this._ownedComponents[id];
|
889
|
-
}
|
890
|
-
}
|
891
|
-
}
|
892
|
-
|
893
|
-
this.scene._removeComponent(this);
|
894
|
-
|
895
|
-
// Memory leak avoidance
|
896
|
-
this._attached = {};
|
897
|
-
this._attachments = null;
|
898
|
-
this._subIdMap = null;
|
899
|
-
this._subIdEvents = null;
|
900
|
-
this._eventSubs = null;
|
901
|
-
this._events = null;
|
902
|
-
this._eventCallDepth = 0;
|
903
|
-
this._ownedComponents = null;
|
904
|
-
this._updateScheduled = false;
|
905
|
-
}
|
906
|
-
}
|
907
|
-
|
908
|
-
export {Component};
|