super-three 0.165.0 → 0.168.0
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/build/three.cjs +854 -410
- package/build/three.module.js +849 -411
- package/build/three.module.min.js +1 -1
- package/build/three.webgpu.js +77755 -0
- package/build/three.webgpu.min.js +6 -0
- package/examples/jsm/Addons.js +5 -2
- package/examples/jsm/animation/AnimationClipCreator.js +1 -1
- package/examples/jsm/capabilities/WebGL.js +27 -21
- package/examples/jsm/controls/ArcballControls.js +174 -158
- package/examples/jsm/controls/DragControls.js +260 -132
- package/examples/jsm/controls/FirstPersonControls.js +175 -163
- package/examples/jsm/controls/FlyControls.js +194 -188
- package/examples/jsm/controls/OrbitControls.js +777 -786
- package/examples/jsm/controls/PointerLockControls.js +24 -15
- package/examples/jsm/controls/TrackballControls.js +453 -452
- package/examples/jsm/csm/CSMShader.js +4 -4
- package/examples/jsm/effects/AnaglyphEffect.js +6 -13
- package/examples/jsm/effects/ParallaxBarrierEffect.js +17 -11
- package/examples/jsm/effects/StereoEffect.js +6 -1
- package/examples/jsm/environments/RoomEnvironment.js +1 -1
- package/examples/jsm/exporters/GLTFExporter.js +13 -4
- package/examples/jsm/exporters/USDZExporter.js +29 -8
- package/examples/jsm/geometries/TeapotGeometry.js +1 -1
- package/examples/jsm/helpers/LightProbeHelper.js +42 -43
- package/examples/jsm/helpers/ViewHelper.js +51 -2
- package/examples/jsm/libs/tween.module.js +64 -75
- package/examples/jsm/lights/RectAreaLightTexturesLib.js +91 -0
- package/examples/jsm/lights/RectAreaLightUniformsLib.js +8 -63
- package/examples/jsm/lines/webgpu/Line2.js +20 -0
- package/examples/jsm/lines/webgpu/LineSegments2.js +376 -0
- package/examples/jsm/loaders/FBXLoader.js +23 -45
- package/examples/jsm/loaders/GLTFLoader.js +10 -4
- package/examples/jsm/loaders/KTX2Loader.js +19 -7
- package/examples/jsm/loaders/MaterialXLoader.js +10 -10
- package/examples/jsm/loaders/PCDLoader.js +9 -9
- package/examples/jsm/loaders/USDZLoader.js +124 -76
- package/examples/jsm/loaders/UltraHDRLoader.js +583 -0
- package/examples/jsm/loaders/VTKLoader.js +76 -3
- package/examples/jsm/misc/GPUComputationRenderer.js +9 -19
- package/examples/jsm/modifiers/SimplifyModifier.js +2 -1
- package/examples/jsm/objects/InstancedPoints.js +2 -2
- package/examples/jsm/objects/SkyMesh.js +188 -0
- package/examples/jsm/objects/Water2Mesh.js +159 -0
- package/examples/jsm/objects/WaterMesh.js +102 -0
- package/examples/jsm/physics/RapierPhysics.js +20 -0
- package/examples/jsm/postprocessing/OutlinePass.js +31 -46
- package/examples/jsm/postprocessing/RenderTransitionPass.js +13 -38
- package/examples/jsm/postprocessing/SSAARenderPass.js +3 -1
- package/examples/jsm/postprocessing/SSAOPass.js +6 -9
- package/examples/jsm/postprocessing/UnrealBloomPass.js +4 -4
- package/examples/jsm/shaders/BleachBypassShader.js +1 -2
- package/examples/jsm/shaders/ColorifyShader.js +1 -2
- package/examples/jsm/shaders/FXAAShader.js +0 -2
- package/examples/jsm/shaders/GTAOShader.js +1 -1
- package/examples/jsm/shaders/LuminosityHighPassShader.js +1 -3
- package/examples/jsm/shaders/OutputShader.js +1 -1
- package/examples/jsm/transpiler/GLSLDecoder.js +46 -4
- package/examples/jsm/transpiler/TSLEncoder.js +24 -22
- package/examples/jsm/utils/TextureUtils.js +1 -1
- package/package.json +8 -6
- package/src/Three.WebGPU.js +200 -0
- package/src/Three.js +3 -0
- package/src/constants.js +4 -1
- package/src/core/Object3D.js +22 -22
- package/src/extras/Controls.js +32 -0
- package/src/extras/TextureUtils.js +210 -0
- package/src/lights/Light.js +1 -0
- package/src/lights/LightShadow.js +5 -0
- package/{examples/jsm/lights → src/lights/webgpu}/IESSpotLight.js +1 -1
- package/src/loaders/ObjectLoader.js +33 -2
- package/{examples/jsm/nodes/loaders → src/loaders/nodes}/NodeLoader.js +6 -4
- package/{examples/jsm/nodes/loaders → src/loaders/nodes}/NodeMaterialLoader.js +2 -2
- package/{examples/jsm/nodes/loaders → src/loaders/nodes}/NodeObjectLoader.js +2 -1
- package/src/materials/Material.js +7 -1
- package/{examples/jsm/nodes/materials → src/materials/nodes}/InstancedPointsNodeMaterial.js +36 -27
- package/{examples/jsm/nodes/materials → src/materials/nodes}/Line2NodeMaterial.js +37 -40
- package/src/materials/nodes/LineBasicNodeMaterial.js +27 -0
- package/{examples/jsm/nodes/materials → src/materials/nodes}/LineDashedNodeMaterial.js +10 -11
- package/src/materials/nodes/MeshBasicNodeMaterial.js +73 -0
- package/src/materials/nodes/MeshLambertNodeMaterial.js +43 -0
- package/src/materials/nodes/MeshMatcapNodeMaterial.js +53 -0
- package/src/materials/nodes/MeshNormalNodeMaterial.js +40 -0
- package/src/materials/nodes/MeshPhongNodeMaterial.js +74 -0
- package/{examples/jsm/nodes/materials → src/materials/nodes}/MeshPhysicalNodeMaterial.js +22 -20
- package/{examples/jsm/nodes/materials → src/materials/nodes}/MeshSSSNodeMaterial.js +6 -6
- package/{examples/jsm/nodes/materials → src/materials/nodes}/MeshStandardNodeMaterial.js +28 -11
- package/src/materials/nodes/MeshToonNodeMaterial.js +34 -0
- package/{examples/jsm/nodes/materials → src/materials/nodes}/NodeMaterial.js +142 -96
- package/{examples/jsm/nodes/materials/Materials.js → src/materials/nodes/NodeMaterials.js} +1 -1
- package/{examples/jsm/nodes/materials → src/materials/nodes}/PointsNodeMaterial.js +5 -6
- package/src/materials/nodes/ShadowNodeMaterial.js +34 -0
- package/{examples/jsm/nodes/materials → src/materials/nodes}/SpriteNodeMaterial.js +13 -13
- package/{examples/jsm/nodes/materials → src/materials/nodes}/VolumeNodeMaterial.js +14 -16
- package/src/math/Box2.js +4 -4
- package/src/math/Box3.js +6 -6
- package/src/math/ColorManagement.js +10 -0
- package/src/math/Matrix2.js +54 -0
- package/src/math/Vector4.js +13 -0
- package/src/nodes/Nodes.js +164 -0
- package/src/nodes/TSL.js +176 -0
- package/{examples/jsm → src}/nodes/accessors/AccessorsUtils.js +8 -8
- package/src/nodes/accessors/BatchNode.js +124 -0
- package/{examples/jsm/nodes/accessors/BitangentNode.js → src/nodes/accessors/Bitangent.js} +9 -9
- package/{examples/jsm → src}/nodes/accessors/BufferAttributeNode.js +41 -6
- package/{examples/jsm → src}/nodes/accessors/BufferNode.js +4 -4
- package/src/nodes/accessors/Camera.js +19 -0
- package/{examples/jsm → src}/nodes/accessors/ClippingNode.js +16 -14
- package/src/nodes/accessors/CubeTextureNode.js +76 -0
- package/src/nodes/accessors/InstanceNode.js +144 -0
- package/src/nodes/accessors/InstancedPointsMaterialNode.js +21 -0
- package/{examples/jsm → src}/nodes/accessors/MaterialNode.js +66 -49
- package/src/nodes/accessors/MaterialProperties.js +3 -0
- package/{examples/jsm → src}/nodes/accessors/MaterialReferenceNode.js +6 -4
- package/src/nodes/accessors/ModelNode.js +37 -0
- package/{examples/jsm → src}/nodes/accessors/ModelViewProjectionNode.js +6 -7
- package/{examples/jsm → src}/nodes/accessors/MorphNode.js +35 -31
- package/src/nodes/accessors/Normal.js +62 -0
- package/{examples/jsm → src}/nodes/accessors/Object3DNode.js +11 -11
- package/src/nodes/accessors/PointUVNode.js +26 -0
- package/src/nodes/accessors/Position.js +10 -0
- package/src/nodes/accessors/ReferenceBaseNode.js +143 -0
- package/{examples/jsm → src}/nodes/accessors/ReferenceNode.js +14 -8
- package/src/nodes/accessors/ReflectVector.js +10 -0
- package/{examples/jsm → src}/nodes/accessors/RendererReferenceNode.js +6 -6
- package/{examples/jsm → src}/nodes/accessors/SceneNode.js +5 -6
- package/src/nodes/accessors/SkinningNode.js +187 -0
- package/{examples/jsm → src}/nodes/accessors/StorageBufferNode.js +54 -6
- package/{examples/jsm → src}/nodes/accessors/StorageTextureNode.js +16 -7
- package/src/nodes/accessors/Tangent.js +22 -0
- package/{examples/jsm → src}/nodes/accessors/Texture3DNode.js +11 -11
- package/{examples/jsm/nodes/accessors/TextureBicubicNode.js → src/nodes/accessors/TextureBicubic.js} +3 -32
- package/{examples/jsm → src}/nodes/accessors/TextureNode.js +69 -37
- package/{examples/jsm → src}/nodes/accessors/TextureSizeNode.js +4 -6
- package/{examples/jsm/nodes/accessors/UniformsNode.js → src/nodes/accessors/UniformArrayNode.js} +24 -9
- package/{examples/jsm → src}/nodes/accessors/UserDataNode.js +4 -4
- package/src/nodes/accessors/VelocityNode.js +83 -0
- package/{examples/jsm → src}/nodes/accessors/VertexColorNode.js +6 -5
- package/{examples/jsm → src}/nodes/code/CodeNode.js +5 -5
- package/{examples/jsm → src}/nodes/code/ExpressionNode.js +4 -4
- package/{examples/jsm → src}/nodes/code/FunctionCallNode.js +5 -5
- package/{examples/jsm → src}/nodes/code/FunctionNode.js +5 -23
- package/{examples/jsm → src}/nodes/code/ScriptableNode.js +18 -6
- package/{examples/jsm → src}/nodes/code/ScriptableValueNode.js +6 -7
- package/{examples/jsm → src}/nodes/core/AssignNode.js +5 -5
- package/{examples/jsm → src}/nodes/core/AttributeNode.js +22 -21
- package/{examples/jsm → src}/nodes/core/BypassNode.js +5 -5
- package/src/nodes/core/CacheNode.js +46 -0
- package/{examples/jsm → src}/nodes/core/ConstNode.js +2 -2
- package/{examples/jsm → src}/nodes/core/ContextNode.js +17 -11
- package/{examples/jsm → src}/nodes/core/IndexNode.js +17 -6
- package/{examples/jsm → src}/nodes/core/InputNode.js +2 -2
- package/{examples/jsm → src}/nodes/core/LightingModel.js +2 -2
- package/src/nodes/core/MRTNode.js +82 -0
- package/{examples/jsm → src}/nodes/core/Node.js +57 -31
- package/{examples/jsm → src}/nodes/core/NodeBuilder.js +216 -65
- package/src/nodes/core/NodeCache.js +36 -0
- package/{examples/jsm → src}/nodes/core/NodeFrame.js +42 -0
- package/{examples/jsm → src}/nodes/core/NodeFunction.js +2 -2
- package/{examples/jsm → src}/nodes/core/NodeUniform.js +1 -2
- package/{examples/jsm → src}/nodes/core/NodeUtils.js +7 -1
- package/{examples/jsm → src}/nodes/core/OutputStructNode.js +4 -4
- package/{examples/jsm → src}/nodes/core/ParameterNode.js +4 -4
- package/src/nodes/core/PropertyNode.js +84 -0
- package/{examples/jsm → src}/nodes/core/StackNode.js +26 -10
- package/{examples/jsm → src}/nodes/core/StructTypeNode.js +2 -2
- package/{examples/jsm → src}/nodes/core/TempNode.js +4 -4
- package/src/nodes/core/UniformGroupNode.js +55 -0
- package/{examples/jsm → src}/nodes/core/UniformNode.js +14 -5
- package/{examples/jsm → src}/nodes/core/VarNode.js +8 -12
- package/{examples/jsm → src}/nodes/core/VaryingNode.js +13 -5
- package/{examples/jsm → src}/nodes/display/AfterImageNode.js +27 -35
- package/src/nodes/display/AnaglyphPassNode.js +61 -0
- package/{examples/jsm → src}/nodes/display/AnamorphicNode.js +27 -30
- package/src/nodes/display/BleachBypass.js +26 -0
- package/src/nodes/display/BlendMode.js +54 -0
- package/src/nodes/display/BloomNode.js +335 -0
- package/{examples/jsm → src}/nodes/display/BumpMapNode.js +7 -12
- package/src/nodes/display/ColorAdjustment.js +46 -0
- package/src/nodes/display/ColorSpaceFunctions.js +38 -0
- package/src/nodes/display/ColorSpaceNode.js +85 -0
- package/src/nodes/display/DenoiseNode.js +201 -0
- package/src/nodes/display/DepthOfFieldNode.js +121 -0
- package/src/nodes/display/DotScreenNode.js +63 -0
- package/src/nodes/display/FXAANode.js +329 -0
- package/src/nodes/display/FilmNode.js +53 -0
- package/src/nodes/display/FrontFacingNode.js +41 -0
- package/src/nodes/display/GTAONode.js +328 -0
- package/{examples/jsm → src}/nodes/display/GaussianBlurNode.js +44 -24
- package/src/nodes/display/Lut3DNode.js +54 -0
- package/src/nodes/display/MotionBlur.js +25 -0
- package/{examples/jsm → src}/nodes/display/NormalMapNode.js +9 -11
- package/src/nodes/display/ParallaxBarrierPassNode.js +55 -0
- package/src/nodes/display/PassNode.js +367 -0
- package/src/nodes/display/PixelationPassNode.js +206 -0
- package/{examples/jsm → src}/nodes/display/PosterizeNode.js +4 -6
- package/src/nodes/display/RGBShiftNode.js +50 -0
- package/src/nodes/display/RenderOutputNode.js +56 -0
- package/src/nodes/display/SSAAPassNode.js +284 -0
- package/src/nodes/display/Sepia.js +17 -0
- package/src/nodes/display/SobelOperatorNode.js +123 -0
- package/src/nodes/display/StereoCompositePassNode.js +107 -0
- package/src/nodes/display/StereoPassNode.js +80 -0
- package/src/nodes/display/ToneMappingFunctions.js +190 -0
- package/src/nodes/display/ToneMappingNode.js +66 -0
- package/src/nodes/display/TransitionNode.js +77 -0
- package/src/nodes/display/ViewportDepthNode.js +121 -0
- package/src/nodes/display/ViewportDepthTextureNode.js +30 -0
- package/{examples/jsm → src}/nodes/display/ViewportNode.js +28 -26
- package/src/nodes/display/ViewportSharedTextureNode.js +36 -0
- package/{examples/jsm → src}/nodes/display/ViewportTextureNode.js +12 -12
- package/{examples/jsm → src}/nodes/fog/FogExp2Node.js +4 -6
- package/{examples/jsm → src}/nodes/fog/FogNode.js +5 -7
- package/{examples/jsm → src}/nodes/fog/FogRangeNode.js +4 -6
- package/{examples/jsm → src}/nodes/functions/BSDF/BRDF_GGX.js +4 -4
- package/{examples/jsm → src}/nodes/functions/BSDF/BRDF_Lambert.js +2 -2
- package/{examples/jsm → src}/nodes/functions/BSDF/BRDF_Sheen.js +6 -6
- package/{examples/jsm → src}/nodes/functions/BSDF/DFGApprox.js +2 -2
- package/{examples/jsm → src}/nodes/functions/BSDF/D_GGX.js +2 -2
- package/{examples/jsm → src}/nodes/functions/BSDF/D_GGX_Anisotropic.js +3 -3
- package/{examples/jsm → src}/nodes/functions/BSDF/EnvironmentBRDF.js +2 -2
- package/{examples/jsm → src}/nodes/functions/BSDF/F_Schlick.js +2 -2
- package/src/nodes/functions/BSDF/LTC.js +131 -0
- package/{examples/jsm → src}/nodes/functions/BSDF/Schlick_to_F0.js +2 -2
- package/{examples/jsm → src}/nodes/functions/BSDF/V_GGX_SmithCorrelated.js +2 -2
- package/{examples/jsm → src}/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.js +2 -2
- package/src/nodes/functions/BasicLightingModel.js +78 -0
- package/{examples/jsm → src}/nodes/functions/PhongLightingModel.js +10 -8
- package/{examples/jsm → src}/nodes/functions/PhysicalLightingModel.js +73 -31
- package/{examples/jsm → src}/nodes/functions/ShadowMaskModel.js +1 -1
- package/{examples/jsm → src}/nodes/functions/ToonLightingModel.js +6 -4
- package/src/nodes/functions/material/getGeometryRoughness.js +13 -0
- package/{examples/jsm → src}/nodes/functions/material/getRoughness.js +2 -2
- package/{examples/jsm → src}/nodes/geometry/RangeNode.js +23 -10
- package/{examples/jsm → src}/nodes/gpgpu/ComputeNode.js +5 -5
- package/src/nodes/lighting/AONode.js +24 -0
- package/{examples/jsm → src}/nodes/lighting/AmbientLightNode.js +2 -7
- package/src/nodes/lighting/AnalyticLightNode.js +354 -0
- package/src/nodes/lighting/BasicEnvironmentNode.js +27 -0
- package/src/nodes/lighting/BasicLightMapNode.js +29 -0
- package/{examples/jsm → src}/nodes/lighting/DirectionalLightNode.js +3 -9
- package/{examples/jsm → src}/nodes/lighting/EnvironmentNode.js +23 -21
- package/{examples/jsm → src}/nodes/lighting/HemisphereLightNode.js +4 -7
- package/{examples/jsm → src}/nodes/lighting/IESSpotLightNode.js +3 -8
- package/{examples/jsm → src}/nodes/lighting/IrradianceNode.js +2 -2
- package/{examples/jsm → src}/nodes/lighting/LightNode.js +5 -5
- package/src/nodes/lighting/LightProbeNode.js +76 -0
- package/{examples/jsm → src}/nodes/lighting/LightUtils.js +3 -3
- package/src/nodes/lighting/LightingContextNode.js +64 -0
- package/{examples/jsm → src}/nodes/lighting/LightingNode.js +4 -2
- package/src/nodes/lighting/LightsNode.js +231 -0
- package/{examples/jsm → src}/nodes/lighting/PointLightNode.js +4 -10
- package/src/nodes/lighting/RectAreaLightNode.js +93 -0
- package/{examples/jsm → src}/nodes/lighting/SpotLightNode.js +4 -10
- package/{examples/jsm → src}/nodes/materialx/MaterialXNodes.js +2 -2
- package/{examples/jsm → src}/nodes/materialx/lib/mx_hsv.js +43 -46
- package/{examples/jsm → src}/nodes/materialx/lib/mx_noise.js +500 -603
- package/{examples/jsm → src}/nodes/materialx/lib/mx_transform_color.js +3 -9
- package/{examples/jsm/nodes/math/CondNode.js → src/nodes/math/ConditionalNode.js} +31 -13
- package/src/nodes/math/Hash.js +13 -0
- package/src/nodes/math/MathNode.js +404 -0
- package/{examples/jsm → src}/nodes/math/MathUtils.js +0 -7
- package/{examples/jsm → src}/nodes/math/OperatorNode.js +100 -58
- package/{examples/jsm → src}/nodes/math/TriNoise3D.js +19 -29
- package/{examples/jsm → src}/nodes/parsers/GLSLNodeFunction.js +7 -7
- package/{examples/jsm → src}/nodes/pmrem/PMREMNode.js +60 -16
- package/{examples/jsm → src}/nodes/pmrem/PMREMUtils.js +46 -46
- package/src/nodes/procedural/Checker.js +14 -0
- package/src/nodes/tsl/TSLBase.js +30 -0
- package/{examples/jsm/nodes/shadernode/ShaderNode.js → src/nodes/tsl/TSLCore.js} +106 -96
- package/{examples/jsm → src}/nodes/utils/ArrayElementNode.js +2 -2
- package/{examples/jsm → src}/nodes/utils/ConvertNode.js +2 -2
- package/src/nodes/utils/CubeMapNode.js +157 -0
- package/src/nodes/utils/Discard.js +8 -0
- package/{examples/jsm → src}/nodes/utils/EquirectUVNode.js +5 -5
- package/src/nodes/utils/FlipNode.js +65 -0
- package/{examples/jsm → src}/nodes/utils/FunctionOverloadingNode.js +7 -5
- package/{examples/jsm → src}/nodes/utils/JoinNode.js +2 -2
- package/{examples/jsm → src}/nodes/utils/LoopNode.js +19 -12
- package/{examples/jsm → src}/nodes/utils/MatcapUVNode.js +6 -6
- package/{examples/jsm → src}/nodes/utils/MaxMipLevelNode.js +12 -6
- package/{examples/jsm → src}/nodes/utils/OscNode.js +7 -7
- package/src/nodes/utils/Packing.js +4 -0
- package/src/nodes/utils/RTTNode.js +130 -0
- package/{examples/jsm → src}/nodes/utils/ReflectorNode.js +17 -4
- package/{examples/jsm → src}/nodes/utils/RemapNode.js +7 -7
- package/{examples/jsm → src}/nodes/utils/RotateNode.js +4 -12
- package/{examples/jsm → src}/nodes/utils/SetNode.js +2 -2
- package/{examples/jsm → src}/nodes/utils/SplitNode.js +2 -2
- package/{examples/jsm → src}/nodes/utils/SpriteSheetUVNode.js +5 -5
- package/src/nodes/utils/SpriteUtils.js +47 -0
- package/{examples/jsm → src}/nodes/utils/StorageArrayElementNode.js +4 -6
- package/{examples/jsm → src}/nodes/utils/TimerNode.js +5 -5
- package/{examples/jsm → src}/nodes/utils/TriplanarTexturesNode.js +7 -9
- package/src/nodes/utils/UVUtils.js +19 -0
- package/src/nodes/utils/ViewportUtils.js +14 -0
- package/src/objects/BatchedMesh.js +169 -190
- package/src/objects/InstancedMesh.js +1 -1
- package/src/renderers/WebGLRenderer.js +60 -23
- package/{examples/jsm → src}/renderers/common/Attributes.js +2 -1
- package/{examples/jsm → src}/renderers/common/Backend.js +30 -27
- package/{examples/jsm → src}/renderers/common/Background.js +12 -4
- package/src/renderers/common/BindGroup.js +18 -0
- package/{examples/jsm → src}/renderers/common/Bindings.js +45 -32
- package/{examples/jsm → src}/renderers/common/ClippingContext.js +18 -7
- package/{examples/jsm → src}/renderers/common/Color4.js +1 -1
- package/{examples/jsm → src}/renderers/common/CubeRenderTarget.js +16 -4
- package/{examples/jsm → src}/renderers/common/Geometries.js +37 -5
- package/{examples/jsm → src}/renderers/common/Info.js +34 -6
- package/src/renderers/common/PostProcessing.js +90 -0
- package/{examples/jsm/objects → src/renderers/common}/QuadMesh.js +8 -3
- package/{examples/jsm → src}/renderers/common/RenderContext.js +25 -1
- package/{examples/jsm → src}/renderers/common/RenderContexts.js +1 -1
- package/{examples/jsm → src}/renderers/common/RenderList.js +1 -1
- package/{examples/jsm → src}/renderers/common/RenderObject.js +45 -12
- package/{examples/jsm → src}/renderers/common/Renderer.js +151 -73
- package/{examples/jsm → src}/renderers/common/SampledTexture.js +14 -5
- package/src/renderers/common/StandardRenderer.js +18 -0
- package/{examples/jsm → src}/renderers/common/StorageBufferAttribute.js +1 -1
- package/{examples/jsm → src}/renderers/common/StorageInstancedBufferAttribute.js +1 -1
- package/{examples/jsm → src}/renderers/common/StorageTexture.js +2 -1
- package/{examples/jsm → src}/renderers/common/Textures.js +14 -14
- package/{examples/jsm → src}/renderers/common/Uniform.js +9 -4
- package/{examples/jsm → src}/renderers/common/UniformsGroup.js +69 -31
- package/{examples/jsm → src}/renderers/common/extras/PMREMGenerator.js +25 -25
- package/src/renderers/common/nodes/NodeBuilderState.js +58 -0
- package/src/renderers/common/nodes/NodeLibrary.js +118 -0
- package/{examples/jsm → src}/renderers/common/nodes/NodeSampledTexture.js +8 -7
- package/{examples/jsm → src}/renderers/common/nodes/NodeSampler.js +2 -1
- package/{examples/jsm → src}/renderers/common/nodes/NodeStorageBuffer.js +5 -1
- package/{examples/jsm → src}/renderers/common/nodes/NodeUniform.js +3 -3
- package/{examples/jsm → src}/renderers/common/nodes/NodeUniformBuffer.js +2 -1
- package/{examples/jsm → src}/renderers/common/nodes/NodeUniformsGroup.js +2 -8
- package/{examples/jsm → src}/renderers/common/nodes/Nodes.js +69 -21
- package/src/renderers/common/nodes/StandardNodeLibrary.js +105 -0
- package/src/renderers/shaders/ShaderChunk/batching_pars_vertex.glsl.js +16 -1
- package/src/renderers/shaders/ShaderChunk/batching_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/color_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/colorspace_pars_fragment.glsl.js +0 -9
- package/src/renderers/shaders/ShaderChunk/common.glsl.js +0 -10
- package/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js +3 -3
- package/src/renderers/shaders/ShaderChunk/packing.glsl.js +45 -13
- package/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.js +7 -4
- package/src/renderers/shaders/ShaderChunk/shadowmap_pars_vertex.glsl.js +3 -0
- package/src/renderers/shaders/ShaderChunk/shadowmask_pars_fragment.glsl.js +3 -3
- package/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.js +2 -2
- package/src/renderers/shaders/ShaderLib/depth.glsl.js +8 -0
- package/src/renderers/shaders/UniformsLib.js +3 -0
- package/src/renderers/webgl/WebGLAttributes.js +2 -2
- package/src/renderers/webgl/WebGLBufferRenderer.js +6 -19
- package/src/renderers/webgl/WebGLIndexedBufferRenderer.js +6 -18
- package/src/renderers/webgl/WebGLLights.js +6 -0
- package/src/renderers/webgl/WebGLProgram.js +27 -1
- package/src/renderers/webgl/WebGLPrograms.js +1 -1
- package/src/renderers/webgl/WebGLProperties.js +7 -0
- package/src/renderers/webgl/WebGLTextures.js +75 -57
- package/src/renderers/webgl/WebGLUniforms.js +12 -2
- package/src/renderers/webgl/WebGLUniformsGroups.js +7 -7
- package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/WebGLBackend.js +242 -120
- package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/nodes/GLSLNodeBuilder.js +227 -44
- package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/utils/WebGLAttributeUtils.js +2 -2
- package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/utils/WebGLConstants.js +1 -0
- package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/utils/WebGLExtensions.js +2 -0
- package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/utils/WebGLState.js +22 -1
- package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/utils/WebGLTextureUtils.js +62 -23
- package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/utils/WebGLUtils.js +1 -1
- package/{examples/jsm → src}/renderers/webgpu/WebGPUBackend.js +242 -136
- package/{examples/jsm → src}/renderers/webgpu/WebGPURenderer.js +9 -9
- package/{examples/jsm → src}/renderers/webgpu/nodes/WGSLNodeBuilder.js +281 -107
- package/src/renderers/webgpu/nodes/WGSLNodeFunction.js +159 -0
- package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUAttributeUtils.js +2 -1
- package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUBindingUtils.js +64 -33
- package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUConstants.js +4 -1
- package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUPipelineUtils.js +34 -36
- package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUTexturePassUtils.js +62 -5
- package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUTextureUtils.js +76 -44
- package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUUtils.js +42 -4
- package/src/renderers/webxr/WebXRDepthSensing.js +6 -0
- package/src/renderers/webxr/WebXRManager.js +37 -24
- package/src/textures/CompressedArrayTexture.js +1 -1
- package/examples/jsm/loaders/LogLuvLoader.js +0 -606
- package/examples/jsm/nodes/Nodes.js +0 -202
- package/examples/jsm/nodes/accessors/BatchNode.js +0 -78
- package/examples/jsm/nodes/accessors/CameraNode.js +0 -12
- package/examples/jsm/nodes/accessors/CubeTextureNode.js +0 -61
- package/examples/jsm/nodes/accessors/InstanceNode.js +0 -94
- package/examples/jsm/nodes/accessors/InstancedPointsMaterialNode.js +0 -21
- package/examples/jsm/nodes/accessors/ModelNode.js +0 -36
- package/examples/jsm/nodes/accessors/NormalNode.js +0 -14
- package/examples/jsm/nodes/accessors/PointUVNode.js +0 -26
- package/examples/jsm/nodes/accessors/PositionNode.js +0 -10
- package/examples/jsm/nodes/accessors/ReflectVectorNode.js +0 -6
- package/examples/jsm/nodes/accessors/SkinningNode.js +0 -124
- package/examples/jsm/nodes/accessors/TangentNode.js +0 -23
- package/examples/jsm/nodes/core/CacheNode.js +0 -49
- package/examples/jsm/nodes/core/NodeCache.js +0 -26
- package/examples/jsm/nodes/core/NodeKeywords.js +0 -80
- package/examples/jsm/nodes/core/PropertyNode.js +0 -83
- package/examples/jsm/nodes/core/UniformGroupNode.js +0 -36
- package/examples/jsm/nodes/display/BlendModeNode.js +0 -128
- package/examples/jsm/nodes/display/ColorAdjustmentNode.js +0 -99
- package/examples/jsm/nodes/display/ColorSpaceNode.js +0 -108
- package/examples/jsm/nodes/display/FrontFacingNode.js +0 -40
- package/examples/jsm/nodes/display/PassNode.js +0 -201
- package/examples/jsm/nodes/display/ToneMappingNode.js +0 -188
- package/examples/jsm/nodes/display/ViewportDepthNode.js +0 -97
- package/examples/jsm/nodes/display/ViewportDepthTextureNode.js +0 -31
- package/examples/jsm/nodes/display/ViewportSharedTextureNode.js +0 -37
- package/examples/jsm/nodes/functions/material/getGeometryRoughness.js +0 -13
- package/examples/jsm/nodes/lighting/AONode.js +0 -27
- package/examples/jsm/nodes/lighting/AnalyticLightNode.js +0 -256
- package/examples/jsm/nodes/lighting/LightingContextNode.js +0 -66
- package/examples/jsm/nodes/lighting/LightsNode.js +0 -215
- package/examples/jsm/nodes/materials/LineBasicNodeMaterial.js +0 -28
- package/examples/jsm/nodes/materials/MeshBasicNodeMaterial.js +0 -28
- package/examples/jsm/nodes/materials/MeshLambertNodeMaterial.js +0 -34
- package/examples/jsm/nodes/materials/MeshMatcapNodeMaterial.js +0 -52
- package/examples/jsm/nodes/materials/MeshNormalNodeMaterial.js +0 -38
- package/examples/jsm/nodes/materials/MeshPhongNodeMaterial.js +0 -65
- package/examples/jsm/nodes/materials/MeshToonNodeMaterial.js +0 -34
- package/examples/jsm/nodes/materials/ShadowNodeMaterial.js +0 -34
- package/examples/jsm/nodes/math/HashNode.js +0 -34
- package/examples/jsm/nodes/math/MathNode.js +0 -391
- package/examples/jsm/nodes/procedural/CheckerNode.js +0 -42
- package/examples/jsm/nodes/utils/DiscardNode.js +0 -27
- package/examples/jsm/nodes/utils/PackingNode.js +0 -55
- package/examples/jsm/nodes/utils/RotateUVNode.js +0 -35
- package/examples/jsm/renderers/common/PostProcessing.js +0 -33
- package/examples/jsm/renderers/common/nodes/NodeBuilderState.js +0 -44
- package/examples/jsm/renderers/webgpu/nodes/WGSLNodeFunction.js +0 -104
- /package/{examples/jsm/nodes/accessors/UVNode.js → src/nodes/accessors/UV.js} +0 -0
- /package/{examples/jsm → src}/nodes/core/NodeAttribute.js +0 -0
- /package/{examples/jsm → src}/nodes/core/NodeCode.js +0 -0
- /package/{examples/jsm → src}/nodes/core/NodeFunctionInput.js +0 -0
- /package/{examples/jsm → src}/nodes/core/NodeParser.js +0 -0
- /package/{examples/jsm → src}/nodes/core/NodeVar.js +0 -0
- /package/{examples/jsm → src}/nodes/core/NodeVarying.js +0 -0
- /package/{examples/jsm → src}/nodes/core/UniformGroup.js +0 -0
- /package/{examples/jsm → src}/nodes/core/constants.js +0 -0
- /package/{examples/jsm → src}/nodes/materialx/DISCLAIMER.md +0 -0
- /package/{examples/jsm → src}/nodes/parsers/GLSLNodeParser.js +0 -0
- /package/{examples/jsm → src}/renderers/common/Animation.js +0 -0
- /package/{examples/jsm → src}/renderers/common/Binding.js +0 -0
- /package/{examples/jsm → src}/renderers/common/Buffer.js +0 -0
- /package/{examples/jsm → src}/renderers/common/BufferUtils.js +0 -0
- /package/{examples/jsm → src}/renderers/common/ChainMap.js +0 -0
- /package/{examples/jsm → src}/renderers/common/ComputePipeline.js +0 -0
- /package/{examples/jsm → src}/renderers/common/Constants.js +0 -0
- /package/{examples/jsm → src}/renderers/common/DataMap.js +0 -0
- /package/{examples/jsm → src}/renderers/common/Pipeline.js +0 -0
- /package/{examples/jsm → src}/renderers/common/Pipelines.js +0 -0
- /package/{examples/jsm → src}/renderers/common/ProgrammableStage.js +0 -0
- /package/{examples/jsm → src}/renderers/common/RenderBundle.js +0 -0
- /package/{examples/jsm → src}/renderers/common/RenderBundles.js +0 -0
- /package/{examples/jsm → src}/renderers/common/RenderLists.js +0 -0
- /package/{examples/jsm → src}/renderers/common/RenderObjects.js +0 -0
- /package/{examples/jsm → src}/renderers/common/RenderPipeline.js +0 -0
- /package/{examples/jsm → src}/renderers/common/Sampler.js +0 -0
- /package/{examples/jsm → src}/renderers/common/StorageBuffer.js +0 -0
- /package/{examples/jsm → src}/renderers/common/UniformBuffer.js +0 -0
- /package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/WebGLBufferRenderer.js +0 -0
- /package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/utils/WebGLCapabilities.js +0 -0
- /package/{examples/jsm → src}/renderers/webgpu/nodes/WGSLNodeParser.js +0 -0
|
@@ -207,7 +207,7 @@ class InstancedMesh extends Mesh {
|
|
|
207
207
|
|
|
208
208
|
if ( this.instanceColor === null ) {
|
|
209
209
|
|
|
210
|
-
this.instanceColor = new InstancedBufferAttribute( new Float32Array( this.instanceMatrix.count * 3 ), 3 );
|
|
210
|
+
this.instanceColor = new InstancedBufferAttribute( new Float32Array( this.instanceMatrix.count * 3 ).fill( 1 ), 3 );
|
|
211
211
|
|
|
212
212
|
}
|
|
213
213
|
|
|
@@ -56,7 +56,7 @@ import { WebVRManager } from './webvr/WebVRManager.js';
|
|
|
56
56
|
import { WebXRManager } from './webxr/WebXRManager.js';
|
|
57
57
|
import { WebGLMaterials } from './webgl/WebGLMaterials.js';
|
|
58
58
|
import { WebGLUniformsGroups } from './webgl/WebGLUniformsGroups.js';
|
|
59
|
-
import { createCanvasElement, probeAsync } from '../utils.js';
|
|
59
|
+
import { createCanvasElement, probeAsync, warnOnce } from '../utils.js';
|
|
60
60
|
import { ColorManagement } from '../math/ColorManagement.js';
|
|
61
61
|
|
|
62
62
|
class WebGLRenderer {
|
|
@@ -203,6 +203,8 @@ class WebGLRenderer {
|
|
|
203
203
|
|
|
204
204
|
const _vector3 = new Vector3();
|
|
205
205
|
|
|
206
|
+
const _vector4 = new Vector4();
|
|
207
|
+
|
|
206
208
|
const _emptyScene = { background: null, fog: null, environment: null, overrideMaterial: null, isScene: true };
|
|
207
209
|
|
|
208
210
|
let _renderBackground = false;
|
|
@@ -862,7 +864,25 @@ class WebGLRenderer {
|
|
|
862
864
|
|
|
863
865
|
} else {
|
|
864
866
|
|
|
865
|
-
|
|
867
|
+
if ( ! extensions.get( 'WEBGL_multi_draw' ) ) {
|
|
868
|
+
|
|
869
|
+
const starts = object._multiDrawStarts;
|
|
870
|
+
const counts = object._multiDrawCounts;
|
|
871
|
+
const drawCount = object._multiDrawCount;
|
|
872
|
+
const bytesPerElement = index ? attributes.get( index ).bytesPerElement : 1;
|
|
873
|
+
const uniforms = properties.get( material ).currentProgram.getUniforms();
|
|
874
|
+
for ( let i = 0; i < drawCount; i ++ ) {
|
|
875
|
+
|
|
876
|
+
uniforms.setValue( _gl, '_gl_DrawID', i );
|
|
877
|
+
renderer.render( starts[ i ] / bytesPerElement, counts[ i ] );
|
|
878
|
+
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
} else {
|
|
882
|
+
|
|
883
|
+
renderer.renderMultiDraw( object._multiDrawStarts, object._multiDrawCounts, object._multiDrawCount );
|
|
884
|
+
|
|
885
|
+
}
|
|
866
886
|
|
|
867
887
|
}
|
|
868
888
|
|
|
@@ -1335,7 +1355,7 @@ class WebGLRenderer {
|
|
|
1335
1355
|
|
|
1336
1356
|
if ( sortObjects ) {
|
|
1337
1357
|
|
|
1338
|
-
|
|
1358
|
+
_vector4.setFromMatrixPosition( object.matrixWorld )
|
|
1339
1359
|
.applyMatrix4( _projScreenMatrix );
|
|
1340
1360
|
|
|
1341
1361
|
}
|
|
@@ -1345,7 +1365,7 @@ class WebGLRenderer {
|
|
|
1345
1365
|
|
|
1346
1366
|
if ( material.visible ) {
|
|
1347
1367
|
|
|
1348
|
-
currentRenderList.push( object, geometry, material, groupOrder,
|
|
1368
|
+
currentRenderList.push( object, geometry, material, groupOrder, _vector4.z, null );
|
|
1349
1369
|
|
|
1350
1370
|
}
|
|
1351
1371
|
|
|
@@ -1363,16 +1383,16 @@ class WebGLRenderer {
|
|
|
1363
1383
|
if ( object.boundingSphere !== undefined ) {
|
|
1364
1384
|
|
|
1365
1385
|
if ( object.boundingSphere === null ) object.computeBoundingSphere();
|
|
1366
|
-
|
|
1386
|
+
_vector4.copy( object.boundingSphere.center );
|
|
1367
1387
|
|
|
1368
1388
|
} else {
|
|
1369
1389
|
|
|
1370
1390
|
if ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();
|
|
1371
|
-
|
|
1391
|
+
_vector4.copy( geometry.boundingSphere.center );
|
|
1372
1392
|
|
|
1373
1393
|
}
|
|
1374
1394
|
|
|
1375
|
-
|
|
1395
|
+
_vector4
|
|
1376
1396
|
.applyMatrix4( object.matrixWorld )
|
|
1377
1397
|
.applyMatrix4( _projScreenMatrix );
|
|
1378
1398
|
|
|
@@ -1389,7 +1409,7 @@ class WebGLRenderer {
|
|
|
1389
1409
|
|
|
1390
1410
|
if ( groupMaterial && groupMaterial.visible ) {
|
|
1391
1411
|
|
|
1392
|
-
currentRenderList.push( object, geometry, groupMaterial, groupOrder,
|
|
1412
|
+
currentRenderList.push( object, geometry, groupMaterial, groupOrder, _vector4.z, group );
|
|
1393
1413
|
|
|
1394
1414
|
}
|
|
1395
1415
|
|
|
@@ -1397,7 +1417,7 @@ class WebGLRenderer {
|
|
|
1397
1417
|
|
|
1398
1418
|
} else if ( material.visible ) {
|
|
1399
1419
|
|
|
1400
|
-
currentRenderList.push( object, geometry, material, groupOrder,
|
|
1420
|
+
currentRenderList.push( object, geometry, material, groupOrder, _vector4.z, null );
|
|
1401
1421
|
|
|
1402
1422
|
}
|
|
1403
1423
|
|
|
@@ -1492,15 +1512,9 @@ class WebGLRenderer {
|
|
|
1492
1512
|
_currentClearAlpha = _this.getClearAlpha();
|
|
1493
1513
|
if ( _currentClearAlpha < 1 ) _this.setClearColor( 0xffffff, 0.5 );
|
|
1494
1514
|
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
background.render( scene );
|
|
1498
|
-
|
|
1499
|
-
} else {
|
|
1515
|
+
_this.clear();
|
|
1500
1516
|
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
}
|
|
1517
|
+
if ( _renderBackground ) background.render( scene );
|
|
1504
1518
|
|
|
1505
1519
|
// Turn off the features which can affect the frag color for opaque objects pass.
|
|
1506
1520
|
// Otherwise they are applied twice in opaque objects pass and transmission objects pass.
|
|
@@ -1677,8 +1691,6 @@ class WebGLRenderer {
|
|
|
1677
1691
|
|
|
1678
1692
|
parameters.uniforms = programCache.getUniforms( material );
|
|
1679
1693
|
|
|
1680
|
-
material.onBuild( object, parameters, _this );
|
|
1681
|
-
|
|
1682
1694
|
material.onBeforeCompile( parameters, _this );
|
|
1683
1695
|
|
|
1684
1696
|
program = programCache.acquireProgram( parameters, programCacheKey );
|
|
@@ -2063,6 +2075,9 @@ class WebGLRenderer {
|
|
|
2063
2075
|
p_uniforms.setOptional( _gl, object, 'batchingTexture' );
|
|
2064
2076
|
p_uniforms.setValue( _gl, 'batchingTexture', object._matricesTexture, textures );
|
|
2065
2077
|
|
|
2078
|
+
p_uniforms.setOptional( _gl, object, 'batchingIdTexture' );
|
|
2079
|
+
p_uniforms.setValue( _gl, 'batchingIdTexture', object._indirectTexture, textures );
|
|
2080
|
+
|
|
2066
2081
|
p_uniforms.setOptional( _gl, object, 'batchingColorTexture' );
|
|
2067
2082
|
if ( object._colorsTexture !== null ) {
|
|
2068
2083
|
|
|
@@ -2318,6 +2333,28 @@ class WebGLRenderer {
|
|
|
2318
2333
|
// Color and depth texture must be rebound in order for the swapchain to update.
|
|
2319
2334
|
textures.rebindTextures( renderTarget, properties.get( renderTarget.texture ).__webglTexture, properties.get( renderTarget.depthTexture ).__webglTexture );
|
|
2320
2335
|
|
|
2336
|
+
} else if ( renderTarget.depthBuffer ) {
|
|
2337
|
+
|
|
2338
|
+
// check if the depth texture is already bound to the frame buffer and that it's been initialized
|
|
2339
|
+
const depthTexture = renderTarget.depthTexture;
|
|
2340
|
+
if ( renderTargetProperties.__boundDepthTexture !== depthTexture ) {
|
|
2341
|
+
|
|
2342
|
+
// check if the depth texture is compatible
|
|
2343
|
+
if (
|
|
2344
|
+
depthTexture !== null &&
|
|
2345
|
+
properties.has( depthTexture ) &&
|
|
2346
|
+
( renderTarget.width !== depthTexture.image.width || renderTarget.height !== depthTexture.image.height )
|
|
2347
|
+
) {
|
|
2348
|
+
|
|
2349
|
+
throw new Error( 'WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.' );
|
|
2350
|
+
|
|
2351
|
+
}
|
|
2352
|
+
|
|
2353
|
+
// Swap the depth buffer to the currently attached one
|
|
2354
|
+
textures.setupDepthRenderbuffer( renderTarget );
|
|
2355
|
+
|
|
2356
|
+
}
|
|
2357
|
+
|
|
2321
2358
|
}
|
|
2322
2359
|
|
|
2323
2360
|
const texture = renderTarget.texture;
|
|
@@ -2550,7 +2587,7 @@ class WebGLRenderer {
|
|
|
2550
2587
|
if ( texture.isTexture !== true ) {
|
|
2551
2588
|
|
|
2552
2589
|
// @deprecated, r165
|
|
2553
|
-
|
|
2590
|
+
warnOnce( 'WebGLRenderer: copyFramebufferToTexture function signature has changed.' );
|
|
2554
2591
|
|
|
2555
2592
|
position = arguments[ 0 ] || null;
|
|
2556
2593
|
texture = arguments[ 1 ];
|
|
@@ -2578,7 +2615,7 @@ class WebGLRenderer {
|
|
|
2578
2615
|
if ( srcTexture.isTexture !== true ) {
|
|
2579
2616
|
|
|
2580
2617
|
// @deprecated, r165
|
|
2581
|
-
|
|
2618
|
+
warnOnce( 'WebGLRenderer: copyTextureToTexture function signature has changed.' );
|
|
2582
2619
|
|
|
2583
2620
|
dstPosition = arguments[ 0 ] || null;
|
|
2584
2621
|
srcTexture = arguments[ 1 ];
|
|
@@ -2654,7 +2691,7 @@ class WebGLRenderer {
|
|
|
2654
2691
|
|
|
2655
2692
|
} else {
|
|
2656
2693
|
|
|
2657
|
-
_gl.texSubImage2D( _gl.TEXTURE_2D, level, dstX, dstY, glFormat, glType, image );
|
|
2694
|
+
_gl.texSubImage2D( _gl.TEXTURE_2D, level, dstX, dstY, width, height, glFormat, glType, image );
|
|
2658
2695
|
|
|
2659
2696
|
}
|
|
2660
2697
|
|
|
@@ -2679,7 +2716,7 @@ class WebGLRenderer {
|
|
|
2679
2716
|
if ( srcTexture.isTexture !== true ) {
|
|
2680
2717
|
|
|
2681
2718
|
// @deprecated, r165
|
|
2682
|
-
|
|
2719
|
+
warnOnce( 'WebGLRenderer: copyTextureToTexture3D function signature has changed.' );
|
|
2683
2720
|
|
|
2684
2721
|
srcRegion = arguments[ 0 ] || null;
|
|
2685
2722
|
dstPosition = arguments[ 1 ] || null;
|
|
@@ -3,7 +3,10 @@ let vector4 = null;
|
|
|
3
3
|
let color4 = null;
|
|
4
4
|
|
|
5
5
|
import Color4 from './Color4.js';
|
|
6
|
-
import { Vector2
|
|
6
|
+
import { Vector2 } from '../../math/Vector2.js';
|
|
7
|
+
import { Vector4 } from '../../math/Vector4.js';
|
|
8
|
+
import { createCanvasElement } from '../../utils.js';
|
|
9
|
+
import { REVISION } from '../../constants.js';
|
|
7
10
|
|
|
8
11
|
class Backend {
|
|
9
12
|
|
|
@@ -24,63 +27,63 @@ class Backend {
|
|
|
24
27
|
|
|
25
28
|
// render context
|
|
26
29
|
|
|
27
|
-
begin( renderContext ) { }
|
|
30
|
+
begin( /*renderContext*/ ) { }
|
|
28
31
|
|
|
29
|
-
finish( renderContext ) { }
|
|
32
|
+
finish( /*renderContext*/ ) { }
|
|
30
33
|
|
|
31
34
|
// render object
|
|
32
35
|
|
|
33
|
-
draw( renderObject, info ) { }
|
|
36
|
+
draw( /*renderObject, info*/ ) { }
|
|
34
37
|
|
|
35
38
|
// program
|
|
36
39
|
|
|
37
|
-
createProgram( program ) { }
|
|
40
|
+
createProgram( /*program*/ ) { }
|
|
38
41
|
|
|
39
|
-
destroyProgram( program ) { }
|
|
42
|
+
destroyProgram( /*program*/ ) { }
|
|
40
43
|
|
|
41
44
|
// bindings
|
|
42
45
|
|
|
43
|
-
createBindings(
|
|
46
|
+
createBindings( /*bingGroup, bindings*/ ) { }
|
|
44
47
|
|
|
45
|
-
updateBindings(
|
|
48
|
+
updateBindings( /*bingGroup, bindings*/ ) { }
|
|
46
49
|
|
|
47
50
|
// pipeline
|
|
48
51
|
|
|
49
|
-
createRenderPipeline( renderObject ) { }
|
|
52
|
+
createRenderPipeline( /*renderObject*/ ) { }
|
|
50
53
|
|
|
51
|
-
createComputePipeline( computeNode, pipeline ) { }
|
|
54
|
+
createComputePipeline( /*computeNode, pipeline*/ ) { }
|
|
52
55
|
|
|
53
|
-
destroyPipeline( pipeline ) { }
|
|
56
|
+
destroyPipeline( /*pipeline*/ ) { }
|
|
54
57
|
|
|
55
58
|
// cache key
|
|
56
59
|
|
|
57
|
-
needsRenderUpdate( renderObject ) { } // return Boolean ( fast test )
|
|
60
|
+
needsRenderUpdate( /*renderObject*/ ) { } // return Boolean ( fast test )
|
|
58
61
|
|
|
59
|
-
getRenderCacheKey( renderObject ) { } // return String
|
|
62
|
+
getRenderCacheKey( /*renderObject*/ ) { } // return String
|
|
60
63
|
|
|
61
64
|
// node builder
|
|
62
65
|
|
|
63
|
-
createNodeBuilder( renderObject ) { } // return NodeBuilder (ADD IT)
|
|
66
|
+
createNodeBuilder( /*renderObject*/ ) { } // return NodeBuilder (ADD IT)
|
|
64
67
|
|
|
65
68
|
// textures
|
|
66
69
|
|
|
67
|
-
createSampler( texture ) { }
|
|
70
|
+
createSampler( /*texture*/ ) { }
|
|
68
71
|
|
|
69
|
-
createDefaultTexture( texture ) { }
|
|
72
|
+
createDefaultTexture( /*texture*/ ) { }
|
|
70
73
|
|
|
71
|
-
createTexture( texture ) { }
|
|
74
|
+
createTexture( /*texture*/ ) { }
|
|
72
75
|
|
|
73
|
-
copyTextureToBuffer( texture, x, y, width, height ) {}
|
|
76
|
+
copyTextureToBuffer( /*texture, x, y, width, height*/ ) {}
|
|
74
77
|
|
|
75
78
|
// attributes
|
|
76
79
|
|
|
77
|
-
createAttribute( attribute ) { }
|
|
80
|
+
createAttribute( /*attribute*/ ) { }
|
|
78
81
|
|
|
79
|
-
createIndexAttribute( attribute ) { }
|
|
82
|
+
createIndexAttribute( /*attribute*/ ) { }
|
|
80
83
|
|
|
81
|
-
updateAttribute( attribute ) { }
|
|
84
|
+
updateAttribute( /*attribute*/ ) { }
|
|
82
85
|
|
|
83
|
-
destroyAttribute( attribute ) { }
|
|
86
|
+
destroyAttribute( /*attribute*/ ) { }
|
|
84
87
|
|
|
85
88
|
// canvas
|
|
86
89
|
|
|
@@ -90,17 +93,17 @@ class Backend {
|
|
|
90
93
|
|
|
91
94
|
// utils
|
|
92
95
|
|
|
93
|
-
resolveTimestampAsync( renderContext, type ) { }
|
|
96
|
+
resolveTimestampAsync( /*renderContext, type*/ ) { }
|
|
94
97
|
|
|
95
|
-
hasFeatureAsync( name ) { } // return Boolean
|
|
98
|
+
hasFeatureAsync( /*name*/ ) { } // return Boolean
|
|
96
99
|
|
|
97
|
-
hasFeature( name ) { } // return Boolean
|
|
100
|
+
hasFeature( /*name*/ ) { } // return Boolean
|
|
98
101
|
|
|
99
102
|
getInstanceCount( renderObject ) {
|
|
100
103
|
|
|
101
104
|
const { object, geometry } = renderObject;
|
|
102
105
|
|
|
103
|
-
return geometry.isInstancedBufferGeometry ? geometry.instanceCount : ( object.
|
|
106
|
+
return geometry.isInstancedBufferGeometry ? geometry.instanceCount : ( object.count > 1 ? object.count : 1 );
|
|
104
107
|
|
|
105
108
|
}
|
|
106
109
|
|
|
@@ -120,7 +123,7 @@ class Backend {
|
|
|
120
123
|
|
|
121
124
|
}
|
|
122
125
|
|
|
123
|
-
setScissorTest( boolean ) { }
|
|
126
|
+
setScissorTest( /*boolean*/ ) { }
|
|
124
127
|
|
|
125
128
|
getClearColor() {
|
|
126
129
|
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import DataMap from './DataMap.js';
|
|
2
2
|
import Color4 from './Color4.js';
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
3
|
+
import { vec4, context, normalWorld, backgroundBlurriness, backgroundIntensity, modelViewProjection } from '../../nodes/TSL.js';
|
|
4
|
+
import NodeMaterial from '../../materials/nodes/NodeMaterial.js';
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
import { Mesh } from '../../objects/Mesh.js';
|
|
7
|
+
import { SphereGeometry } from '../../geometries/SphereGeometry.js';
|
|
8
|
+
import { BackSide, LinearSRGBColorSpace } from '../../constants.js';
|
|
9
|
+
|
|
10
|
+
const _clearColor = /*@__PURE__*/ new Color4();
|
|
7
11
|
|
|
8
12
|
class Background extends DataMap {
|
|
9
13
|
|
|
@@ -60,16 +64,19 @@ class Background extends DataMap {
|
|
|
60
64
|
viewProj = viewProj.setZ( viewProj.w );
|
|
61
65
|
|
|
62
66
|
const nodeMaterial = new NodeMaterial();
|
|
67
|
+
nodeMaterial.name = 'Background.material';
|
|
63
68
|
nodeMaterial.side = BackSide;
|
|
64
69
|
nodeMaterial.depthTest = false;
|
|
65
70
|
nodeMaterial.depthWrite = false;
|
|
66
71
|
nodeMaterial.fog = false;
|
|
72
|
+
nodeMaterial.lights = false;
|
|
67
73
|
nodeMaterial.vertexNode = viewProj;
|
|
68
|
-
nodeMaterial.
|
|
74
|
+
nodeMaterial.colorNode = backgroundMeshNode;
|
|
69
75
|
|
|
70
76
|
sceneData.backgroundMeshNode = backgroundMeshNode;
|
|
71
77
|
sceneData.backgroundMesh = backgroundMesh = new Mesh( new SphereGeometry( 1, 32, 32 ), nodeMaterial );
|
|
72
78
|
backgroundMesh.frustumCulled = false;
|
|
79
|
+
backgroundMesh.name = 'Background.mesh';
|
|
73
80
|
|
|
74
81
|
backgroundMesh.onBeforeRender = function ( renderer, scene, camera ) {
|
|
75
82
|
|
|
@@ -84,6 +91,7 @@ class Background extends DataMap {
|
|
|
84
91
|
if ( sceneData.backgroundCacheKey !== backgroundCacheKey ) {
|
|
85
92
|
|
|
86
93
|
sceneData.backgroundMeshNode.node = vec4( backgroundNode ).mul( backgroundIntensity );
|
|
94
|
+
sceneData.backgroundMeshNode.needsUpdate = true;
|
|
87
95
|
|
|
88
96
|
backgroundMesh.material.needsUpdate = true;
|
|
89
97
|
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
let _id = 0;
|
|
2
|
+
|
|
3
|
+
class BindGroup {
|
|
4
|
+
|
|
5
|
+
constructor( name = '', bindings = [], index = 0, bindingsReference = [] ) {
|
|
6
|
+
|
|
7
|
+
this.name = name;
|
|
8
|
+
this.bindings = bindings;
|
|
9
|
+
this.index = index;
|
|
10
|
+
this.bindingsReference = bindingsReference;
|
|
11
|
+
|
|
12
|
+
this.id = _id ++;
|
|
13
|
+
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default BindGroup;
|
|
@@ -22,61 +22,77 @@ class Bindings extends DataMap {
|
|
|
22
22
|
|
|
23
23
|
const bindings = renderObject.getBindings();
|
|
24
24
|
|
|
25
|
-
const
|
|
25
|
+
for ( const bindGroup of bindings ) {
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
const groupData = this.get( bindGroup );
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
if ( groupData.bindGroup === undefined ) {
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
// each object defines an array of bindings (ubos, textures, samplers etc.)
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
this._init( bindGroup );
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
this.backend.createBindings( bindGroup, bindings );
|
|
36
|
+
|
|
37
|
+
groupData.bindGroup = bindGroup;
|
|
38
|
+
|
|
39
|
+
}
|
|
36
40
|
|
|
37
41
|
}
|
|
38
42
|
|
|
39
|
-
return
|
|
43
|
+
return bindings;
|
|
40
44
|
|
|
41
45
|
}
|
|
42
46
|
|
|
43
47
|
getForCompute( computeNode ) {
|
|
44
48
|
|
|
45
|
-
const
|
|
49
|
+
const bindings = this.nodes.getForCompute( computeNode ).bindings;
|
|
46
50
|
|
|
47
|
-
|
|
51
|
+
for ( const bindGroup of bindings ) {
|
|
48
52
|
|
|
49
|
-
const
|
|
53
|
+
const groupData = this.get( bindGroup );
|
|
50
54
|
|
|
51
|
-
|
|
55
|
+
if ( groupData.bindGroup === undefined ) {
|
|
52
56
|
|
|
53
|
-
|
|
57
|
+
this._init( bindGroup );
|
|
54
58
|
|
|
55
|
-
|
|
59
|
+
this.backend.createBindings( bindGroup, bindings );
|
|
56
60
|
|
|
57
|
-
|
|
61
|
+
groupData.bindGroup = bindGroup;
|
|
62
|
+
|
|
63
|
+
}
|
|
58
64
|
|
|
59
65
|
}
|
|
60
66
|
|
|
61
|
-
return
|
|
67
|
+
return bindings;
|
|
62
68
|
|
|
63
69
|
}
|
|
64
70
|
|
|
65
71
|
updateForCompute( computeNode ) {
|
|
66
72
|
|
|
67
|
-
this.
|
|
73
|
+
this._updateBindings( this.getForCompute( computeNode ) );
|
|
68
74
|
|
|
69
75
|
}
|
|
70
76
|
|
|
71
77
|
updateForRender( renderObject ) {
|
|
72
78
|
|
|
73
|
-
this.
|
|
79
|
+
this._updateBindings( this.getForRender( renderObject ) );
|
|
80
|
+
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
_updateBindings( bindings ) {
|
|
84
|
+
|
|
85
|
+
for ( const bindGroup of bindings ) {
|
|
86
|
+
|
|
87
|
+
this._update( bindGroup, bindings );
|
|
88
|
+
|
|
89
|
+
}
|
|
74
90
|
|
|
75
91
|
}
|
|
76
92
|
|
|
77
|
-
_init(
|
|
93
|
+
_init( bindGroup ) {
|
|
78
94
|
|
|
79
|
-
for ( const binding of bindings ) {
|
|
95
|
+
for ( const binding of bindGroup.bindings ) {
|
|
80
96
|
|
|
81
97
|
if ( binding.isSampledTexture ) {
|
|
82
98
|
|
|
@@ -94,7 +110,7 @@ class Bindings extends DataMap {
|
|
|
94
110
|
|
|
95
111
|
}
|
|
96
112
|
|
|
97
|
-
_update(
|
|
113
|
+
_update( bindGroup, bindings ) {
|
|
98
114
|
|
|
99
115
|
const { backend } = this;
|
|
100
116
|
|
|
@@ -102,7 +118,7 @@ class Bindings extends DataMap {
|
|
|
102
118
|
|
|
103
119
|
// iterate over all bindings and check if buffer updates or a new binding group is required
|
|
104
120
|
|
|
105
|
-
for ( const binding of bindings ) {
|
|
121
|
+
for ( const binding of bindGroup.bindings ) {
|
|
106
122
|
|
|
107
123
|
if ( binding.isNodeUniformsGroup ) {
|
|
108
124
|
|
|
@@ -128,31 +144,30 @@ class Bindings extends DataMap {
|
|
|
128
144
|
|
|
129
145
|
} else if ( binding.isSampledTexture ) {
|
|
130
146
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
if ( binding.needsBindingsUpdate ) needsBindingsUpdate = true;
|
|
147
|
+
if ( binding.needsBindingsUpdate( this.textures.get( binding.texture ).generation ) ) needsBindingsUpdate = true;
|
|
134
148
|
|
|
135
149
|
const updated = binding.update();
|
|
136
150
|
|
|
151
|
+
const texture = binding.texture;
|
|
152
|
+
|
|
137
153
|
if ( updated ) {
|
|
138
154
|
|
|
139
|
-
this.textures.updateTexture(
|
|
155
|
+
this.textures.updateTexture( texture );
|
|
140
156
|
|
|
141
157
|
}
|
|
142
158
|
|
|
143
|
-
const textureData = backend.get(
|
|
159
|
+
const textureData = backend.get( texture );
|
|
144
160
|
|
|
145
161
|
if ( backend.isWebGPUBackend === true && textureData.texture === undefined && textureData.externalTexture === undefined ) {
|
|
146
162
|
|
|
147
163
|
// TODO: Remove this once we found why updated === false isn't bound to a texture in the WebGPU backend
|
|
148
|
-
console.error( 'Bindings._update: binding should be available:', binding, updated,
|
|
164
|
+
console.error( 'Bindings._update: binding should be available:', binding, updated, texture, binding.textureNode.value, needsBindingsUpdate );
|
|
149
165
|
|
|
150
|
-
this.textures.updateTexture(
|
|
166
|
+
this.textures.updateTexture( texture );
|
|
151
167
|
needsBindingsUpdate = true;
|
|
152
168
|
|
|
153
169
|
}
|
|
154
170
|
|
|
155
|
-
|
|
156
171
|
if ( texture.isStorageTexture === true ) {
|
|
157
172
|
|
|
158
173
|
const textureData = this.get( texture );
|
|
@@ -177,9 +192,7 @@ class Bindings extends DataMap {
|
|
|
177
192
|
|
|
178
193
|
if ( needsBindingsUpdate === true ) {
|
|
179
194
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
this.backend.updateBindings( bindings, pipeline );
|
|
195
|
+
this.backend.updateBindings( bindGroup, bindings );
|
|
183
196
|
|
|
184
197
|
}
|
|
185
198
|
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { Matrix3
|
|
1
|
+
import { Matrix3 } from '../../math/Matrix3.js';
|
|
2
|
+
import { Plane } from '../../math/Plane.js';
|
|
3
|
+
import { Vector4 } from '../../math/Vector4.js';
|
|
2
4
|
|
|
3
|
-
const _plane = new Plane();
|
|
4
|
-
|
|
5
|
-
let _clippingContextVersion = 0;
|
|
5
|
+
const _plane = /*@__PURE__*/ new Plane();
|
|
6
6
|
|
|
7
7
|
class ClippingContext {
|
|
8
8
|
|
|
9
9
|
constructor() {
|
|
10
10
|
|
|
11
|
-
this.version =
|
|
11
|
+
this.version = 0;
|
|
12
12
|
|
|
13
13
|
this.globalClippingCount = 0;
|
|
14
14
|
|
|
@@ -20,6 +20,7 @@ class ClippingContext {
|
|
|
20
20
|
|
|
21
21
|
this.parentVersion = 0;
|
|
22
22
|
this.viewNormalMatrix = new Matrix3();
|
|
23
|
+
this.cacheKey = '';
|
|
23
24
|
|
|
24
25
|
}
|
|
25
26
|
|
|
@@ -91,7 +92,12 @@ class ClippingContext {
|
|
|
91
92
|
|
|
92
93
|
}
|
|
93
94
|
|
|
94
|
-
if ( update )
|
|
95
|
+
if ( update ) {
|
|
96
|
+
|
|
97
|
+
this.version ++;
|
|
98
|
+
this.cacheKey = `${ this.globalClippingCount }:${ this.localClippingEnabled === undefined ? false : this.localClippingEnabled }:`;
|
|
99
|
+
|
|
100
|
+
}
|
|
95
101
|
|
|
96
102
|
}
|
|
97
103
|
|
|
@@ -156,7 +162,12 @@ class ClippingContext {
|
|
|
156
162
|
|
|
157
163
|
}
|
|
158
164
|
|
|
159
|
-
if ( update )
|
|
165
|
+
if ( update ) {
|
|
166
|
+
|
|
167
|
+
this.version += parent.version;
|
|
168
|
+
this.cacheKey = parent.cacheKey + `:${ this.localClippingCount }:${ this.localClipIntersection === undefined ? false : this.localClipIntersection }`;
|
|
169
|
+
|
|
170
|
+
}
|
|
160
171
|
|
|
161
172
|
}
|
|
162
173
|
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
import { WebGLCubeRenderTarget, Scene, CubeCamera, BoxGeometry, Mesh, BackSide, NoBlending, LinearFilter, LinearMipmapLinearFilter } from 'three';
|
|
2
1
|
import { equirectUV } from '../../nodes/utils/EquirectUVNode.js';
|
|
3
2
|
import { texture as TSL_Texture } from '../../nodes/accessors/TextureNode.js';
|
|
4
|
-
import { positionWorldDirection } from '../../nodes/accessors/
|
|
5
|
-
import
|
|
3
|
+
import { positionWorldDirection } from '../../nodes/accessors/Position.js';
|
|
4
|
+
import NodeMaterial from '../../materials/nodes/NodeMaterial.js';
|
|
5
|
+
|
|
6
|
+
import { WebGLCubeRenderTarget } from '../../renderers/WebGLCubeRenderTarget.js';
|
|
7
|
+
import { Scene } from '../../scenes/Scene.js';
|
|
8
|
+
import { CubeCamera } from '../../cameras/CubeCamera.js';
|
|
9
|
+
import { BoxGeometry } from '../../geometries/BoxGeometry.js';
|
|
10
|
+
import { Mesh } from '../../objects/Mesh.js';
|
|
11
|
+
import { BackSide, NoBlending, LinearFilter, LinearMipmapLinearFilter } from '../../constants.js';
|
|
6
12
|
|
|
7
13
|
// @TODO: Consider rename WebGLCubeRenderTarget to just CubeRenderTarget
|
|
8
14
|
|
|
@@ -34,7 +40,7 @@ class CubeRenderTarget extends WebGLCubeRenderTarget {
|
|
|
34
40
|
|
|
35
41
|
const uvNode = equirectUV( positionWorldDirection );
|
|
36
42
|
|
|
37
|
-
const material =
|
|
43
|
+
const material = new NodeMaterial();
|
|
38
44
|
material.colorNode = TSL_Texture( texture, uvNode, 0 );
|
|
39
45
|
material.side = BackSide;
|
|
40
46
|
material.blending = NoBlending;
|
|
@@ -48,8 +54,14 @@ class CubeRenderTarget extends WebGLCubeRenderTarget {
|
|
|
48
54
|
if ( texture.minFilter === LinearMipmapLinearFilter ) texture.minFilter = LinearFilter;
|
|
49
55
|
|
|
50
56
|
const camera = new CubeCamera( 1, 10, this );
|
|
57
|
+
|
|
58
|
+
const currentMRT = renderer.getMRT();
|
|
59
|
+
renderer.setMRT( null );
|
|
60
|
+
|
|
51
61
|
camera.update( renderer, scene );
|
|
52
62
|
|
|
63
|
+
renderer.setMRT( currentMRT );
|
|
64
|
+
|
|
53
65
|
texture.minFilter = currentMinFilter;
|
|
54
66
|
texture.currentGenerateMipmaps = currentGenerateMipmaps;
|
|
55
67
|
|