super-three 0.165.0 → 0.167.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 +706 -383
- package/build/three.module.js +702 -384
- package/build/three.module.min.js +1 -1
- package/build/three.webgpu.js +76086 -0
- package/build/three.webgpu.min.js +6 -0
- package/examples/jsm/Addons.js +2 -1
- package/examples/jsm/csm/CSMShader.js +4 -4
- package/examples/jsm/exporters/GLTFExporter.js +7 -3
- package/examples/jsm/geometries/TeapotGeometry.js +1 -1
- 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/MaterialXLoader.js +2 -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/postprocessing/RenderTransitionPass.js +13 -38
- package/examples/jsm/postprocessing/SSAOPass.js +6 -9
- package/examples/jsm/postprocessing/UnrealBloomPass.js +4 -4
- 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/transpiler/GLSLDecoder.js +46 -4
- package/examples/jsm/transpiler/TSLEncoder.js +17 -15
- package/package.json +7 -6
- package/src/Three.WebGPU.js +194 -0
- package/src/Three.js +2 -0
- package/src/constants.js +4 -1
- package/src/core/Object3D.js +22 -22
- 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/src/materials/Material.js +13 -4
- 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/{examples/jsm → src}/nodes/Nodes.js +30 -12
- package/{examples/jsm → src}/nodes/accessors/BatchNode.js +28 -10
- package/{examples/jsm → src}/nodes/accessors/BufferAttributeNode.js +36 -1
- package/src/nodes/accessors/CameraNode.js +19 -0
- package/{examples/jsm → src}/nodes/accessors/CubeTextureNode.js +22 -5
- package/src/nodes/accessors/InstanceNode.js +140 -0
- package/{examples/jsm → src}/nodes/accessors/MaterialNode.js +22 -2
- package/{examples/jsm → src}/nodes/accessors/ModelNode.js +2 -1
- package/{examples/jsm → src}/nodes/accessors/MorphNode.js +24 -20
- package/{examples/jsm → src}/nodes/accessors/NormalNode.js +1 -1
- package/{examples/jsm → src}/nodes/accessors/Object3DNode.js +1 -1
- package/{examples/jsm → src}/nodes/accessors/ReferenceNode.js +1 -1
- package/{examples/jsm → src}/nodes/accessors/ReflectVectorNode.js +4 -0
- package/{examples/jsm → src}/nodes/accessors/StorageBufferNode.js +50 -1
- package/{examples/jsm → src}/nodes/accessors/StorageTextureNode.js +12 -3
- package/{examples/jsm → src}/nodes/accessors/TextureNode.js +55 -18
- package/{examples/jsm → src}/nodes/accessors/UniformsNode.js +7 -1
- package/{examples/jsm → src}/nodes/accessors/VertexColorNode.js +2 -1
- package/{examples/jsm → src}/nodes/code/ScriptableNode.js +14 -0
- package/{examples/jsm → src}/nodes/code/ScriptableValueNode.js +2 -1
- package/{examples/jsm → src}/nodes/core/AttributeNode.js +20 -6
- package/{examples/jsm → src}/nodes/core/CacheNode.js +7 -10
- package/{examples/jsm → src}/nodes/core/IndexNode.js +6 -0
- package/{examples/jsm → src}/nodes/core/LightingModel.js +2 -2
- package/src/nodes/core/MRTNode.js +76 -0
- package/{examples/jsm → src}/nodes/core/Node.js +18 -12
- package/{examples/jsm → src}/nodes/core/NodeBuilder.js +175 -37
- 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 +6 -1
- package/{examples/jsm → src}/nodes/core/PropertyNode.js +1 -0
- package/{examples/jsm → src}/nodes/core/TempNode.js +2 -2
- package/{examples/jsm → src}/nodes/core/UniformGroupNode.js +20 -0
- package/{examples/jsm → src}/nodes/core/UniformNode.js +10 -1
- package/{examples/jsm → src}/nodes/core/VarNode.js +2 -6
- package/{examples/jsm → src}/nodes/core/VaryingNode.js +8 -0
- package/{examples/jsm → src}/nodes/display/AfterImageNode.js +19 -27
- package/{examples/jsm → src}/nodes/display/AnamorphicNode.js +18 -21
- package/src/nodes/display/BloomNode.js +333 -0
- package/{examples/jsm → src}/nodes/display/ColorAdjustmentNode.js +7 -2
- package/{examples/jsm → src}/nodes/display/ColorSpaceNode.js +1 -1
- package/src/nodes/display/DenoiseNode.js +198 -0
- package/src/nodes/display/DepthOfFieldNode.js +119 -0
- package/src/nodes/display/DotScreenNode.js +75 -0
- package/src/nodes/display/FXAANode.js +327 -0
- package/src/nodes/display/FilmNode.js +52 -0
- package/{examples/jsm → src}/nodes/display/FrontFacingNode.js +2 -1
- package/src/nodes/display/GTAONode.js +324 -0
- package/{examples/jsm → src}/nodes/display/GaussianBlurNode.js +34 -17
- package/src/nodes/display/Lut3DNode.js +53 -0
- package/{examples/jsm → src}/nodes/display/NormalMapNode.js +1 -1
- package/src/nodes/display/PassNode.js +291 -0
- package/src/nodes/display/PixelationPassNode.js +201 -0
- package/src/nodes/display/RGBShiftNode.js +49 -0
- package/src/nodes/display/RenderOutputNode.js +56 -0
- package/src/nodes/display/SobelOperatorNode.js +121 -0
- package/{examples/jsm → src}/nodes/display/ToneMappingNode.js +44 -5
- package/src/nodes/display/TransitionNode.js +76 -0
- package/{examples/jsm → src}/nodes/display/ViewportDepthNode.js +39 -16
- package/{examples/jsm → src}/nodes/display/ViewportDepthTextureNode.js +2 -1
- package/{examples/jsm → src}/nodes/display/ViewportNode.js +2 -1
- package/{examples/jsm → src}/nodes/display/ViewportSharedTextureNode.js +2 -1
- package/{examples/jsm → src}/nodes/display/ViewportTextureNode.js +5 -2
- package/src/nodes/functions/BSDF/LTC.js +131 -0
- package/src/nodes/functions/BasicLightingModel.js +78 -0
- package/{examples/jsm → src}/nodes/functions/PhongLightingModel.js +5 -3
- package/{examples/jsm → src}/nodes/functions/PhysicalLightingModel.js +42 -1
- package/{examples/jsm → src}/nodes/functions/ToonLightingModel.js +3 -1
- package/{examples/jsm → src}/nodes/geometry/RangeNode.js +19 -6
- package/{examples/jsm → src}/nodes/lighting/AONode.js +1 -4
- package/{examples/jsm → src}/nodes/lighting/AmbientLightNode.js +1 -1
- package/src/nodes/lighting/AnalyticLightNode.js +333 -0
- package/src/nodes/lighting/BasicEnvironmentNode.js +26 -0
- package/src/nodes/lighting/BasicLightMapNode.js +29 -0
- package/{examples/jsm → src}/nodes/lighting/DirectionalLightNode.js +2 -3
- package/{examples/jsm → src}/nodes/lighting/EnvironmentNode.js +5 -4
- package/{examples/jsm → src}/nodes/lighting/HemisphereLightNode.js +2 -1
- package/{examples/jsm → src}/nodes/lighting/IESSpotLightNode.js +1 -1
- package/{examples/jsm → src}/nodes/lighting/LightingNode.js +2 -0
- package/{examples/jsm → src}/nodes/lighting/LightsNode.js +1 -3
- package/{examples/jsm → src}/nodes/lighting/PointLightNode.js +2 -3
- package/src/nodes/lighting/RectAreaLightNode.js +97 -0
- package/{examples/jsm → src}/nodes/lighting/SpotLightNode.js +2 -3
- package/{examples/jsm → src}/nodes/loaders/NodeLoader.js +3 -1
- package/{examples/jsm → src}/nodes/loaders/NodeMaterialLoader.js +2 -1
- package/{examples/jsm → src}/nodes/loaders/NodeObjectLoader.js +2 -1
- package/{examples/jsm → src}/nodes/materials/InstancedPointsNodeMaterial.js +3 -3
- package/{examples/jsm → src}/nodes/materials/Line2NodeMaterial.js +3 -3
- package/{examples/jsm → src}/nodes/materials/LineBasicNodeMaterial.js +3 -3
- package/{examples/jsm → src}/nodes/materials/LineDashedNodeMaterial.js +4 -3
- package/src/nodes/materials/MeshBasicNodeMaterial.js +73 -0
- package/{examples/jsm → src}/nodes/materials/MeshLambertNodeMaterial.js +12 -3
- package/{examples/jsm → src}/nodes/materials/MeshMatcapNodeMaterial.js +6 -5
- package/{examples/jsm → src}/nodes/materials/MeshNormalNodeMaterial.js +5 -3
- package/{examples/jsm → src}/nodes/materials/MeshPhongNodeMaterial.js +11 -3
- package/{examples/jsm → src}/nodes/materials/MeshPhysicalNodeMaterial.js +5 -4
- package/{examples/jsm → src}/nodes/materials/MeshStandardNodeMaterial.js +14 -3
- package/{examples/jsm → src}/nodes/materials/MeshToonNodeMaterial.js +3 -3
- package/{examples/jsm → src}/nodes/materials/NodeMaterial.js +85 -20
- package/{examples/jsm → src}/nodes/materials/PointsNodeMaterial.js +3 -3
- package/{examples/jsm → src}/nodes/materials/ShadowNodeMaterial.js +3 -3
- package/{examples/jsm → src}/nodes/materials/SpriteNodeMaterial.js +3 -3
- package/{examples/jsm → src}/nodes/materialx/lib/mx_hsv.js +9 -17
- package/{examples/jsm → src}/nodes/materialx/lib/mx_noise.js +474 -577
- package/{examples/jsm → src}/nodes/materialx/lib/mx_transform_color.js +2 -8
- package/{examples/jsm → src}/nodes/math/CondNode.js +13 -6
- package/{examples/jsm → src}/nodes/math/MathNode.js +14 -1
- package/{examples/jsm → src}/nodes/math/OperatorNode.js +6 -6
- package/{examples/jsm → src}/nodes/parsers/GLSLNodeFunction.js +7 -7
- package/{examples/jsm → src}/nodes/pmrem/PMREMNode.js +2 -1
- package/{examples/jsm → src}/nodes/shadernode/ShaderNode.js +2 -0
- package/{examples/jsm → src}/nodes/utils/DiscardNode.js +1 -0
- package/{examples/jsm → src}/nodes/utils/FunctionOverloadingNode.js +2 -0
- package/{examples/jsm → src}/nodes/utils/LoopNode.js +7 -6
- package/{examples/jsm → src}/nodes/utils/MaxMipLevelNode.js +8 -2
- package/src/nodes/utils/RTTNode.js +130 -0
- package/{examples/jsm → src}/nodes/utils/ReflectorNode.js +9 -1
- package/src/objects/BatchedMesh.js +168 -188
- package/src/objects/InstancedMesh.js +1 -1
- package/src/renderers/WebGLRenderer.js +38 -25
- 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 +9 -3
- package/src/renderers/common/BindGroup.js +16 -0
- package/{examples/jsm → src}/renderers/common/Bindings.js +38 -23
- package/{examples/jsm → src}/renderers/common/ClippingContext.js +4 -2
- package/{examples/jsm → src}/renderers/common/Color4.js +1 -1
- package/{examples/jsm → src}/renderers/common/CubeRenderTarget.js +7 -1
- 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 +87 -0
- package/{examples/jsm/objects → src/renderers/common}/QuadMesh.js +6 -3
- package/{examples/jsm → src}/renderers/common/RenderContext.js +1 -1
- package/{examples/jsm → src}/renderers/common/RenderContexts.js +1 -1
- package/{examples/jsm → src}/renderers/common/RenderObject.js +44 -11
- package/{examples/jsm → src}/renderers/common/Renderer.js +84 -32
- package/{examples/jsm → src}/renderers/common/SampledTexture.js +2 -2
- 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 +6 -2
- 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 +13 -12
- package/src/renderers/common/nodes/NodeBuilderState.js +58 -0
- package/{examples/jsm → src}/renderers/common/nodes/NodeSampledTexture.js +6 -5
- 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 +37 -16
- 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/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 +26 -0
- package/src/renderers/webgl/WebGLPrograms.js +1 -1
- package/src/renderers/webgl/WebGLTextures.js +14 -53
- 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 +156 -54
- package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/nodes/GLSLNodeBuilder.js +178 -43
- 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 +1 -1
- package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/utils/WebGLTextureUtils.js +34 -2
- package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/utils/WebGLUtils.js +1 -1
- package/{examples/jsm → src}/renderers/webgpu/WebGPUBackend.js +164 -76
- package/{examples/jsm → src}/renderers/webgpu/WebGPURenderer.js +2 -2
- package/{examples/jsm → src}/renderers/webgpu/nodes/WGSLNodeBuilder.js +194 -56
- 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 +20 -13
- package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUConstants.js +3 -1
- package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUPipelineUtils.js +28 -21
- package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUTextureUtils.js +40 -23
- package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUUtils.js +24 -3
- package/src/renderers/webxr/WebXRDepthSensing.js +6 -0
- package/src/renderers/webxr/WebXRManager.js +6 -0
- package/src/textures/CompressedArrayTexture.js +1 -1
- package/examples/jsm/nodes/accessors/CameraNode.js +0 -12
- package/examples/jsm/nodes/accessors/InstanceNode.js +0 -94
- package/examples/jsm/nodes/core/NodeCache.js +0 -26
- package/examples/jsm/nodes/display/PassNode.js +0 -201
- package/examples/jsm/nodes/lighting/AnalyticLightNode.js +0 -256
- package/examples/jsm/nodes/materials/MeshBasicNodeMaterial.js +0 -28
- 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 → src}/nodes/accessors/AccessorsUtils.js +0 -0
- /package/{examples/jsm → src}/nodes/accessors/BitangentNode.js +0 -0
- /package/{examples/jsm → src}/nodes/accessors/BufferNode.js +0 -0
- /package/{examples/jsm → src}/nodes/accessors/ClippingNode.js +0 -0
- /package/{examples/jsm → src}/nodes/accessors/InstancedPointsMaterialNode.js +0 -0
- /package/{examples/jsm → src}/nodes/accessors/MaterialReferenceNode.js +0 -0
- /package/{examples/jsm → src}/nodes/accessors/ModelViewProjectionNode.js +0 -0
- /package/{examples/jsm → src}/nodes/accessors/PointUVNode.js +0 -0
- /package/{examples/jsm → src}/nodes/accessors/PositionNode.js +0 -0
- /package/{examples/jsm → src}/nodes/accessors/RendererReferenceNode.js +0 -0
- /package/{examples/jsm → src}/nodes/accessors/SceneNode.js +0 -0
- /package/{examples/jsm → src}/nodes/accessors/SkinningNode.js +0 -0
- /package/{examples/jsm → src}/nodes/accessors/TangentNode.js +0 -0
- /package/{examples/jsm → src}/nodes/accessors/Texture3DNode.js +0 -0
- /package/{examples/jsm → src}/nodes/accessors/TextureBicubicNode.js +0 -0
- /package/{examples/jsm → src}/nodes/accessors/TextureSizeNode.js +0 -0
- /package/{examples/jsm → src}/nodes/accessors/UVNode.js +0 -0
- /package/{examples/jsm → src}/nodes/accessors/UserDataNode.js +0 -0
- /package/{examples/jsm → src}/nodes/code/CodeNode.js +0 -0
- /package/{examples/jsm → src}/nodes/code/ExpressionNode.js +0 -0
- /package/{examples/jsm → src}/nodes/code/FunctionCallNode.js +0 -0
- /package/{examples/jsm → src}/nodes/code/FunctionNode.js +0 -0
- /package/{examples/jsm → src}/nodes/core/AssignNode.js +0 -0
- /package/{examples/jsm → src}/nodes/core/BypassNode.js +0 -0
- /package/{examples/jsm → src}/nodes/core/ConstNode.js +0 -0
- /package/{examples/jsm → src}/nodes/core/ContextNode.js +0 -0
- /package/{examples/jsm → src}/nodes/core/InputNode.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/NodeKeywords.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/OutputStructNode.js +0 -0
- /package/{examples/jsm → src}/nodes/core/ParameterNode.js +0 -0
- /package/{examples/jsm → src}/nodes/core/StackNode.js +0 -0
- /package/{examples/jsm → src}/nodes/core/StructTypeNode.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/display/BlendModeNode.js +0 -0
- /package/{examples/jsm → src}/nodes/display/BumpMapNode.js +0 -0
- /package/{examples/jsm → src}/nodes/display/PosterizeNode.js +0 -0
- /package/{examples/jsm → src}/nodes/fog/FogExp2Node.js +0 -0
- /package/{examples/jsm → src}/nodes/fog/FogNode.js +0 -0
- /package/{examples/jsm → src}/nodes/fog/FogRangeNode.js +0 -0
- /package/{examples/jsm → src}/nodes/functions/BSDF/BRDF_GGX.js +0 -0
- /package/{examples/jsm → src}/nodes/functions/BSDF/BRDF_Lambert.js +0 -0
- /package/{examples/jsm → src}/nodes/functions/BSDF/BRDF_Sheen.js +0 -0
- /package/{examples/jsm → src}/nodes/functions/BSDF/DFGApprox.js +0 -0
- /package/{examples/jsm → src}/nodes/functions/BSDF/D_GGX.js +0 -0
- /package/{examples/jsm → src}/nodes/functions/BSDF/D_GGX_Anisotropic.js +0 -0
- /package/{examples/jsm → src}/nodes/functions/BSDF/EnvironmentBRDF.js +0 -0
- /package/{examples/jsm → src}/nodes/functions/BSDF/F_Schlick.js +0 -0
- /package/{examples/jsm → src}/nodes/functions/BSDF/Schlick_to_F0.js +0 -0
- /package/{examples/jsm → src}/nodes/functions/BSDF/V_GGX_SmithCorrelated.js +0 -0
- /package/{examples/jsm → src}/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.js +0 -0
- /package/{examples/jsm → src}/nodes/functions/ShadowMaskModel.js +0 -0
- /package/{examples/jsm → src}/nodes/functions/material/getGeometryRoughness.js +0 -0
- /package/{examples/jsm → src}/nodes/functions/material/getRoughness.js +0 -0
- /package/{examples/jsm → src}/nodes/gpgpu/ComputeNode.js +0 -0
- /package/{examples/jsm → src}/nodes/lighting/IrradianceNode.js +0 -0
- /package/{examples/jsm → src}/nodes/lighting/LightNode.js +0 -0
- /package/{examples/jsm → src}/nodes/lighting/LightUtils.js +0 -0
- /package/{examples/jsm → src}/nodes/lighting/LightingContextNode.js +0 -0
- /package/{examples/jsm → src}/nodes/materials/Materials.js +0 -0
- /package/{examples/jsm → src}/nodes/materials/MeshSSSNodeMaterial.js +0 -0
- /package/{examples/jsm → src}/nodes/materials/VolumeNodeMaterial.js +0 -0
- /package/{examples/jsm → src}/nodes/materialx/DISCLAIMER.md +0 -0
- /package/{examples/jsm → src}/nodes/materialx/MaterialXNodes.js +0 -0
- /package/{examples/jsm → src}/nodes/math/HashNode.js +0 -0
- /package/{examples/jsm → src}/nodes/math/MathUtils.js +0 -0
- /package/{examples/jsm → src}/nodes/math/TriNoise3D.js +0 -0
- /package/{examples/jsm → src}/nodes/parsers/GLSLNodeParser.js +0 -0
- /package/{examples/jsm → src}/nodes/pmrem/PMREMUtils.js +0 -0
- /package/{examples/jsm → src}/nodes/procedural/CheckerNode.js +0 -0
- /package/{examples/jsm → src}/nodes/utils/ArrayElementNode.js +0 -0
- /package/{examples/jsm → src}/nodes/utils/ConvertNode.js +0 -0
- /package/{examples/jsm → src}/nodes/utils/EquirectUVNode.js +0 -0
- /package/{examples/jsm → src}/nodes/utils/JoinNode.js +0 -0
- /package/{examples/jsm → src}/nodes/utils/MatcapUVNode.js +0 -0
- /package/{examples/jsm → src}/nodes/utils/OscNode.js +0 -0
- /package/{examples/jsm → src}/nodes/utils/PackingNode.js +0 -0
- /package/{examples/jsm → src}/nodes/utils/RemapNode.js +0 -0
- /package/{examples/jsm → src}/nodes/utils/RotateNode.js +0 -0
- /package/{examples/jsm → src}/nodes/utils/RotateUVNode.js +0 -0
- /package/{examples/jsm → src}/nodes/utils/SetNode.js +0 -0
- /package/{examples/jsm → src}/nodes/utils/SplitNode.js +0 -0
- /package/{examples/jsm → src}/nodes/utils/SpriteSheetUVNode.js +0 -0
- /package/{examples/jsm → src}/nodes/utils/StorageArrayElementNode.js +0 -0
- /package/{examples/jsm → src}/nodes/utils/TimerNode.js +0 -0
- /package/{examples/jsm → src}/nodes/utils/TriplanarTexturesNode.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/RenderList.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
- /package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUTexturePassUtils.js +0 -0
|
@@ -9,36 +9,68 @@ vec3 unpackRGBToNormal( const in vec3 rgb ) {
|
|
|
9
9
|
|
|
10
10
|
const float PackUpscale = 256. / 255.; // fraction -> 0..1 (including 1)
|
|
11
11
|
const float UnpackDownscale = 255. / 256.; // 0..1 -> fraction (excluding 1)
|
|
12
|
+
const float ShiftRight8 = 1. / 256.;
|
|
13
|
+
const float Inv255 = 1. / 255.;
|
|
12
14
|
|
|
13
|
-
const
|
|
14
|
-
const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );
|
|
15
|
+
const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );
|
|
15
16
|
|
|
16
|
-
const
|
|
17
|
+
const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );
|
|
18
|
+
const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );
|
|
19
|
+
const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );
|
|
17
20
|
|
|
18
21
|
vec4 packDepthToRGBA( const in float v ) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
+
if( v <= 0.0 )
|
|
23
|
+
return vec4( 0., 0., 0., 0. );
|
|
24
|
+
if( v >= 1.0 )
|
|
25
|
+
return vec4( 1., 1., 1., 1. );
|
|
26
|
+
float vuf;
|
|
27
|
+
float af = modf( v * PackFactors.a, vuf );
|
|
28
|
+
float bf = modf( vuf * ShiftRight8, vuf );
|
|
29
|
+
float gf = modf( vuf * ShiftRight8, vuf );
|
|
30
|
+
return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
vec3 packDepthToRGB( const in float v ) {
|
|
34
|
+
if( v <= 0.0 )
|
|
35
|
+
return vec3( 0., 0., 0. );
|
|
36
|
+
if( v >= 1.0 )
|
|
37
|
+
return vec3( 1., 1., 1. );
|
|
38
|
+
float vuf;
|
|
39
|
+
float bf = modf( v * PackFactors.b, vuf );
|
|
40
|
+
float gf = modf( vuf * ShiftRight8, vuf );
|
|
41
|
+
// the 0.9999 tweak is unimportant, very tiny empirical improvement
|
|
42
|
+
// return vec3( vuf * Inv255, gf * PackUpscale, bf * 0.9999 );
|
|
43
|
+
return vec3( vuf * Inv255, gf * PackUpscale, bf );
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
vec2 packDepthToRG( const in float v ) {
|
|
47
|
+
if( v <= 0.0 )
|
|
48
|
+
return vec2( 0., 0. );
|
|
49
|
+
if( v >= 1.0 )
|
|
50
|
+
return vec2( 1., 1. );
|
|
51
|
+
float vuf;
|
|
52
|
+
float gf = modf( v * 256., vuf );
|
|
53
|
+
return vec2( vuf * Inv255, gf );
|
|
22
54
|
}
|
|
23
55
|
|
|
24
56
|
float unpackRGBAToDepth( const in vec4 v ) {
|
|
25
|
-
return dot( v,
|
|
57
|
+
return dot( v, UnpackFactors4 );
|
|
26
58
|
}
|
|
27
59
|
|
|
28
|
-
|
|
29
|
-
return
|
|
60
|
+
float unpackRGBToDepth( const in vec3 v ) {
|
|
61
|
+
return dot( v, UnpackFactors3 );
|
|
30
62
|
}
|
|
31
63
|
|
|
32
|
-
float unpackRGToDepth( const in
|
|
33
|
-
return
|
|
64
|
+
float unpackRGToDepth( const in vec2 v ) {
|
|
65
|
+
return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;
|
|
34
66
|
}
|
|
35
67
|
|
|
36
|
-
vec4 pack2HalfToRGBA( vec2 v ) {
|
|
68
|
+
vec4 pack2HalfToRGBA( const in vec2 v ) {
|
|
37
69
|
vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
|
|
38
70
|
return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
|
|
39
71
|
}
|
|
40
72
|
|
|
41
|
-
vec2 unpackRGBATo2Half( vec4 v ) {
|
|
73
|
+
vec2 unpackRGBATo2Half( const in vec4 v ) {
|
|
42
74
|
return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
|
|
43
75
|
}
|
|
44
76
|
|
|
@@ -19,6 +19,7 @@ export default /* glsl */`
|
|
|
19
19
|
varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
|
|
20
20
|
|
|
21
21
|
struct DirectionalLightShadow {
|
|
22
|
+
float shadowIntensity;
|
|
22
23
|
float shadowBias;
|
|
23
24
|
float shadowNormalBias;
|
|
24
25
|
float shadowRadius;
|
|
@@ -34,6 +35,7 @@ export default /* glsl */`
|
|
|
34
35
|
uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
|
|
35
36
|
|
|
36
37
|
struct SpotLightShadow {
|
|
38
|
+
float shadowIntensity;
|
|
37
39
|
float shadowBias;
|
|
38
40
|
float shadowNormalBias;
|
|
39
41
|
float shadowRadius;
|
|
@@ -50,6 +52,7 @@ export default /* glsl */`
|
|
|
50
52
|
varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
|
|
51
53
|
|
|
52
54
|
struct PointLightShadow {
|
|
55
|
+
float shadowIntensity;
|
|
53
56
|
float shadowBias;
|
|
54
57
|
float shadowNormalBias;
|
|
55
58
|
float shadowRadius;
|
|
@@ -103,7 +106,7 @@ export default /* glsl */`
|
|
|
103
106
|
|
|
104
107
|
}
|
|
105
108
|
|
|
106
|
-
float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
|
|
109
|
+
float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
|
|
107
110
|
|
|
108
111
|
float shadow = 1.0;
|
|
109
112
|
|
|
@@ -196,7 +199,7 @@ export default /* glsl */`
|
|
|
196
199
|
|
|
197
200
|
}
|
|
198
201
|
|
|
199
|
-
return shadow;
|
|
202
|
+
return mix( 1.0, shadow, shadowIntensity );
|
|
200
203
|
|
|
201
204
|
}
|
|
202
205
|
|
|
@@ -271,7 +274,7 @@ export default /* glsl */`
|
|
|
271
274
|
|
|
272
275
|
}
|
|
273
276
|
|
|
274
|
-
float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
|
|
277
|
+
float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
|
|
275
278
|
|
|
276
279
|
float shadow = 1.0;
|
|
277
280
|
|
|
@@ -316,7 +319,7 @@ export default /* glsl */`
|
|
|
316
319
|
|
|
317
320
|
}
|
|
318
321
|
|
|
319
|
-
return shadow;
|
|
322
|
+
return mix( 1.0, shadow, shadowIntensity );
|
|
320
323
|
|
|
321
324
|
}
|
|
322
325
|
|
|
@@ -15,6 +15,7 @@ export default /* glsl */`
|
|
|
15
15
|
varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
|
|
16
16
|
|
|
17
17
|
struct DirectionalLightShadow {
|
|
18
|
+
float shadowIntensity;
|
|
18
19
|
float shadowBias;
|
|
19
20
|
float shadowNormalBias;
|
|
20
21
|
float shadowRadius;
|
|
@@ -28,6 +29,7 @@ export default /* glsl */`
|
|
|
28
29
|
#if NUM_SPOT_LIGHT_SHADOWS > 0
|
|
29
30
|
|
|
30
31
|
struct SpotLightShadow {
|
|
32
|
+
float shadowIntensity;
|
|
31
33
|
float shadowBias;
|
|
32
34
|
float shadowNormalBias;
|
|
33
35
|
float shadowRadius;
|
|
@@ -44,6 +46,7 @@ export default /* glsl */`
|
|
|
44
46
|
varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
|
|
45
47
|
|
|
46
48
|
struct PointLightShadow {
|
|
49
|
+
float shadowIntensity;
|
|
47
50
|
float shadowBias;
|
|
48
51
|
float shadowNormalBias;
|
|
49
52
|
float shadowRadius;
|
|
@@ -13,7 +13,7 @@ float getShadowMask() {
|
|
|
13
13
|
for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
|
|
14
14
|
|
|
15
15
|
directionalLight = directionalLightShadows[ i ];
|
|
16
|
-
shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
|
|
16
|
+
shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
|
|
17
17
|
|
|
18
18
|
}
|
|
19
19
|
#pragma unroll_loop_end
|
|
@@ -28,7 +28,7 @@ float getShadowMask() {
|
|
|
28
28
|
for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
|
|
29
29
|
|
|
30
30
|
spotLight = spotLightShadows[ i ];
|
|
31
|
-
shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
|
|
31
|
+
shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
|
|
32
32
|
|
|
33
33
|
}
|
|
34
34
|
#pragma unroll_loop_end
|
|
@@ -43,7 +43,7 @@ float getShadowMask() {
|
|
|
43
43
|
for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
|
|
44
44
|
|
|
45
45
|
pointLight = pointLightShadows[ i ];
|
|
46
|
-
shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
|
|
46
|
+
shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
|
|
47
47
|
|
|
48
48
|
}
|
|
49
49
|
#pragma unroll_loop_end
|
|
@@ -91,6 +91,14 @@ void main() {
|
|
|
91
91
|
|
|
92
92
|
gl_FragColor = packDepthToRGBA( fragCoordZ );
|
|
93
93
|
|
|
94
|
+
#elif DEPTH_PACKING == 3202
|
|
95
|
+
|
|
96
|
+
gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );
|
|
97
|
+
|
|
98
|
+
#elif DEPTH_PACKING == 3203
|
|
99
|
+
|
|
100
|
+
gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );
|
|
101
|
+
|
|
94
102
|
#endif
|
|
95
103
|
|
|
96
104
|
}
|
|
@@ -130,6 +130,7 @@ const UniformsLib = {
|
|
|
130
130
|
} },
|
|
131
131
|
|
|
132
132
|
directionalLightShadows: { value: [], properties: {
|
|
133
|
+
shadowIntensity: 1,
|
|
133
134
|
shadowBias: {},
|
|
134
135
|
shadowNormalBias: {},
|
|
135
136
|
shadowRadius: {},
|
|
@@ -150,6 +151,7 @@ const UniformsLib = {
|
|
|
150
151
|
} },
|
|
151
152
|
|
|
152
153
|
spotLightShadows: { value: [], properties: {
|
|
154
|
+
shadowIntensity: 1,
|
|
153
155
|
shadowBias: {},
|
|
154
156
|
shadowNormalBias: {},
|
|
155
157
|
shadowRadius: {},
|
|
@@ -168,6 +170,7 @@ const UniformsLib = {
|
|
|
168
170
|
} },
|
|
169
171
|
|
|
170
172
|
pointLightShadows: { value: [], properties: {
|
|
173
|
+
shadowIntensity: 1,
|
|
171
174
|
shadowBias: {},
|
|
172
175
|
shadowNormalBias: {},
|
|
173
176
|
shadowRadius: {},
|
|
@@ -145,6 +145,8 @@ function WebGLAttributes( gl ) {
|
|
|
145
145
|
|
|
146
146
|
function update( attribute, bufferType ) {
|
|
147
147
|
|
|
148
|
+
if ( attribute.isInterleavedBufferAttribute ) attribute = attribute.data;
|
|
149
|
+
|
|
148
150
|
if ( attribute.isGLBufferAttribute ) {
|
|
149
151
|
|
|
150
152
|
const cached = buffers.get( attribute );
|
|
@@ -164,8 +166,6 @@ function WebGLAttributes( gl ) {
|
|
|
164
166
|
|
|
165
167
|
}
|
|
166
168
|
|
|
167
|
-
if ( attribute.isInterleavedBufferAttribute ) attribute = attribute.data;
|
|
168
|
-
|
|
169
169
|
const data = buffers.get( attribute );
|
|
170
170
|
|
|
171
171
|
if ( data === undefined ) {
|
|
@@ -31,30 +31,17 @@ function WebGLBufferRenderer( gl, extensions, info ) {
|
|
|
31
31
|
if ( drawCount === 0 ) return;
|
|
32
32
|
|
|
33
33
|
const extension = extensions.get( 'WEBGL_multi_draw' );
|
|
34
|
+
extension.multiDrawArraysWEBGL( mode, starts, 0, counts, 0, drawCount );
|
|
34
35
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
for ( let i = 0; i < drawCount; i ++ ) {
|
|
36
|
+
let elementCount = 0;
|
|
37
|
+
for ( let i = 0; i < drawCount; i ++ ) {
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
} else {
|
|
44
|
-
|
|
45
|
-
extension.multiDrawArraysWEBGL( mode, starts, 0, counts, 0, drawCount );
|
|
46
|
-
|
|
47
|
-
let elementCount = 0;
|
|
48
|
-
for ( let i = 0; i < drawCount; i ++ ) {
|
|
49
|
-
|
|
50
|
-
elementCount += counts[ i ];
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
info.update( elementCount, mode, 1 );
|
|
39
|
+
elementCount += counts[ i ];
|
|
55
40
|
|
|
56
41
|
}
|
|
57
42
|
|
|
43
|
+
info.update( elementCount, mode, 1 );
|
|
44
|
+
|
|
58
45
|
}
|
|
59
46
|
|
|
60
47
|
function renderMultiDrawInstances( starts, counts, drawCount, primcount ) {
|
|
@@ -40,29 +40,17 @@ function WebGLIndexedBufferRenderer( gl, extensions, info ) {
|
|
|
40
40
|
if ( drawCount === 0 ) return;
|
|
41
41
|
|
|
42
42
|
const extension = extensions.get( 'WEBGL_multi_draw' );
|
|
43
|
+
extension.multiDrawElementsWEBGL( mode, counts, 0, type, starts, 0, drawCount );
|
|
43
44
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
for ( let i = 0; i < drawCount; i ++ ) {
|
|
47
|
-
|
|
48
|
-
this.render( starts[ i ] / bytesPerElement, counts[ i ] );
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
} else {
|
|
45
|
+
let elementCount = 0;
|
|
46
|
+
for ( let i = 0; i < drawCount; i ++ ) {
|
|
53
47
|
|
|
54
|
-
|
|
48
|
+
elementCount += counts[ i ];
|
|
55
49
|
|
|
56
|
-
|
|
57
|
-
for ( let i = 0; i < drawCount; i ++ ) {
|
|
58
|
-
|
|
59
|
-
elementCount += counts[ i ];
|
|
60
|
-
|
|
61
|
-
}
|
|
50
|
+
}
|
|
62
51
|
|
|
63
|
-
|
|
52
|
+
info.update( elementCount, mode, 1 );
|
|
64
53
|
|
|
65
|
-
}
|
|
66
54
|
|
|
67
55
|
}
|
|
68
56
|
|
|
@@ -99,6 +99,7 @@ function ShadowUniformsCache() {
|
|
|
99
99
|
|
|
100
100
|
case 'DirectionalLight':
|
|
101
101
|
uniforms = {
|
|
102
|
+
shadowIntensity: 1,
|
|
102
103
|
shadowBias: 0,
|
|
103
104
|
shadowNormalBias: 0,
|
|
104
105
|
shadowRadius: 1,
|
|
@@ -108,6 +109,7 @@ function ShadowUniformsCache() {
|
|
|
108
109
|
|
|
109
110
|
case 'SpotLight':
|
|
110
111
|
uniforms = {
|
|
112
|
+
shadowIntensity: 1,
|
|
111
113
|
shadowBias: 0,
|
|
112
114
|
shadowNormalBias: 0,
|
|
113
115
|
shadowRadius: 1,
|
|
@@ -117,6 +119,7 @@ function ShadowUniformsCache() {
|
|
|
117
119
|
|
|
118
120
|
case 'PointLight':
|
|
119
121
|
uniforms = {
|
|
122
|
+
shadowIntensity: 1,
|
|
120
123
|
shadowBias: 0,
|
|
121
124
|
shadowNormalBias: 0,
|
|
122
125
|
shadowRadius: 1,
|
|
@@ -266,6 +269,7 @@ function WebGLLights( extensions ) {
|
|
|
266
269
|
|
|
267
270
|
const shadowUniforms = shadowCache.get( light );
|
|
268
271
|
|
|
272
|
+
shadowUniforms.shadowIntensity = shadow.intensity;
|
|
269
273
|
shadowUniforms.shadowBias = shadow.bias;
|
|
270
274
|
shadowUniforms.shadowNormalBias = shadow.normalBias;
|
|
271
275
|
shadowUniforms.shadowRadius = shadow.radius;
|
|
@@ -319,6 +323,7 @@ function WebGLLights( extensions ) {
|
|
|
319
323
|
|
|
320
324
|
const shadowUniforms = shadowCache.get( light );
|
|
321
325
|
|
|
326
|
+
shadowUniforms.shadowIntensity = shadow.intensity;
|
|
322
327
|
shadowUniforms.shadowBias = shadow.bias;
|
|
323
328
|
shadowUniforms.shadowNormalBias = shadow.normalBias;
|
|
324
329
|
shadowUniforms.shadowRadius = shadow.radius;
|
|
@@ -360,6 +365,7 @@ function WebGLLights( extensions ) {
|
|
|
360
365
|
|
|
361
366
|
const shadowUniforms = shadowCache.get( light );
|
|
362
367
|
|
|
368
|
+
shadowUniforms.shadowIntensity = shadow.intensity;
|
|
363
369
|
shadowUniforms.shadowBias = shadow.bias;
|
|
364
370
|
shadowUniforms.shadowNormalBias = shadow.normalBias;
|
|
365
371
|
shadowUniforms.shadowRadius = shadow.radius;
|
|
@@ -3,6 +3,7 @@ import { WebGLShader } from './WebGLShader.js';
|
|
|
3
3
|
import { ShaderChunk } from '../shaders/ShaderChunk.js';
|
|
4
4
|
import { NoToneMapping, AddOperation, MixOperation, MultiplyOperation, CubeRefractionMapping, CubeUVReflectionMapping, CubeReflectionMapping, PCFSoftShadowMap, PCFShadowMap, VSMShadowMap, AgXToneMapping, ACESFilmicToneMapping, NeutralToneMapping, CineonToneMapping, CustomToneMapping, ReinhardToneMapping, LinearToneMapping, GLSL3, LinearSRGBColorSpace, SRGBColorSpace, LinearDisplayP3ColorSpace, DisplayP3ColorSpace, P3Primaries, Rec709Primaries } from '../../constants.js';
|
|
5
5
|
import { ColorManagement } from '../../math/ColorManagement.js';
|
|
6
|
+
import { Vector3 } from '../../math/Vector3.js';
|
|
6
7
|
|
|
7
8
|
// From https://www.khronos.org/registry/webgl/extensions/KHR_parallel_shader_compile/
|
|
8
9
|
const COMPLETION_STATUS_KHR = 0x91B1;
|
|
@@ -142,6 +143,30 @@ function getToneMappingFunction( functionName, toneMapping ) {
|
|
|
142
143
|
|
|
143
144
|
}
|
|
144
145
|
|
|
146
|
+
const _v0 = /*@__PURE__*/ new Vector3();
|
|
147
|
+
|
|
148
|
+
function getLuminanceFunction() {
|
|
149
|
+
|
|
150
|
+
ColorManagement.getLuminanceCoefficients( _v0 );
|
|
151
|
+
|
|
152
|
+
const r = _v0.x.toFixed( 4 );
|
|
153
|
+
const g = _v0.y.toFixed( 4 );
|
|
154
|
+
const b = _v0.z.toFixed( 4 );
|
|
155
|
+
|
|
156
|
+
return [
|
|
157
|
+
|
|
158
|
+
'float luminance( const in vec3 rgb ) {',
|
|
159
|
+
|
|
160
|
+
` const vec3 weights = vec3( ${ r }, ${ g }, ${ b } );`,
|
|
161
|
+
|
|
162
|
+
' return dot( weights, rgb );',
|
|
163
|
+
|
|
164
|
+
'}'
|
|
165
|
+
|
|
166
|
+
].join( '\n' );
|
|
167
|
+
|
|
168
|
+
}
|
|
169
|
+
|
|
145
170
|
function generateVertexExtensions( parameters ) {
|
|
146
171
|
|
|
147
172
|
const chunks = [
|
|
@@ -813,6 +838,7 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
813
838
|
|
|
814
839
|
ShaderChunk[ 'colorspace_pars_fragment' ], // this code is required here because it is used by the various encoding/decoding function defined below
|
|
815
840
|
getTexelEncodingFunction( 'linearToOutputTexel', parameters.outputColorSpace ),
|
|
841
|
+
getLuminanceFunction(),
|
|
816
842
|
|
|
817
843
|
parameters.useDepthPacking ? '#define DEPTH_PACKING ' + parameters.depthPacking : '',
|
|
818
844
|
|
|
@@ -354,7 +354,7 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
354
354
|
index0AttributeName: material.index0AttributeName,
|
|
355
355
|
|
|
356
356
|
extensionClipCullDistance: HAS_EXTENSIONS && material.extensions.clipCullDistance === true && extensions.has( 'WEBGL_clip_cull_distance' ),
|
|
357
|
-
extensionMultiDraw: HAS_EXTENSIONS && material.extensions.multiDraw === true && extensions.has( 'WEBGL_multi_draw' ),
|
|
357
|
+
extensionMultiDraw: ( HAS_EXTENSIONS && material.extensions.multiDraw === true || IS_BATCHEDMESH ) && extensions.has( 'WEBGL_multi_draw' ),
|
|
358
358
|
|
|
359
359
|
rendererExtensionParallelShaderCompile: extensions.has( 'KHR_parallel_shader_compile' ),
|
|
360
360
|
|
|
@@ -2,6 +2,7 @@ import { LinearFilter, LinearMipmapLinearFilter, LinearMipmapNearestFilter, Near
|
|
|
2
2
|
import { createElementNS } from '../../utils.js';
|
|
3
3
|
import { ColorManagement } from '../../math/ColorManagement.js';
|
|
4
4
|
import { Vector2 } from '../../math/Vector2.js';
|
|
5
|
+
import { getByteLength } from '../../extras/TextureUtils.js';
|
|
5
6
|
|
|
6
7
|
function WebGLTextures( _gl, extensions, state, properties, capabilities, utils, info ) {
|
|
7
8
|
|
|
@@ -898,10 +899,15 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
898
899
|
|
|
899
900
|
if ( texture.layerUpdates.size > 0 ) {
|
|
900
901
|
|
|
902
|
+
const layerByteLength = getByteLength( mipmap.width, mipmap.height, texture.format, texture.type );
|
|
903
|
+
|
|
901
904
|
for ( const layerIndex of texture.layerUpdates ) {
|
|
902
905
|
|
|
903
|
-
const
|
|
904
|
-
|
|
906
|
+
const layerData = mipmap.data.subarray(
|
|
907
|
+
layerIndex * layerByteLength / mipmap.data.BYTES_PER_ELEMENT,
|
|
908
|
+
( layerIndex + 1 ) * layerByteLength / mipmap.data.BYTES_PER_ELEMENT
|
|
909
|
+
);
|
|
910
|
+
state.compressedTexSubImage3D( _gl.TEXTURE_2D_ARRAY, i, 0, 0, layerIndex, mipmap.width, mipmap.height, 1, glFormat, layerData, 0, 0 );
|
|
905
911
|
|
|
906
912
|
}
|
|
907
913
|
|
|
@@ -1019,60 +1025,15 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
1019
1025
|
|
|
1020
1026
|
if ( texture.layerUpdates.size > 0 ) {
|
|
1021
1027
|
|
|
1022
|
-
|
|
1023
|
-
// interpreted as one color component, depending on format. When
|
|
1024
|
-
// type is one of GL_UNSIGNED_SHORT_5_6_5,
|
|
1025
|
-
// GL_UNSIGNED_SHORT_4_4_4_4, GL_UNSIGNED_SHORT_5_5_5_1, each
|
|
1026
|
-
// unsigned value is interpreted as containing all the components
|
|
1027
|
-
// for a single pixel, with the color components arranged
|
|
1028
|
-
// according to format.
|
|
1029
|
-
//
|
|
1030
|
-
// See https://registry.khronos.org/OpenGL-Refpages/es1.1/xhtml/glTexImage2D.xml
|
|
1031
|
-
let texelSize;
|
|
1032
|
-
switch ( glType ) {
|
|
1033
|
-
|
|
1034
|
-
case _gl.UNSIGNED_BYTE:
|
|
1035
|
-
switch ( glFormat ) {
|
|
1036
|
-
|
|
1037
|
-
case _gl.ALPHA:
|
|
1038
|
-
texelSize = 1;
|
|
1039
|
-
break;
|
|
1040
|
-
case _gl.LUMINANCE:
|
|
1041
|
-
texelSize = 1;
|
|
1042
|
-
break;
|
|
1043
|
-
case _gl.LUMINANCE_ALPHA:
|
|
1044
|
-
texelSize = 2;
|
|
1045
|
-
break;
|
|
1046
|
-
case _gl.RGB:
|
|
1047
|
-
texelSize = 3;
|
|
1048
|
-
break;
|
|
1049
|
-
case _gl.RGBA:
|
|
1050
|
-
texelSize = 4;
|
|
1051
|
-
break;
|
|
1052
|
-
|
|
1053
|
-
default:
|
|
1054
|
-
throw new Error( `Unknown texel size for format ${glFormat}.` );
|
|
1055
|
-
|
|
1056
|
-
}
|
|
1057
|
-
|
|
1058
|
-
break;
|
|
1059
|
-
|
|
1060
|
-
case _gl.UNSIGNED_SHORT_4_4_4_4:
|
|
1061
|
-
case _gl.UNSIGNED_SHORT_5_5_5_1:
|
|
1062
|
-
case _gl.UNSIGNED_SHORT_5_6_5:
|
|
1063
|
-
texelSize = 1;
|
|
1064
|
-
break;
|
|
1065
|
-
|
|
1066
|
-
default:
|
|
1067
|
-
throw new Error( `Unknown texel size for type ${glType}.` );
|
|
1068
|
-
|
|
1069
|
-
}
|
|
1070
|
-
|
|
1071
|
-
const layerSize = image.width * image.height * texelSize;
|
|
1028
|
+
const layerByteLength = getByteLength( image.width, image.height, texture.format, texture.type );
|
|
1072
1029
|
|
|
1073
1030
|
for ( const layerIndex of texture.layerUpdates ) {
|
|
1074
1031
|
|
|
1075
|
-
|
|
1032
|
+
const layerData = image.data.subarray(
|
|
1033
|
+
layerIndex * layerByteLength / image.data.BYTES_PER_ELEMENT,
|
|
1034
|
+
( layerIndex + 1 ) * layerByteLength / image.data.BYTES_PER_ELEMENT
|
|
1035
|
+
);
|
|
1036
|
+
state.texSubImage3D( _gl.TEXTURE_2D_ARRAY, 0, 0, 0, layerIndex, image.width, image.height, 1, glFormat, glType, layerData );
|
|
1076
1037
|
|
|
1077
1038
|
}
|
|
1078
1039
|
|
|
@@ -51,7 +51,6 @@ import { LessEqualCompare } from '../../constants.js';
|
|
|
51
51
|
const emptyTexture = /*@__PURE__*/ new Texture();
|
|
52
52
|
|
|
53
53
|
const emptyShadowTexture = /*@__PURE__*/ new DepthTexture( 1, 1 );
|
|
54
|
-
emptyShadowTexture.compareFunction = LessEqualCompare;
|
|
55
54
|
|
|
56
55
|
const emptyArrayTexture = /*@__PURE__*/ new DataArrayTexture();
|
|
57
56
|
const empty3dTexture = /*@__PURE__*/ new Data3DTexture();
|
|
@@ -569,7 +568,18 @@ function setValueT1( gl, v, textures ) {
|
|
|
569
568
|
|
|
570
569
|
}
|
|
571
570
|
|
|
572
|
-
|
|
571
|
+
let emptyTexture2D;
|
|
572
|
+
|
|
573
|
+
if ( this.type === gl.SAMPLER_2D_SHADOW ) {
|
|
574
|
+
|
|
575
|
+
emptyShadowTexture.compareFunction = LessEqualCompare; // #28670
|
|
576
|
+
emptyTexture2D = emptyShadowTexture;
|
|
577
|
+
|
|
578
|
+
} else {
|
|
579
|
+
|
|
580
|
+
emptyTexture2D = emptyTexture;
|
|
581
|
+
|
|
582
|
+
}
|
|
573
583
|
|
|
574
584
|
textures.setTexture2D( v || emptyTexture2D, unit );
|
|
575
585
|
|
|
@@ -240,27 +240,27 @@ function WebGLUniformsGroups( gl, info, capabilities, state ) {
|
|
|
240
240
|
|
|
241
241
|
const info = getUniformSize( value );
|
|
242
242
|
|
|
243
|
-
//
|
|
244
|
-
const
|
|
243
|
+
const chunkOffset = offset % chunkSize; // offset in the current chunk
|
|
244
|
+
const chunkPadding = chunkOffset % info.boundary; // required padding to match boundary
|
|
245
|
+
const chunkStart = chunkOffset + chunkPadding; // the start position in the current chunk for the data
|
|
246
|
+
|
|
247
|
+
offset += chunkPadding;
|
|
245
248
|
|
|
246
249
|
// Check for chunk overflow
|
|
247
|
-
if (
|
|
250
|
+
if ( chunkStart !== 0 && ( chunkSize - chunkStart ) < info.storage ) {
|
|
248
251
|
|
|
249
252
|
// Add padding and adjust offset
|
|
250
|
-
offset += ( chunkSize -
|
|
253
|
+
offset += ( chunkSize - chunkStart );
|
|
251
254
|
|
|
252
255
|
}
|
|
253
256
|
|
|
254
257
|
// the following two properties will be used for partial buffer updates
|
|
255
|
-
|
|
256
258
|
uniform.__data = new Float32Array( info.storage / Float32Array.BYTES_PER_ELEMENT );
|
|
257
259
|
uniform.__offset = offset;
|
|
258
260
|
|
|
259
|
-
|
|
260
261
|
// Update the global offset
|
|
261
262
|
offset += info.storage;
|
|
262
263
|
|
|
263
|
-
|
|
264
264
|
}
|
|
265
265
|
|
|
266
266
|
}
|