super-three 0.164.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/README.md +3 -3
- package/build/three.cjs +1273 -503
- package/build/three.module.js +1269 -504
- 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/controls/TransformControls.js +1 -1
- package/examples/jsm/csm/CSMShader.js +4 -4
- package/examples/jsm/environments/RoomEnvironment.js +1 -5
- package/examples/jsm/exporters/GLTFExporter.js +8 -4
- package/examples/jsm/exporters/USDZExporter.js +6 -4
- package/examples/jsm/geometries/TeapotGeometry.js +1 -1
- package/examples/jsm/helpers/ViewHelper.js +75 -61
- package/examples/jsm/lights/RectAreaLightTexturesLib.js +91 -0
- package/examples/jsm/lights/RectAreaLightUniformsLib.js +8 -63
- package/examples/jsm/lines/LineMaterial.js +1 -15
- package/examples/jsm/lines/LineSegments2.js +15 -0
- package/examples/jsm/lines/Wireframe.js +16 -1
- package/examples/jsm/lines/webgpu/Line2.js +20 -0
- package/examples/jsm/lines/webgpu/LineSegments2.js +376 -0
- package/examples/jsm/loaders/DRACOLoader.js +1 -1
- package/examples/jsm/loaders/FBXLoader.js +47 -58
- package/examples/jsm/loaders/GLTFLoader.js +12 -4
- package/examples/jsm/loaders/LDrawLoader.js +3 -2
- package/examples/jsm/loaders/MMDLoader.js +31 -12
- 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/CurveModifier.js +11 -9
- package/examples/jsm/modifiers/SimplifyModifier.js +2 -1
- package/examples/jsm/objects/InstancedPoints.js +2 -2
- package/examples/jsm/objects/Lensflare.js +2 -2
- package/examples/jsm/postprocessing/RenderPass.js +1 -1
- 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/renderers/CSS2DRenderer.js +25 -5
- package/examples/jsm/renderers/CSS3DRenderer.js +24 -3
- 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/examples/jsm/utils/BufferGeometryUtils.js +18 -16
- package/examples/jsm/utils/GPUStatsPanel.js +2 -0
- package/examples/jsm/utils/SortUtils.js +8 -5
- package/package.json +9 -7
- package/src/Three.WebGPU.js +194 -0
- package/src/Three.js +2 -0
- package/src/animation/tracks/BooleanKeyframeTrack.js +10 -1
- package/src/animation/tracks/QuaternionKeyframeTrack.js +1 -2
- package/src/animation/tracks/StringKeyframeTrack.js +10 -1
- package/src/constants.js +4 -1
- package/src/core/Object3D.js +24 -22
- package/src/core/Raycaster.js +6 -2
- 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/FileLoader.js +4 -0
- package/src/loaders/LoaderUtils.js +3 -1
- package/src/loaders/ObjectLoader.js +34 -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 +39 -20
- package/{examples/jsm → src}/nodes/accessors/BatchNode.js +28 -10
- package/src/nodes/accessors/BitangentNode.js +13 -0
- package/{examples/jsm → src}/nodes/accessors/BufferAttributeNode.js +36 -1
- package/{examples/jsm → src}/nodes/accessors/BufferNode.js +6 -0
- 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 +24 -2
- package/{examples/jsm → src}/nodes/accessors/ModelNode.js +4 -0
- package/{examples/jsm → src}/nodes/accessors/MorphNode.js +24 -20
- package/src/nodes/accessors/NormalNode.js +14 -0
- package/{examples/jsm → src}/nodes/accessors/Object3DNode.js +1 -1
- package/src/nodes/accessors/PositionNode.js +10 -0
- package/{examples/jsm → src}/nodes/accessors/ReferenceNode.js +7 -1
- package/src/nodes/accessors/ReflectVectorNode.js +10 -0
- package/{examples/jsm → src}/nodes/accessors/StorageBufferNode.js +50 -1
- package/{examples/jsm/nodes/accessors/TextureStoreNode.js → src/nodes/accessors/StorageTextureNode.js} +28 -6
- package/src/nodes/accessors/TangentNode.js +23 -0
- package/src/nodes/accessors/Texture3DNode.js +100 -0
- package/{examples/jsm → src}/nodes/accessors/TextureNode.js +55 -18
- package/src/nodes/accessors/UVNode.js +3 -0
- 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 +34 -8
- package/{examples/jsm → src}/nodes/core/CacheNode.js +7 -10
- package/{examples/jsm → src}/nodes/core/ContextNode.js +6 -0
- 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 +33 -14
- package/{examples/jsm → src}/nodes/core/NodeBuilder.js +194 -45
- 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/NodeKeywords.js +1 -1
- 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/OutputStructNode.js +1 -5
- package/{examples/jsm → src}/nodes/core/PropertyNode.js +2 -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/src/nodes/core/VaryingNode.js +104 -0
- package/{examples/jsm → src}/nodes/display/AfterImageNode.js +24 -20
- 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 +3 -2
- 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 +103 -18
- package/src/nodes/functions/ToonLightingModel.js +51 -0
- 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 +18 -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 +4 -4
- package/{examples/jsm → src}/nodes/materials/LineBasicNodeMaterial.js +3 -3
- package/{examples/jsm → src}/nodes/materials/LineDashedNodeMaterial.js +4 -3
- package/{examples/jsm → src}/nodes/materials/Materials.js +3 -0
- package/src/nodes/materials/MeshBasicNodeMaterial.js +73 -0
- package/{examples/jsm → src}/nodes/materials/MeshLambertNodeMaterial.js +12 -3
- package/src/nodes/materials/MeshMatcapNodeMaterial.js +53 -0
- 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 +26 -8
- package/{examples/jsm → src}/nodes/materials/MeshStandardNodeMaterial.js +14 -3
- package/src/nodes/materials/MeshToonNodeMaterial.js +34 -0
- package/{examples/jsm → src}/nodes/materials/NodeMaterial.js +97 -24
- 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/src/nodes/materials/VolumeNodeMaterial.js +106 -0
- 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/HashNode.js +2 -2
- 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 +57 -33
- package/{examples/jsm → src}/nodes/utils/ArrayElementNode.js +1 -1
- 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/MatcapUVNode.js +1 -1
- 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/{examples/jsm → src}/nodes/utils/TimerNode.js +1 -1
- package/src/objects/BatchedMesh.js +232 -162
- package/src/objects/InstancedMesh.js +1 -1
- package/src/renderers/WebGLRenderer.js +312 -68
- package/{examples/jsm → src}/renderers/common/Attributes.js +4 -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 +54 -22
- package/src/renderers/common/ChainMap.js +59 -0
- package/{examples/jsm → src}/renderers/common/ClippingContext.js +8 -6
- 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/{examples/jsm → src}/renderers/common/Pipelines.js +2 -2
- package/src/renderers/common/PostProcessing.js +87 -0
- package/{examples/jsm/objects → src/renderers/common}/QuadMesh.js +6 -3
- package/src/renderers/common/RenderBundle.js +18 -0
- package/src/renderers/common/RenderBundles.js +38 -0
- 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/RenderList.js +9 -0
- package/{examples/jsm → src}/renderers/common/RenderObject.js +50 -11
- package/{examples/jsm → src}/renderers/common/Renderer.js +220 -40
- 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 +10 -5
- 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 +19 -4
- package/{examples/jsm → src}/renderers/common/nodes/NodeSampler.js +8 -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 +31 -1
- package/src/renderers/shaders/ShaderChunk/batching_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/color_pars_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/color_vertex.glsl.js +9 -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/lights_pars_begin.glsl.js +8 -22
- package/src/renderers/shaders/ShaderChunk/morphcolor_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/morphinstance_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/morphnormal_vertex.glsl.js +3 -14
- package/src/renderers/shaders/ShaderChunk/morphtarget_pars_vertex.glsl.js +10 -31
- package/src/renderers/shaders/ShaderChunk/morphtarget_vertex.glsl.js +3 -23
- 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/WebGLBackground.js +6 -0
- package/src/renderers/webgl/WebGLBufferRenderer.js +6 -19
- package/src/renderers/webgl/WebGLExtensions.js +3 -1
- package/src/renderers/webgl/WebGLIndexedBufferRenderer.js +6 -18
- package/src/renderers/webgl/WebGLLights.js +15 -12
- package/src/renderers/webgl/WebGLMaterials.js +1 -5
- package/src/renderers/webgl/WebGLMorphtargets.js +1 -2
- package/src/renderers/webgl/WebGLProgram.js +28 -31
- package/src/renderers/webgl/WebGLPrograms.js +15 -15
- package/src/renderers/webgl/WebGLRenderStates.js +2 -2
- package/src/renderers/webgl/WebGLTextures.js +100 -70
- 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 +188 -41
- 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 +126 -7
- package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/utils/WebGLUtils.js +1 -1
- package/{examples/jsm → src}/renderers/webgpu/WebGPUBackend.js +212 -78
- package/{examples/jsm → src}/renderers/webgpu/WebGPURenderer.js +2 -2
- package/{examples/jsm → src}/renderers/webgpu/nodes/WGSLNodeBuilder.js +245 -49
- 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 +30 -14
- package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUConstants.js +9 -1
- package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUPipelineUtils.js +74 -24
- package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUTextureUtils.js +101 -25
- package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUUtils.js +24 -3
- package/src/renderers/webxr/WebXRDepthSensing.js +9 -3
- package/src/renderers/webxr/WebXRManager.js +12 -2
- package/src/textures/CompressedArrayTexture.js +14 -0
- package/src/textures/DataArrayTexture.js +14 -0
- package/src/textures/DepthTexture.js +1 -3
- package/src/utils.js +30 -1
- package/examples/jsm/nodes/accessors/BitangentNode.js +0 -89
- package/examples/jsm/nodes/accessors/CameraNode.js +0 -119
- package/examples/jsm/nodes/accessors/InstanceNode.js +0 -94
- package/examples/jsm/nodes/accessors/NormalNode.js +0 -106
- package/examples/jsm/nodes/accessors/PositionNode.js +0 -104
- package/examples/jsm/nodes/accessors/ReflectVectorNode.js +0 -35
- package/examples/jsm/nodes/accessors/TangentNode.js +0 -109
- package/examples/jsm/nodes/accessors/UVNode.js +0 -47
- package/examples/jsm/nodes/core/NodeCache.js +0 -26
- package/examples/jsm/nodes/core/VaryingNode.js +0 -65
- package/examples/jsm/nodes/display/PassNode.js +0 -199
- package/examples/jsm/nodes/lighting/AnalyticLightNode.js +0 -255
- package/examples/jsm/nodes/materials/MeshBasicNodeMaterial.js +0 -28
- package/examples/jsm/renderers/common/ChainMap.js +0 -89
- 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/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/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/TextureBicubicNode.js +0 -0
- /package/{examples/jsm → src}/nodes/accessors/TextureSizeNode.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/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/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/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/MeshSSSNodeMaterial.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/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/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/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/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/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/ProgrammableStage.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
|
@@ -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 } 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 {
|
|
@@ -148,10 +148,6 @@ class WebGLRenderer {
|
|
|
148
148
|
|
|
149
149
|
this._outputColorSpace = SRGBColorSpace;
|
|
150
150
|
|
|
151
|
-
// physical lights
|
|
152
|
-
|
|
153
|
-
this._useLegacyLights = false;
|
|
154
|
-
|
|
155
151
|
// tone mapping
|
|
156
152
|
|
|
157
153
|
this.toneMapping = NoToneMapping;
|
|
@@ -207,8 +203,12 @@ class WebGLRenderer {
|
|
|
207
203
|
|
|
208
204
|
const _vector3 = new Vector3();
|
|
209
205
|
|
|
206
|
+
const _vector4 = new Vector4();
|
|
207
|
+
|
|
210
208
|
const _emptyScene = { background: null, fog: null, environment: null, overrideMaterial: null, isScene: true };
|
|
211
209
|
|
|
210
|
+
let _renderBackground = false;
|
|
211
|
+
|
|
212
212
|
function getTargetPixelRatio() {
|
|
213
213
|
|
|
214
214
|
return _currentRenderTarget === null ? _pixelRatio : 1;
|
|
@@ -864,7 +864,25 @@ class WebGLRenderer {
|
|
|
864
864
|
|
|
865
865
|
} else {
|
|
866
866
|
|
|
867
|
-
|
|
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
|
+
}
|
|
868
886
|
|
|
869
887
|
}
|
|
870
888
|
|
|
@@ -958,7 +976,7 @@ class WebGLRenderer {
|
|
|
958
976
|
|
|
959
977
|
}
|
|
960
978
|
|
|
961
|
-
currentRenderState.setupLights(
|
|
979
|
+
currentRenderState.setupLights();
|
|
962
980
|
|
|
963
981
|
// Only initialize materials in the new scene, not the targetScene.
|
|
964
982
|
|
|
@@ -1148,6 +1166,18 @@ class WebGLRenderer {
|
|
|
1148
1166
|
|
|
1149
1167
|
renderListStack.push( currentRenderList );
|
|
1150
1168
|
|
|
1169
|
+
if ( xr.enabled === true && xr.isPresenting === true ) {
|
|
1170
|
+
|
|
1171
|
+
const depthSensingMesh = _this.xr.getDepthSensingMesh();
|
|
1172
|
+
|
|
1173
|
+
if ( depthSensingMesh !== null ) {
|
|
1174
|
+
|
|
1175
|
+
projectObject( depthSensingMesh, camera, - Infinity, _this.sortObjects );
|
|
1176
|
+
|
|
1177
|
+
}
|
|
1178
|
+
|
|
1179
|
+
}
|
|
1180
|
+
|
|
1151
1181
|
projectObject( scene, camera, 0, _this.sortObjects );
|
|
1152
1182
|
|
|
1153
1183
|
currentRenderList.finish();
|
|
@@ -1158,8 +1188,8 @@ class WebGLRenderer {
|
|
|
1158
1188
|
|
|
1159
1189
|
}
|
|
1160
1190
|
|
|
1161
|
-
|
|
1162
|
-
if (
|
|
1191
|
+
_renderBackground = xr.enabled === false || xr.isPresenting === false || xr.hasDepthSensing() === false;
|
|
1192
|
+
if ( _renderBackground ) {
|
|
1163
1193
|
|
|
1164
1194
|
background.addToRenderList( currentRenderList, scene );
|
|
1165
1195
|
|
|
@@ -1186,7 +1216,7 @@ class WebGLRenderer {
|
|
|
1186
1216
|
const opaqueObjects = currentRenderList.opaque;
|
|
1187
1217
|
const transmissiveObjects = currentRenderList.transmissive;
|
|
1188
1218
|
|
|
1189
|
-
currentRenderState.setupLights(
|
|
1219
|
+
currentRenderState.setupLights();
|
|
1190
1220
|
|
|
1191
1221
|
if ( camera.isArrayCamera ) {
|
|
1192
1222
|
|
|
@@ -1204,7 +1234,7 @@ class WebGLRenderer {
|
|
|
1204
1234
|
|
|
1205
1235
|
}
|
|
1206
1236
|
|
|
1207
|
-
if (
|
|
1237
|
+
if ( _renderBackground ) background.render( scene );
|
|
1208
1238
|
|
|
1209
1239
|
if ( xr.enabled && xr.isMultiview ) {
|
|
1210
1240
|
|
|
@@ -1228,7 +1258,7 @@ class WebGLRenderer {
|
|
|
1228
1258
|
|
|
1229
1259
|
if ( transmissiveObjects.length > 0 ) renderTransmissionPass( opaqueObjects, transmissiveObjects, scene, camera );
|
|
1230
1260
|
|
|
1231
|
-
if (
|
|
1261
|
+
if ( _renderBackground ) background.render( scene );
|
|
1232
1262
|
|
|
1233
1263
|
renderScene( currentRenderList, scene, camera );
|
|
1234
1264
|
|
|
@@ -1325,7 +1355,7 @@ class WebGLRenderer {
|
|
|
1325
1355
|
|
|
1326
1356
|
if ( sortObjects ) {
|
|
1327
1357
|
|
|
1328
|
-
|
|
1358
|
+
_vector4.setFromMatrixPosition( object.matrixWorld )
|
|
1329
1359
|
.applyMatrix4( _projScreenMatrix );
|
|
1330
1360
|
|
|
1331
1361
|
}
|
|
@@ -1335,7 +1365,7 @@ class WebGLRenderer {
|
|
|
1335
1365
|
|
|
1336
1366
|
if ( material.visible ) {
|
|
1337
1367
|
|
|
1338
|
-
currentRenderList.push( object, geometry, material, groupOrder,
|
|
1368
|
+
currentRenderList.push( object, geometry, material, groupOrder, _vector4.z, null );
|
|
1339
1369
|
|
|
1340
1370
|
}
|
|
1341
1371
|
|
|
@@ -1353,16 +1383,16 @@ class WebGLRenderer {
|
|
|
1353
1383
|
if ( object.boundingSphere !== undefined ) {
|
|
1354
1384
|
|
|
1355
1385
|
if ( object.boundingSphere === null ) object.computeBoundingSphere();
|
|
1356
|
-
|
|
1386
|
+
_vector4.copy( object.boundingSphere.center );
|
|
1357
1387
|
|
|
1358
1388
|
} else {
|
|
1359
1389
|
|
|
1360
1390
|
if ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();
|
|
1361
|
-
|
|
1391
|
+
_vector4.copy( geometry.boundingSphere.center );
|
|
1362
1392
|
|
|
1363
1393
|
}
|
|
1364
1394
|
|
|
1365
|
-
|
|
1395
|
+
_vector4
|
|
1366
1396
|
.applyMatrix4( object.matrixWorld )
|
|
1367
1397
|
.applyMatrix4( _projScreenMatrix );
|
|
1368
1398
|
|
|
@@ -1379,7 +1409,7 @@ class WebGLRenderer {
|
|
|
1379
1409
|
|
|
1380
1410
|
if ( groupMaterial && groupMaterial.visible ) {
|
|
1381
1411
|
|
|
1382
|
-
currentRenderList.push( object, geometry, groupMaterial, groupOrder,
|
|
1412
|
+
currentRenderList.push( object, geometry, groupMaterial, groupOrder, _vector4.z, group );
|
|
1383
1413
|
|
|
1384
1414
|
}
|
|
1385
1415
|
|
|
@@ -1387,7 +1417,7 @@ class WebGLRenderer {
|
|
|
1387
1417
|
|
|
1388
1418
|
} else if ( material.visible ) {
|
|
1389
1419
|
|
|
1390
|
-
currentRenderList.push( object, geometry, material, groupOrder,
|
|
1420
|
+
currentRenderList.push( object, geometry, material, groupOrder, _vector4.z, null );
|
|
1391
1421
|
|
|
1392
1422
|
}
|
|
1393
1423
|
|
|
@@ -1452,7 +1482,8 @@ class WebGLRenderer {
|
|
|
1452
1482
|
samples: 4,
|
|
1453
1483
|
stencilBuffer: stencil,
|
|
1454
1484
|
resolveDepthBuffer: false,
|
|
1455
|
-
resolveStencilBuffer: false
|
|
1485
|
+
resolveStencilBuffer: false,
|
|
1486
|
+
colorSpace: ColorManagement.workingColorSpace,
|
|
1456
1487
|
} );
|
|
1457
1488
|
|
|
1458
1489
|
// debug
|
|
@@ -1483,6 +1514,8 @@ class WebGLRenderer {
|
|
|
1483
1514
|
|
|
1484
1515
|
_this.clear();
|
|
1485
1516
|
|
|
1517
|
+
if ( _renderBackground ) background.render( scene );
|
|
1518
|
+
|
|
1486
1519
|
// Turn off the features which can affect the frag color for opaque objects pass.
|
|
1487
1520
|
// Otherwise they are applied twice in opaque objects pass and transmission objects pass.
|
|
1488
1521
|
const currentToneMapping = _this.toneMapping;
|
|
@@ -1582,8 +1615,6 @@ class WebGLRenderer {
|
|
|
1582
1615
|
object.modelViewMatrix.multiplyMatrices( camera.matrixWorldInverse, object.matrixWorld );
|
|
1583
1616
|
object.normalMatrix.getNormalMatrix( object.modelViewMatrix );
|
|
1584
1617
|
|
|
1585
|
-
material.onBeforeRender( _this, scene, camera, geometry, object, group );
|
|
1586
|
-
|
|
1587
1618
|
if ( material.transparent === true && material.side === DoubleSide && material.forceSinglePass === false ) {
|
|
1588
1619
|
|
|
1589
1620
|
material.side = BackSide;
|
|
@@ -1658,8 +1689,6 @@ class WebGLRenderer {
|
|
|
1658
1689
|
|
|
1659
1690
|
parameters.uniforms = programCache.getUniforms( material );
|
|
1660
1691
|
|
|
1661
|
-
material.onBuild( object, parameters, _this );
|
|
1662
|
-
|
|
1663
1692
|
material.onBeforeCompile( parameters, _this );
|
|
1664
1693
|
|
|
1665
1694
|
program = programCache.acquireProgram( parameters, programCacheKey );
|
|
@@ -1738,6 +1767,7 @@ class WebGLRenderer {
|
|
|
1738
1767
|
|
|
1739
1768
|
materialProperties.outputColorSpace = parameters.outputColorSpace;
|
|
1740
1769
|
materialProperties.batching = parameters.batching;
|
|
1770
|
+
materialProperties.batchingColor = parameters.batchingColor;
|
|
1741
1771
|
materialProperties.instancing = parameters.instancing;
|
|
1742
1772
|
materialProperties.instancingColor = parameters.instancingColor;
|
|
1743
1773
|
materialProperties.instancingMorph = parameters.instancingMorph;
|
|
@@ -1830,6 +1860,14 @@ class WebGLRenderer {
|
|
|
1830
1860
|
|
|
1831
1861
|
needsProgramChange = true;
|
|
1832
1862
|
|
|
1863
|
+
} else if ( object.isBatchedMesh && materialProperties.batchingColor === true && object.colorTexture === null ) {
|
|
1864
|
+
|
|
1865
|
+
needsProgramChange = true;
|
|
1866
|
+
|
|
1867
|
+
} else if ( object.isBatchedMesh && materialProperties.batchingColor === false && object.colorTexture !== null ) {
|
|
1868
|
+
|
|
1869
|
+
needsProgramChange = true;
|
|
1870
|
+
|
|
1833
1871
|
} else if ( object.isInstancedMesh && materialProperties.instancing === false ) {
|
|
1834
1872
|
|
|
1835
1873
|
needsProgramChange = true;
|
|
@@ -2035,6 +2073,16 @@ class WebGLRenderer {
|
|
|
2035
2073
|
p_uniforms.setOptional( _gl, object, 'batchingTexture' );
|
|
2036
2074
|
p_uniforms.setValue( _gl, 'batchingTexture', object._matricesTexture, textures );
|
|
2037
2075
|
|
|
2076
|
+
p_uniforms.setOptional( _gl, object, 'batchingIdTexture' );
|
|
2077
|
+
p_uniforms.setValue( _gl, 'batchingIdTexture', object._indirectTexture, textures );
|
|
2078
|
+
|
|
2079
|
+
p_uniforms.setOptional( _gl, object, 'batchingColorTexture' );
|
|
2080
|
+
if ( object._colorsTexture !== null ) {
|
|
2081
|
+
|
|
2082
|
+
p_uniforms.setValue( _gl, 'batchingColorTexture', object._colorsTexture, textures );
|
|
2083
|
+
|
|
2084
|
+
}
|
|
2085
|
+
|
|
2038
2086
|
}
|
|
2039
2087
|
|
|
2040
2088
|
const morphAttributes = geometry.morphAttributes;
|
|
@@ -2430,24 +2478,159 @@ class WebGLRenderer {
|
|
|
2430
2478
|
|
|
2431
2479
|
};
|
|
2432
2480
|
|
|
2433
|
-
this.
|
|
2481
|
+
this.readRenderTargetPixelsAsync = async function ( renderTarget, x, y, width, height, buffer, activeCubeFaceIndex ) {
|
|
2482
|
+
|
|
2483
|
+
if ( ! ( renderTarget && renderTarget.isWebGLRenderTarget ) ) {
|
|
2484
|
+
|
|
2485
|
+
throw new Error( 'THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.' );
|
|
2486
|
+
|
|
2487
|
+
}
|
|
2488
|
+
|
|
2489
|
+
let framebuffer = properties.get( renderTarget ).__webglFramebuffer;
|
|
2490
|
+
if ( renderTarget.isWebGLCubeRenderTarget && activeCubeFaceIndex !== undefined ) {
|
|
2491
|
+
|
|
2492
|
+
framebuffer = framebuffer[ activeCubeFaceIndex ];
|
|
2493
|
+
|
|
2494
|
+
}
|
|
2495
|
+
|
|
2496
|
+
if ( framebuffer ) {
|
|
2497
|
+
|
|
2498
|
+
state.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );
|
|
2499
|
+
|
|
2500
|
+
try {
|
|
2501
|
+
|
|
2502
|
+
const texture = renderTarget.texture;
|
|
2503
|
+
const textureFormat = texture.format;
|
|
2504
|
+
const textureType = texture.type;
|
|
2505
|
+
|
|
2506
|
+
if ( ! capabilities.textureFormatReadable( textureFormat ) ) {
|
|
2507
|
+
|
|
2508
|
+
throw new Error( 'THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.' );
|
|
2509
|
+
|
|
2510
|
+
}
|
|
2511
|
+
|
|
2512
|
+
if ( ! capabilities.textureTypeReadable( textureType ) ) {
|
|
2513
|
+
|
|
2514
|
+
throw new Error( 'THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.' );
|
|
2515
|
+
|
|
2516
|
+
}
|
|
2517
|
+
|
|
2518
|
+
// the following if statement ensures valid read requests (no out-of-bounds pixels, see #8604)
|
|
2519
|
+
if ( ( x >= 0 && x <= ( renderTarget.width - width ) ) && ( y >= 0 && y <= ( renderTarget.height - height ) ) ) {
|
|
2520
|
+
|
|
2521
|
+
const glBuffer = _gl.createBuffer();
|
|
2522
|
+
_gl.bindBuffer( _gl.PIXEL_PACK_BUFFER, glBuffer );
|
|
2523
|
+
_gl.bufferData( _gl.PIXEL_PACK_BUFFER, buffer.byteLength, _gl.STREAM_READ );
|
|
2524
|
+
_gl.readPixels( x, y, width, height, utils.convert( textureFormat ), utils.convert( textureType ), 0 );
|
|
2525
|
+
_gl.flush();
|
|
2526
|
+
|
|
2527
|
+
// check if the commands have finished every 8 ms
|
|
2528
|
+
const sync = _gl.fenceSync( _gl.SYNC_GPU_COMMANDS_COMPLETE, 0 );
|
|
2529
|
+
await probeAsync( _gl, sync, 4 );
|
|
2530
|
+
|
|
2531
|
+
try {
|
|
2532
|
+
|
|
2533
|
+
_gl.bindBuffer( _gl.PIXEL_PACK_BUFFER, glBuffer );
|
|
2534
|
+
_gl.getBufferSubData( _gl.PIXEL_PACK_BUFFER, 0, buffer );
|
|
2535
|
+
|
|
2536
|
+
} finally {
|
|
2537
|
+
|
|
2538
|
+
_gl.deleteBuffer( glBuffer );
|
|
2539
|
+
_gl.deleteSync( sync );
|
|
2540
|
+
|
|
2541
|
+
}
|
|
2542
|
+
|
|
2543
|
+
return buffer;
|
|
2544
|
+
|
|
2545
|
+
}
|
|
2546
|
+
|
|
2547
|
+
} finally {
|
|
2548
|
+
|
|
2549
|
+
// restore framebuffer of current render target if necessary
|
|
2550
|
+
|
|
2551
|
+
const framebuffer = ( _currentRenderTarget !== null ) ? properties.get( _currentRenderTarget ).__webglFramebuffer : null;
|
|
2552
|
+
state.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );
|
|
2553
|
+
|
|
2554
|
+
}
|
|
2555
|
+
|
|
2556
|
+
}
|
|
2557
|
+
|
|
2558
|
+
};
|
|
2559
|
+
|
|
2560
|
+
this.copyFramebufferToTexture = function ( texture, position = null, level = 0 ) {
|
|
2561
|
+
|
|
2562
|
+
// support previous signature with position first
|
|
2563
|
+
if ( texture.isTexture !== true ) {
|
|
2564
|
+
|
|
2565
|
+
// @deprecated, r165
|
|
2566
|
+
warnOnce( 'WebGLRenderer: copyFramebufferToTexture function signature has changed.' );
|
|
2567
|
+
|
|
2568
|
+
position = arguments[ 0 ] || null;
|
|
2569
|
+
texture = arguments[ 1 ];
|
|
2570
|
+
|
|
2571
|
+
}
|
|
2434
2572
|
|
|
2435
2573
|
const levelScale = Math.pow( 2, - level );
|
|
2436
2574
|
const width = Math.floor( texture.image.width * levelScale );
|
|
2437
2575
|
const height = Math.floor( texture.image.height * levelScale );
|
|
2438
2576
|
|
|
2577
|
+
const x = position !== null ? position.x : 0;
|
|
2578
|
+
const y = position !== null ? position.y : 0;
|
|
2579
|
+
|
|
2439
2580
|
textures.setTexture2D( texture, 0 );
|
|
2440
2581
|
|
|
2441
|
-
_gl.copyTexSubImage2D( _gl.TEXTURE_2D, level, 0, 0,
|
|
2582
|
+
_gl.copyTexSubImage2D( _gl.TEXTURE_2D, level, 0, 0, x, y, width, height );
|
|
2442
2583
|
|
|
2443
2584
|
state.unbindTexture();
|
|
2444
2585
|
|
|
2445
2586
|
};
|
|
2446
2587
|
|
|
2447
|
-
this.copyTextureToTexture = function (
|
|
2588
|
+
this.copyTextureToTexture = function ( srcTexture, dstTexture, srcRegion = null, dstPosition = null, level = 0 ) {
|
|
2589
|
+
|
|
2590
|
+
// support previous signature with dstPosition first
|
|
2591
|
+
if ( srcTexture.isTexture !== true ) {
|
|
2592
|
+
|
|
2593
|
+
// @deprecated, r165
|
|
2594
|
+
warnOnce( 'WebGLRenderer: copyTextureToTexture function signature has changed.' );
|
|
2595
|
+
|
|
2596
|
+
dstPosition = arguments[ 0 ] || null;
|
|
2597
|
+
srcTexture = arguments[ 1 ];
|
|
2598
|
+
dstTexture = arguments[ 2 ];
|
|
2599
|
+
level = arguments[ 3 ] || 0;
|
|
2600
|
+
srcRegion = null;
|
|
2601
|
+
|
|
2602
|
+
}
|
|
2603
|
+
|
|
2604
|
+
let width, height, minX, minY;
|
|
2605
|
+
let dstX, dstY;
|
|
2606
|
+
if ( srcRegion !== null ) {
|
|
2607
|
+
|
|
2608
|
+
width = srcRegion.max.x - srcRegion.min.x;
|
|
2609
|
+
height = srcRegion.max.y - srcRegion.min.y;
|
|
2610
|
+
minX = srcRegion.min.x;
|
|
2611
|
+
minY = srcRegion.min.y;
|
|
2612
|
+
|
|
2613
|
+
} else {
|
|
2614
|
+
|
|
2615
|
+
width = srcTexture.image.width;
|
|
2616
|
+
height = srcTexture.image.height;
|
|
2617
|
+
minX = 0;
|
|
2618
|
+
minY = 0;
|
|
2619
|
+
|
|
2620
|
+
}
|
|
2621
|
+
|
|
2622
|
+
if ( dstPosition !== null ) {
|
|
2623
|
+
|
|
2624
|
+
dstX = dstPosition.x;
|
|
2625
|
+
dstY = dstPosition.y;
|
|
2626
|
+
|
|
2627
|
+
} else {
|
|
2628
|
+
|
|
2629
|
+
dstX = 0;
|
|
2630
|
+
dstY = 0;
|
|
2631
|
+
|
|
2632
|
+
}
|
|
2448
2633
|
|
|
2449
|
-
const width = srcTexture.image.width;
|
|
2450
|
-
const height = srcTexture.image.height;
|
|
2451
2634
|
const glFormat = utils.convert( dstTexture.format );
|
|
2452
2635
|
const glType = utils.convert( dstTexture.type );
|
|
2453
2636
|
|
|
@@ -2459,24 +2642,43 @@ class WebGLRenderer {
|
|
|
2459
2642
|
_gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, dstTexture.premultiplyAlpha );
|
|
2460
2643
|
_gl.pixelStorei( _gl.UNPACK_ALIGNMENT, dstTexture.unpackAlignment );
|
|
2461
2644
|
|
|
2645
|
+
const currentUnpackRowLen = _gl.getParameter( _gl.UNPACK_ROW_LENGTH );
|
|
2646
|
+
const currentUnpackImageHeight = _gl.getParameter( _gl.UNPACK_IMAGE_HEIGHT );
|
|
2647
|
+
const currentUnpackSkipPixels = _gl.getParameter( _gl.UNPACK_SKIP_PIXELS );
|
|
2648
|
+
const currentUnpackSkipRows = _gl.getParameter( _gl.UNPACK_SKIP_ROWS );
|
|
2649
|
+
const currentUnpackSkipImages = _gl.getParameter( _gl.UNPACK_SKIP_IMAGES );
|
|
2650
|
+
|
|
2651
|
+
const image = srcTexture.isCompressedTexture ? srcTexture.mipmaps[ level ] : srcTexture.image;
|
|
2652
|
+
|
|
2653
|
+
_gl.pixelStorei( _gl.UNPACK_ROW_LENGTH, image.width );
|
|
2654
|
+
_gl.pixelStorei( _gl.UNPACK_IMAGE_HEIGHT, image.height );
|
|
2655
|
+
_gl.pixelStorei( _gl.UNPACK_SKIP_PIXELS, minX );
|
|
2656
|
+
_gl.pixelStorei( _gl.UNPACK_SKIP_ROWS, minY );
|
|
2657
|
+
|
|
2462
2658
|
if ( srcTexture.isDataTexture ) {
|
|
2463
2659
|
|
|
2464
|
-
_gl.texSubImage2D( _gl.TEXTURE_2D, level,
|
|
2660
|
+
_gl.texSubImage2D( _gl.TEXTURE_2D, level, dstX, dstY, width, height, glFormat, glType, image.data );
|
|
2465
2661
|
|
|
2466
2662
|
} else {
|
|
2467
2663
|
|
|
2468
2664
|
if ( srcTexture.isCompressedTexture ) {
|
|
2469
2665
|
|
|
2470
|
-
_gl.compressedTexSubImage2D( _gl.TEXTURE_2D, level,
|
|
2666
|
+
_gl.compressedTexSubImage2D( _gl.TEXTURE_2D, level, dstX, dstY, image.width, image.height, glFormat, image.data );
|
|
2471
2667
|
|
|
2472
2668
|
} else {
|
|
2473
2669
|
|
|
2474
|
-
_gl.texSubImage2D( _gl.TEXTURE_2D, level,
|
|
2670
|
+
_gl.texSubImage2D( _gl.TEXTURE_2D, level, dstX, dstY, width, height, glFormat, glType, image );
|
|
2475
2671
|
|
|
2476
2672
|
}
|
|
2477
2673
|
|
|
2478
2674
|
}
|
|
2479
2675
|
|
|
2676
|
+
_gl.pixelStorei( _gl.UNPACK_ROW_LENGTH, currentUnpackRowLen );
|
|
2677
|
+
_gl.pixelStorei( _gl.UNPACK_IMAGE_HEIGHT, currentUnpackImageHeight );
|
|
2678
|
+
_gl.pixelStorei( _gl.UNPACK_SKIP_PIXELS, currentUnpackSkipPixels );
|
|
2679
|
+
_gl.pixelStorei( _gl.UNPACK_SKIP_ROWS, currentUnpackSkipRows );
|
|
2680
|
+
_gl.pixelStorei( _gl.UNPACK_SKIP_IMAGES, currentUnpackSkipImages );
|
|
2681
|
+
|
|
2480
2682
|
// Generate mipmaps only when copying level 0
|
|
2481
2683
|
if ( level === 0 && dstTexture.generateMipmaps ) _gl.generateMipmap( _gl.TEXTURE_2D );
|
|
2482
2684
|
|
|
@@ -2484,11 +2686,59 @@ class WebGLRenderer {
|
|
|
2484
2686
|
|
|
2485
2687
|
};
|
|
2486
2688
|
|
|
2487
|
-
this.copyTextureToTexture3D = function (
|
|
2689
|
+
this.copyTextureToTexture3D = function ( srcTexture, dstTexture, srcRegion = null, dstPosition = null, level = 0 ) {
|
|
2690
|
+
|
|
2691
|
+
// support previous signature with source box first
|
|
2692
|
+
if ( srcTexture.isTexture !== true ) {
|
|
2693
|
+
|
|
2694
|
+
// @deprecated, r165
|
|
2695
|
+
warnOnce( 'WebGLRenderer: copyTextureToTexture3D function signature has changed.' );
|
|
2696
|
+
|
|
2697
|
+
srcRegion = arguments[ 0 ] || null;
|
|
2698
|
+
dstPosition = arguments[ 1 ] || null;
|
|
2699
|
+
srcTexture = arguments[ 2 ];
|
|
2700
|
+
dstTexture = arguments[ 3 ];
|
|
2701
|
+
level = arguments[ 4 ] || 0;
|
|
2702
|
+
|
|
2703
|
+
}
|
|
2704
|
+
|
|
2705
|
+
let width, height, depth, minX, minY, minZ;
|
|
2706
|
+
let dstX, dstY, dstZ;
|
|
2707
|
+
const image = srcTexture.isCompressedTexture ? srcTexture.mipmaps[ level ] : srcTexture.image;
|
|
2708
|
+
if ( srcRegion !== null ) {
|
|
2709
|
+
|
|
2710
|
+
width = srcRegion.max.x - srcRegion.min.x;
|
|
2711
|
+
height = srcRegion.max.y - srcRegion.min.y;
|
|
2712
|
+
depth = srcRegion.max.z - srcRegion.min.z;
|
|
2713
|
+
minX = srcRegion.min.x;
|
|
2714
|
+
minY = srcRegion.min.y;
|
|
2715
|
+
minZ = srcRegion.min.z;
|
|
2716
|
+
|
|
2717
|
+
} else {
|
|
2718
|
+
|
|
2719
|
+
width = image.width;
|
|
2720
|
+
height = image.height;
|
|
2721
|
+
depth = image.depth;
|
|
2722
|
+
minX = 0;
|
|
2723
|
+
minY = 0;
|
|
2724
|
+
minZ = 0;
|
|
2725
|
+
|
|
2726
|
+
}
|
|
2727
|
+
|
|
2728
|
+
if ( dstPosition !== null ) {
|
|
2729
|
+
|
|
2730
|
+
dstX = dstPosition.x;
|
|
2731
|
+
dstY = dstPosition.y;
|
|
2732
|
+
dstZ = dstPosition.z;
|
|
2733
|
+
|
|
2734
|
+
} else {
|
|
2735
|
+
|
|
2736
|
+
dstX = 0;
|
|
2737
|
+
dstY = 0;
|
|
2738
|
+
dstZ = 0;
|
|
2739
|
+
|
|
2740
|
+
}
|
|
2488
2741
|
|
|
2489
|
-
const width = sourceBox.max.x - sourceBox.min.x;
|
|
2490
|
-
const height = sourceBox.max.y - sourceBox.min.y;
|
|
2491
|
-
const depth = sourceBox.max.z - sourceBox.min.z;
|
|
2492
2742
|
const glFormat = utils.convert( dstTexture.format );
|
|
2493
2743
|
const glType = utils.convert( dstTexture.type );
|
|
2494
2744
|
let glTarget;
|
|
@@ -2514,43 +2764,41 @@ class WebGLRenderer {
|
|
|
2514
2764
|
_gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, dstTexture.premultiplyAlpha );
|
|
2515
2765
|
_gl.pixelStorei( _gl.UNPACK_ALIGNMENT, dstTexture.unpackAlignment );
|
|
2516
2766
|
|
|
2517
|
-
const
|
|
2518
|
-
const
|
|
2519
|
-
const
|
|
2520
|
-
const
|
|
2521
|
-
const
|
|
2522
|
-
|
|
2523
|
-
const image = srcTexture.isCompressedTexture ? srcTexture.mipmaps[ level ] : srcTexture.image;
|
|
2767
|
+
const currentUnpackRowLen = _gl.getParameter( _gl.UNPACK_ROW_LENGTH );
|
|
2768
|
+
const currentUnpackImageHeight = _gl.getParameter( _gl.UNPACK_IMAGE_HEIGHT );
|
|
2769
|
+
const currentUnpackSkipPixels = _gl.getParameter( _gl.UNPACK_SKIP_PIXELS );
|
|
2770
|
+
const currentUnpackSkipRows = _gl.getParameter( _gl.UNPACK_SKIP_ROWS );
|
|
2771
|
+
const currentUnpackSkipImages = _gl.getParameter( _gl.UNPACK_SKIP_IMAGES );
|
|
2524
2772
|
|
|
2525
2773
|
_gl.pixelStorei( _gl.UNPACK_ROW_LENGTH, image.width );
|
|
2526
2774
|
_gl.pixelStorei( _gl.UNPACK_IMAGE_HEIGHT, image.height );
|
|
2527
|
-
_gl.pixelStorei( _gl.UNPACK_SKIP_PIXELS,
|
|
2528
|
-
_gl.pixelStorei( _gl.UNPACK_SKIP_ROWS,
|
|
2529
|
-
_gl.pixelStorei( _gl.UNPACK_SKIP_IMAGES,
|
|
2775
|
+
_gl.pixelStorei( _gl.UNPACK_SKIP_PIXELS, minX );
|
|
2776
|
+
_gl.pixelStorei( _gl.UNPACK_SKIP_ROWS, minY );
|
|
2777
|
+
_gl.pixelStorei( _gl.UNPACK_SKIP_IMAGES, minZ );
|
|
2530
2778
|
|
|
2531
2779
|
if ( srcTexture.isDataTexture || srcTexture.isData3DTexture ) {
|
|
2532
2780
|
|
|
2533
|
-
_gl.texSubImage3D( glTarget, level,
|
|
2781
|
+
_gl.texSubImage3D( glTarget, level, dstX, dstY, dstZ, width, height, depth, glFormat, glType, image.data );
|
|
2534
2782
|
|
|
2535
2783
|
} else {
|
|
2536
2784
|
|
|
2537
2785
|
if ( dstTexture.isCompressedArrayTexture ) {
|
|
2538
2786
|
|
|
2539
|
-
_gl.compressedTexSubImage3D( glTarget, level,
|
|
2787
|
+
_gl.compressedTexSubImage3D( glTarget, level, dstX, dstY, dstZ, width, height, depth, glFormat, image.data );
|
|
2540
2788
|
|
|
2541
2789
|
} else {
|
|
2542
2790
|
|
|
2543
|
-
_gl.texSubImage3D( glTarget, level,
|
|
2791
|
+
_gl.texSubImage3D( glTarget, level, dstX, dstY, dstZ, width, height, depth, glFormat, glType, image );
|
|
2544
2792
|
|
|
2545
2793
|
}
|
|
2546
2794
|
|
|
2547
2795
|
}
|
|
2548
2796
|
|
|
2549
|
-
_gl.pixelStorei( _gl.UNPACK_ROW_LENGTH,
|
|
2550
|
-
_gl.pixelStorei( _gl.UNPACK_IMAGE_HEIGHT,
|
|
2551
|
-
_gl.pixelStorei( _gl.UNPACK_SKIP_PIXELS,
|
|
2552
|
-
_gl.pixelStorei( _gl.UNPACK_SKIP_ROWS,
|
|
2553
|
-
_gl.pixelStorei( _gl.UNPACK_SKIP_IMAGES,
|
|
2797
|
+
_gl.pixelStorei( _gl.UNPACK_ROW_LENGTH, currentUnpackRowLen );
|
|
2798
|
+
_gl.pixelStorei( _gl.UNPACK_IMAGE_HEIGHT, currentUnpackImageHeight );
|
|
2799
|
+
_gl.pixelStorei( _gl.UNPACK_SKIP_PIXELS, currentUnpackSkipPixels );
|
|
2800
|
+
_gl.pixelStorei( _gl.UNPACK_SKIP_ROWS, currentUnpackSkipRows );
|
|
2801
|
+
_gl.pixelStorei( _gl.UNPACK_SKIP_IMAGES, currentUnpackSkipImages );
|
|
2554
2802
|
|
|
2555
2803
|
// Generate mipmaps only when copying level 0
|
|
2556
2804
|
if ( level === 0 && dstTexture.generateMipmaps ) _gl.generateMipmap( glTarget );
|
|
@@ -2559,6 +2807,16 @@ class WebGLRenderer {
|
|
|
2559
2807
|
|
|
2560
2808
|
};
|
|
2561
2809
|
|
|
2810
|
+
this.initRenderTarget = function ( target ) {
|
|
2811
|
+
|
|
2812
|
+
if ( properties.get( target ).__webglFramebuffer === undefined ) {
|
|
2813
|
+
|
|
2814
|
+
textures.setupRenderTarget( target );
|
|
2815
|
+
|
|
2816
|
+
}
|
|
2817
|
+
|
|
2818
|
+
};
|
|
2819
|
+
|
|
2562
2820
|
this.initTexture = function ( texture ) {
|
|
2563
2821
|
|
|
2564
2822
|
if ( texture.isCubeTexture ) {
|
|
@@ -2624,20 +2882,6 @@ class WebGLRenderer {
|
|
|
2624
2882
|
|
|
2625
2883
|
}
|
|
2626
2884
|
|
|
2627
|
-
get useLegacyLights() { // @deprecated, r155
|
|
2628
|
-
|
|
2629
|
-
console.warn( 'THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733.' );
|
|
2630
|
-
return this._useLegacyLights;
|
|
2631
|
-
|
|
2632
|
-
}
|
|
2633
|
-
|
|
2634
|
-
set useLegacyLights( value ) { // @deprecated, r155
|
|
2635
|
-
|
|
2636
|
-
console.warn( 'THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733.' );
|
|
2637
|
-
this._useLegacyLights = value;
|
|
2638
|
-
|
|
2639
|
-
}
|
|
2640
|
-
|
|
2641
2885
|
}
|
|
2642
2886
|
|
|
2643
2887
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import DataMap from './DataMap.js';
|
|
2
2
|
import { AttributeType } from './Constants.js';
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
import { DynamicDrawUsage } from '../../constants.js';
|
|
4
5
|
|
|
5
6
|
class Attributes extends DataMap {
|
|
6
7
|
|
|
@@ -22,6 +23,8 @@ class Attributes extends DataMap {
|
|
|
22
23
|
|
|
23
24
|
}
|
|
24
25
|
|
|
26
|
+
return attributeData;
|
|
27
|
+
|
|
25
28
|
}
|
|
26
29
|
|
|
27
30
|
update( attribute, type ) {
|