csyjk 1.2.2 → 2.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{dist/app.js → app.js} +0 -0
- package/{dist/index.html → index.html} +0 -0
- package/package.json +5 -40
- package/{dist/style.css → style.css} +0 -0
- package/.babelrc +0 -7
- package/.idea/modules.xml +0 -8
- package/.idea/xx.iml +0 -12
- package/public/gltf.js +0 -2241
- package/public/index.html +0 -10
- package/src/index.js +0 -3
- package/src/lib/gltf/assets/check.jpg +0 -0
- package/src/lib/gltf/assets/iconfont/iconfont.css +0 -358
- package/src/lib/gltf/assets/iconfont/iconfont.eot +0 -0
- package/src/lib/gltf/assets/iconfont/iconfont.js +0 -1
- package/src/lib/gltf/assets/iconfont/iconfont.json +0 -604
- package/src/lib/gltf/assets/iconfont/iconfont.svg +0 -189
- package/src/lib/gltf/assets/iconfont/iconfont.ttf +0 -0
- package/src/lib/gltf/assets/iconfont/iconfont.woff +0 -0
- package/src/lib/gltf/assets/iconfont/iconfont.woff2 +0 -0
- package/src/lib/gltf/assets/yjkkit-sdk/index.js +0 -0
- package/src/lib/gltf/assets/yjkkit-sdk/package.json +0 -15
- package/src/lib/gltf/assets/yjkkit-sdk/src/extras/ContextMenu/ContextMenu.js +0 -863
- package/src/lib/gltf/assets/yjkkit-sdk/src/extras/ContextMenu/index.js +0 -1
- package/src/lib/gltf/assets/yjkkit-sdk/src/extras/index.js +0 -1
- package/src/lib/gltf/assets/yjkkit-sdk/src/index.js +0 -3
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AngleMeasurementsPlugin/AngleMeasurement.js +0 -462
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsControl.js +0 -279
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsPlugin.js +0 -262
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AngleMeasurementsPlugin/index.js +0 -1
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AnnotationsPlugin/Annotation.js +0 -362
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AnnotationsPlugin/AnnotationsPlugin.js +0 -575
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AnnotationsPlugin/index.js +0 -1
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AxisGizmoPlugin/AxisGizmoPlugin.js +0 -333
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AxisGizmoPlugin/index.js +0 -1
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/BCFViewpointsPlugin/BCFViewpointsPlugin.js +0 -777
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/BCFViewpointsPlugin/index.js +0 -1
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js +0 -525
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsControl.js +0 -242
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsPlugin.js +0 -297
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/DistanceMeasurementsPlugin/index.js +0 -1
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/FastNavPlugin/FastNavPlugin.js +0 -345
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/FastNavPlugin/index.js +0 -1
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/GLTFLoaderPlugin/GLTFDefaultDataSource.js +0 -122
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/GLTFLoaderPlugin/GLTFLoaderPlugin.js +0 -462
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/GLTFLoaderPlugin/GLTFPerformanceModelLoader.js +0 -508
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/GLTFLoaderPlugin/GLTFSceneGraphLoader.js +0 -922
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/GLTFLoaderPlugin/index.js +0 -2
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/NavCubePlugin/CubeTextureCanvas.js +0 -273
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/NavCubePlugin/NavCubePlugin.js +0 -687
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/NavCubePlugin/index.js +0 -1
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/OBJLoaderPlugin/OBJLoaderPlugin.js +0 -145
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/OBJLoaderPlugin/OBJSceneGraphLoader.js +0 -777
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/OBJLoaderPlugin/index.js +0 -1
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/STLLoaderPlugin/STLDefaultDataSource.js +0 -33
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/STLLoaderPlugin/STLLoaderPlugin.js +0 -273
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/STLLoaderPlugin/STLSceneGraphLoader.js +0 -313
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/STLLoaderPlugin/index.js +0 -2
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/SectionPlanesPlugin/Control.js +0 -1328
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/SectionPlanesPlugin/Overview.js +0 -249
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/SectionPlanesPlugin/Plane.js +0 -169
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/SectionPlanesPlugin/SectionPlanesPlugin.js +0 -403
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/SectionPlanesPlugin/index.js +0 -1
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/SkyboxesPlugin/SkyboxesPlugin.js +0 -134
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/SkyboxesPlugin/index.js +0 -1
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/StoreyViewsPlugin/IFCStoreyPlanObjectStates.js +0 -77
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/StoreyViewsPlugin/Storey.js +0 -61
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/StoreyViewsPlugin/StoreyMap.js +0 -57
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/StoreyViewsPlugin/StoreyViewsPlugin.js +0 -822
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/StoreyViewsPlugin/index.js +0 -1
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/TreeViewPlugin/ModelTreeView.js +0 -888
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/TreeViewPlugin/TreeViewNode.js +0 -88
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/TreeViewPlugin/TreeViewPlugin.js +0 -624
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/TreeViewPlugin/index.js +0 -1
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/TreeViewPlugin/modelValidation.js +0 -87
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/ViewCullPlugin/ViewCullPlugin.js +0 -295
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/ViewCullPlugin/index.js +0 -1
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/XKTDefaultDataSource.js +0 -78
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js +0 -847
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/index.js +0 -2
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV1.js +0 -167
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV2.js +0 -228
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV3.js +0 -220
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV4.js +0 -279
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV5.js +0 -244
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV6.js +0 -301
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV7.js +0 -426
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV8.js +0 -479
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/lib/pako.js +0 -6818
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/XML3DLoaderPlugin.js +0 -238
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/XML3DSceneGraphLoader.js +0 -1279
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/index.js +0 -1
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/.jshintrc +0 -11
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/deflate.js +0 -2060
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/inflate.js +0 -2155
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/mime-types.js +0 -1002
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/pako/codecs.js +0 -64
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/z-worker.js +0 -153
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/zip-ext.js +0 -267
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/zip-fs.js +0 -553
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/zip.js +0 -991
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/zlib-asm/codecs.js +0 -49
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/index.js +0 -17
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/lib/culling/ObjectCullStates.js +0 -205
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/lib/html/Dot.js +0 -78
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/lib/html/Label.js +0 -97
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/lib/html/Wire.js +0 -95
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/Plugin.js +0 -112
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/Viewer.js +0 -372
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/index.js +0 -3
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/metadata/IFCObjectDefaultColors.js +0 -162
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/metadata/IFCObjectDefaults.js +0 -39
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/metadata/MetaModel.js +0 -145
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/metadata/MetaObject.js +0 -215
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/metadata/MetaScene.js +0 -311
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/CameraControl.js +0 -1669
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/cc.js +0 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/CameraUpdater.js +0 -312
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/controllers/PanController.js +0 -112
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/controllers/PickController.js +0 -193
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/controllers/PivotController.js +0 -289
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/cu.js +0 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/KeyboardAxisViewHandler.js +0 -122
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/KeyboardPanRotateDollyHandler.js +0 -186
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/MouseMiscHandler.js +0 -68
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/MousePanRotateDollyHandler.js +0 -439
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/MousePickHandler.js +0 -361
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/TouchPanRotateAndDollyHandler.js +0 -258
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/TouchPickHandler.js +0 -197
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/mouspan.js +0 -498
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/Component.js +0 -908
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/Entity.js +0 -475
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/ImagePlane/ImagePlane.js +0 -570
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/ImagePlane/index.js +0 -1
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/PerformanceModel.js +0 -2623
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/index.js +0 -1
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/ENTITY_FLAGS.js +0 -21
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/PerformanceMesh.js +0 -262
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/PerformanceNode.js +0 -697
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/RENDER_PASSES.js +0 -34
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/ScratchMemory.js +0 -63
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/compression.js +0 -183
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesBatching/LinesBatchingBuffer.js +0 -33
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesBatching/LinesBatchingLayer.js +0 -736
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesBatching/LinesBatchingRenderers.js +0 -68
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesBatching/renderers/LinesBatchingColorRenderer.js +0 -295
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesBatching/renderers/LinesBatchingSilhouetteRenderer.js +0 -327
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesInstancing/LinesInstancingLayer.js +0 -698
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesInstancing/LinesInstancingRenderers.js +0 -68
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesInstancing/renderers/LinesInstancingColorRenderer.js +0 -364
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesInstancing/renderers/LinesInstancingSilhouetteRenderer.js +0 -356
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/PointsBatchingBuffer.js +0 -33
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/PointsBatchingLayer.js +0 -776
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/PointsBatchingRenderers.js +0 -113
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/renderers/PointsBatchingColorRenderer.js +0 -340
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/renderers/PointsBatchingOcclusionRenderer.js +0 -312
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/renderers/PointsBatchingPickDepthRenderer.js +0 -343
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/renderers/PointsBatchingPickMeshRenderer.js +0 -331
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/renderers/PointsBatchingShadowRenderer.js +0 -242
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/renderers/PointsBatchingSilhouetteRenderer.js +0 -348
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/PointsInstancingLayer.js +0 -737
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/PointsInstancingRenderers.js +0 -143
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/renderers/PointsInstancingColorRenderer.js +0 -373
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/renderers/PointsInstancingDepthRenderer.js +0 -366
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/renderers/PointsInstancingOcclusionRenderer.js +0 -370
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/renderers/PointsInstancingPickDepthRenderer.js +0 -386
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/renderers/PointsInstancingPickMeshRenderer.js +0 -376
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/renderers/PointsInstancingShadowRenderer.js +0 -293
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/renderers/PointsInstancingSilhouetteRenderer.js +0 -382
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/TrianglesBatchingBuffer.js +0 -37
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/TrianglesBatchingLayer.js +0 -1017
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/TrianglesBatchingRenderers.js +0 -246
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingColorQualityRenderer.js +0 -809
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingColorRenderer.js +0 -504
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingDepthRenderer.js +0 -297
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingEdgesColorRenderer.js +0 -300
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingEdgesRenderer.js +0 -322
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingNormalsRenderer.js +0 -311
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingOcclusionRenderer.js +0 -291
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingPickDepthRenderer.js +0 -319
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingPickMeshRenderer.js +0 -305
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingPickNormalsRenderer.js +0 -300
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingShadowRenderer.js +0 -242
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingSilhouetteRenderer.js +0 -323
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/TrianglesInstancingLayer.js +0 -969
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/TrianglesInstancingRenderers.js +0 -246
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingColorQualityRenderer.js +0 -859
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingColorRenderer.js +0 -557
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingDepthRenderer.js +0 -341
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingEdgesColorRenderer.js +0 -338
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingEdgesRenderer.js +0 -356
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingNormalsRenderer.js +0 -354
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingOcclusionRenderer.js +0 -329
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingPickDepthRenderer.js +0 -358
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingPickMeshRenderer.js +0 -349
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingPickNormalsRenderer.js +0 -363
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingShadowRenderer.js +0 -284
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingSilhouetteRenderer.js +0 -354
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/Camera.js +0 -880
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/CameraFlightAnimation.js +0 -669
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/CameraPath.js +0 -194
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/CameraPathAnimation.js +0 -326
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/CustomProjection.js +0 -149
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/Frustum.js +0 -316
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/Ortho.js +0 -286
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/Perspective.js +0 -302
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/index.js +0 -2
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/canvas/Canvas.js +0 -464
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/canvas/Spinner.js +0 -323
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/core.js +0 -234
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/Geometry.js +0 -33
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/ReadableGeometry.js +0 -689
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/VBOGeometry.js +0 -327
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildBoxGeometry.js +0 -238
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildBoxLinesGeometry.js +0 -106
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildCylinderGeometry.js +0 -271
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildGridGeometry.js +0 -102
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildPlaneGeometry.js +0 -168
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildSphereGeometry.js +0 -161
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildTorusGeometry.js +0 -172
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildVectorTextGeometry.js +0 -1721
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/index.js +0 -8
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/index.js +0 -4
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/loaders/index.js +0 -2
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/loaders/load3DSGeometry.js +0 -103
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/loaders/loadOBJGeometry.js +0 -130
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/index.js +0 -18
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/input/Input.js +0 -1475
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/libs/canvas2image.js +0 -218
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/libs/k3d.js +0 -1032
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/AmbientLight.js +0 -175
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/CubeTexture.js +0 -156
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/DirLight.js +0 -314
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/Light.js +0 -29
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/LightMap.js +0 -77
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/PointLight.js +0 -395
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/ReflectionMap.js +0 -79
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/Shadow.js +0 -138
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/index.js +0 -5
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/marker/Marker.js +0 -382
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/marker/index.js +0 -1
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/EdgeMaterial.js +0 -359
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/EmphasisMaterial.js +0 -577
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/Fresnel.js +0 -222
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/LambertMaterial.js +0 -378
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/LinesMaterial.js +0 -169
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/Material.js +0 -39
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/MetallicMaterial.js +0 -820
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/PhongMaterial.js +0 -860
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/PointsMaterial.js +0 -320
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/SpecularMaterial.js +0 -807
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/Texture.js +0 -522
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/index.js +0 -8
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/math/Frustum.js +0 -118
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/math/buildEdgeIndices.js +0 -162
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/math/geometryCompressionUtils.js +0 -353
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/math/index.js +0 -1
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/math/math.js +0 -5302
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/math/rtcCoords.js +0 -132
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mementos/CameraMemento.js +0 -200
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mementos/ModelMemento.js +0 -272
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mementos/ObjectsMemento.js +0 -259
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mementos/index.js +0 -3
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/Mesh.js +0 -2165
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/draw/DrawRenderer.js +0 -978
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/draw/DrawShaderSource.js +0 -1566
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/emphasis/EmphasisEdgesRenderer.js +0 -249
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/emphasis/EmphasisEdgesShaderSource.js +0 -163
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/emphasis/EmphasisFillRenderer.js +0 -276
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/emphasis/EmphasisFillShaderSource.js +0 -269
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/index.js +0 -1
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/occlusion/OcclusionRenderer.js +0 -207
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/occlusion/OcclusionShaderSource.js +0 -156
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/pick/PickMeshRenderer.js +0 -210
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/pick/PickMeshShaderSource.js +0 -146
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/pick/PickTriangleRenderer.js +0 -186
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/pick/PickTriangleShaderSource.js +0 -120
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/shadow/ShadowRenderer.js +0 -214
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/shadow/ShadowShaderSource.js +0 -96
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/metriqs/Metriqs.js +0 -259
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/nodes/Node.js +0 -1356
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/nodes/index.js +0 -1
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/paths/CubicBezierCurve.js +0 -194
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/paths/Curve.js +0 -183
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/paths/Path.js +0 -239
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/paths/QuadraticBezierCurve.js +0 -161
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/paths/SplineCurve.js +0 -133
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/paths/index.js +0 -5
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/postfx/SAO.js +0 -547
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/scene/Scene.js +0 -2481
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/sectionPlane/SectionPlane.js +0 -194
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/sectionPlane/index.js +0 -1
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/skybox/Skybox.js +0 -119
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/skybox/index.js +0 -1
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/stats.js +0 -45
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/utils/Map.js +0 -45
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/utils/Queue.js +0 -56
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/utils/index.js +0 -2
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/utils.js +0 -452
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/viewport/Viewport.js +0 -212
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/ArrayBuf.js +0 -121
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Attribute.js +0 -23
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Drawable.js +0 -270
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/FrameContext.js +0 -259
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/PickResult.js +0 -317
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Pickable.js +0 -69
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Program.js +0 -179
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/RenderBuffer.js +0 -315
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/RenderFlags.js +0 -203
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/RenderState.js +0 -40
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Renderer.js +0 -1300
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Sampler.js +0 -18
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Shader.js +0 -49
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Texture2D.js +0 -217
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/occlusion/OcclusionLayer.js +0 -214
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/occlusion/OcclusionTester.js +0 -432
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/sao/SAODepthLimitedBlurRenderer.js +0 -326
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/sao/SAOOcclusionRenderer.js +0 -375
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/webglEnums.js +0 -61
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webglInfo.js +0 -48
- package/src/lib/gltf/gltf.css +0 -392
- package/src/lib/gltf/gltf.js +0 -2241
- package/webpack.config.js +0 -70
|
@@ -1,522 +0,0 @@
|
|
|
1
|
-
import {Component} from '../Component.js';
|
|
2
|
-
import {RenderState} from '../webgl/RenderState.js';
|
|
3
|
-
import {Texture2D} from '../webgl/Texture2D.js';
|
|
4
|
-
import {math} from '../math/math.js';
|
|
5
|
-
import {stats} from '../stats.js';
|
|
6
|
-
|
|
7
|
-
function ensureImageSizePowerOfTwo(image) {
|
|
8
|
-
if (!isPowerOfTwo(image.width) || !isPowerOfTwo(image.height)) {
|
|
9
|
-
const canvas = document.createElement("canvas");
|
|
10
|
-
canvas.width = nextHighestPowerOfTwo(image.width);
|
|
11
|
-
canvas.height = nextHighestPowerOfTwo(image.height);
|
|
12
|
-
const ctx = canvas.getContext("2d");
|
|
13
|
-
ctx.drawImage(image,
|
|
14
|
-
0, 0, image.width, image.height,
|
|
15
|
-
0, 0, canvas.width, canvas.height);
|
|
16
|
-
image = canvas;
|
|
17
|
-
}
|
|
18
|
-
return image;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function isPowerOfTwo(x) {
|
|
22
|
-
return (x & (x - 1)) === 0;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function nextHighestPowerOfTwo(x) {
|
|
26
|
-
--x;
|
|
27
|
-
for (let i = 1; i < 32; i <<= 1) {
|
|
28
|
-
x = x | x >> i;
|
|
29
|
-
}
|
|
30
|
-
return x + 1;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* @desc A 2D texture map.
|
|
35
|
-
*
|
|
36
|
-
* * Textures are attached to {@link Material}s, which are attached to {@link Mesh}es.
|
|
37
|
-
* * To create a Texture from an image file, set {@link Texture#src} to the image file path.
|
|
38
|
-
* * To create a Texture from an HTMLImageElement, set the Texture's {@link Texture#image} to the HTMLImageElement.
|
|
39
|
-
*
|
|
40
|
-
* ## Usage
|
|
41
|
-
*
|
|
42
|
-
* In this example we have a Mesh with a {@link PhongMaterial} which applies diffuse {@link Texture}, and a {@link buildTorusGeometry} which builds a {@link ReadableGeometry}.
|
|
43
|
-
*
|
|
44
|
-
* Note that yjkkit will ignore {@link PhongMaterial#diffuse} and {@link PhongMaterial#specular}, since we override those
|
|
45
|
-
* with {@link PhongMaterial#diffuseMap} and {@link PhongMaterial#specularMap}. The {@link Texture} pixel colors directly
|
|
46
|
-
* provide the diffuse and specular components for each fragment across the {@link ReadableGeometry} surface.
|
|
47
|
-
*
|
|
48
|
-
* [[Run this example](http://yjkkit.github.io/yjkkit-sdk/examples/#materials_Texture)]
|
|
49
|
-
*
|
|
50
|
-
* ```` javascript
|
|
51
|
-
* import {Viewer, Mesh, buildTorusGeometry,
|
|
52
|
-
* ReadableGeometry, PhongMaterial, Texture} from "yjkkit-sdk.es.js";
|
|
53
|
-
*
|
|
54
|
-
* const viewer = new Viewer({
|
|
55
|
-
* canvasId: "myCanvas"
|
|
56
|
-
* });
|
|
57
|
-
*
|
|
58
|
-
* viewer.camera.eye = [0, 0, 5];
|
|
59
|
-
* viewer.camera.look = [0, 0, 0];
|
|
60
|
-
* viewer.camera.up = [0, 1, 0];
|
|
61
|
-
*
|
|
62
|
-
* new Mesh(viewer.scene, {
|
|
63
|
-
* geometry: new ReadableGeometry(viewer.scene, buildTorusGeometry({
|
|
64
|
-
* center: [0, 0, 0],
|
|
65
|
-
* radius: 1.5,
|
|
66
|
-
* tube: 0.5,
|
|
67
|
-
* radialSegments: 32,
|
|
68
|
-
* tubeSegments: 24,
|
|
69
|
-
* arc: Math.PI * 2.0
|
|
70
|
-
* }),
|
|
71
|
-
* material: new PhongMaterial(viewer.scene, {
|
|
72
|
-
* ambient: [0.9, 0.3, 0.9],
|
|
73
|
-
* shininess: 30,
|
|
74
|
-
* diffuseMap: new Texture(viewer.scene, {
|
|
75
|
-
* src: "textures/diffuse/uvGrid2.jpg"
|
|
76
|
-
* })
|
|
77
|
-
* })
|
|
78
|
-
* });
|
|
79
|
-
*````
|
|
80
|
-
*/
|
|
81
|
-
class Texture extends Component {
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
@private
|
|
85
|
-
*/
|
|
86
|
-
get type() {
|
|
87
|
-
return "Texture";
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* @constructor
|
|
92
|
-
* @param {Component} owner Owner component. When destroyed, the owner will destroy this Texture as well.
|
|
93
|
-
* @param {*} [cfg] Configs
|
|
94
|
-
* @param {String} [cfg.id] Optional ID for this Texture, unique among all components in the parent scene, generated automatically when omitted.
|
|
95
|
-
* @param {String} [cfg.src=null] Path to image file to load into this Texture. See the {@link Texture#src} property for more info.
|
|
96
|
-
* @param {HTMLImageElement} [cfg.image=null] HTML Image object to load into this Texture. See the {@link Texture#image} property for more info.
|
|
97
|
-
* @param {String} [cfg.minFilter="linearMipmapLinear"] How the texture is sampled when a texel covers less than one pixel. See the {@link Texture#minFilter} property for more info.
|
|
98
|
-
* @param {String} [cfg.magFilter="linear"] How the texture is sampled when a texel covers more than one pixel. See the {@link Texture#magFilter} property for more info.
|
|
99
|
-
* @param {String} [cfg.wrapS="repeat"] Wrap parameter for texture coordinate *S*. See the {@link Texture#wrapS} property for more info.
|
|
100
|
-
* @param {String} [cfg.wrapT="repeat"] Wrap parameter for texture coordinate *S*. See the {@link Texture#wrapT} property for more info.
|
|
101
|
-
* @param {Boolean} [cfg.flipY=false] Flips this Texture's source data along its vertical axis when true.
|
|
102
|
-
* @param {Number[]} [cfg.translate=[0,0]] 2D translation vector that will be added to texture's *S* and *T* coordinates.
|
|
103
|
-
* @param {Number[]} [cfg.scale=[1,1]] 2D scaling vector that will be applied to texture's *S* and *T* coordinates.
|
|
104
|
-
* @param {Number} [cfg.rotate=0] Rotation, in degrees, that will be applied to texture's *S* and *T* coordinates.
|
|
105
|
-
* @param {String} [cfg.encoding="linear"] Encoding format. See the {@link Texture#encoding} property for more info.
|
|
106
|
-
*/
|
|
107
|
-
constructor(owner, cfg = {}) {
|
|
108
|
-
|
|
109
|
-
super(owner, cfg);
|
|
110
|
-
|
|
111
|
-
this._state = new RenderState({
|
|
112
|
-
texture: new Texture2D(this.scene.canvas.gl),
|
|
113
|
-
matrix: math.identityMat4(),
|
|
114
|
-
hasMatrix: (cfg.translate && (cfg.translate[0] !== 0 || cfg.translate[1] !== 0)) || (!!cfg.rotate) || (cfg.scale && (cfg.scale[0] !== 0 || cfg.scale[1] !== 0)),
|
|
115
|
-
minFilter: this._checkMinFilter(cfg.minFilter),
|
|
116
|
-
magFilter: this._checkMagFilter(cfg.magFilter),
|
|
117
|
-
wrapS: this._checkWrapS(cfg.wrapS),
|
|
118
|
-
wrapT: this._checkWrapT(cfg.wrapT),
|
|
119
|
-
flipY: this._checkFlipY(cfg.flipY),
|
|
120
|
-
encoding: this._checkEncoding(cfg.encoding)
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
// Data source
|
|
124
|
-
|
|
125
|
-
this._src = null;
|
|
126
|
-
this._image = null;
|
|
127
|
-
|
|
128
|
-
// Transformation
|
|
129
|
-
|
|
130
|
-
this._translate = math.vec2([0, 0]);
|
|
131
|
-
this._scale = math.vec2([1, 1]);
|
|
132
|
-
this._rotate = math.vec2([0, 0]);
|
|
133
|
-
|
|
134
|
-
this._matrixDirty = false;
|
|
135
|
-
|
|
136
|
-
// Transform
|
|
137
|
-
|
|
138
|
-
this.translate = cfg.translate;
|
|
139
|
-
this.scale = cfg.scale;
|
|
140
|
-
this.rotate = cfg.rotate;
|
|
141
|
-
|
|
142
|
-
// Data source
|
|
143
|
-
|
|
144
|
-
if (cfg.src) {
|
|
145
|
-
this.src = cfg.src; // Image file
|
|
146
|
-
} else if (cfg.image) {
|
|
147
|
-
this.image = cfg.image; // Image object
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
stats.memory.textures++;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
_checkMinFilter(value) {
|
|
154
|
-
value = value || "linearMipmapLinear";
|
|
155
|
-
if (value !== "linear" &&
|
|
156
|
-
value !== "linearMipmapNearest" &&
|
|
157
|
-
value !== "linearMipmapLinear" &&
|
|
158
|
-
value !== "nearestMipmapLinear" &&
|
|
159
|
-
value !== "nearestMipmapNearest") {
|
|
160
|
-
this.error("Unsupported value for 'minFilter': '" + value +
|
|
161
|
-
"' - supported values are 'linear', 'linearMipmapNearest', 'nearestMipmapNearest', " +
|
|
162
|
-
"'nearestMipmapLinear' and 'linearMipmapLinear'. Defaulting to 'linearMipmapLinear'.");
|
|
163
|
-
value = "linearMipmapLinear";
|
|
164
|
-
}
|
|
165
|
-
return value;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
_checkMagFilter(value) {
|
|
169
|
-
value = value || "linear";
|
|
170
|
-
if (value !== "linear" && value !== "nearest") {
|
|
171
|
-
this.error("Unsupported value for 'magFilter': '" + value +
|
|
172
|
-
"' - supported values are 'linear' and 'nearest'. Defaulting to 'linear'.");
|
|
173
|
-
value = "linear";
|
|
174
|
-
}
|
|
175
|
-
return value;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
_checkFilter(value) {
|
|
179
|
-
value = value || "linear";
|
|
180
|
-
if (value !== "linear" && value !== "nearest") {
|
|
181
|
-
this.error("Unsupported value for 'magFilter': '" + value +
|
|
182
|
-
"' - supported values are 'linear' and 'nearest'. Defaulting to 'linear'.");
|
|
183
|
-
value = "linear";
|
|
184
|
-
}
|
|
185
|
-
return value;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
_checkWrapS(value) {
|
|
189
|
-
value = value || "repeat";
|
|
190
|
-
if (value !== "clampToEdge" && value !== "mirroredRepeat" && value !== "repeat") {
|
|
191
|
-
this.error("Unsupported value for 'wrapS': '" + value +
|
|
192
|
-
"' - supported values are 'clampToEdge', 'mirroredRepeat' and 'repeat'. Defaulting to 'repeat'.");
|
|
193
|
-
value = "repeat";
|
|
194
|
-
}
|
|
195
|
-
return value;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
_checkWrapT(value) {
|
|
199
|
-
value = value || "repeat";
|
|
200
|
-
if (value !== "clampToEdge" && value !== "mirroredRepeat" && value !== "repeat") {
|
|
201
|
-
this.error("Unsupported value for 'wrapT': '" + value +
|
|
202
|
-
"' - supported values are 'clampToEdge', 'mirroredRepeat' and 'repeat'. Defaulting to 'repeat'.");
|
|
203
|
-
value = "repeat";
|
|
204
|
-
}
|
|
205
|
-
return value;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
_checkFlipY(value) {
|
|
209
|
-
return !!value;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
_checkEncoding(value) {
|
|
213
|
-
value = value || "linear";
|
|
214
|
-
if (value !== "linear" && value !== "sRGB" && value !== "gamma") {
|
|
215
|
-
this.error("Unsupported value for 'encoding': '" + value + "' - supported values are 'linear', 'sRGB', 'gamma'. Defaulting to 'linear'.");
|
|
216
|
-
value = "linear";
|
|
217
|
-
}
|
|
218
|
-
return value;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
_webglContextRestored() {
|
|
222
|
-
this._state.texture = new Texture2D(this.scene.canvas.gl);
|
|
223
|
-
if (this._image) {
|
|
224
|
-
this.image = this._image;
|
|
225
|
-
} else if (this._src) {
|
|
226
|
-
this.src = this._src;
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
_update() {
|
|
231
|
-
const state = this._state;
|
|
232
|
-
if (this._matrixDirty) {
|
|
233
|
-
let matrix;
|
|
234
|
-
let t;
|
|
235
|
-
if (this._translate[0] !== 0 || this._translate[1] !== 0) {
|
|
236
|
-
matrix = math.translationMat4v([this._translate[0], this._translate[1], 0], this._state.matrix);
|
|
237
|
-
}
|
|
238
|
-
if (this._scale[0] !== 1 || this._scale[1] !== 1) {
|
|
239
|
-
t = math.scalingMat4v([this._scale[0], this._scale[1], 1]);
|
|
240
|
-
matrix = matrix ? math.mulMat4(matrix, t) : t;
|
|
241
|
-
}
|
|
242
|
-
if (this._rotate !== 0) {
|
|
243
|
-
t = math.rotationMat4v(this._rotate * 0.0174532925, [0, 0, 1]);
|
|
244
|
-
matrix = matrix ? math.mulMat4(matrix, t) : t;
|
|
245
|
-
}
|
|
246
|
-
if (matrix) {
|
|
247
|
-
state.matrix = matrix;
|
|
248
|
-
}
|
|
249
|
-
this._matrixDirty = false;
|
|
250
|
-
}
|
|
251
|
-
this.glRedraw();
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
/**
|
|
256
|
-
* Sets an HTML DOM Image object to source this Texture from.
|
|
257
|
-
*
|
|
258
|
-
* Sets {@link Texture#src} null.
|
|
259
|
-
*
|
|
260
|
-
* @type {HTMLImageElement}
|
|
261
|
-
*/
|
|
262
|
-
set image(value) {
|
|
263
|
-
this._image = ensureImageSizePowerOfTwo(value);
|
|
264
|
-
this._image.crossOrigin = "Anonymous";
|
|
265
|
-
this._state.texture.setImage(this._image, this._state);
|
|
266
|
-
this._state.texture.setProps(this._state); // Generate mipmaps
|
|
267
|
-
this._src = null;
|
|
268
|
-
this.glRedraw();
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
/**
|
|
272
|
-
* Gets HTML DOM Image object this Texture is sourced from, if any.
|
|
273
|
-
*
|
|
274
|
-
* Returns null if not set.
|
|
275
|
-
*
|
|
276
|
-
* @type {HTMLImageElement}
|
|
277
|
-
*/
|
|
278
|
-
get image() {
|
|
279
|
-
return this._image;
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
/**
|
|
283
|
-
* Sets path to an image file to source this Texture from.
|
|
284
|
-
*
|
|
285
|
-
* Sets {@link Texture#image} null.
|
|
286
|
-
*
|
|
287
|
-
* @type {String}
|
|
288
|
-
*/
|
|
289
|
-
set src(src) {
|
|
290
|
-
this.scene.loading++;
|
|
291
|
-
this.scene.canvas.spinner.processes++;
|
|
292
|
-
const self = this;
|
|
293
|
-
let image = new Image();
|
|
294
|
-
image.onload = function () {
|
|
295
|
-
image = ensureImageSizePowerOfTwo(image);
|
|
296
|
-
//self._image = image; // For faster WebGL context restore - memory inefficient?
|
|
297
|
-
self._state.texture.setImage(image, self._state);
|
|
298
|
-
self._state.texture.setProps(self._state); // Generate mipmaps
|
|
299
|
-
self.scene.loading--;
|
|
300
|
-
self.glRedraw();
|
|
301
|
-
self.scene.canvas.spinner.processes--;
|
|
302
|
-
};
|
|
303
|
-
image.src = src;
|
|
304
|
-
this._src = src;
|
|
305
|
-
this._image = null;
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
/**
|
|
309
|
-
* Gets path to the image file this Texture from, if any.
|
|
310
|
-
*
|
|
311
|
-
* Returns null if not set.
|
|
312
|
-
*
|
|
313
|
-
* @type {String}
|
|
314
|
-
*/
|
|
315
|
-
get src() {
|
|
316
|
-
return this._src;
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
/**
|
|
320
|
-
* Sets the 2D translation vector added to this Texture's *S* and *T* UV coordinates.
|
|
321
|
-
*
|
|
322
|
-
* Default value is ````[0, 0]````.
|
|
323
|
-
*
|
|
324
|
-
* @type {Number[]}
|
|
325
|
-
*/
|
|
326
|
-
set translate(value) {
|
|
327
|
-
this._translate.set(value || [0, 0]);
|
|
328
|
-
this._matrixDirty = true;
|
|
329
|
-
this._needUpdate();
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
/**
|
|
333
|
-
* Gets the 2D translation vector added to this Texture's *S* and *T* UV coordinates.
|
|
334
|
-
*
|
|
335
|
-
* Default value is ````[0, 0]````.
|
|
336
|
-
*
|
|
337
|
-
* @type {Number[]}
|
|
338
|
-
*/
|
|
339
|
-
get translate() {
|
|
340
|
-
return this._translate;
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
/**
|
|
344
|
-
* Sets the 2D scaling vector that will be applied to this Texture's *S* and *T* UV coordinates.
|
|
345
|
-
*
|
|
346
|
-
* Default value is ````[1, 1]````.
|
|
347
|
-
*
|
|
348
|
-
* @type {Number[]}
|
|
349
|
-
*/
|
|
350
|
-
set scale(value) {
|
|
351
|
-
this._scale.set(value || [1, 1]);
|
|
352
|
-
this._matrixDirty = true;
|
|
353
|
-
this._needUpdate();
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
/**
|
|
357
|
-
* Gets the 2D scaling vector that will be applied to this Texture's *S* and *T* UV coordinates.
|
|
358
|
-
*
|
|
359
|
-
* Default value is ````[1, 1]````.
|
|
360
|
-
*
|
|
361
|
-
* @type {Number[]}
|
|
362
|
-
*/
|
|
363
|
-
get scale() {
|
|
364
|
-
return this._scale;
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
/**
|
|
368
|
-
* Sets the rotation angles, in degrees, that will be applied to this Texture's *S* and *T* UV coordinates.
|
|
369
|
-
*
|
|
370
|
-
* Default value is ````0````.
|
|
371
|
-
*
|
|
372
|
-
* @type {Number}
|
|
373
|
-
*/
|
|
374
|
-
set rotate(value) {
|
|
375
|
-
value = value || 0;
|
|
376
|
-
if (this._rotate === value) {
|
|
377
|
-
return;
|
|
378
|
-
}
|
|
379
|
-
this._rotate = value;
|
|
380
|
-
this._matrixDirty = true;
|
|
381
|
-
this._needUpdate();
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
/**
|
|
385
|
-
* Gets the rotation angles, in degrees, that will be applied to this Texture's *S* and *T* UV coordinates.
|
|
386
|
-
*
|
|
387
|
-
* Default value is ````0````.
|
|
388
|
-
*
|
|
389
|
-
* @type {Number}
|
|
390
|
-
*/
|
|
391
|
-
get rotate() {
|
|
392
|
-
return this._rotate;
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
/**
|
|
396
|
-
* Gets how this Texture is sampled when a texel covers less than one pixel.
|
|
397
|
-
*
|
|
398
|
-
* Options are:
|
|
399
|
-
*
|
|
400
|
-
* * "nearest" - Uses the value of the texture element that is nearest
|
|
401
|
-
* (in Manhattan distance) to the center of the pixel being textured.
|
|
402
|
-
*
|
|
403
|
-
* * "linear" - Uses the weighted average of the four texture elements that are
|
|
404
|
-
* closest to the center of the pixel being textured.
|
|
405
|
-
*
|
|
406
|
-
* * "nearestMipmapNearest" - Chooses the mipmap that most closely matches the
|
|
407
|
-
* size of the pixel being textured and uses the "nearest" criterion (the texture
|
|
408
|
-
* element nearest to the center of the pixel) to produce a texture value.
|
|
409
|
-
*
|
|
410
|
-
* * "linearMipmapNearest" - Chooses the mipmap that most closely matches the size of
|
|
411
|
-
* the pixel being textured and uses the "linear" criterion (a weighted average of the
|
|
412
|
-
* four texture elements that are closest to the center of the pixel) to produce a
|
|
413
|
-
* texture value.
|
|
414
|
-
*
|
|
415
|
-
* * "nearestMipmapLinear" - Chooses the two mipmaps that most closely
|
|
416
|
-
* match the size of the pixel being textured and uses the "nearest" criterion
|
|
417
|
-
* (the texture element nearest to the center of the pixel) to produce a texture
|
|
418
|
-
* value from each mipmap. The final texture value is a weighted average of those two
|
|
419
|
-
* values.
|
|
420
|
-
*
|
|
421
|
-
* * "linearMipmapLinear" - (default) - Chooses the two mipmaps that most closely match the size
|
|
422
|
-
* of the pixel being textured and uses the "linear" criterion (a weighted average
|
|
423
|
-
* of the four texture elements that are closest to the center of the pixel) to
|
|
424
|
-
* produce a texture value from each mipmap. The final texture value is a weighted
|
|
425
|
-
* average of those two values.
|
|
426
|
-
*
|
|
427
|
-
* Default value is "linearMipmapLinear".
|
|
428
|
-
*
|
|
429
|
-
* @type {String}
|
|
430
|
-
*/
|
|
431
|
-
get minFilter() {
|
|
432
|
-
return this._state.minFilter;
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
/**
|
|
436
|
-
* Gets how this Texture is sampled when a texel covers more than one pixel.
|
|
437
|
-
*
|
|
438
|
-
* * "nearest" - Uses the value of the texture element that is nearest
|
|
439
|
-
* (in Manhattan distance) to the center of the pixel being textured.
|
|
440
|
-
* * "linear" - (default) - Uses the weighted average of the four texture elements that are
|
|
441
|
-
* closest to the center of the pixel being textured.
|
|
442
|
-
*
|
|
443
|
-
* Default value is "linearMipmapLinear".
|
|
444
|
-
*
|
|
445
|
-
* @type {String}
|
|
446
|
-
*/
|
|
447
|
-
get magFilter() {
|
|
448
|
-
return this._state.magFilter;
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
/**
|
|
452
|
-
* Gets the wrap parameter for this Texture's *S* coordinate.
|
|
453
|
-
*
|
|
454
|
-
* Values can be:
|
|
455
|
-
*
|
|
456
|
-
* * "clampToEdge" - causes *S* coordinates to be clamped to the size of the texture.
|
|
457
|
-
* * "mirroredRepeat" - causes the *S* coordinate to be set to the fractional part of the texture coordinate
|
|
458
|
-
* if the integer part of *S* is even; if the integer part of *S* is odd, then the *S* texture coordinate is
|
|
459
|
-
* set to *1 - frac S* , where *frac S* represents the fractional part of *S*.
|
|
460
|
-
* * "repeat" - (default) - causes the integer part of the *S* coordinate to be ignored; yjkkit uses only the
|
|
461
|
-
* fractional part, thereby creating a repeating pattern.
|
|
462
|
-
*
|
|
463
|
-
* Default value is "repeat".
|
|
464
|
-
*
|
|
465
|
-
* @type {String}
|
|
466
|
-
*/
|
|
467
|
-
get wrapS() {
|
|
468
|
-
return this._state.wrapS;
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
/**
|
|
472
|
-
* Gets the wrap parameter for this Texture's *T* coordinate.
|
|
473
|
-
*
|
|
474
|
-
* Values can be:
|
|
475
|
-
*
|
|
476
|
-
* * "clampToEdge" - causes *S* coordinates to be clamped to the size of the texture.
|
|
477
|
-
* * "mirroredRepeat" - causes the *S* coordinate to be set to the fractional part of the texture coordinate
|
|
478
|
-
* if the integer part of *S* is even; if the integer part of *S* is odd, then the *S* texture coordinate is
|
|
479
|
-
* set to *1 - frac S* , where *frac S* represents the fractional part of *S*.
|
|
480
|
-
* * "repeat" - (default) - causes the integer part of the *S* coordinate to be ignored; yjkkit uses only the
|
|
481
|
-
* fractional part, thereby creating a repeating pattern.
|
|
482
|
-
*
|
|
483
|
-
* Default value is "repeat".
|
|
484
|
-
*
|
|
485
|
-
* @type {String}
|
|
486
|
-
*/
|
|
487
|
-
get wrapT() {
|
|
488
|
-
return this._state.wrapT;
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
/**
|
|
492
|
-
* Gets if this Texture's source data is flipped along its vertical axis.
|
|
493
|
-
*
|
|
494
|
-
* @type {Boolean}
|
|
495
|
-
*/
|
|
496
|
-
get flipY() {
|
|
497
|
-
return this._state.flipY;
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
/**
|
|
501
|
-
* Gets the Texture's encoding format.
|
|
502
|
-
*
|
|
503
|
-
* @type {String}
|
|
504
|
-
*/
|
|
505
|
-
get encoding() {
|
|
506
|
-
return this._state.encoding;
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
/**
|
|
510
|
-
* Destroys this Texture
|
|
511
|
-
*/
|
|
512
|
-
destroy() {
|
|
513
|
-
super.destroy();
|
|
514
|
-
if (this._state.texture) {
|
|
515
|
-
this._state.texture.destroy();
|
|
516
|
-
}
|
|
517
|
-
this._state.destroy();
|
|
518
|
-
stats.memory.textures--;
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
|
-
|
|
522
|
-
export {Texture};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export * from "./LambertMaterial.js";
|
|
2
|
-
export * from "./MetallicMaterial.js";
|
|
3
|
-
export * from "./SpecularMaterial.js";
|
|
4
|
-
export * from "./PhongMaterial.js";
|
|
5
|
-
export * from "./EmphasisMaterial.js";
|
|
6
|
-
export * from "./EdgeMaterial.js";
|
|
7
|
-
export * from "./Texture.js";
|
|
8
|
-
export * from "./Fresnel.js";
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import {math} from "./math.js";
|
|
2
|
-
|
|
3
|
-
const tempVec3a = math.vec3();
|
|
4
|
-
const tempVec3b = math.vec3();
|
|
5
|
-
const tempMat4a = math.mat4();
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @private
|
|
9
|
-
*/
|
|
10
|
-
class FrustumPlane {
|
|
11
|
-
|
|
12
|
-
constructor() {
|
|
13
|
-
this.normal = math.vec3();
|
|
14
|
-
this.offset = 0;
|
|
15
|
-
this.testVertex = math.vec3();
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
set(nx, ny, nz, offset) {
|
|
19
|
-
const s = 1.0 / Math.sqrt(nx * nx + ny * ny + nz * nz);
|
|
20
|
-
this.normal[0] = nx * s;
|
|
21
|
-
this.normal[1] = ny * s;
|
|
22
|
-
this.normal[2] = nz * s;
|
|
23
|
-
this.offset = offset * s;
|
|
24
|
-
this.testVertex[0] = (this.normal[0] >= 0.0) ? 1 : 0;
|
|
25
|
-
this.testVertex[1] = (this.normal[1] >= 0.0) ? 1 : 0;
|
|
26
|
-
this.testVertex[2] = (this.normal[2] >= 0.0) ? 1 : 0;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* @private
|
|
32
|
-
*/
|
|
33
|
-
class Frustum {
|
|
34
|
-
constructor() {
|
|
35
|
-
this.planes = [
|
|
36
|
-
new FrustumPlane(), new FrustumPlane(), new FrustumPlane(),
|
|
37
|
-
new FrustumPlane(), new FrustumPlane(), new FrustumPlane()
|
|
38
|
-
];
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
Frustum.INSIDE = 0;
|
|
43
|
-
Frustum.INTERSECT = 1;
|
|
44
|
-
Frustum.OUTSIDE = 2;
|
|
45
|
-
|
|
46
|
-
/** @private */
|
|
47
|
-
function setFrustum(frustum, viewMat, projMat) {
|
|
48
|
-
|
|
49
|
-
const m = math.mulMat4(projMat, viewMat, tempMat4a);
|
|
50
|
-
|
|
51
|
-
const m0 = m[0];
|
|
52
|
-
const m1 = m[1];
|
|
53
|
-
const m2 = m[2];
|
|
54
|
-
const m3 = m[3];
|
|
55
|
-
const m4 = m[4];
|
|
56
|
-
const m5 = m[5];
|
|
57
|
-
const m6 = m[6];
|
|
58
|
-
const m7 = m[7];
|
|
59
|
-
const m8 = m[8];
|
|
60
|
-
const m9 = m[9];
|
|
61
|
-
const m10 = m[10];
|
|
62
|
-
const m11 = m[11];
|
|
63
|
-
const m12 = m[12];
|
|
64
|
-
const m13 = m[13];
|
|
65
|
-
const m14 = m[14];
|
|
66
|
-
const m15 = m[15];
|
|
67
|
-
|
|
68
|
-
frustum.planes[0].set(m3 - m0, m7 - m4, m11 - m8, m15 - m12);
|
|
69
|
-
frustum.planes[1].set(m3 + m0, m7 + m4, m11 + m8, m15 + m12);
|
|
70
|
-
frustum.planes[2].set(m3 - m1, m7 - m5, m11 - m9, m15 - m13);
|
|
71
|
-
frustum.planes[3].set(m3 + m1, m7 + m5, m11 + m9, m15 + m13);
|
|
72
|
-
frustum.planes[4].set(m3 - m2, m7 - m6, m11 - m10, m15 - m14);
|
|
73
|
-
frustum.planes[5].set(m3 + m2, m7 + m6, m11 + m10, m15 + m14);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/** @private */
|
|
77
|
-
function frustumIntersectsAABB3(frustum, aabb) {
|
|
78
|
-
|
|
79
|
-
let ret = Frustum.INSIDE;
|
|
80
|
-
|
|
81
|
-
const min = tempVec3a;
|
|
82
|
-
const max = tempVec3b;
|
|
83
|
-
|
|
84
|
-
min[0] = aabb[0];
|
|
85
|
-
min[1] = aabb[1];
|
|
86
|
-
min[2] = aabb[2];
|
|
87
|
-
max[0] = aabb[3];
|
|
88
|
-
max[1] = aabb[4];
|
|
89
|
-
max[2] = aabb[5];
|
|
90
|
-
|
|
91
|
-
const bminmax = [min, max];
|
|
92
|
-
|
|
93
|
-
for (let i = 0; i < 6; ++i) {
|
|
94
|
-
const plane = frustum.planes[i];
|
|
95
|
-
if (((plane.normal[0] * bminmax[plane.testVertex[0]][0]) +
|
|
96
|
-
(plane.normal[1] * bminmax[plane.testVertex[1]][1]) +
|
|
97
|
-
(plane.normal[2] * bminmax[plane.testVertex[2]][2]) +
|
|
98
|
-
(plane.offset)) < 0.0) {
|
|
99
|
-
return Frustum.OUTSIDE;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
if (((plane.normal[0] * bminmax[1 - plane.testVertex[0]][0]) +
|
|
103
|
-
(plane.normal[1] * bminmax[1 - plane.testVertex[1]][1]) +
|
|
104
|
-
(plane.normal[2] * bminmax[1 - plane.testVertex[2]][2]) +
|
|
105
|
-
(plane.offset)) < 0.0) {
|
|
106
|
-
ret = Frustum.INTERSECT;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
return ret;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
export {
|
|
114
|
-
Frustum,
|
|
115
|
-
FrustumPlane,
|
|
116
|
-
frustumIntersectsAABB3,
|
|
117
|
-
setFrustum
|
|
118
|
-
};
|