super-three 0.167.0 → 0.168.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/three.cjs +165 -44
- package/build/three.module.js +165 -45
- package/build/three.module.min.js +1 -1
- package/build/three.webgpu.js +23600 -21931
- package/build/three.webgpu.min.js +1 -1
- package/examples/jsm/Addons.js +3 -1
- package/examples/jsm/animation/AnimationClipCreator.js +1 -1
- package/examples/jsm/capabilities/WebGL.js +27 -21
- package/examples/jsm/controls/ArcballControls.js +174 -158
- package/examples/jsm/controls/DragControls.js +260 -132
- package/examples/jsm/controls/FirstPersonControls.js +175 -163
- package/examples/jsm/controls/FlyControls.js +194 -188
- package/examples/jsm/controls/OrbitControls.js +777 -786
- package/examples/jsm/controls/PointerLockControls.js +24 -15
- package/examples/jsm/controls/TrackballControls.js +453 -452
- package/examples/jsm/effects/AnaglyphEffect.js +6 -13
- package/examples/jsm/effects/ParallaxBarrierEffect.js +17 -11
- package/examples/jsm/effects/StereoEffect.js +6 -1
- package/examples/jsm/environments/RoomEnvironment.js +1 -1
- package/examples/jsm/exporters/GLTFExporter.js +6 -1
- package/examples/jsm/exporters/USDZExporter.js +29 -8
- package/examples/jsm/helpers/LightProbeHelper.js +42 -43
- package/examples/jsm/loaders/KTX2Loader.js +19 -7
- package/examples/jsm/loaders/MaterialXLoader.js +11 -4
- package/examples/jsm/loaders/PCDLoader.js +9 -9
- package/examples/jsm/objects/SkyMesh.js +188 -0
- package/examples/jsm/objects/Water2Mesh.js +159 -0
- package/examples/jsm/objects/WaterMesh.js +102 -0
- package/examples/jsm/physics/RapierPhysics.js +20 -0
- package/examples/jsm/postprocessing/OutlinePass.js +31 -46
- package/examples/jsm/postprocessing/SSAARenderPass.js +3 -1
- package/examples/jsm/shaders/BleachBypassShader.js +1 -2
- package/examples/jsm/shaders/OutputShader.js +1 -1
- package/examples/jsm/transpiler/TSLEncoder.js +8 -8
- package/examples/jsm/utils/TextureUtils.js +1 -1
- package/package.json +2 -1
- package/src/Three.WebGPU.js +6 -0
- package/src/Three.js +1 -0
- package/src/constants.js +1 -1
- package/src/extras/Controls.js +32 -0
- package/src/loaders/ObjectLoader.js +3 -3
- package/src/{nodes/loaders → loaders/nodes}/NodeLoader.js +4 -4
- package/src/{nodes/loaders → loaders/nodes}/NodeMaterialLoader.js +1 -2
- package/src/materials/Material.js +4 -7
- package/src/{nodes/materials → materials/nodes}/InstancedPointsNodeMaterial.js +33 -24
- package/src/{nodes/materials → materials/nodes}/Line2NodeMaterial.js +34 -37
- package/src/{nodes/materials → materials/nodes}/LineBasicNodeMaterial.js +3 -4
- package/src/{nodes/materials → materials/nodes}/LineDashedNodeMaterial.js +7 -9
- package/src/{nodes/materials → materials/nodes}/MeshBasicNodeMaterial.js +11 -11
- package/src/{nodes/materials → materials/nodes}/MeshLambertNodeMaterial.js +5 -5
- package/src/{nodes/materials → materials/nodes}/MeshMatcapNodeMaterial.js +8 -8
- package/src/materials/nodes/MeshNormalNodeMaterial.js +40 -0
- package/src/{nodes/materials → materials/nodes}/MeshPhongNodeMaterial.js +9 -8
- package/src/{nodes/materials → materials/nodes}/MeshPhysicalNodeMaterial.js +18 -17
- package/src/{nodes/materials → materials/nodes}/MeshSSSNodeMaterial.js +6 -6
- package/src/{nodes/materials → materials/nodes}/MeshStandardNodeMaterial.js +17 -11
- package/src/{nodes/materials → materials/nodes}/MeshToonNodeMaterial.js +4 -4
- package/src/{nodes/materials → materials/nodes}/NodeMaterial.js +67 -86
- package/src/{nodes/materials/Materials.js → materials/nodes/NodeMaterials.js} +1 -1
- package/src/{nodes/materials → materials/nodes}/PointsNodeMaterial.js +3 -4
- package/src/{nodes/materials → materials/nodes}/ShadowNodeMaterial.js +4 -4
- package/src/{nodes/materials → materials/nodes}/SpriteNodeMaterial.js +11 -11
- package/src/{nodes/materials → materials/nodes}/VolumeNodeMaterial.js +14 -16
- package/src/nodes/Nodes.js +103 -159
- package/src/nodes/TSL.js +176 -0
- package/src/nodes/accessors/AccessorsUtils.js +8 -8
- package/src/nodes/accessors/BatchNode.js +48 -20
- package/src/nodes/accessors/{BitangentNode.js → Bitangent.js} +9 -9
- package/src/nodes/accessors/BufferAttributeNode.js +5 -5
- package/src/nodes/accessors/BufferNode.js +4 -4
- package/src/nodes/accessors/{CameraNode.js → Camera.js} +10 -10
- package/src/nodes/accessors/ClippingNode.js +16 -14
- package/src/nodes/accessors/CubeTextureNode.js +5 -7
- package/src/nodes/accessors/InstanceNode.js +17 -13
- package/src/nodes/accessors/InstancedPointsMaterialNode.js +4 -4
- package/src/nodes/accessors/MaterialNode.js +52 -55
- package/src/nodes/accessors/MaterialProperties.js +3 -0
- package/src/nodes/accessors/MaterialReferenceNode.js +6 -4
- package/src/nodes/accessors/ModelNode.js +11 -11
- package/src/nodes/accessors/ModelViewProjectionNode.js +6 -7
- package/src/nodes/accessors/MorphNode.js +12 -12
- package/src/nodes/accessors/Normal.js +62 -0
- package/src/nodes/accessors/Object3DNode.js +10 -10
- package/src/nodes/accessors/PointUVNode.js +4 -4
- package/src/nodes/accessors/Position.js +10 -0
- package/src/nodes/accessors/ReferenceBaseNode.js +143 -0
- package/src/nodes/accessors/ReferenceNode.js +13 -7
- package/src/nodes/accessors/ReflectVector.js +10 -0
- package/src/nodes/accessors/RendererReferenceNode.js +6 -6
- package/src/nodes/accessors/SceneNode.js +5 -6
- package/src/nodes/accessors/SkinningNode.js +84 -21
- package/src/nodes/accessors/StorageBufferNode.js +4 -5
- package/src/nodes/accessors/StorageTextureNode.js +5 -5
- package/src/nodes/accessors/Tangent.js +22 -0
- package/src/nodes/accessors/Texture3DNode.js +11 -11
- package/src/nodes/accessors/{TextureBicubicNode.js → TextureBicubic.js} +3 -32
- package/src/nodes/accessors/TextureNode.js +16 -21
- package/src/nodes/accessors/TextureSizeNode.js +4 -6
- package/src/nodes/accessors/{UniformsNode.js → UniformArrayNode.js} +17 -8
- package/src/nodes/accessors/UserDataNode.js +4 -4
- package/src/nodes/accessors/VelocityNode.js +83 -0
- package/src/nodes/accessors/VertexColorNode.js +4 -4
- package/src/nodes/code/CodeNode.js +5 -5
- package/src/nodes/code/ExpressionNode.js +4 -4
- package/src/nodes/code/FunctionCallNode.js +5 -5
- package/src/nodes/code/FunctionNode.js +5 -23
- package/src/nodes/code/ScriptableNode.js +4 -6
- package/src/nodes/code/ScriptableValueNode.js +4 -6
- package/src/nodes/core/AssignNode.js +5 -5
- package/src/nodes/core/AttributeNode.js +7 -20
- package/src/nodes/core/BypassNode.js +5 -5
- package/src/nodes/core/CacheNode.js +5 -5
- package/src/nodes/core/ConstNode.js +2 -2
- package/src/nodes/core/ContextNode.js +17 -11
- package/src/nodes/core/IndexNode.js +12 -7
- package/src/nodes/core/InputNode.js +2 -2
- package/src/nodes/core/MRTNode.js +12 -6
- package/src/nodes/core/Node.js +39 -19
- package/src/nodes/core/NodeBuilder.js +46 -33
- package/src/nodes/core/NodeUtils.js +1 -0
- package/src/nodes/core/OutputStructNode.js +4 -4
- package/src/nodes/core/ParameterNode.js +4 -4
- package/src/nodes/core/PropertyNode.js +32 -32
- package/src/nodes/core/StackNode.js +26 -10
- package/src/nodes/core/StructTypeNode.js +2 -2
- package/src/nodes/core/TempNode.js +2 -2
- package/src/nodes/core/UniformGroupNode.js +8 -9
- package/src/nodes/core/UniformNode.js +4 -4
- package/src/nodes/core/VarNode.js +6 -6
- package/src/nodes/core/VaryingNode.js +5 -5
- package/src/nodes/display/AfterImageNode.js +9 -9
- package/src/nodes/display/AnaglyphPassNode.js +61 -0
- package/src/nodes/display/AnamorphicNode.js +11 -11
- package/src/nodes/display/BleachBypass.js +26 -0
- package/src/nodes/display/BlendMode.js +54 -0
- package/src/nodes/display/BloomNode.js +21 -19
- package/src/nodes/display/BumpMapNode.js +7 -12
- package/src/nodes/display/ColorAdjustment.js +46 -0
- package/src/nodes/display/ColorSpaceFunctions.js +38 -0
- package/src/nodes/display/ColorSpaceNode.js +40 -63
- package/src/nodes/display/DenoiseNode.js +20 -17
- package/src/nodes/display/DepthOfFieldNode.js +8 -6
- package/src/nodes/display/DotScreenNode.js +10 -22
- package/src/nodes/display/FXAANode.js +17 -15
- package/src/nodes/display/FilmNode.js +7 -6
- package/src/nodes/display/FrontFacingNode.js +5 -5
- package/src/nodes/display/GTAONode.js +19 -15
- package/src/nodes/display/GaussianBlurNode.js +11 -8
- package/src/nodes/display/Lut3DNode.js +6 -5
- package/src/nodes/display/MotionBlur.js +25 -0
- package/src/nodes/display/NormalMapNode.js +8 -10
- package/src/nodes/display/ParallaxBarrierPassNode.js +55 -0
- package/src/nodes/display/PassNode.js +84 -8
- package/src/nodes/display/PixelationPassNode.js +12 -7
- package/src/nodes/display/PosterizeNode.js +4 -6
- package/src/nodes/display/RGBShiftNode.js +8 -7
- package/src/nodes/display/RenderOutputNode.js +9 -9
- package/src/nodes/display/SSAAPassNode.js +284 -0
- package/src/nodes/display/Sepia.js +17 -0
- package/src/nodes/display/SobelOperatorNode.js +9 -7
- package/src/nodes/display/StereoCompositePassNode.js +107 -0
- package/src/nodes/display/StereoPassNode.js +80 -0
- package/src/nodes/display/ToneMappingFunctions.js +190 -0
- package/src/nodes/display/ToneMappingNode.js +12 -173
- package/src/nodes/display/TransitionNode.js +9 -8
- package/src/nodes/display/ViewportDepthNode.js +30 -29
- package/src/nodes/display/ViewportDepthTextureNode.js +6 -8
- package/src/nodes/display/ViewportNode.js +26 -25
- package/src/nodes/display/ViewportSharedTextureNode.js +6 -8
- package/src/nodes/display/ViewportTextureNode.js +7 -10
- package/src/nodes/fog/FogExp2Node.js +4 -6
- package/src/nodes/fog/FogNode.js +5 -7
- package/src/nodes/fog/FogRangeNode.js +4 -6
- package/src/nodes/functions/BSDF/BRDF_GGX.js +4 -4
- package/src/nodes/functions/BSDF/BRDF_Lambert.js +2 -2
- package/src/nodes/functions/BSDF/BRDF_Sheen.js +6 -6
- package/src/nodes/functions/BSDF/DFGApprox.js +2 -2
- package/src/nodes/functions/BSDF/D_GGX.js +2 -2
- package/src/nodes/functions/BSDF/D_GGX_Anisotropic.js +3 -3
- package/src/nodes/functions/BSDF/EnvironmentBRDF.js +2 -2
- package/src/nodes/functions/BSDF/F_Schlick.js +2 -2
- package/src/nodes/functions/BSDF/LTC.js +6 -6
- package/src/nodes/functions/BSDF/Schlick_to_F0.js +2 -2
- package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated.js +2 -2
- package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.js +2 -2
- package/src/nodes/functions/BasicLightingModel.js +1 -1
- package/src/nodes/functions/PhongLightingModel.js +5 -5
- package/src/nodes/functions/PhysicalLightingModel.js +32 -31
- package/src/nodes/functions/ShadowMaskModel.js +1 -1
- package/src/nodes/functions/ToonLightingModel.js +3 -3
- package/src/nodes/functions/material/getGeometryRoughness.js +4 -4
- package/src/nodes/functions/material/getRoughness.js +2 -2
- package/src/nodes/geometry/RangeNode.js +4 -4
- package/src/nodes/gpgpu/ComputeNode.js +5 -5
- package/src/nodes/lighting/AONode.js +2 -2
- package/src/nodes/lighting/AmbientLightNode.js +2 -7
- package/src/nodes/lighting/AnalyticLightNode.js +34 -13
- package/src/nodes/lighting/BasicEnvironmentNode.js +4 -3
- package/src/nodes/lighting/BasicLightMapNode.js +3 -3
- package/src/nodes/lighting/DirectionalLightNode.js +2 -7
- package/src/nodes/lighting/EnvironmentNode.js +20 -19
- package/src/nodes/lighting/HemisphereLightNode.js +3 -7
- package/src/nodes/lighting/IESSpotLightNode.js +3 -8
- package/src/nodes/lighting/IrradianceNode.js +2 -2
- package/src/nodes/lighting/LightNode.js +5 -5
- package/src/nodes/lighting/LightProbeNode.js +76 -0
- package/src/nodes/lighting/LightUtils.js +3 -3
- package/src/nodes/lighting/LightingContextNode.js +15 -17
- package/src/nodes/lighting/LightingNode.js +2 -2
- package/src/nodes/lighting/LightsNode.js +94 -76
- package/src/nodes/lighting/PointLightNode.js +3 -8
- package/src/nodes/lighting/RectAreaLightNode.js +2 -6
- package/src/nodes/lighting/SpotLightNode.js +3 -8
- package/src/nodes/materialx/MaterialXNodes.js +2 -2
- package/src/nodes/materialx/lib/mx_hsv.js +36 -31
- package/src/nodes/materialx/lib/mx_noise.js +96 -96
- package/src/nodes/materialx/lib/mx_transform_color.js +2 -2
- package/src/nodes/math/{CondNode.js → ConditionalNode.js} +18 -7
- package/src/nodes/math/Hash.js +13 -0
- package/src/nodes/math/MathNode.js +124 -124
- package/src/nodes/math/MathUtils.js +0 -7
- package/src/nodes/math/OperatorNode.js +94 -52
- package/src/nodes/math/TriNoise3D.js +19 -29
- package/src/nodes/pmrem/PMREMNode.js +58 -15
- package/src/nodes/pmrem/PMREMUtils.js +46 -46
- package/src/nodes/procedural/Checker.js +14 -0
- package/src/nodes/tsl/TSLBase.js +30 -0
- package/src/nodes/{shadernode/ShaderNode.js → tsl/TSLCore.js} +105 -97
- package/src/nodes/utils/ArrayElementNode.js +2 -2
- package/src/nodes/utils/ConvertNode.js +2 -2
- package/src/nodes/utils/CubeMapNode.js +157 -0
- package/src/nodes/utils/Discard.js +8 -0
- package/src/nodes/utils/EquirectUVNode.js +5 -5
- package/src/nodes/utils/FlipNode.js +65 -0
- package/src/nodes/utils/FunctionOverloadingNode.js +5 -5
- package/src/nodes/utils/JoinNode.js +2 -2
- package/src/nodes/utils/LoopNode.js +12 -6
- package/src/nodes/utils/MatcapUVNode.js +6 -6
- package/src/nodes/utils/MaxMipLevelNode.js +4 -4
- package/src/nodes/utils/OscNode.js +7 -7
- package/src/nodes/utils/Packing.js +4 -0
- package/src/nodes/utils/RTTNode.js +8 -8
- package/src/nodes/utils/ReflectorNode.js +8 -3
- package/src/nodes/utils/RemapNode.js +7 -7
- package/src/nodes/utils/RotateNode.js +4 -12
- package/src/nodes/utils/SetNode.js +2 -2
- package/src/nodes/utils/SplitNode.js +2 -2
- package/src/nodes/utils/SpriteSheetUVNode.js +5 -5
- package/src/nodes/utils/SpriteUtils.js +47 -0
- package/src/nodes/utils/StorageArrayElementNode.js +4 -6
- package/src/nodes/utils/TimerNode.js +5 -5
- package/src/nodes/utils/TriplanarTexturesNode.js +7 -9
- package/src/nodes/utils/UVUtils.js +19 -0
- package/src/nodes/utils/ViewportUtils.js +14 -0
- package/src/objects/BatchedMesh.js +2 -3
- package/src/renderers/WebGLRenderer.js +24 -0
- package/src/renderers/common/Backend.js +2 -2
- package/src/renderers/common/Background.js +3 -1
- package/src/renderers/common/BindGroup.js +3 -1
- package/src/renderers/common/Bindings.js +13 -15
- package/src/renderers/common/ClippingContext.js +14 -5
- package/src/renderers/common/CubeRenderTarget.js +9 -3
- package/src/renderers/common/PostProcessing.js +4 -1
- package/src/renderers/common/QuadMesh.js +2 -0
- package/src/renderers/common/RenderContext.js +24 -0
- package/src/renderers/common/RenderList.js +1 -1
- package/src/renderers/common/RenderObject.js +2 -2
- package/src/renderers/common/Renderer.js +75 -49
- package/src/renderers/common/SampledTexture.js +12 -3
- package/src/renderers/common/StandardRenderer.js +18 -0
- package/src/renderers/common/Textures.js +8 -12
- package/src/renderers/common/extras/PMREMGenerator.js +12 -13
- package/src/renderers/common/nodes/NodeBuilderState.js +1 -1
- package/src/renderers/common/nodes/NodeLibrary.js +118 -0
- package/src/renderers/common/nodes/NodeSampledTexture.js +2 -2
- package/src/renderers/common/nodes/Nodes.js +36 -9
- package/src/renderers/common/nodes/StandardNodeLibrary.js +105 -0
- package/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.js +2 -2
- package/src/renderers/webgl/WebGLProgram.js +1 -1
- package/src/renderers/webgl/WebGLProperties.js +7 -0
- package/src/renderers/webgl/WebGLTextures.js +61 -4
- package/src/renderers/webgl-fallback/WebGLBackend.js +88 -68
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +57 -9
- package/src/renderers/webgl-fallback/utils/WebGLState.js +21 -0
- package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +28 -21
- package/src/renderers/webgpu/WebGPUBackend.js +86 -68
- package/src/renderers/webgpu/WebGPURenderer.js +8 -8
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +99 -63
- package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +45 -21
- package/src/renderers/webgpu/utils/WebGPUConstants.js +2 -1
- package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +6 -15
- package/src/renderers/webgpu/utils/WebGPUTexturePassUtils.js +62 -5
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +36 -21
- package/src/renderers/webgpu/utils/WebGPUUtils.js +18 -1
- package/src/renderers/webxr/WebXRManager.js +32 -25
- package/examples/jsm/loaders/LogLuvLoader.js +0 -606
- package/src/nodes/accessors/NormalNode.js +0 -14
- package/src/nodes/accessors/PositionNode.js +0 -10
- package/src/nodes/accessors/ReflectVectorNode.js +0 -10
- package/src/nodes/accessors/TangentNode.js +0 -23
- package/src/nodes/core/NodeKeywords.js +0 -80
- package/src/nodes/display/BlendModeNode.js +0 -128
- package/src/nodes/display/ColorAdjustmentNode.js +0 -104
- package/src/nodes/materials/MeshNormalNodeMaterial.js +0 -40
- package/src/nodes/math/HashNode.js +0 -34
- package/src/nodes/procedural/CheckerNode.js +0 -42
- package/src/nodes/utils/DiscardNode.js +0 -28
- package/src/nodes/utils/PackingNode.js +0 -55
- package/src/nodes/utils/RotateUVNode.js +0 -35
- /package/src/{nodes/loaders → loaders/nodes}/NodeObjectLoader.js +0 -0
- /package/src/nodes/accessors/{UVNode.js → UV.js} +0 -0
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import Node, {
|
|
1
|
+
import Node, { registerNode } from '../core/Node.js';
|
|
2
2
|
import { expression } from '../code/ExpressionNode.js';
|
|
3
|
-
import {
|
|
4
|
-
import { addNodeElement, nodeObject, nodeArray } from '../shadernode/ShaderNode.js';
|
|
3
|
+
import { nodeObject, nodeArray } from '../tsl/TSLBase.js';
|
|
5
4
|
|
|
6
5
|
class LoopNode extends Node {
|
|
7
6
|
|
|
@@ -192,10 +191,17 @@ class LoopNode extends Node {
|
|
|
192
191
|
|
|
193
192
|
export default LoopNode;
|
|
194
193
|
|
|
195
|
-
|
|
194
|
+
LoopNode.type = /*@__PURE__*/ registerNode( 'Loop', LoopNode );
|
|
195
|
+
|
|
196
|
+
export const Loop = ( ...params ) => nodeObject( new LoopNode( nodeArray( params, 'int' ) ) ).append();
|
|
196
197
|
export const Continue = () => expression( 'continue' ).append();
|
|
197
198
|
export const Break = () => expression( 'break' ).append();
|
|
198
199
|
|
|
199
|
-
|
|
200
|
+
//
|
|
201
|
+
|
|
202
|
+
export const loop = ( ...params ) => { // @deprecated, r168
|
|
203
|
+
|
|
204
|
+
console.warn( 'TSL.LoopNode: loop() has been renamed to Loop().' );
|
|
205
|
+
return Loop( ...params );
|
|
200
206
|
|
|
201
|
-
|
|
207
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { registerNode } from '../core/Node.js';
|
|
1
2
|
import TempNode from '../core/TempNode.js';
|
|
2
|
-
import { transformedNormalView } from '../accessors/
|
|
3
|
-
import { positionViewDirection } from '../accessors/
|
|
4
|
-
import { nodeImmutable, vec2, vec3 } from '../
|
|
5
|
-
import { addNodeClass } from '../core/Node.js';
|
|
3
|
+
import { transformedNormalView } from '../accessors/Normal.js';
|
|
4
|
+
import { positionViewDirection } from '../accessors/Position.js';
|
|
5
|
+
import { nodeImmutable, vec2, vec3 } from '../tsl/TSLBase.js';
|
|
6
6
|
|
|
7
7
|
class MatcapUVNode extends TempNode {
|
|
8
8
|
|
|
@@ -25,6 +25,6 @@ class MatcapUVNode extends TempNode {
|
|
|
25
25
|
|
|
26
26
|
export default MatcapUVNode;
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
MatcapUVNode.type = /*@__PURE__*/ registerNode( 'MatcapUV', MatcapUVNode );
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
export const matcapUV = /*@__PURE__*/ nodeImmutable( MatcapUVNode );
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { registerNode } from '../core/Node.js';
|
|
1
2
|
import UniformNode from '../core/UniformNode.js';
|
|
2
3
|
import { NodeUpdateType } from '../core/constants.js';
|
|
3
|
-
import { nodeProxy } from '../
|
|
4
|
-
import { addNodeClass } from '../core/Node.js';
|
|
4
|
+
import { nodeProxy } from '../tsl/TSLBase.js';
|
|
5
5
|
|
|
6
6
|
class MaxMipLevelNode extends UniformNode {
|
|
7
7
|
|
|
@@ -47,6 +47,6 @@ class MaxMipLevelNode extends UniformNode {
|
|
|
47
47
|
|
|
48
48
|
export default MaxMipLevelNode;
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
MaxMipLevelNode.type = /*@__PURE__*/ registerNode( 'MaxMipLevel', MaxMipLevelNode );
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
export const maxMipLevel = /*@__PURE__*/ nodeProxy( MaxMipLevelNode );
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import Node, {
|
|
1
|
+
import Node, { registerNode } from '../core/Node.js';
|
|
2
2
|
import { timerLocal } from './TimerNode.js';
|
|
3
|
-
import { nodeObject, nodeProxy } from '../
|
|
3
|
+
import { nodeObject, nodeProxy } from '../tsl/TSLBase.js';
|
|
4
4
|
|
|
5
5
|
class OscNode extends Node {
|
|
6
6
|
|
|
@@ -73,9 +73,9 @@ OscNode.SAWTOOTH = 'sawtooth';
|
|
|
73
73
|
|
|
74
74
|
export default OscNode;
|
|
75
75
|
|
|
76
|
-
|
|
77
|
-
export const oscSquare = nodeProxy( OscNode, OscNode.SQUARE );
|
|
78
|
-
export const oscTriangle = nodeProxy( OscNode, OscNode.TRIANGLE );
|
|
79
|
-
export const oscSawtooth = nodeProxy( OscNode, OscNode.SAWTOOTH );
|
|
76
|
+
OscNode.type = /*@__PURE__*/ registerNode( 'Osc', OscNode );
|
|
80
77
|
|
|
81
|
-
|
|
78
|
+
export const oscSine = /*@__PURE__*/ nodeProxy( OscNode, OscNode.SINE );
|
|
79
|
+
export const oscSquare = /*@__PURE__*/ nodeProxy( OscNode, OscNode.SQUARE );
|
|
80
|
+
export const oscTriangle = /*@__PURE__*/ nodeProxy( OscNode, OscNode.TRIANGLE );
|
|
81
|
+
export const oscSawtooth = /*@__PURE__*/ nodeProxy( OscNode, OscNode.SAWTOOTH );
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { registerNode } from '../core/Node.js';
|
|
2
|
+
import { nodeObject } from '../tsl/TSLCore.js';
|
|
2
3
|
import TextureNode from '../accessors/TextureNode.js';
|
|
3
4
|
import { NodeUpdateType } from '../core/constants.js';
|
|
4
|
-
import {
|
|
5
|
-
import NodeMaterial from '
|
|
6
|
-
import { uv } from '../accessors/UVNode.js';
|
|
5
|
+
import { uv } from '../accessors/UV.js';
|
|
6
|
+
import NodeMaterial from '../../materials/nodes/NodeMaterial.js';
|
|
7
7
|
import QuadMesh from '../../renderers/common/QuadMesh.js';
|
|
8
8
|
|
|
9
9
|
import { RenderTarget } from '../../core/RenderTarget.js';
|
|
@@ -47,6 +47,7 @@ class RTTNode extends TextureNode {
|
|
|
47
47
|
setup( builder ) {
|
|
48
48
|
|
|
49
49
|
this._rttNode = this.node.context( builder.getSharedContext() );
|
|
50
|
+
this._quadMesh.material.name = 'RTT';
|
|
50
51
|
this._quadMesh.material.needsUpdate = true;
|
|
51
52
|
|
|
52
53
|
return super.setup( builder );
|
|
@@ -123,8 +124,7 @@ class RTTNode extends TextureNode {
|
|
|
123
124
|
|
|
124
125
|
export default RTTNode;
|
|
125
126
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
addNodeElement( 'toTexture', ( node, ...params ) => node.isTextureNode ? node : rtt( node, ...params ) );
|
|
127
|
+
RTTNode.type = /*@__PURE__*/ registerNode( 'RTT', RTTNode );
|
|
129
128
|
|
|
130
|
-
|
|
129
|
+
export const rtt = ( node, ...params ) => nodeObject( new RTTNode( nodeObject( node ), ...params ) );
|
|
130
|
+
export const convertToTexture = ( node, ...params ) => node.isTextureNode ? node : rtt( node, ...params );
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { registerNode } from '../core/Node.js';
|
|
1
2
|
import TextureNode from '../accessors/TextureNode.js';
|
|
2
|
-
import { nodeObject
|
|
3
|
+
import { nodeObject } from '../tsl/TSLBase.js';
|
|
3
4
|
import { NodeUpdateType } from '../core/constants.js';
|
|
4
|
-
import {
|
|
5
|
+
import { viewportUV } from '../display/ViewportNode.js';
|
|
5
6
|
|
|
6
7
|
import { HalfFloatType, LinearMipMapLinearFilter } from '../../constants.js';
|
|
7
8
|
import { Plane } from '../../math/Plane.js';
|
|
@@ -27,7 +28,7 @@ const _q = new Vector4();
|
|
|
27
28
|
const _size = new Vector2();
|
|
28
29
|
|
|
29
30
|
const _defaultRT = new RenderTarget();
|
|
30
|
-
const _defaultUV =
|
|
31
|
+
const _defaultUV = viewportUV.flipX();
|
|
31
32
|
|
|
32
33
|
let _inReflector = false;
|
|
33
34
|
|
|
@@ -214,11 +215,14 @@ class ReflectorNode extends TextureNode {
|
|
|
214
215
|
material.visible = false;
|
|
215
216
|
|
|
216
217
|
const currentRenderTarget = renderer.getRenderTarget();
|
|
218
|
+
const currentMRT = renderer.getMRT();
|
|
217
219
|
|
|
220
|
+
renderer.setMRT( null );
|
|
218
221
|
renderer.setRenderTarget( renderTarget );
|
|
219
222
|
|
|
220
223
|
renderer.render( scene, virtualCamera );
|
|
221
224
|
|
|
225
|
+
renderer.setMRT( currentMRT );
|
|
222
226
|
renderer.setRenderTarget( currentRenderTarget );
|
|
223
227
|
|
|
224
228
|
material.visible = true;
|
|
@@ -233,3 +237,4 @@ export const reflector = ( parameters ) => nodeObject( new ReflectorNode( parame
|
|
|
233
237
|
|
|
234
238
|
export default ReflectorNode;
|
|
235
239
|
|
|
240
|
+
ReflectorNode.type = /*@__PURE__*/ registerNode( 'Reflector', ReflectorNode );
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import Node, {
|
|
2
|
-
import { float,
|
|
1
|
+
import Node, { registerNode } from '../core/Node.js';
|
|
2
|
+
import { float, addMethodChaining, nodeProxy } from '../tsl/TSLCore.js';
|
|
3
3
|
|
|
4
4
|
class RemapNode extends Node {
|
|
5
5
|
|
|
@@ -33,10 +33,10 @@ class RemapNode extends Node {
|
|
|
33
33
|
|
|
34
34
|
export default RemapNode;
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
export const remapClamp = nodeProxy( RemapNode );
|
|
36
|
+
RemapNode.type = /*@__PURE__*/ registerNode( 'Remap', RemapNode );
|
|
38
37
|
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
export const remap = /*@__PURE__*/ nodeProxy( RemapNode, null, null, { doClamp: false } );
|
|
39
|
+
export const remapClamp = /*@__PURE__*/ nodeProxy( RemapNode );
|
|
41
40
|
|
|
42
|
-
|
|
41
|
+
addMethodChaining( 'remap', remap );
|
|
42
|
+
addMethodChaining( 'remapClamp', remapClamp );
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
+
import { registerNode } from '../core/Node.js';
|
|
1
2
|
import TempNode from '../core/TempNode.js';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
addNodeElement,
|
|
5
|
-
nodeProxy,
|
|
6
|
-
vec4,
|
|
7
|
-
mat2,
|
|
8
|
-
mat4,
|
|
9
|
-
} from '../shadernode/ShaderNode.js';
|
|
3
|
+
import { nodeProxy, vec4, mat2, mat4 } from '../tsl/TSLBase.js';
|
|
10
4
|
import { cos, sin } from '../math/MathNode.js';
|
|
11
5
|
|
|
12
6
|
class RotateNode extends TempNode {
|
|
@@ -61,8 +55,6 @@ class RotateNode extends TempNode {
|
|
|
61
55
|
|
|
62
56
|
export default RotateNode;
|
|
63
57
|
|
|
64
|
-
|
|
58
|
+
RotateNode.type = /*@__PURE__*/ registerNode( 'Rotate', RotateNode );
|
|
65
59
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
addNodeClass( 'RotateNode', RotateNode );
|
|
60
|
+
export const rotate = /*@__PURE__*/ nodeProxy( RotateNode );
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { registerNode } from '../core/Node.js';
|
|
2
2
|
import TempNode from '../core/TempNode.js';
|
|
3
3
|
import { vectorComponents } from '../core/constants.js';
|
|
4
4
|
|
|
@@ -59,4 +59,4 @@ class SetNode extends TempNode {
|
|
|
59
59
|
|
|
60
60
|
export default SetNode;
|
|
61
61
|
|
|
62
|
-
|
|
62
|
+
SetNode.type = /*@__PURE__*/ registerNode( 'Set', SetNode );
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import Node, {
|
|
1
|
+
import Node, { registerNode } from '../core/Node.js';
|
|
2
2
|
import { vectorComponents } from '../core/constants.js';
|
|
3
3
|
|
|
4
4
|
const stringVectorComponents = vectorComponents.join( '' );
|
|
@@ -109,4 +109,4 @@ class SplitNode extends Node {
|
|
|
109
109
|
|
|
110
110
|
export default SplitNode;
|
|
111
111
|
|
|
112
|
-
|
|
112
|
+
SplitNode.type = /*@__PURE__*/ registerNode( 'Split', SplitNode );
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import Node, {
|
|
2
|
-
import { uv } from '../accessors/
|
|
3
|
-
import { nodeProxy, float, vec2 } from '../
|
|
1
|
+
import Node, { registerNode } from '../core/Node.js';
|
|
2
|
+
import { uv } from '../accessors/UV.js';
|
|
3
|
+
import { nodeProxy, float, vec2 } from '../tsl/TSLBase.js';
|
|
4
4
|
|
|
5
5
|
class SpriteSheetUVNode extends Node {
|
|
6
6
|
|
|
@@ -36,6 +36,6 @@ class SpriteSheetUVNode extends Node {
|
|
|
36
36
|
|
|
37
37
|
export default SpriteSheetUVNode;
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
SpriteSheetUVNode.type = /*@__PURE__*/ registerNode( 'SpriteSheetUV', SpriteSheetUVNode );
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
export const spritesheetUV = /*@__PURE__*/ nodeProxy( SpriteSheetUVNode );
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { modelWorldMatrix } from '../accessors/ModelNode.js';
|
|
2
|
+
import { cameraViewMatrix, cameraProjectionMatrix } from '../accessors/Camera.js';
|
|
3
|
+
import { positionLocal } from '../accessors/Position.js';
|
|
4
|
+
import { Fn, defined } from '../tsl/TSLBase.js';
|
|
5
|
+
|
|
6
|
+
export const billboarding = /*@__PURE__*/ Fn( ( { position = null, horizontal = true, vertical = false } ) => {
|
|
7
|
+
|
|
8
|
+
let worldMatrix;
|
|
9
|
+
|
|
10
|
+
if ( position !== null ) {
|
|
11
|
+
|
|
12
|
+
worldMatrix = modelWorldMatrix.toVar();
|
|
13
|
+
worldMatrix[ 3 ][ 0 ] = position.x;
|
|
14
|
+
worldMatrix[ 3 ][ 1 ] = position.y;
|
|
15
|
+
worldMatrix[ 3 ][ 2 ] = position.z;
|
|
16
|
+
|
|
17
|
+
} else {
|
|
18
|
+
|
|
19
|
+
worldMatrix = modelWorldMatrix;
|
|
20
|
+
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const modelViewMatrix = cameraViewMatrix.mul( worldMatrix );
|
|
24
|
+
|
|
25
|
+
if ( defined( horizontal ) ) {
|
|
26
|
+
|
|
27
|
+
modelViewMatrix[ 0 ][ 0 ] = modelWorldMatrix[ 0 ].length();
|
|
28
|
+
modelViewMatrix[ 0 ][ 1 ] = 0;
|
|
29
|
+
modelViewMatrix[ 0 ][ 2 ] = 0;
|
|
30
|
+
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if ( defined( vertical ) ) {
|
|
34
|
+
|
|
35
|
+
modelViewMatrix[ 1 ][ 0 ] = 0;
|
|
36
|
+
modelViewMatrix[ 1 ][ 1 ] = modelWorldMatrix[ 1 ].length();
|
|
37
|
+
modelViewMatrix[ 1 ][ 2 ] = 0;
|
|
38
|
+
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
modelViewMatrix[ 2 ][ 0 ] = 0;
|
|
42
|
+
modelViewMatrix[ 2 ][ 1 ] = 0;
|
|
43
|
+
modelViewMatrix[ 2 ][ 2 ] = 1;
|
|
44
|
+
|
|
45
|
+
return cameraProjectionMatrix.mul( modelViewMatrix ).mul( positionLocal );
|
|
46
|
+
|
|
47
|
+
} );
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { nodeProxy
|
|
1
|
+
import { registerNode } from '../core/Node.js';
|
|
2
|
+
import { nodeProxy } from '../tsl/TSLBase.js';
|
|
3
3
|
import ArrayElementNode from './ArrayElementNode.js';
|
|
4
4
|
|
|
5
5
|
class StorageArrayElementNode extends ArrayElementNode {
|
|
@@ -84,8 +84,6 @@ class StorageArrayElementNode extends ArrayElementNode {
|
|
|
84
84
|
|
|
85
85
|
export default StorageArrayElementNode;
|
|
86
86
|
|
|
87
|
-
|
|
87
|
+
StorageArrayElementNode.type = /*@__PURE__*/ registerNode( 'StorageArrayElement', StorageArrayElementNode );
|
|
88
88
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
addNodeClass( 'StorageArrayElementNode', StorageArrayElementNode );
|
|
89
|
+
export const storageElement = /*@__PURE__*/ nodeProxy( StorageArrayElementNode );
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { registerNode } from '../core/Node.js';
|
|
1
2
|
import UniformNode from '../core/UniformNode.js';
|
|
2
3
|
import { NodeUpdateType } from '../core/constants.js';
|
|
3
|
-
import { nodeObject, nodeImmutable } from '../
|
|
4
|
-
import { addNodeClass } from '../core/Node.js';
|
|
4
|
+
import { nodeObject, nodeImmutable } from '../tsl/TSLBase.js';
|
|
5
5
|
|
|
6
6
|
class TimerNode extends UniformNode {
|
|
7
7
|
|
|
@@ -85,10 +85,10 @@ TimerNode.FRAME = 'frame';
|
|
|
85
85
|
|
|
86
86
|
export default TimerNode;
|
|
87
87
|
|
|
88
|
+
TimerNode.type = /*@__PURE__*/ registerNode( 'Timer', TimerNode );
|
|
89
|
+
|
|
88
90
|
// @TODO: add support to use node in timeScale
|
|
89
91
|
export const timerLocal = ( timeScale, value = 0 ) => nodeObject( new TimerNode( TimerNode.LOCAL, timeScale, value ) );
|
|
90
92
|
export const timerGlobal = ( timeScale, value = 0 ) => nodeObject( new TimerNode( TimerNode.GLOBAL, timeScale, value ) );
|
|
91
93
|
export const timerDelta = ( timeScale, value = 0 ) => nodeObject( new TimerNode( TimerNode.DELTA, timeScale, value ) );
|
|
92
|
-
export const frameId = nodeImmutable( TimerNode, TimerNode.FRAME ).toUint();
|
|
93
|
-
|
|
94
|
-
addNodeClass( 'TimerNode', TimerNode );
|
|
94
|
+
export const frameId = /*@__PURE__*/ nodeImmutable( TimerNode, TimerNode.FRAME ).toUint();
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import Node, {
|
|
1
|
+
import Node, { registerNode } from '../core/Node.js';
|
|
2
2
|
import { add } from '../math/OperatorNode.js';
|
|
3
|
-
import { normalLocal } from '../accessors/
|
|
4
|
-
import { positionLocal } from '../accessors/
|
|
3
|
+
import { normalLocal } from '../accessors/Normal.js';
|
|
4
|
+
import { positionLocal } from '../accessors/Position.js';
|
|
5
5
|
import { texture } from '../accessors/TextureNode.js';
|
|
6
|
-
import {
|
|
6
|
+
import { nodeProxy, float, vec3 } from '../tsl/TSLBase.js';
|
|
7
7
|
|
|
8
8
|
class TriplanarTexturesNode extends Node {
|
|
9
9
|
|
|
@@ -54,9 +54,7 @@ class TriplanarTexturesNode extends Node {
|
|
|
54
54
|
|
|
55
55
|
export default TriplanarTexturesNode;
|
|
56
56
|
|
|
57
|
-
|
|
58
|
-
export const triplanarTexture = ( ...params ) => triplanarTextures( ...params );
|
|
59
|
-
|
|
60
|
-
addNodeElement( 'triplanarTexture', triplanarTexture );
|
|
57
|
+
TriplanarTexturesNode.type = /*@__PURE__*/ registerNode( 'TriplanarTextures', TriplanarTexturesNode );
|
|
61
58
|
|
|
62
|
-
|
|
59
|
+
export const triplanarTextures = /*@__PURE__*/ nodeProxy( TriplanarTexturesNode );
|
|
60
|
+
export const triplanarTexture = ( ...params ) => triplanarTextures( ...params );
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Fn, vec2 } from '../tsl/TSLBase.js';
|
|
2
|
+
import { rotate } from './RotateNode.js';
|
|
3
|
+
|
|
4
|
+
export const rotateUV = /*@__PURE__*/ Fn( ( [ uv, rotation, center = vec2( 0.5 ) ] ) => {
|
|
5
|
+
|
|
6
|
+
return rotate( uv.sub( center ), rotation ).add( center );
|
|
7
|
+
|
|
8
|
+
} );
|
|
9
|
+
|
|
10
|
+
export const spherizeUV = /*@__PURE__*/ Fn( ( [ uv, strength, center = vec2( 0.5 ) ] ) => {
|
|
11
|
+
|
|
12
|
+
const delta = uv.sub( center );
|
|
13
|
+
const delta2 = delta.dot( delta );
|
|
14
|
+
const delta4 = delta2.mul( delta2 );
|
|
15
|
+
const deltaOffset = delta4.mul( strength );
|
|
16
|
+
|
|
17
|
+
return uv.add( delta.mul( deltaOffset ) );
|
|
18
|
+
|
|
19
|
+
} );
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Fn } from '../tsl/TSLBase.js';
|
|
2
|
+
import { viewportUV } from '../display/ViewportNode.js';
|
|
3
|
+
import { viewportDepthTexture } from '../display/ViewportDepthTextureNode.js';
|
|
4
|
+
import { linearDepth } from '../display/ViewportDepthNode.js';
|
|
5
|
+
|
|
6
|
+
export const viewportSafeUV = /*@__PURE__*/ Fn( ( [ uv = null ] ) => {
|
|
7
|
+
|
|
8
|
+
const depth = linearDepth();
|
|
9
|
+
const depthDiff = linearDepth( viewportDepthTexture( uv ) ).sub( depth );
|
|
10
|
+
const finalUV = depthDiff.lessThan( 0 ).select( viewportUV, uv );
|
|
11
|
+
|
|
12
|
+
return finalUV;
|
|
13
|
+
|
|
14
|
+
} );
|
|
@@ -206,7 +206,7 @@ class BatchedMesh extends Mesh {
|
|
|
206
206
|
|
|
207
207
|
_initColorsTexture() {
|
|
208
208
|
|
|
209
|
-
let size = Math.sqrt( this.
|
|
209
|
+
let size = Math.sqrt( this._maxInstanceCount );
|
|
210
210
|
size = Math.ceil( size );
|
|
211
211
|
|
|
212
212
|
// 4 floats per RGBA pixel initialized to white
|
|
@@ -300,12 +300,11 @@ class BatchedMesh extends Mesh {
|
|
|
300
300
|
|
|
301
301
|
}
|
|
302
302
|
|
|
303
|
-
const geometryCount = this._geometryCount;
|
|
304
303
|
const boundingBox = this.boundingBox;
|
|
305
304
|
const drawInfo = this._drawInfo;
|
|
306
305
|
|
|
307
306
|
boundingBox.makeEmpty();
|
|
308
|
-
for ( let i = 0; i <
|
|
307
|
+
for ( let i = 0, l = drawInfo.length; i < l; i ++ ) {
|
|
309
308
|
|
|
310
309
|
if ( drawInfo[ i ].active === false ) continue;
|
|
311
310
|
|
|
@@ -1615,6 +1615,8 @@ class WebGLRenderer {
|
|
|
1615
1615
|
object.modelViewMatrix.multiplyMatrices( camera.matrixWorldInverse, object.matrixWorld );
|
|
1616
1616
|
object.normalMatrix.getNormalMatrix( object.modelViewMatrix );
|
|
1617
1617
|
|
|
1618
|
+
material.onBeforeRender( _this, scene, camera, geometry, object, group );
|
|
1619
|
+
|
|
1618
1620
|
if ( material.transparent === true && material.side === DoubleSide && material.forceSinglePass === false ) {
|
|
1619
1621
|
|
|
1620
1622
|
material.side = BackSide;
|
|
@@ -2331,6 +2333,28 @@ class WebGLRenderer {
|
|
|
2331
2333
|
// Color and depth texture must be rebound in order for the swapchain to update.
|
|
2332
2334
|
textures.rebindTextures( renderTarget, properties.get( renderTarget.texture ).__webglTexture, properties.get( renderTarget.depthTexture ).__webglTexture );
|
|
2333
2335
|
|
|
2336
|
+
} else if ( renderTarget.depthBuffer ) {
|
|
2337
|
+
|
|
2338
|
+
// check if the depth texture is already bound to the frame buffer and that it's been initialized
|
|
2339
|
+
const depthTexture = renderTarget.depthTexture;
|
|
2340
|
+
if ( renderTargetProperties.__boundDepthTexture !== depthTexture ) {
|
|
2341
|
+
|
|
2342
|
+
// check if the depth texture is compatible
|
|
2343
|
+
if (
|
|
2344
|
+
depthTexture !== null &&
|
|
2345
|
+
properties.has( depthTexture ) &&
|
|
2346
|
+
( renderTarget.width !== depthTexture.image.width || renderTarget.height !== depthTexture.image.height )
|
|
2347
|
+
) {
|
|
2348
|
+
|
|
2349
|
+
throw new Error( 'WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.' );
|
|
2350
|
+
|
|
2351
|
+
}
|
|
2352
|
+
|
|
2353
|
+
// Swap the depth buffer to the currently attached one
|
|
2354
|
+
textures.setupDepthRenderbuffer( renderTarget );
|
|
2355
|
+
|
|
2356
|
+
}
|
|
2357
|
+
|
|
2334
2358
|
}
|
|
2335
2359
|
|
|
2336
2360
|
const texture = renderTarget.texture;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import DataMap from './DataMap.js';
|
|
2
2
|
import Color4 from './Color4.js';
|
|
3
|
-
import { vec4, context, normalWorld, backgroundBlurriness, backgroundIntensity,
|
|
3
|
+
import { vec4, context, normalWorld, backgroundBlurriness, backgroundIntensity, modelViewProjection } from '../../nodes/TSL.js';
|
|
4
|
+
import NodeMaterial from '../../materials/nodes/NodeMaterial.js';
|
|
4
5
|
|
|
5
6
|
import { Mesh } from '../../objects/Mesh.js';
|
|
6
7
|
import { SphereGeometry } from '../../geometries/SphereGeometry.js';
|
|
@@ -90,6 +91,7 @@ class Background extends DataMap {
|
|
|
90
91
|
if ( sceneData.backgroundCacheKey !== backgroundCacheKey ) {
|
|
91
92
|
|
|
92
93
|
sceneData.backgroundMeshNode.node = vec4( backgroundNode ).mul( backgroundIntensity );
|
|
94
|
+
sceneData.backgroundMeshNode.needsUpdate = true;
|
|
93
95
|
|
|
94
96
|
backgroundMesh.material.needsUpdate = true;
|
|
95
97
|
|
|
@@ -2,10 +2,12 @@ let _id = 0;
|
|
|
2
2
|
|
|
3
3
|
class BindGroup {
|
|
4
4
|
|
|
5
|
-
constructor( name = '', bindings = [] ) {
|
|
5
|
+
constructor( name = '', bindings = [], index = 0, bindingsReference = [] ) {
|
|
6
6
|
|
|
7
7
|
this.name = name;
|
|
8
8
|
this.bindings = bindings;
|
|
9
|
+
this.index = index;
|
|
10
|
+
this.bindingsReference = bindingsReference;
|
|
9
11
|
|
|
10
12
|
this.id = _id ++;
|
|
11
13
|
|
|
@@ -70,21 +70,21 @@ class Bindings extends DataMap {
|
|
|
70
70
|
|
|
71
71
|
updateForCompute( computeNode ) {
|
|
72
72
|
|
|
73
|
-
this._updateBindings(
|
|
73
|
+
this._updateBindings( this.getForCompute( computeNode ) );
|
|
74
74
|
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
updateForRender( renderObject ) {
|
|
78
78
|
|
|
79
|
-
this._updateBindings(
|
|
79
|
+
this._updateBindings( this.getForRender( renderObject ) );
|
|
80
80
|
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
_updateBindings(
|
|
83
|
+
_updateBindings( bindings ) {
|
|
84
84
|
|
|
85
85
|
for ( const bindGroup of bindings ) {
|
|
86
86
|
|
|
87
|
-
this._update(
|
|
87
|
+
this._update( bindGroup, bindings );
|
|
88
88
|
|
|
89
89
|
}
|
|
90
90
|
|
|
@@ -110,7 +110,7 @@ class Bindings extends DataMap {
|
|
|
110
110
|
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
-
_update(
|
|
113
|
+
_update( bindGroup, bindings ) {
|
|
114
114
|
|
|
115
115
|
const { backend } = this;
|
|
116
116
|
|
|
@@ -144,26 +144,26 @@ class Bindings extends DataMap {
|
|
|
144
144
|
|
|
145
145
|
} else if ( binding.isSampledTexture ) {
|
|
146
146
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
if ( binding.needsBindingsUpdate ) needsBindingsUpdate = true;
|
|
147
|
+
if ( binding.needsBindingsUpdate( this.textures.get( binding.texture ).generation ) ) needsBindingsUpdate = true;
|
|
150
148
|
|
|
151
149
|
const updated = binding.update();
|
|
152
150
|
|
|
151
|
+
const texture = binding.texture;
|
|
152
|
+
|
|
153
153
|
if ( updated ) {
|
|
154
154
|
|
|
155
|
-
this.textures.updateTexture(
|
|
155
|
+
this.textures.updateTexture( texture );
|
|
156
156
|
|
|
157
157
|
}
|
|
158
158
|
|
|
159
|
-
const textureData = backend.get(
|
|
159
|
+
const textureData = backend.get( texture );
|
|
160
160
|
|
|
161
161
|
if ( backend.isWebGPUBackend === true && textureData.texture === undefined && textureData.externalTexture === undefined ) {
|
|
162
162
|
|
|
163
163
|
// TODO: Remove this once we found why updated === false isn't bound to a texture in the WebGPU backend
|
|
164
|
-
console.error( 'Bindings._update: binding should be available:', binding, updated,
|
|
164
|
+
console.error( 'Bindings._update: binding should be available:', binding, updated, texture, binding.textureNode.value, needsBindingsUpdate );
|
|
165
165
|
|
|
166
|
-
this.textures.updateTexture(
|
|
166
|
+
this.textures.updateTexture( texture );
|
|
167
167
|
needsBindingsUpdate = true;
|
|
168
168
|
|
|
169
169
|
}
|
|
@@ -192,9 +192,7 @@ class Bindings extends DataMap {
|
|
|
192
192
|
|
|
193
193
|
if ( needsBindingsUpdate === true ) {
|
|
194
194
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
this.backend.updateBindings( bindGroup, bindings, pipeline );
|
|
195
|
+
this.backend.updateBindings( bindGroup, bindings );
|
|
198
196
|
|
|
199
197
|
}
|
|
200
198
|
|