csyjk 1.1.1 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- package/.babelrc +7 -0
- package/.idea/modules.xml +8 -0
- package/.idea/xx.iml +12 -0
- package/dist/app.js +43 -0
- package/{index.html → dist/index.html} +0 -0
- package/{style.css → dist/style.css} +1 -1
- package/package.json +40 -5
- package/public/gltf.js +2241 -0
- package/public/index.html +10 -0
- package/src/index.js +3 -0
- package/src/lib/gltf/assets/check.jpg +0 -0
- package/src/lib/gltf/assets/iconfont/iconfont.css +358 -0
- package/src/lib/gltf/assets/iconfont/iconfont.eot +0 -0
- package/src/lib/gltf/assets/iconfont/iconfont.js +1 -0
- package/src/lib/gltf/assets/iconfont/iconfont.json +604 -0
- package/src/lib/gltf/assets/iconfont/iconfont.svg +189 -0
- package/src/lib/gltf/assets/iconfont/iconfont.ttf +0 -0
- package/src/lib/gltf/assets/iconfont/iconfont.woff +0 -0
- package/src/lib/gltf/assets/iconfont/iconfont.woff2 +0 -0
- package/src/lib/gltf/assets/yjkkit-sdk/index.js +0 -0
- package/src/lib/gltf/assets/yjkkit-sdk/package.json +15 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/extras/ContextMenu/ContextMenu.js +863 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/extras/ContextMenu/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/extras/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/index.js +3 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AngleMeasurementsPlugin/AngleMeasurement.js +462 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsControl.js +279 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsPlugin.js +262 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AngleMeasurementsPlugin/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AnnotationsPlugin/Annotation.js +362 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AnnotationsPlugin/AnnotationsPlugin.js +575 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AnnotationsPlugin/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AxisGizmoPlugin/AxisGizmoPlugin.js +333 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AxisGizmoPlugin/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/BCFViewpointsPlugin/BCFViewpointsPlugin.js +777 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/BCFViewpointsPlugin/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js +525 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsControl.js +242 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsPlugin.js +297 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/DistanceMeasurementsPlugin/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/FastNavPlugin/FastNavPlugin.js +345 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/FastNavPlugin/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/GLTFLoaderPlugin/GLTFDefaultDataSource.js +122 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/GLTFLoaderPlugin/GLTFLoaderPlugin.js +462 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/GLTFLoaderPlugin/GLTFPerformanceModelLoader.js +508 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/GLTFLoaderPlugin/GLTFSceneGraphLoader.js +922 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/GLTFLoaderPlugin/index.js +2 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/NavCubePlugin/CubeTextureCanvas.js +273 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/NavCubePlugin/NavCubePlugin.js +687 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/NavCubePlugin/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/OBJLoaderPlugin/OBJLoaderPlugin.js +145 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/OBJLoaderPlugin/OBJSceneGraphLoader.js +777 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/OBJLoaderPlugin/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/STLLoaderPlugin/STLDefaultDataSource.js +33 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/STLLoaderPlugin/STLLoaderPlugin.js +273 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/STLLoaderPlugin/STLSceneGraphLoader.js +313 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/STLLoaderPlugin/index.js +2 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/SectionPlanesPlugin/Control.js +1328 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/SectionPlanesPlugin/Overview.js +249 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/SectionPlanesPlugin/Plane.js +169 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/SectionPlanesPlugin/SectionPlanesPlugin.js +403 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/SectionPlanesPlugin/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/SkyboxesPlugin/SkyboxesPlugin.js +134 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/SkyboxesPlugin/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/StoreyViewsPlugin/IFCStoreyPlanObjectStates.js +77 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/StoreyViewsPlugin/Storey.js +61 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/StoreyViewsPlugin/StoreyMap.js +57 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/StoreyViewsPlugin/StoreyViewsPlugin.js +822 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/StoreyViewsPlugin/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/TreeViewPlugin/ModelTreeView.js +888 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/TreeViewPlugin/TreeViewNode.js +88 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/TreeViewPlugin/TreeViewPlugin.js +624 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/TreeViewPlugin/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/TreeViewPlugin/modelValidation.js +87 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/ViewCullPlugin/ViewCullPlugin.js +295 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/ViewCullPlugin/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/XKTDefaultDataSource.js +78 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js +847 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/index.js +2 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV1.js +167 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV2.js +228 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV3.js +220 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV4.js +279 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV5.js +244 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV6.js +301 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV7.js +426 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV8.js +479 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/lib/pako.js +6818 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/XML3DLoaderPlugin.js +238 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/XML3DSceneGraphLoader.js +1279 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/.jshintrc +11 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/deflate.js +2060 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/inflate.js +2155 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/mime-types.js +1002 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/pako/codecs.js +64 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/z-worker.js +153 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/zip-ext.js +267 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/zip-fs.js +553 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/zip.js +991 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/zlib-asm/codecs.js +49 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/index.js +17 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/lib/culling/ObjectCullStates.js +205 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/lib/html/Dot.js +78 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/lib/html/Label.js +97 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/lib/html/Wire.js +95 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/Plugin.js +112 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/Viewer.js +372 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/index.js +3 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/metadata/IFCObjectDefaultColors.js +162 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/metadata/IFCObjectDefaults.js +39 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/metadata/MetaModel.js +145 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/metadata/MetaObject.js +215 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/metadata/MetaScene.js +311 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/CameraControl.js +1669 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/cc.js +0 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/CameraUpdater.js +312 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/controllers/PanController.js +112 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/controllers/PickController.js +193 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/controllers/PivotController.js +289 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/cu.js +0 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/KeyboardAxisViewHandler.js +122 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/KeyboardPanRotateDollyHandler.js +186 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/MouseMiscHandler.js +68 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/MousePanRotateDollyHandler.js +439 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/MousePickHandler.js +361 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/TouchPanRotateAndDollyHandler.js +258 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/TouchPickHandler.js +197 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/mouspan.js +498 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/Component.js +908 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/Entity.js +475 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/ImagePlane/ImagePlane.js +570 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/ImagePlane/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/PerformanceModel.js +2623 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/ENTITY_FLAGS.js +21 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/PerformanceMesh.js +262 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/PerformanceNode.js +697 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/RENDER_PASSES.js +34 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/ScratchMemory.js +63 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/compression.js +183 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesBatching/LinesBatchingBuffer.js +33 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesBatching/LinesBatchingLayer.js +736 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesBatching/LinesBatchingRenderers.js +68 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesBatching/renderers/LinesBatchingColorRenderer.js +295 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesBatching/renderers/LinesBatchingSilhouetteRenderer.js +327 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesInstancing/LinesInstancingLayer.js +698 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesInstancing/LinesInstancingRenderers.js +68 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesInstancing/renderers/LinesInstancingColorRenderer.js +364 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesInstancing/renderers/LinesInstancingSilhouetteRenderer.js +356 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/PointsBatchingBuffer.js +33 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/PointsBatchingLayer.js +776 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/PointsBatchingRenderers.js +113 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/renderers/PointsBatchingColorRenderer.js +340 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/renderers/PointsBatchingOcclusionRenderer.js +312 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/renderers/PointsBatchingPickDepthRenderer.js +343 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/renderers/PointsBatchingPickMeshRenderer.js +331 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/renderers/PointsBatchingShadowRenderer.js +242 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/renderers/PointsBatchingSilhouetteRenderer.js +348 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/PointsInstancingLayer.js +737 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/PointsInstancingRenderers.js +143 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/renderers/PointsInstancingColorRenderer.js +373 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/renderers/PointsInstancingDepthRenderer.js +366 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/renderers/PointsInstancingOcclusionRenderer.js +370 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/renderers/PointsInstancingPickDepthRenderer.js +386 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/renderers/PointsInstancingPickMeshRenderer.js +376 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/renderers/PointsInstancingShadowRenderer.js +293 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/renderers/PointsInstancingSilhouetteRenderer.js +382 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/TrianglesBatchingBuffer.js +37 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/TrianglesBatchingLayer.js +1017 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/TrianglesBatchingRenderers.js +246 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingColorQualityRenderer.js +809 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingColorRenderer.js +504 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingDepthRenderer.js +297 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingEdgesColorRenderer.js +300 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingEdgesRenderer.js +322 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingNormalsRenderer.js +311 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingOcclusionRenderer.js +291 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingPickDepthRenderer.js +319 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingPickMeshRenderer.js +305 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingPickNormalsRenderer.js +300 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingShadowRenderer.js +242 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingSilhouetteRenderer.js +323 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/TrianglesInstancingLayer.js +969 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/TrianglesInstancingRenderers.js +246 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingColorQualityRenderer.js +859 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingColorRenderer.js +557 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingDepthRenderer.js +341 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingEdgesColorRenderer.js +338 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingEdgesRenderer.js +356 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingNormalsRenderer.js +354 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingOcclusionRenderer.js +329 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingPickDepthRenderer.js +358 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingPickMeshRenderer.js +349 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingPickNormalsRenderer.js +363 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingShadowRenderer.js +284 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingSilhouetteRenderer.js +354 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/Camera.js +880 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/CameraFlightAnimation.js +669 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/CameraPath.js +194 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/CameraPathAnimation.js +326 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/CustomProjection.js +149 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/Frustum.js +316 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/Ortho.js +286 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/Perspective.js +302 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/index.js +2 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/canvas/Canvas.js +464 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/canvas/Spinner.js +323 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/core.js +234 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/Geometry.js +33 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/ReadableGeometry.js +689 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/VBOGeometry.js +327 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildBoxGeometry.js +238 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildBoxLinesGeometry.js +106 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildCylinderGeometry.js +271 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildGridGeometry.js +102 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildPlaneGeometry.js +168 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildSphereGeometry.js +161 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildTorusGeometry.js +172 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildVectorTextGeometry.js +1721 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/index.js +8 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/index.js +4 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/loaders/index.js +2 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/loaders/load3DSGeometry.js +103 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/loaders/loadOBJGeometry.js +130 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/index.js +18 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/input/Input.js +1475 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/libs/canvas2image.js +218 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/libs/k3d.js +1032 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/AmbientLight.js +175 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/CubeTexture.js +156 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/DirLight.js +314 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/Light.js +29 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/LightMap.js +77 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/PointLight.js +395 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/ReflectionMap.js +79 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/Shadow.js +138 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/index.js +5 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/marker/Marker.js +382 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/marker/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/EdgeMaterial.js +359 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/EmphasisMaterial.js +577 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/Fresnel.js +222 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/LambertMaterial.js +378 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/LinesMaterial.js +169 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/Material.js +39 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/MetallicMaterial.js +820 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/PhongMaterial.js +860 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/PointsMaterial.js +320 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/SpecularMaterial.js +807 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/Texture.js +522 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/index.js +8 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/math/Frustum.js +118 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/math/buildEdgeIndices.js +162 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/math/geometryCompressionUtils.js +353 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/math/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/math/math.js +5302 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/math/rtcCoords.js +132 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mementos/CameraMemento.js +200 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mementos/ModelMemento.js +272 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mementos/ObjectsMemento.js +259 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mementos/index.js +3 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/Mesh.js +2165 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/draw/DrawRenderer.js +978 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/draw/DrawShaderSource.js +1566 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/emphasis/EmphasisEdgesRenderer.js +249 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/emphasis/EmphasisEdgesShaderSource.js +163 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/emphasis/EmphasisFillRenderer.js +276 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/emphasis/EmphasisFillShaderSource.js +269 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/occlusion/OcclusionRenderer.js +207 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/occlusion/OcclusionShaderSource.js +156 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/pick/PickMeshRenderer.js +210 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/pick/PickMeshShaderSource.js +146 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/pick/PickTriangleRenderer.js +186 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/pick/PickTriangleShaderSource.js +120 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/shadow/ShadowRenderer.js +214 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/shadow/ShadowShaderSource.js +96 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/metriqs/Metriqs.js +259 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/nodes/Node.js +1356 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/nodes/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/paths/CubicBezierCurve.js +194 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/paths/Curve.js +183 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/paths/Path.js +239 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/paths/QuadraticBezierCurve.js +161 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/paths/SplineCurve.js +133 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/paths/index.js +5 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/postfx/SAO.js +547 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/scene/Scene.js +2481 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/sectionPlane/SectionPlane.js +194 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/sectionPlane/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/skybox/Skybox.js +119 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/skybox/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/stats.js +45 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/utils/Map.js +45 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/utils/Queue.js +56 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/utils/index.js +2 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/utils.js +452 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/viewport/Viewport.js +212 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/ArrayBuf.js +121 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Attribute.js +23 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Drawable.js +270 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/FrameContext.js +259 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/PickResult.js +317 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Pickable.js +69 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Program.js +179 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/RenderBuffer.js +315 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/RenderFlags.js +203 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/RenderState.js +40 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Renderer.js +1300 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Sampler.js +18 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Shader.js +49 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Texture2D.js +217 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/occlusion/OcclusionLayer.js +214 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/occlusion/OcclusionTester.js +432 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/sao/SAODepthLimitedBlurRenderer.js +326 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/sao/SAOOcclusionRenderer.js +375 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/webglEnums.js +61 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webglInfo.js +48 -0
- package/src/lib/gltf/gltf.css +392 -0
- package/src/lib/gltf/gltf.js +2241 -0
- package/webpack.config.js +70 -0
- package/app.js +0 -43
@@ -0,0 +1,77 @@
|
|
1
|
+
import {CubeTexture} from './CubeTexture.js';
|
2
|
+
|
3
|
+
/**
|
4
|
+
* @desc A **LightMap** specifies a cube texture light map.
|
5
|
+
*
|
6
|
+
* ## Usage
|
7
|
+
*
|
8
|
+
* ````javascript
|
9
|
+
* import {Viewer, Mesh, buildSphereGeometry,
|
10
|
+
* ReadableGeometry, MetallicMaterial, LightMap} from "yjkkit-sdk.es.js";
|
11
|
+
*
|
12
|
+
* // Create a Viewer and arrange the camera
|
13
|
+
*
|
14
|
+
* const viewer = new Viewer({
|
15
|
+
* canvasId: "myCanvas"
|
16
|
+
* });
|
17
|
+
*
|
18
|
+
* viewer.scene.camera.eye = [0, 0, 5];
|
19
|
+
* viewer.scene.camera.look = [0, 0, 0];
|
20
|
+
* viewer.scene.camera.up = [0, 1, 0];
|
21
|
+
*
|
22
|
+
* new LightMap(viewer.scene, {
|
23
|
+
* src: [
|
24
|
+
* "textures/light/Uffizi_Gallery/Uffizi_Gallery_Irradiance_PX.png",
|
25
|
+
* "textures/light/Uffizi_Gallery/Uffizi_Gallery_Irradiance_NX.png",
|
26
|
+
* "textures/light/Uffizi_Gallery/Uffizi_Gallery_Irradiance_PY.png",
|
27
|
+
* "textures/light/Uffizi_Gallery/Uffizi_Gallery_Irradiance_NY.png",
|
28
|
+
* "textures/light/Uffizi_Gallery/Uffizi_Gallery_Irradiance_PZ.png",
|
29
|
+
* "textures/light/Uffizi_Gallery/Uffizi_Gallery_Irradiance_NZ.png"
|
30
|
+
* ]
|
31
|
+
* });
|
32
|
+
*
|
33
|
+
* // Create a sphere and ground plane
|
34
|
+
*
|
35
|
+
* new Mesh(viewer.scene, {
|
36
|
+
* geometry: new ReadableGeometry(viewer.scene, buildSphereGeometry({
|
37
|
+
* radius: 2.0
|
38
|
+
* }),
|
39
|
+
* new MetallicMaterial(viewer.scene, {
|
40
|
+
* baseColor: [1, 1, 1],
|
41
|
+
* metallic: 1.0,
|
42
|
+
* roughness: 1.0
|
43
|
+
* })
|
44
|
+
* });
|
45
|
+
* ````
|
46
|
+
*/
|
47
|
+
class LightMap extends CubeTexture {
|
48
|
+
|
49
|
+
/**
|
50
|
+
@private
|
51
|
+
*/
|
52
|
+
get type() {
|
53
|
+
return "LightMap";
|
54
|
+
}
|
55
|
+
|
56
|
+
/**
|
57
|
+
* @constructor
|
58
|
+
* @param {Component} owner Owner component. When destroyed, the owner will destroy this component as well.
|
59
|
+
* @param {*} [cfg] Configs
|
60
|
+
* @param {String} [cfg.id] Optional ID for this LightMap, unique among all components in the parent scene, generated automatically when omitted.
|
61
|
+
* @param {String:Object} [cfg.meta] Optional map of user-defined metadata to attach to this LightMap.
|
62
|
+
* @param {String[]} [cfg.src=null] Paths to six image files to load into this LightMap.
|
63
|
+
* @param {Boolean} [cfg.flipY=false] Flips this LightMap's source data along its vertical axis when true.
|
64
|
+
* @param {String} [cfg.encoding="linear"] Encoding format. See the {@link LightMap#encoding} property for more info.
|
65
|
+
*/
|
66
|
+
constructor(owner, cfg = {}) {
|
67
|
+
super(owner, cfg);
|
68
|
+
this.scene._lightMapCreated(this);
|
69
|
+
}
|
70
|
+
|
71
|
+
destroy() {
|
72
|
+
super.destroy();
|
73
|
+
this.scene._lightMapDestroyed(this);
|
74
|
+
}
|
75
|
+
}
|
76
|
+
|
77
|
+
export {LightMap};
|
@@ -0,0 +1,395 @@
|
|
1
|
+
import {Light} from './Light.js';
|
2
|
+
import {RenderState} from '../webgl/RenderState.js';
|
3
|
+
import {RenderBuffer} from '../webgl/RenderBuffer.js';
|
4
|
+
import {math} from '../math/math.js';
|
5
|
+
|
6
|
+
/**
|
7
|
+
* A positional light source that originates from a single point and spreads outward in all directions, with optional attenuation over distance.
|
8
|
+
*
|
9
|
+
* * Has a position in {@link PointLight#pos}, but no direction.
|
10
|
+
* * Defined in either *World* or *View* coordinate space. When in World-space, {@link PointLight#pos} is relative to
|
11
|
+
* the World coordinate system, and will appear to move as the {@link Camera} moves. When in View-space,
|
12
|
+
* {@link PointLight#pos} is relative to the View coordinate system, and will behave as if fixed to the viewer's head.
|
13
|
+
* * Has {@link PointLight#constantAttenuation}, {@link PointLight#linearAttenuation} and {@link PointLight#quadraticAttenuation}
|
14
|
+
* factors, which indicate how intensity attenuates over distance.
|
15
|
+
* * {@link AmbientLight}s, {@link PointLight}s and {@link PointLight}s are registered by their {@link Component#id} on {@link Scene#lights}.
|
16
|
+
*
|
17
|
+
* ## Usage
|
18
|
+
*
|
19
|
+
* In the example below we'll replace the {@link Scene}'s default light sources with three World-space PointLights.
|
20
|
+
*
|
21
|
+
* [[Run this example](http://yjkkit.github.io/yjkkit-sdk/examples/#lights_PointLight_world)]
|
22
|
+
*
|
23
|
+
* ````javascript
|
24
|
+
* import {Viewer, Mesh, buildSphereGeometry, buildPlaneGeometry,
|
25
|
+
* ReadableGeometry, PhongMaterial, Texture, PointLight} from "yjkkit-sdk.es.js";
|
26
|
+
*
|
27
|
+
* // Create a Viewer and arrange the camera
|
28
|
+
*
|
29
|
+
* const viewer = new Viewer({
|
30
|
+
* canvasId: "myCanvas"
|
31
|
+
* });
|
32
|
+
*
|
33
|
+
* viewer.scene.camera.eye = [0, 0, 5];
|
34
|
+
* viewer.scene.camera.look = [0, 0, 0];
|
35
|
+
* viewer.scene.camera.up = [0, 1, 0];
|
36
|
+
*
|
37
|
+
* // Replace the Scene's default lights with three custom world-space PointLights
|
38
|
+
*
|
39
|
+
* viewer.scene.clearLights();
|
40
|
+
*
|
41
|
+
* new PointLight(viewer.scene,{
|
42
|
+
* id: "keyLight",
|
43
|
+
* pos: [-80, 60, 80],
|
44
|
+
* color: [1.0, 0.3, 0.3],
|
45
|
+
* intensity: 1.0,
|
46
|
+
* space: "world"
|
47
|
+
* });
|
48
|
+
*
|
49
|
+
* new PointLight(viewer.scene,{
|
50
|
+
* id: "fillLight",
|
51
|
+
* pos: [80, 40, 40],
|
52
|
+
* color: [0.3, 1.0, 0.3],
|
53
|
+
* intensity: 1.0,
|
54
|
+
* space: "world"
|
55
|
+
* });
|
56
|
+
*
|
57
|
+
* new PointLight(viewer.scene,{
|
58
|
+
* id: "rimLight",
|
59
|
+
* pos: [-20, 80, -80],
|
60
|
+
* color: [0.6, 0.6, 0.6],
|
61
|
+
* intensity: 1.0,
|
62
|
+
* space: "world"
|
63
|
+
* });
|
64
|
+
*
|
65
|
+
* // Create a sphere and ground plane
|
66
|
+
*
|
67
|
+
* new Mesh(viewer.scene, {
|
68
|
+
* geometry: new ReadableGeometry(viewer.scene, buildSphereGeometry({
|
69
|
+
* radius: 1.3
|
70
|
+
* }),
|
71
|
+
* material: new PhongMaterial(viewer.scene, {
|
72
|
+
* diffuse: [0.7, 0.7, 0.7],
|
73
|
+
* specular: [1.0, 1.0, 1.0],
|
74
|
+
* emissive: [0, 0, 0],
|
75
|
+
* alpha: 1.0,
|
76
|
+
* ambient: [1, 1, 0],
|
77
|
+
* diffuseMap: new Texture(viewer.scene, {
|
78
|
+
* src: "textures/diffuse/uvGrid2.jpg"
|
79
|
+
* })
|
80
|
+
* })
|
81
|
+
* });
|
82
|
+
*
|
83
|
+
* new Mesh(viewer.scene, {
|
84
|
+
* geometry: buildPlaneGeometry(ReadableGeometry, viewer.scene, {
|
85
|
+
* xSize: 30,
|
86
|
+
* zSize: 30
|
87
|
+
* }),
|
88
|
+
* material: new PhongMaterial(viewer.scene, {
|
89
|
+
* diffuseMap: new Texture(viewer.scene, {
|
90
|
+
* src: "textures/diffuse/uvGrid2.jpg"
|
91
|
+
* }),
|
92
|
+
* backfaces: true
|
93
|
+
* }),
|
94
|
+
* position: [0, -2.1, 0]
|
95
|
+
* });
|
96
|
+
* ````
|
97
|
+
*/
|
98
|
+
class PointLight extends Light {
|
99
|
+
|
100
|
+
/**
|
101
|
+
@private
|
102
|
+
*/
|
103
|
+
get type() {
|
104
|
+
return "PointLight";
|
105
|
+
}
|
106
|
+
|
107
|
+
/**
|
108
|
+
* @param {Component} owner Owner component. When destroyed, the owner will destroy this PointLight as well.
|
109
|
+
* @param {*} [cfg] The PointLight configuration
|
110
|
+
* @param {String} [cfg.id] Optional ID, unique among all components in the parent {@link Scene}, generated automatically when omitted.
|
111
|
+
* @param {Number[]} [cfg.pos=[ 1.0, 1.0, 1.0 ]] Position, in either World or View space, depending on the value of the **space** parameter.
|
112
|
+
* @param {Number[]} [cfg.color=[0.7, 0.7, 0.8 ]] Color of this PointLight.
|
113
|
+
* @param {Number} [cfg.intensity=1.0] Intensity of this PointLight, as a factor in range ````[0..1]````.
|
114
|
+
* @param {Number} [cfg.constantAttenuation=0] Constant attenuation factor.
|
115
|
+
* @param {Number} [cfg.linearAttenuation=0] Linear attenuation factor.
|
116
|
+
* @param {Number} [cfg.quadraticAttenuation=0]Quadratic attenuation factor.
|
117
|
+
* @param {String} [cfg.space="view"]The coordinate system this PointLight is defined in - "view" or "world".
|
118
|
+
* @param {Boolean} [cfg.castsShadow=false] Flag which indicates if this PointLight casts a castsShadow.
|
119
|
+
*/
|
120
|
+
constructor(owner, cfg = {}) {
|
121
|
+
|
122
|
+
super(owner, cfg);
|
123
|
+
|
124
|
+
const self = this;
|
125
|
+
|
126
|
+
this._shadowRenderBuf = null;
|
127
|
+
this._shadowViewMatrix = null;
|
128
|
+
this._shadowProjMatrix = null;
|
129
|
+
this._shadowViewMatrixDirty = true;
|
130
|
+
this._shadowProjMatrixDirty = true;
|
131
|
+
|
132
|
+
const camera = this.scene.camera;
|
133
|
+
const canvas = this.scene.canvas;
|
134
|
+
|
135
|
+
this._onCameraViewMatrix = camera.on("viewMatrix", () => {
|
136
|
+
this._shadowViewMatrixDirty = true;
|
137
|
+
});
|
138
|
+
|
139
|
+
this._onCameraProjMatrix = camera.on("projMatrix", () => {
|
140
|
+
this._shadowProjMatrixDirty = true;
|
141
|
+
});
|
142
|
+
|
143
|
+
this._onCanvasBoundary = canvas.on("boundary", () => {
|
144
|
+
this._shadowProjMatrixDirty = true;
|
145
|
+
});
|
146
|
+
|
147
|
+
this._state = new RenderState({
|
148
|
+
|
149
|
+
type: "point",
|
150
|
+
pos: math.vec3([1.0, 1.0, 1.0]),
|
151
|
+
color: math.vec3([0.7, 0.7, 0.8]),
|
152
|
+
intensity: 1.0, attenuation: [0.0, 0.0, 0.0],
|
153
|
+
space: cfg.space || "view",
|
154
|
+
castsShadow: false,
|
155
|
+
|
156
|
+
getShadowViewMatrix: () => {
|
157
|
+
if (self._shadowViewMatrixDirty) {
|
158
|
+
if (!self._shadowViewMatrix) {
|
159
|
+
self._shadowViewMatrix = math.identityMat4();
|
160
|
+
}
|
161
|
+
const eye = self._state.pos;
|
162
|
+
const look = camera.look;
|
163
|
+
const up = camera.up;
|
164
|
+
math.lookAtMat4v(eye, look, up, self._shadowViewMatrix);
|
165
|
+
self._shadowViewMatrixDirty = false;
|
166
|
+
}
|
167
|
+
return self._shadowViewMatrix;
|
168
|
+
},
|
169
|
+
|
170
|
+
getShadowProjMatrix: () => {
|
171
|
+
if (self._shadowProjMatrixDirty) { // TODO: Set when canvas resizes
|
172
|
+
if (!self._shadowProjMatrix) {
|
173
|
+
self._shadowProjMatrix = math.identityMat4();
|
174
|
+
}
|
175
|
+
const canvas = self.scene.canvas.canvas;
|
176
|
+
math.perspectiveMat4(70 * (Math.PI / 180.0), canvas.clientWidth / canvas.clientHeight, 0.1, 500.0, self._shadowProjMatrix);
|
177
|
+
self._shadowProjMatrixDirty = false;
|
178
|
+
}
|
179
|
+
return self._shadowProjMatrix;
|
180
|
+
},
|
181
|
+
|
182
|
+
getShadowRenderBuf: () => {
|
183
|
+
if (!self._shadowRenderBuf) {
|
184
|
+
self._shadowRenderBuf = new RenderBuffer(self.scene.canvas.canvas, self.scene.canvas.gl, {size: [1024, 1024]}); // Super old mobile devices have a limit of 1024x1024 textures
|
185
|
+
}
|
186
|
+
return self._shadowRenderBuf;
|
187
|
+
}
|
188
|
+
});
|
189
|
+
|
190
|
+
this.pos = cfg.pos;
|
191
|
+
this.color = cfg.color;
|
192
|
+
this.intensity = cfg.intensity;
|
193
|
+
this.constantAttenuation = cfg.constantAttenuation;
|
194
|
+
this.linearAttenuation = cfg.linearAttenuation;
|
195
|
+
this.quadraticAttenuation = cfg.quadraticAttenuation;
|
196
|
+
this.castsShadow = cfg.castsShadow;
|
197
|
+
|
198
|
+
this.scene._lightCreated(this);
|
199
|
+
}
|
200
|
+
|
201
|
+
/**
|
202
|
+
* Sets the position of this PointLight.
|
203
|
+
*
|
204
|
+
* This will be either World- or View-space, depending on the value of {@link PointLight#space}.
|
205
|
+
*
|
206
|
+
* Default value is ````[1.0, 1.0, 1.0]````.
|
207
|
+
*
|
208
|
+
* @param {Number[]} pos The position.
|
209
|
+
*/
|
210
|
+
set pos(pos) {
|
211
|
+
this._state.pos.set(pos || [1.0, 1.0, 1.0]);
|
212
|
+
this._shadowViewMatrixDirty = true;
|
213
|
+
this.glRedraw();
|
214
|
+
}
|
215
|
+
|
216
|
+
/**
|
217
|
+
* Gets the position of this PointLight.
|
218
|
+
*
|
219
|
+
* This will be either World- or View-space, depending on the value of {@link PointLight#space}.
|
220
|
+
*
|
221
|
+
* Default value is ````[1.0, 1.0, 1.0]````.
|
222
|
+
*
|
223
|
+
* @returns {Number[]} The position.
|
224
|
+
*/
|
225
|
+
get pos() {
|
226
|
+
return this._state.pos;
|
227
|
+
}
|
228
|
+
|
229
|
+
/**
|
230
|
+
* Sets the RGB color of this PointLight.
|
231
|
+
*
|
232
|
+
* Default value is ````[0.7, 0.7, 0.8]````.
|
233
|
+
*
|
234
|
+
* @param {Number[]} color The PointLight's RGB color.
|
235
|
+
*/
|
236
|
+
set color(color) {
|
237
|
+
this._state.color.set(color || [0.7, 0.7, 0.8]);
|
238
|
+
this.glRedraw();
|
239
|
+
}
|
240
|
+
|
241
|
+
/**
|
242
|
+
* Gets the RGB color of this PointLight.
|
243
|
+
*
|
244
|
+
* Default value is ````[0.7, 0.7, 0.8]````.
|
245
|
+
*
|
246
|
+
* @returns {Number[]} The PointLight's RGB color.
|
247
|
+
*/
|
248
|
+
get color() {
|
249
|
+
return this._state.color;
|
250
|
+
}
|
251
|
+
|
252
|
+
/**
|
253
|
+
* Sets the intensity of this PointLight.
|
254
|
+
*
|
255
|
+
* Default intensity is ````1.0```` for maximum intensity.
|
256
|
+
*
|
257
|
+
* @param {Number} intensity The PointLight's intensity
|
258
|
+
*/
|
259
|
+
set intensity(intensity) {
|
260
|
+
intensity = intensity !== undefined ? intensity : 1.0;
|
261
|
+
this._state.intensity = intensity;
|
262
|
+
this.glRedraw();
|
263
|
+
}
|
264
|
+
|
265
|
+
/**
|
266
|
+
* Gets the intensity of this PointLight.
|
267
|
+
*
|
268
|
+
* Default value is ````1.0```` for maximum intensity.
|
269
|
+
*
|
270
|
+
* @returns {Number} The PointLight's intensity.
|
271
|
+
*/
|
272
|
+
get intensity() {
|
273
|
+
return this._state.intensity;
|
274
|
+
}
|
275
|
+
|
276
|
+
/**
|
277
|
+
* Sets the constant attenuation factor for this PointLight.
|
278
|
+
*
|
279
|
+
* Default value is ````0````.
|
280
|
+
*
|
281
|
+
* @param {Number} value The constant attenuation factor.
|
282
|
+
*/
|
283
|
+
set constantAttenuation(value) {
|
284
|
+
this._state.attenuation[0] = value || 0.0;
|
285
|
+
this.glRedraw();
|
286
|
+
}
|
287
|
+
|
288
|
+
/**
|
289
|
+
* Gets the constant attenuation factor for this PointLight.
|
290
|
+
*
|
291
|
+
* Default value is ````0````.
|
292
|
+
*
|
293
|
+
* @returns {Number} The constant attenuation factor.
|
294
|
+
*/
|
295
|
+
get constantAttenuation() {
|
296
|
+
return this._state.attenuation[0];
|
297
|
+
}
|
298
|
+
|
299
|
+
/**
|
300
|
+
* Sets the linear attenuation factor for this PointLight.
|
301
|
+
*
|
302
|
+
* Default value is ````0````.
|
303
|
+
*
|
304
|
+
* @param {Number} value The linear attenuation factor.
|
305
|
+
*/
|
306
|
+
set linearAttenuation(value) {
|
307
|
+
this._state.attenuation[1] = value || 0.0;
|
308
|
+
this.glRedraw();
|
309
|
+
}
|
310
|
+
|
311
|
+
/**
|
312
|
+
* Gets the linear attenuation factor for this PointLight.
|
313
|
+
*
|
314
|
+
* Default value is ````0````.
|
315
|
+
*
|
316
|
+
* @returns {Number} The linear attenuation factor.
|
317
|
+
*/
|
318
|
+
get linearAttenuation() {
|
319
|
+
return this._state.attenuation[1];
|
320
|
+
}
|
321
|
+
|
322
|
+
/**
|
323
|
+
* Sets the quadratic attenuation factor for this PointLight.
|
324
|
+
*
|
325
|
+
* Default value is ````0````.
|
326
|
+
*
|
327
|
+
* @param {Number} value The quadratic attenuation factor.
|
328
|
+
*/
|
329
|
+
set quadraticAttenuation(value) {
|
330
|
+
this._state.attenuation[2] = value || 0.0;
|
331
|
+
this.glRedraw();
|
332
|
+
}
|
333
|
+
|
334
|
+
/**
|
335
|
+
* Gets the quadratic attenuation factor for this PointLight.
|
336
|
+
*
|
337
|
+
* Default value is ````0````.
|
338
|
+
*
|
339
|
+
* @returns {Number} The quadratic attenuation factor.
|
340
|
+
*/
|
341
|
+
get quadraticAttenuation() {
|
342
|
+
return this._state.attenuation[2];
|
343
|
+
}
|
344
|
+
|
345
|
+
/**
|
346
|
+
* Sets if this PointLight casts a shadow.
|
347
|
+
*
|
348
|
+
* Default value is ````false````.
|
349
|
+
*
|
350
|
+
* @param {Boolean} castsShadow Set ````true```` to cast shadows.
|
351
|
+
*/
|
352
|
+
set castsShadow(castsShadow) {
|
353
|
+
castsShadow = !!castsShadow;
|
354
|
+
if (this._state.castsShadow === castsShadow) {
|
355
|
+
return;
|
356
|
+
}
|
357
|
+
this._state.castsShadow = castsShadow;
|
358
|
+
this._shadowViewMatrixDirty = true;
|
359
|
+
this.glRedraw();
|
360
|
+
}
|
361
|
+
|
362
|
+
/**
|
363
|
+
* Gets if this PointLight casts a shadow.
|
364
|
+
*
|
365
|
+
* Default value is ````false````.
|
366
|
+
*
|
367
|
+
* @returns {Boolean} ````true```` if this PointLight casts shadows.
|
368
|
+
*/
|
369
|
+
get castsShadow() {
|
370
|
+
return this._state.castsShadow;
|
371
|
+
}
|
372
|
+
|
373
|
+
/**
|
374
|
+
* Destroys this PointLight.
|
375
|
+
*/
|
376
|
+
destroy() {
|
377
|
+
|
378
|
+
const camera = this.scene.camera;
|
379
|
+
const canvas = this.scene.canvas;
|
380
|
+
camera.off(this._onCameraViewMatrix);
|
381
|
+
camera.off(this._onCameraProjMatrix);
|
382
|
+
canvas.off(this._onCanvasBoundary);
|
383
|
+
|
384
|
+
super.destroy();
|
385
|
+
|
386
|
+
this._state.destroy();
|
387
|
+
if (this._shadowRenderBuf) {
|
388
|
+
this._shadowRenderBuf.destroy();
|
389
|
+
}
|
390
|
+
this.scene._lightDestroyed(this);
|
391
|
+
this.glRedraw();
|
392
|
+
}
|
393
|
+
}
|
394
|
+
|
395
|
+
export {PointLight};
|
@@ -0,0 +1,79 @@
|
|
1
|
+
import {CubeTexture} from './CubeTexture.js';
|
2
|
+
|
3
|
+
/**
|
4
|
+
* @desc A reflection cube map.
|
5
|
+
*
|
6
|
+
* ## Usage
|
7
|
+
*
|
8
|
+
* ````javascript
|
9
|
+
* import {Viewer, Mesh, buildSphereGeometry,
|
10
|
+
* ReadableGeometry, MetallicMaterial, ReflectionMap} from "yjkkit-sdk.es.js";
|
11
|
+
*
|
12
|
+
* // Create a Viewer and arrange the camera
|
13
|
+
*
|
14
|
+
* const viewer = new Viewer({
|
15
|
+
* canvasId: "myCanvas"
|
16
|
+
* });
|
17
|
+
*
|
18
|
+
* viewer.scene.camera.eye = [0, 0, 5];
|
19
|
+
* viewer.scene.camera.look = [0, 0, 0];
|
20
|
+
* viewer.scene.camera.up = [0, 1, 0];
|
21
|
+
*
|
22
|
+
* new ReflectionMap(viewer.scene, {
|
23
|
+
* src: [
|
24
|
+
* "textures/reflect/Uffizi_Gallery/Uffizi_Gallery_Radiance_PX.png",
|
25
|
+
* "textures/reflect/Uffizi_Gallery/Uffizi_Gallery_Radiance_NX.png",
|
26
|
+
* "textures/reflect/Uffizi_Gallery/Uffizi_Gallery_Radiance_PY.png",
|
27
|
+
* "textures/reflect/Uffizi_Gallery/Uffizi_Gallery_Radiance_NY.png",
|
28
|
+
* "textures/reflect/Uffizi_Gallery/Uffizi_Gallery_Radiance_PZ.png",
|
29
|
+
* "textures/reflect/Uffizi_Gallery/Uffizi_Gallery_Radiance_NZ.png"
|
30
|
+
* ]
|
31
|
+
* });
|
32
|
+
*
|
33
|
+
* // Create a sphere and ground plane
|
34
|
+
*
|
35
|
+
* new Mesh(viewer.scene, {
|
36
|
+
* geometry: new ReadableGeometry(viewer.scene, buildSphereGeometry({
|
37
|
+
* radius: 2.0
|
38
|
+
* }),
|
39
|
+
* new MetallicMaterial(viewer.scene, {
|
40
|
+
* baseColor: [1, 1, 1],
|
41
|
+
* metallic: 1.0,
|
42
|
+
* roughness: 1.0
|
43
|
+
* })
|
44
|
+
* });
|
45
|
+
* ````
|
46
|
+
*/
|
47
|
+
class ReflectionMap extends CubeTexture {
|
48
|
+
|
49
|
+
/**
|
50
|
+
@private
|
51
|
+
*/
|
52
|
+
get type() {
|
53
|
+
return "ReflectionMap";
|
54
|
+
}
|
55
|
+
|
56
|
+
/**
|
57
|
+
* @param {Component} owner Owner component. When destroyed, the owner will destroy this component as well.
|
58
|
+
* @param {*} [cfg] Configs
|
59
|
+
* @param {String} [cfg.id] Optional ID for this ReflectionMap, unique among all components in the parent scene, generated automatically when omitted.
|
60
|
+
* @param {String[]} [cfg.src=null] Paths to six image files to load into this ReflectionMap.
|
61
|
+
* @param {Boolean} [cfg.flipY=false] Flips this ReflectionMap's source data along its vertical axis when true.
|
62
|
+
* @param {String} [cfg.encoding="linear"] Encoding format. See the {@link ReflectionMap/encoding} property for more info.
|
63
|
+
*/
|
64
|
+
constructor(owner, cfg = {}) {
|
65
|
+
super(owner, cfg);
|
66
|
+
this.scene._lightsState.addReflectionMap(this._state);
|
67
|
+
this.scene._reflectionMapCreated(this);
|
68
|
+
}
|
69
|
+
|
70
|
+
/**
|
71
|
+
* Destroys this ReflectionMap.
|
72
|
+
*/
|
73
|
+
destroy() {
|
74
|
+
super.destroy();
|
75
|
+
this.scene._reflectionMapDestroyed(this);
|
76
|
+
}
|
77
|
+
}
|
78
|
+
|
79
|
+
export {ReflectionMap};
|
@@ -0,0 +1,138 @@
|
|
1
|
+
/**
|
2
|
+
A **Shadow** defines a shadow cast by a {@link DirLight} or a {@link SpotLight}.
|
3
|
+
|
4
|
+
Work in progress!
|
5
|
+
|
6
|
+
## Overview
|
7
|
+
|
8
|
+
* Shadows are attached to {@link DirLight} and {@link SpotLight} components.
|
9
|
+
|
10
|
+
TODO
|
11
|
+
|
12
|
+
## Examples
|
13
|
+
|
14
|
+
TODO
|
15
|
+
|
16
|
+
## Usage
|
17
|
+
|
18
|
+
```` javascript
|
19
|
+
var mesh = new yjkkit.Mesh(scene, {
|
20
|
+
|
21
|
+
lights: new yjkkit.Lights({
|
22
|
+
lights: [
|
23
|
+
|
24
|
+
new yjkkit.SpotLight({
|
25
|
+
pos: [0, 100, 100],
|
26
|
+
dir: [0, -1, 0],
|
27
|
+
color: [0.5, 0.7, 0.5],
|
28
|
+
intensity: 1
|
29
|
+
constantAttenuation: 0,
|
30
|
+
linearAttenuation: 0,
|
31
|
+
quadraticAttenuation: 0,
|
32
|
+
space: "view",
|
33
|
+
|
34
|
+
shadow: new yjkkit.Shadow({
|
35
|
+
resolution: [1000, 1000],
|
36
|
+
intensity: 0.7,
|
37
|
+
sampling: "stratified" // "stratified" | "poisson" | "basic"
|
38
|
+
});
|
39
|
+
})
|
40
|
+
]
|
41
|
+
}),
|
42
|
+
,
|
43
|
+
material: new yjkkit.PhongMaterial({
|
44
|
+
diffuse: [0.5, 0.5, 0.0]
|
45
|
+
}),
|
46
|
+
|
47
|
+
geometry: new yjkkit.BoxGeometry()
|
48
|
+
});
|
49
|
+
````
|
50
|
+
|
51
|
+
@class Shadow
|
52
|
+
@module yjkkit
|
53
|
+
@submodule lighting
|
54
|
+
@constructor
|
55
|
+
@extends Component
|
56
|
+
@param {Component} owner Owner component. When destroyed, the owner will destroy this component as well.
|
57
|
+
@param {*} [cfg] The Shadow configuration
|
58
|
+
@param {String} [cfg.id] Optional ID, unique among all components in the parent {@link Scene}, generated automatically when omitted.
|
59
|
+
@param {String:Object} [cfg.meta] Optional map of user-defined metadata to attach to this Shadow.
|
60
|
+
@param [cfg.resolution=[1000,1000]] {Uint16Array} Resolution of the texture map for this Shadow.
|
61
|
+
@param [cfg.intensity=1.0] {Number} Intensity of this Shadow.
|
62
|
+
*/
|
63
|
+
import {Component} from '../Component.js';
|
64
|
+
import {math} from '../math/math.js';
|
65
|
+
|
66
|
+
class Shadow extends Component {
|
67
|
+
|
68
|
+
/**
|
69
|
+
@private
|
70
|
+
*/
|
71
|
+
get type() {
|
72
|
+
return "Shadow";
|
73
|
+
}
|
74
|
+
|
75
|
+
constructor(owner, cfg={}) {
|
76
|
+
|
77
|
+
super(owner, cfg);
|
78
|
+
|
79
|
+
this._state = {
|
80
|
+
resolution: math.vec3([1000, 1000]),
|
81
|
+
intensity: 1.0
|
82
|
+
};
|
83
|
+
|
84
|
+
this.resolution = cfg.resolution;
|
85
|
+
this.intensity = cfg.intensity;
|
86
|
+
}
|
87
|
+
|
88
|
+
/**
|
89
|
+
The resolution of the texture map for this Shadow.
|
90
|
+
|
91
|
+
This will be either World- or View-space, depending on the value of {@link Shadow/space}.
|
92
|
+
|
93
|
+
Fires a {@link Shadow/resolution:event} event on change.
|
94
|
+
|
95
|
+
@property resolution
|
96
|
+
@default [1000, 1000]
|
97
|
+
@type Uint16Array
|
98
|
+
*/
|
99
|
+
set resolution(value) {
|
100
|
+
|
101
|
+
this._state.resolution.set(value || [1000.0, 1000.0]);
|
102
|
+
|
103
|
+
this.glRedraw();
|
104
|
+
}
|
105
|
+
|
106
|
+
get resolution() {
|
107
|
+
return this._state.resolution;
|
108
|
+
}
|
109
|
+
|
110
|
+
/**
|
111
|
+
The intensity of this Shadow.
|
112
|
+
|
113
|
+
Fires a {@link Shadow/intensity:event} event on change.
|
114
|
+
|
115
|
+
@property intensity
|
116
|
+
@default 1.0
|
117
|
+
@type {Number}
|
118
|
+
*/
|
119
|
+
set intensity(value) {
|
120
|
+
|
121
|
+
value = value !== undefined ? value : 1.0;
|
122
|
+
|
123
|
+
this._state.intensity = value;
|
124
|
+
|
125
|
+
this.glRedraw();
|
126
|
+
}
|
127
|
+
|
128
|
+
get intensity() {
|
129
|
+
return this._state.intensity;
|
130
|
+
}
|
131
|
+
|
132
|
+
destroy() {
|
133
|
+
super.destroy();
|
134
|
+
//this._state.destroy();
|
135
|
+
}
|
136
|
+
}
|
137
|
+
|
138
|
+
export {Shadow};
|