@unikia/upe-renderer 0.0.0-stage → 0.187.11
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/LICENSE +21 -0
- package/LICENSE.types +21 -0
- package/README.md +35 -2
- package/README.three.md +85 -0
- package/UPSTREAM.md +11 -0
- package/build/three.cjs +17 -0
- package/build/three.core.d.ts +1 -0
- package/build/three.core.js +61178 -0
- package/build/three.d.cts +1 -0
- package/build/three.module.d.ts +1 -0
- package/build/three.module.js +19537 -0
- package/build/three.tsl.d.ts +1 -0
- package/build/three.tsl.js +41943 -0
- package/build/three.webgpu.d.ts +1 -0
- package/build/three.webgpu.js +54819 -0
- package/build/three.webgpu.nodes.d.ts +1 -0
- package/build/three.webgpu.nodes.js +96449 -0
- package/examples/jsm/Addons.d.ts +300 -0
- package/examples/jsm/Addons.js +303 -0
- package/examples/jsm/animation/AnimationClipCreator.d.ts +12 -0
- package/examples/jsm/animation/AnimationClipCreator.js +168 -0
- package/examples/jsm/animation/CCDIKSolver.d.ts +44 -0
- package/examples/jsm/animation/CCDIKSolver.js +607 -0
- package/examples/jsm/capabilities/WebGL.d.ts +6 -0
- package/examples/jsm/capabilities/WebGL.js +113 -0
- package/examples/jsm/capabilities/WebGPU.d.ts +7 -0
- package/examples/jsm/capabilities/WebGPU.js +59 -0
- package/examples/jsm/controls/ArcballControls.d.ts +208 -0
- package/examples/jsm/controls/ArcballControls.js +3543 -0
- package/examples/jsm/controls/DragControls.d.ts +81 -0
- package/examples/jsm/controls/DragControls.js +452 -0
- package/examples/jsm/controls/FirstPersonControls.d.ts +105 -0
- package/examples/jsm/controls/FirstPersonControls.js +512 -0
- package/examples/jsm/controls/FlyControls.d.ts +44 -0
- package/examples/jsm/controls/FlyControls.js +384 -0
- package/examples/jsm/controls/MapControls.d.ts +21 -0
- package/examples/jsm/controls/MapControls.js +116 -0
- package/examples/jsm/controls/OrbitControls.d.ts +295 -0
- package/examples/jsm/controls/OrbitControls.js +1985 -0
- package/examples/jsm/controls/PointerLockControls.d.ts +84 -0
- package/examples/jsm/controls/PointerLockControls.js +264 -0
- package/examples/jsm/controls/TrackballControls.d.ts +152 -0
- package/examples/jsm/controls/TrackballControls.js +1106 -0
- package/examples/jsm/controls/TransformControls.d.ts +363 -0
- package/examples/jsm/controls/TransformControls.js +2003 -0
- package/examples/jsm/csm/CSM.d.ts +55 -0
- package/examples/jsm/csm/CSM.js +598 -0
- package/examples/jsm/csm/CSMFrustum.d.ts +85 -0
- package/examples/jsm/csm/CSMFrustum.js +234 -0
- package/examples/jsm/csm/CSMHelper.d.ts +28 -0
- package/examples/jsm/csm/CSMHelper.js +243 -0
- package/examples/jsm/csm/CSMShader.d.ts +4 -0
- package/examples/jsm/csm/CSMShader.js +378 -0
- package/examples/jsm/csm/CSMShadowNode.d.ts +44 -0
- package/examples/jsm/csm/CSMShadowNode.js +619 -0
- package/examples/jsm/curves/CurveExtras.d.ts +68 -0
- package/examples/jsm/curves/CurveExtras.js +694 -0
- package/examples/jsm/curves/NURBSCurve.d.ts +28 -0
- package/examples/jsm/curves/NURBSCurve.js +169 -0
- package/examples/jsm/curves/NURBSSurface.d.ts +13 -0
- package/examples/jsm/curves/NURBSSurface.js +98 -0
- package/examples/jsm/curves/NURBSUtils.d.ts +146 -0
- package/examples/jsm/curves/NURBSUtils.js +532 -0
- package/examples/jsm/curves/NURBSVolume.d.ts +23 -0
- package/examples/jsm/curves/NURBSVolume.js +82 -0
- package/examples/jsm/effects/AnaglyphEffect.d.ts +21 -0
- package/examples/jsm/effects/AnaglyphEffect.js +274 -0
- package/examples/jsm/effects/AsciiEffect.d.ts +18 -0
- package/examples/jsm/effects/AsciiEffect.js +323 -0
- package/examples/jsm/effects/OutlineEffect.d.ts +28 -0
- package/examples/jsm/effects/OutlineEffect.js +489 -0
- package/examples/jsm/effects/ParallaxBarrierEffect.d.ts +11 -0
- package/examples/jsm/effects/ParallaxBarrierEffect.js +155 -0
- package/examples/jsm/effects/StereoEffect.d.ts +9 -0
- package/examples/jsm/effects/StereoEffect.js +91 -0
- package/examples/jsm/environments/ColorEnvironment.d.ts +9 -0
- package/examples/jsm/environments/ColorEnvironment.js +59 -0
- package/examples/jsm/environments/DebugEnvironment.d.ts +5 -0
- package/examples/jsm/environments/DebugEnvironment.js +102 -0
- package/examples/jsm/environments/RoomEnvironment.d.ts +6 -0
- package/examples/jsm/environments/RoomEnvironment.js +185 -0
- package/examples/jsm/exporters/DRACOExporter.d.ts +17 -0
- package/examples/jsm/exporters/DRACOExporter.js +332 -0
- package/examples/jsm/exporters/EXRExporter.d.ts +27 -0
- package/examples/jsm/exporters/EXRExporter.js +1275 -0
- package/examples/jsm/exporters/GLTFExporter.d.ts +161 -0
- package/examples/jsm/exporters/GLTFExporter.js +3856 -0
- package/examples/jsm/exporters/KTX2Exporter.d.ts +7 -0
- package/examples/jsm/exporters/KTX2Exporter.js +347 -0
- package/examples/jsm/exporters/OBJExporter.d.ts +7 -0
- package/examples/jsm/exporters/OBJExporter.js +351 -0
- package/examples/jsm/exporters/PLYExporter.d.ts +31 -0
- package/examples/jsm/exporters/PLYExporter.js +786 -0
- package/examples/jsm/exporters/STLExporter.d.ts +21 -0
- package/examples/jsm/exporters/STLExporter.js +221 -0
- package/examples/jsm/exporters/USDZExporter.d.ts +30 -0
- package/examples/jsm/exporters/USDZExporter.js +1489 -0
- package/examples/jsm/generators/CityGenerator.d.ts +131 -0
- package/examples/jsm/generators/CityGenerator.js +679 -0
- package/examples/jsm/generators/ForestGenerator.d.ts +73 -0
- package/examples/jsm/generators/ForestGenerator.js +347 -0
- package/examples/jsm/generators/TerrainGenerator.d.ts +57 -0
- package/examples/jsm/generators/TerrainGenerator.js +516 -0
- package/examples/jsm/generators/TreeGenerator.d.ts +102 -0
- package/examples/jsm/generators/TreeGenerator.js +371 -0
- package/examples/jsm/generators/city/BenchGenerator.d.ts +29 -0
- package/examples/jsm/generators/city/BenchGenerator.js +127 -0
- package/examples/jsm/generators/city/CarGenerator.d.ts +43 -0
- package/examples/jsm/generators/city/CarGenerator.js +479 -0
- package/examples/jsm/generators/city/CityGeneratorUtils.js +31 -0
- package/examples/jsm/generators/city/HydrantGenerator.d.ts +27 -0
- package/examples/jsm/generators/city/HydrantGenerator.js +106 -0
- package/examples/jsm/generators/city/InstancedMeshGenerator.d.ts +29 -0
- package/examples/jsm/generators/city/InstancedMeshGenerator.js +86 -0
- package/examples/jsm/generators/city/PersonGenerator.d.ts +44 -0
- package/examples/jsm/generators/city/PersonGenerator.js +447 -0
- package/examples/jsm/generators/city/SidewalkGenerator.d.ts +40 -0
- package/examples/jsm/generators/city/SidewalkGenerator.js +248 -0
- package/examples/jsm/generators/city/SkyscraperGenerator.d.ts +83 -0
- package/examples/jsm/generators/city/SkyscraperGenerator.js +1799 -0
- package/examples/jsm/generators/city/StreetTreeGenerator.d.ts +30 -0
- package/examples/jsm/generators/city/StreetTreeGenerator.js +231 -0
- package/examples/jsm/generators/city/StreetlightGenerator.d.ts +28 -0
- package/examples/jsm/generators/city/StreetlightGenerator.js +100 -0
- package/examples/jsm/generators/city/TrafficlightGenerator.d.ts +29 -0
- package/examples/jsm/generators/city/TrafficlightGenerator.js +106 -0
- package/examples/jsm/generators/city/TrashcanGenerator.d.ts +24 -0
- package/examples/jsm/generators/city/TrashcanGenerator.js +100 -0
- package/examples/jsm/geometries/BoxLineGeometry.d.ts +12 -0
- package/examples/jsm/geometries/BoxLineGeometry.js +92 -0
- package/examples/jsm/geometries/ConvexGeometry.d.ts +5 -0
- package/examples/jsm/geometries/ConvexGeometry.js +72 -0
- package/examples/jsm/geometries/DecalGeometry.d.ts +16 -0
- package/examples/jsm/geometries/DecalGeometry.js +420 -0
- package/examples/jsm/geometries/LoftGeometry.d.ts +83 -0
- package/examples/jsm/geometries/LoftGeometry.js +355 -0
- package/examples/jsm/geometries/ParametricFunctions.d.ts +8 -0
- package/examples/jsm/geometries/ParametricFunctions.js +100 -0
- package/examples/jsm/geometries/ParametricGeometry.d.ts +18 -0
- package/examples/jsm/geometries/ParametricGeometry.js +172 -0
- package/examples/jsm/geometries/RoundedBoxGeometry.d.ts +5 -0
- package/examples/jsm/geometries/RoundedBoxGeometry.js +216 -0
- package/examples/jsm/geometries/TeapotGeometry.d.ts +37 -0
- package/examples/jsm/geometries/TeapotGeometry.js +689 -0
- package/examples/jsm/geometries/TextGeometry.d.ts +89 -0
- package/examples/jsm/geometries/TextGeometry.js +102 -0
- package/examples/jsm/gpgpu/BitonicSort.d.ts +21 -0
- package/examples/jsm/gpgpu/BitonicSort.js +722 -0
- package/examples/jsm/gpgpu/CountingSort.d.ts +31 -0
- package/examples/jsm/gpgpu/CountingSort.js +271 -0
- package/examples/jsm/helpers/AnimationPathHelper.d.ts +38 -0
- package/examples/jsm/helpers/AnimationPathHelper.js +302 -0
- package/examples/jsm/helpers/LightProbeGridHelper.d.ts +12 -0
- package/examples/jsm/helpers/LightProbeGridHelper.js +166 -0
- package/examples/jsm/helpers/LightProbeGridHelperWebGL.d.ts +12 -0
- package/examples/jsm/helpers/LightProbeGridHelperWebGL.js +221 -0
- package/examples/jsm/helpers/LightProbeHelper.d.ts +12 -0
- package/examples/jsm/helpers/LightProbeHelper.js +166 -0
- package/examples/jsm/helpers/LightProbeHelperGPU.d.ts +12 -0
- package/examples/jsm/helpers/LightProbeHelperGPU.js +102 -0
- package/examples/jsm/helpers/OctreeHelper.d.ts +17 -0
- package/examples/jsm/helpers/OctreeHelper.js +109 -0
- package/examples/jsm/helpers/PositionalAudioHelper.d.ts +13 -0
- package/examples/jsm/helpers/PositionalAudioHelper.js +169 -0
- package/examples/jsm/helpers/RapierHelper.d.ts +13 -0
- package/examples/jsm/helpers/RapierHelper.js +59 -0
- package/examples/jsm/helpers/RectAreaLightHelper.d.ts +10 -0
- package/examples/jsm/helpers/RectAreaLightHelper.js +118 -0
- package/examples/jsm/helpers/TextureHelper.d.ts +10 -0
- package/examples/jsm/helpers/TextureHelper.js +265 -0
- package/examples/jsm/helpers/TextureHelperGPU.d.ts +10 -0
- package/examples/jsm/helpers/TextureHelperGPU.js +214 -0
- package/examples/jsm/helpers/VertexNormalsHelper.d.ts +14 -0
- package/examples/jsm/helpers/VertexNormalsHelper.js +155 -0
- package/examples/jsm/helpers/VertexTangentsHelper.d.ts +12 -0
- package/examples/jsm/helpers/VertexTangentsHelper.js +133 -0
- package/examples/jsm/helpers/ViewHelper.d.ts +20 -0
- package/examples/jsm/helpers/ViewHelper.js +529 -0
- package/examples/jsm/inspector/Extension.d.ts +22 -0
- package/examples/jsm/inspector/Extension.js +107 -0
- package/examples/jsm/inspector/Inspector.d.ts +54 -0
- package/examples/jsm/inspector/Inspector.js +644 -0
- package/examples/jsm/inspector/RendererInspector.d.ts +9 -0
- package/examples/jsm/inspector/RendererInspector.js +624 -0
- package/examples/jsm/inspector/Storage.js +49 -0
- package/examples/jsm/inspector/extensions/color-grading/ColorGrading.d.ts +34 -0
- package/examples/jsm/inspector/extensions/color-grading/ColorGrading.js +2614 -0
- package/examples/jsm/inspector/extensions/color-grading/ColorWheel.js +352 -0
- package/examples/jsm/inspector/extensions/color-grading/CurveEditor.js +599 -0
- package/examples/jsm/inspector/extensions/color-grading/LUT3DStyle.js +1201 -0
- package/examples/jsm/inspector/extensions/color-grading/LUTMath.js +788 -0
- package/examples/jsm/inspector/extensions/color-grading/modules/BrightnessModule.js +72 -0
- package/examples/jsm/inspector/extensions/color-grading/modules/ColorWheelModule.js +112 -0
- package/examples/jsm/inspector/extensions/color-grading/modules/ContrastModule.js +82 -0
- package/examples/jsm/inspector/extensions/color-grading/modules/CurvesModule.js +109 -0
- package/examples/jsm/inspector/extensions/color-grading/modules/ExposureHueModule.js +110 -0
- package/examples/jsm/inspector/extensions/color-grading/modules/ExposureModule.js +73 -0
- package/examples/jsm/inspector/extensions/color-grading/modules/HueModule.js +78 -0
- package/examples/jsm/inspector/extensions/color-grading/modules/ImportedCubeModule.js +89 -0
- package/examples/jsm/inspector/extensions/color-grading/modules/Module.js +285 -0
- package/examples/jsm/inspector/extensions/color-grading/modules/OutputModule.js +101 -0
- package/examples/jsm/inspector/extensions/color-grading/modules/RendererModule.js +225 -0
- package/examples/jsm/inspector/extensions/color-grading/modules/SatVibranceModule.js +102 -0
- package/examples/jsm/inspector/extensions/color-grading/modules/SaturationModule.js +76 -0
- package/examples/jsm/inspector/extensions/color-grading/modules/VibranceModule.js +76 -0
- package/examples/jsm/inspector/extensions/color-grading/modules/WhiteBalanceModule.js +86 -0
- package/examples/jsm/inspector/extensions/tsl-graph/TSLGraphEditor.d.ts +20 -0
- package/examples/jsm/inspector/extensions/tsl-graph/TSLGraphEditor.js +911 -0
- package/examples/jsm/inspector/extensions/tsl-graph/TSLGraphLoader.d.ts +11 -0
- package/examples/jsm/inspector/extensions/tsl-graph/TSLGraphLoader.js +282 -0
- package/examples/jsm/inspector/tabs/Console.js +420 -0
- package/examples/jsm/inspector/tabs/Memory.js +134 -0
- package/examples/jsm/inspector/tabs/Parameters.d.ts +122 -0
- package/examples/jsm/inspector/tabs/Parameters.js +444 -0
- package/examples/jsm/inspector/tabs/Performance.js +298 -0
- package/examples/jsm/inspector/tabs/Settings.js +310 -0
- package/examples/jsm/inspector/tabs/Timeline.js +1824 -0
- package/examples/jsm/inspector/tabs/Viewer.js +1389 -0
- package/examples/jsm/inspector/ui/Graph.js +232 -0
- package/examples/jsm/inspector/ui/Item.d.ts +5 -0
- package/examples/jsm/inspector/ui/Item.js +249 -0
- package/examples/jsm/inspector/ui/List.js +81 -0
- package/examples/jsm/inspector/ui/Profiler.js +2273 -0
- package/examples/jsm/inspector/ui/Style.js +2268 -0
- package/examples/jsm/inspector/ui/Tab.d.ts +9 -0
- package/examples/jsm/inspector/ui/Tab.js +269 -0
- package/examples/jsm/inspector/ui/Values.d.ts +103 -0
- package/examples/jsm/inspector/ui/Values.js +578 -0
- package/examples/jsm/inspector/ui/utils.js +189 -0
- package/examples/jsm/interaction/InteractionManager.d.ts +18 -0
- package/examples/jsm/interaction/InteractionManager.js +226 -0
- package/examples/jsm/interactive/HTMLMesh.d.ts +13 -0
- package/examples/jsm/interactive/HTMLMesh.js +617 -0
- package/examples/jsm/interactive/InteractiveGroup.d.ts +28 -0
- package/examples/jsm/interactive/InteractiveGroup.js +224 -0
- package/examples/jsm/interactive/SelectionBox.d.ts +16 -0
- package/examples/jsm/interactive/SelectionBox.js +324 -0
- package/examples/jsm/interactive/SelectionHelper.d.ts +17 -0
- package/examples/jsm/interactive/SelectionHelper.js +150 -0
- package/examples/jsm/libs/basis/README.md +45 -0
- package/examples/jsm/libs/basis/basis_transcoder.js +19 -0
- package/examples/jsm/libs/basis/basis_transcoder.wasm +0 -0
- package/examples/jsm/libs/chevrotain.module.min.js +141 -0
- package/examples/jsm/libs/demuxer_mp4.js +109 -0
- package/examples/jsm/libs/draco/README.md +31 -0
- package/examples/jsm/libs/draco/draco_decoder.js +34 -0
- package/examples/jsm/libs/draco/draco_decoder.wasm +0 -0
- package/examples/jsm/libs/draco/draco_wasm_wrapper.js +117 -0
- package/examples/jsm/libs/draco/gltf/draco_decoder.js +33 -0
- package/examples/jsm/libs/draco/gltf/draco_decoder.wasm +0 -0
- package/examples/jsm/libs/draco/gltf/draco_wasm_wrapper.js +116 -0
- package/examples/jsm/libs/fflate.module.d.ts +1 -0
- package/examples/jsm/libs/fflate.module.js +2699 -0
- package/examples/jsm/libs/ktx-parse.module.js +1 -0
- package/examples/jsm/libs/lil-gui.module.min.d.ts +608 -0
- package/examples/jsm/libs/lil-gui.module.min.js +8 -0
- package/examples/jsm/libs/meshopt_clusterizer.module.js +421 -0
- package/examples/jsm/libs/meshopt_decoder.module.d.ts +1 -0
- package/examples/jsm/libs/meshopt_decoder.module.js +196 -0
- package/examples/jsm/libs/meshopt_simplifier.module.js +627 -0
- package/examples/jsm/libs/mikktspace.README.md +27 -0
- package/examples/jsm/libs/mikktspace.module.d.ts +19 -0
- package/examples/jsm/libs/mikktspace.module.js +765 -0
- package/examples/jsm/libs/motion-controllers.module.js +397 -0
- package/examples/jsm/libs/potpack.module.js +125 -0
- package/examples/jsm/libs/stats.module.d.ts +3 -0
- package/examples/jsm/libs/stats.module.js +167 -0
- package/examples/jsm/libs/tween.module.d.ts +2 -0
- package/examples/jsm/libs/tween.module.js +876 -0
- package/examples/jsm/libs/utif.module.js +1665 -0
- package/examples/jsm/libs/zstddec.module.d.ts +5 -0
- package/examples/jsm/libs/zstddec.module.js +1 -0
- package/examples/jsm/lighting/ClusteredLighting.d.ts +45 -0
- package/examples/jsm/lighting/ClusteredLighting.js +153 -0
- package/examples/jsm/lighting/DynamicLighting.d.ts +16 -0
- package/examples/jsm/lighting/DynamicLighting.js +82 -0
- package/examples/jsm/lighting/LightMapper.js +295 -0
- package/examples/jsm/lighting/LightProbeGrid.d.ts +177 -0
- package/examples/jsm/lighting/LightProbeGrid.js +923 -0
- package/examples/jsm/lighting/LightProbeGridUtils.js +107 -0
- package/examples/jsm/lighting/LightProbeGridWebGL.d.ts +178 -0
- package/examples/jsm/lighting/LightProbeGridWebGL.js +846 -0
- package/examples/jsm/lighting/vxgi/VXGIConeTracer.js +243 -0
- package/examples/jsm/lighting/vxgi/VXGIIrradiance.js +43 -0
- package/examples/jsm/lighting/vxgi/VXGINode.d.ts +100 -0
- package/examples/jsm/lighting/vxgi/VXGINode.js +617 -0
- package/examples/jsm/lighting/vxgi/VXGISceneCollector.js +793 -0
- package/examples/jsm/lighting/vxgi/VXGIVolume.d.ts +245 -0
- package/examples/jsm/lighting/vxgi/VXGIVolume.js +1440 -0
- package/examples/jsm/lights/LightProbeGenerator.d.ts +16 -0
- package/examples/jsm/lights/LightProbeGenerator.js +337 -0
- package/examples/jsm/lights/RectAreaLightTexturesLib.d.ts +7 -0
- package/examples/jsm/lights/RectAreaLightTexturesLib.js +127 -0
- package/examples/jsm/lights/RectAreaLightUniformsLib.d.ts +5 -0
- package/examples/jsm/lights/RectAreaLightUniformsLib.js +40 -0
- package/examples/jsm/lights/SunLight.d.ts +53 -0
- package/examples/jsm/lights/SunLight.js +100 -0
- package/examples/jsm/lights/SunLightNode.d.ts +25 -0
- package/examples/jsm/lights/SunLightNode.js +56 -0
- package/examples/jsm/lights/SunLightShadow.d.ts +57 -0
- package/examples/jsm/lights/SunLightShadow.js +319 -0
- package/examples/jsm/lights/SunShadowNode.d.ts +53 -0
- package/examples/jsm/lights/SunShadowNode.js +312 -0
- package/examples/jsm/lines/Line2.d.ts +25 -0
- package/examples/jsm/lines/Line2.js +56 -0
- package/examples/jsm/lines/LineGeometry.d.ts +27 -0
- package/examples/jsm/lines/LineGeometry.js +157 -0
- package/examples/jsm/lines/LineMaterial.d.ts +82 -0
- package/examples/jsm/lines/LineMaterial.js +742 -0
- package/examples/jsm/lines/LineSegments2.d.ts +39 -0
- package/examples/jsm/lines/LineSegments2.js +434 -0
- package/examples/jsm/lines/LineSegmentsGeometry.d.ts +53 -0
- package/examples/jsm/lines/LineSegmentsGeometry.js +298 -0
- package/examples/jsm/lines/Wireframe.d.ts +14 -0
- package/examples/jsm/lines/Wireframe.js +108 -0
- package/examples/jsm/lines/WireframeGeometry2.d.ts +8 -0
- package/examples/jsm/lines/WireframeGeometry2.js +49 -0
- package/examples/jsm/lines/webgpu/Line2.d.ts +14 -0
- package/examples/jsm/lines/webgpu/Line2.js +46 -0
- package/examples/jsm/lines/webgpu/LineSegments2.d.ts +15 -0
- package/examples/jsm/lines/webgpu/LineSegments2.js +419 -0
- package/examples/jsm/lines/webgpu/Wireframe.d.ts +13 -0
- package/examples/jsm/lines/webgpu/Wireframe.js +86 -0
- package/examples/jsm/loaders/3DMLoader.d.ts +12 -0
- package/examples/jsm/loaders/3DMLoader.js +1946 -0
- package/examples/jsm/loaders/3MFLoader.d.ts +9 -0
- package/examples/jsm/loaders/3MFLoader.js +1826 -0
- package/examples/jsm/loaders/AMFLoader.d.ts +7 -0
- package/examples/jsm/loaders/AMFLoader.js +543 -0
- package/examples/jsm/loaders/BVHLoader.d.ts +14 -0
- package/examples/jsm/loaders/BVHLoader.js +486 -0
- package/examples/jsm/loaders/ColladaLoader.d.ts +35 -0
- package/examples/jsm/loaders/ColladaLoader.js +161 -0
- package/examples/jsm/loaders/DDSLoader.d.ts +22 -0
- package/examples/jsm/loaders/DDSLoader.js +385 -0
- package/examples/jsm/loaders/DRACOLoader.d.ts +39 -0
- package/examples/jsm/loaders/DRACOLoader.js +776 -0
- package/examples/jsm/loaders/EXRLoader.d.ts +24 -0
- package/examples/jsm/loaders/EXRLoader.js +3411 -0
- package/examples/jsm/loaders/FBXLoader.d.ts +8 -0
- package/examples/jsm/loaders/FBXLoader.js +4660 -0
- package/examples/jsm/loaders/FontLoader.d.ts +41 -0
- package/examples/jsm/loaders/FontLoader.js +262 -0
- package/examples/jsm/loaders/GCodeLoader.d.ts +8 -0
- package/examples/jsm/loaders/GCodeLoader.js +314 -0
- package/examples/jsm/loaders/GLTFGaussianSplatLoaderExtension.d.ts +14 -0
- package/examples/jsm/loaders/GLTFGaussianSplatLoaderExtension.js +330 -0
- package/examples/jsm/loaders/GLTFLoader.d.ts +153 -0
- package/examples/jsm/loaders/GLTFLoader.js +5006 -0
- package/examples/jsm/loaders/GaussianSplatPLYLoader.d.ts +9 -0
- package/examples/jsm/loaders/GaussianSplatPLYLoader.js +388 -0
- package/examples/jsm/loaders/HDRCubeTextureLoader.d.ts +18 -0
- package/examples/jsm/loaders/HDRCubeTextureLoader.js +167 -0
- package/examples/jsm/loaders/HDRLoader.d.ts +12 -0
- package/examples/jsm/loaders/HDRLoader.js +463 -0
- package/examples/jsm/loaders/IESLoader.d.ts +5 -0
- package/examples/jsm/loaders/IESLoader.js +413 -0
- package/examples/jsm/loaders/JXLLoader.js +159 -0
- package/examples/jsm/loaders/KMZLoader.d.ts +9 -0
- package/examples/jsm/loaders/KMZLoader.js +169 -0
- package/examples/jsm/loaders/KSPLATLoader.d.ts +9 -0
- package/examples/jsm/loaders/KSPLATLoader.js +465 -0
- package/examples/jsm/loaders/KTX2Loader.d.ts +58 -0
- package/examples/jsm/loaders/KTX2Loader.js +1321 -0
- package/examples/jsm/loaders/KTXLoader.d.ts +22 -0
- package/examples/jsm/loaders/KTXLoader.js +199 -0
- package/examples/jsm/loaders/LDrawLoader.d.ts +38 -0
- package/examples/jsm/loaders/LDrawLoader.js +2503 -0
- package/examples/jsm/loaders/LUT3dlLoader.d.ts +39 -0
- package/examples/jsm/loaders/LUT3dlLoader.js +209 -0
- package/examples/jsm/loaders/LUTCubeLoader.d.ts +42 -0
- package/examples/jsm/loaders/LUTCubeLoader.js +194 -0
- package/examples/jsm/loaders/LUTImageLoader.d.ts +18 -0
- package/examples/jsm/loaders/LUTImageLoader.js +192 -0
- package/examples/jsm/loaders/LWOLoader.d.ts +25 -0
- package/examples/jsm/loaders/LWOLoader.js +1057 -0
- package/examples/jsm/loaders/MD2Loader.d.ts +7 -0
- package/examples/jsm/loaders/MD2Loader.js +437 -0
- package/examples/jsm/loaders/MDDLoader.d.ts +12 -0
- package/examples/jsm/loaders/MDDLoader.js +151 -0
- package/examples/jsm/loaders/MTLLoader.d.ts +95 -0
- package/examples/jsm/loaders/MTLLoader.js +601 -0
- package/examples/jsm/loaders/MaterialXLoader.d.ts +70 -0
- package/examples/jsm/loaders/MaterialXLoader.js +279 -0
- package/examples/jsm/loaders/NRRDLoader.d.ts +15 -0
- package/examples/jsm/loaders/NRRDLoader.js +720 -0
- package/examples/jsm/loaders/OBJLoader.d.ts +10 -0
- package/examples/jsm/loaders/OBJLoader.js +961 -0
- package/examples/jsm/loaders/PCDLoader.d.ts +8 -0
- package/examples/jsm/loaders/PCDLoader.js +624 -0
- package/examples/jsm/loaders/PDBLoader.d.ts +15 -0
- package/examples/jsm/loaders/PDBLoader.js +274 -0
- package/examples/jsm/loaders/PLYLoader.d.ts +11 -0
- package/examples/jsm/loaders/PLYLoader.js +992 -0
- package/examples/jsm/loaders/PVRLoader.d.ts +16 -0
- package/examples/jsm/loaders/PVRLoader.js +270 -0
- package/examples/jsm/loaders/RGBELoader.d.ts +7 -0
- package/examples/jsm/loaders/RGBELoader.js +18 -0
- package/examples/jsm/loaders/SPLATLoader.d.ts +9 -0
- package/examples/jsm/loaders/SPLATLoader.js +141 -0
- package/examples/jsm/loaders/SPZLoader.d.ts +18 -0
- package/examples/jsm/loaders/SPZLoader.js +563 -0
- package/examples/jsm/loaders/STLLoader.d.ts +7 -0
- package/examples/jsm/loaders/STLLoader.js +423 -0
- package/examples/jsm/loaders/SVGLoader.d.ts +67 -0
- package/examples/jsm/loaders/SVGLoader.js +3297 -0
- package/examples/jsm/loaders/TDSLoader.d.ts +35 -0
- package/examples/jsm/loaders/TDSLoader.js +1146 -0
- package/examples/jsm/loaders/TGALoader.d.ts +7 -0
- package/examples/jsm/loaders/TGALoader.js +539 -0
- package/examples/jsm/loaders/TIFFLoader.d.ts +7 -0
- package/examples/jsm/loaders/TIFFLoader.js +59 -0
- package/examples/jsm/loaders/TTFLoader.d.ts +10 -0
- package/examples/jsm/loaders/TTFLoader.js +263 -0
- package/examples/jsm/loaders/USDLoader.d.ts +14 -0
- package/examples/jsm/loaders/USDLoader.js +317 -0
- package/examples/jsm/loaders/USDZLoader.d.ts +14 -0
- package/examples/jsm/loaders/USDZLoader.js +16 -0
- package/examples/jsm/loaders/UltraHDRLoader.d.ts +28 -0
- package/examples/jsm/loaders/UltraHDRLoader.js +757 -0
- package/examples/jsm/loaders/VOXLoader.d.ts +38 -0
- package/examples/jsm/loaders/VOXLoader.js +922 -0
- package/examples/jsm/loaders/VRMLLoader.d.ts +7 -0
- package/examples/jsm/loaders/VRMLLoader.js +3650 -0
- package/examples/jsm/loaders/VTKLoader.d.ts +13 -0
- package/examples/jsm/loaders/VTKLoader.js +1295 -0
- package/examples/jsm/loaders/XYZLoader.d.ts +7 -0
- package/examples/jsm/loaders/XYZLoader.js +145 -0
- package/examples/jsm/loaders/collada/ColladaComposer.js +3051 -0
- package/examples/jsm/loaders/collada/ColladaParser.js +1977 -0
- package/examples/jsm/loaders/lwo/IFFParser.js +1217 -0
- package/examples/jsm/loaders/lwo/LWO2Parser.js +414 -0
- package/examples/jsm/loaders/lwo/LWO3Parser.js +373 -0
- package/examples/jsm/loaders/materialx/MaterialXArchive.js +108 -0
- package/examples/jsm/loaders/materialx/MaterialXDocument.js +1350 -0
- package/examples/jsm/loaders/materialx/MaterialXHextile.d.ts +24 -0
- package/examples/jsm/loaders/materialx/MaterialXHextile.js +183 -0
- package/examples/jsm/loaders/materialx/MaterialXInterfaceValidation.d.ts +8 -0
- package/examples/jsm/loaders/materialx/MaterialXInterfaceValidation.js +293 -0
- package/examples/jsm/loaders/materialx/MaterialXLog.d.ts +33 -0
- package/examples/jsm/loaders/materialx/MaterialXLog.js +79 -0
- package/examples/jsm/loaders/materialx/MaterialXNodeDefs.js +99 -0
- package/examples/jsm/loaders/materialx/MaterialXNodeInterfaceRegistry.js +763 -0
- package/examples/jsm/loaders/materialx/MaterialXNodeLibrary.js +871 -0
- package/examples/jsm/loaders/materialx/MaterialXSurfaceMappings.js +565 -0
- package/examples/jsm/loaders/materialx/MaterialXUtils.js +82 -0
- package/examples/jsm/loaders/materialx/compile/MaterialXCompileRegistry.js +999 -0
- package/examples/jsm/loaders/materialx/parse/MaterialXParser.js +28 -0
- package/examples/jsm/loaders/usd/USDAParser.js +923 -0
- package/examples/jsm/loaders/usd/USDCParser.js +1875 -0
- package/examples/jsm/loaders/usd/USDComposer.js +4660 -0
- package/examples/jsm/materials/LDrawConditionalLineMaterial.d.ts +9 -0
- package/examples/jsm/materials/LDrawConditionalLineMaterial.js +183 -0
- package/examples/jsm/materials/LDrawConditionalLineNodeMaterial.d.ts +9 -0
- package/examples/jsm/materials/LDrawConditionalLineNodeMaterial.js +154 -0
- package/examples/jsm/materials/WoodNodeMaterial.d.ts +75 -0
- package/examples/jsm/materials/WoodNodeMaterial.js +431 -0
- package/examples/jsm/math/Capsule.d.ts +26 -0
- package/examples/jsm/math/Capsule.js +159 -0
- package/examples/jsm/math/ColorConverter.d.ts +19 -0
- package/examples/jsm/math/ColorConverter.js +62 -0
- package/examples/jsm/math/ColorSpaces.d.ts +15 -0
- package/examples/jsm/math/ColorSpaces.js +147 -0
- package/examples/jsm/math/ConvexHull.d.ts +89 -0
- package/examples/jsm/math/ConvexHull.js +1695 -0
- package/examples/jsm/math/ImprovedNoise.d.ts +4 -0
- package/examples/jsm/math/ImprovedNoise.js +88 -0
- package/examples/jsm/math/Lut.d.ts +27 -0
- package/examples/jsm/math/Lut.js +317 -0
- package/examples/jsm/math/MeshSurfaceSampler.d.ts +21 -0
- package/examples/jsm/math/MeshSurfaceSampler.js +315 -0
- package/examples/jsm/math/OBB.d.ts +24 -0
- package/examples/jsm/math/OBB.js +535 -0
- package/examples/jsm/math/Octree.d.ts +54 -0
- package/examples/jsm/math/Octree.js +825 -0
- package/examples/jsm/math/SimplexNoise.d.ts +9 -0
- package/examples/jsm/math/SimplexNoise.js +470 -0
- package/examples/jsm/misc/ConvexObjectBreaker.d.ts +25 -0
- package/examples/jsm/misc/ConvexObjectBreaker.js +539 -0
- package/examples/jsm/misc/GPUComputationRenderer.d.ts +55 -0
- package/examples/jsm/misc/GPUComputationRenderer.js +508 -0
- package/examples/jsm/misc/Gyroscope.d.ts +5 -0
- package/examples/jsm/misc/Gyroscope.js +78 -0
- package/examples/jsm/misc/MD2Character.d.ts +33 -0
- package/examples/jsm/misc/MD2Character.js +391 -0
- package/examples/jsm/misc/MD2CharacterComplex.d.ts +55 -0
- package/examples/jsm/misc/MD2CharacterComplex.js +740 -0
- package/examples/jsm/misc/MorphAnimMesh.d.ts +13 -0
- package/examples/jsm/misc/MorphAnimMesh.js +119 -0
- package/examples/jsm/misc/MorphBlendMesh.d.ts +21 -0
- package/examples/jsm/misc/MorphBlendMesh.js +425 -0
- package/examples/jsm/misc/ProgressiveLightMap.d.ts +58 -0
- package/examples/jsm/misc/ProgressiveLightMap.js +370 -0
- package/examples/jsm/misc/ProgressiveLightMapGPU.d.ts +27 -0
- package/examples/jsm/misc/ProgressiveLightMapGPU.js +322 -0
- package/examples/jsm/misc/RollerCoaster.d.ts +26 -0
- package/examples/jsm/misc/RollerCoaster.js +661 -0
- package/examples/jsm/misc/SculptGL.LICENSE.txt +21 -0
- package/examples/jsm/misc/Sculptor.d.ts +259 -0
- package/examples/jsm/misc/Sculptor.js +1679 -0
- package/examples/jsm/misc/SculptorMesh.js +1504 -0
- package/examples/jsm/misc/SculptorTools.js +1180 -0
- package/examples/jsm/misc/SculptorUtils.js +345 -0
- package/examples/jsm/misc/TileCreasedNormalsPlugin.d.ts +49 -0
- package/examples/jsm/misc/TileCreasedNormalsPlugin.js +270 -0
- package/examples/jsm/misc/TubePainter.d.ts +10 -0
- package/examples/jsm/misc/TubePainter.js +611 -0
- package/examples/jsm/misc/Volume.d.ts +37 -0
- package/examples/jsm/misc/Volume.js +520 -0
- package/examples/jsm/misc/VolumeSlice.d.ts +28 -0
- package/examples/jsm/misc/VolumeSlice.js +275 -0
- package/examples/jsm/modifiers/CurveModifier.d.ts +41 -0
- package/examples/jsm/modifiers/CurveModifier.js +374 -0
- package/examples/jsm/modifiers/CurveModifierGPU.d.ts +31 -0
- package/examples/jsm/modifiers/CurveModifierGPU.js +256 -0
- package/examples/jsm/modifiers/EdgeSplitModifier.d.ts +26 -0
- package/examples/jsm/modifiers/EdgeSplitModifier.js +299 -0
- package/examples/jsm/modifiers/SimplifyModifier.d.ts +6 -0
- package/examples/jsm/modifiers/SimplifyModifier.js +139 -0
- package/examples/jsm/modifiers/TessellateModifier.d.ts +9 -0
- package/examples/jsm/modifiers/TessellateModifier.js +340 -0
- package/examples/jsm/objects/GaussianSplat.d.ts +35 -0
- package/examples/jsm/objects/GaussianSplat.js +1040 -0
- package/examples/jsm/objects/GroundedSkybox.d.ts +5 -0
- package/examples/jsm/objects/GroundedSkybox.js +69 -0
- package/examples/jsm/objects/Lensflare.d.ts +21 -0
- package/examples/jsm/objects/Lensflare.js +489 -0
- package/examples/jsm/objects/LensflareMesh.d.ts +21 -0
- package/examples/jsm/objects/LensflareMesh.js +376 -0
- package/examples/jsm/objects/MarchingCubes.d.ts +76 -0
- package/examples/jsm/objects/MarchingCubes.js +1261 -0
- package/examples/jsm/objects/Reflector.d.ts +54 -0
- package/examples/jsm/objects/Reflector.js +390 -0
- package/examples/jsm/objects/ReflectorForSSRPass.d.ts +62 -0
- package/examples/jsm/objects/ReflectorForSSRPass.js +393 -0
- package/examples/jsm/objects/Refractor.d.ts +21 -0
- package/examples/jsm/objects/Refractor.js +389 -0
- package/examples/jsm/objects/ShadowMesh.d.ts +10 -0
- package/examples/jsm/objects/ShadowMesh.js +130 -0
- package/examples/jsm/objects/Sky.d.ts +28 -0
- package/examples/jsm/objects/Sky.js +342 -0
- package/examples/jsm/objects/SkyMesh.d.ts +26 -0
- package/examples/jsm/objects/SkyMesh.js +403 -0
- package/examples/jsm/objects/Water.d.ts +22 -0
- package/examples/jsm/objects/Water.js +374 -0
- package/examples/jsm/objects/Water2.d.ts +21 -0
- package/examples/jsm/objects/Water2.js +403 -0
- package/examples/jsm/objects/Water2Mesh.d.ts +53 -0
- package/examples/jsm/objects/Water2Mesh.js +199 -0
- package/examples/jsm/objects/WaterMesh.d.ts +40 -0
- package/examples/jsm/objects/WaterMesh.js +194 -0
- package/examples/jsm/offscreen/jank.js +45 -0
- package/examples/jsm/offscreen/offscreen.js +8 -0
- package/examples/jsm/offscreen/scene.js +86 -0
- package/examples/jsm/physics/AmmoPhysics.d.ts +9 -0
- package/examples/jsm/physics/AmmoPhysics.js +366 -0
- package/examples/jsm/physics/JoltPhysics.d.ts +10 -0
- package/examples/jsm/physics/JoltPhysics.js +334 -0
- package/examples/jsm/physics/RapierPhysics.d.ts +26 -0
- package/examples/jsm/physics/RapierPhysics.js +461 -0
- package/examples/jsm/pipelines/MeshletDrawingPipeline.js +5571 -0
- package/examples/jsm/pipelines/VisibilityBufferDrawingPipeline.js +954 -0
- package/examples/jsm/postprocessing/AfterimagePass.d.ts +17 -0
- package/examples/jsm/postprocessing/AfterimagePass.js +187 -0
- package/examples/jsm/postprocessing/BloomPass.d.ts +14 -0
- package/examples/jsm/postprocessing/BloomPass.js +274 -0
- package/examples/jsm/postprocessing/BokehPass.d.ts +23 -0
- package/examples/jsm/postprocessing/BokehPass.js +218 -0
- package/examples/jsm/postprocessing/ClearPass.d.ts +9 -0
- package/examples/jsm/postprocessing/ClearPass.js +97 -0
- package/examples/jsm/postprocessing/CubeTexturePass.d.ts +14 -0
- package/examples/jsm/postprocessing/CubeTexturePass.js +146 -0
- package/examples/jsm/postprocessing/DotScreenPass.d.ts +10 -0
- package/examples/jsm/postprocessing/DotScreenPass.js +114 -0
- package/examples/jsm/postprocessing/EffectComposer.d.ts +30 -0
- package/examples/jsm/postprocessing/EffectComposer.js +365 -0
- package/examples/jsm/postprocessing/FXAAPass.d.ts +7 -0
- package/examples/jsm/postprocessing/FXAAPass.js +40 -0
- package/examples/jsm/postprocessing/FilmPass.d.ts +10 -0
- package/examples/jsm/postprocessing/FilmPass.js +113 -0
- package/examples/jsm/postprocessing/GTAOPass.d.ts +121 -0
- package/examples/jsm/postprocessing/GTAOPass.js +735 -0
- package/examples/jsm/postprocessing/GlitchPass.d.ts +16 -0
- package/examples/jsm/postprocessing/GlitchPass.js +177 -0
- package/examples/jsm/postprocessing/HalftonePass.d.ts +37 -0
- package/examples/jsm/postprocessing/HalftonePass.js +134 -0
- package/examples/jsm/postprocessing/LUTPass.d.ts +13 -0
- package/examples/jsm/postprocessing/LUTPass.js +138 -0
- package/examples/jsm/postprocessing/MaskPass.d.ts +14 -0
- package/examples/jsm/postprocessing/MaskPass.js +195 -0
- package/examples/jsm/postprocessing/OutlinePass.d.ts +64 -0
- package/examples/jsm/postprocessing/OutlinePass.js +776 -0
- package/examples/jsm/postprocessing/OutputPass.d.ts +14 -0
- package/examples/jsm/postprocessing/OutputPass.js +148 -0
- package/examples/jsm/postprocessing/Pass.d.ts +31 -0
- package/examples/jsm/postprocessing/Pass.js +191 -0
- package/examples/jsm/postprocessing/RenderPass.d.ts +28 -0
- package/examples/jsm/postprocessing/RenderPass.js +193 -0
- package/examples/jsm/postprocessing/RenderPixelatedPass.d.ts +30 -0
- package/examples/jsm/postprocessing/RenderPixelatedPass.js +314 -0
- package/examples/jsm/postprocessing/RenderTransitionPass.d.ts +33 -0
- package/examples/jsm/postprocessing/RenderTransitionPass.js +267 -0
- package/examples/jsm/postprocessing/SAOPass.d.ts +70 -0
- package/examples/jsm/postprocessing/SAOPass.js +407 -0
- package/examples/jsm/postprocessing/SMAAPass.d.ts +21 -0
- package/examples/jsm/postprocessing/SMAAPass.js +230 -0
- package/examples/jsm/postprocessing/SSAARenderPass.d.ts +26 -0
- package/examples/jsm/postprocessing/SSAARenderPass.js +313 -0
- package/examples/jsm/postprocessing/SSAOPass.d.ts +68 -0
- package/examples/jsm/postprocessing/SSAOPass.js +527 -0
- package/examples/jsm/postprocessing/SSRPass.d.ts +99 -0
- package/examples/jsm/postprocessing/SSRPass.js +858 -0
- package/examples/jsm/postprocessing/SavePass.d.ts +12 -0
- package/examples/jsm/postprocessing/SavePass.js +132 -0
- package/examples/jsm/postprocessing/ShaderPass.d.ts +11 -0
- package/examples/jsm/postprocessing/ShaderPass.js +135 -0
- package/examples/jsm/postprocessing/TAARenderPass.d.ts +8 -0
- package/examples/jsm/postprocessing/TAARenderPass.js +243 -0
- package/examples/jsm/postprocessing/TexturePass.d.ts +12 -0
- package/examples/jsm/postprocessing/TexturePass.js +131 -0
- package/examples/jsm/postprocessing/UnrealBloomPass.d.ts +26 -0
- package/examples/jsm/postprocessing/UnrealBloomPass.js +541 -0
- package/examples/jsm/renderers/CSS2DRenderer.d.ts +29 -0
- package/examples/jsm/renderers/CSS2DRenderer.js +352 -0
- package/examples/jsm/renderers/CSS3DRenderer.d.ts +26 -0
- package/examples/jsm/renderers/CSS3DRenderer.js +454 -0
- package/examples/jsm/renderers/Projector.d.ts +60 -0
- package/examples/jsm/renderers/Projector.js +1154 -0
- package/examples/jsm/renderers/SVGRenderer.d.ts +26 -0
- package/examples/jsm/renderers/SVGRenderer.js +800 -0
- package/examples/jsm/shaders/ACESFilmicToneMappingShader.d.ts +11 -0
- package/examples/jsm/shaders/ACESFilmicToneMappingShader.js +96 -0
- package/examples/jsm/shaders/AfterimageShader.d.ts +12 -0
- package/examples/jsm/shaders/AfterimageShader.js +63 -0
- package/examples/jsm/shaders/BasicShader.d.ts +6 -0
- package/examples/jsm/shaders/BasicShader.js +36 -0
- package/examples/jsm/shaders/BleachBypassShader.d.ts +10 -0
- package/examples/jsm/shaders/BleachBypassShader.js +68 -0
- package/examples/jsm/shaders/BlendShader.d.ts +13 -0
- package/examples/jsm/shaders/BlendShader.js +56 -0
- package/examples/jsm/shaders/BokehShader.d.ts +21 -0
- package/examples/jsm/shaders/BokehShader.js +151 -0
- package/examples/jsm/shaders/BokehShader2.d.ts +44 -0
- package/examples/jsm/shaders/BokehShader2.js +404 -0
- package/examples/jsm/shaders/BrightnessContrastShader.d.ts +12 -0
- package/examples/jsm/shaders/BrightnessContrastShader.js +62 -0
- package/examples/jsm/shaders/ColorCorrectionShader.d.ts +13 -0
- package/examples/jsm/shaders/ColorCorrectionShader.js +59 -0
- package/examples/jsm/shaders/ColorifyShader.d.ts +10 -0
- package/examples/jsm/shaders/ColorifyShader.js +57 -0
- package/examples/jsm/shaders/ConvolutionShader.d.ts +17 -0
- package/examples/jsm/shaders/ConvolutionShader.js +74 -0
- package/examples/jsm/shaders/CopyShader.d.ts +10 -0
- package/examples/jsm/shaders/CopyShader.js +52 -0
- package/examples/jsm/shaders/DOFMipMapShader.d.ts +13 -0
- package/examples/jsm/shaders/DOFMipMapShader.js +63 -0
- package/examples/jsm/shaders/DepthLimitedBlurShader.d.ts +28 -0
- package/examples/jsm/shaders/DepthLimitedBlurShader.js +183 -0
- package/examples/jsm/shaders/DigitalGlitch.d.ts +19 -0
- package/examples/jsm/shaders/DigitalGlitch.js +104 -0
- package/examples/jsm/shaders/DotScreenShader.d.ts +13 -0
- package/examples/jsm/shaders/DotScreenShader.js +75 -0
- package/examples/jsm/shaders/ExposureShader.d.ts +11 -0
- package/examples/jsm/shaders/ExposureShader.js +51 -0
- package/examples/jsm/shaders/FXAAShader.d.ts +11 -0
- package/examples/jsm/shaders/FXAAShader.js +298 -0
- package/examples/jsm/shaders/FilmShader.d.ts +12 -0
- package/examples/jsm/shaders/FilmShader.js +73 -0
- package/examples/jsm/shaders/FocusShader.d.ts +14 -0
- package/examples/jsm/shaders/FocusShader.js +94 -0
- package/examples/jsm/shaders/FreiChenShader.d.ts +11 -0
- package/examples/jsm/shaders/FreiChenShader.js +103 -0
- package/examples/jsm/shaders/GTAOShader.d.ts +59 -0
- package/examples/jsm/shaders/GTAOShader.js +437 -0
- package/examples/jsm/shaders/GammaCorrectionShader.d.ts +9 -0
- package/examples/jsm/shaders/GammaCorrectionShader.js +52 -0
- package/examples/jsm/shaders/HalftoneShader.d.ts +22 -0
- package/examples/jsm/shaders/HalftoneShader.js +332 -0
- package/examples/jsm/shaders/HorizontalBlurShader.d.ts +10 -0
- package/examples/jsm/shaders/HorizontalBlurShader.js +68 -0
- package/examples/jsm/shaders/HorizontalTiltShiftShader.d.ts +12 -0
- package/examples/jsm/shaders/HorizontalTiltShiftShader.js +70 -0
- package/examples/jsm/shaders/HueSaturationShader.d.ts +12 -0
- package/examples/jsm/shaders/HueSaturationShader.js +74 -0
- package/examples/jsm/shaders/KaleidoShader.d.ts +12 -0
- package/examples/jsm/shaders/KaleidoShader.js +65 -0
- package/examples/jsm/shaders/LuminosityHighPassShader.d.ts +15 -0
- package/examples/jsm/shaders/LuminosityHighPassShader.js +68 -0
- package/examples/jsm/shaders/LuminosityShader.d.ts +10 -0
- package/examples/jsm/shaders/LuminosityShader.js +54 -0
- package/examples/jsm/shaders/MirrorShader.d.ts +11 -0
- package/examples/jsm/shaders/MirrorShader.js +62 -0
- package/examples/jsm/shaders/NormalMapShader.d.ts +13 -0
- package/examples/jsm/shaders/NormalMapShader.js +60 -0
- package/examples/jsm/shaders/OutputShader.d.ts +11 -0
- package/examples/jsm/shaders/OutputShader.js +103 -0
- package/examples/jsm/shaders/PoissonDenoiseShader.d.ts +28 -0
- package/examples/jsm/shaders/PoissonDenoiseShader.js +230 -0
- package/examples/jsm/shaders/RGBShiftShader.d.ts +11 -0
- package/examples/jsm/shaders/RGBShiftShader.js +61 -0
- package/examples/jsm/shaders/SAOShader.d.ts +29 -0
- package/examples/jsm/shaders/SAOShader.js +201 -0
- package/examples/jsm/shaders/SMAAShader.d.ts +43 -0
- package/examples/jsm/shaders/SMAAShader.js +489 -0
- package/examples/jsm/shaders/SSAOShader.d.ts +49 -0
- package/examples/jsm/shaders/SSAOShader.js +331 -0
- package/examples/jsm/shaders/SSRShader.d.ts +62 -0
- package/examples/jsm/shaders/SSRShader.js +396 -0
- package/examples/jsm/shaders/SepiaShader.d.ts +10 -0
- package/examples/jsm/shaders/SepiaShader.js +57 -0
- package/examples/jsm/shaders/SobelOperatorShader.d.ts +11 -0
- package/examples/jsm/shaders/SobelOperatorShader.js +98 -0
- package/examples/jsm/shaders/SubsurfaceScatteringShader.d.ts +38 -0
- package/examples/jsm/shaders/SubsurfaceScatteringShader.js +95 -0
- package/examples/jsm/shaders/TechnicolorShader.d.ts +10 -0
- package/examples/jsm/shaders/TechnicolorShader.js +51 -0
- package/examples/jsm/shaders/ToonShader.d.ts +54 -0
- package/examples/jsm/shaders/ToonShader.js +349 -0
- package/examples/jsm/shaders/TriangleBlurShader.d.ts +11 -0
- package/examples/jsm/shaders/TriangleBlurShader.js +79 -0
- package/examples/jsm/shaders/UnpackDepthRGBAShader.d.ts +11 -0
- package/examples/jsm/shaders/UnpackDepthRGBAShader.js +60 -0
- package/examples/jsm/shaders/VelocityShader.d.ts +16 -0
- package/examples/jsm/shaders/VelocityShader.js +137 -0
- package/examples/jsm/shaders/VerticalBlurShader.d.ts +10 -0
- package/examples/jsm/shaders/VerticalBlurShader.js +66 -0
- package/examples/jsm/shaders/VerticalTiltShiftShader.d.ts +12 -0
- package/examples/jsm/shaders/VerticalTiltShiftShader.js +70 -0
- package/examples/jsm/shaders/VignetteShader.d.ts +11 -0
- package/examples/jsm/shaders/VignetteShader.js +56 -0
- package/examples/jsm/shaders/VolumeShader.d.ts +14 -0
- package/examples/jsm/shaders/VolumeShader.js +285 -0
- package/examples/jsm/shaders/WaterRefractionShader.d.ts +14 -0
- package/examples/jsm/shaders/WaterRefractionShader.js +106 -0
- package/examples/jsm/textures/FlakesTexture.d.ts +3 -0
- package/examples/jsm/textures/FlakesTexture.js +54 -0
- package/examples/jsm/transpiler/AST.d.ts +293 -0
- package/examples/jsm/transpiler/AST.js +694 -0
- package/examples/jsm/transpiler/GLSLDecoder.d.ts +7 -0
- package/examples/jsm/transpiler/GLSLDecoder.js +1718 -0
- package/examples/jsm/transpiler/Linker.js +327 -0
- package/examples/jsm/transpiler/ShaderToyDecoder.d.ts +3 -0
- package/examples/jsm/transpiler/ShaderToyDecoder.js +51 -0
- package/examples/jsm/transpiler/TSLEncoder.d.ts +51 -0
- package/examples/jsm/transpiler/TSLEncoder.js +1055 -0
- package/examples/jsm/transpiler/Transpiler.d.ts +5 -0
- package/examples/jsm/transpiler/Transpiler.js +67 -0
- package/examples/jsm/transpiler/TranspilerUtils.js +29 -0
- package/examples/jsm/transpiler/WGSLEncoder.js +868 -0
- package/examples/jsm/tsl/WebGLNodesHandler.d.ts +17 -0
- package/examples/jsm/tsl/WebGLNodesHandler.js +607 -0
- package/examples/jsm/tsl/display/AfterImageNode.d.ts +15 -0
- package/examples/jsm/tsl/display/AfterImageNode.js +256 -0
- package/examples/jsm/tsl/display/AnaglyphPassNode.d.ts +42 -0
- package/examples/jsm/tsl/display/AnaglyphPassNode.js +550 -0
- package/examples/jsm/tsl/display/BilateralBlurNode.d.ts +27 -0
- package/examples/jsm/tsl/display/BilateralBlurNode.js +377 -0
- package/examples/jsm/tsl/display/BleachBypass.d.ts +3 -0
- package/examples/jsm/tsl/display/BleachBypass.js +33 -0
- package/examples/jsm/tsl/display/BloomNode.d.ts +44 -0
- package/examples/jsm/tsl/display/BloomNode.js +599 -0
- package/examples/jsm/tsl/display/CRT.d.ts +22 -0
- package/examples/jsm/tsl/display/CRT.js +150 -0
- package/examples/jsm/tsl/display/ChromaticAberrationNode.d.ts +19 -0
- package/examples/jsm/tsl/display/ChromaticAberrationNode.js +163 -0
- package/examples/jsm/tsl/display/DenoiseNode.d.ts +26 -0
- package/examples/jsm/tsl/display/DenoiseNode.js +354 -0
- package/examples/jsm/tsl/display/DepthOfFieldNode.d.ts +28 -0
- package/examples/jsm/tsl/display/DepthOfFieldNode.js +572 -0
- package/examples/jsm/tsl/display/DotScreenNode.d.ts +17 -0
- package/examples/jsm/tsl/display/DotScreenNode.js +104 -0
- package/examples/jsm/tsl/display/FSR1Node.d.ts +17 -0
- package/examples/jsm/tsl/display/FSR1Node.js +481 -0
- package/examples/jsm/tsl/display/FXAANode.d.ts +11 -0
- package/examples/jsm/tsl/display/FXAANode.js +357 -0
- package/examples/jsm/tsl/display/FilmNode.d.ts +17 -0
- package/examples/jsm/tsl/display/FilmNode.js +101 -0
- package/examples/jsm/tsl/display/GTAONode.d.ts +37 -0
- package/examples/jsm/tsl/display/GTAONode.js +727 -0
- package/examples/jsm/tsl/display/GaussianBlurNode.d.ts +56 -0
- package/examples/jsm/tsl/display/GaussianBlurNode.js +412 -0
- package/examples/jsm/tsl/display/GodraysNode.d.ts +20 -0
- package/examples/jsm/tsl/display/GodraysNode.js +604 -0
- package/examples/jsm/tsl/display/ImportanceSampledEnvironment.d.ts +84 -0
- package/examples/jsm/tsl/display/ImportanceSampledEnvironment.js +564 -0
- package/examples/jsm/tsl/display/LensflareNode.d.ts +34 -0
- package/examples/jsm/tsl/display/LensflareNode.js +282 -0
- package/examples/jsm/tsl/display/Lut3DNode.d.ts +19 -0
- package/examples/jsm/tsl/display/Lut3DNode.js +109 -0
- package/examples/jsm/tsl/display/MotionBlur.d.ts +7 -0
- package/examples/jsm/tsl/display/MotionBlur.js +33 -0
- package/examples/jsm/tsl/display/OITPassNode.d.ts +64 -0
- package/examples/jsm/tsl/display/OITPassNode.js +341 -0
- package/examples/jsm/tsl/display/OutlineNode.d.ts +31 -0
- package/examples/jsm/tsl/display/OutlineNode.js +916 -0
- package/examples/jsm/tsl/display/ParallaxBarrierPassNode.d.ts +12 -0
- package/examples/jsm/tsl/display/ParallaxBarrierPassNode.js +90 -0
- package/examples/jsm/tsl/display/PixelationPassNode.d.ts +27 -0
- package/examples/jsm/tsl/display/PixelationPassNode.js +227 -0
- package/examples/jsm/tsl/display/RGBShiftNode.d.ts +15 -0
- package/examples/jsm/tsl/display/RGBShiftNode.js +96 -0
- package/examples/jsm/tsl/display/RecurrentDenoiseNode.d.ts +89 -0
- package/examples/jsm/tsl/display/RecurrentDenoiseNode.js +812 -0
- package/examples/jsm/tsl/display/RetroPassNode.d.ts +17 -0
- package/examples/jsm/tsl/display/RetroPassNode.js +263 -0
- package/examples/jsm/tsl/display/SMAANode.d.ts +17 -0
- package/examples/jsm/tsl/display/SMAANode.js +729 -0
- package/examples/jsm/tsl/display/SSAAPassNode.d.ts +18 -0
- package/examples/jsm/tsl/display/SSAAPassNode.js +344 -0
- package/examples/jsm/tsl/display/SSAONode.d.ts +116 -0
- package/examples/jsm/tsl/display/SSAONode.js +422 -0
- package/examples/jsm/tsl/display/SSGINode.d.ts +33 -0
- package/examples/jsm/tsl/display/SSGINode.js +698 -0
- package/examples/jsm/tsl/display/SSRNode.d.ts +315 -0
- package/examples/jsm/tsl/display/SSRNode.js +1430 -0
- package/examples/jsm/tsl/display/SSSNode.d.ts +20 -0
- package/examples/jsm/tsl/display/SSSNode.js +479 -0
- package/examples/jsm/tsl/display/Sepia.d.ts +3 -0
- package/examples/jsm/tsl/display/Sepia.js +24 -0
- package/examples/jsm/tsl/display/Shape.d.ts +3 -0
- package/examples/jsm/tsl/display/Shape.js +29 -0
- package/examples/jsm/tsl/display/SharpenNode.d.ts +22 -0
- package/examples/jsm/tsl/display/SharpenNode.js +284 -0
- package/examples/jsm/tsl/display/SobelOperatorNode.d.ts +11 -0
- package/examples/jsm/tsl/display/SobelOperatorNode.js +168 -0
- package/examples/jsm/tsl/display/StereoCompositePassNode.d.ts +13 -0
- package/examples/jsm/tsl/display/StereoCompositePassNode.js +190 -0
- package/examples/jsm/tsl/display/StereoPassNode.d.ts +13 -0
- package/examples/jsm/tsl/display/StereoPassNode.js +117 -0
- package/examples/jsm/tsl/display/TAAUNode.d.ts +31 -0
- package/examples/jsm/tsl/display/TAAUNode.js +700 -0
- package/examples/jsm/tsl/display/TRAANode.d.ts +26 -0
- package/examples/jsm/tsl/display/TRAANode.js +609 -0
- package/examples/jsm/tsl/display/TemporalReprojectNode.d.ts +64 -0
- package/examples/jsm/tsl/display/TemporalReprojectNode.js +1024 -0
- package/examples/jsm/tsl/display/TransitionNode.d.ts +31 -0
- package/examples/jsm/tsl/display/TransitionNode.js +141 -0
- package/examples/jsm/tsl/display/boxBlur.d.ts +10 -0
- package/examples/jsm/tsl/display/boxBlur.js +65 -0
- package/examples/jsm/tsl/display/depthAwareBlend.d.ts +15 -0
- package/examples/jsm/tsl/display/depthAwareBlend.js +80 -0
- package/examples/jsm/tsl/display/depthAwareBlur.d.ts +10 -0
- package/examples/jsm/tsl/display/depthAwareBlur.js +63 -0
- package/examples/jsm/tsl/display/hashBlur.d.ts +12 -0
- package/examples/jsm/tsl/display/hashBlur.js +55 -0
- package/examples/jsm/tsl/display/lensDirt.js +30 -0
- package/examples/jsm/tsl/display/radialBlur.d.ts +12 -0
- package/examples/jsm/tsl/display/radialBlur.js +68 -0
- package/examples/jsm/tsl/lighting/ClusteredLightsNode.d.ts +54 -0
- package/examples/jsm/tsl/lighting/ClusteredLightsNode.js +994 -0
- package/examples/jsm/tsl/lighting/DynamicLightsNode.d.ts +21 -0
- package/examples/jsm/tsl/lighting/DynamicLightsNode.js +201 -0
- package/examples/jsm/tsl/lighting/LightProbeGridNode.js +183 -0
- package/examples/jsm/tsl/lighting/data/AmbientLightDataNode.d.ts +9 -0
- package/examples/jsm/tsl/lighting/data/AmbientLightDataNode.js +67 -0
- package/examples/jsm/tsl/lighting/data/DirectionalLightDataNode.d.ts +9 -0
- package/examples/jsm/tsl/lighting/data/DirectionalLightDataNode.js +117 -0
- package/examples/jsm/tsl/lighting/data/HemisphereLightDataNode.d.ts +9 -0
- package/examples/jsm/tsl/lighting/data/HemisphereLightDataNode.js +105 -0
- package/examples/jsm/tsl/lighting/data/PointLightDataNode.d.ts +9 -0
- package/examples/jsm/tsl/lighting/data/PointLightDataNode.js +140 -0
- package/examples/jsm/tsl/lighting/data/SpotLightDataNode.d.ts +9 -0
- package/examples/jsm/tsl/lighting/data/SpotLightDataNode.js +167 -0
- package/examples/jsm/tsl/math/Bayer.d.ts +5 -0
- package/examples/jsm/tsl/math/Bayer.js +84 -0
- package/examples/jsm/tsl/math/curlNoise.d.ts +38 -0
- package/examples/jsm/tsl/math/curlNoise.js +107 -0
- package/examples/jsm/tsl/math/voronoiNoise.d.ts +52 -0
- package/examples/jsm/tsl/math/voronoiNoise.js +112 -0
- package/examples/jsm/tsl/shadows/TileShadowNode.d.ts +14 -0
- package/examples/jsm/tsl/shadows/TileShadowNode.js +542 -0
- package/examples/jsm/tsl/shadows/TileShadowNodeHelper.d.ts +14 -0
- package/examples/jsm/tsl/shadows/TileShadowNodeHelper.js +212 -0
- package/examples/jsm/tsl/utils/GroundedSkybox.d.ts +17 -0
- package/examples/jsm/tsl/utils/GroundedSkybox.js +62 -0
- package/examples/jsm/tsl/utils/RNoise.d.ts +12 -0
- package/examples/jsm/tsl/utils/RNoise.js +51 -0
- package/examples/jsm/tsl/utils/Raymarching.d.ts +8 -0
- package/examples/jsm/tsl/utils/Raymarching.js +70 -0
- package/examples/jsm/tsl/utils/SoftParticles.d.ts +21 -0
- package/examples/jsm/tsl/utils/SoftParticles.js +53 -0
- package/examples/jsm/tsl/utils/SpecularHelpers.d.ts +20 -0
- package/examples/jsm/tsl/utils/SpecularHelpers.js +302 -0
- package/examples/jsm/tsl/utils/TAAUtils.js +184 -0
- package/examples/jsm/utils/BufferGeometryUtils.d.ts +37 -0
- package/examples/jsm/utils/BufferGeometryUtils.js +1523 -0
- package/examples/jsm/utils/CameraUtils.d.ts +9 -0
- package/examples/jsm/utils/CameraUtils.js +82 -0
- package/examples/jsm/utils/ColorUtils.d.ts +5 -0
- package/examples/jsm/utils/ColorUtils.js +76 -0
- package/examples/jsm/utils/GaussianSplatUtils.d.ts +68 -0
- package/examples/jsm/utils/GaussianSplatUtils.js +229 -0
- package/examples/jsm/utils/GeometryCompressionUtils.d.ts +21 -0
- package/examples/jsm/utils/GeometryCompressionUtils.js +547 -0
- package/examples/jsm/utils/GeometryUtils.d.ts +25 -0
- package/examples/jsm/utils/GeometryUtils.js +226 -0
- package/examples/jsm/utils/LDrawUtils.d.ts +5 -0
- package/examples/jsm/utils/LDrawUtils.js +211 -0
- package/examples/jsm/utils/MeshletGeometryUtils.js +417 -0
- package/examples/jsm/utils/SceneOptimizer.d.ts +18 -0
- package/examples/jsm/utils/SceneOptimizer.js +459 -0
- package/examples/jsm/utils/SceneUtils.d.ts +57 -0
- package/examples/jsm/utils/SceneUtils.js +363 -0
- package/examples/jsm/utils/ShadowMapViewer.d.ts +26 -0
- package/examples/jsm/utils/ShadowMapViewer.js +244 -0
- package/examples/jsm/utils/ShadowMapViewerGPU.d.ts +26 -0
- package/examples/jsm/utils/ShadowMapViewerGPU.js +233 -0
- package/examples/jsm/utils/SkeletonUtils.d.ts +32 -0
- package/examples/jsm/utils/SkeletonUtils.js +496 -0
- package/examples/jsm/utils/SortUtils.d.ts +7 -0
- package/examples/jsm/utils/SortUtils.js +175 -0
- package/examples/jsm/utils/UVsDebug.d.ts +3 -0
- package/examples/jsm/utils/UVsDebug.js +173 -0
- package/examples/jsm/utils/WebGLTextureUtils.d.ts +3 -0
- package/examples/jsm/utils/WebGLTextureUtils.js +115 -0
- package/examples/jsm/utils/WebGPUTextureUtils.d.ts +3 -0
- package/examples/jsm/utils/WebGPUTextureUtils.js +81 -0
- package/examples/jsm/utils/WorkerPool.d.ts +26 -0
- package/examples/jsm/utils/WorkerPool.js +167 -0
- package/examples/jsm/utils/unwrapUVs.js +865 -0
- package/examples/jsm/webxr/ARButton.d.ts +9 -0
- package/examples/jsm/webxr/ARButton.js +251 -0
- package/examples/jsm/webxr/OculusHandModel.d.ts +23 -0
- package/examples/jsm/webxr/OculusHandModel.js +194 -0
- package/examples/jsm/webxr/OculusHandPointerModel.d.ts +67 -0
- package/examples/jsm/webxr/OculusHandPointerModel.js +539 -0
- package/examples/jsm/webxr/Text2D.d.ts +3 -0
- package/examples/jsm/webxr/Text2D.js +52 -0
- package/examples/jsm/webxr/VRButton.d.ts +7 -0
- package/examples/jsm/webxr/VRButton.js +264 -0
- package/examples/jsm/webxr/WebGLXRFallback.d.ts +14 -0
- package/examples/jsm/webxr/WebGLXRFallback.js +75 -0
- package/examples/jsm/webxr/XRButton.d.ts +7 -0
- package/examples/jsm/webxr/XRButton.js +246 -0
- package/examples/jsm/webxr/XRControllerModelFactory.d.ts +23 -0
- package/examples/jsm/webxr/XRControllerModelFactory.js +415 -0
- package/examples/jsm/webxr/XREstimatedLight.d.ts +69 -0
- package/examples/jsm/webxr/XREstimatedLight.js +261 -0
- package/examples/jsm/webxr/XRHandMeshModel.d.ts +20 -0
- package/examples/jsm/webxr/XRHandMeshModel.js +177 -0
- package/examples/jsm/webxr/XRHandModelFactory.d.ts +32 -0
- package/examples/jsm/webxr/XRHandModelFactory.js +198 -0
- package/examples/jsm/webxr/XRHandPrimitiveModel.d.ts +24 -0
- package/examples/jsm/webxr/XRHandPrimitiveModel.js +147 -0
- package/examples/jsm/webxr/XRPlanes.d.ts +5 -0
- package/examples/jsm/webxr/XRPlanes.js +118 -0
- package/index.d.ts +6 -0
- package/package.json +68 -4
- package/src/Three.Core.d.ts +176 -0
- package/src/Three.Core.js +189 -0
- package/src/Three.Legacy.js +0 -0
- package/src/Three.TSL.d.ts +686 -0
- package/src/Three.TSL.js +3 -0
- package/src/Three.WebGPU.Nodes.d.ts +36 -0
- package/src/Three.WebGPU.Nodes.js +34 -0
- package/src/Three.WebGPU.d.ts +44 -0
- package/src/Three.WebGPU.js +44 -0
- package/src/Three.d.ts +47 -0
- package/src/Three.js +10 -0
- package/src/animation/AnimationAction.d.ts +286 -0
- package/src/animation/AnimationAction.js +946 -0
- package/src/animation/AnimationClip.d.ts +168 -0
- package/src/animation/AnimationClip.js +502 -0
- package/src/animation/AnimationMixer.d.ts +175 -0
- package/src/animation/AnimationMixer.js +860 -0
- package/src/animation/AnimationObjectGroup.d.ts +58 -0
- package/src/animation/AnimationObjectGroup.js +423 -0
- package/src/animation/AnimationUtils.d.ts +182 -0
- package/src/animation/AnimationUtils.js +519 -0
- package/src/animation/KeyframeTrack.d.ts +197 -0
- package/src/animation/KeyframeTrack.js +692 -0
- package/src/animation/PropertyBinding.d.ts +101 -0
- package/src/animation/PropertyBinding.js +794 -0
- package/src/animation/PropertyMixer.d.ts +75 -0
- package/src/animation/PropertyMixer.js +385 -0
- package/src/animation/tracks/BooleanKeyframeTrack.d.ts +18 -0
- package/src/animation/tracks/BooleanKeyframeTrack.js +55 -0
- package/src/animation/tracks/ColorKeyframeTrack.d.ts +17 -0
- package/src/animation/tracks/ColorKeyframeTrack.js +36 -0
- package/src/animation/tracks/NumberKeyframeTrack.d.ts +17 -0
- package/src/animation/tracks/NumberKeyframeTrack.js +36 -0
- package/src/animation/tracks/QuaternionKeyframeTrack.d.ts +17 -0
- package/src/animation/tracks/QuaternionKeyframeTrack.js +51 -0
- package/src/animation/tracks/StringKeyframeTrack.d.ts +18 -0
- package/src/animation/tracks/StringKeyframeTrack.js +55 -0
- package/src/animation/tracks/VectorKeyframeTrack.d.ts +17 -0
- package/src/animation/tracks/VectorKeyframeTrack.js +36 -0
- package/src/audio/Audio.d.ts +340 -0
- package/src/audio/Audio.js +778 -0
- package/src/audio/AudioAnalyser.d.ts +63 -0
- package/src/audio/AudioAnalyser.js +97 -0
- package/src/audio/AudioContext.d.ts +19 -0
- package/src/audio/AudioContext.js +40 -0
- package/src/audio/AudioListener.d.ts +75 -0
- package/src/audio/AudioListener.js +218 -0
- package/src/audio/PositionalAudio.d.ts +108 -0
- package/src/audio/PositionalAudio.js +253 -0
- package/src/cameras/ArrayCamera.d.ts +35 -0
- package/src/cameras/ArrayCamera.js +66 -0
- package/src/cameras/Camera.d.ts +42 -0
- package/src/cameras/Camera.js +160 -0
- package/src/cameras/CubeCamera.d.ts +89 -0
- package/src/cameras/CubeCamera.js +259 -0
- package/src/cameras/OrthographicCamera.d.ts +144 -0
- package/src/cameras/OrthographicCamera.js +245 -0
- package/src/cameras/PerspectiveCamera.d.ts +241 -0
- package/src/cameras/PerspectiveCamera.js +407 -0
- package/src/cameras/StereoCamera.d.ts +44 -0
- package/src/cameras/StereoCamera.js +149 -0
- package/src/constants.d.ts +976 -0
- package/src/constants.js +1774 -0
- package/src/core/BufferAttribute.d.ts +650 -0
- package/src/core/BufferAttribute.js +1093 -0
- package/src/core/BufferGeometry.d.ts +442 -0
- package/src/core/BufferGeometry.js +1472 -0
- package/src/core/Clock.d.ts +73 -0
- package/src/core/Clock.js +135 -0
- package/src/core/EventDispatcher.d.ts +82 -0
- package/src/core/EventDispatcher.js +131 -0
- package/src/core/GLBufferAttribute.d.ts +138 -0
- package/src/core/GLBufferAttribute.js +171 -0
- package/src/core/InstancedBufferAttribute.d.ts +32 -0
- package/src/core/InstancedBufferAttribute.js +68 -0
- package/src/core/InstancedBufferGeometry.d.ts +37 -0
- package/src/core/InstancedBufferGeometry.js +60 -0
- package/src/core/InstancedInterleavedBuffer.d.ts +22 -0
- package/src/core/InstancedInterleavedBuffer.js +74 -0
- package/src/core/InterleavedBuffer.d.ts +162 -0
- package/src/core/InterleavedBuffer.js +305 -0
- package/src/core/InterleavedBufferAttribute.d.ts +201 -0
- package/src/core/InterleavedBufferAttribute.js +583 -0
- package/src/core/Layers.d.ts +72 -0
- package/src/core/Layers.js +121 -0
- package/src/core/Object3D.d.ts +725 -0
- package/src/core/Object3D.js +1719 -0
- package/src/core/Raycaster.d.ts +212 -0
- package/src/core/Raycaster.js +268 -0
- package/src/core/RenderTarget.d.ts +153 -0
- package/src/core/RenderTarget.js +501 -0
- package/src/core/RenderTarget3D.d.ts +9 -0
- package/src/core/RenderTarget3D.js +52 -0
- package/src/core/Timer.d.ts +77 -0
- package/src/core/Timer.js +184 -0
- package/src/core/Uniform.d.ts +38 -0
- package/src/core/Uniform.js +46 -0
- package/src/core/UniformsGroup.d.ts +39 -0
- package/src/core/UniformsGroup.js +184 -0
- package/src/extras/Controls.d.ts +59 -0
- package/src/extras/Controls.js +112 -0
- package/src/extras/DataUtils.d.ts +22 -0
- package/src/extras/DataUtils.js +217 -0
- package/src/extras/Earcut.d.ts +17 -0
- package/src/extras/Earcut.js +28 -0
- package/src/extras/ImageUtils.d.ts +33 -0
- package/src/extras/ImageUtils.js +137 -0
- package/src/extras/PMREMGenerator.d.ts +95 -0
- package/src/extras/PMREMGenerator.js +770 -0
- package/src/extras/ShapeUtils.d.ts +25 -0
- package/src/extras/ShapeUtils.js +114 -0
- package/src/extras/TextureUtils.d.ts +42 -0
- package/src/extras/TextureUtils.js +297 -0
- package/src/extras/core/Curve.d.ts +162 -0
- package/src/extras/core/Curve.js +521 -0
- package/src/extras/core/CurvePath.d.ts +77 -0
- package/src/extras/core/CurvePath.js +309 -0
- package/src/extras/core/Interpolations.d.ts +36 -0
- package/src/extras/core/Interpolations.js +111 -0
- package/src/extras/core/Path.d.ts +166 -0
- package/src/extras/core/Path.js +329 -0
- package/src/extras/core/Shape.d.ts +86 -0
- package/src/extras/core/Shape.js +165 -0
- package/src/extras/core/ShapePath.d.ts +94 -0
- package/src/extras/core/ShapePath.js +356 -0
- package/src/extras/curves/ArcCurve.d.ts +41 -0
- package/src/extras/curves/ArcCurve.js +39 -0
- package/src/extras/curves/CatmullRomCurve3.d.ts +77 -0
- package/src/extras/curves/CatmullRomCurve3.js +327 -0
- package/src/extras/curves/CubicBezierCurve.d.ts +72 -0
- package/src/extras/curves/CubicBezierCurve.js +145 -0
- package/src/extras/curves/CubicBezierCurve3.d.ts +72 -0
- package/src/extras/curves/CubicBezierCurve3.js +129 -0
- package/src/extras/curves/Curves.d.ts +10 -0
- package/src/extras/curves/Curves.js +10 -0
- package/src/extras/curves/EllipseCurve.d.ts +115 -0
- package/src/extras/curves/EllipseCurve.js +258 -0
- package/src/extras/curves/LineCurve.d.ts +42 -0
- package/src/extras/curves/LineCurve.js +128 -0
- package/src/extras/curves/LineCurve3.d.ts +42 -0
- package/src/extras/curves/LineCurve3.js +128 -0
- package/src/extras/curves/QuadraticBezierCurve.d.ts +64 -0
- package/src/extras/curves/QuadraticBezierCurve.js +133 -0
- package/src/extras/curves/QuadraticBezierCurve3.d.ts +64 -0
- package/src/extras/curves/QuadraticBezierCurve3.js +118 -0
- package/src/extras/curves/SplineCurve.d.ts +52 -0
- package/src/extras/curves/SplineCurve.js +145 -0
- package/src/extras/lib/earcut.js +685 -0
- package/src/geometries/BoxGeometry.d.ts +59 -0
- package/src/geometries/BoxGeometry.js +219 -0
- package/src/geometries/CapsuleGeometry.d.ts +56 -0
- package/src/geometries/CapsuleGeometry.js +218 -0
- package/src/geometries/CircleGeometry.d.ts +51 -0
- package/src/geometries/CircleGeometry.js +142 -0
- package/src/geometries/ConeGeometry.d.ts +64 -0
- package/src/geometries/ConeGeometry.js +70 -0
- package/src/geometries/CylinderGeometry.d.ts +64 -0
- package/src/geometries/CylinderGeometry.js +333 -0
- package/src/geometries/DodecahedronGeometry.d.ts +25 -0
- package/src/geometries/DodecahedronGeometry.js +99 -0
- package/src/geometries/EdgesGeometry.d.ts +41 -0
- package/src/geometries/EdgesGeometry.js +182 -0
- package/src/geometries/ExtrudeGeometry.d.ts +138 -0
- package/src/geometries/ExtrudeGeometry.js +910 -0
- package/src/geometries/Geometries.d.ts +21 -0
- package/src/geometries/Geometries.js +21 -0
- package/src/geometries/IcosahedronGeometry.d.ts +26 -0
- package/src/geometries/IcosahedronGeometry.js +75 -0
- package/src/geometries/LatheGeometry.d.ts +55 -0
- package/src/geometries/LatheGeometry.js +232 -0
- package/src/geometries/OctahedronGeometry.d.ts +25 -0
- package/src/geometries/OctahedronGeometry.js +70 -0
- package/src/geometries/PlaneGeometry.d.ts +48 -0
- package/src/geometries/PlaneGeometry.js +133 -0
- package/src/geometries/PolyhedronGeometry.d.ts +54 -0
- package/src/geometries/PolyhedronGeometry.js +348 -0
- package/src/geometries/RingGeometry.d.ts +59 -0
- package/src/geometries/RingGeometry.js +165 -0
- package/src/geometries/ShapeGeometry.d.ts +53 -0
- package/src/geometries/ShapeGeometry.js +233 -0
- package/src/geometries/SphereGeometry.d.ts +67 -0
- package/src/geometries/SphereGeometry.js +180 -0
- package/src/geometries/TetrahedronGeometry.d.ts +25 -0
- package/src/geometries/TetrahedronGeometry.js +67 -0
- package/src/geometries/TorusGeometry.d.ts +69 -0
- package/src/geometries/TorusGeometry.js +161 -0
- package/src/geometries/TorusKnotGeometry.d.ts +59 -0
- package/src/geometries/TorusKnotGeometry.js +206 -0
- package/src/geometries/TubeGeometry.d.ts +86 -0
- package/src/geometries/TubeGeometry.js +253 -0
- package/src/geometries/WireframeGeometry.d.ts +40 -0
- package/src/geometries/WireframeGeometry.js +179 -0
- package/src/helpers/ArrowHelper.d.ts +72 -0
- package/src/helpers/ArrowHelper.js +173 -0
- package/src/helpers/AxesHelper.d.ts +33 -0
- package/src/helpers/AxesHelper.js +98 -0
- package/src/helpers/Box3Helper.d.ts +28 -0
- package/src/helpers/Box3Helper.js +85 -0
- package/src/helpers/BoxHelper.d.ts +48 -0
- package/src/helpers/BoxHelper.js +151 -0
- package/src/helpers/CameraHelper.d.ts +54 -0
- package/src/helpers/CameraHelper.js +347 -0
- package/src/helpers/DirectionalLightHelper.d.ts +55 -0
- package/src/helpers/DirectionalLightHelper.js +152 -0
- package/src/helpers/GridHelper.d.ts +28 -0
- package/src/helpers/GridHelper.js +84 -0
- package/src/helpers/HemisphereLightHelper.d.ts +44 -0
- package/src/helpers/HemisphereLightHelper.js +134 -0
- package/src/helpers/PlaneHelper.d.ts +33 -0
- package/src/helpers/PlaneHelper.js +98 -0
- package/src/helpers/PointLightHelper.d.ts +43 -0
- package/src/helpers/PointLightHelper.js +115 -0
- package/src/helpers/PolarGridHelper.d.ts +37 -0
- package/src/helpers/PolarGridHelper.js +128 -0
- package/src/helpers/SkeletonHelper.d.ts +44 -0
- package/src/helpers/SkeletonHelper.js +196 -0
- package/src/helpers/SpotLightHelper.d.ts +45 -0
- package/src/helpers/SpotLightHelper.js +156 -0
- package/src/lights/AmbientLight.d.ts +28 -0
- package/src/lights/AmbientLight.js +42 -0
- package/src/lights/DirectionalLight.d.ts +68 -0
- package/src/lights/DirectionalLight.js +113 -0
- package/src/lights/DirectionalLightShadow.d.ts +18 -0
- package/src/lights/DirectionalLightShadow.js +31 -0
- package/src/lights/HemisphereLight.d.ts +41 -0
- package/src/lights/HemisphereLight.js +76 -0
- package/src/lights/Light.d.ts +39 -0
- package/src/lights/Light.js +86 -0
- package/src/lights/LightProbe.d.ts +46 -0
- package/src/lights/LightProbe.js +77 -0
- package/src/lights/LightShadow.d.ts +201 -0
- package/src/lights/LightShadow.js +380 -0
- package/src/lights/PointLight.d.ts +72 -0
- package/src/lights/PointLight.js +131 -0
- package/src/lights/PointLightShadow.d.ts +18 -0
- package/src/lights/PointLightShadow.js +31 -0
- package/src/lights/RectAreaLight.d.ts +62 -0
- package/src/lights/RectAreaLight.js +115 -0
- package/src/lights/SpotLight.d.ts +124 -0
- package/src/lights/SpotLight.js +194 -0
- package/src/lights/SpotLightShadow.d.ts +44 -0
- package/src/lights/SpotLightShadow.js +98 -0
- package/src/lights/webgpu/IESSpotLight.d.ts +18 -0
- package/src/lights/webgpu/IESSpotLight.js +47 -0
- package/src/lights/webgpu/ProjectorLight.d.ts +16 -0
- package/src/lights/webgpu/ProjectorLight.js +46 -0
- package/src/loaders/AnimationLoader.d.ts +9 -0
- package/src/loaders/AnimationLoader.js +100 -0
- package/src/loaders/AudioLoader.d.ts +6 -0
- package/src/loaders/AudioLoader.js +110 -0
- package/src/loaders/BufferGeometryLoader.d.ts +10 -0
- package/src/loaders/BufferGeometryLoader.js +249 -0
- package/src/loaders/Cache.d.ts +21 -0
- package/src/loaders/Cache.js +115 -0
- package/src/loaders/CompressedTextureLoader.d.ts +14 -0
- package/src/loaders/CompressedTextureLoader.js +169 -0
- package/src/loaders/CubeTextureLoader.d.ts +14 -0
- package/src/loaders/CubeTextureLoader.js +105 -0
- package/src/loaders/DataTextureLoader.d.ts +48 -0
- package/src/loaders/DataTextureLoader.js +207 -0
- package/src/loaders/FileLoader.d.ts +19 -0
- package/src/loaders/FileLoader.js +369 -0
- package/src/loaders/ImageBitmapLoader.d.ts +22 -0
- package/src/loaders/ImageBitmapLoader.js +227 -0
- package/src/loaders/ImageLoader.d.ts +17 -0
- package/src/loaders/ImageLoader.js +169 -0
- package/src/loaders/Loader.d.ts +51 -0
- package/src/loaders/Loader.js +269 -0
- package/src/loaders/LoaderUtils.d.ts +5 -0
- package/src/loaders/LoaderUtils.js +59 -0
- package/src/loaders/LoadingManager.d.ts +73 -0
- package/src/loaders/LoadingManager.js +334 -0
- package/src/loaders/MaterialLoader.d.ts +29 -0
- package/src/loaders/MaterialLoader.js +211 -0
- package/src/loaders/ObjectLoader.d.ts +35 -0
- package/src/loaders/ObjectLoader.js +1328 -0
- package/src/loaders/TextureLoader.d.ts +18 -0
- package/src/loaders/TextureLoader.js +76 -0
- package/src/loaders/nodes/NodeLoader.d.ts +21 -0
- package/src/loaders/nodes/NodeLoader.js +196 -0
- package/src/loaders/nodes/NodeMaterialLoader.d.ts +11 -0
- package/src/loaders/nodes/NodeMaterialLoader.js +108 -0
- package/src/loaders/nodes/NodeObjectLoader.d.ts +22 -0
- package/src/loaders/nodes/NodeObjectLoader.js +169 -0
- package/src/materials/LineBasicMaterial.d.ts +93 -0
- package/src/materials/LineBasicMaterial.js +126 -0
- package/src/materials/LineDashedMaterial.d.ts +56 -0
- package/src/materials/LineDashedMaterial.js +86 -0
- package/src/materials/Material.d.ts +663 -0
- package/src/materials/Material.js +1254 -0
- package/src/materials/Materials.d.ts +18 -0
- package/src/materials/Materials.js +39 -0
- package/src/materials/MeshBasicMaterial.d.ts +204 -0
- package/src/materials/MeshBasicMaterial.js +274 -0
- package/src/materials/MeshDepthMaterial.d.ts +119 -0
- package/src/materials/MeshDepthMaterial.js +158 -0
- package/src/materials/MeshDistanceMaterial.d.ts +102 -0
- package/src/materials/MeshDistanceMaterial.js +129 -0
- package/src/materials/MeshLambertMaterial.d.ts +331 -0
- package/src/materials/MeshLambertMaterial.js +441 -0
- package/src/materials/MeshMatcapMaterial.d.ts +199 -0
- package/src/materials/MeshMatcapMaterial.js +269 -0
- package/src/materials/MeshNormalMaterial.d.ts +134 -0
- package/src/materials/MeshNormalMaterial.js +183 -0
- package/src/materials/MeshPhongMaterial.d.ts +343 -0
- package/src/materials/MeshPhongMaterial.js +460 -0
- package/src/materials/MeshPhysicalMaterial.d.ts +353 -0
- package/src/materials/MeshPhysicalMaterial.js +685 -0
- package/src/materials/MeshStandardMaterial.d.ts +352 -0
- package/src/materials/MeshStandardMaterial.js +466 -0
- package/src/materials/MeshToonMaterial.d.ts +265 -0
- package/src/materials/MeshToonMaterial.js +354 -0
- package/src/materials/PointsMaterial.d.ts +113 -0
- package/src/materials/PointsMaterial.js +146 -0
- package/src/materials/RawShaderMaterial.d.ts +17 -0
- package/src/materials/RawShaderMaterial.js +42 -0
- package/src/materials/ShaderMaterial.d.ts +268 -0
- package/src/materials/ShaderMaterial.js +499 -0
- package/src/materials/ShadowMaterial.d.ts +61 -0
- package/src/materials/ShadowMaterial.js +91 -0
- package/src/materials/SpriteMaterial.d.ts +100 -0
- package/src/materials/SpriteMaterial.js +143 -0
- package/src/materials/nodes/Line2NodeMaterial.d.ts +102 -0
- package/src/materials/nodes/Line2NodeMaterial.js +656 -0
- package/src/materials/nodes/LineBasicNodeMaterial.d.ts +38 -0
- package/src/materials/nodes/LineBasicNodeMaterial.js +46 -0
- package/src/materials/nodes/LineDashedNodeMaterial.d.ts +88 -0
- package/src/materials/nodes/LineDashedNodeMaterial.js +132 -0
- package/src/materials/nodes/MeshBasicNodeMaterial.d.ts +55 -0
- package/src/materials/nodes/MeshBasicNodeMaterial.js +134 -0
- package/src/materials/nodes/MeshLambertNodeMaterial.d.ts +55 -0
- package/src/materials/nodes/MeshLambertNodeMaterial.js +95 -0
- package/src/materials/nodes/MeshMatcapNodeMaterial.d.ts +45 -0
- package/src/materials/nodes/MeshMatcapNodeMaterial.js +77 -0
- package/src/materials/nodes/MeshNormalNodeMaterial.d.ts +41 -0
- package/src/materials/nodes/MeshNormalNodeMaterial.js +67 -0
- package/src/materials/nodes/MeshPhongNodeMaterial.d.ts +77 -0
- package/src/materials/nodes/MeshPhongNodeMaterial.js +145 -0
- package/src/materials/nodes/MeshPhysicalNodeMaterial.d.ts +286 -0
- package/src/materials/nodes/MeshPhysicalNodeMaterial.js +563 -0
- package/src/materials/nodes/MeshSSSNodeMaterial.d.ts +110 -0
- package/src/materials/nodes/MeshSSSNodeMaterial.js +162 -0
- package/src/materials/nodes/MeshStandardNodeMaterial.d.ts +93 -0
- package/src/materials/nodes/MeshStandardNodeMaterial.js +176 -0
- package/src/materials/nodes/MeshToonNodeMaterial.d.ts +45 -0
- package/src/materials/nodes/MeshToonNodeMaterial.js +79 -0
- package/src/materials/nodes/NodeMaterial.d.ts +503 -0
- package/src/materials/nodes/NodeMaterial.js +1400 -0
- package/src/materials/nodes/NodeMaterialInstance.js +193 -0
- package/src/materials/nodes/NodeMaterials.d.ts +18 -0
- package/src/materials/nodes/NodeMaterials.js +22 -0
- package/src/materials/nodes/PointsNodeMaterial.d.ts +60 -0
- package/src/materials/nodes/PointsNodeMaterial.js +212 -0
- package/src/materials/nodes/ShadowNodeMaterial.d.ts +45 -0
- package/src/materials/nodes/ShadowNodeMaterial.js +76 -0
- package/src/materials/nodes/SpriteNodeMaterial.d.ts +74 -0
- package/src/materials/nodes/SpriteNodeMaterial.js +176 -0
- package/src/materials/nodes/VolumeNodeMaterial.d.ts +56 -0
- package/src/materials/nodes/VolumeNodeMaterial.js +81 -0
- package/src/materials/nodes/manager/NodeMaterialObserver.d.ts +58 -0
- package/src/materials/nodes/manager/NodeMaterialObserver.js +1142 -0
- package/src/math/Box2.d.ts +48 -0
- package/src/math/Box2.js +381 -0
- package/src/math/Box3.d.ts +310 -0
- package/src/math/Box3.js +810 -0
- package/src/math/Color.d.ts +376 -0
- package/src/math/Color.js +967 -0
- package/src/math/ColorManagement.d.ts +59 -0
- package/src/math/ColorManagement.js +196 -0
- package/src/math/Cylindrical.d.ts +26 -0
- package/src/math/Cylindrical.js +120 -0
- package/src/math/Euler.d.ts +50 -0
- package/src/math/Euler.js +449 -0
- package/src/math/Frustum.d.ts +30 -0
- package/src/math/Frustum.js +294 -0
- package/src/math/FrustumArray.d.ts +86 -0
- package/src/math/FrustumArray.js +240 -0
- package/src/math/Interpolant.d.ts +113 -0
- package/src/math/Interpolant.js +320 -0
- package/src/math/Line3.d.ts +30 -0
- package/src/math/Line3.js +335 -0
- package/src/math/MathUtils.d.ts +153 -0
- package/src/math/MathUtils.js +740 -0
- package/src/math/Matrix2.d.ts +53 -0
- package/src/math/Matrix2.js +128 -0
- package/src/math/Matrix3.d.ts +193 -0
- package/src/math/Matrix3.js +628 -0
- package/src/math/Matrix4.d.ts +506 -0
- package/src/math/Matrix4.js +1332 -0
- package/src/math/Plane.d.ts +55 -0
- package/src/math/Plane.js +397 -0
- package/src/math/Quaternion.d.ts +189 -0
- package/src/math/Quaternion.js +908 -0
- package/src/math/Ray.d.ts +60 -0
- package/src/math/Ray.js +705 -0
- package/src/math/Sphere.d.ts +55 -0
- package/src/math/Sphere.js +420 -0
- package/src/math/Spherical.d.ts +27 -0
- package/src/math/Spherical.js +147 -0
- package/src/math/SphericalHarmonics3.d.ts +50 -0
- package/src/math/SphericalHarmonics3.js +341 -0
- package/src/math/Triangle.d.ts +110 -0
- package/src/math/Triangle.js +538 -0
- package/src/math/Vector2.d.ts +321 -0
- package/src/math/Vector2.js +870 -0
- package/src/math/Vector3.d.ts +301 -0
- package/src/math/Vector3.js +1263 -0
- package/src/math/Vector4.d.ts +241 -0
- package/src/math/Vector4.js +1063 -0
- package/src/math/interpolants/BezierInterpolant.d.ts +23 -0
- package/src/math/interpolants/BezierInterpolant.js +119 -0
- package/src/math/interpolants/CubicInterpolant.d.ts +22 -0
- package/src/math/interpolants/CubicInterpolant.js +159 -0
- package/src/math/interpolants/DiscreteInterpolant.d.ts +12 -0
- package/src/math/interpolants/DiscreteInterpolant.js +34 -0
- package/src/math/interpolants/LinearInterpolant.d.ts +11 -0
- package/src/math/interpolants/LinearInterpolant.js +51 -0
- package/src/math/interpolants/QuaternionLinearInterpolant.d.ts +11 -0
- package/src/math/interpolants/QuaternionLinearInterpolant.js +48 -0
- package/src/nodes/Nodes.d.ts +170 -0
- package/src/nodes/Nodes.js +166 -0
- package/src/nodes/TSL.d.ts +183 -0
- package/src/nodes/TSL.js +185 -0
- package/src/nodes/accessors/AccessorsUtils.d.ts +8 -0
- package/src/nodes/accessors/AccessorsUtils.js +53 -0
- package/src/nodes/accessors/Arrays.d.ts +22 -0
- package/src/nodes/accessors/Arrays.js +68 -0
- package/src/nodes/accessors/Batch.d.ts +25 -0
- package/src/nodes/accessors/Batch.js +186 -0
- package/src/nodes/accessors/Bitangent.d.ts +6 -0
- package/src/nodes/accessors/Bitangent.js +82 -0
- package/src/nodes/accessors/BufferAttributeNode.d.ts +247 -0
- package/src/nodes/accessors/BufferAttributeNode.js +472 -0
- package/src/nodes/accessors/BufferNode.d.ts +33 -0
- package/src/nodes/accessors/BufferNode.js +138 -0
- package/src/nodes/accessors/BuiltinNode.d.ts +13 -0
- package/src/nodes/accessors/BuiltinNode.js +69 -0
- package/src/nodes/accessors/Camera.d.ts +16 -0
- package/src/nodes/accessors/Camera.js +410 -0
- package/src/nodes/accessors/ClippingNode.d.ts +19 -0
- package/src/nodes/accessors/ClippingNode.js +266 -0
- package/src/nodes/accessors/CubeTextureNode.d.ts +38 -0
- package/src/nodes/accessors/CubeTextureNode.js +203 -0
- package/src/nodes/accessors/Instance.d.ts +32 -0
- package/src/nodes/accessors/Instance.js +387 -0
- package/src/nodes/accessors/Lights.d.ts +17 -0
- package/src/nodes/accessors/Lights.js +152 -0
- package/src/nodes/accessors/MaterialNode.d.ts +134 -0
- package/src/nodes/accessors/MaterialNode.js +837 -0
- package/src/nodes/accessors/MaterialProperties.d.ts +8 -0
- package/src/nodes/accessors/MaterialProperties.js +57 -0
- package/src/nodes/accessors/MaterialReferenceNode.d.ts +15 -0
- package/src/nodes/accessors/MaterialReferenceNode.js +84 -0
- package/src/nodes/accessors/ModelNode.d.ts +49 -0
- package/src/nodes/accessors/ModelNode.js +260 -0
- package/src/nodes/accessors/ModelViewProjectionNode.d.ts +3 -0
- package/src/nodes/accessors/ModelViewProjectionNode.js +13 -0
- package/src/nodes/accessors/Morph.d.ts +11 -0
- package/src/nodes/accessors/Morph.js +356 -0
- package/src/nodes/accessors/Normal.d.ts +36 -0
- package/src/nodes/accessors/Normal.js +201 -0
- package/src/nodes/accessors/Object3DNode.d.ts +42 -0
- package/src/nodes/accessors/Object3DNode.js +274 -0
- package/src/nodes/accessors/PointUVNode.d.ts +9 -0
- package/src/nodes/accessors/PointUVNode.js +61 -0
- package/src/nodes/accessors/Position.d.ts +11 -0
- package/src/nodes/accessors/Position.js +126 -0
- package/src/nodes/accessors/ReferenceAttributeNode.js +279 -0
- package/src/nodes/accessors/ReferenceBaseNode.d.ts +26 -0
- package/src/nodes/accessors/ReferenceBaseNode.js +294 -0
- package/src/nodes/accessors/ReferenceElementNode.d.ts +15 -0
- package/src/nodes/accessors/ReferenceElementNode.js +72 -0
- package/src/nodes/accessors/ReferenceNode.d.ts +37 -0
- package/src/nodes/accessors/ReferenceNode.js +362 -0
- package/src/nodes/accessors/ReflectVector.d.ts +7 -0
- package/src/nodes/accessors/ReflectVector.js +36 -0
- package/src/nodes/accessors/RendererReferenceNode.d.ts +14 -0
- package/src/nodes/accessors/RendererReferenceNode.js +78 -0
- package/src/nodes/accessors/SceneProperties.d.ts +5 -0
- package/src/nodes/accessors/SceneProperties.js +47 -0
- package/src/nodes/accessors/Skinning.d.ts +23 -0
- package/src/nodes/accessors/Skinning.js +380 -0
- package/src/nodes/accessors/StorageBufferNode.d.ts +82 -0
- package/src/nodes/accessors/StorageBufferNode.js +396 -0
- package/src/nodes/accessors/StorageTexture3DNode.d.ts +17 -0
- package/src/nodes/accessors/StorageTexture3DNode.js +100 -0
- package/src/nodes/accessors/StorageTextureNode.d.ts +47 -0
- package/src/nodes/accessors/StorageTextureNode.js +331 -0
- package/src/nodes/accessors/Tangent.d.ts +6 -0
- package/src/nodes/accessors/Tangent.js +60 -0
- package/src/nodes/accessors/TangentUtils.d.ts +21 -0
- package/src/nodes/accessors/TangentUtils.js +46 -0
- package/src/nodes/accessors/Texture3DNode.d.ts +29 -0
- package/src/nodes/accessors/Texture3DNode.js +196 -0
- package/src/nodes/accessors/TextureBicubic.d.ts +6 -0
- package/src/nodes/accessors/TextureBicubic.js +95 -0
- package/src/nodes/accessors/TextureNode.d.ts +104 -0
- package/src/nodes/accessors/TextureNode.js +1142 -0
- package/src/nodes/accessors/TextureSizeNode.d.ts +17 -0
- package/src/nodes/accessors/TextureSizeNode.js +85 -0
- package/src/nodes/accessors/UV.d.ts +3 -0
- package/src/nodes/accessors/UV.js +11 -0
- package/src/nodes/accessors/UniformArrayNode.d.ts +29 -0
- package/src/nodes/accessors/UniformArrayNode.js +368 -0
- package/src/nodes/accessors/UserDataNode.d.ts +14 -0
- package/src/nodes/accessors/UserDataNode.js +76 -0
- package/src/nodes/accessors/VelocityNode.d.ts +19 -0
- package/src/nodes/accessors/VelocityNode.js +229 -0
- package/src/nodes/accessors/VertexColorNode.d.ts +11 -0
- package/src/nodes/accessors/VertexColorNode.js +109 -0
- package/src/nodes/code/CodeNode.d.ts +22 -0
- package/src/nodes/code/CodeNode.js +187 -0
- package/src/nodes/code/ExpressionNode.d.ts +9 -0
- package/src/nodes/code/ExpressionNode.js +74 -0
- package/src/nodes/code/FunctionCallNode.d.ts +27 -0
- package/src/nodes/code/FunctionCallNode.js +187 -0
- package/src/nodes/code/FunctionNode.d.ts +40 -0
- package/src/nodes/code/FunctionNode.js +180 -0
- package/src/nodes/core/ArrayNode.d.ts +33 -0
- package/src/nodes/core/ArrayNode.js +174 -0
- package/src/nodes/core/AssignNode.d.ts +15 -0
- package/src/nodes/core/AssignNode.js +203 -0
- package/src/nodes/core/AttributeNode.d.ts +21 -0
- package/src/nodes/core/AttributeNode.js +207 -0
- package/src/nodes/core/BypassNode.d.ts +17 -0
- package/src/nodes/core/BypassNode.js +99 -0
- package/src/nodes/core/ConstNode.d.ts +16 -0
- package/src/nodes/core/ConstNode.js +97 -0
- package/src/nodes/core/ContextNode.d.ts +65 -0
- package/src/nodes/core/ContextNode.js +341 -0
- package/src/nodes/core/IndexNode.d.ts +33 -0
- package/src/nodes/core/IndexNode.js +236 -0
- package/src/nodes/core/InputNode.d.ts +23 -0
- package/src/nodes/core/InputNode.js +142 -0
- package/src/nodes/core/InspectorNode.d.ts +15 -0
- package/src/nodes/core/InspectorNode.js +114 -0
- package/src/nodes/core/IsolateNode.d.ts +31 -0
- package/src/nodes/core/IsolateNode.js +141 -0
- package/src/nodes/core/LightingModel.d.ts +33 -0
- package/src/nodes/core/LightingModel.js +77 -0
- package/src/nodes/core/MRTNode.d.ts +38 -0
- package/src/nodes/core/MRTNode.js +243 -0
- package/src/nodes/core/Node.d.ts +622 -0
- package/src/nodes/core/Node.js +1520 -0
- package/src/nodes/core/NodeAttribute.d.ts +47 -0
- package/src/nodes/core/NodeAttribute.js +53 -0
- package/src/nodes/core/NodeBuilder.d.ts +25 -0
- package/src/nodes/core/NodeBuilder.js +3918 -0
- package/src/nodes/core/NodeCache.d.ts +50 -0
- package/src/nodes/core/NodeCache.js +75 -0
- package/src/nodes/core/NodeCode.d.ts +4 -0
- package/src/nodes/core/NodeCode.js +46 -0
- package/src/nodes/core/NodeError.d.ts +9 -0
- package/src/nodes/core/NodeError.js +28 -0
- package/src/nodes/core/NodeFrame.d.ts +36 -0
- package/src/nodes/core/NodeFrame.js +322 -0
- package/src/nodes/core/NodeFunction.d.ts +13 -0
- package/src/nodes/core/NodeFunction.js +69 -0
- package/src/nodes/core/NodeFunctionInput.d.ts +7 -0
- package/src/nodes/core/NodeFunctionInput.js +61 -0
- package/src/nodes/core/NodeParser.d.ts +18 -0
- package/src/nodes/core/NodeParser.js +23 -0
- package/src/nodes/core/NodeUniform.d.ts +66 -0
- package/src/nodes/core/NodeUniform.js +91 -0
- package/src/nodes/core/NodeUtils.d.ts +26 -0
- package/src/nodes/core/NodeUtils.js +521 -0
- package/src/nodes/core/NodeVar.d.ts +51 -0
- package/src/nodes/core/NodeVar.js +69 -0
- package/src/nodes/core/NodeVarying.d.ts +59 -0
- package/src/nodes/core/NodeVarying.js +63 -0
- package/src/nodes/core/OutputStructNode.d.ts +11 -0
- package/src/nodes/core/OutputStructNode.js +111 -0
- package/src/nodes/core/OverrideContextNode.d.ts +92 -0
- package/src/nodes/core/OverrideContextNode.js +154 -0
- package/src/nodes/core/ParameterNode.d.ts +18 -0
- package/src/nodes/core/ParameterNode.js +94 -0
- package/src/nodes/core/PropertyNode.d.ts +66 -0
- package/src/nodes/core/PropertyNode.js +435 -0
- package/src/nodes/core/StackNode.d.ts +25 -0
- package/src/nodes/core/StackNode.js +459 -0
- package/src/nodes/core/StackTrace.d.ts +9 -0
- package/src/nodes/core/StackTrace.js +139 -0
- package/src/nodes/core/StructNode.d.ts +37 -0
- package/src/nodes/core/StructNode.js +139 -0
- package/src/nodes/core/StructType.d.ts +10 -0
- package/src/nodes/core/StructType.js +13 -0
- package/src/nodes/core/StructTypeNode.d.ts +57 -0
- package/src/nodes/core/StructTypeNode.js +154 -0
- package/src/nodes/core/SubBuildNode.d.ts +14 -0
- package/src/nodes/core/SubBuildNode.js +97 -0
- package/src/nodes/core/TempNode.d.ts +16 -0
- package/src/nodes/core/TempNode.js +63 -0
- package/src/nodes/core/UniformGroupNode.d.ts +22 -0
- package/src/nodes/core/UniformGroupNode.js +174 -0
- package/src/nodes/core/UniformNode.d.ts +162 -0
- package/src/nodes/core/UniformNode.js +273 -0
- package/src/nodes/core/VarNode.d.ts +45 -0
- package/src/nodes/core/VarNode.js +282 -0
- package/src/nodes/core/VaryingNode.d.ts +36 -0
- package/src/nodes/core/VaryingNode.js +251 -0
- package/src/nodes/core/constants.d.ts +72 -0
- package/src/nodes/core/constants.js +68 -0
- package/src/nodes/display/BlendModes.d.ts +76 -0
- package/src/nodes/display/BlendModes.js +96 -0
- package/src/nodes/display/BumpMapNode.d.ts +16 -0
- package/src/nodes/display/BumpMapNode.js +132 -0
- package/src/nodes/display/ColorAdjustment.d.ts +54 -0
- package/src/nodes/display/ColorAdjustment.js +171 -0
- package/src/nodes/display/ColorSpaceFunctions.d.ts +5 -0
- package/src/nodes/display/ColorSpaceFunctions.js +42 -0
- package/src/nodes/display/ColorSpaceNode.d.ts +54 -0
- package/src/nodes/display/ColorSpaceNode.js +164 -0
- package/src/nodes/display/FrontFacingNode.d.ts +71 -0
- package/src/nodes/display/FrontFacingNode.js +137 -0
- package/src/nodes/display/NormalMapNode.d.ts +18 -0
- package/src/nodes/display/NormalMapNode.js +153 -0
- package/src/nodes/display/PassNode.d.ts +124 -0
- package/src/nodes/display/PassNode.js +1167 -0
- package/src/nodes/display/PremultiplyAlphaFunctions.d.ts +37 -0
- package/src/nodes/display/PremultiplyAlphaFunctions.js +39 -0
- package/src/nodes/display/RenderOutputNode.d.ts +29 -0
- package/src/nodes/display/RenderOutputNode.js +176 -0
- package/src/nodes/display/ScreenNode.d.ts +44 -0
- package/src/nodes/display/ScreenNode.js +255 -0
- package/src/nodes/display/ToneMappingFunctions.d.ts +13 -0
- package/src/nodes/display/ToneMappingFunctions.js +200 -0
- package/src/nodes/display/ToneMappingNode.d.ts +29 -0
- package/src/nodes/display/ToneMappingNode.js +147 -0
- package/src/nodes/display/ToonOutlinePassNode.d.ts +23 -0
- package/src/nodes/display/ToonOutlinePassNode.js +255 -0
- package/src/nodes/display/ViewportDepthNode.d.ts +41 -0
- package/src/nodes/display/ViewportDepthNode.js +372 -0
- package/src/nodes/display/ViewportDepthTextureNode.d.ts +14 -0
- package/src/nodes/display/ViewportDepthTextureNode.js +63 -0
- package/src/nodes/display/ViewportSharedTextureNode.d.ts +16 -0
- package/src/nodes/display/ViewportSharedTextureNode.js +73 -0
- package/src/nodes/display/ViewportTextureNode.d.ts +33 -0
- package/src/nodes/display/ViewportTextureNode.js +256 -0
- package/src/nodes/fog/Fog.d.ts +27 -0
- package/src/nodes/fog/Fog.js +97 -0
- package/src/nodes/functions/BSDF/BRDF_EON.js +65 -0
- package/src/nodes/functions/BSDF/BRDF_GGX.d.ts +15 -0
- package/src/nodes/functions/BSDF/BRDF_GGX.js +57 -0
- package/src/nodes/functions/BSDF/BRDF_Lambert.d.ts +6 -0
- package/src/nodes/functions/BSDF/BRDF_Lambert.js +9 -0
- package/src/nodes/functions/BSDF/BRDF_Sheen.d.ts +6 -0
- package/src/nodes/functions/BSDF/BRDF_Sheen.js +43 -0
- package/src/nodes/functions/BSDF/DFGLUT.d.ts +13 -0
- package/src/nodes/functions/BSDF/DFGLUT.js +57 -0
- package/src/nodes/functions/BSDF/D_GGX.d.ts +9 -0
- package/src/nodes/functions/BSDF/D_GGX.js +16 -0
- package/src/nodes/functions/BSDF/D_GGX_Anisotropic.d.ts +9 -0
- package/src/nodes/functions/BSDF/D_GGX_Anisotropic.js +25 -0
- package/src/nodes/functions/BSDF/EnvironmentBRDF.d.ts +8 -0
- package/src/nodes/functions/BSDF/EnvironmentBRDF.js +13 -0
- package/src/nodes/functions/BSDF/F_Schlick.d.ts +6 -0
- package/src/nodes/functions/BSDF/F_Schlick.js +16 -0
- package/src/nodes/functions/BSDF/LTC.d.ts +13 -0
- package/src/nodes/functions/BSDF/LTC.js +148 -0
- package/src/nodes/functions/BSDF/Schlick_to_F0.d.ts +9 -0
- package/src/nodes/functions/BSDF/Schlick_to_F0.js +13 -0
- package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated.d.ts +10 -0
- package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated.js +18 -0
- package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.d.ts +15 -0
- package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.js +26 -0
- package/src/nodes/functions/BasicLightingModel.d.ts +7 -0
- package/src/nodes/functions/BasicLightingModel.js +100 -0
- package/src/nodes/functions/PhongLightingModel.d.ts +7 -0
- package/src/nodes/functions/PhongLightingModel.js +99 -0
- package/src/nodes/functions/PhysicalLightingModel.d.ts +40 -0
- package/src/nodes/functions/PhysicalLightingModel.js +969 -0
- package/src/nodes/functions/ShadowMaskModel.d.ts +8 -0
- package/src/nodes/functions/ShadowMaskModel.js +58 -0
- package/src/nodes/functions/ToonLightingModel.d.ts +4 -0
- package/src/nodes/functions/ToonLightingModel.js +70 -0
- package/src/nodes/functions/VolumetricLightingModel.d.ts +6 -0
- package/src/nodes/functions/VolumetricLightingModel.js +216 -0
- package/src/nodes/functions/material/getAlphaHashThreshold.d.ts +5 -0
- package/src/nodes/functions/material/getAlphaHashThreshold.js +62 -0
- package/src/nodes/functions/material/getGeometryRoughness.d.ts +5 -0
- package/src/nodes/functions/material/getGeometryRoughness.js +19 -0
- package/src/nodes/functions/material/getParallaxCorrectNormal.d.ts +9 -0
- package/src/nodes/functions/material/getParallaxCorrectNormal.js +36 -0
- package/src/nodes/functions/material/getRoughness.d.ts +6 -0
- package/src/nodes/functions/material/getRoughness.js +20 -0
- package/src/nodes/functions/material/getShIrradianceAt.d.ts +5 -0
- package/src/nodes/functions/material/getShIrradianceAt.js +28 -0
- package/src/nodes/geometry/RangeNode.d.ts +62 -0
- package/src/nodes/geometry/RangeNode.js +193 -0
- package/src/nodes/gpgpu/AtomicFunctionNode.d.ts +91 -0
- package/src/nodes/gpgpu/AtomicFunctionNode.js +330 -0
- package/src/nodes/gpgpu/BarrierNode.d.ts +15 -0
- package/src/nodes/gpgpu/BarrierNode.js +113 -0
- package/src/nodes/gpgpu/ComputeBuiltinNode.d.ts +22 -0
- package/src/nodes/gpgpu/ComputeBuiltinNode.js +233 -0
- package/src/nodes/gpgpu/ComputeNode.d.ts +50 -0
- package/src/nodes/gpgpu/ComputeNode.js +319 -0
- package/src/nodes/gpgpu/SubgroupFunctionNode.d.ts +99 -0
- package/src/nodes/gpgpu/SubgroupFunctionNode.js +592 -0
- package/src/nodes/gpgpu/WorkgroupInfoNode.d.ts +24 -0
- package/src/nodes/gpgpu/WorkgroupInfoNode.js +278 -0
- package/src/nodes/lighting/AONode.d.ts +8 -0
- package/src/nodes/lighting/AONode.js +45 -0
- package/src/nodes/lighting/AmbientLightNode.d.ts +8 -0
- package/src/nodes/lighting/AmbientLightNode.js +35 -0
- package/src/nodes/lighting/AnalyticLightNode.d.ts +32 -0
- package/src/nodes/lighting/AnalyticLightNode.js +302 -0
- package/src/nodes/lighting/BasicEnvironmentNode.d.ts +10 -0
- package/src/nodes/lighting/BasicEnvironmentNode.js +53 -0
- package/src/nodes/lighting/BasicLightMapNode.d.ts +8 -0
- package/src/nodes/lighting/BasicLightMapNode.js +49 -0
- package/src/nodes/lighting/DirectionalLightNode.d.ts +8 -0
- package/src/nodes/lighting/DirectionalLightNode.js +39 -0
- package/src/nodes/lighting/EnvironmentNode.d.ts +8 -0
- package/src/nodes/lighting/EnvironmentNode.js +264 -0
- package/src/nodes/lighting/HemisphereLightNode.d.ts +14 -0
- package/src/nodes/lighting/HemisphereLightNode.js +87 -0
- package/src/nodes/lighting/IESSpotLightNode.d.ts +5 -0
- package/src/nodes/lighting/IESSpotLightNode.js +102 -0
- package/src/nodes/lighting/IrradianceNode.d.ts +8 -0
- package/src/nodes/lighting/IrradianceNode.js +44 -0
- package/src/nodes/lighting/LightProbeNode.d.ts +11 -0
- package/src/nodes/lighting/LightProbeNode.js +74 -0
- package/src/nodes/lighting/LightUtils.d.ts +8 -0
- package/src/nodes/lighting/LightUtils.js +25 -0
- package/src/nodes/lighting/LightingContextNode.d.ts +41 -0
- package/src/nodes/lighting/LightingContextNode.js +123 -0
- package/src/nodes/lighting/LightingNode.d.ts +7 -0
- package/src/nodes/lighting/LightingNode.js +42 -0
- package/src/nodes/lighting/LightsNode.d.ts +48 -0
- package/src/nodes/lighting/LightsNode.js +495 -0
- package/src/nodes/lighting/PointLightNode.d.ts +23 -0
- package/src/nodes/lighting/PointLightNode.js +102 -0
- package/src/nodes/lighting/PointShadowNode.d.ts +25 -0
- package/src/nodes/lighting/PointShadowNode.js +374 -0
- package/src/nodes/lighting/ProjectorLightNode.d.ts +5 -0
- package/src/nodes/lighting/ProjectorLightNode.js +91 -0
- package/src/nodes/lighting/RectAreaLightNode.d.ts +21 -0
- package/src/nodes/lighting/RectAreaLightNode.js +132 -0
- package/src/nodes/lighting/ShadowBaseNode.d.ts +47 -0
- package/src/nodes/lighting/ShadowBaseNode.js +230 -0
- package/src/nodes/lighting/ShadowFilterNode.d.ts +17 -0
- package/src/nodes/lighting/ShadowFilterNode.js +152 -0
- package/src/nodes/lighting/ShadowNode.d.ts +11 -0
- package/src/nodes/lighting/ShadowNode.js +843 -0
- package/src/nodes/lighting/SpotLightNode.d.ts +22 -0
- package/src/nodes/lighting/SpotLightNode.js +168 -0
- package/src/nodes/materialx/DISCLAIMER.md +199 -0
- package/src/nodes/materialx/MaterialXColor.d.ts +5 -0
- package/src/nodes/materialx/MaterialXColor.js +112 -0
- package/src/nodes/materialx/MaterialXColorTransform.d.ts +3 -0
- package/src/nodes/materialx/MaterialXColorTransform.js +14 -0
- package/src/nodes/materialx/MaterialXCore.d.ts +5 -0
- package/src/nodes/materialx/MaterialXCore.js +37 -0
- package/src/nodes/materialx/MaterialXNodes.d.ts +206 -0
- package/src/nodes/materialx/MaterialXNodes.js +186 -0
- package/src/nodes/materialx/MaterialXNoise.d.ts +415 -0
- package/src/nodes/materialx/MaterialXNoise.js +1461 -0
- package/src/nodes/math/BitcastNode.d.ts +24 -0
- package/src/nodes/math/BitcastNode.js +156 -0
- package/src/nodes/math/BitcountNode.d.ts +23 -0
- package/src/nodes/math/BitcountNode.js +425 -0
- package/src/nodes/math/ConditionalNode.d.ts +51 -0
- package/src/nodes/math/ConditionalNode.js +315 -0
- package/src/nodes/math/Hash.d.ts +3 -0
- package/src/nodes/math/Hash.js +21 -0
- package/src/nodes/math/MathNode.d.ts +895 -0
- package/src/nodes/math/MathNode.js +1252 -0
- package/src/nodes/math/MathUtils.d.ts +10 -0
- package/src/nodes/math/MathUtils.js +65 -0
- package/src/nodes/math/OperatorNode.d.ts +709 -0
- package/src/nodes/math/OperatorNode.js +735 -0
- package/src/nodes/math/PackFloatNode.d.ts +24 -0
- package/src/nodes/math/PackFloatNode.js +126 -0
- package/src/nodes/math/Packed4x8IntegerNode.d.ts +49 -0
- package/src/nodes/math/Packed4x8IntegerNode.js +401 -0
- package/src/nodes/math/TriNoise3D.d.ts +11 -0
- package/src/nodes/math/TriNoise3D.js +51 -0
- package/src/nodes/math/UnpackFloatNode.d.ts +21 -0
- package/src/nodes/math/UnpackFloatNode.js +124 -0
- package/src/nodes/parsers/GLSLNodeFunction.d.ts +9 -0
- package/src/nodes/parsers/GLSLNodeFunction.js +168 -0
- package/src/nodes/parsers/GLSLNodeParser.d.ts +8 -0
- package/src/nodes/parsers/GLSLNodeParser.js +25 -0
- package/src/nodes/pmrem/PMREMNode.d.ts +21 -0
- package/src/nodes/pmrem/PMREMNode.js +391 -0
- package/src/nodes/pmrem/PMREMUtils.d.ts +21 -0
- package/src/nodes/pmrem/PMREMUtils.js +190 -0
- package/src/nodes/procedural/Checker.d.ts +3 -0
- package/src/nodes/procedural/Checker.js +22 -0
- package/src/nodes/shapes/Shapes.d.ts +3 -0
- package/src/nodes/shapes/Shapes.js +33 -0
- package/src/nodes/tsl/TSLBase.d.ts +30 -0
- package/src/nodes/tsl/TSLBase.js +36 -0
- package/src/nodes/tsl/TSLCore.d.ts +2420 -0
- package/src/nodes/tsl/TSLCore.js +1390 -0
- package/src/nodes/utils/ArrayElementNode.d.ts +15 -0
- package/src/nodes/utils/ArrayElementNode.js +108 -0
- package/src/nodes/utils/ConvertNode.d.ts +14 -0
- package/src/nodes/utils/ConvertNode.js +100 -0
- package/src/nodes/utils/CubeMapNode.d.ts +12 -0
- package/src/nodes/utils/CubeMapNode.js +237 -0
- package/src/nodes/utils/DebugNode.d.ts +22 -0
- package/src/nodes/utils/DebugNode.js +83 -0
- package/src/nodes/utils/Discard.d.ts +10 -0
- package/src/nodes/utils/Discard.js +24 -0
- package/src/nodes/utils/EquirectUV.d.ts +33 -0
- package/src/nodes/utils/EquirectUV.js +52 -0
- package/src/nodes/utils/EventNode.d.ts +41 -0
- package/src/nodes/utils/EventNode.js +229 -0
- package/src/nodes/utils/FlipNode.d.ts +11 -0
- package/src/nodes/utils/FlipNode.js +106 -0
- package/src/nodes/utils/FunctionOverloadingNode.d.ts +12 -0
- package/src/nodes/utils/FunctionOverloadingNode.js +176 -0
- package/src/nodes/utils/JoinNode.d.ts +14 -0
- package/src/nodes/utils/JoinNode.js +117 -0
- package/src/nodes/utils/LoopNode.d.ts +43 -0
- package/src/nodes/utils/LoopNode.js +395 -0
- package/src/nodes/utils/MatcapUV.d.ts +3 -0
- package/src/nodes/utils/MatcapUV.js +22 -0
- package/src/nodes/utils/MaxMipLevelNode.d.ts +13 -0
- package/src/nodes/utils/MaxMipLevelNode.js +103 -0
- package/src/nodes/utils/MemberNode.d.ts +11 -0
- package/src/nodes/utils/MemberNode.js +138 -0
- package/src/nodes/utils/Oscillators.d.ts +6 -0
- package/src/nodes/utils/Oscillators.js +41 -0
- package/src/nodes/utils/Packing.d.ts +52 -0
- package/src/nodes/utils/Packing.js +64 -0
- package/src/nodes/utils/PostProcessingUtils.d.ts +56 -0
- package/src/nodes/utils/PostProcessingUtils.js +170 -0
- package/src/nodes/utils/RTTNode.d.ts +46 -0
- package/src/nodes/utils/RTTNode.js +372 -0
- package/src/nodes/utils/ReflectorNode.d.ts +61 -0
- package/src/nodes/utils/ReflectorNode.js +658 -0
- package/src/nodes/utils/Remap.d.ts +223 -0
- package/src/nodes/utils/Remap.js +48 -0
- package/src/nodes/utils/RotateNode.d.ts +26 -0
- package/src/nodes/utils/RotateNode.js +180 -0
- package/src/nodes/utils/SampleNode.d.ts +26 -0
- package/src/nodes/utils/SampleNode.js +97 -0
- package/src/nodes/utils/SetNode.d.ts +11 -0
- package/src/nodes/utils/SetNode.js +108 -0
- package/src/nodes/utils/SplitNode.d.ts +14 -0
- package/src/nodes/utils/SplitNode.js +185 -0
- package/src/nodes/utils/SpriteSheetUV.d.ts +7 -0
- package/src/nodes/utils/SpriteSheetUV.js +35 -0
- package/src/nodes/utils/SpriteUtils.d.ts +5 -0
- package/src/nodes/utils/SpriteUtils.js +98 -0
- package/src/nodes/utils/StorageArrayElementNode.d.ts +28 -0
- package/src/nodes/utils/StorageArrayElementNode.js +143 -0
- package/src/nodes/utils/Timer.d.ts +5 -0
- package/src/nodes/utils/Timer.js +26 -0
- package/src/nodes/utils/TriplanarTextures.d.ts +19 -0
- package/src/nodes/utils/TriplanarTextures.js +65 -0
- package/src/nodes/utils/UVUtils.d.ts +19 -0
- package/src/nodes/utils/UVUtils.js +67 -0
- package/src/nodes/utils/ViewportUtils.d.ts +3 -0
- package/src/nodes/utils/ViewportUtils.js +26 -0
- package/src/objects/BatchedMesh.d.ts +280 -0
- package/src/objects/BatchedMesh.js +1827 -0
- package/src/objects/Bone.d.ts +36 -0
- package/src/objects/Bone.js +41 -0
- package/src/objects/ClippingGroup.d.ts +41 -0
- package/src/objects/ClippingGroup.js +68 -0
- package/src/objects/Group.d.ts +37 -0
- package/src/objects/Group.js +41 -0
- package/src/objects/InstancedMesh.d.ts +175 -0
- package/src/objects/InstancedMesh.js +419 -0
- package/src/objects/LOD.d.ts +112 -0
- package/src/objects/LOD.js +329 -0
- package/src/objects/Line.d.ts +96 -0
- package/src/objects/Line.js +361 -0
- package/src/objects/LineLoop.d.ts +40 -0
- package/src/objects/LineLoop.js +37 -0
- package/src/objects/LineSegments.d.ts +41 -0
- package/src/objects/LineSegments.js +74 -0
- package/src/objects/Mesh.d.ts +111 -0
- package/src/objects/Mesh.js +516 -0
- package/src/objects/Points.d.ts +75 -0
- package/src/objects/Points.js +260 -0
- package/src/objects/Skeleton.d.ts +120 -0
- package/src/objects/Skeleton.js +409 -0
- package/src/objects/SkinnedMesh.d.ts +163 -0
- package/src/objects/SkinnedMesh.js +370 -0
- package/src/objects/Sprite.d.ts +82 -0
- package/src/objects/Sprite.js +267 -0
- package/src/renderers/WebGL3DRenderTarget.d.ts +29 -0
- package/src/renderers/WebGL3DRenderTarget.js +48 -0
- package/src/renderers/WebGLArrayRenderTarget.d.ts +29 -0
- package/src/renderers/WebGLArrayRenderTarget.js +48 -0
- package/src/renderers/WebGLCubeRenderTarget.d.ts +18 -0
- package/src/renderers/WebGLCubeRenderTarget.js +182 -0
- package/src/renderers/WebGLRenderTarget.d.ts +8 -0
- package/src/renderers/WebGLRenderTarget.js +34 -0
- package/src/renderers/WebGLRenderer.d.ts +489 -0
- package/src/renderers/WebGLRenderer.js +3803 -0
- package/src/renderers/common/Animation.js +173 -0
- package/src/renderers/common/Attributes.js +197 -0
- package/src/renderers/common/Backend.d.ts +29 -0
- package/src/renderers/common/Backend.js +916 -0
- package/src/renderers/common/Background.js +225 -0
- package/src/renderers/common/BindGroup.js +56 -0
- package/src/renderers/common/Binding.js +60 -0
- package/src/renderers/common/Bindings.js +641 -0
- package/src/renderers/common/BlendMode.d.ts +22 -0
- package/src/renderers/common/BlendMode.js +143 -0
- package/src/renderers/common/Buffer.js +136 -0
- package/src/renderers/common/BufferUtils.d.ts +28 -0
- package/src/renderers/common/BufferUtils.js +58 -0
- package/src/renderers/common/BundleGroup.d.ts +46 -0
- package/src/renderers/common/BundleGroup.js +87 -0
- package/src/renderers/common/CanvasTarget.d.ts +158 -0
- package/src/renderers/common/CanvasTarget.js +341 -0
- package/src/renderers/common/CapabilityTier.js +18 -0
- package/src/renderers/common/ChainMap.js +122 -0
- package/src/renderers/common/ClippingContext.d.ts +134 -0
- package/src/renderers/common/ClippingContext.js +291 -0
- package/src/renderers/common/Color4.d.ts +53 -0
- package/src/renderers/common/Color4.js +86 -0
- package/src/renderers/common/ComputePipeline.js +57 -0
- package/src/renderers/common/Constants.d.ts +9 -0
- package/src/renderers/common/Constants.js +10 -0
- package/src/renderers/common/CubeRenderTarget.d.ts +47 -0
- package/src/renderers/common/CubeRenderTarget.js +147 -0
- package/src/renderers/common/DataMap.js +90 -0
- package/src/renderers/common/DirectRenderPipeline.d.ts +20 -0
- package/src/renderers/common/DirectRenderPipeline.js +237 -0
- package/src/renderers/common/GPUInstanceCuller.d.ts +43 -0
- package/src/renderers/common/GPUInstanceCuller.js +372 -0
- package/src/renderers/common/GPUTimings.js +66 -0
- package/src/renderers/common/Geometries.js +523 -0
- package/src/renderers/common/IndirectStorageBufferAttribute.d.ts +10 -0
- package/src/renderers/common/IndirectStorageBufferAttribute.js +38 -0
- package/src/renderers/common/Info.d.ts +194 -0
- package/src/renderers/common/Info.js +542 -0
- package/src/renderers/common/InspectorBase.d.ts +129 -0
- package/src/renderers/common/InspectorBase.js +180 -0
- package/src/renderers/common/Lighting.d.ts +55 -0
- package/src/renderers/common/Lighting.js +171 -0
- package/src/renderers/common/Pipeline.js +35 -0
- package/src/renderers/common/Pipelines.js +514 -0
- package/src/renderers/common/PostProcessing.d.ts +21 -0
- package/src/renderers/common/PostProcessing.js +28 -0
- package/src/renderers/common/ProgrammableStage.js +62 -0
- package/src/renderers/common/QuadMesh.d.ts +19 -0
- package/src/renderers/common/QuadMesh.js +126 -0
- package/src/renderers/common/ReadbackBuffer.d.ts +63 -0
- package/src/renderers/common/ReadbackBuffer.js +78 -0
- package/src/renderers/common/RenderBundle.js +26 -0
- package/src/renderers/common/RenderBundles.js +71 -0
- package/src/renderers/common/RenderContext.js +310 -0
- package/src/renderers/common/RenderContexts.js +109 -0
- package/src/renderers/common/RenderList.js +475 -0
- package/src/renderers/common/RenderLists.js +125 -0
- package/src/renderers/common/RenderObject.js +1065 -0
- package/src/renderers/common/RenderObjectPipeline.js +40 -0
- package/src/renderers/common/RenderObjects.js +263 -0
- package/src/renderers/common/RenderPipeline.d.ts +26 -0
- package/src/renderers/common/RenderPipeline.js +263 -0
- package/src/renderers/common/Renderer.d.ts +1209 -0
- package/src/renderers/common/Renderer.js +4357 -0
- package/src/renderers/common/RendererUtils.d.ts +77 -0
- package/src/renderers/common/RendererUtils.js +215 -0
- package/src/renderers/common/SampledTexture.js +152 -0
- package/src/renderers/common/Sampler.js +133 -0
- package/src/renderers/common/StandardDrawingPipeline.js +343 -0
- package/src/renderers/common/Storage3DTexture.d.ts +42 -0
- package/src/renderers/common/Storage3DTexture.js +127 -0
- package/src/renderers/common/StorageArrayTexture.d.ts +31 -0
- package/src/renderers/common/StorageArrayTexture.js +94 -0
- package/src/renderers/common/StorageBuffer.js +53 -0
- package/src/renderers/common/StorageBufferAttribute.d.ts +7 -0
- package/src/renderers/common/StorageBufferAttribute.js +46 -0
- package/src/renderers/common/StorageInstancedBufferAttribute.d.ts +8 -0
- package/src/renderers/common/StorageInstancedBufferAttribute.js +46 -0
- package/src/renderers/common/StorageTexture.d.ts +7 -0
- package/src/renderers/common/StorageTexture.js +77 -0
- package/src/renderers/common/Textures.js +763 -0
- package/src/renderers/common/TimestampQueryPool.d.ts +120 -0
- package/src/renderers/common/TimestampQueryPool.js +173 -0
- package/src/renderers/common/Uniform.js +375 -0
- package/src/renderers/common/UniformBuffer.js +34 -0
- package/src/renderers/common/UniformsGroup.js +589 -0
- package/src/renderers/common/XRManager.d.ts +293 -0
- package/src/renderers/common/XRManager.js +1928 -0
- package/src/renderers/common/XRRenderTarget.js +91 -0
- package/src/renderers/common/extras/PMREMGenerator.d.ts +52 -0
- package/src/renderers/common/extras/PMREMGenerator.js +673 -0
- package/src/renderers/common/nodes/NodeBuilderState.js +162 -0
- package/src/renderers/common/nodes/NodeLibrary.d.ts +129 -0
- package/src/renderers/common/nodes/NodeLibrary.js +172 -0
- package/src/renderers/common/nodes/NodeManager.js +1219 -0
- package/src/renderers/common/nodes/NodeSampledTexture.js +154 -0
- package/src/renderers/common/nodes/NodeSampler.js +76 -0
- package/src/renderers/common/nodes/NodeStorageBuffer.js +74 -0
- package/src/renderers/common/nodes/NodeUniform.js +418 -0
- package/src/renderers/common/nodes/NodeUniformBuffer.js +107 -0
- package/src/renderers/common/nodes/NodeUniformsGroup.js +51 -0
- package/src/renderers/shaders/DFGLUTData.js +50 -0
- package/src/renderers/shaders/ShaderChunk/alphahash_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/alphahash_pars_fragment.glsl.js +68 -0
- package/src/renderers/shaders/ShaderChunk/alphamap_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/alphamap_pars_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/alphatest_fragment.glsl.js +16 -0
- package/src/renderers/shaders/ShaderChunk/alphatest_pars_fragment.glsl.js +5 -0
- package/src/renderers/shaders/ShaderChunk/aomap_fragment.glsl.js +26 -0
- package/src/renderers/shaders/ShaderChunk/aomap_pars_fragment.glsl.js +8 -0
- package/src/renderers/shaders/ShaderChunk/batching_pars_vertex.glsl.js +49 -0
- package/src/renderers/shaders/ShaderChunk/batching_vertex.glsl.js +5 -0
- package/src/renderers/shaders/ShaderChunk/begin_vertex.glsl.js +9 -0
- package/src/renderers/shaders/ShaderChunk/beginnormal_vertex.glsl.js +9 -0
- package/src/renderers/shaders/ShaderChunk/bsdfs.glsl.js +33 -0
- package/src/renderers/shaders/ShaderChunk/bumpmap_pars_fragment.glsl.js +43 -0
- package/src/renderers/shaders/ShaderChunk/clearcoat_normal_fragment_begin.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/clearcoat_normal_fragment_maps.glsl.js +10 -0
- package/src/renderers/shaders/ShaderChunk/clearcoat_pars_fragment.glsl.js +21 -0
- package/src/renderers/shaders/ShaderChunk/clipping_planes_fragment.glsl.js +78 -0
- package/src/renderers/shaders/ShaderChunk/clipping_planes_pars_fragment.glsl.js +9 -0
- package/src/renderers/shaders/ShaderChunk/clipping_planes_pars_vertex.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/clipping_planes_vertex.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/color_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/color_pars_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/color_pars_vertex.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/color_vertex.glsl.js +29 -0
- package/src/renderers/shaders/ShaderChunk/colorspace_fragment.glsl.js +3 -0
- package/src/renderers/shaders/ShaderChunk/colorspace_pars_fragment.glsl.js +15 -0
- package/src/renderers/shaders/ShaderChunk/common.glsl.js +134 -0
- package/src/renderers/shaders/ShaderChunk/default_fragment.glsl.js +5 -0
- package/src/renderers/shaders/ShaderChunk/default_vertex.glsl.js +5 -0
- package/src/renderers/shaders/ShaderChunk/defaultnormal_vertex.glsl.js +59 -0
- package/src/renderers/shaders/ShaderChunk/displacementmap_pars_vertex.glsl.js +9 -0
- package/src/renderers/shaders/ShaderChunk/displacementmap_vertex.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/dithering_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/dithering_pars_fragment.glsl.js +20 -0
- package/src/renderers/shaders/ShaderChunk/emissivemap_fragment.glsl.js +17 -0
- package/src/renderers/shaders/ShaderChunk/emissivemap_pars_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/envmap_common_pars_fragment.glsl.js +23 -0
- package/src/renderers/shaders/ShaderChunk/envmap_fragment.glsl.js +58 -0
- package/src/renderers/shaders/ShaderChunk/envmap_pars_fragment.glsl.js +21 -0
- package/src/renderers/shaders/ShaderChunk/envmap_pars_vertex.glsl.js +22 -0
- package/src/renderers/shaders/ShaderChunk/envmap_physical_pars_fragment.glsl.js +117 -0
- package/src/renderers/shaders/ShaderChunk/envmap_vertex.glsl.js +37 -0
- package/src/renderers/shaders/ShaderChunk/fog_fragment.glsl.js +17 -0
- package/src/renderers/shaders/ShaderChunk/fog_pars_fragment.glsl.js +19 -0
- package/src/renderers/shaders/ShaderChunk/fog_pars_vertex.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/fog_vertex.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/gradientmap_pars_fragment.glsl.js +27 -0
- package/src/renderers/shaders/ShaderChunk/iridescence_fragment.glsl.js +120 -0
- package/src/renderers/shaders/ShaderChunk/iridescence_pars_fragment.glsl.js +14 -0
- package/src/renderers/shaders/ShaderChunk/lightmap_pars_fragment.glsl.js +8 -0
- package/src/renderers/shaders/ShaderChunk/lightprobes_pars_fragment.glsl.js +92 -0
- package/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js +281 -0
- package/src/renderers/shaders/ShaderChunk/lights_fragment_end.glsl.js +19 -0
- package/src/renderers/shaders/ShaderChunk/lights_fragment_maps.glsl.js +62 -0
- package/src/renderers/shaders/ShaderChunk/lights_lambert_fragment.glsl.js +5 -0
- package/src/renderers/shaders/ShaderChunk/lights_lambert_pars_fragment.glsl.js +28 -0
- package/src/renderers/shaders/ShaderChunk/lights_pars_begin.glsl.js +236 -0
- package/src/renderers/shaders/ShaderChunk/lights_phong_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/lights_phong_pars_fragment.glsl.js +32 -0
- package/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js +183 -0
- package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +757 -0
- package/src/renderers/shaders/ShaderChunk/lights_toon_fragment.glsl.js +4 -0
- package/src/renderers/shaders/ShaderChunk/lights_toon_pars_fragment.glsl.js +26 -0
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_fragment.glsl.js +9 -0
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_fragment.glsl.js +9 -0
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_vertex.glsl.js +8 -0
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_vertex.glsl.js +8 -0
- package/src/renderers/shaders/ShaderChunk/map_fragment.glsl.js +17 -0
- package/src/renderers/shaders/ShaderChunk/map_pars_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/map_particle_fragment.glsl.js +27 -0
- package/src/renderers/shaders/ShaderChunk/map_particle_pars_fragment.glsl.js +27 -0
- package/src/renderers/shaders/ShaderChunk/metalnessmap_fragment.glsl.js +12 -0
- package/src/renderers/shaders/ShaderChunk/metalnessmap_pars_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/morphcolor_vertex.glsl.js +33 -0
- package/src/renderers/shaders/ShaderChunk/morphinstance_vertex.glsl.js +14 -0
- package/src/renderers/shaders/ShaderChunk/morphnormal_vertex.glsl.js +16 -0
- package/src/renderers/shaders/ShaderChunk/morphtarget_pars_vertex.glsl.js +26 -0
- package/src/renderers/shaders/ShaderChunk/morphtarget_vertex.glsl.js +16 -0
- package/src/renderers/shaders/ShaderChunk/normal_fragment_begin.glsl.js +76 -0
- package/src/renderers/shaders/ShaderChunk/normal_fragment_maps.glsl.js +40 -0
- package/src/renderers/shaders/ShaderChunk/normal_pars_fragment.glsl.js +14 -0
- package/src/renderers/shaders/ShaderChunk/normal_pars_vertex.glsl.js +14 -0
- package/src/renderers/shaders/ShaderChunk/normal_vertex.glsl.js +20 -0
- package/src/renderers/shaders/ShaderChunk/normalmap_pars_fragment.glsl.js +43 -0
- package/src/renderers/shaders/ShaderChunk/opaque_fragment.glsl.js +11 -0
- package/src/renderers/shaders/ShaderChunk/packing.glsl.js +116 -0
- package/src/renderers/shaders/ShaderChunk/premultiplied_alpha_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/project_vertex.glsl.js +19 -0
- package/src/renderers/shaders/ShaderChunk/roughnessmap_fragment.glsl.js +12 -0
- package/src/renderers/shaders/ShaderChunk/roughnessmap_pars_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.js +474 -0
- package/src/renderers/shaders/ShaderChunk/shadowmap_pars_vertex.glsl.js +80 -0
- package/src/renderers/shaders/ShaderChunk/shadowmap_vertex.glsl.js +85 -0
- package/src/renderers/shaders/ShaderChunk/shadowmask_pars_fragment.glsl.js +81 -0
- package/src/renderers/shaders/ShaderChunk/skinbase_vertex.glsl.js +10 -0
- package/src/renderers/shaders/ShaderChunk/skinning_pars_vertex.glsl.js +25 -0
- package/src/renderers/shaders/ShaderChunk/skinning_vertex.glsl.js +15 -0
- package/src/renderers/shaders/ShaderChunk/skinnormal_vertex.glsl.js +20 -0
- package/src/renderers/shaders/ShaderChunk/specularmap_fragment.glsl.js +14 -0
- package/src/renderers/shaders/ShaderChunk/specularmap_pars_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/tonemapping_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.js +200 -0
- package/src/renderers/shaders/ShaderChunk/transmission_fragment.glsl.js +36 -0
- package/src/renderers/shaders/ShaderChunk/transmission_pars_fragment.glsl.js +235 -0
- package/src/renderers/shaders/ShaderChunk/uv_pars_fragment.glsl.js +124 -0
- package/src/renderers/shaders/ShaderChunk/uv_pars_vertex.glsl.js +151 -0
- package/src/renderers/shaders/ShaderChunk/uv_vertex.glsl.js +127 -0
- package/src/renderers/shaders/ShaderChunk/worldpos_vertex.glsl.js +21 -0
- package/src/renderers/shaders/ShaderChunk.d.ts +144 -0
- package/src/renderers/shaders/ShaderChunk.js +270 -0
- package/src/renderers/shaders/ShaderLib/background.glsl.js +40 -0
- package/src/renderers/shaders/ShaderLib/backgroundCube.glsl.js +48 -0
- package/src/renderers/shaders/ShaderLib/cube.glsl.js +36 -0
- package/src/renderers/shaders/ShaderLib/depth.glsl.js +117 -0
- package/src/renderers/shaders/ShaderLib/distance.glsl.js +77 -0
- package/src/renderers/shaders/ShaderLib/equirect.glsl.js +35 -0
- package/src/renderers/shaders/ShaderLib/linedashed.glsl.js +76 -0
- package/src/renderers/shaders/ShaderLib/meshbasic.glsl.js +116 -0
- package/src/renderers/shaders/ShaderLib/meshlambert.glsl.js +125 -0
- package/src/renderers/shaders/ShaderLib/meshmatcap.glsl.js +112 -0
- package/src/renderers/shaders/ShaderLib/meshnormal.glsl.js +86 -0
- package/src/renderers/shaders/ShaderLib/meshphong.glsl.js +127 -0
- package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +235 -0
- package/src/renderers/shaders/ShaderLib/meshtoon.glsl.js +118 -0
- package/src/renderers/shaders/ShaderLib/points.glsl.js +87 -0
- package/src/renderers/shaders/ShaderLib/shadow.glsl.js +58 -0
- package/src/renderers/shaders/ShaderLib/sprite.glsl.js +79 -0
- package/src/renderers/shaders/ShaderLib/vsm.glsl.js +51 -0
- package/src/renderers/shaders/ShaderLib.d.ts +29 -0
- package/src/renderers/shaders/ShaderLib.js +366 -0
- package/src/renderers/shaders/UniformsLib.d.ts +209 -0
- package/src/renderers/shaders/UniformsLib.js +249 -0
- package/src/renderers/shaders/UniformsUtils.d.ts +14 -0
- package/src/renderers/shaders/UniformsUtils.js +154 -0
- package/src/renderers/webgl/WebGLAnimation.js +54 -0
- package/src/renderers/webgl/WebGLAttributes.d.ts +23 -0
- package/src/renderers/webgl/WebGLAttributes.js +237 -0
- package/src/renderers/webgl/WebGLBackground.js +303 -0
- package/src/renderers/webgl/WebGLBindingStates.d.ts +26 -0
- package/src/renderers/webgl/WebGLBindingStates.js +668 -0
- package/src/renderers/webgl/WebGLBufferRenderer.d.ts +15 -0
- package/src/renderers/webgl/WebGLBufferRenderer.js +57 -0
- package/src/renderers/webgl/WebGLCapabilities.d.ts +48 -0
- package/src/renderers/webgl/WebGLCapabilities.js +156 -0
- package/src/renderers/webgl/WebGLClipping.d.ts +26 -0
- package/src/renderers/webgl/WebGLClipping.js +171 -0
- package/src/renderers/webgl/WebGLEnvironments.d.ts +8 -0
- package/src/renderers/webgl/WebGLEnvironments.js +228 -0
- package/src/renderers/webgl/WebGLExtensions.d.ts +7 -0
- package/src/renderers/webgl/WebGLExtensions.js +61 -0
- package/src/renderers/webgl/WebGLGeometries.d.ts +13 -0
- package/src/renderers/webgl/WebGLGeometries.js +214 -0
- package/src/renderers/webgl/WebGLIndexedBufferRenderer.d.ts +13 -0
- package/src/renderers/webgl/WebGLIndexedBufferRenderer.js +68 -0
- package/src/renderers/webgl/WebGLInfo.d.ts +39 -0
- package/src/renderers/webgl/WebGLInfo.js +73 -0
- package/src/renderers/webgl/WebGLLights.d.ts +57 -0
- package/src/renderers/webgl/WebGLLights.js +654 -0
- package/src/renderers/webgl/WebGLMaterials.js +621 -0
- package/src/renderers/webgl/WebGLMorphtargets.js +168 -0
- package/src/renderers/webgl/WebGLObjects.d.ts +19 -0
- package/src/renderers/webgl/WebGLObjects.js +94 -0
- package/src/renderers/webgl/WebGLOutput.js +319 -0
- package/src/renderers/webgl/WebGLProgram.d.ts +22 -0
- package/src/renderers/webgl/WebGLProgram.js +994 -0
- package/src/renderers/webgl/WebGLPrograms.d.ts +242 -0
- package/src/renderers/webgl/WebGLPrograms.js +708 -0
- package/src/renderers/webgl/WebGLProperties.d.ts +9 -0
- package/src/renderers/webgl/WebGLProperties.js +55 -0
- package/src/renderers/webgl/WebGLRenderLists.d.ts +68 -0
- package/src/renderers/webgl/WebGLRenderLists.js +257 -0
- package/src/renderers/webgl/WebGLRenderStates.js +127 -0
- package/src/renderers/webgl/WebGLShader.d.ts +1 -0
- package/src/renderers/webgl/WebGLShader.js +12 -0
- package/src/renderers/webgl/WebGLShaderCache.js +118 -0
- package/src/renderers/webgl/WebGLShadowMap.d.ts +33 -0
- package/src/renderers/webgl/WebGLShadowMap.js +613 -0
- package/src/renderers/webgl/WebGLState.d.ts +399 -0
- package/src/renderers/webgl/WebGLState.js +1374 -0
- package/src/renderers/webgl/WebGLTextures.d.ts +31 -0
- package/src/renderers/webgl/WebGLTextures.js +2571 -0
- package/src/renderers/webgl/WebGLUniforms.d.ts +5 -0
- package/src/renderers/webgl/WebGLUniforms.js +1241 -0
- package/src/renderers/webgl/WebGLUniformsGroups.d.ts +17 -0
- package/src/renderers/webgl/WebGLUniformsGroups.js +447 -0
- package/src/renderers/webgl/WebGLUtils.d.ts +11 -0
- package/src/renderers/webgl/WebGLUtils.js +217 -0
- package/src/renderers/webgl-fallback/WebGLBackend.d.ts +16 -0
- package/src/renderers/webgl-fallback/WebGLBackend.js +2878 -0
- package/src/renderers/webgl-fallback/WebGLBufferRenderer.js +99 -0
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.d.ts +9 -0
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +1994 -0
- package/src/renderers/webgl-fallback/utils/WebGLAttributeUtils.js +362 -0
- package/src/renderers/webgl-fallback/utils/WebGLCapabilities.d.ts +51 -0
- package/src/renderers/webgl-fallback/utils/WebGLCapabilities.js +105 -0
- package/src/renderers/webgl-fallback/utils/WebGLConstants.js +13 -0
- package/src/renderers/webgl-fallback/utils/WebGLExtensions.js +83 -0
- package/src/renderers/webgl-fallback/utils/WebGLState.js +1532 -0
- package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +1461 -0
- package/src/renderers/webgl-fallback/utils/WebGLTimestampQueryPool.js +406 -0
- package/src/renderers/webgl-fallback/utils/WebGLUtils.js +319 -0
- package/src/renderers/webgl-fallback/utils/WebGLVertexArrayUtils.js +346 -0
- package/src/renderers/webgpu/WebGPUBackend.d.ts +32 -0
- package/src/renderers/webgpu/WebGPUBackend.js +3379 -0
- package/src/renderers/webgpu/WebGPURenderer.Nodes.d.ts +12 -0
- package/src/renderers/webgpu/WebGPURenderer.Nodes.js +69 -0
- package/src/renderers/webgpu/WebGPURenderer.d.ts +17 -0
- package/src/renderers/webgpu/WebGPURenderer.js +107 -0
- package/src/renderers/webgpu/descriptors/GPUBindGroupDescriptor.js +48 -0
- package/src/renderers/webgpu/descriptors/GPUBufferDescriptor.js +57 -0
- package/src/renderers/webgpu/descriptors/GPUCommandEncoderDescriptor.js +30 -0
- package/src/renderers/webgpu/descriptors/GPUComputePassDescriptor.js +38 -0
- package/src/renderers/webgpu/descriptors/GPUComputePipelineDescriptor.js +48 -0
- package/src/renderers/webgpu/descriptors/GPUCopyExternalImageDestInfo.js +47 -0
- package/src/renderers/webgpu/descriptors/GPUCopyExternalImageSourceInfo.js +50 -0
- package/src/renderers/webgpu/descriptors/GPUExtent3D.js +51 -0
- package/src/renderers/webgpu/descriptors/GPUPipelineLayoutDescriptor.js +39 -0
- package/src/renderers/webgpu/descriptors/GPUQuerySetDescriptor.js +47 -0
- package/src/renderers/webgpu/descriptors/GPURenderBundleEncoderDescriptor.js +74 -0
- package/src/renderers/webgpu/descriptors/GPURenderPassColorAttachment.js +72 -0
- package/src/renderers/webgpu/descriptors/GPURenderPassDepthStencilAttachment.js +99 -0
- package/src/renderers/webgpu/descriptors/GPURenderPassDescriptor.js +72 -0
- package/src/renderers/webgpu/descriptors/GPURenderPassTimestampWrites.js +49 -0
- package/src/renderers/webgpu/descriptors/GPURenderPipelineDescriptor.js +130 -0
- package/src/renderers/webgpu/descriptors/GPUSamplerDescriptor.js +119 -0
- package/src/renderers/webgpu/descriptors/GPUShaderModuleDescriptor.js +46 -0
- package/src/renderers/webgpu/descriptors/GPUTexelCopyBufferInfo.js +57 -0
- package/src/renderers/webgpu/descriptors/GPUTexelCopyBufferLayout.js +48 -0
- package/src/renderers/webgpu/descriptors/GPUTexelCopyTextureInfo.js +61 -0
- package/src/renderers/webgpu/descriptors/GPUTextureDescriptor.js +99 -0
- package/src/renderers/webgpu/descriptors/GPUTextureViewDescriptor.js +108 -0
- package/src/renderers/webgpu/nodes/BasicNodeLibrary.d.ts +13 -0
- package/src/renderers/webgpu/nodes/BasicNodeLibrary.js +66 -0
- package/src/renderers/webgpu/nodes/StandardNodeLibrary.d.ts +91 -0
- package/src/renderers/webgpu/nodes/StandardNodeLibrary.js +99 -0
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.d.ts +9 -0
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +2834 -0
- package/src/renderers/webgpu/nodes/WGSLNodeFunction.js +188 -0
- package/src/renderers/webgpu/nodes/WGSLNodeParser.js +25 -0
- package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +646 -0
- package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +683 -0
- package/src/renderers/webgpu/utils/WebGPUCapabilities.js +149 -0
- package/src/renderers/webgpu/utils/WebGPUConstants.d.ts +348 -0
- package/src/renderers/webgpu/utils/WebGPUConstants.js +354 -0
- package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +1010 -0
- package/src/renderers/webgpu/utils/WebGPUTexturePassUtils.js +452 -0
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +1920 -0
- package/src/renderers/webgpu/utils/WebGPUTimestampQueryPool.js +337 -0
- package/src/renderers/webgpu/utils/WebGPUUniformArena.js +240 -0
- package/src/renderers/webgpu/utils/WebGPUUtils.js +359 -0
- package/src/renderers/webxr/WebXRController.d.ts +67 -0
- package/src/renderers/webxr/WebXRController.js +440 -0
- package/src/renderers/webxr/WebXRDepthSensing.d.ts +21 -0
- package/src/renderers/webxr/WebXRDepthSensing.js +155 -0
- package/src/renderers/webxr/WebXRManager.d.ts +89 -0
- package/src/renderers/webxr/WebXRManager.js +1041 -0
- package/src/scenes/Fog.d.ts +71 -0
- package/src/scenes/Fog.js +98 -0
- package/src/scenes/FogExp2.d.ts +61 -0
- package/src/scenes/FogExp2.js +86 -0
- package/src/scenes/Scene.d.ts +104 -0
- package/src/scenes/Scene.js +165 -0
- package/src/textures/CanvasTexture.d.ts +51 -0
- package/src/textures/CanvasTexture.js +45 -0
- package/src/textures/CompressedArrayTexture.d.ts +65 -0
- package/src/textures/CompressedArrayTexture.js +105 -0
- package/src/textures/CompressedCubeTexture.d.ts +13 -0
- package/src/textures/CompressedCubeTexture.js +48 -0
- package/src/textures/CompressedTexture.d.ts +92 -0
- package/src/textures/CompressedTexture.js +86 -0
- package/src/textures/CubeDepthTexture.d.ts +40 -0
- package/src/textures/CubeDepthTexture.js +76 -0
- package/src/textures/CubeTexture.d.ts +82 -0
- package/src/textures/CubeTexture.js +81 -0
- package/src/textures/Data3DTexture.d.ts +94 -0
- package/src/textures/Data3DTexture.js +128 -0
- package/src/textures/DataArrayTexture.d.ts +123 -0
- package/src/textures/DataArrayTexture.js +150 -0
- package/src/textures/DataTexture.d.ts +112 -0
- package/src/textures/DataTexture.js +87 -0
- package/src/textures/DepthTexture.d.ts +105 -0
- package/src/textures/DepthTexture.js +104 -0
- package/src/textures/ExternalTexture.d.ts +14 -0
- package/src/textures/ExternalTexture.js +53 -0
- package/src/textures/FramebufferTexture.d.ts +67 -0
- package/src/textures/FramebufferTexture.js +96 -0
- package/src/textures/HTMLTexture.d.ts +27 -0
- package/src/textures/HTMLTexture.js +74 -0
- package/src/textures/Texture.d.ts +565 -0
- package/src/textures/Texture.js +840 -0
- package/src/textures/TextureSource.d.ts +99 -0
- package/src/textures/TextureSource.js +261 -0
- package/src/textures/VideoFrameTexture.d.ts +27 -0
- package/src/textures/VideoFrameTexture.js +72 -0
- package/src/textures/VideoTexture.d.ts +90 -0
- package/src/textures/VideoTexture.js +127 -0
- package/src/upe.d.ts +5 -0
- package/src/upe.js +17 -0
- package/src/utils.d.ts +36 -0
- package/src/utils.js +493 -0
|
@@ -0,0 +1,3379 @@
|
|
|
1
|
+
// debugger tools
|
|
2
|
+
// import 'https://greggman.github.io/webgpu-avoid-redundant-state-setting/webgpu-check-redundant-state-setting.js';
|
|
3
|
+
|
|
4
|
+
import { GPUFeatureName, GPULoadOp, GPUStoreOp, GPUIndexFormat, GPUTextureViewDimension, GPUFeatureMap, GPUShaderStage } from './utils/WebGPUConstants.js';
|
|
5
|
+
|
|
6
|
+
import WGSLNodeBuilder from './nodes/WGSLNodeBuilder.js';
|
|
7
|
+
import Backend from '../common/Backend.js';
|
|
8
|
+
|
|
9
|
+
import WebGPUUtils, { beforeSubmit, submit } from './utils/WebGPUUtils.js';
|
|
10
|
+
import WebGPUUniformArena from './utils/WebGPUUniformArena.js';
|
|
11
|
+
import WebGPUAttributeUtils from './utils/WebGPUAttributeUtils.js';
|
|
12
|
+
import WebGPUBindingUtils from './utils/WebGPUBindingUtils.js';
|
|
13
|
+
import WebGPUCapabilities from './utils/WebGPUCapabilities.js';
|
|
14
|
+
import WebGPUPipelineUtils from './utils/WebGPUPipelineUtils.js';
|
|
15
|
+
import WebGPUTextureUtils from './utils/WebGPUTextureUtils.js';
|
|
16
|
+
|
|
17
|
+
import { WebGPUCoordinateSystem, TimestampQuery, REVISION, HalfFloatType, Compatibility, CustomBlending } from '../../constants.js';
|
|
18
|
+
import { Color } from '../../math/Color.js';
|
|
19
|
+
import WebGPUTimestampQueryPool from './utils/WebGPUTimestampQueryPool.js';
|
|
20
|
+
import { error, warnOnce } from '../../utils.js';
|
|
21
|
+
|
|
22
|
+
import GPUBufferDescriptor from './descriptors/GPUBufferDescriptor.js';
|
|
23
|
+
import GPUCommandEncoderDescriptor from './descriptors/GPUCommandEncoderDescriptor.js';
|
|
24
|
+
import GPUComputePassDescriptor from './descriptors/GPUComputePassDescriptor.js';
|
|
25
|
+
import GPUQuerySetDescriptor from './descriptors/GPUQuerySetDescriptor.js';
|
|
26
|
+
import GPUShaderModuleDescriptor from './descriptors/GPUShaderModuleDescriptor.js';
|
|
27
|
+
import GPURenderPassColorAttachment from './descriptors/GPURenderPassColorAttachment.js';
|
|
28
|
+
import GPURenderPassDepthStencilAttachment from './descriptors/GPURenderPassDepthStencilAttachment.js';
|
|
29
|
+
import GPURenderPassDescriptor from './descriptors/GPURenderPassDescriptor.js';
|
|
30
|
+
import GPURenderPassTimestampWrites from './descriptors/GPURenderPassTimestampWrites.js';
|
|
31
|
+
import GPUTexelCopyTextureInfo from './descriptors/GPUTexelCopyTextureInfo.js';
|
|
32
|
+
import GPUTextureDescriptor from './descriptors/GPUTextureDescriptor.js';
|
|
33
|
+
import GPUTextureViewDescriptor from './descriptors/GPUTextureViewDescriptor.js';
|
|
34
|
+
import GPUExtent3D from './descriptors/GPUExtent3D.js';
|
|
35
|
+
|
|
36
|
+
const _clearValue = { r: 0, g: 0, b: 0, a: 1 };
|
|
37
|
+
const _blendConstant = { r: 0, g: 0, b: 0, a: 0 };
|
|
38
|
+
const _bufferDescriptor = new GPUBufferDescriptor();
|
|
39
|
+
const _commandEncoderDescriptor = new GPUCommandEncoderDescriptor();
|
|
40
|
+
const _computePassDescriptor = new GPUComputePassDescriptor();
|
|
41
|
+
const _querySetDescriptor = new GPUQuerySetDescriptor();
|
|
42
|
+
const _shaderModuleDescriptor = new GPUShaderModuleDescriptor();
|
|
43
|
+
const _renderPassTimestampWrites = new GPURenderPassTimestampWrites();
|
|
44
|
+
const _texelCopyTextureInfoSrc = new GPUTexelCopyTextureInfo();
|
|
45
|
+
const _texelCopyTextureInfoDst = new GPUTexelCopyTextureInfo();
|
|
46
|
+
const _textureDescriptor = new GPUTextureDescriptor();
|
|
47
|
+
const _viewDescriptor = new GPUTextureViewDescriptor();
|
|
48
|
+
const _extent3D = new GPUExtent3D();
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* A backend implementation targeting WebGPU.
|
|
52
|
+
*
|
|
53
|
+
* @private
|
|
54
|
+
* @augments Backend
|
|
55
|
+
*/
|
|
56
|
+
class WebGPUBackend extends Backend {
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* WebGPUBackend options.
|
|
60
|
+
*
|
|
61
|
+
* @typedef {Object} WebGPUBackend~Options
|
|
62
|
+
* @property {boolean} [logarithmicDepthBuffer=false] - Whether logarithmic depth buffer is enabled or not.
|
|
63
|
+
* @property {boolean} [reversedDepthBuffer=false] - Whether reversed depth buffer is enabled or not.
|
|
64
|
+
* @property {boolean} [alpha=true] - Whether the default framebuffer (which represents the final contents of the canvas) should be transparent or opaque.
|
|
65
|
+
* @property {boolean} [depth=true] - Whether the default framebuffer should have a depth buffer or not.
|
|
66
|
+
* @property {boolean} [stencil=false] - Whether the default framebuffer should have a stencil buffer or not.
|
|
67
|
+
* @property {boolean} [antialias=false] - Whether MSAA as the default anti-aliasing should be enabled or not.
|
|
68
|
+
* @property {number} [samples=0] - When `antialias` is `true`, `4` samples are used by default. Set this parameter to any other integer value than 0 to overwrite the default.
|
|
69
|
+
* @property {boolean} [forceWebGL=false] - If set to `true`, the renderer uses a WebGL 2 backend no matter if WebGPU is supported or not.
|
|
70
|
+
* @property {boolean} [trackTimestamp=false] - Whether to track timestamps with a Timestamp Query API or not.
|
|
71
|
+
* @property {string} [powerPreference=undefined] - The power preference.
|
|
72
|
+
* @property {Object|string} [requiredLimits='adapter'] - The limits the device is requested with: `'adapter'` for every limit the adapter offers, `'default'` for WebGPU's defaults, or the limits to require. The request will fail if the adapter cannot provide these limits.
|
|
73
|
+
* @property {GPUDevice} [device=undefined] - If there is an existing GPU device on app level, it can be passed to the renderer as a parameter.
|
|
74
|
+
* @property {number} [outputType=undefined] - Texture type for output to canvas. By default, device's preferred format is used; other formats may incur overhead.
|
|
75
|
+
*/
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Constructs a new WebGPU backend.
|
|
79
|
+
*
|
|
80
|
+
* @param {WebGPUBackend~Options} [parameters] - The configuration parameter.
|
|
81
|
+
*/
|
|
82
|
+
constructor( parameters = {} ) {
|
|
83
|
+
|
|
84
|
+
super( parameters );
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* This flag can be used for type testing.
|
|
88
|
+
*
|
|
89
|
+
* @type {boolean}
|
|
90
|
+
* @readonly
|
|
91
|
+
* @default true
|
|
92
|
+
*/
|
|
93
|
+
this.isWebGPUBackend = true;
|
|
94
|
+
|
|
95
|
+
// some parameters require default values other than "undefined"
|
|
96
|
+
this.parameters.alpha = ( parameters.alpha === undefined ) ? true : parameters.alpha;
|
|
97
|
+
|
|
98
|
+
this.parameters.requiredLimits = ( parameters.requiredLimits === undefined ) ? 'adapter' : parameters.requiredLimits;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Indicates whether the backend is in WebGPU compatibility mode or not.
|
|
102
|
+
* The backend must be initialized before the property can be evaluated.
|
|
103
|
+
*
|
|
104
|
+
* @type {?boolean}
|
|
105
|
+
* @readonly
|
|
106
|
+
* @default null
|
|
107
|
+
*/
|
|
108
|
+
this.compatibilityMode = null;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* A reference to the device.
|
|
112
|
+
*
|
|
113
|
+
* @type {?GPUDevice}
|
|
114
|
+
* @default null
|
|
115
|
+
*/
|
|
116
|
+
/**
|
|
117
|
+
* The adapter the device was requested from, or `null` when the device was passed in.
|
|
118
|
+
*
|
|
119
|
+
* @type {?GPUAdapter}
|
|
120
|
+
* @default null
|
|
121
|
+
*/
|
|
122
|
+
this.adapter = null;
|
|
123
|
+
|
|
124
|
+
this.device = null;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* A reference to the default render pass descriptor.
|
|
128
|
+
*
|
|
129
|
+
* @type {?Object}
|
|
130
|
+
* @default null
|
|
131
|
+
*/
|
|
132
|
+
this.defaultRenderPassdescriptor = null;
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* A reference to a backend module holding common utility functions.
|
|
136
|
+
*
|
|
137
|
+
* @type {WebGPUUtils}
|
|
138
|
+
*/
|
|
139
|
+
this.utils = new WebGPUUtils( this );
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* A reference to a backend module holding shader attribute-related
|
|
143
|
+
* utility functions.
|
|
144
|
+
*
|
|
145
|
+
* @type {WebGPUAttributeUtils}
|
|
146
|
+
*/
|
|
147
|
+
this.attributeUtils = new WebGPUAttributeUtils( this );
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* A reference to a backend module holding shader binding-related
|
|
151
|
+
* utility functions.
|
|
152
|
+
*
|
|
153
|
+
* @type {WebGPUBindingUtils}
|
|
154
|
+
*/
|
|
155
|
+
this.bindingUtils = new WebGPUBindingUtils( this );
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* A reference to a backend module holding device capability related
|
|
159
|
+
* utility functions.
|
|
160
|
+
*
|
|
161
|
+
* @type {WebGPUCapabilities}
|
|
162
|
+
*/
|
|
163
|
+
this.capabilities = new WebGPUCapabilities( this );
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* A reference to a backend module holding shader pipeline-related
|
|
167
|
+
* utility functions.
|
|
168
|
+
*
|
|
169
|
+
* @type {WebGPUPipelineUtils}
|
|
170
|
+
*/
|
|
171
|
+
this.pipelineUtils = new WebGPUPipelineUtils( this );
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* A reference to a backend module holding shader texture-related
|
|
175
|
+
* utility functions.
|
|
176
|
+
*
|
|
177
|
+
* @type {WebGPUTextureUtils}
|
|
178
|
+
*/
|
|
179
|
+
this.textureUtils = new WebGPUTextureUtils( this );
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* A map that manages the resolve buffers for occlusion queries.
|
|
183
|
+
*
|
|
184
|
+
* @type {Map<number,GPUBuffer>}
|
|
185
|
+
*/
|
|
186
|
+
this.occludedResolveCache = new Map();
|
|
187
|
+
|
|
188
|
+
// compatibility checks
|
|
189
|
+
|
|
190
|
+
const compatibilityTextureCompare = typeof navigator === 'undefined' ? true : /Android/.test( navigator.userAgent ) === false;
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* A map of compatibility checks.
|
|
194
|
+
*
|
|
195
|
+
* @type {Object}
|
|
196
|
+
*/
|
|
197
|
+
this._compatibility = {
|
|
198
|
+
[ Compatibility.TEXTURE_COMPARE ]: compatibilityTextureCompare
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Initializes the backend so it is ready for usage.
|
|
205
|
+
*
|
|
206
|
+
* @async
|
|
207
|
+
* @param {Renderer} renderer - The renderer.
|
|
208
|
+
* @return {Promise} A Promise that resolves when the backend has been initialized.
|
|
209
|
+
*/
|
|
210
|
+
async init( renderer ) {
|
|
211
|
+
|
|
212
|
+
await super.init( renderer );
|
|
213
|
+
|
|
214
|
+
//
|
|
215
|
+
|
|
216
|
+
const parameters = this.parameters;
|
|
217
|
+
|
|
218
|
+
// create the device if it is not passed with parameters
|
|
219
|
+
|
|
220
|
+
let device;
|
|
221
|
+
|
|
222
|
+
if ( parameters.device === undefined ) {
|
|
223
|
+
|
|
224
|
+
const adapterOptions = {
|
|
225
|
+
powerPreference: parameters.powerPreference,
|
|
226
|
+
featureLevel: 'compatibility',
|
|
227
|
+
xrCompatible: renderer.xr.enabled
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
const adapter = ( typeof navigator !== 'undefined' ) ? await navigator.gpu.requestAdapter( adapterOptions ) : null;
|
|
231
|
+
|
|
232
|
+
if ( adapter === null ) {
|
|
233
|
+
|
|
234
|
+
throw new Error( 'THREE.WebGPUBackend: Unable to create WebGPU adapter.' );
|
|
235
|
+
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
// every feature the adapter offers, not only those three.js knows by name, and its
|
|
239
|
+
// limits unless the caller asks for others
|
|
240
|
+
|
|
241
|
+
let requiredLimits = parameters.requiredLimits;
|
|
242
|
+
|
|
243
|
+
if ( requiredLimits === 'adapter' ) {
|
|
244
|
+
|
|
245
|
+
requiredLimits = {};
|
|
246
|
+
|
|
247
|
+
for ( const name in adapter.limits ) {
|
|
248
|
+
|
|
249
|
+
if ( typeof adapter.limits[ name ] === 'number' ) requiredLimits[ name ] = adapter.limits[ name ];
|
|
250
|
+
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
} else if ( requiredLimits === 'default' ) {
|
|
254
|
+
|
|
255
|
+
requiredLimits = {};
|
|
256
|
+
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
const deviceDescriptor = {
|
|
260
|
+
requiredFeatures: [ ...adapter.features ],
|
|
261
|
+
requiredLimits
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
this.adapter = adapter;
|
|
265
|
+
|
|
266
|
+
device = await adapter.requestDevice( deviceDescriptor );
|
|
267
|
+
|
|
268
|
+
} else {
|
|
269
|
+
|
|
270
|
+
device = parameters.device;
|
|
271
|
+
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
this.compatibilityMode = ! device.features.has( 'core-features-and-limits' );
|
|
275
|
+
|
|
276
|
+
if ( this.compatibilityMode ) {
|
|
277
|
+
|
|
278
|
+
renderer._samples = 0;
|
|
279
|
+
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
device.lost.then( ( info ) => {
|
|
283
|
+
|
|
284
|
+
if ( info.reason === 'destroyed' ) return;
|
|
285
|
+
|
|
286
|
+
const deviceLossInfo = {
|
|
287
|
+
api: 'WebGPU',
|
|
288
|
+
message: info.message || 'Unknown reason',
|
|
289
|
+
reason: info.reason || null,
|
|
290
|
+
originalEvent: info
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
renderer.onDeviceLost( deviceLossInfo );
|
|
294
|
+
|
|
295
|
+
} );
|
|
296
|
+
|
|
297
|
+
device.onuncapturederror = ( event ) => {
|
|
298
|
+
|
|
299
|
+
const gpuError = event.error;
|
|
300
|
+
const type = gpuError && gpuError.constructor ? gpuError.constructor.name : 'GPUError';
|
|
301
|
+
const message = ( gpuError && gpuError.message ) || 'Unknown uncaptured GPU error';
|
|
302
|
+
|
|
303
|
+
renderer.onError( {
|
|
304
|
+
api: 'WebGPU',
|
|
305
|
+
type,
|
|
306
|
+
message,
|
|
307
|
+
originalEvent: event
|
|
308
|
+
} );
|
|
309
|
+
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
this.device = device;
|
|
313
|
+
|
|
314
|
+
// Uniform buffers as slices of a few large buffers, written to the GPU once per submit.
|
|
315
|
+
this.uniformArena = new WebGPUUniformArena( device );
|
|
316
|
+
beforeSubmit( device, () => this.uniformArena.flush() );
|
|
317
|
+
|
|
318
|
+
this.trackTimestamp = this.trackTimestamp && this.hasFeature( GPUFeatureName.TimestampQuery );
|
|
319
|
+
|
|
320
|
+
this.capabilities.detect();
|
|
321
|
+
|
|
322
|
+
this.updateSize();
|
|
323
|
+
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* Registers external GPU textures from `XRGPUBinding` for use in rendering.
|
|
328
|
+
*
|
|
329
|
+
* @param {RenderTarget} renderTarget - The render target to register the textures for.
|
|
330
|
+
* @param {GPUTexture} colorTexture - The shared XR color GPUTexture.
|
|
331
|
+
* @param {?Array<Object>} [viewDescriptors=null] - Optional view descriptors, one per XR view.
|
|
332
|
+
*/
|
|
333
|
+
setXRRenderTargetTextures( renderTarget, colorTexture, viewDescriptors = null ) {
|
|
334
|
+
|
|
335
|
+
// Update the external XR texture without replacing the cached MSAA attachments.
|
|
336
|
+
const textureData = this.get( renderTarget.texture );
|
|
337
|
+
|
|
338
|
+
textureData.texture = colorTexture;
|
|
339
|
+
textureData.format = colorTexture.format;
|
|
340
|
+
textureData.externalTexture = true;
|
|
341
|
+
textureData.xrViewDescriptors = viewDescriptors;
|
|
342
|
+
textureData.initialized = true;
|
|
343
|
+
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* A reference to the context.
|
|
348
|
+
*
|
|
349
|
+
* @type {?GPUCanvasContext}
|
|
350
|
+
* @default null
|
|
351
|
+
*/
|
|
352
|
+
get context() {
|
|
353
|
+
|
|
354
|
+
const canvasTarget = this.renderer.getCanvasTarget();
|
|
355
|
+
const canvasData = this.get( canvasTarget );
|
|
356
|
+
|
|
357
|
+
let context = canvasData.context;
|
|
358
|
+
|
|
359
|
+
if ( context === undefined ) {
|
|
360
|
+
|
|
361
|
+
const parameters = this.parameters;
|
|
362
|
+
|
|
363
|
+
if ( canvasTarget.isDefaultCanvasTarget === true && parameters.context !== undefined ) {
|
|
364
|
+
|
|
365
|
+
context = parameters.context;
|
|
366
|
+
|
|
367
|
+
} else {
|
|
368
|
+
|
|
369
|
+
context = canvasTarget.domElement.getContext( 'webgpu' );
|
|
370
|
+
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
// OffscreenCanvas does not have setAttribute, see #22811
|
|
374
|
+
if ( 'setAttribute' in canvasTarget.domElement ) canvasTarget.domElement.setAttribute( 'data-engine', `three.js r${ REVISION } webgpu` );
|
|
375
|
+
|
|
376
|
+
const alphaMode = parameters.alpha ? 'premultiplied' : 'opaque';
|
|
377
|
+
|
|
378
|
+
const toneMappingMode = parameters.outputType === HalfFloatType ? 'extended' : 'standard';
|
|
379
|
+
|
|
380
|
+
context.configure( {
|
|
381
|
+
device: this.device,
|
|
382
|
+
format: this.utils.getPreferredCanvasFormat(),
|
|
383
|
+
usage: GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.COPY_SRC,
|
|
384
|
+
alphaMode: alphaMode,
|
|
385
|
+
toneMapping: {
|
|
386
|
+
mode: toneMappingMode
|
|
387
|
+
}
|
|
388
|
+
} );
|
|
389
|
+
|
|
390
|
+
canvasData.context = context;
|
|
391
|
+
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
return context;
|
|
395
|
+
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
/**
|
|
399
|
+
* The coordinate system of the backend.
|
|
400
|
+
*
|
|
401
|
+
* @type {number}
|
|
402
|
+
* @readonly
|
|
403
|
+
*/
|
|
404
|
+
get coordinateSystem() {
|
|
405
|
+
|
|
406
|
+
return WebGPUCoordinateSystem;
|
|
407
|
+
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
/**
|
|
411
|
+
* Whether the backend supports query timestamps or not.
|
|
412
|
+
*
|
|
413
|
+
* @type {boolean}
|
|
414
|
+
* @readonly
|
|
415
|
+
*/
|
|
416
|
+
get hasTimestamp() {
|
|
417
|
+
|
|
418
|
+
return true;
|
|
419
|
+
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
/**
|
|
423
|
+
* This method performs a readback operation by moving buffer data from
|
|
424
|
+
* a storage buffer attribute from the GPU to the CPU. ReadbackBuffer can
|
|
425
|
+
* be used to retain and reuse handles to the intermediate buffers and prevent
|
|
426
|
+
* new allocation.
|
|
427
|
+
*
|
|
428
|
+
* @async
|
|
429
|
+
* @param {BufferAttribute} attribute - The storage buffer attribute to read from.
|
|
430
|
+
* @param {?(ReadbackBuffer|ArrayBuffer)} [target=null] - The readback buffer or array buffer that receives the data. If `null`, a new array buffer is returned.
|
|
431
|
+
* @param {number} [offset=0] - The byte offset to start reading from. Must be a multiple of 4.
|
|
432
|
+
* @param {number} [count=-1] - The number of bytes to read. Must be a multiple of 4, or `-1` to read to the end of the buffer.
|
|
433
|
+
* @return {Promise<ArrayBuffer|ReadbackBuffer>} A promise that resolves with the buffer data when the data are ready.
|
|
434
|
+
*/
|
|
435
|
+
async getArrayBufferAsync( attribute, target = null, offset = 0, count = - 1 ) {
|
|
436
|
+
|
|
437
|
+
return await this.attributeUtils.getArrayBufferAsync( attribute, target, offset, count );
|
|
438
|
+
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
/**
|
|
442
|
+
* Returns the backend's rendering context.
|
|
443
|
+
*
|
|
444
|
+
* @return {GPUCanvasContext} The rendering context.
|
|
445
|
+
*/
|
|
446
|
+
getContext() {
|
|
447
|
+
|
|
448
|
+
return this.context;
|
|
449
|
+
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* Returns the default render pass descriptor.
|
|
454
|
+
*
|
|
455
|
+
* In WebGPU, the default framebuffer must be configured
|
|
456
|
+
* like custom framebuffers so the backend needs a render
|
|
457
|
+
* pass descriptor even when rendering directly to screen.
|
|
458
|
+
*
|
|
459
|
+
* @private
|
|
460
|
+
* @return {GPURenderPassDescriptor} The render pass descriptor.
|
|
461
|
+
*/
|
|
462
|
+
_getDefaultRenderPassDescriptor() {
|
|
463
|
+
|
|
464
|
+
const renderer = this.renderer;
|
|
465
|
+
const canvasTarget = renderer.getCanvasTarget();
|
|
466
|
+
const canvasData = this.get( canvasTarget );
|
|
467
|
+
const samples = renderer.currentSamples;
|
|
468
|
+
|
|
469
|
+
let descriptor = canvasData.descriptor;
|
|
470
|
+
|
|
471
|
+
if ( descriptor === undefined || canvasData.samples !== samples ) {
|
|
472
|
+
|
|
473
|
+
descriptor = new GPURenderPassDescriptor();
|
|
474
|
+
descriptor.colorAttachments.push( new GPURenderPassColorAttachment() );
|
|
475
|
+
|
|
476
|
+
if ( renderer.depth === true || renderer.stencil === true ) {
|
|
477
|
+
|
|
478
|
+
const depthStencilAttachment = new GPURenderPassDepthStencilAttachment();
|
|
479
|
+
depthStencilAttachment.view = this.textureUtils.getDepthBuffer( renderer.depth, renderer.stencil ).createView();
|
|
480
|
+
descriptor.depthStencilAttachment = depthStencilAttachment;
|
|
481
|
+
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
const colorAttachment = descriptor.colorAttachments[ 0 ];
|
|
485
|
+
|
|
486
|
+
if ( samples > 0 ) {
|
|
487
|
+
|
|
488
|
+
colorAttachment.view = this.textureUtils.getColorBuffer().createView();
|
|
489
|
+
|
|
490
|
+
} else {
|
|
491
|
+
|
|
492
|
+
colorAttachment.resolveTarget = undefined;
|
|
493
|
+
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
canvasData.descriptor = descriptor;
|
|
497
|
+
canvasData.samples = samples;
|
|
498
|
+
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
const colorAttachment = descriptor.colorAttachments[ 0 ];
|
|
502
|
+
|
|
503
|
+
if ( samples > 0 ) {
|
|
504
|
+
|
|
505
|
+
colorAttachment.resolveTarget = this.context.getCurrentTexture().createView();
|
|
506
|
+
|
|
507
|
+
} else {
|
|
508
|
+
|
|
509
|
+
colorAttachment.view = this.context.getCurrentTexture().createView();
|
|
510
|
+
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
return descriptor;
|
|
514
|
+
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
/**
|
|
518
|
+
* Returns whether the render target is a render target array with depth 2D array texture.
|
|
519
|
+
*
|
|
520
|
+
* @param {RenderContext} renderContext - The render context.
|
|
521
|
+
* @return {boolean} Whether the render target is a render target array with depth 2D array texture.
|
|
522
|
+
*
|
|
523
|
+
* @private
|
|
524
|
+
*/
|
|
525
|
+
_isRenderCameraDepthArray( renderContext ) {
|
|
526
|
+
|
|
527
|
+
const camera = renderContext.camera;
|
|
528
|
+
|
|
529
|
+
return renderContext.depthTexture && renderContext.depthTexture.isArrayTexture === true && camera !== null && camera.isArrayCamera === true;
|
|
530
|
+
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
/**
|
|
534
|
+
* Returns whether the current render context references external textures.
|
|
535
|
+
*
|
|
536
|
+
* External textures can change every frame, so their descriptors must not be cached.
|
|
537
|
+
*
|
|
538
|
+
* @private
|
|
539
|
+
* @param {RenderContext} renderContext - The render context.
|
|
540
|
+
* @return {boolean} Whether the render context uses external textures.
|
|
541
|
+
*/
|
|
542
|
+
_hasExternalTexture( renderContext ) {
|
|
543
|
+
|
|
544
|
+
const textures = renderContext.textures;
|
|
545
|
+
|
|
546
|
+
if ( textures === null ) return false;
|
|
547
|
+
|
|
548
|
+
for ( let i = 0; i < textures.length; i ++ ) {
|
|
549
|
+
|
|
550
|
+
if ( this.get( textures[ i ] ).externalTexture === true ) return true;
|
|
551
|
+
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
return false;
|
|
555
|
+
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
/**
|
|
559
|
+
* Returns multisampled color textures for an external render target.
|
|
560
|
+
*
|
|
561
|
+
* @private
|
|
562
|
+
* @param {RenderContext} renderContext - The render context.
|
|
563
|
+
* @param {Object} textureData - The backend data for the external texture.
|
|
564
|
+
* @param {number} count - The number of textures to create.
|
|
565
|
+
* @return {?Array<GPUTexture>} The multisampled textures.
|
|
566
|
+
*/
|
|
567
|
+
_getExternalMSAATextures( renderContext, textureData, count ) {
|
|
568
|
+
|
|
569
|
+
const samples = this.utils.getSampleCount( renderContext.sampleCount );
|
|
570
|
+
|
|
571
|
+
if ( samples === 1 ) {
|
|
572
|
+
|
|
573
|
+
if ( textureData.msaaTextures !== undefined ) {
|
|
574
|
+
|
|
575
|
+
for ( const texture of textureData.msaaTextures ) texture.destroy();
|
|
576
|
+
|
|
577
|
+
textureData.msaaTextures = undefined;
|
|
578
|
+
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
return null;
|
|
582
|
+
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
const renderTarget = renderContext.renderTarget;
|
|
586
|
+
const width = renderTarget.width;
|
|
587
|
+
const height = renderTarget.height;
|
|
588
|
+
const format = textureData.format;
|
|
589
|
+
|
|
590
|
+
if ( textureData.msaaTextures === undefined ||
|
|
591
|
+
textureData.msaaTextures.length !== count ||
|
|
592
|
+
textureData.msaaWidth !== width ||
|
|
593
|
+
textureData.msaaHeight !== height ||
|
|
594
|
+
textureData.msaaSamples !== samples ||
|
|
595
|
+
textureData.msaaFormat !== format ) {
|
|
596
|
+
|
|
597
|
+
if ( textureData.msaaTextures !== undefined ) {
|
|
598
|
+
|
|
599
|
+
for ( const texture of textureData.msaaTextures ) texture.destroy();
|
|
600
|
+
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
_textureDescriptor.size.width = width;
|
|
604
|
+
_textureDescriptor.size.height = height;
|
|
605
|
+
_textureDescriptor.sampleCount = samples;
|
|
606
|
+
_textureDescriptor.format = format;
|
|
607
|
+
// Layered rendering can resume after a framebuffer copy,
|
|
608
|
+
// so these attachments must support loading.
|
|
609
|
+
_textureDescriptor.usage = GPUTextureUsage.RENDER_ATTACHMENT;
|
|
610
|
+
|
|
611
|
+
textureData.msaaTextures = [];
|
|
612
|
+
|
|
613
|
+
for ( let i = 0; i < count; i ++ ) {
|
|
614
|
+
|
|
615
|
+
_textureDescriptor.label = renderTarget.texture.name + '-msaa-' + i;
|
|
616
|
+
textureData.msaaTextures.push( this.device.createTexture( _textureDescriptor ) );
|
|
617
|
+
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
_textureDescriptor.reset();
|
|
621
|
+
|
|
622
|
+
textureData.msaaWidth = width;
|
|
623
|
+
textureData.msaaHeight = height;
|
|
624
|
+
textureData.msaaSamples = samples;
|
|
625
|
+
textureData.msaaFormat = format;
|
|
626
|
+
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
return textureData.msaaTextures;
|
|
630
|
+
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
/**
|
|
634
|
+
* Creates attachment views for an external texture render target.
|
|
635
|
+
*
|
|
636
|
+
* @private
|
|
637
|
+
* @param {RenderContext} renderContext - The render context.
|
|
638
|
+
* @param {Object} textureData - The backend data for the texture.
|
|
639
|
+
* @return {Array<Object>} The attachment view descriptors.
|
|
640
|
+
*/
|
|
641
|
+
_createExternalTextureViews( renderContext, textureData ) {
|
|
642
|
+
|
|
643
|
+
const textureViews = [];
|
|
644
|
+
const camera = renderContext.camera;
|
|
645
|
+
const viewDescriptors = textureData.xrViewDescriptors;
|
|
646
|
+
const viewCount = Math.max( viewDescriptors?.length || 0, renderContext.activeCubeFace + 1, 1 );
|
|
647
|
+
const msaaTextures = this._getExternalMSAATextures( renderContext, textureData, viewCount );
|
|
648
|
+
|
|
649
|
+
if ( viewDescriptors && camera !== null && camera.isArrayCamera === true ) {
|
|
650
|
+
|
|
651
|
+
for ( let i = 0; i < viewDescriptors.length; i ++ ) {
|
|
652
|
+
|
|
653
|
+
const textureView = textureData.texture.createView( viewDescriptors[ i ] );
|
|
654
|
+
|
|
655
|
+
textureViews.push( {
|
|
656
|
+
view: msaaTextures !== null ? msaaTextures[ i ].createView() : textureView,
|
|
657
|
+
resolveTarget: msaaTextures !== null && renderContext.renderTarget.resolveColorBuffer === true ? textureView : undefined,
|
|
658
|
+
depthSlice: undefined
|
|
659
|
+
} );
|
|
660
|
+
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
} else {
|
|
664
|
+
|
|
665
|
+
const layer = renderContext.activeCubeFace;
|
|
666
|
+
const textureView = textureData.texture.createView( {
|
|
667
|
+
dimension: GPUTextureViewDimension.TwoD,
|
|
668
|
+
baseArrayLayer: layer,
|
|
669
|
+
arrayLayerCount: 1
|
|
670
|
+
} );
|
|
671
|
+
|
|
672
|
+
textureViews.push( {
|
|
673
|
+
view: msaaTextures !== null ? msaaTextures[ layer ].createView() : textureView,
|
|
674
|
+
resolveTarget: msaaTextures !== null && renderContext.renderTarget.resolveColorBuffer === true ? textureView : undefined,
|
|
675
|
+
depthSlice: undefined
|
|
676
|
+
} );
|
|
677
|
+
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
return textureViews;
|
|
681
|
+
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
/**
|
|
685
|
+
* Returns the render pass descriptor for the given render context.
|
|
686
|
+
*
|
|
687
|
+
* @private
|
|
688
|
+
* @param {RenderContext} renderContext - The render context.
|
|
689
|
+
* @param {Object} colorAttachmentsConfig - Configuration object for the color attachments.
|
|
690
|
+
* @return {Object} The render pass descriptor.
|
|
691
|
+
*/
|
|
692
|
+
_getRenderPassDescriptor( renderContext, colorAttachmentsConfig = {} ) {
|
|
693
|
+
|
|
694
|
+
const renderTarget = renderContext.renderTarget;
|
|
695
|
+
const renderTargetData = this.get( renderTarget );
|
|
696
|
+
const hasExternalTexture = this._hasExternalTexture( renderContext );
|
|
697
|
+
|
|
698
|
+
let descriptors = renderTargetData.descriptors;
|
|
699
|
+
|
|
700
|
+
if ( descriptors === undefined ||
|
|
701
|
+
renderTargetData.width !== renderTarget.width ||
|
|
702
|
+
renderTargetData.height !== renderTarget.height ||
|
|
703
|
+
renderTargetData.samples !== renderTarget.samples ||
|
|
704
|
+
hasExternalTexture
|
|
705
|
+
) {
|
|
706
|
+
|
|
707
|
+
descriptors = {};
|
|
708
|
+
|
|
709
|
+
renderTargetData.descriptors = descriptors;
|
|
710
|
+
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
const cacheKey = renderContext.getCacheKey();
|
|
714
|
+
let descriptorBase = descriptors[ cacheKey ];
|
|
715
|
+
|
|
716
|
+
if ( descriptorBase === undefined || hasExternalTexture ) {
|
|
717
|
+
|
|
718
|
+
const textures = renderContext.textures;
|
|
719
|
+
const textureViews = [];
|
|
720
|
+
|
|
721
|
+
let sliceIndex;
|
|
722
|
+
|
|
723
|
+
const isRenderCameraDepthArray = this._isRenderCameraDepthArray( renderContext );
|
|
724
|
+
|
|
725
|
+
for ( let i = 0; i < textures.length; i ++ ) {
|
|
726
|
+
|
|
727
|
+
const textureData = this.get( textures[ i ] );
|
|
728
|
+
|
|
729
|
+
if ( textureData.externalTexture === true ) {
|
|
730
|
+
|
|
731
|
+
textureViews.push( ...this._createExternalTextureViews( renderContext, textureData ) );
|
|
732
|
+
continue;
|
|
733
|
+
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
_viewDescriptor.label = `colorAttachment_${ i }`;
|
|
737
|
+
_viewDescriptor.baseMipLevel = renderContext.activeMipmapLevel;
|
|
738
|
+
_viewDescriptor.mipLevelCount = 1;
|
|
739
|
+
_viewDescriptor.baseArrayLayer = renderContext.activeCubeFace;
|
|
740
|
+
_viewDescriptor.arrayLayerCount = 1;
|
|
741
|
+
_viewDescriptor.dimension = GPUTextureViewDimension.TwoD;
|
|
742
|
+
|
|
743
|
+
if ( renderTarget.isRenderTarget3D ) {
|
|
744
|
+
|
|
745
|
+
sliceIndex = renderContext.activeCubeFace;
|
|
746
|
+
|
|
747
|
+
_viewDescriptor.baseArrayLayer = 0;
|
|
748
|
+
_viewDescriptor.dimension = GPUTextureViewDimension.ThreeD;
|
|
749
|
+
|
|
750
|
+
} else if ( renderTarget.isRenderTarget && textures[ i ].image.depth > 1 ) {
|
|
751
|
+
|
|
752
|
+
if ( isRenderCameraDepthArray === true ) {
|
|
753
|
+
|
|
754
|
+
const cameras = renderContext.camera.cameras;
|
|
755
|
+
for ( let layer = 0; layer < cameras.length; layer ++ ) {
|
|
756
|
+
|
|
757
|
+
_viewDescriptor.baseArrayLayer = layer;
|
|
758
|
+
_viewDescriptor.arrayLayerCount = 1;
|
|
759
|
+
_viewDescriptor.dimension = GPUTextureViewDimension.TwoD;
|
|
760
|
+
|
|
761
|
+
const textureView = textureData.texture.createView( _viewDescriptor );
|
|
762
|
+
const msaaTexture = textureData.msaaTextures?.[ layer ];
|
|
763
|
+
textureViews.push( {
|
|
764
|
+
view: msaaTexture !== undefined ? msaaTexture.createView() : textureView,
|
|
765
|
+
resolveTarget: msaaTexture !== undefined && renderTarget.resolveColorBuffer === true ? textureView : undefined,
|
|
766
|
+
depthSlice: undefined
|
|
767
|
+
} );
|
|
768
|
+
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
} else {
|
|
772
|
+
|
|
773
|
+
_viewDescriptor.dimension = GPUTextureViewDimension.TwoDArray;
|
|
774
|
+
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
if ( isRenderCameraDepthArray !== true ) {
|
|
780
|
+
|
|
781
|
+
const textureView = textureData.texture.createView( _viewDescriptor );
|
|
782
|
+
|
|
783
|
+
let view, resolveTarget;
|
|
784
|
+
|
|
785
|
+
if ( textureData.msaaTexture !== undefined ) {
|
|
786
|
+
|
|
787
|
+
view = textureData.msaaTexture.createView();
|
|
788
|
+
resolveTarget = renderTarget.resolveColorBuffer === true ? textureView : undefined;
|
|
789
|
+
|
|
790
|
+
} else if ( textureData.msaaTextures !== undefined ) {
|
|
791
|
+
|
|
792
|
+
view = textureData.msaaTextures[ renderContext.activeCubeFace ].createView();
|
|
793
|
+
resolveTarget = renderTarget.resolveColorBuffer === true ? textureView : undefined;
|
|
794
|
+
|
|
795
|
+
} else {
|
|
796
|
+
|
|
797
|
+
view = textureView;
|
|
798
|
+
resolveTarget = undefined;
|
|
799
|
+
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
textureViews.push( {
|
|
803
|
+
view,
|
|
804
|
+
resolveTarget,
|
|
805
|
+
depthSlice: sliceIndex
|
|
806
|
+
} );
|
|
807
|
+
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
_viewDescriptor.reset();
|
|
811
|
+
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
const colorAttachments = [];
|
|
815
|
+
|
|
816
|
+
for ( let i = 0; i < textureViews.length; i ++ ) {
|
|
817
|
+
|
|
818
|
+
const viewInfo = textureViews[ i ];
|
|
819
|
+
const attachment = new GPURenderPassColorAttachment();
|
|
820
|
+
attachment.view = viewInfo.view;
|
|
821
|
+
attachment.depthSlice = viewInfo.depthSlice;
|
|
822
|
+
attachment.resolveTarget = viewInfo.resolveTarget;
|
|
823
|
+
colorAttachments.push( attachment );
|
|
824
|
+
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
descriptorBase = {
|
|
828
|
+
textureViews,
|
|
829
|
+
colorAttachments,
|
|
830
|
+
descriptor: new GPURenderPassDescriptor()
|
|
831
|
+
};
|
|
832
|
+
|
|
833
|
+
if ( renderContext.depth ) {
|
|
834
|
+
|
|
835
|
+
const depthTextureData = this.get( renderContext.depthTexture );
|
|
836
|
+
|
|
837
|
+
if ( renderContext.depthTexture.isArrayTexture || renderContext.depthTexture.isCubeTexture ) {
|
|
838
|
+
|
|
839
|
+
_viewDescriptor.dimension = GPUTextureViewDimension.TwoD;
|
|
840
|
+
_viewDescriptor.arrayLayerCount = 1;
|
|
841
|
+
_viewDescriptor.baseArrayLayer = renderContext.activeCubeFace;
|
|
842
|
+
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
const depthStencilAttachment = new GPURenderPassDepthStencilAttachment();
|
|
846
|
+
const msaaDepthTexture = depthTextureData.msaaTextures?.[ renderContext.activeCubeFace ];
|
|
847
|
+
depthStencilAttachment.view = msaaDepthTexture !== undefined ? msaaDepthTexture.createView() : depthTextureData.texture.createView( _viewDescriptor );
|
|
848
|
+
descriptorBase.depthStencilAttachment = depthStencilAttachment;
|
|
849
|
+
|
|
850
|
+
_viewDescriptor.reset();
|
|
851
|
+
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
descriptors[ cacheKey ] = descriptorBase;
|
|
855
|
+
|
|
856
|
+
renderTargetData.width = renderTarget.width;
|
|
857
|
+
renderTargetData.height = renderTarget.height;
|
|
858
|
+
renderTargetData.samples = renderTarget.samples;
|
|
859
|
+
renderTargetData.activeMipmapLevel = renderContext.activeMipmapLevel;
|
|
860
|
+
renderTargetData.activeCubeFace = renderContext.activeCubeFace;
|
|
861
|
+
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
const descriptor = descriptorBase.descriptor;
|
|
865
|
+
|
|
866
|
+
descriptor.reset();
|
|
867
|
+
|
|
868
|
+
// Apply dynamic properties to cached attachments
|
|
869
|
+
for ( let i = 0; i < descriptorBase.colorAttachments.length; i ++ ) {
|
|
870
|
+
|
|
871
|
+
const attachment = descriptorBase.colorAttachments[ i ];
|
|
872
|
+
|
|
873
|
+
let clearValue = { r: 0, g: 0, b: 0, a: 1 };
|
|
874
|
+
if ( i === 0 && colorAttachmentsConfig.clearValue ) {
|
|
875
|
+
|
|
876
|
+
clearValue = colorAttachmentsConfig.clearValue;
|
|
877
|
+
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
attachment.loadOp = colorAttachmentsConfig.loadOp || GPULoadOp.Load;
|
|
881
|
+
attachment.storeOp = colorAttachmentsConfig.storeOp || GPUStoreOp.Store;
|
|
882
|
+
attachment.clearValue = clearValue;
|
|
883
|
+
|
|
884
|
+
descriptor.colorAttachments.push( attachment );
|
|
885
|
+
|
|
886
|
+
}
|
|
887
|
+
|
|
888
|
+
if ( descriptorBase.depthStencilAttachment ) {
|
|
889
|
+
|
|
890
|
+
descriptor.depthStencilAttachment = descriptorBase.depthStencilAttachment;
|
|
891
|
+
|
|
892
|
+
}
|
|
893
|
+
|
|
894
|
+
return descriptor;
|
|
895
|
+
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
/**
|
|
899
|
+
* This method is executed at the beginning of a render call and prepares
|
|
900
|
+
* the WebGPU state for upcoming render calls
|
|
901
|
+
*
|
|
902
|
+
* @param {RenderContext} renderContext - The render context.
|
|
903
|
+
*/
|
|
904
|
+
beginRender( renderContext ) {
|
|
905
|
+
|
|
906
|
+
const renderContextData = this.get( renderContext );
|
|
907
|
+
|
|
908
|
+
//
|
|
909
|
+
|
|
910
|
+
const device = this.device;
|
|
911
|
+
const occlusionQueryCount = renderContext.occlusionQueryCount;
|
|
912
|
+
const occlusionData = this.getOcclusionData( renderContext );
|
|
913
|
+
|
|
914
|
+
let occlusionQuerySet;
|
|
915
|
+
|
|
916
|
+
if ( occlusionQueryCount > 0 ) {
|
|
917
|
+
|
|
918
|
+
if ( occlusionData.currentOcclusionQuerySet ) occlusionData.currentOcclusionQuerySet.destroy();
|
|
919
|
+
if ( occlusionData.currentOcclusionQueryBuffer ) occlusionData.currentOcclusionQueryBuffer.destroy();
|
|
920
|
+
|
|
921
|
+
// Get a reference to the array of objects with queries. The occlusionData property
|
|
922
|
+
// can be changed by another render pass before the buffer.mapAsyc() completes.
|
|
923
|
+
occlusionData.currentOcclusionQuerySet = occlusionData.occlusionQuerySet;
|
|
924
|
+
occlusionData.currentOcclusionQueryBuffer = occlusionData.occlusionQueryBuffer;
|
|
925
|
+
occlusionData.currentOcclusionQueryObjects = occlusionData.occlusionQueryObjects;
|
|
926
|
+
|
|
927
|
+
//
|
|
928
|
+
|
|
929
|
+
_querySetDescriptor.label = `occlusionQuerySet_${ renderContext.id }`;
|
|
930
|
+
_querySetDescriptor.type = 'occlusion';
|
|
931
|
+
_querySetDescriptor.count = occlusionQueryCount;
|
|
932
|
+
|
|
933
|
+
occlusionQuerySet = device.createQuerySet( _querySetDescriptor );
|
|
934
|
+
|
|
935
|
+
_querySetDescriptor.reset();
|
|
936
|
+
|
|
937
|
+
occlusionData.occlusionQuerySet = occlusionQuerySet;
|
|
938
|
+
occlusionData.occlusionQueryIndex = 0;
|
|
939
|
+
occlusionData.occlusionQueryObjects = new Array( occlusionQueryCount );
|
|
940
|
+
|
|
941
|
+
occlusionData.lastOcclusionObject = null;
|
|
942
|
+
|
|
943
|
+
} else if ( occlusionData.lastOcclusionObject !== undefined ) {
|
|
944
|
+
|
|
945
|
+
// invalidate if there is a stale query
|
|
946
|
+
|
|
947
|
+
occlusionData.lastOcclusionObject = undefined;
|
|
948
|
+
|
|
949
|
+
occlusionData.occlusionQuerySet.destroy();
|
|
950
|
+
occlusionData.occlusionQuerySet = undefined;
|
|
951
|
+
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
let descriptor;
|
|
955
|
+
|
|
956
|
+
if ( renderContext.textures === null ) {
|
|
957
|
+
|
|
958
|
+
descriptor = this._getDefaultRenderPassDescriptor();
|
|
959
|
+
|
|
960
|
+
} else {
|
|
961
|
+
|
|
962
|
+
descriptor = this._getRenderPassDescriptor( renderContext, { loadOp: GPULoadOp.Load } );
|
|
963
|
+
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
this.initTimestampQuery( TimestampQuery.RENDER, this.getTimestampUID( renderContext ), descriptor );
|
|
967
|
+
|
|
968
|
+
descriptor.occlusionQuerySet = occlusionQuerySet;
|
|
969
|
+
|
|
970
|
+
const depthStencilAttachment = descriptor.depthStencilAttachment;
|
|
971
|
+
const renderTarget = renderContext.renderTarget;
|
|
972
|
+
const discardColor = renderContext.sampleCount > 1 && renderTarget?.storeMultisampledColorBuffer === false;
|
|
973
|
+
const discardDepth = renderContext.sampleCount > 1 && renderTarget?.storeMultisampledDepthBuffer === false;
|
|
974
|
+
const discardStencil = renderContext.sampleCount > 1 && renderTarget?.storeMultisampledStencilBuffer === false;
|
|
975
|
+
|
|
976
|
+
// A fullscreen pass overwrites the external texture, so its previous contents do not need to be loaded.
|
|
977
|
+
const clearExternalColor = renderContext.fullscreenPass === true && this._hasExternalTexture( renderContext );
|
|
978
|
+
|
|
979
|
+
if ( renderContext.textures !== null ) {
|
|
980
|
+
|
|
981
|
+
const colorAttachments = descriptor.colorAttachments;
|
|
982
|
+
|
|
983
|
+
for ( let i = 0; i < colorAttachments.length; i ++ ) {
|
|
984
|
+
|
|
985
|
+
const colorAttachment = colorAttachments[ i ];
|
|
986
|
+
|
|
987
|
+
if ( renderContext.clearColor || discardColor || clearExternalColor ) {
|
|
988
|
+
|
|
989
|
+
const clearColor = renderContext.mrt ? renderContext.mrt.getClearColor( renderContext.textures[ i ].name ) : null;
|
|
990
|
+
|
|
991
|
+
if ( clearColor !== null ) {
|
|
992
|
+
|
|
993
|
+
colorAttachment.clearValue = clearColor;
|
|
994
|
+
|
|
995
|
+
} else if ( i === 0 ) {
|
|
996
|
+
|
|
997
|
+
colorAttachment.clearValue = renderContext.clearColorValue;
|
|
998
|
+
|
|
999
|
+
} else {
|
|
1000
|
+
|
|
1001
|
+
_clearValue.r = 0;
|
|
1002
|
+
_clearValue.g = 0;
|
|
1003
|
+
_clearValue.b = 0;
|
|
1004
|
+
_clearValue.a = 1;
|
|
1005
|
+
|
|
1006
|
+
colorAttachment.clearValue = _clearValue;
|
|
1007
|
+
|
|
1008
|
+
}
|
|
1009
|
+
|
|
1010
|
+
colorAttachment.loadOp = GPULoadOp.Clear;
|
|
1011
|
+
|
|
1012
|
+
} else {
|
|
1013
|
+
|
|
1014
|
+
colorAttachment.loadOp = GPULoadOp.Load;
|
|
1015
|
+
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
if ( discardColor ) {
|
|
1019
|
+
|
|
1020
|
+
colorAttachment.storeOp = GPUStoreOp.Discard;
|
|
1021
|
+
|
|
1022
|
+
} else {
|
|
1023
|
+
|
|
1024
|
+
colorAttachment.storeOp = GPUStoreOp.Store;
|
|
1025
|
+
|
|
1026
|
+
}
|
|
1027
|
+
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1030
|
+
} else {
|
|
1031
|
+
|
|
1032
|
+
const colorAttachment = descriptor.colorAttachments[ 0 ];
|
|
1033
|
+
|
|
1034
|
+
if ( renderContext.clearColor ) {
|
|
1035
|
+
|
|
1036
|
+
colorAttachment.clearValue = renderContext.clearColorValue;
|
|
1037
|
+
colorAttachment.loadOp = GPULoadOp.Clear;
|
|
1038
|
+
|
|
1039
|
+
} else {
|
|
1040
|
+
|
|
1041
|
+
colorAttachment.loadOp = GPULoadOp.Load;
|
|
1042
|
+
|
|
1043
|
+
}
|
|
1044
|
+
|
|
1045
|
+
colorAttachment.storeOp = GPUStoreOp.Store;
|
|
1046
|
+
|
|
1047
|
+
}
|
|
1048
|
+
|
|
1049
|
+
//
|
|
1050
|
+
|
|
1051
|
+
if ( renderContext.depth ) {
|
|
1052
|
+
|
|
1053
|
+
if ( renderContext.clearDepth || discardDepth ) {
|
|
1054
|
+
|
|
1055
|
+
depthStencilAttachment.depthClearValue = renderContext.clearDepthValue;
|
|
1056
|
+
depthStencilAttachment.depthLoadOp = GPULoadOp.Clear;
|
|
1057
|
+
|
|
1058
|
+
} else {
|
|
1059
|
+
|
|
1060
|
+
depthStencilAttachment.depthLoadOp = GPULoadOp.Load;
|
|
1061
|
+
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
if ( discardDepth ) {
|
|
1065
|
+
|
|
1066
|
+
depthStencilAttachment.depthStoreOp = GPUStoreOp.Discard;
|
|
1067
|
+
|
|
1068
|
+
} else {
|
|
1069
|
+
|
|
1070
|
+
depthStencilAttachment.depthStoreOp = GPUStoreOp.Store;
|
|
1071
|
+
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1076
|
+
if ( renderContext.stencil ) {
|
|
1077
|
+
|
|
1078
|
+
if ( renderContext.clearStencil || discardStencil ) {
|
|
1079
|
+
|
|
1080
|
+
depthStencilAttachment.stencilClearValue = renderContext.clearStencilValue;
|
|
1081
|
+
depthStencilAttachment.stencilLoadOp = GPULoadOp.Clear;
|
|
1082
|
+
|
|
1083
|
+
} else {
|
|
1084
|
+
|
|
1085
|
+
depthStencilAttachment.stencilLoadOp = GPULoadOp.Load;
|
|
1086
|
+
|
|
1087
|
+
}
|
|
1088
|
+
|
|
1089
|
+
if ( discardStencil ) {
|
|
1090
|
+
|
|
1091
|
+
depthStencilAttachment.stencilStoreOp = GPUStoreOp.Discard;
|
|
1092
|
+
|
|
1093
|
+
} else {
|
|
1094
|
+
|
|
1095
|
+
depthStencilAttachment.stencilStoreOp = GPUStoreOp.Store;
|
|
1096
|
+
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
//
|
|
1102
|
+
|
|
1103
|
+
_commandEncoderDescriptor.label = 'renderContext_' + renderContext.id;
|
|
1104
|
+
const encoder = device.createCommandEncoder( _commandEncoderDescriptor );
|
|
1105
|
+
_commandEncoderDescriptor.reset();
|
|
1106
|
+
|
|
1107
|
+
// Layered render targets: prepare bundle encoders for each camera in the array camera.
|
|
1108
|
+
|
|
1109
|
+
if ( this._isRenderCameraDepthArray( renderContext ) === true ) {
|
|
1110
|
+
|
|
1111
|
+
const cameras = renderContext.camera.cameras;
|
|
1112
|
+
|
|
1113
|
+
// The layer descriptors hold views of the depth texture, which can be recreated (dispose, resize)
|
|
1114
|
+
// or belong to another render target, since render contexts are shared by attachment state.
|
|
1115
|
+
|
|
1116
|
+
const depthTextureGPU = this.get( renderContext.depthTexture ).texture;
|
|
1117
|
+
|
|
1118
|
+
if ( ! renderContextData.layerDescriptors || renderContextData.layerDescriptors.length !== cameras.length || renderContextData.layerDepthTexture !== depthTextureGPU ) {
|
|
1119
|
+
|
|
1120
|
+
this._createArrayCameraLayerDescriptors( renderContext, renderContextData, descriptor, cameras );
|
|
1121
|
+
renderContextData.layerDepthTexture = depthTextureGPU;
|
|
1122
|
+
|
|
1123
|
+
} else {
|
|
1124
|
+
|
|
1125
|
+
this._updateArrayCameraLayerDescriptors( renderContext, renderContextData, descriptor, cameras );
|
|
1126
|
+
|
|
1127
|
+
}
|
|
1128
|
+
|
|
1129
|
+
this._createArrayCameraBundleEncoders( renderContext, renderContextData );
|
|
1130
|
+
renderContextData.arrayCameraRenderStages = [];
|
|
1131
|
+
|
|
1132
|
+
// We'll complete the bundles in finishRender
|
|
1133
|
+
renderContextData.currentPass = null;
|
|
1134
|
+
|
|
1135
|
+
} else {
|
|
1136
|
+
|
|
1137
|
+
renderContextData.bundleEncoders = undefined;
|
|
1138
|
+
renderContextData.bundleSets = undefined;
|
|
1139
|
+
renderContextData.arrayCameraRenderStages = undefined;
|
|
1140
|
+
|
|
1141
|
+
const currentPass = encoder.beginRenderPass( descriptor );
|
|
1142
|
+
renderContextData.currentPass = currentPass;
|
|
1143
|
+
|
|
1144
|
+
if ( renderContext.viewport ) {
|
|
1145
|
+
|
|
1146
|
+
this.updateViewport( renderContext );
|
|
1147
|
+
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1150
|
+
if ( renderContext.scissor ) {
|
|
1151
|
+
|
|
1152
|
+
this.updateScissor( renderContext );
|
|
1153
|
+
|
|
1154
|
+
}
|
|
1155
|
+
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1158
|
+
//
|
|
1159
|
+
|
|
1160
|
+
renderContextData.descriptor = descriptor;
|
|
1161
|
+
renderContextData.encoder = encoder;
|
|
1162
|
+
renderContextData.renderBundles = [];
|
|
1163
|
+
|
|
1164
|
+
this._resetRenderContextData( renderContextData );
|
|
1165
|
+
|
|
1166
|
+
}
|
|
1167
|
+
|
|
1168
|
+
/**
|
|
1169
|
+
* Resets the state cache of the given render context data.
|
|
1170
|
+
*
|
|
1171
|
+
* A new render pass encoder starts with a blend constant and a stencil reference
|
|
1172
|
+
* of zero so the cached values must be reset as well.
|
|
1173
|
+
*
|
|
1174
|
+
* @private
|
|
1175
|
+
* @param {Object} renderContextData - The render context data.
|
|
1176
|
+
*/
|
|
1177
|
+
_resetRenderContextData( renderContextData ) {
|
|
1178
|
+
|
|
1179
|
+
renderContextData.currentSets = { attributes: {}, bindingGroups: [], pipeline: null, index: null };
|
|
1180
|
+
|
|
1181
|
+
if ( renderContextData.currentBlendColor === undefined ) renderContextData.currentBlendColor = new Color();
|
|
1182
|
+
|
|
1183
|
+
renderContextData.currentBlendColor.setRGB( 0, 0, 0 );
|
|
1184
|
+
renderContextData.currentBlendAlpha = 0;
|
|
1185
|
+
renderContextData.currentStencilRef = 0;
|
|
1186
|
+
|
|
1187
|
+
}
|
|
1188
|
+
|
|
1189
|
+
/**
|
|
1190
|
+
* Creates a render bundle encoder and state cache for each camera layer.
|
|
1191
|
+
*
|
|
1192
|
+
* @param {RenderContext} renderContext - The render context.
|
|
1193
|
+
* @param {Object} renderContextData - The render context data.
|
|
1194
|
+
* @private
|
|
1195
|
+
*/
|
|
1196
|
+
_createArrayCameraBundleEncoders( renderContext, renderContextData ) {
|
|
1197
|
+
|
|
1198
|
+
const cameras = renderContext.camera.cameras;
|
|
1199
|
+
|
|
1200
|
+
renderContextData.bundleEncoders = [];
|
|
1201
|
+
renderContextData.bundleSets = [];
|
|
1202
|
+
|
|
1203
|
+
for ( let i = 0; i < cameras.length; i ++ ) {
|
|
1204
|
+
|
|
1205
|
+
const bundleEncoder = this.pipelineUtils.createBundleEncoder(
|
|
1206
|
+
renderContext,
|
|
1207
|
+
'renderBundleArrayCamera_' + i
|
|
1208
|
+
);
|
|
1209
|
+
|
|
1210
|
+
const bundleSets = {
|
|
1211
|
+
attributes: {},
|
|
1212
|
+
bindingGroups: [],
|
|
1213
|
+
pipeline: null,
|
|
1214
|
+
index: null
|
|
1215
|
+
};
|
|
1216
|
+
|
|
1217
|
+
renderContextData.bundleEncoders.push( bundleEncoder );
|
|
1218
|
+
renderContextData.bundleSets.push( bundleSets );
|
|
1219
|
+
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
}
|
|
1223
|
+
|
|
1224
|
+
/**
|
|
1225
|
+
* Finishes the render bundle encoders for all camera layers.
|
|
1226
|
+
*
|
|
1227
|
+
* @param {Object} renderContextData - The render context data.
|
|
1228
|
+
* @return {Array<GPURenderBundle>} The completed render bundles.
|
|
1229
|
+
* @private
|
|
1230
|
+
*/
|
|
1231
|
+
_finishArrayCameraBundleEncoders( renderContextData ) {
|
|
1232
|
+
|
|
1233
|
+
const bundles = [];
|
|
1234
|
+
|
|
1235
|
+
for ( const bundleEncoder of renderContextData.bundleEncoders ) {
|
|
1236
|
+
|
|
1237
|
+
bundles.push( bundleEncoder.finish() );
|
|
1238
|
+
|
|
1239
|
+
}
|
|
1240
|
+
|
|
1241
|
+
return bundles;
|
|
1242
|
+
|
|
1243
|
+
}
|
|
1244
|
+
|
|
1245
|
+
/**
|
|
1246
|
+
* Creates render pass descriptors for each camera in an array camera.
|
|
1247
|
+
*
|
|
1248
|
+
* @param {RenderContext} renderContext - The render context.
|
|
1249
|
+
* @param {Object} renderContextData - The render context data.
|
|
1250
|
+
* @param {Object} descriptor - The render pass descriptor.
|
|
1251
|
+
* @param {ArrayCamera} cameras - The array camera.
|
|
1252
|
+
*
|
|
1253
|
+
* @private
|
|
1254
|
+
*/
|
|
1255
|
+
_createArrayCameraLayerDescriptors( renderContext, renderContextData, descriptor, cameras ) {
|
|
1256
|
+
|
|
1257
|
+
const depthStencilAttachment = descriptor.depthStencilAttachment;
|
|
1258
|
+
renderContextData.layerDescriptors = [];
|
|
1259
|
+
|
|
1260
|
+
const depthTextureData = this.get( renderContext.depthTexture );
|
|
1261
|
+
if ( ! depthTextureData.viewCache ) {
|
|
1262
|
+
|
|
1263
|
+
depthTextureData.viewCache = [];
|
|
1264
|
+
|
|
1265
|
+
}
|
|
1266
|
+
|
|
1267
|
+
for ( let i = 0; i < cameras.length; i ++ ) {
|
|
1268
|
+
|
|
1269
|
+
const layerDescriptor = new GPURenderPassDescriptor();
|
|
1270
|
+
layerDescriptor.label = descriptor.label;
|
|
1271
|
+
layerDescriptor.occlusionQuerySet = descriptor.occlusionQuerySet;
|
|
1272
|
+
layerDescriptor.timestampWrites = descriptor.timestampWrites;
|
|
1273
|
+
|
|
1274
|
+
if ( descriptor.colorAttachments.length > 0 ) {
|
|
1275
|
+
|
|
1276
|
+
const sourceAttachment = descriptor.colorAttachments[ 0 ];
|
|
1277
|
+
const layerAttachment = descriptor.colorAttachments[ i ];
|
|
1278
|
+
|
|
1279
|
+
const layerColorAttachment = new GPURenderPassColorAttachment();
|
|
1280
|
+
layerColorAttachment.view = layerAttachment.view;
|
|
1281
|
+
layerColorAttachment.depthSlice = layerAttachment.depthSlice;
|
|
1282
|
+
layerColorAttachment.resolveTarget = layerAttachment.resolveTarget;
|
|
1283
|
+
layerColorAttachment.loadOp = sourceAttachment.loadOp;
|
|
1284
|
+
layerColorAttachment.storeOp = sourceAttachment.storeOp;
|
|
1285
|
+
layerColorAttachment.clearValue = sourceAttachment.clearValue;
|
|
1286
|
+
|
|
1287
|
+
layerDescriptor.colorAttachments.push( layerColorAttachment );
|
|
1288
|
+
|
|
1289
|
+
}
|
|
1290
|
+
|
|
1291
|
+
if ( descriptor.depthStencilAttachment ) {
|
|
1292
|
+
|
|
1293
|
+
const layerIndex = i;
|
|
1294
|
+
|
|
1295
|
+
if ( ! depthTextureData.viewCache[ layerIndex ] ) {
|
|
1296
|
+
|
|
1297
|
+
const msaaTexture = depthTextureData.msaaTextures?.[ layerIndex ];
|
|
1298
|
+
|
|
1299
|
+
if ( msaaTexture !== undefined ) {
|
|
1300
|
+
|
|
1301
|
+
depthTextureData.viewCache[ layerIndex ] = msaaTexture.createView();
|
|
1302
|
+
|
|
1303
|
+
} else {
|
|
1304
|
+
|
|
1305
|
+
_viewDescriptor.dimension = GPUTextureViewDimension.TwoD;
|
|
1306
|
+
_viewDescriptor.baseArrayLayer = i;
|
|
1307
|
+
_viewDescriptor.arrayLayerCount = 1;
|
|
1308
|
+
|
|
1309
|
+
depthTextureData.viewCache[ layerIndex ] = depthTextureData.texture.createView( _viewDescriptor );
|
|
1310
|
+
|
|
1311
|
+
}
|
|
1312
|
+
|
|
1313
|
+
_viewDescriptor.reset();
|
|
1314
|
+
|
|
1315
|
+
}
|
|
1316
|
+
|
|
1317
|
+
const layerDepthStencilAttachment = new GPURenderPassDepthStencilAttachment();
|
|
1318
|
+
layerDepthStencilAttachment.view = depthTextureData.viewCache[ layerIndex ];
|
|
1319
|
+
layerDepthStencilAttachment.depthLoadOp = depthStencilAttachment.depthLoadOp || GPULoadOp.Clear;
|
|
1320
|
+
layerDepthStencilAttachment.depthStoreOp = depthStencilAttachment.depthStoreOp || GPUStoreOp.Store;
|
|
1321
|
+
layerDepthStencilAttachment.depthClearValue = depthStencilAttachment.depthClearValue ?? 1.0;
|
|
1322
|
+
|
|
1323
|
+
if ( renderContext.stencil ) {
|
|
1324
|
+
|
|
1325
|
+
layerDepthStencilAttachment.stencilLoadOp = depthStencilAttachment.stencilLoadOp;
|
|
1326
|
+
layerDepthStencilAttachment.stencilStoreOp = depthStencilAttachment.stencilStoreOp;
|
|
1327
|
+
layerDepthStencilAttachment.stencilClearValue = depthStencilAttachment.stencilClearValue;
|
|
1328
|
+
|
|
1329
|
+
}
|
|
1330
|
+
|
|
1331
|
+
layerDescriptor.depthStencilAttachment = layerDepthStencilAttachment;
|
|
1332
|
+
|
|
1333
|
+
} else {
|
|
1334
|
+
|
|
1335
|
+
const layerDepthStencilAttachment = new GPURenderPassDepthStencilAttachment();
|
|
1336
|
+
layerDepthStencilAttachment.view = depthStencilAttachment.view;
|
|
1337
|
+
layerDepthStencilAttachment.depthLoadOp = depthStencilAttachment.depthLoadOp;
|
|
1338
|
+
layerDepthStencilAttachment.depthStoreOp = depthStencilAttachment.depthStoreOp;
|
|
1339
|
+
layerDepthStencilAttachment.depthClearValue = depthStencilAttachment.depthClearValue;
|
|
1340
|
+
layerDepthStencilAttachment.depthReadOnly = depthStencilAttachment.depthReadOnly;
|
|
1341
|
+
layerDepthStencilAttachment.stencilLoadOp = depthStencilAttachment.stencilLoadOp;
|
|
1342
|
+
layerDepthStencilAttachment.stencilStoreOp = depthStencilAttachment.stencilStoreOp;
|
|
1343
|
+
layerDepthStencilAttachment.stencilClearValue = depthStencilAttachment.stencilClearValue;
|
|
1344
|
+
layerDepthStencilAttachment.stencilReadOnly = depthStencilAttachment.stencilReadOnly;
|
|
1345
|
+
layerDescriptor.depthStencilAttachment = layerDepthStencilAttachment;
|
|
1346
|
+
|
|
1347
|
+
}
|
|
1348
|
+
|
|
1349
|
+
renderContextData.layerDescriptors.push( layerDescriptor );
|
|
1350
|
+
|
|
1351
|
+
}
|
|
1352
|
+
|
|
1353
|
+
}
|
|
1354
|
+
|
|
1355
|
+
/**
|
|
1356
|
+
* Updates render pass descriptors for each camera in an array camera.
|
|
1357
|
+
*
|
|
1358
|
+
* @param {RenderContext} renderContext - The render context.
|
|
1359
|
+
* @param {Object} renderContextData - The render context data.
|
|
1360
|
+
* @param {Object} descriptor - The render pass descriptor.
|
|
1361
|
+
* @param {ArrayCamera} cameras - The array camera.
|
|
1362
|
+
*
|
|
1363
|
+
*/
|
|
1364
|
+
_updateArrayCameraLayerDescriptors( renderContext, renderContextData, descriptor, cameras ) {
|
|
1365
|
+
|
|
1366
|
+
const renderTarget = renderContext.renderTarget;
|
|
1367
|
+
const discardDepth = renderContext.sampleCount > 1 && renderTarget?.storeMultisampledDepthBuffer === false;
|
|
1368
|
+
const discardStencil = renderContext.sampleCount > 1 && renderTarget?.storeMultisampledStencilBuffer === false;
|
|
1369
|
+
|
|
1370
|
+
for ( let i = 0; i < cameras.length; i ++ ) {
|
|
1371
|
+
|
|
1372
|
+
const layerDescriptor = renderContextData.layerDescriptors[ i ];
|
|
1373
|
+
layerDescriptor.timestampWrites = descriptor.timestampWrites;
|
|
1374
|
+
|
|
1375
|
+
if ( descriptor.colorAttachments.length > 0 ) {
|
|
1376
|
+
|
|
1377
|
+
const sourceColorAttachment = descriptor.colorAttachments[ 0 ];
|
|
1378
|
+
const layerColorAttachment = descriptor.colorAttachments[ i ];
|
|
1379
|
+
const colorAttachment = layerDescriptor.colorAttachments[ 0 ];
|
|
1380
|
+
|
|
1381
|
+
colorAttachment.view = layerColorAttachment.view;
|
|
1382
|
+
colorAttachment.resolveTarget = layerColorAttachment.resolveTarget;
|
|
1383
|
+
colorAttachment.depthSlice = layerColorAttachment.depthSlice;
|
|
1384
|
+
colorAttachment.loadOp = sourceColorAttachment.loadOp;
|
|
1385
|
+
colorAttachment.storeOp = sourceColorAttachment.storeOp;
|
|
1386
|
+
colorAttachment.clearValue = sourceColorAttachment.clearValue;
|
|
1387
|
+
|
|
1388
|
+
}
|
|
1389
|
+
|
|
1390
|
+
if ( layerDescriptor.depthStencilAttachment ) {
|
|
1391
|
+
|
|
1392
|
+
const depthAttachment = layerDescriptor.depthStencilAttachment;
|
|
1393
|
+
|
|
1394
|
+
if ( renderContext.depth ) {
|
|
1395
|
+
|
|
1396
|
+
if ( renderContext.clearDepth || discardDepth ) {
|
|
1397
|
+
|
|
1398
|
+
depthAttachment.depthClearValue = renderContext.clearDepthValue;
|
|
1399
|
+
depthAttachment.depthLoadOp = GPULoadOp.Clear;
|
|
1400
|
+
|
|
1401
|
+
} else {
|
|
1402
|
+
|
|
1403
|
+
depthAttachment.depthLoadOp = GPULoadOp.Load;
|
|
1404
|
+
|
|
1405
|
+
}
|
|
1406
|
+
|
|
1407
|
+
}
|
|
1408
|
+
|
|
1409
|
+
if ( renderContext.stencil ) {
|
|
1410
|
+
|
|
1411
|
+
if ( renderContext.clearStencil || discardStencil ) {
|
|
1412
|
+
|
|
1413
|
+
depthAttachment.stencilClearValue = renderContext.clearStencilValue;
|
|
1414
|
+
depthAttachment.stencilLoadOp = GPULoadOp.Clear;
|
|
1415
|
+
|
|
1416
|
+
} else {
|
|
1417
|
+
|
|
1418
|
+
depthAttachment.stencilLoadOp = GPULoadOp.Load;
|
|
1419
|
+
|
|
1420
|
+
}
|
|
1421
|
+
|
|
1422
|
+
}
|
|
1423
|
+
|
|
1424
|
+
}
|
|
1425
|
+
|
|
1426
|
+
}
|
|
1427
|
+
|
|
1428
|
+
}
|
|
1429
|
+
|
|
1430
|
+
/**
|
|
1431
|
+
* This method is executed at the end of a render call and finalizes work
|
|
1432
|
+
* after draw calls.
|
|
1433
|
+
*
|
|
1434
|
+
* @param {RenderContext} renderContext - The render context.
|
|
1435
|
+
*/
|
|
1436
|
+
finishRender( renderContext ) {
|
|
1437
|
+
|
|
1438
|
+
const renderContextData = this.get( renderContext );
|
|
1439
|
+
const occlusionQueryCount = renderContext.occlusionQueryCount;
|
|
1440
|
+
const occlusionData = this.getOcclusionData( renderContext );
|
|
1441
|
+
|
|
1442
|
+
if ( renderContextData.renderBundles.length > 0 ) {
|
|
1443
|
+
|
|
1444
|
+
renderContextData.currentPass.executeBundles( renderContextData.renderBundles );
|
|
1445
|
+
|
|
1446
|
+
}
|
|
1447
|
+
|
|
1448
|
+
const lastOcclusionObject = occlusionData.lastOcclusionObject;
|
|
1449
|
+
|
|
1450
|
+
if ( lastOcclusionObject && lastOcclusionObject.occlusionTest === true ) {
|
|
1451
|
+
|
|
1452
|
+
renderContextData.currentPass.endOcclusionQuery();
|
|
1453
|
+
|
|
1454
|
+
}
|
|
1455
|
+
|
|
1456
|
+
// Layered render targets: execute the bundle for each layer.
|
|
1457
|
+
|
|
1458
|
+
const encoder = renderContextData.encoder;
|
|
1459
|
+
|
|
1460
|
+
if ( this._isRenderCameraDepthArray( renderContext ) === true ) {
|
|
1461
|
+
|
|
1462
|
+
const bundles = this._finishArrayCameraBundleEncoders( renderContextData );
|
|
1463
|
+
const renderStages = renderContextData.arrayCameraRenderStages;
|
|
1464
|
+
renderStages.push( { bundles } );
|
|
1465
|
+
|
|
1466
|
+
// A viewport texture is 2D, so each layer must be captured immediately before that layer samples it.
|
|
1467
|
+
for ( let i = 0; i < renderContextData.layerDescriptors.length; i ++ ) {
|
|
1468
|
+
|
|
1469
|
+
const layerDescriptor = renderContextData.layerDescriptors[ i ];
|
|
1470
|
+
const colorLoadOps = layerDescriptor.colorAttachments.map( attachment => attachment.loadOp );
|
|
1471
|
+
const colorStoreOps = layerDescriptor.colorAttachments.map( attachment => attachment.storeOp );
|
|
1472
|
+
const depthLoadOp = layerDescriptor.depthStencilAttachment?.depthLoadOp;
|
|
1473
|
+
const depthStoreOp = layerDescriptor.depthStencilAttachment?.depthStoreOp;
|
|
1474
|
+
const stencilLoadOp = layerDescriptor.depthStencilAttachment?.stencilLoadOp;
|
|
1475
|
+
const stencilStoreOp = layerDescriptor.depthStencilAttachment?.stencilStoreOp;
|
|
1476
|
+
|
|
1477
|
+
for ( let stageIndex = 0; stageIndex < renderStages.length; stageIndex ++ ) {
|
|
1478
|
+
|
|
1479
|
+
const renderStage = renderStages[ stageIndex ];
|
|
1480
|
+
const bundle = renderStage.bundles[ i ];
|
|
1481
|
+
const isLastStage = stageIndex === renderStages.length - 1;
|
|
1482
|
+
|
|
1483
|
+
for ( let j = 0; j < layerDescriptor.colorAttachments.length; j ++ ) {
|
|
1484
|
+
|
|
1485
|
+
const attachment = layerDescriptor.colorAttachments[ j ];
|
|
1486
|
+
attachment.loadOp = stageIndex === 0 ? colorLoadOps[ j ] : GPULoadOp.Load;
|
|
1487
|
+
attachment.storeOp = isLastStage ? colorStoreOps[ j ] : GPUStoreOp.Store;
|
|
1488
|
+
|
|
1489
|
+
}
|
|
1490
|
+
|
|
1491
|
+
if ( renderContext.depth ) {
|
|
1492
|
+
|
|
1493
|
+
layerDescriptor.depthStencilAttachment.depthLoadOp = stageIndex === 0 ? depthLoadOp : GPULoadOp.Load;
|
|
1494
|
+
layerDescriptor.depthStencilAttachment.depthStoreOp = isLastStage ? depthStoreOp : GPUStoreOp.Store;
|
|
1495
|
+
|
|
1496
|
+
}
|
|
1497
|
+
|
|
1498
|
+
if ( renderContext.stencil ) {
|
|
1499
|
+
|
|
1500
|
+
layerDescriptor.depthStencilAttachment.stencilLoadOp = stageIndex === 0 ? stencilLoadOp : GPULoadOp.Load;
|
|
1501
|
+
layerDescriptor.depthStencilAttachment.stencilStoreOp = isLastStage ? stencilStoreOp : GPUStoreOp.Store;
|
|
1502
|
+
|
|
1503
|
+
}
|
|
1504
|
+
|
|
1505
|
+
const renderPass = encoder.beginRenderPass( layerDescriptor );
|
|
1506
|
+
|
|
1507
|
+
if ( renderContext.viewport ) {
|
|
1508
|
+
|
|
1509
|
+
const { x, y, width, height, minDepth, maxDepth } = renderContext.viewportValue;
|
|
1510
|
+
renderPass.setViewport( x, y, width, height, minDepth, maxDepth );
|
|
1511
|
+
|
|
1512
|
+
}
|
|
1513
|
+
|
|
1514
|
+
if ( renderContext.scissor ) {
|
|
1515
|
+
|
|
1516
|
+
const { x, y, width, height } = renderContext.scissorValue;
|
|
1517
|
+
renderPass.setScissorRect( x, y, width, height );
|
|
1518
|
+
|
|
1519
|
+
}
|
|
1520
|
+
|
|
1521
|
+
renderPass.executeBundles( [ bundle ] );
|
|
1522
|
+
|
|
1523
|
+
renderPass.end();
|
|
1524
|
+
|
|
1525
|
+
if ( renderStage.framebufferCopy !== undefined ) {
|
|
1526
|
+
|
|
1527
|
+
const { texture, sourceGPU, destinationGPU, rectangle, generateMipmaps } = renderStage.framebufferCopy;
|
|
1528
|
+
|
|
1529
|
+
this._copyFramebufferToTexture( encoder, texture, sourceGPU, destinationGPU, rectangle, i, generateMipmaps );
|
|
1530
|
+
|
|
1531
|
+
}
|
|
1532
|
+
|
|
1533
|
+
}
|
|
1534
|
+
|
|
1535
|
+
for ( let j = 0; j < layerDescriptor.colorAttachments.length; j ++ ) {
|
|
1536
|
+
|
|
1537
|
+
layerDescriptor.colorAttachments[ j ].loadOp = colorLoadOps[ j ];
|
|
1538
|
+
layerDescriptor.colorAttachments[ j ].storeOp = colorStoreOps[ j ];
|
|
1539
|
+
|
|
1540
|
+
}
|
|
1541
|
+
|
|
1542
|
+
if ( renderContext.depth ) {
|
|
1543
|
+
|
|
1544
|
+
layerDescriptor.depthStencilAttachment.depthLoadOp = depthLoadOp;
|
|
1545
|
+
layerDescriptor.depthStencilAttachment.depthStoreOp = depthStoreOp;
|
|
1546
|
+
|
|
1547
|
+
}
|
|
1548
|
+
|
|
1549
|
+
if ( renderContext.stencil ) {
|
|
1550
|
+
|
|
1551
|
+
layerDescriptor.depthStencilAttachment.stencilLoadOp = stencilLoadOp;
|
|
1552
|
+
layerDescriptor.depthStencilAttachment.stencilStoreOp = stencilStoreOp;
|
|
1553
|
+
|
|
1554
|
+
}
|
|
1555
|
+
|
|
1556
|
+
}
|
|
1557
|
+
|
|
1558
|
+
} else if ( renderContextData.currentPass ) {
|
|
1559
|
+
|
|
1560
|
+
renderContextData.currentPass.end();
|
|
1561
|
+
|
|
1562
|
+
}
|
|
1563
|
+
|
|
1564
|
+
if ( occlusionQueryCount > 0 ) {
|
|
1565
|
+
|
|
1566
|
+
const bufferSize = occlusionQueryCount * 8; // 8 byte entries for query results
|
|
1567
|
+
|
|
1568
|
+
//
|
|
1569
|
+
|
|
1570
|
+
let queryResolveBuffer = this.occludedResolveCache.get( bufferSize );
|
|
1571
|
+
|
|
1572
|
+
if ( queryResolveBuffer === undefined ) {
|
|
1573
|
+
|
|
1574
|
+
_bufferDescriptor.size = bufferSize;
|
|
1575
|
+
_bufferDescriptor.usage = GPUBufferUsage.QUERY_RESOLVE | GPUBufferUsage.COPY_SRC;
|
|
1576
|
+
|
|
1577
|
+
queryResolveBuffer = this.device.createBuffer( _bufferDescriptor );
|
|
1578
|
+
|
|
1579
|
+
_bufferDescriptor.reset();
|
|
1580
|
+
|
|
1581
|
+
this.occludedResolveCache.set( bufferSize, queryResolveBuffer );
|
|
1582
|
+
|
|
1583
|
+
}
|
|
1584
|
+
|
|
1585
|
+
//
|
|
1586
|
+
|
|
1587
|
+
_bufferDescriptor.size = bufferSize;
|
|
1588
|
+
_bufferDescriptor.usage = GPUBufferUsage.COPY_DST | GPUBufferUsage.MAP_READ;
|
|
1589
|
+
|
|
1590
|
+
const readBuffer = this.device.createBuffer( _bufferDescriptor );
|
|
1591
|
+
|
|
1592
|
+
_bufferDescriptor.reset();
|
|
1593
|
+
|
|
1594
|
+
// two buffers required here - WebGPU doesn't allow usage of QUERY_RESOLVE & MAP_READ to be combined
|
|
1595
|
+
renderContextData.encoder.resolveQuerySet( occlusionData.occlusionQuerySet, 0, occlusionQueryCount, queryResolveBuffer, 0 );
|
|
1596
|
+
renderContextData.encoder.copyBufferToBuffer( queryResolveBuffer, 0, readBuffer, 0, bufferSize );
|
|
1597
|
+
|
|
1598
|
+
occlusionData.occlusionQueryBuffer = readBuffer;
|
|
1599
|
+
|
|
1600
|
+
//
|
|
1601
|
+
|
|
1602
|
+
this.resolveOccludedAsync( renderContext );
|
|
1603
|
+
|
|
1604
|
+
}
|
|
1605
|
+
|
|
1606
|
+
submit( this.device, renderContextData.encoder.finish() );
|
|
1607
|
+
|
|
1608
|
+
// pass and encoder are only valid between beginRender() and finishRender()
|
|
1609
|
+
|
|
1610
|
+
renderContextData.currentPass = null;
|
|
1611
|
+
renderContextData.encoder = null;
|
|
1612
|
+
|
|
1613
|
+
//
|
|
1614
|
+
|
|
1615
|
+
if ( renderContext.textures !== null ) {
|
|
1616
|
+
|
|
1617
|
+
const textures = renderContext.textures;
|
|
1618
|
+
|
|
1619
|
+
for ( let i = 0; i < textures.length; i ++ ) {
|
|
1620
|
+
|
|
1621
|
+
const texture = textures[ i ];
|
|
1622
|
+
|
|
1623
|
+
if ( texture.generateMipmaps === true && texture.mipmapsAutoUpdate === true ) {
|
|
1624
|
+
|
|
1625
|
+
this.textureUtils.generateMipmaps( texture );
|
|
1626
|
+
|
|
1627
|
+
}
|
|
1628
|
+
|
|
1629
|
+
}
|
|
1630
|
+
|
|
1631
|
+
}
|
|
1632
|
+
|
|
1633
|
+
}
|
|
1634
|
+
|
|
1635
|
+
/**
|
|
1636
|
+
* Returns `true` if the given 3D object is fully occluded by other
|
|
1637
|
+
* 3D objects in the scene.
|
|
1638
|
+
*
|
|
1639
|
+
* @param {RenderContext} renderContext - The render context.
|
|
1640
|
+
* @param {Object3D} object - The 3D object to test.
|
|
1641
|
+
* @return {boolean} Whether the 3D object is fully occluded or not.
|
|
1642
|
+
*/
|
|
1643
|
+
isOccluded( renderContext, object ) {
|
|
1644
|
+
|
|
1645
|
+
const occlusionData = this.getOcclusionData( renderContext );
|
|
1646
|
+
|
|
1647
|
+
return occlusionData.occluded && occlusionData.occluded.has( object );
|
|
1648
|
+
|
|
1649
|
+
}
|
|
1650
|
+
|
|
1651
|
+
/**
|
|
1652
|
+
* This method processes the result of occlusion queries and writes it
|
|
1653
|
+
* into the occlusion data of the render context.
|
|
1654
|
+
*
|
|
1655
|
+
* @async
|
|
1656
|
+
* @param {RenderContext} renderContext - The render context.
|
|
1657
|
+
* @return {Promise} A Promise that resolves when the occlusion query results have been processed.
|
|
1658
|
+
*/
|
|
1659
|
+
async resolveOccludedAsync( renderContext ) {
|
|
1660
|
+
|
|
1661
|
+
const occlusionData = this.getOcclusionData( renderContext );
|
|
1662
|
+
|
|
1663
|
+
// handle occlusion query results
|
|
1664
|
+
|
|
1665
|
+
const { currentOcclusionQueryBuffer, currentOcclusionQueryObjects } = occlusionData;
|
|
1666
|
+
|
|
1667
|
+
if ( currentOcclusionQueryBuffer && currentOcclusionQueryObjects ) {
|
|
1668
|
+
|
|
1669
|
+
const occluded = new WeakSet();
|
|
1670
|
+
|
|
1671
|
+
occlusionData.currentOcclusionQueryObjects = null;
|
|
1672
|
+
occlusionData.currentOcclusionQueryBuffer = null;
|
|
1673
|
+
|
|
1674
|
+
await currentOcclusionQueryBuffer.mapAsync( GPUMapMode.READ );
|
|
1675
|
+
|
|
1676
|
+
const buffer = currentOcclusionQueryBuffer.getMappedRange();
|
|
1677
|
+
const results = new BigUint64Array( buffer );
|
|
1678
|
+
|
|
1679
|
+
for ( let i = 0; i < currentOcclusionQueryObjects.length; i ++ ) {
|
|
1680
|
+
|
|
1681
|
+
const object = currentOcclusionQueryObjects[ i ];
|
|
1682
|
+
|
|
1683
|
+
if ( object !== undefined && results[ i ] === BigInt( 0 ) ) {
|
|
1684
|
+
|
|
1685
|
+
occluded.add( object );
|
|
1686
|
+
|
|
1687
|
+
}
|
|
1688
|
+
|
|
1689
|
+
}
|
|
1690
|
+
|
|
1691
|
+
currentOcclusionQueryBuffer.destroy();
|
|
1692
|
+
|
|
1693
|
+
occlusionData.occluded = occluded;
|
|
1694
|
+
|
|
1695
|
+
}
|
|
1696
|
+
|
|
1697
|
+
}
|
|
1698
|
+
|
|
1699
|
+
/**
|
|
1700
|
+
* Updates the viewport with the values from the given render context.
|
|
1701
|
+
*
|
|
1702
|
+
* @param {RenderContext} renderContext - The render context.
|
|
1703
|
+
*/
|
|
1704
|
+
updateViewport( renderContext ) {
|
|
1705
|
+
|
|
1706
|
+
const { currentPass } = this.get( renderContext );
|
|
1707
|
+
const { x, y, width, height, minDepth, maxDepth } = renderContext.viewportValue;
|
|
1708
|
+
|
|
1709
|
+
currentPass.setViewport( x, y, width, height, minDepth, maxDepth );
|
|
1710
|
+
|
|
1711
|
+
}
|
|
1712
|
+
|
|
1713
|
+
/**
|
|
1714
|
+
* Updates the scissor with the values from the given render context.
|
|
1715
|
+
*
|
|
1716
|
+
* @param {RenderContext} renderContext - The render context.
|
|
1717
|
+
*/
|
|
1718
|
+
updateScissor( renderContext ) {
|
|
1719
|
+
|
|
1720
|
+
const { currentPass } = this.get( renderContext );
|
|
1721
|
+
const { x, y, width, height } = renderContext.scissorValue;
|
|
1722
|
+
|
|
1723
|
+
currentPass.setScissorRect( x, y, width, height );
|
|
1724
|
+
|
|
1725
|
+
}
|
|
1726
|
+
|
|
1727
|
+
/**
|
|
1728
|
+
* Returns the clear color and alpha into a single
|
|
1729
|
+
* color object.
|
|
1730
|
+
*
|
|
1731
|
+
* @return {Color4} The clear color.
|
|
1732
|
+
*/
|
|
1733
|
+
getClearColor() {
|
|
1734
|
+
|
|
1735
|
+
const clearColor = super.getClearColor();
|
|
1736
|
+
|
|
1737
|
+
// only premultiply alpha when alphaMode is "premultiplied"
|
|
1738
|
+
|
|
1739
|
+
if ( this.renderer.alpha === true ) {
|
|
1740
|
+
|
|
1741
|
+
clearColor.r *= clearColor.a;
|
|
1742
|
+
clearColor.g *= clearColor.a;
|
|
1743
|
+
clearColor.b *= clearColor.a;
|
|
1744
|
+
|
|
1745
|
+
}
|
|
1746
|
+
|
|
1747
|
+
return clearColor;
|
|
1748
|
+
|
|
1749
|
+
}
|
|
1750
|
+
|
|
1751
|
+
/**
|
|
1752
|
+
* Performs a clear operation.
|
|
1753
|
+
*
|
|
1754
|
+
* @param {boolean} color - Whether the color buffer should be cleared or not.
|
|
1755
|
+
* @param {boolean} depth - Whether the depth buffer should be cleared or not.
|
|
1756
|
+
* @param {boolean} stencil - Whether the stencil buffer should be cleared or not.
|
|
1757
|
+
* @param {?RenderContext} [renderTargetContext=null] - The render context of the current set render target.
|
|
1758
|
+
*/
|
|
1759
|
+
clear( color, depth, stencil, renderTargetContext = null ) {
|
|
1760
|
+
|
|
1761
|
+
const device = this.device;
|
|
1762
|
+
const renderer = this.renderer;
|
|
1763
|
+
|
|
1764
|
+
let colorAttachments = [];
|
|
1765
|
+
let depthStencilAttachment;
|
|
1766
|
+
|
|
1767
|
+
let supportsDepth;
|
|
1768
|
+
let supportsStencil;
|
|
1769
|
+
|
|
1770
|
+
if ( color ) {
|
|
1771
|
+
|
|
1772
|
+
const clearColor = this.getClearColor();
|
|
1773
|
+
|
|
1774
|
+
_clearValue.r = clearColor.r;
|
|
1775
|
+
_clearValue.g = clearColor.g;
|
|
1776
|
+
_clearValue.b = clearColor.b;
|
|
1777
|
+
_clearValue.a = clearColor.a;
|
|
1778
|
+
|
|
1779
|
+
}
|
|
1780
|
+
|
|
1781
|
+
if ( renderTargetContext === null ) {
|
|
1782
|
+
|
|
1783
|
+
supportsDepth = renderer.depth;
|
|
1784
|
+
supportsStencil = renderer.stencil;
|
|
1785
|
+
|
|
1786
|
+
const descriptor = this._getDefaultRenderPassDescriptor();
|
|
1787
|
+
|
|
1788
|
+
if ( color ) {
|
|
1789
|
+
|
|
1790
|
+
colorAttachments = descriptor.colorAttachments;
|
|
1791
|
+
|
|
1792
|
+
const colorAttachment = colorAttachments[ 0 ];
|
|
1793
|
+
|
|
1794
|
+
colorAttachment.clearValue = _clearValue;
|
|
1795
|
+
colorAttachment.loadOp = GPULoadOp.Clear;
|
|
1796
|
+
colorAttachment.storeOp = GPUStoreOp.Store;
|
|
1797
|
+
|
|
1798
|
+
}
|
|
1799
|
+
|
|
1800
|
+
if ( supportsDepth || supportsStencil ) {
|
|
1801
|
+
|
|
1802
|
+
depthStencilAttachment = descriptor.depthStencilAttachment;
|
|
1803
|
+
|
|
1804
|
+
}
|
|
1805
|
+
|
|
1806
|
+
} else {
|
|
1807
|
+
|
|
1808
|
+
supportsDepth = renderTargetContext.depth;
|
|
1809
|
+
supportsStencil = renderTargetContext.stencil;
|
|
1810
|
+
|
|
1811
|
+
const clearConfig = {
|
|
1812
|
+
loadOp: color ? GPULoadOp.Clear : GPULoadOp.Load,
|
|
1813
|
+
clearValue: color ? _clearValue : undefined
|
|
1814
|
+
};
|
|
1815
|
+
|
|
1816
|
+
if ( supportsDepth ) {
|
|
1817
|
+
|
|
1818
|
+
clearConfig.depthLoadOp = depth ? GPULoadOp.Clear : GPULoadOp.Load;
|
|
1819
|
+
clearConfig.depthClearValue = depth ? renderer.getClearDepth() : undefined;
|
|
1820
|
+
clearConfig.depthStoreOp = GPUStoreOp.Store;
|
|
1821
|
+
|
|
1822
|
+
}
|
|
1823
|
+
|
|
1824
|
+
if ( supportsStencil ) {
|
|
1825
|
+
|
|
1826
|
+
clearConfig.stencilLoadOp = stencil ? GPULoadOp.Clear : GPULoadOp.Load;
|
|
1827
|
+
clearConfig.stencilClearValue = stencil ? renderer.getClearStencil() : undefined;
|
|
1828
|
+
clearConfig.stencilStoreOp = GPUStoreOp.Store;
|
|
1829
|
+
|
|
1830
|
+
}
|
|
1831
|
+
|
|
1832
|
+
const descriptor = this._getRenderPassDescriptor( renderTargetContext, clearConfig );
|
|
1833
|
+
|
|
1834
|
+
colorAttachments = descriptor.colorAttachments;
|
|
1835
|
+
depthStencilAttachment = descriptor.depthStencilAttachment;
|
|
1836
|
+
|
|
1837
|
+
}
|
|
1838
|
+
|
|
1839
|
+
if ( supportsDepth && depthStencilAttachment ) {
|
|
1840
|
+
|
|
1841
|
+
if ( depth ) {
|
|
1842
|
+
|
|
1843
|
+
depthStencilAttachment.depthLoadOp = GPULoadOp.Clear;
|
|
1844
|
+
depthStencilAttachment.depthClearValue = renderer.getClearDepth();
|
|
1845
|
+
depthStencilAttachment.depthStoreOp = GPUStoreOp.Store;
|
|
1846
|
+
|
|
1847
|
+
} else {
|
|
1848
|
+
|
|
1849
|
+
depthStencilAttachment.depthLoadOp = GPULoadOp.Load;
|
|
1850
|
+
depthStencilAttachment.depthStoreOp = GPUStoreOp.Store;
|
|
1851
|
+
|
|
1852
|
+
}
|
|
1853
|
+
|
|
1854
|
+
}
|
|
1855
|
+
|
|
1856
|
+
//
|
|
1857
|
+
|
|
1858
|
+
if ( supportsStencil && depthStencilAttachment ) {
|
|
1859
|
+
|
|
1860
|
+
if ( stencil ) {
|
|
1861
|
+
|
|
1862
|
+
depthStencilAttachment.stencilLoadOp = GPULoadOp.Clear;
|
|
1863
|
+
depthStencilAttachment.stencilClearValue = renderer.getClearStencil();
|
|
1864
|
+
depthStencilAttachment.stencilStoreOp = GPUStoreOp.Store;
|
|
1865
|
+
|
|
1866
|
+
} else {
|
|
1867
|
+
|
|
1868
|
+
depthStencilAttachment.stencilLoadOp = GPULoadOp.Load;
|
|
1869
|
+
depthStencilAttachment.stencilStoreOp = GPUStoreOp.Store;
|
|
1870
|
+
|
|
1871
|
+
}
|
|
1872
|
+
|
|
1873
|
+
}
|
|
1874
|
+
|
|
1875
|
+
//
|
|
1876
|
+
|
|
1877
|
+
_commandEncoderDescriptor.label = 'clear';
|
|
1878
|
+
const encoder = device.createCommandEncoder( _commandEncoderDescriptor );
|
|
1879
|
+
_commandEncoderDescriptor.reset();
|
|
1880
|
+
|
|
1881
|
+
const currentPass = encoder.beginRenderPass( {
|
|
1882
|
+
colorAttachments,
|
|
1883
|
+
depthStencilAttachment
|
|
1884
|
+
} );
|
|
1885
|
+
|
|
1886
|
+
currentPass.end();
|
|
1887
|
+
|
|
1888
|
+
submit( device, encoder.finish() );
|
|
1889
|
+
|
|
1890
|
+
}
|
|
1891
|
+
|
|
1892
|
+
// compute
|
|
1893
|
+
|
|
1894
|
+
/**
|
|
1895
|
+
* This method is executed at the beginning of a compute call and
|
|
1896
|
+
* prepares the state for upcoming compute tasks.
|
|
1897
|
+
*
|
|
1898
|
+
* @param {Node|Array<Node>} computeGroup - The compute node(s).
|
|
1899
|
+
*/
|
|
1900
|
+
beginCompute( computeGroup ) {
|
|
1901
|
+
|
|
1902
|
+
const groupGPU = this.get( computeGroup );
|
|
1903
|
+
|
|
1904
|
+
//
|
|
1905
|
+
|
|
1906
|
+
const label = 'computeGroup_' + computeGroup.id;
|
|
1907
|
+
|
|
1908
|
+
_computePassDescriptor.label = label;
|
|
1909
|
+
_commandEncoderDescriptor.label = label;
|
|
1910
|
+
|
|
1911
|
+
this.initTimestampQuery( TimestampQuery.COMPUTE, this.getTimestampUID( computeGroup ), _computePassDescriptor );
|
|
1912
|
+
|
|
1913
|
+
groupGPU.cmdEncoderGPU = this.device.createCommandEncoder( _commandEncoderDescriptor );
|
|
1914
|
+
groupGPU.passEncoderGPU = groupGPU.cmdEncoderGPU.beginComputePass( _computePassDescriptor );
|
|
1915
|
+
groupGPU.currentPipeline = null;
|
|
1916
|
+
|
|
1917
|
+
_commandEncoderDescriptor.reset();
|
|
1918
|
+
_computePassDescriptor.reset();
|
|
1919
|
+
|
|
1920
|
+
}
|
|
1921
|
+
|
|
1922
|
+
/**
|
|
1923
|
+
* Executes a compute command for the given compute node.
|
|
1924
|
+
*
|
|
1925
|
+
* @param {Node|Array<Node>} computeGroup - The group of compute nodes of a compute call. Can be a single compute node.
|
|
1926
|
+
* @param {Node} computeNode - The compute node.
|
|
1927
|
+
* @param {Array<BindGroup>} bindings - The bindings.
|
|
1928
|
+
* @param {ComputePipeline} pipeline - The compute pipeline.
|
|
1929
|
+
* @param {number|Array<number>|IndirectStorageBufferAttribute} [dispatchSize=null]
|
|
1930
|
+
* - A single number representing count, or
|
|
1931
|
+
* - An array [x, y, z] representing dispatch size, or
|
|
1932
|
+
* - A IndirectStorageBufferAttribute for indirect dispatch size.
|
|
1933
|
+
*/
|
|
1934
|
+
compute( computeGroup, computeNode, bindings, pipeline, dispatchSize = null ) {
|
|
1935
|
+
|
|
1936
|
+
const computeNodeData = this.get( computeNode );
|
|
1937
|
+
const groupGPU = this.get( computeGroup );
|
|
1938
|
+
const { passEncoderGPU } = groupGPU;
|
|
1939
|
+
|
|
1940
|
+
// pipeline
|
|
1941
|
+
|
|
1942
|
+
const pipelineGPU = this.get( pipeline ).pipeline;
|
|
1943
|
+
|
|
1944
|
+
if ( groupGPU.currentPipeline !== pipelineGPU ) {
|
|
1945
|
+
|
|
1946
|
+
passEncoderGPU.setPipeline( pipelineGPU );
|
|
1947
|
+
groupGPU.currentPipeline = pipelineGPU;
|
|
1948
|
+
|
|
1949
|
+
}
|
|
1950
|
+
|
|
1951
|
+
// bind groups
|
|
1952
|
+
|
|
1953
|
+
for ( let i = 0, l = bindings.length; i < l; i ++ ) {
|
|
1954
|
+
|
|
1955
|
+
const bindGroup = bindings[ i ];
|
|
1956
|
+
const bindingsData = this.get( bindGroup );
|
|
1957
|
+
|
|
1958
|
+
passEncoderGPU.setBindGroup( i, bindingsData.group );
|
|
1959
|
+
|
|
1960
|
+
}
|
|
1961
|
+
|
|
1962
|
+
if ( dispatchSize === null ) {
|
|
1963
|
+
|
|
1964
|
+
dispatchSize = computeNode.dispatchSize || computeNode.count;
|
|
1965
|
+
|
|
1966
|
+
}
|
|
1967
|
+
|
|
1968
|
+
// When the dispatchSize is set with a StorageBuffer from the GPU.
|
|
1969
|
+
|
|
1970
|
+
if ( dispatchSize && dispatchSize.isIndirectStorageBufferAttribute ) {
|
|
1971
|
+
|
|
1972
|
+
const dispatchBuffer = this.get( dispatchSize ).buffer;
|
|
1973
|
+
|
|
1974
|
+
passEncoderGPU.dispatchWorkgroupsIndirect( dispatchBuffer, 0 );
|
|
1975
|
+
|
|
1976
|
+
return;
|
|
1977
|
+
|
|
1978
|
+
}
|
|
1979
|
+
|
|
1980
|
+
if ( typeof dispatchSize === 'number' ) {
|
|
1981
|
+
|
|
1982
|
+
// If a single number is given, we calculate the dispatch size based on the workgroup size
|
|
1983
|
+
|
|
1984
|
+
const count = dispatchSize;
|
|
1985
|
+
|
|
1986
|
+
if ( computeNodeData.dispatchSize === undefined || computeNodeData.count !== count ) {
|
|
1987
|
+
|
|
1988
|
+
// cache dispatch size to avoid recalculating it every time
|
|
1989
|
+
|
|
1990
|
+
computeNodeData.dispatchSize = [ 0, 1, 1 ];
|
|
1991
|
+
computeNodeData.count = count;
|
|
1992
|
+
|
|
1993
|
+
const workgroupSize = computeNode.workgroupSize;
|
|
1994
|
+
|
|
1995
|
+
let size = workgroupSize[ 0 ];
|
|
1996
|
+
|
|
1997
|
+
for ( let i = 1; i < workgroupSize.length; i ++ )
|
|
1998
|
+
size *= workgroupSize[ i ];
|
|
1999
|
+
|
|
2000
|
+
const dispatchCount = Math.ceil( count / size );
|
|
2001
|
+
|
|
2002
|
+
//
|
|
2003
|
+
|
|
2004
|
+
const maxComputeWorkgroupsPerDimension = this.device.limits.maxComputeWorkgroupsPerDimension;
|
|
2005
|
+
|
|
2006
|
+
dispatchSize = [ dispatchCount, 1, 1 ];
|
|
2007
|
+
|
|
2008
|
+
if ( dispatchCount > maxComputeWorkgroupsPerDimension ) {
|
|
2009
|
+
|
|
2010
|
+
dispatchSize[ 0 ] = Math.min( dispatchCount, maxComputeWorkgroupsPerDimension );
|
|
2011
|
+
dispatchSize[ 1 ] = Math.ceil( dispatchCount / maxComputeWorkgroupsPerDimension );
|
|
2012
|
+
|
|
2013
|
+
}
|
|
2014
|
+
|
|
2015
|
+
computeNodeData.dispatchSize = dispatchSize;
|
|
2016
|
+
|
|
2017
|
+
}
|
|
2018
|
+
|
|
2019
|
+
dispatchSize = computeNodeData.dispatchSize;
|
|
2020
|
+
|
|
2021
|
+
}
|
|
2022
|
+
|
|
2023
|
+
//
|
|
2024
|
+
|
|
2025
|
+
passEncoderGPU.dispatchWorkgroups(
|
|
2026
|
+
dispatchSize[ 0 ],
|
|
2027
|
+
dispatchSize[ 1 ] || 1,
|
|
2028
|
+
dispatchSize[ 2 ] || 1
|
|
2029
|
+
);
|
|
2030
|
+
|
|
2031
|
+
}
|
|
2032
|
+
|
|
2033
|
+
/**
|
|
2034
|
+
* This method is executed at the end of a compute call and
|
|
2035
|
+
* finalizes work after compute tasks.
|
|
2036
|
+
*
|
|
2037
|
+
* @param {Node|Array<Node>} computeGroup - The compute node(s).
|
|
2038
|
+
*/
|
|
2039
|
+
finishCompute( computeGroup ) {
|
|
2040
|
+
|
|
2041
|
+
const groupData = this.get( computeGroup );
|
|
2042
|
+
|
|
2043
|
+
groupData.passEncoderGPU.end();
|
|
2044
|
+
|
|
2045
|
+
submit( this.device, groupData.cmdEncoderGPU.finish() );
|
|
2046
|
+
|
|
2047
|
+
}
|
|
2048
|
+
|
|
2049
|
+
/**
|
|
2050
|
+
* Internal draw function that performs the draw with the given pass encoder.
|
|
2051
|
+
*
|
|
2052
|
+
* @private
|
|
2053
|
+
* @param {RenderObject} renderObject - The render object.
|
|
2054
|
+
* @param {Info} info - Holds a series of statistical information about the GPU memory and the rendering process.
|
|
2055
|
+
* @param {Object} renderContextData - The render context data object, holding current pass state and occlusion query tracking.
|
|
2056
|
+
* @param {GPURenderPipeline} pipelineGPU - The GPU render pipeline.
|
|
2057
|
+
* @param {Array<BindGroup>} bindings - The bind groups.
|
|
2058
|
+
* @param {Array<BufferAttribute>} vertexBuffers - The vertex buffers.
|
|
2059
|
+
* @param {{vertexCount: number, firstVertex: number, instanceCount: number, firstInstance: number}} drawParams - The draw parameters.
|
|
2060
|
+
* @param {GPURenderPassEncoder|GPURenderBundleEncoder} passEncoderGPU - The GPU pass encoder used for recording draw commands.
|
|
2061
|
+
* @param {Object} currentSets - Tracking object for currently set pipeline, attributes, bind groups, and index state.
|
|
2062
|
+
* @param {number} [cameraIndexSlot=-1] - Index of the binding slot holding the camera index bind group.
|
|
2063
|
+
*/
|
|
2064
|
+
_draw( renderObject, info, renderContextData, pipelineGPU, bindings, vertexBuffers, drawParams, passEncoderGPU, currentSets, cameraIndexSlot = - 1 ) {
|
|
2065
|
+
|
|
2066
|
+
const { object, material, context } = renderObject;
|
|
2067
|
+
|
|
2068
|
+
const index = renderObject.getIndex();
|
|
2069
|
+
const hasIndex = ( index !== null );
|
|
2070
|
+
|
|
2071
|
+
// pipeline
|
|
2072
|
+
|
|
2073
|
+
if ( currentSets.pipeline !== pipelineGPU ) {
|
|
2074
|
+
|
|
2075
|
+
passEncoderGPU.setPipeline( pipelineGPU );
|
|
2076
|
+
currentSets.pipeline = pipelineGPU;
|
|
2077
|
+
|
|
2078
|
+
}
|
|
2079
|
+
|
|
2080
|
+
// bind groups
|
|
2081
|
+
|
|
2082
|
+
const currentBindingGroups = currentSets.bindingGroups;
|
|
2083
|
+
|
|
2084
|
+
for ( let i = 0, l = bindings.length; i < l; i ++ ) {
|
|
2085
|
+
|
|
2086
|
+
// the camera index slot is bound per sub-camera in draw()
|
|
2087
|
+
|
|
2088
|
+
if ( i === cameraIndexSlot ) continue;
|
|
2089
|
+
|
|
2090
|
+
// compare native bind groups
|
|
2091
|
+
|
|
2092
|
+
const bindGroup = bindings[ i ];
|
|
2093
|
+
const bindGroupGPU = this.get( bindGroup ).group;
|
|
2094
|
+
|
|
2095
|
+
if ( currentBindingGroups[ i ] !== bindGroupGPU ) {
|
|
2096
|
+
|
|
2097
|
+
passEncoderGPU.setBindGroup( i, bindGroupGPU );
|
|
2098
|
+
currentBindingGroups[ i ] = bindGroupGPU;
|
|
2099
|
+
|
|
2100
|
+
}
|
|
2101
|
+
|
|
2102
|
+
}
|
|
2103
|
+
|
|
2104
|
+
// attributes
|
|
2105
|
+
|
|
2106
|
+
// index
|
|
2107
|
+
|
|
2108
|
+
if ( hasIndex === true ) {
|
|
2109
|
+
|
|
2110
|
+
if ( currentSets.index !== index ) {
|
|
2111
|
+
|
|
2112
|
+
const buffer = this.get( index ).buffer;
|
|
2113
|
+
const indexFormat = ( index.array instanceof Uint16Array ) ? GPUIndexFormat.Uint16 : GPUIndexFormat.Uint32;
|
|
2114
|
+
|
|
2115
|
+
passEncoderGPU.setIndexBuffer( buffer, indexFormat );
|
|
2116
|
+
|
|
2117
|
+
currentSets.index = index;
|
|
2118
|
+
|
|
2119
|
+
}
|
|
2120
|
+
|
|
2121
|
+
}
|
|
2122
|
+
|
|
2123
|
+
for ( let i = 0, l = vertexBuffers.length; i < l; i ++ ) {
|
|
2124
|
+
|
|
2125
|
+
const vertexBuffer = vertexBuffers[ i ];
|
|
2126
|
+
|
|
2127
|
+
if ( currentSets.attributes[ i ] !== vertexBuffer ) {
|
|
2128
|
+
|
|
2129
|
+
const buffer = this.get( vertexBuffer ).buffer;
|
|
2130
|
+
passEncoderGPU.setVertexBuffer( i, buffer );
|
|
2131
|
+
|
|
2132
|
+
currentSets.attributes[ i ] = vertexBuffer;
|
|
2133
|
+
|
|
2134
|
+
}
|
|
2135
|
+
|
|
2136
|
+
}
|
|
2137
|
+
// stencil
|
|
2138
|
+
|
|
2139
|
+
if ( context.stencil === true && material.stencilWrite === true && renderContextData.currentStencilRef !== material.stencilRef ) {
|
|
2140
|
+
|
|
2141
|
+
passEncoderGPU.setStencilReference( material.stencilRef );
|
|
2142
|
+
renderContextData.currentStencilRef = material.stencilRef;
|
|
2143
|
+
|
|
2144
|
+
}
|
|
2145
|
+
|
|
2146
|
+
// blend constant
|
|
2147
|
+
|
|
2148
|
+
if ( material.blending === CustomBlending && passEncoderGPU.setBlendConstant !== undefined ) {
|
|
2149
|
+
|
|
2150
|
+
const blendColor = material.blendColor;
|
|
2151
|
+
const blendAlpha = material.blendAlpha;
|
|
2152
|
+
|
|
2153
|
+
if ( blendColor.equals( renderContextData.currentBlendColor ) === false || blendAlpha !== renderContextData.currentBlendAlpha ) {
|
|
2154
|
+
|
|
2155
|
+
_blendConstant.r = blendColor.r;
|
|
2156
|
+
_blendConstant.g = blendColor.g;
|
|
2157
|
+
_blendConstant.b = blendColor.b;
|
|
2158
|
+
_blendConstant.a = blendAlpha;
|
|
2159
|
+
|
|
2160
|
+
passEncoderGPU.setBlendConstant( _blendConstant );
|
|
2161
|
+
|
|
2162
|
+
renderContextData.currentBlendColor.copy( blendColor );
|
|
2163
|
+
renderContextData.currentBlendAlpha = blendAlpha;
|
|
2164
|
+
|
|
2165
|
+
}
|
|
2166
|
+
|
|
2167
|
+
}
|
|
2168
|
+
|
|
2169
|
+
if ( object.isBatchedMesh === true ) {
|
|
2170
|
+
|
|
2171
|
+
const starts = object._mergedDrawStarts;
|
|
2172
|
+
const counts = object._mergedDrawCounts;
|
|
2173
|
+
const instanceCounts = object._mergedDrawInstanceCounts;
|
|
2174
|
+
const drawCount = object._mergedDrawCount;
|
|
2175
|
+
const bytesPerElement = object._multiDrawBytesPerElement;
|
|
2176
|
+
|
|
2177
|
+
let firstInstance = 0;
|
|
2178
|
+
|
|
2179
|
+
for ( let i = 0; i < drawCount; i ++ ) {
|
|
2180
|
+
|
|
2181
|
+
const instanceCount = instanceCounts[ i ];
|
|
2182
|
+
|
|
2183
|
+
if ( hasIndex === true ) {
|
|
2184
|
+
|
|
2185
|
+
passEncoderGPU.drawIndexed( counts[ i ], instanceCount, starts[ i ] / bytesPerElement, 0, firstInstance );
|
|
2186
|
+
|
|
2187
|
+
} else {
|
|
2188
|
+
|
|
2189
|
+
passEncoderGPU.draw( counts[ i ], instanceCount, starts[ i ], firstInstance );
|
|
2190
|
+
|
|
2191
|
+
}
|
|
2192
|
+
|
|
2193
|
+
info.update( object, counts[ i ], instanceCount );
|
|
2194
|
+
|
|
2195
|
+
firstInstance += instanceCount;
|
|
2196
|
+
|
|
2197
|
+
}
|
|
2198
|
+
|
|
2199
|
+
} else if ( hasIndex === true ) {
|
|
2200
|
+
|
|
2201
|
+
const { vertexCount: indexCount, instanceCount, firstVertex: firstIndex } = drawParams;
|
|
2202
|
+
|
|
2203
|
+
const indirect = renderObject.getIndirect();
|
|
2204
|
+
|
|
2205
|
+
if ( indirect !== null ) {
|
|
2206
|
+
|
|
2207
|
+
const buffer = this.get( indirect ).buffer;
|
|
2208
|
+
const indirectOffset = renderObject.getIndirectOffset();
|
|
2209
|
+
const indirectOffsets = Array.isArray( indirectOffset ) ? indirectOffset : [ indirectOffset ];
|
|
2210
|
+
|
|
2211
|
+
for ( let i = 0; i < indirectOffsets.length; i ++ ) {
|
|
2212
|
+
|
|
2213
|
+
passEncoderGPU.drawIndexedIndirect( buffer, indirectOffsets[ i ] );
|
|
2214
|
+
|
|
2215
|
+
}
|
|
2216
|
+
|
|
2217
|
+
} else {
|
|
2218
|
+
|
|
2219
|
+
passEncoderGPU.drawIndexed( indexCount, instanceCount, firstIndex, 0, 0 );
|
|
2220
|
+
|
|
2221
|
+
info.update( object, indexCount, instanceCount );
|
|
2222
|
+
|
|
2223
|
+
}
|
|
2224
|
+
|
|
2225
|
+
} else {
|
|
2226
|
+
|
|
2227
|
+
const { vertexCount, instanceCount, firstVertex } = drawParams;
|
|
2228
|
+
|
|
2229
|
+
const indirect = renderObject.getIndirect();
|
|
2230
|
+
|
|
2231
|
+
if ( indirect !== null ) {
|
|
2232
|
+
|
|
2233
|
+
const buffer = this.get( indirect ).buffer;
|
|
2234
|
+
const indirectOffset = renderObject.getIndirectOffset();
|
|
2235
|
+
const indirectOffsets = Array.isArray( indirectOffset ) ? indirectOffset : [ indirectOffset ];
|
|
2236
|
+
|
|
2237
|
+
for ( let i = 0; i < indirectOffsets.length; i ++ ) {
|
|
2238
|
+
|
|
2239
|
+
passEncoderGPU.drawIndirect( buffer, indirectOffsets[ i ] );
|
|
2240
|
+
|
|
2241
|
+
}
|
|
2242
|
+
|
|
2243
|
+
} else {
|
|
2244
|
+
|
|
2245
|
+
passEncoderGPU.draw( vertexCount, instanceCount, firstVertex, 0 );
|
|
2246
|
+
|
|
2247
|
+
info.update( object, vertexCount, instanceCount );
|
|
2248
|
+
|
|
2249
|
+
}
|
|
2250
|
+
|
|
2251
|
+
}
|
|
2252
|
+
|
|
2253
|
+
}
|
|
2254
|
+
|
|
2255
|
+
// render object
|
|
2256
|
+
|
|
2257
|
+
/**
|
|
2258
|
+
* Executes a draw command for the given render object.
|
|
2259
|
+
*
|
|
2260
|
+
* @param {RenderObject} renderObject - The render object to draw.
|
|
2261
|
+
* @param {Info} info - Holds a series of statistical information about the GPU memory and the rendering process.
|
|
2262
|
+
*/
|
|
2263
|
+
draw( renderObject, info ) {
|
|
2264
|
+
|
|
2265
|
+
const { object, context, pipeline } = renderObject;
|
|
2266
|
+
const renderContextData = this.get( context );
|
|
2267
|
+
const pipelineData = this.get( pipeline );
|
|
2268
|
+
const pipelineGPU = pipelineData.pipeline;
|
|
2269
|
+
|
|
2270
|
+
// Skip if pipeline has error
|
|
2271
|
+
if ( pipelineData.error === true ) return;
|
|
2272
|
+
|
|
2273
|
+
const drawParams = renderObject.getDrawParameters();
|
|
2274
|
+
if ( drawParams === null ) return;
|
|
2275
|
+
|
|
2276
|
+
const bindings = renderObject.getBindings();
|
|
2277
|
+
|
|
2278
|
+
// vertex buffers
|
|
2279
|
+
|
|
2280
|
+
const vertexBuffers = renderObject.getVertexBuffers();
|
|
2281
|
+
|
|
2282
|
+
if ( renderObject.camera.isArrayCamera && renderObject.camera.cameras.length > 0 ) {
|
|
2283
|
+
|
|
2284
|
+
const cameraData = this.get( renderObject.camera );
|
|
2285
|
+
const cameras = renderObject.camera.cameras;
|
|
2286
|
+
const cameraIndex = renderObject.getBindingGroup( 'cameraIndex' );
|
|
2287
|
+
|
|
2288
|
+
if ( cameraData.indexesGPU === undefined || cameraData.indexesGPU.length !== cameras.length ) {
|
|
2289
|
+
|
|
2290
|
+
const bindingsData = this.get( cameraIndex );
|
|
2291
|
+
const indexesGPU = [];
|
|
2292
|
+
|
|
2293
|
+
const data = new Uint32Array( [ 0, 0, 0, 0 ] );
|
|
2294
|
+
|
|
2295
|
+
for ( let i = 0, len = cameras.length; i < len; i ++ ) {
|
|
2296
|
+
|
|
2297
|
+
data[ 0 ] = i;
|
|
2298
|
+
|
|
2299
|
+
const { layoutGPU } = bindingsData.layout;
|
|
2300
|
+
|
|
2301
|
+
const bindGroupIndex = this.bindingUtils.createBindGroupIndex( data, layoutGPU );
|
|
2302
|
+
|
|
2303
|
+
indexesGPU.push( bindGroupIndex );
|
|
2304
|
+
|
|
2305
|
+
}
|
|
2306
|
+
|
|
2307
|
+
cameraData.indexesGPU = indexesGPU; // TODO: Create a global library for this
|
|
2308
|
+
|
|
2309
|
+
}
|
|
2310
|
+
|
|
2311
|
+
const renderTarget = context.renderTarget;
|
|
2312
|
+
const pixelRatio = ( renderTarget === null || renderTarget.isPostProcessingRenderTarget === true ) ? this.renderer.getPixelRatio() : 1;
|
|
2313
|
+
const indexPos = cameraIndex ? bindings.indexOf( cameraIndex ) : - 1;
|
|
2314
|
+
|
|
2315
|
+
const frustumArray = context.frustumArray;
|
|
2316
|
+
|
|
2317
|
+
for ( let i = 0, len = cameras.length; i < len; i ++ ) {
|
|
2318
|
+
|
|
2319
|
+
const subCamera = cameras[ i ];
|
|
2320
|
+
|
|
2321
|
+
if ( object.layers.test( subCamera.layers ) && ( renderObject.camera.perCameraFrustumCulled === false || object.frustumCulled === false || object.intersectsFrustum( frustumArray.getFrustum( i ) ) ) ) {
|
|
2322
|
+
|
|
2323
|
+
const vp = subCamera.viewport;
|
|
2324
|
+
|
|
2325
|
+
let pass = renderContextData.currentPass;
|
|
2326
|
+
let sets = renderContextData.currentSets;
|
|
2327
|
+
const isBundleEncoder = renderContextData.bundleEncoders !== undefined;
|
|
2328
|
+
|
|
2329
|
+
if ( isBundleEncoder ) {
|
|
2330
|
+
|
|
2331
|
+
const bundleEncoder = renderContextData.bundleEncoders[ i ];
|
|
2332
|
+
const bundleSets = renderContextData.bundleSets[ i ];
|
|
2333
|
+
pass = bundleEncoder;
|
|
2334
|
+
sets = bundleSets;
|
|
2335
|
+
|
|
2336
|
+
}
|
|
2337
|
+
// GPURenderBundleEncoder does not support setViewport, only GPURenderPassEncoder does
|
|
2338
|
+
|
|
2339
|
+
if ( vp && ! isBundleEncoder ) {
|
|
2340
|
+
|
|
2341
|
+
pass.setViewport(
|
|
2342
|
+
Math.floor( vp.x * pixelRatio ),
|
|
2343
|
+
Math.floor( vp.y * pixelRatio ),
|
|
2344
|
+
Math.floor( vp.width * pixelRatio ),
|
|
2345
|
+
Math.floor( vp.height * pixelRatio ),
|
|
2346
|
+
context.viewportValue.minDepth,
|
|
2347
|
+
context.viewportValue.maxDepth
|
|
2348
|
+
);
|
|
2349
|
+
|
|
2350
|
+
}
|
|
2351
|
+
|
|
2352
|
+
// Set camera index binding for this layer
|
|
2353
|
+
if ( indexPos !== - 1 && cameraData.indexesGPU ) {
|
|
2354
|
+
|
|
2355
|
+
const cameraIndexGPU = cameraData.indexesGPU[ i ];
|
|
2356
|
+
|
|
2357
|
+
if ( sets.bindingGroups[ indexPos ] !== cameraIndexGPU ) {
|
|
2358
|
+
|
|
2359
|
+
pass.setBindGroup( indexPos, cameraIndexGPU );
|
|
2360
|
+
sets.bindingGroups[ indexPos ] = cameraIndexGPU;
|
|
2361
|
+
|
|
2362
|
+
}
|
|
2363
|
+
|
|
2364
|
+
}
|
|
2365
|
+
|
|
2366
|
+
this._draw( renderObject, info, renderContextData, pipelineGPU, bindings, vertexBuffers, drawParams, pass, sets, indexPos );
|
|
2367
|
+
|
|
2368
|
+
}
|
|
2369
|
+
|
|
2370
|
+
}
|
|
2371
|
+
|
|
2372
|
+
} else {
|
|
2373
|
+
|
|
2374
|
+
// Regular single camera rendering
|
|
2375
|
+
if ( renderContextData.currentPass ) {
|
|
2376
|
+
|
|
2377
|
+
// Handle occlusion queries
|
|
2378
|
+
|
|
2379
|
+
if ( renderContextData.currentPass instanceof GPURenderBundleEncoder ) {
|
|
2380
|
+
|
|
2381
|
+
if ( object.occlusionTest === true ) {
|
|
2382
|
+
|
|
2383
|
+
warnOnce( 'WebGPUBackend: Occlusion queries can not be recorded into render bundles.' );
|
|
2384
|
+
|
|
2385
|
+
}
|
|
2386
|
+
|
|
2387
|
+
} else if ( context.occlusionQueryCount > 0 ) {
|
|
2388
|
+
|
|
2389
|
+
const occlusionData = this.getOcclusionData( context );
|
|
2390
|
+
|
|
2391
|
+
const lastObject = occlusionData.lastOcclusionObject;
|
|
2392
|
+
if ( lastObject !== object ) {
|
|
2393
|
+
|
|
2394
|
+
if ( lastObject !== null && lastObject.occlusionTest === true ) {
|
|
2395
|
+
|
|
2396
|
+
renderContextData.currentPass.endOcclusionQuery();
|
|
2397
|
+
occlusionData.occlusionQueryIndex ++;
|
|
2398
|
+
|
|
2399
|
+
}
|
|
2400
|
+
|
|
2401
|
+
if ( object.occlusionTest === true ) {
|
|
2402
|
+
|
|
2403
|
+
renderContextData.currentPass.beginOcclusionQuery( occlusionData.occlusionQueryIndex );
|
|
2404
|
+
occlusionData.occlusionQueryObjects[ occlusionData.occlusionQueryIndex ] = object;
|
|
2405
|
+
|
|
2406
|
+
}
|
|
2407
|
+
|
|
2408
|
+
occlusionData.lastOcclusionObject = object;
|
|
2409
|
+
|
|
2410
|
+
}
|
|
2411
|
+
|
|
2412
|
+
}
|
|
2413
|
+
|
|
2414
|
+
this._draw( renderObject, info, renderContextData, pipelineGPU, bindings, vertexBuffers, drawParams, renderContextData.currentPass, renderContextData.currentSets );
|
|
2415
|
+
|
|
2416
|
+
}
|
|
2417
|
+
|
|
2418
|
+
}
|
|
2419
|
+
|
|
2420
|
+
}
|
|
2421
|
+
|
|
2422
|
+
// cache key
|
|
2423
|
+
|
|
2424
|
+
/**
|
|
2425
|
+
* Returns `true` if the render pipeline requires an update.
|
|
2426
|
+
*
|
|
2427
|
+
* @param {RenderObject} renderObject - The render object.
|
|
2428
|
+
* @return {boolean} Whether the render pipeline requires an update or not.
|
|
2429
|
+
*/
|
|
2430
|
+
needsRenderUpdate( renderObject ) {
|
|
2431
|
+
|
|
2432
|
+
const data = this.get( renderObject );
|
|
2433
|
+
|
|
2434
|
+
const { object, material, geometry } = renderObject;
|
|
2435
|
+
|
|
2436
|
+
const utils = this.utils;
|
|
2437
|
+
|
|
2438
|
+
const sampleCount = utils.getSampleCountRenderContext( renderObject.context );
|
|
2439
|
+
const colorSpace = utils.getCurrentColorSpace( renderObject.context );
|
|
2440
|
+
const colorFormat = utils.getCurrentColorFormat( renderObject.context );
|
|
2441
|
+
const depthStencilFormat = utils.getCurrentDepthStencilFormat( renderObject.context );
|
|
2442
|
+
const primitiveTopology = utils.getPrimitiveTopology( object, material );
|
|
2443
|
+
const stripIndexFormat = utils.getStripIndexFormat( object, geometry );
|
|
2444
|
+
const frontFaceCW = ( object.isMesh && object.matrixWorld.determinantAffine() < 0 );
|
|
2445
|
+
|
|
2446
|
+
let needsUpdate = false;
|
|
2447
|
+
|
|
2448
|
+
if ( data.material !== material || data.materialVersion !== material.version ||
|
|
2449
|
+
data.transparent !== material.transparent || data.blending !== material.blending || data.premultipliedAlpha !== material.premultipliedAlpha ||
|
|
2450
|
+
data.blendSrc !== material.blendSrc || data.blendDst !== material.blendDst || data.blendEquation !== material.blendEquation ||
|
|
2451
|
+
data.blendSrcAlpha !== material.blendSrcAlpha || data.blendDstAlpha !== material.blendDstAlpha || data.blendEquationAlpha !== material.blendEquationAlpha ||
|
|
2452
|
+
data.colorWrite !== material.colorWrite || data.depthWrite !== material.depthWrite || data.depthTest !== material.depthTest || data.depthFunc !== material.depthFunc ||
|
|
2453
|
+
data.stencilWrite !== material.stencilWrite || data.stencilFunc !== material.stencilFunc ||
|
|
2454
|
+
data.stencilFail !== material.stencilFail || data.stencilZFail !== material.stencilZFail || data.stencilZPass !== material.stencilZPass ||
|
|
2455
|
+
data.stencilFuncMask !== material.stencilFuncMask || data.stencilWriteMask !== material.stencilWriteMask ||
|
|
2456
|
+
data.polygonOffset !== material.polygonOffset || data.polygonOffsetFactor !== material.polygonOffsetFactor || data.polygonOffsetUnits !== material.polygonOffsetUnits ||
|
|
2457
|
+
data.side !== material.side || data.alphaToCoverage !== material.alphaToCoverage ||
|
|
2458
|
+
data.sampleCount !== sampleCount || data.colorSpace !== colorSpace ||
|
|
2459
|
+
data.colorFormat !== colorFormat || data.depthStencilFormat !== depthStencilFormat ||
|
|
2460
|
+
data.primitiveTopology !== primitiveTopology || data.stripIndexFormat !== stripIndexFormat ||
|
|
2461
|
+
data.frontFaceCW !== frontFaceCW ||
|
|
2462
|
+
data.geometryVersion !== renderObject.geometryVersion ||
|
|
2463
|
+
data.clippingContextCacheKey !== renderObject.clippingContextCacheKey
|
|
2464
|
+
) {
|
|
2465
|
+
|
|
2466
|
+
data.material = material; data.materialVersion = material.version;
|
|
2467
|
+
data.transparent = material.transparent; data.blending = material.blending; data.premultipliedAlpha = material.premultipliedAlpha;
|
|
2468
|
+
data.blendSrc = material.blendSrc; data.blendDst = material.blendDst; data.blendEquation = material.blendEquation;
|
|
2469
|
+
data.blendSrcAlpha = material.blendSrcAlpha; data.blendDstAlpha = material.blendDstAlpha; data.blendEquationAlpha = material.blendEquationAlpha;
|
|
2470
|
+
data.colorWrite = material.colorWrite;
|
|
2471
|
+
data.depthWrite = material.depthWrite; data.depthTest = material.depthTest; data.depthFunc = material.depthFunc;
|
|
2472
|
+
data.stencilWrite = material.stencilWrite; data.stencilFunc = material.stencilFunc;
|
|
2473
|
+
data.stencilFail = material.stencilFail; data.stencilZFail = material.stencilZFail; data.stencilZPass = material.stencilZPass;
|
|
2474
|
+
data.stencilFuncMask = material.stencilFuncMask; data.stencilWriteMask = material.stencilWriteMask;
|
|
2475
|
+
data.polygonOffset = material.polygonOffset; data.polygonOffsetFactor = material.polygonOffsetFactor; data.polygonOffsetUnits = material.polygonOffsetUnits;
|
|
2476
|
+
data.side = material.side; data.alphaToCoverage = material.alphaToCoverage;
|
|
2477
|
+
data.sampleCount = sampleCount;
|
|
2478
|
+
data.colorSpace = colorSpace;
|
|
2479
|
+
data.colorFormat = colorFormat;
|
|
2480
|
+
data.depthStencilFormat = depthStencilFormat;
|
|
2481
|
+
data.primitiveTopology = primitiveTopology;
|
|
2482
|
+
data.stripIndexFormat = stripIndexFormat;
|
|
2483
|
+
data.frontFaceCW = frontFaceCW;
|
|
2484
|
+
data.geometryVersion = renderObject.geometryVersion;
|
|
2485
|
+
data.clippingContextCacheKey = renderObject.clippingContextCacheKey;
|
|
2486
|
+
|
|
2487
|
+
needsUpdate = true;
|
|
2488
|
+
|
|
2489
|
+
}
|
|
2490
|
+
|
|
2491
|
+
return needsUpdate;
|
|
2492
|
+
|
|
2493
|
+
}
|
|
2494
|
+
|
|
2495
|
+
/**
|
|
2496
|
+
* Returns a cache key that is used to identify render pipelines.
|
|
2497
|
+
*
|
|
2498
|
+
* @param {RenderObject} renderObject - The render object.
|
|
2499
|
+
* @return {string} The cache key.
|
|
2500
|
+
*/
|
|
2501
|
+
getRenderCacheKey( renderObject ) {
|
|
2502
|
+
|
|
2503
|
+
const { object, material, geometry } = renderObject;
|
|
2504
|
+
|
|
2505
|
+
const utils = this.utils;
|
|
2506
|
+
const renderContext = renderObject.context;
|
|
2507
|
+
|
|
2508
|
+
// meshes with negative scale have a different frontFace render pipeline
|
|
2509
|
+
// descriptor value so the following must be honored in the cache key
|
|
2510
|
+
|
|
2511
|
+
const frontFaceCW = ( object.isMesh && object.matrixWorld.determinantAffine() < 0 );
|
|
2512
|
+
|
|
2513
|
+
return [
|
|
2514
|
+
material.transparent, material.blending, material.premultipliedAlpha,
|
|
2515
|
+
material.blendSrc, material.blendDst, material.blendEquation,
|
|
2516
|
+
material.blendSrcAlpha, material.blendDstAlpha, material.blendEquationAlpha,
|
|
2517
|
+
material.colorWrite,
|
|
2518
|
+
material.depthWrite, material.depthTest, material.depthFunc,
|
|
2519
|
+
material.stencilWrite, material.stencilFunc,
|
|
2520
|
+
material.stencilFail, material.stencilZFail, material.stencilZPass,
|
|
2521
|
+
material.stencilFuncMask, material.stencilWriteMask,
|
|
2522
|
+
material.polygonOffset, material.polygonOffsetFactor, material.polygonOffsetUnits,
|
|
2523
|
+
material.side, material.alphaToCoverage,
|
|
2524
|
+
frontFaceCW,
|
|
2525
|
+
utils.getSampleCountRenderContext( renderContext ),
|
|
2526
|
+
utils.getCurrentColorSpace( renderContext ), utils.getCurrentColorFormat( renderContext ), utils.getCurrentDepthStencilFormat( renderContext ),
|
|
2527
|
+
utils.getPrimitiveTopology( object, material ), utils.getStripIndexFormat( object, geometry ),
|
|
2528
|
+
this.attributeUtils.getVertexBufferLayoutCacheKey( renderObject ),
|
|
2529
|
+
renderObject.clippingContextCacheKey
|
|
2530
|
+
].join();
|
|
2531
|
+
|
|
2532
|
+
}
|
|
2533
|
+
|
|
2534
|
+
// textures
|
|
2535
|
+
|
|
2536
|
+
/**
|
|
2537
|
+
* Updates a GPU sampler for the given texture.
|
|
2538
|
+
*
|
|
2539
|
+
* @param {Sampler} binding - The sampler binding to update.
|
|
2540
|
+
* @return {string} The current sampler key.
|
|
2541
|
+
*/
|
|
2542
|
+
updateSampler( binding ) {
|
|
2543
|
+
|
|
2544
|
+
return this.textureUtils.updateSampler( binding );
|
|
2545
|
+
|
|
2546
|
+
}
|
|
2547
|
+
|
|
2548
|
+
/**
|
|
2549
|
+
* Frees the GPU sampler for the given sampler binding.
|
|
2550
|
+
*
|
|
2551
|
+
* @param {Sampler} binding - The sampler binding to free.
|
|
2552
|
+
*/
|
|
2553
|
+
destroySampler( binding ) {
|
|
2554
|
+
|
|
2555
|
+
this.textureUtils.destroySampler( binding );
|
|
2556
|
+
|
|
2557
|
+
}
|
|
2558
|
+
|
|
2559
|
+
/**
|
|
2560
|
+
* Creates a default texture for the given texture that can be used
|
|
2561
|
+
* as a placeholder until the actual texture is ready for usage.
|
|
2562
|
+
*
|
|
2563
|
+
* @param {Texture} texture - The texture to create a default texture for.
|
|
2564
|
+
* @return {boolean} Whether the sampler has been updated or not.
|
|
2565
|
+
*/
|
|
2566
|
+
createDefaultTexture( texture ) {
|
|
2567
|
+
|
|
2568
|
+
return this.textureUtils.createDefaultTexture( texture );
|
|
2569
|
+
|
|
2570
|
+
}
|
|
2571
|
+
|
|
2572
|
+
/**
|
|
2573
|
+
* Defines a texture on the GPU for the given texture object.
|
|
2574
|
+
*
|
|
2575
|
+
* @param {Texture} texture - The texture.
|
|
2576
|
+
* @param {Object} [options={}] - Optional configuration parameter.
|
|
2577
|
+
*/
|
|
2578
|
+
createTexture( texture, options ) {
|
|
2579
|
+
|
|
2580
|
+
this.textureUtils.createTexture( texture, options );
|
|
2581
|
+
|
|
2582
|
+
}
|
|
2583
|
+
|
|
2584
|
+
/**
|
|
2585
|
+
* Uploads the updated texture data to the GPU.
|
|
2586
|
+
*
|
|
2587
|
+
* @param {Texture} texture - The texture.
|
|
2588
|
+
* @param {Object} [options={}] - Optional configuration parameter.
|
|
2589
|
+
*/
|
|
2590
|
+
updateTexture( texture, options ) {
|
|
2591
|
+
|
|
2592
|
+
this.textureUtils.updateTexture( texture, options );
|
|
2593
|
+
|
|
2594
|
+
}
|
|
2595
|
+
|
|
2596
|
+
/**
|
|
2597
|
+
* Generates mipmaps for the given texture.
|
|
2598
|
+
*
|
|
2599
|
+
* @param {Texture} texture - The texture.
|
|
2600
|
+
*/
|
|
2601
|
+
generateMipmaps( texture ) {
|
|
2602
|
+
|
|
2603
|
+
this.textureUtils.generateMipmaps( texture );
|
|
2604
|
+
|
|
2605
|
+
}
|
|
2606
|
+
|
|
2607
|
+
/**
|
|
2608
|
+
* Destroys the GPU data for the given texture object.
|
|
2609
|
+
*
|
|
2610
|
+
* @param {Texture} texture - The texture.
|
|
2611
|
+
* @param {boolean} [isDefaultTexture=false] - Whether the texture uses a default GPU texture or not.
|
|
2612
|
+
*/
|
|
2613
|
+
destroyTexture( texture, isDefaultTexture = false ) {
|
|
2614
|
+
|
|
2615
|
+
this.textureUtils.destroyTexture( texture, isDefaultTexture );
|
|
2616
|
+
|
|
2617
|
+
}
|
|
2618
|
+
|
|
2619
|
+
/**
|
|
2620
|
+
* Returns texture data as a typed array.
|
|
2621
|
+
*
|
|
2622
|
+
* @async
|
|
2623
|
+
* @param {Texture} texture - The texture to copy.
|
|
2624
|
+
* @param {number} x - The x coordinate of the copy origin.
|
|
2625
|
+
* @param {number} y - The y coordinate of the copy origin.
|
|
2626
|
+
* @param {number} width - The width of the copy.
|
|
2627
|
+
* @param {number} height - The height of the copy.
|
|
2628
|
+
* @param {number} faceIndex - The cube face, depth slice or array layer index.
|
|
2629
|
+
* @return {Promise<TypedArray>} A Promise that resolves with a typed array when the copy operation has finished.
|
|
2630
|
+
*/
|
|
2631
|
+
async copyTextureToBuffer( texture, x, y, width, height, faceIndex ) {
|
|
2632
|
+
|
|
2633
|
+
return this.textureUtils.copyTextureToBuffer( texture, x, y, width, height, faceIndex );
|
|
2634
|
+
|
|
2635
|
+
}
|
|
2636
|
+
|
|
2637
|
+
/**
|
|
2638
|
+
* Inits a time stamp query for the given render context.
|
|
2639
|
+
*
|
|
2640
|
+
* @param {string} type - The type of the timestamp query (e.g. 'render', 'compute').
|
|
2641
|
+
* @param {number} uid - Unique id for the context (e.g. render context id).
|
|
2642
|
+
* @param {Object} descriptor - The query descriptor.
|
|
2643
|
+
*/
|
|
2644
|
+
initTimestampQuery( type, uid, descriptor ) {
|
|
2645
|
+
|
|
2646
|
+
if ( ! this.trackTimestamp ) {
|
|
2647
|
+
|
|
2648
|
+
descriptor.timestampWrites = undefined;
|
|
2649
|
+
return;
|
|
2650
|
+
|
|
2651
|
+
}
|
|
2652
|
+
|
|
2653
|
+
if ( ! this.timestampQueryPool[ type ] ) {
|
|
2654
|
+
|
|
2655
|
+
// TODO: Variable maxQueries?
|
|
2656
|
+
this.timestampQueryPool[ type ] = new WebGPUTimestampQueryPool( this.device, type, 2048 );
|
|
2657
|
+
|
|
2658
|
+
}
|
|
2659
|
+
|
|
2660
|
+
const timestampQueryPool = this.timestampQueryPool[ type ];
|
|
2661
|
+
|
|
2662
|
+
const baseOffset = timestampQueryPool.allocateQueriesForContext( uid );
|
|
2663
|
+
|
|
2664
|
+
_renderPassTimestampWrites.querySet = timestampQueryPool.querySet;
|
|
2665
|
+
_renderPassTimestampWrites.beginningOfPassWriteIndex = baseOffset;
|
|
2666
|
+
_renderPassTimestampWrites.endOfPassWriteIndex = baseOffset + 1;
|
|
2667
|
+
|
|
2668
|
+
descriptor.timestampWrites = _renderPassTimestampWrites;
|
|
2669
|
+
|
|
2670
|
+
}
|
|
2671
|
+
|
|
2672
|
+
|
|
2673
|
+
// node builder
|
|
2674
|
+
|
|
2675
|
+
/**
|
|
2676
|
+
* Returns a node builder for the given render object.
|
|
2677
|
+
*
|
|
2678
|
+
* @param {RenderObject} object - The render object.
|
|
2679
|
+
* @param {Renderer} renderer - The renderer.
|
|
2680
|
+
* @return {WGSLNodeBuilder} The node builder.
|
|
2681
|
+
*/
|
|
2682
|
+
createNodeBuilder( object, renderer ) {
|
|
2683
|
+
|
|
2684
|
+
return new WGSLNodeBuilder( object, renderer );
|
|
2685
|
+
|
|
2686
|
+
}
|
|
2687
|
+
|
|
2688
|
+
// program
|
|
2689
|
+
|
|
2690
|
+
/**
|
|
2691
|
+
* Creates a shader program from the given programmable stage.
|
|
2692
|
+
*
|
|
2693
|
+
* @param {ProgrammableStage} program - The programmable stage.
|
|
2694
|
+
*/
|
|
2695
|
+
createProgram( program ) {
|
|
2696
|
+
|
|
2697
|
+
const programGPU = this.get( program );
|
|
2698
|
+
|
|
2699
|
+
_shaderModuleDescriptor.label = program.stage + ( program.name !== '' ? `_${ program.name }` : '' );
|
|
2700
|
+
_shaderModuleDescriptor.code = program.code;
|
|
2701
|
+
|
|
2702
|
+
programGPU.module = {
|
|
2703
|
+
module: this.device.createShaderModule( _shaderModuleDescriptor ),
|
|
2704
|
+
entryPoint: 'main'
|
|
2705
|
+
};
|
|
2706
|
+
|
|
2707
|
+
_shaderModuleDescriptor.reset();
|
|
2708
|
+
|
|
2709
|
+
}
|
|
2710
|
+
|
|
2711
|
+
/**
|
|
2712
|
+
* Destroys the shader program of the given programmable stage.
|
|
2713
|
+
*
|
|
2714
|
+
* @param {ProgrammableStage} program - The programmable stage.
|
|
2715
|
+
*/
|
|
2716
|
+
destroyProgram( program ) {
|
|
2717
|
+
|
|
2718
|
+
this.delete( program );
|
|
2719
|
+
|
|
2720
|
+
}
|
|
2721
|
+
|
|
2722
|
+
// pipelines
|
|
2723
|
+
|
|
2724
|
+
/**
|
|
2725
|
+
* Creates a render pipeline for the given render object.
|
|
2726
|
+
*
|
|
2727
|
+
* @param {RenderObject} renderObject - The render object.
|
|
2728
|
+
* @param {Array<Promise>} promises - An array of compilation promises which are used in `compileAsync()`.
|
|
2729
|
+
*/
|
|
2730
|
+
createRenderPipeline( renderObject, promises ) {
|
|
2731
|
+
|
|
2732
|
+
this.pipelineUtils.createRenderPipeline( renderObject, promises );
|
|
2733
|
+
|
|
2734
|
+
}
|
|
2735
|
+
|
|
2736
|
+
/**
|
|
2737
|
+
* Creates a compute pipeline for the given compute node.
|
|
2738
|
+
*
|
|
2739
|
+
* @param {ComputePipeline} computePipeline - The compute pipeline.
|
|
2740
|
+
* @param {Array<BindGroup>} bindings - The bindings.
|
|
2741
|
+
* @param {?Array<Promise>} [promises=null] - Optional compilation promises.
|
|
2742
|
+
*/
|
|
2743
|
+
createComputePipeline( computePipeline, bindings, promises = null ) {
|
|
2744
|
+
|
|
2745
|
+
this.pipelineUtils.createComputePipeline( computePipeline, bindings, promises );
|
|
2746
|
+
|
|
2747
|
+
}
|
|
2748
|
+
|
|
2749
|
+
/**
|
|
2750
|
+
* Prepares the state for encoding render bundles.
|
|
2751
|
+
*
|
|
2752
|
+
* @param {RenderContext} renderContext - The render context.
|
|
2753
|
+
*/
|
|
2754
|
+
beginBundle( renderContext ) {
|
|
2755
|
+
|
|
2756
|
+
const renderContextData = this.get( renderContext );
|
|
2757
|
+
|
|
2758
|
+
renderContextData._currentPass = renderContextData.currentPass;
|
|
2759
|
+
renderContextData._currentSets = renderContextData.currentSets;
|
|
2760
|
+
|
|
2761
|
+
renderContextData.currentSets = { attributes: {}, bindingGroups: [], pipeline: null, index: null };
|
|
2762
|
+
renderContextData.currentPass = this.pipelineUtils.createBundleEncoder( renderContext );
|
|
2763
|
+
|
|
2764
|
+
}
|
|
2765
|
+
|
|
2766
|
+
/**
|
|
2767
|
+
* After processing render bundles this method finalizes related work.
|
|
2768
|
+
*
|
|
2769
|
+
* @param {RenderContext} renderContext - The render context.
|
|
2770
|
+
* @param {RenderBundle} bundle - The render bundle.
|
|
2771
|
+
*/
|
|
2772
|
+
finishBundle( renderContext, bundle ) {
|
|
2773
|
+
|
|
2774
|
+
const renderContextData = this.get( renderContext );
|
|
2775
|
+
|
|
2776
|
+
const bundleEncoder = renderContextData.currentPass;
|
|
2777
|
+
const bundleGPU = bundleEncoder.finish();
|
|
2778
|
+
|
|
2779
|
+
this.get( bundle ).bundleGPU = bundleGPU;
|
|
2780
|
+
|
|
2781
|
+
// restore render pass state
|
|
2782
|
+
|
|
2783
|
+
renderContextData.currentSets = renderContextData._currentSets;
|
|
2784
|
+
renderContextData.currentPass = renderContextData._currentPass;
|
|
2785
|
+
renderContextData._currentPass = null;
|
|
2786
|
+
renderContextData._currentSets = null;
|
|
2787
|
+
|
|
2788
|
+
}
|
|
2789
|
+
|
|
2790
|
+
/**
|
|
2791
|
+
* Adds a render bundle to the render context data.
|
|
2792
|
+
*
|
|
2793
|
+
* @param {RenderContext} renderContext - The render context.
|
|
2794
|
+
* @param {RenderBundle} bundle - The render bundle to add.
|
|
2795
|
+
*/
|
|
2796
|
+
addBundle( renderContext, bundle ) {
|
|
2797
|
+
|
|
2798
|
+
const renderContextData = this.get( renderContext );
|
|
2799
|
+
|
|
2800
|
+
renderContextData.renderBundles.push( this.get( bundle ).bundleGPU );
|
|
2801
|
+
|
|
2802
|
+
}
|
|
2803
|
+
|
|
2804
|
+
// bindings
|
|
2805
|
+
|
|
2806
|
+
/**
|
|
2807
|
+
* Creates a uniform buffer.
|
|
2808
|
+
*
|
|
2809
|
+
* @param {Buffer} uniformBuffer - The uniform buffer.
|
|
2810
|
+
*/
|
|
2811
|
+
createUniformBuffer( uniformBuffer ) {
|
|
2812
|
+
|
|
2813
|
+
const uniformBufferData = this.get( uniformBuffer );
|
|
2814
|
+
|
|
2815
|
+
if ( uniformBufferData.buffer === undefined ) {
|
|
2816
|
+
|
|
2817
|
+
const byteLength = uniformBuffer.byteLength;
|
|
2818
|
+
|
|
2819
|
+
const slice = this.uniformArena.allocate( byteLength );
|
|
2820
|
+
|
|
2821
|
+
if ( slice !== null ) {
|
|
2822
|
+
|
|
2823
|
+
uniformBufferData.slice = slice;
|
|
2824
|
+
uniformBufferData.buffer = slice.buffer;
|
|
2825
|
+
return;
|
|
2826
|
+
|
|
2827
|
+
}
|
|
2828
|
+
|
|
2829
|
+
const usage = GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST;
|
|
2830
|
+
|
|
2831
|
+
const visibilities = [];
|
|
2832
|
+
|
|
2833
|
+
if ( uniformBuffer.visibility & GPUShaderStage.VERTEX ) {
|
|
2834
|
+
|
|
2835
|
+
visibilities.push( 'vertex' );
|
|
2836
|
+
|
|
2837
|
+
}
|
|
2838
|
+
|
|
2839
|
+
if ( uniformBuffer.visibility & GPUShaderStage.FRAGMENT ) {
|
|
2840
|
+
|
|
2841
|
+
visibilities.push( 'fragment' );
|
|
2842
|
+
|
|
2843
|
+
}
|
|
2844
|
+
|
|
2845
|
+
if ( uniformBuffer.visibility & GPUShaderStage.COMPUTE ) {
|
|
2846
|
+
|
|
2847
|
+
visibilities.push( 'compute' );
|
|
2848
|
+
|
|
2849
|
+
}
|
|
2850
|
+
|
|
2851
|
+
const bufferVisibility = `(${visibilities.join( ',' )})`;
|
|
2852
|
+
|
|
2853
|
+
_bufferDescriptor.label = `bindingBuffer${uniformBuffer.id}_${uniformBuffer.name}_${bufferVisibility}`;
|
|
2854
|
+
_bufferDescriptor.size = byteLength;
|
|
2855
|
+
_bufferDescriptor.usage = usage;
|
|
2856
|
+
|
|
2857
|
+
const bufferGPU = this.device.createBuffer( _bufferDescriptor );
|
|
2858
|
+
|
|
2859
|
+
_bufferDescriptor.reset();
|
|
2860
|
+
|
|
2861
|
+
uniformBufferData.buffer = bufferGPU;
|
|
2862
|
+
|
|
2863
|
+
}
|
|
2864
|
+
|
|
2865
|
+
}
|
|
2866
|
+
|
|
2867
|
+
/**
|
|
2868
|
+
* Destroys the GPU data for the given uniform buffer.
|
|
2869
|
+
*
|
|
2870
|
+
* @param {Buffer} uniformBuffer - The uniform buffer.
|
|
2871
|
+
*/
|
|
2872
|
+
destroyUniformBuffer( uniformBuffer ) {
|
|
2873
|
+
|
|
2874
|
+
const uniformBufferData = this.get( uniformBuffer );
|
|
2875
|
+
|
|
2876
|
+
if ( uniformBufferData.slice !== undefined ) this.uniformArena.release( uniformBufferData.slice );
|
|
2877
|
+
else uniformBufferData.buffer.destroy();
|
|
2878
|
+
|
|
2879
|
+
this.delete( uniformBuffer );
|
|
2880
|
+
|
|
2881
|
+
}
|
|
2882
|
+
|
|
2883
|
+
/**
|
|
2884
|
+
* Creates bindings from the given bind group definition.
|
|
2885
|
+
*
|
|
2886
|
+
* @param {BindGroup} bindGroup - The bind group.
|
|
2887
|
+
* @param {Array<BindGroup>} bindings - Array of bind groups.
|
|
2888
|
+
* @param {string} cacheKey - The cache key.
|
|
2889
|
+
* @param {number} version - The version.
|
|
2890
|
+
*/
|
|
2891
|
+
createBindings( bindGroup, bindings, cacheKey, version ) {
|
|
2892
|
+
|
|
2893
|
+
this.bindingUtils.createBindings( bindGroup, bindings, cacheKey, version );
|
|
2894
|
+
|
|
2895
|
+
}
|
|
2896
|
+
|
|
2897
|
+
/**
|
|
2898
|
+
* Updates the given bind group definition.
|
|
2899
|
+
*
|
|
2900
|
+
* @param {BindGroup} bindGroup - The bind group.
|
|
2901
|
+
* @param {Array<BindGroup>} bindings - Array of bind groups.
|
|
2902
|
+
* @param {string} cacheKey - The cache key.
|
|
2903
|
+
* @param {number} version - The version.
|
|
2904
|
+
*/
|
|
2905
|
+
updateBindings( bindGroup, bindings, cacheKey, version ) {
|
|
2906
|
+
|
|
2907
|
+
this.bindingUtils.createBindings( bindGroup, bindings, cacheKey, version );
|
|
2908
|
+
|
|
2909
|
+
}
|
|
2910
|
+
|
|
2911
|
+
/**
|
|
2912
|
+
* Updates a buffer binding.
|
|
2913
|
+
*
|
|
2914
|
+
* @param {Buffer} binding - The buffer binding to update.
|
|
2915
|
+
*/
|
|
2916
|
+
updateBinding( binding ) {
|
|
2917
|
+
|
|
2918
|
+
this.bindingUtils.updateBinding( binding );
|
|
2919
|
+
|
|
2920
|
+
}
|
|
2921
|
+
|
|
2922
|
+
/**
|
|
2923
|
+
* Delete data associated with the current bind group.
|
|
2924
|
+
*
|
|
2925
|
+
* @param {BindGroup} bindGroup - The bind group.
|
|
2926
|
+
*/
|
|
2927
|
+
deleteBindGroupData( bindGroup ) {
|
|
2928
|
+
|
|
2929
|
+
this.bindingUtils.deleteBindGroupData( bindGroup );
|
|
2930
|
+
|
|
2931
|
+
}
|
|
2932
|
+
|
|
2933
|
+
// attributes
|
|
2934
|
+
|
|
2935
|
+
/**
|
|
2936
|
+
* Creates the buffer of an indexed shader attribute.
|
|
2937
|
+
*
|
|
2938
|
+
* @param {BufferAttribute} attribute - The indexed buffer attribute.
|
|
2939
|
+
*/
|
|
2940
|
+
createIndexAttribute( attribute ) {
|
|
2941
|
+
|
|
2942
|
+
let usage = GPUBufferUsage.INDEX | GPUBufferUsage.COPY_SRC | GPUBufferUsage.COPY_DST;
|
|
2943
|
+
|
|
2944
|
+
if ( attribute.isStorageBufferAttribute || attribute.isStorageInstancedBufferAttribute ) {
|
|
2945
|
+
|
|
2946
|
+
usage |= GPUBufferUsage.STORAGE;
|
|
2947
|
+
|
|
2948
|
+
}
|
|
2949
|
+
|
|
2950
|
+
this.attributeUtils.createAttribute( attribute, usage );
|
|
2951
|
+
|
|
2952
|
+
}
|
|
2953
|
+
|
|
2954
|
+
/**
|
|
2955
|
+
* Creates the GPU buffer of a shader attribute.
|
|
2956
|
+
*
|
|
2957
|
+
* @param {BufferAttribute} attribute - The buffer attribute.
|
|
2958
|
+
*/
|
|
2959
|
+
createAttribute( attribute ) {
|
|
2960
|
+
|
|
2961
|
+
this.attributeUtils.createAttribute( attribute, GPUBufferUsage.VERTEX | GPUBufferUsage.COPY_SRC | GPUBufferUsage.COPY_DST );
|
|
2962
|
+
|
|
2963
|
+
}
|
|
2964
|
+
|
|
2965
|
+
/**
|
|
2966
|
+
* Creates the GPU buffer of a storage attribute.
|
|
2967
|
+
*
|
|
2968
|
+
* @param {BufferAttribute} attribute - The buffer attribute.
|
|
2969
|
+
*/
|
|
2970
|
+
createStorageAttribute( attribute ) {
|
|
2971
|
+
|
|
2972
|
+
this.attributeUtils.createAttribute( attribute, GPUBufferUsage.STORAGE | GPUBufferUsage.VERTEX | GPUBufferUsage.COPY_SRC | GPUBufferUsage.COPY_DST );
|
|
2973
|
+
|
|
2974
|
+
}
|
|
2975
|
+
|
|
2976
|
+
/**
|
|
2977
|
+
* Creates the GPU buffer of an indirect storage attribute.
|
|
2978
|
+
*
|
|
2979
|
+
* @param {BufferAttribute} attribute - The buffer attribute.
|
|
2980
|
+
*/
|
|
2981
|
+
createIndirectStorageAttribute( attribute ) {
|
|
2982
|
+
|
|
2983
|
+
this.attributeUtils.createAttribute( attribute, GPUBufferUsage.STORAGE | GPUBufferUsage.INDIRECT | GPUBufferUsage.COPY_SRC | GPUBufferUsage.COPY_DST );
|
|
2984
|
+
|
|
2985
|
+
}
|
|
2986
|
+
|
|
2987
|
+
/**
|
|
2988
|
+
* Updates the GPU buffer of a shader attribute.
|
|
2989
|
+
*
|
|
2990
|
+
* @param {BufferAttribute} attribute - The buffer attribute to update.
|
|
2991
|
+
*/
|
|
2992
|
+
updateAttribute( attribute ) {
|
|
2993
|
+
|
|
2994
|
+
this.attributeUtils.updateAttribute( attribute );
|
|
2995
|
+
|
|
2996
|
+
}
|
|
2997
|
+
|
|
2998
|
+
/**
|
|
2999
|
+
* Destroys the GPU buffer of a shader attribute.
|
|
3000
|
+
*
|
|
3001
|
+
* @param {BufferAttribute} attribute - The buffer attribute to destroy.
|
|
3002
|
+
*/
|
|
3003
|
+
destroyAttribute( attribute ) {
|
|
3004
|
+
|
|
3005
|
+
this.attributeUtils.destroyAttribute( attribute );
|
|
3006
|
+
|
|
3007
|
+
}
|
|
3008
|
+
|
|
3009
|
+
// canvas
|
|
3010
|
+
|
|
3011
|
+
/**
|
|
3012
|
+
* Triggers an update of the default render pass descriptor.
|
|
3013
|
+
*/
|
|
3014
|
+
updateSize() {
|
|
3015
|
+
|
|
3016
|
+
this.delete( this.renderer.getCanvasTarget() );
|
|
3017
|
+
|
|
3018
|
+
}
|
|
3019
|
+
|
|
3020
|
+
/**
|
|
3021
|
+
* Frees the GPU resources of the given canvas target.
|
|
3022
|
+
*
|
|
3023
|
+
* @param {CanvasTarget} canvasTarget - The canvas target.
|
|
3024
|
+
*/
|
|
3025
|
+
destroyCanvasTarget( canvasTarget ) {
|
|
3026
|
+
|
|
3027
|
+
this.destroyTexture( canvasTarget.colorTexture );
|
|
3028
|
+
this.destroyTexture( canvasTarget.depthTexture );
|
|
3029
|
+
|
|
3030
|
+
this.delete( canvasTarget );
|
|
3031
|
+
|
|
3032
|
+
}
|
|
3033
|
+
|
|
3034
|
+
// utils public
|
|
3035
|
+
|
|
3036
|
+
/**
|
|
3037
|
+
* Checks if the given feature is supported by the backend.
|
|
3038
|
+
*
|
|
3039
|
+
* @param {string} name - The feature's name.
|
|
3040
|
+
* @return {boolean} Whether the feature is supported or not.
|
|
3041
|
+
*/
|
|
3042
|
+
hasFeature( name ) {
|
|
3043
|
+
|
|
3044
|
+
if ( GPUFeatureMap[ name ] !== undefined ) name = GPUFeatureMap[ name ];
|
|
3045
|
+
|
|
3046
|
+
return this.device.features.has( name );
|
|
3047
|
+
|
|
3048
|
+
}
|
|
3049
|
+
|
|
3050
|
+
/**
|
|
3051
|
+
* Copies data of the given source texture to the given destination texture.
|
|
3052
|
+
*
|
|
3053
|
+
* @param {Texture} srcTexture - The source texture.
|
|
3054
|
+
* @param {Texture} dstTexture - The destination texture.
|
|
3055
|
+
* @param {?(Box3|Box2)} [srcRegion=null] - The region of the source texture to copy.
|
|
3056
|
+
* @param {?(Vector2|Vector3)} [dstPosition=null] - The destination position of the copy.
|
|
3057
|
+
* @param {number} [srcLevel=0] - The mipmap level to copy.
|
|
3058
|
+
* @param {number} [dstLevel=0] - The destination mip level to copy to.
|
|
3059
|
+
*/
|
|
3060
|
+
copyTextureToTexture( srcTexture, dstTexture, srcRegion = null, dstPosition = null, srcLevel = 0, dstLevel = 0 ) {
|
|
3061
|
+
|
|
3062
|
+
let dstX = 0;
|
|
3063
|
+
let dstY = 0;
|
|
3064
|
+
let dstZ = 0;
|
|
3065
|
+
|
|
3066
|
+
let srcX = 0;
|
|
3067
|
+
let srcY = 0;
|
|
3068
|
+
let srcZ = 0;
|
|
3069
|
+
|
|
3070
|
+
let srcWidth = srcTexture.image.width;
|
|
3071
|
+
let srcHeight = srcTexture.image.height;
|
|
3072
|
+
let srcDepth = 1;
|
|
3073
|
+
|
|
3074
|
+
|
|
3075
|
+
if ( srcRegion !== null ) {
|
|
3076
|
+
|
|
3077
|
+
if ( srcRegion.isBox3 === true ) {
|
|
3078
|
+
|
|
3079
|
+
srcX = srcRegion.min.x;
|
|
3080
|
+
srcY = srcRegion.min.y;
|
|
3081
|
+
srcZ = srcRegion.min.z;
|
|
3082
|
+
srcWidth = srcRegion.max.x - srcRegion.min.x;
|
|
3083
|
+
srcHeight = srcRegion.max.y - srcRegion.min.y;
|
|
3084
|
+
srcDepth = srcRegion.max.z - srcRegion.min.z;
|
|
3085
|
+
|
|
3086
|
+
} else {
|
|
3087
|
+
|
|
3088
|
+
// Assume it's a Box2
|
|
3089
|
+
srcX = srcRegion.min.x;
|
|
3090
|
+
srcY = srcRegion.min.y;
|
|
3091
|
+
srcWidth = srcRegion.max.x - srcRegion.min.x;
|
|
3092
|
+
srcHeight = srcRegion.max.y - srcRegion.min.y;
|
|
3093
|
+
srcDepth = 1;
|
|
3094
|
+
|
|
3095
|
+
}
|
|
3096
|
+
|
|
3097
|
+
}
|
|
3098
|
+
|
|
3099
|
+
|
|
3100
|
+
if ( dstPosition !== null ) {
|
|
3101
|
+
|
|
3102
|
+
dstX = dstPosition.x;
|
|
3103
|
+
dstY = dstPosition.y;
|
|
3104
|
+
dstZ = dstPosition.z || 0;
|
|
3105
|
+
|
|
3106
|
+
}
|
|
3107
|
+
|
|
3108
|
+
_commandEncoderDescriptor.label = 'copyTextureToTexture_' + srcTexture.id + '_' + dstTexture.id;
|
|
3109
|
+
const encoder = this.device.createCommandEncoder( _commandEncoderDescriptor );
|
|
3110
|
+
_commandEncoderDescriptor.reset();
|
|
3111
|
+
|
|
3112
|
+
const sourceGPU = this.get( srcTexture ).texture;
|
|
3113
|
+
const destinationGPU = this.get( dstTexture ).texture;
|
|
3114
|
+
|
|
3115
|
+
_texelCopyTextureInfoSrc.texture = sourceGPU;
|
|
3116
|
+
_texelCopyTextureInfoSrc.mipLevel = srcLevel;
|
|
3117
|
+
_texelCopyTextureInfoSrc.origin.x = srcX;
|
|
3118
|
+
_texelCopyTextureInfoSrc.origin.y = srcY;
|
|
3119
|
+
_texelCopyTextureInfoSrc.origin.z = srcZ;
|
|
3120
|
+
|
|
3121
|
+
_texelCopyTextureInfoDst.texture = destinationGPU;
|
|
3122
|
+
_texelCopyTextureInfoDst.mipLevel = dstLevel;
|
|
3123
|
+
_texelCopyTextureInfoDst.origin.x = dstX;
|
|
3124
|
+
_texelCopyTextureInfoDst.origin.y = dstY;
|
|
3125
|
+
_texelCopyTextureInfoDst.origin.z = dstZ;
|
|
3126
|
+
|
|
3127
|
+
_extent3D.width = srcWidth;
|
|
3128
|
+
_extent3D.height = srcHeight;
|
|
3129
|
+
_extent3D.depthOrArrayLayers = srcDepth;
|
|
3130
|
+
|
|
3131
|
+
encoder.copyTextureToTexture(
|
|
3132
|
+
_texelCopyTextureInfoSrc,
|
|
3133
|
+
_texelCopyTextureInfoDst,
|
|
3134
|
+
_extent3D
|
|
3135
|
+
);
|
|
3136
|
+
|
|
3137
|
+
_texelCopyTextureInfoSrc.reset();
|
|
3138
|
+
_texelCopyTextureInfoDst.reset();
|
|
3139
|
+
_extent3D.reset();
|
|
3140
|
+
|
|
3141
|
+
submit( this.device, encoder.finish() );
|
|
3142
|
+
|
|
3143
|
+
if ( dstLevel === 0 && dstTexture.generateMipmaps === true && dstTexture.mipmapsAutoUpdate === true ) {
|
|
3144
|
+
|
|
3145
|
+
this.textureUtils.generateMipmaps( dstTexture );
|
|
3146
|
+
|
|
3147
|
+
}
|
|
3148
|
+
|
|
3149
|
+
}
|
|
3150
|
+
|
|
3151
|
+
/**
|
|
3152
|
+
* Copies the current bound framebuffer to the given texture.
|
|
3153
|
+
*
|
|
3154
|
+
* @param {Texture} texture - The destination texture.
|
|
3155
|
+
* @param {RenderContext} renderContext - The render context.
|
|
3156
|
+
* @param {Vector4} rectangle - A four dimensional vector defining the origin and dimension of the copy.
|
|
3157
|
+
*/
|
|
3158
|
+
copyFramebufferToTexture( texture, renderContext, rectangle ) {
|
|
3159
|
+
|
|
3160
|
+
const renderContextData = this.get( renderContext );
|
|
3161
|
+
|
|
3162
|
+
let sourceGPU = null;
|
|
3163
|
+
|
|
3164
|
+
if ( renderContext.renderTarget ) {
|
|
3165
|
+
|
|
3166
|
+
if ( texture.isDepthTexture ) {
|
|
3167
|
+
|
|
3168
|
+
sourceGPU = this.get( renderContext.depthTexture ).texture;
|
|
3169
|
+
|
|
3170
|
+
} else {
|
|
3171
|
+
|
|
3172
|
+
sourceGPU = this.get( renderContext.textures[ 0 ] ).texture;
|
|
3173
|
+
|
|
3174
|
+
}
|
|
3175
|
+
|
|
3176
|
+
} else {
|
|
3177
|
+
|
|
3178
|
+
if ( texture.isDepthTexture ) {
|
|
3179
|
+
|
|
3180
|
+
sourceGPU = this.textureUtils.getDepthBuffer( renderContext.depth, renderContext.stencil );
|
|
3181
|
+
|
|
3182
|
+
} else {
|
|
3183
|
+
|
|
3184
|
+
sourceGPU = this.context.getCurrentTexture();
|
|
3185
|
+
|
|
3186
|
+
}
|
|
3187
|
+
|
|
3188
|
+
}
|
|
3189
|
+
|
|
3190
|
+
const destinationGPU = this.get( texture ).texture;
|
|
3191
|
+
|
|
3192
|
+
if ( sourceGPU.format !== destinationGPU.format ) {
|
|
3193
|
+
|
|
3194
|
+
error( 'WebGPUBackend: copyFramebufferToTexture: Source and destination formats do not match.', sourceGPU.format, destinationGPU.format );
|
|
3195
|
+
|
|
3196
|
+
return;
|
|
3197
|
+
|
|
3198
|
+
}
|
|
3199
|
+
|
|
3200
|
+
const generateMipmaps = texture.generateMipmaps === true && texture.mipmapsAutoUpdate === true && destinationGPU.mipLevelCount > 1;
|
|
3201
|
+
|
|
3202
|
+
if ( renderContextData.encoder && this._isRenderCameraDepthArray( renderContext ) === true ) {
|
|
3203
|
+
|
|
3204
|
+
// Layered draws are only executed in finishRender(), so preserve this copy as a render-stage boundary.
|
|
3205
|
+
const bundles = this._finishArrayCameraBundleEncoders( renderContextData );
|
|
3206
|
+
|
|
3207
|
+
renderContextData.arrayCameraRenderStages.push( {
|
|
3208
|
+
bundles,
|
|
3209
|
+
framebufferCopy: {
|
|
3210
|
+
texture,
|
|
3211
|
+
sourceGPU,
|
|
3212
|
+
destinationGPU,
|
|
3213
|
+
rectangle: { x: rectangle.x, y: rectangle.y, z: rectangle.z, w: rectangle.w },
|
|
3214
|
+
// ViewportTextureNode restores this flag before the deferred copy executes.
|
|
3215
|
+
generateMipmaps
|
|
3216
|
+
}
|
|
3217
|
+
} );
|
|
3218
|
+
|
|
3219
|
+
this._createArrayCameraBundleEncoders( renderContext, renderContextData );
|
|
3220
|
+
|
|
3221
|
+
return;
|
|
3222
|
+
|
|
3223
|
+
}
|
|
3224
|
+
|
|
3225
|
+
let encoder;
|
|
3226
|
+
|
|
3227
|
+
if ( renderContextData.currentPass ) {
|
|
3228
|
+
|
|
3229
|
+
renderContextData.currentPass.end();
|
|
3230
|
+
|
|
3231
|
+
encoder = renderContextData.encoder;
|
|
3232
|
+
|
|
3233
|
+
} else {
|
|
3234
|
+
|
|
3235
|
+
_commandEncoderDescriptor.label = 'copyFramebufferToTexture_' + texture.id;
|
|
3236
|
+
encoder = this.device.createCommandEncoder( _commandEncoderDescriptor );
|
|
3237
|
+
_commandEncoderDescriptor.reset();
|
|
3238
|
+
|
|
3239
|
+
}
|
|
3240
|
+
|
|
3241
|
+
// mipmaps must be genereated with the same encoder otherwise the copied texture data
|
|
3242
|
+
// might be out-of-sync, see #31768
|
|
3243
|
+
|
|
3244
|
+
this._copyFramebufferToTexture( encoder, texture, sourceGPU, destinationGPU, rectangle, 0, generateMipmaps );
|
|
3245
|
+
|
|
3246
|
+
if ( renderContextData.currentPass ) {
|
|
3247
|
+
|
|
3248
|
+
const { descriptor } = renderContextData;
|
|
3249
|
+
|
|
3250
|
+
for ( let i = 0; i < descriptor.colorAttachments.length; i ++ ) {
|
|
3251
|
+
|
|
3252
|
+
descriptor.colorAttachments[ i ].loadOp = GPULoadOp.Load;
|
|
3253
|
+
|
|
3254
|
+
}
|
|
3255
|
+
|
|
3256
|
+
if ( renderContext.depth ) descriptor.depthStencilAttachment.depthLoadOp = GPULoadOp.Load;
|
|
3257
|
+
if ( renderContext.stencil ) descriptor.depthStencilAttachment.stencilLoadOp = GPULoadOp.Load;
|
|
3258
|
+
|
|
3259
|
+
renderContextData.currentPass = encoder.beginRenderPass( descriptor );
|
|
3260
|
+
|
|
3261
|
+
this._resetRenderContextData( renderContextData );
|
|
3262
|
+
|
|
3263
|
+
if ( renderContext.viewport ) {
|
|
3264
|
+
|
|
3265
|
+
this.updateViewport( renderContext );
|
|
3266
|
+
|
|
3267
|
+
}
|
|
3268
|
+
|
|
3269
|
+
if ( renderContext.scissor ) {
|
|
3270
|
+
|
|
3271
|
+
this.updateScissor( renderContext );
|
|
3272
|
+
|
|
3273
|
+
}
|
|
3274
|
+
|
|
3275
|
+
} else {
|
|
3276
|
+
|
|
3277
|
+
submit( this.device, encoder.finish() );
|
|
3278
|
+
|
|
3279
|
+
}
|
|
3280
|
+
|
|
3281
|
+
}
|
|
3282
|
+
|
|
3283
|
+
/**
|
|
3284
|
+
* Encodes a framebuffer copy from a specific texture-array layer.
|
|
3285
|
+
*
|
|
3286
|
+
* @param {GPUCommandEncoder} encoder - The command encoder.
|
|
3287
|
+
* @param {Texture} texture - The destination texture.
|
|
3288
|
+
* @param {GPUTexture} sourceGPU - The source GPU texture.
|
|
3289
|
+
* @param {GPUTexture} destinationGPU - The destination GPU texture.
|
|
3290
|
+
* @param {Object} rectangle - The source rectangle.
|
|
3291
|
+
* @param {number} [sourceLayer=0] - The source array layer.
|
|
3292
|
+
* @param {boolean} [generateMipmaps=texture.generateMipmaps] - Whether mipmaps should be generated.
|
|
3293
|
+
* @private
|
|
3294
|
+
*/
|
|
3295
|
+
_copyFramebufferToTexture( encoder, texture, sourceGPU, destinationGPU, rectangle, sourceLayer = 0, generateMipmaps = texture.generateMipmaps ) {
|
|
3296
|
+
|
|
3297
|
+
_texelCopyTextureInfoSrc.texture = sourceGPU;
|
|
3298
|
+
_texelCopyTextureInfoSrc.origin.x = rectangle.x;
|
|
3299
|
+
_texelCopyTextureInfoSrc.origin.y = rectangle.y;
|
|
3300
|
+
_texelCopyTextureInfoSrc.origin.z = sourceLayer;
|
|
3301
|
+
|
|
3302
|
+
_texelCopyTextureInfoDst.texture = destinationGPU;
|
|
3303
|
+
|
|
3304
|
+
_extent3D.width = rectangle.z;
|
|
3305
|
+
_extent3D.height = rectangle.w;
|
|
3306
|
+
|
|
3307
|
+
encoder.copyTextureToTexture(
|
|
3308
|
+
_texelCopyTextureInfoSrc,
|
|
3309
|
+
_texelCopyTextureInfoDst,
|
|
3310
|
+
_extent3D
|
|
3311
|
+
);
|
|
3312
|
+
|
|
3313
|
+
_texelCopyTextureInfoSrc.reset();
|
|
3314
|
+
_texelCopyTextureInfoDst.reset();
|
|
3315
|
+
_extent3D.reset();
|
|
3316
|
+
|
|
3317
|
+
if ( generateMipmaps === true && destinationGPU.mipLevelCount > 1 ) {
|
|
3318
|
+
|
|
3319
|
+
this.textureUtils.generateMipmaps( texture, encoder );
|
|
3320
|
+
|
|
3321
|
+
}
|
|
3322
|
+
|
|
3323
|
+
}
|
|
3324
|
+
|
|
3325
|
+
/**
|
|
3326
|
+
* Checks if the given compatibility is supported by the backend.
|
|
3327
|
+
*
|
|
3328
|
+
* @param {string} name - The compatibility name.
|
|
3329
|
+
* @return {boolean} Whether the compatibility is supported or not.
|
|
3330
|
+
*/
|
|
3331
|
+
hasCompatibility( name ) {
|
|
3332
|
+
|
|
3333
|
+
if ( this._compatibility[ name ] !== undefined ) {
|
|
3334
|
+
|
|
3335
|
+
return this._compatibility[ name ];
|
|
3336
|
+
|
|
3337
|
+
}
|
|
3338
|
+
|
|
3339
|
+
return super.hasCompatibility( name );
|
|
3340
|
+
|
|
3341
|
+
}
|
|
3342
|
+
|
|
3343
|
+
async dispose() {
|
|
3344
|
+
|
|
3345
|
+
await super.dispose();
|
|
3346
|
+
|
|
3347
|
+
this.bindingUtils.dispose();
|
|
3348
|
+
this.textureUtils.dispose();
|
|
3349
|
+
|
|
3350
|
+
if ( this.uniformArena ) {
|
|
3351
|
+
|
|
3352
|
+
beforeSubmit( this.device, null );
|
|
3353
|
+
this.uniformArena.dispose();
|
|
3354
|
+
|
|
3355
|
+
}
|
|
3356
|
+
|
|
3357
|
+
if ( this.occludedResolveCache ) {
|
|
3358
|
+
|
|
3359
|
+
for ( const buffer of this.occludedResolveCache.values() ) {
|
|
3360
|
+
|
|
3361
|
+
buffer.destroy();
|
|
3362
|
+
|
|
3363
|
+
}
|
|
3364
|
+
|
|
3365
|
+
this.occludedResolveCache.clear();
|
|
3366
|
+
|
|
3367
|
+
}
|
|
3368
|
+
|
|
3369
|
+
if ( this.parameters.device === undefined && this.device !== null ) {
|
|
3370
|
+
|
|
3371
|
+
this.device.destroy();
|
|
3372
|
+
|
|
3373
|
+
}
|
|
3374
|
+
|
|
3375
|
+
}
|
|
3376
|
+
|
|
3377
|
+
}
|
|
3378
|
+
|
|
3379
|
+
export default WebGPUBackend;
|