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,522 @@
|
|
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};
|
@@ -0,0 +1,8 @@
|
|
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";
|
@@ -0,0 +1,118 @@
|
|
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
|
+
};
|