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,14 +1,17 @@
|
|
|
1
|
+
import { registerNode } from '../core/Node.js';
|
|
1
2
|
import TempNode from '../core/TempNode.js';
|
|
2
|
-
import { nodeObject,
|
|
3
|
+
import { nodeObject, Fn, float, vec2, vec4 } from '../tsl/TSLBase.js';
|
|
3
4
|
import { NodeUpdateType } from '../core/constants.js';
|
|
4
5
|
import { mul } from '../math/OperatorNode.js';
|
|
5
|
-
import { uv } from '../accessors/
|
|
6
|
+
import { uv } from '../accessors/UV.js';
|
|
6
7
|
import { passTexture } from './PassNode.js';
|
|
7
8
|
import { uniform } from '../core/UniformNode.js';
|
|
9
|
+
import { convertToTexture } from '../utils/RTTNode.js';
|
|
8
10
|
import QuadMesh from '../../renderers/common/QuadMesh.js';
|
|
9
11
|
|
|
10
12
|
import { Vector2 } from '../../math/Vector2.js';
|
|
11
13
|
import { RenderTarget } from '../../core/RenderTarget.js';
|
|
14
|
+
import NodeMaterial from '../../materials/nodes/NodeMaterial.js';
|
|
12
15
|
|
|
13
16
|
// WebGPU: The use of a single QuadMesh for both gaussian blur passes results in a single RenderObject with a SampledTexture binding that
|
|
14
17
|
// alternates between source textures and triggers creation of new BindGroups and BindGroupLayouts every frame.
|
|
@@ -129,7 +132,7 @@ class GaussianBlurNode extends TempNode {
|
|
|
129
132
|
|
|
130
133
|
const sampleTexture = ( uv ) => textureNode.uv( uv );
|
|
131
134
|
|
|
132
|
-
const blur =
|
|
135
|
+
const blur = Fn( () => {
|
|
133
136
|
|
|
134
137
|
const kernelSize = 3 + ( 2 * this.sigma );
|
|
135
138
|
const gaussianCoefficients = this._getCoefficients( kernelSize );
|
|
@@ -161,8 +164,9 @@ class GaussianBlurNode extends TempNode {
|
|
|
161
164
|
|
|
162
165
|
//
|
|
163
166
|
|
|
164
|
-
const material = this._material || ( this._material =
|
|
167
|
+
const material = this._material || ( this._material = new NodeMaterial() );
|
|
165
168
|
material.fragmentNode = blur().context( builder.getSharedContext() );
|
|
169
|
+
material.name = 'Gaussian_blur';
|
|
166
170
|
material.needsUpdate = true;
|
|
167
171
|
|
|
168
172
|
//
|
|
@@ -199,9 +203,8 @@ class GaussianBlurNode extends TempNode {
|
|
|
199
203
|
|
|
200
204
|
}
|
|
201
205
|
|
|
202
|
-
export const gaussianBlur = ( node, directionNode, sigma ) => nodeObject( new GaussianBlurNode( nodeObject( node ).toTexture(), directionNode, sigma ) );
|
|
203
|
-
|
|
204
|
-
addNodeElement( 'gaussianBlur', gaussianBlur );
|
|
205
|
-
|
|
206
206
|
export default GaussianBlurNode;
|
|
207
207
|
|
|
208
|
+
GaussianBlurNode.type = /*@__PURE__*/ registerNode( 'GaussianBlur', GaussianBlurNode );
|
|
209
|
+
|
|
210
|
+
export const gaussianBlur = ( node, directionNode, sigma ) => nodeObject( new GaussianBlurNode( convertToTexture( node ), directionNode, sigma ) );
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { registerNode } from '../core/Node.js';
|
|
1
2
|
import TempNode from '../core/TempNode.js';
|
|
2
|
-
import {
|
|
3
|
+
import { Fn, nodeObject, vec3, vec4, float } from '../tsl/TSLBase.js';
|
|
3
4
|
import { uniform } from '../core/UniformNode.js';
|
|
4
5
|
import { mix } from '../math/MathNode.js';
|
|
5
6
|
|
|
@@ -22,7 +23,7 @@ class Lut3DNode extends TempNode {
|
|
|
22
23
|
|
|
23
24
|
const sampleLut = ( uv ) => lutNode.uv( uv );
|
|
24
25
|
|
|
25
|
-
const lut3D =
|
|
26
|
+
const lut3D = Fn( () => {
|
|
26
27
|
|
|
27
28
|
const base = inputNode;
|
|
28
29
|
|
|
@@ -46,8 +47,8 @@ class Lut3DNode extends TempNode {
|
|
|
46
47
|
|
|
47
48
|
}
|
|
48
49
|
|
|
49
|
-
export
|
|
50
|
+
export default Lut3DNode;
|
|
50
51
|
|
|
51
|
-
|
|
52
|
+
Lut3DNode.type = /*@__PURE__*/ registerNode( 'Lut3D', Lut3DNode );
|
|
52
53
|
|
|
53
|
-
export
|
|
54
|
+
export const lut3D = ( node, lut, size, intensity ) => nodeObject( new Lut3DNode( nodeObject( node ), nodeObject( lut ), size, nodeObject( intensity ) ) );
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { float, int, Fn } from '../tsl/TSLBase.js';
|
|
2
|
+
import { Loop } from '../utils/LoopNode.js';
|
|
3
|
+
import { uv } from '../accessors/UV.js';
|
|
4
|
+
|
|
5
|
+
export const motionBlur = /*@__PURE__*/ Fn( ( [ inputNode, velocity, numSamples = int( 16 ) ] ) => {
|
|
6
|
+
|
|
7
|
+
const sampleColor = ( uv ) => inputNode.uv( uv );
|
|
8
|
+
|
|
9
|
+
const uvs = uv();
|
|
10
|
+
|
|
11
|
+
const colorResult = sampleColor( uvs ).toVar();
|
|
12
|
+
const fSamples = float( numSamples );
|
|
13
|
+
|
|
14
|
+
Loop( { start: int( 1 ), end: numSamples, type: 'int', condition: '<=' }, ( { i } ) => {
|
|
15
|
+
|
|
16
|
+
const offset = velocity.mul( float( i ).div( fSamples.sub( 1 ) ).sub( 0.5 ) );
|
|
17
|
+
colorResult.addAssign( sampleColor( uvs.add( offset ) ) );
|
|
18
|
+
|
|
19
|
+
} );
|
|
20
|
+
|
|
21
|
+
colorResult.divAssign( fSamples );
|
|
22
|
+
|
|
23
|
+
return colorResult;
|
|
24
|
+
|
|
25
|
+
} );
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
+
import { registerNode } from '../core/Node.js';
|
|
1
2
|
import TempNode from '../core/TempNode.js';
|
|
2
3
|
import { add } from '../math/OperatorNode.js';
|
|
3
4
|
|
|
4
5
|
import { modelNormalMatrix } from '../accessors/ModelNode.js';
|
|
5
|
-
import { normalView } from '../accessors/
|
|
6
|
-
import { positionView } from '../accessors/
|
|
6
|
+
import { normalView } from '../accessors/Normal.js';
|
|
7
|
+
import { positionView } from '../accessors/Position.js';
|
|
7
8
|
import { TBNViewMatrix } from '../accessors/AccessorsUtils.js';
|
|
8
|
-
import { uv } from '../accessors/
|
|
9
|
+
import { uv } from '../accessors/UV.js';
|
|
9
10
|
import { faceDirection } from './FrontFacingNode.js';
|
|
10
|
-
import {
|
|
11
|
-
import { addNodeElement, tslFn, nodeProxy, vec3 } from '../shadernode/ShaderNode.js';
|
|
11
|
+
import { Fn, nodeProxy, vec3 } from '../tsl/TSLBase.js';
|
|
12
12
|
|
|
13
13
|
import { TangentSpaceNormalMap, ObjectSpaceNormalMap } from '../../constants.js';
|
|
14
14
|
|
|
15
15
|
// Normal Mapping Without Precomputed Tangents
|
|
16
16
|
// http://www.thetenthplanet.de/archives/1180
|
|
17
17
|
|
|
18
|
-
const perturbNormal2Arb =
|
|
18
|
+
const perturbNormal2Arb = /*@__PURE__*/ Fn( ( inputs ) => {
|
|
19
19
|
|
|
20
20
|
const { eye_pos, surf_norm, mapN, uv } = inputs;
|
|
21
21
|
|
|
@@ -99,8 +99,6 @@ class NormalMapNode extends TempNode {
|
|
|
99
99
|
|
|
100
100
|
export default NormalMapNode;
|
|
101
101
|
|
|
102
|
-
|
|
102
|
+
NormalMapNode.type = /*@__PURE__*/ registerNode( 'NormalMap', NormalMapNode );
|
|
103
103
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
addNodeClass( 'NormalMapNode', NormalMapNode );
|
|
104
|
+
export const normalMap = /*@__PURE__*/ nodeProxy( NormalMapNode );
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { registerNode } from '../core/Node.js';
|
|
2
|
+
import { Fn, If, nodeObject, vec4 } from '../tsl/TSLBase.js';
|
|
3
|
+
import { uv } from '../accessors/UV.js';
|
|
4
|
+
import { mod } from '../math/MathNode.js';
|
|
5
|
+
import { viewportCoordinate } from './ViewportNode.js';
|
|
6
|
+
import StereoCompositePassNode from './StereoCompositePassNode.js';
|
|
7
|
+
import NodeMaterial from '../../materials/nodes/NodeMaterial.js';
|
|
8
|
+
|
|
9
|
+
class ParallaxBarrierPassNode extends StereoCompositePassNode {
|
|
10
|
+
|
|
11
|
+
constructor( scene, camera ) {
|
|
12
|
+
|
|
13
|
+
super( scene, camera );
|
|
14
|
+
|
|
15
|
+
this.isParallaxBarrierPassNode = true;
|
|
16
|
+
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
setup( builder ) {
|
|
20
|
+
|
|
21
|
+
const uvNode = uv();
|
|
22
|
+
|
|
23
|
+
const parallaxBarrier = Fn( () => {
|
|
24
|
+
|
|
25
|
+
const color = vec4().toVar();
|
|
26
|
+
|
|
27
|
+
If( mod( viewportCoordinate.y, 2 ).greaterThan( 1 ), () => {
|
|
28
|
+
|
|
29
|
+
color.assign( this._mapLeft.uv( uvNode ) );
|
|
30
|
+
|
|
31
|
+
} ).Else( () => {
|
|
32
|
+
|
|
33
|
+
color.assign( this._mapRight.uv( uvNode ) );
|
|
34
|
+
|
|
35
|
+
} );
|
|
36
|
+
|
|
37
|
+
return color;
|
|
38
|
+
|
|
39
|
+
} );
|
|
40
|
+
|
|
41
|
+
const material = this._material || ( this._material = new NodeMaterial() );
|
|
42
|
+
material.fragmentNode = parallaxBarrier().context( builder.getSharedContext() );
|
|
43
|
+
material.needsUpdate = true;
|
|
44
|
+
|
|
45
|
+
return super.setup( builder );
|
|
46
|
+
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export default ParallaxBarrierPassNode;
|
|
52
|
+
|
|
53
|
+
ParallaxBarrierPassNode.type = /*@__PURE__*/ registerNode( 'ParallaxBarrierPass', ParallaxBarrierPassNode );
|
|
54
|
+
|
|
55
|
+
export const parallaxBarrierPass = ( scene, camera ) => nodeObject( new ParallaxBarrierPassNode( scene, camera ) );
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { registerNode } from '../core/Node.js';
|
|
2
2
|
import TempNode from '../core/TempNode.js';
|
|
3
3
|
import { default as TextureNode/*, texture*/ } from '../accessors/TextureNode.js';
|
|
4
4
|
import { NodeUpdateType } from '../core/constants.js';
|
|
5
|
-
import { nodeObject } from '../
|
|
5
|
+
import { nodeObject } from '../tsl/TSLBase.js';
|
|
6
6
|
import { uniform } from '../core/UniformNode.js';
|
|
7
7
|
import { viewZToOrthographicDepth, perspectiveDepthToViewZ } from './ViewportDepthNode.js';
|
|
8
8
|
|
|
@@ -27,7 +27,7 @@ class PassTextureNode extends TextureNode {
|
|
|
27
27
|
|
|
28
28
|
setup( builder ) {
|
|
29
29
|
|
|
30
|
-
this.passNode.build( builder );
|
|
30
|
+
if ( builder.object.isQuadMesh ) this.passNode.build( builder );
|
|
31
31
|
|
|
32
32
|
return super.setup( builder );
|
|
33
33
|
|
|
@@ -41,19 +41,28 @@ class PassTextureNode extends TextureNode {
|
|
|
41
41
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
PassTextureNode.type = /*@__PURE__*/ registerNode( 'PassTexture', PassTextureNode );
|
|
45
|
+
|
|
44
46
|
class PassMultipleTextureNode extends PassTextureNode {
|
|
45
47
|
|
|
46
|
-
constructor( passNode, textureName ) {
|
|
48
|
+
constructor( passNode, textureName, previousTexture = false ) {
|
|
47
49
|
|
|
48
50
|
super( passNode, null );
|
|
49
51
|
|
|
50
52
|
this.textureName = textureName;
|
|
53
|
+
this.previousTexture = previousTexture;
|
|
54
|
+
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
updateTexture() {
|
|
58
|
+
|
|
59
|
+
this.value = this.previousTexture ? this.passNode.getPreviousTexture( this.textureName ) : this.passNode.getTexture( this.textureName );
|
|
51
60
|
|
|
52
61
|
}
|
|
53
62
|
|
|
54
63
|
setup( builder ) {
|
|
55
64
|
|
|
56
|
-
this.
|
|
65
|
+
this.updateTexture();
|
|
57
66
|
|
|
58
67
|
return super.setup( builder );
|
|
59
68
|
|
|
@@ -61,12 +70,14 @@ class PassMultipleTextureNode extends PassTextureNode {
|
|
|
61
70
|
|
|
62
71
|
clone() {
|
|
63
72
|
|
|
64
|
-
return new this.constructor( this.passNode, this.textureName );
|
|
73
|
+
return new this.constructor( this.passNode, this.textureName, this.previousTexture );
|
|
65
74
|
|
|
66
75
|
}
|
|
67
76
|
|
|
68
77
|
}
|
|
69
78
|
|
|
79
|
+
PassMultipleTextureNode.type = /*@__PURE__*/ registerNode( 'PassMultipleTexture', PassMultipleTextureNode );
|
|
80
|
+
|
|
70
81
|
class PassNode extends TempNode {
|
|
71
82
|
|
|
72
83
|
constructor( scope, scene, camera, options = {} ) {
|
|
@@ -104,6 +115,9 @@ class PassNode extends TempNode {
|
|
|
104
115
|
this._linearDepthNodes = {};
|
|
105
116
|
this._viewZNodes = {};
|
|
106
117
|
|
|
118
|
+
this._previousTextures = {};
|
|
119
|
+
this._previousTextureNodes = {};
|
|
120
|
+
|
|
107
121
|
this._cameraNear = uniform( 0 );
|
|
108
122
|
this._cameraFar = uniform( 0 );
|
|
109
123
|
|
|
@@ -155,6 +169,44 @@ class PassNode extends TempNode {
|
|
|
155
169
|
|
|
156
170
|
}
|
|
157
171
|
|
|
172
|
+
getPreviousTexture( name ) {
|
|
173
|
+
|
|
174
|
+
let texture = this._previousTextures[ name ];
|
|
175
|
+
|
|
176
|
+
if ( texture === undefined ) {
|
|
177
|
+
|
|
178
|
+
texture = this.getTexture( name ).clone();
|
|
179
|
+
texture.isRenderTargetTexture = true;
|
|
180
|
+
|
|
181
|
+
this._previousTextures[ name ] = texture;
|
|
182
|
+
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
return texture;
|
|
186
|
+
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
toggleTexture( name ) {
|
|
190
|
+
|
|
191
|
+
const prevTexture = this._previousTextures[ name ];
|
|
192
|
+
|
|
193
|
+
if ( prevTexture !== undefined ) {
|
|
194
|
+
|
|
195
|
+
const texture = this._textures[ name ];
|
|
196
|
+
|
|
197
|
+
const index = this.renderTarget.textures.indexOf( texture );
|
|
198
|
+
this.renderTarget.textures[ index ] = prevTexture;
|
|
199
|
+
|
|
200
|
+
this._textures[ name ] = prevTexture;
|
|
201
|
+
this._previousTextures[ name ] = texture;
|
|
202
|
+
|
|
203
|
+
this._textureNodes[ name ].updateTexture();
|
|
204
|
+
this._previousTextureNodes[ name ].updateTexture();
|
|
205
|
+
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
}
|
|
209
|
+
|
|
158
210
|
getTextureNode( name = 'output' ) {
|
|
159
211
|
|
|
160
212
|
let textureNode = this._textureNodes[ name ];
|
|
@@ -162,6 +214,24 @@ class PassNode extends TempNode {
|
|
|
162
214
|
if ( textureNode === undefined ) {
|
|
163
215
|
|
|
164
216
|
this._textureNodes[ name ] = textureNode = nodeObject( new PassMultipleTextureNode( this, name ) );
|
|
217
|
+
this._textureNodes[ name ].updateTexture();
|
|
218
|
+
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
return textureNode;
|
|
222
|
+
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
getPreviousTextureNode( name = 'output' ) {
|
|
226
|
+
|
|
227
|
+
let textureNode = this._previousTextureNodes[ name ];
|
|
228
|
+
|
|
229
|
+
if ( textureNode === undefined ) {
|
|
230
|
+
|
|
231
|
+
if ( this._textureNodes[ name ] === undefined ) this.getTextureNode( name );
|
|
232
|
+
|
|
233
|
+
this._previousTextureNodes[ name ] = textureNode = nodeObject( new PassMultipleTextureNode( this, name, true ) );
|
|
234
|
+
this._previousTextureNodes[ name ].updateTexture();
|
|
165
235
|
|
|
166
236
|
}
|
|
167
237
|
|
|
@@ -240,6 +310,12 @@ class PassNode extends TempNode {
|
|
|
240
310
|
this._cameraNear.value = camera.near;
|
|
241
311
|
this._cameraFar.value = camera.far;
|
|
242
312
|
|
|
313
|
+
for ( const name in this._previousTextures ) {
|
|
314
|
+
|
|
315
|
+
this.toggleTexture( name );
|
|
316
|
+
|
|
317
|
+
}
|
|
318
|
+
|
|
243
319
|
renderer.setRenderTarget( this.renderTarget );
|
|
244
320
|
renderer.setMRT( this._mrt );
|
|
245
321
|
|
|
@@ -284,8 +360,8 @@ PassNode.DEPTH = 'depth';
|
|
|
284
360
|
|
|
285
361
|
export default PassNode;
|
|
286
362
|
|
|
363
|
+
PassNode.type = /*@__PURE__*/ registerNode( 'Pass', PassNode );
|
|
364
|
+
|
|
287
365
|
export const pass = ( scene, camera, options ) => nodeObject( new PassNode( PassNode.COLOR, scene, camera, options ) );
|
|
288
366
|
export const passTexture = ( pass, texture ) => nodeObject( new PassTextureNode( pass, texture ) );
|
|
289
367
|
export const depthPass = ( scene, camera ) => nodeObject( new PassNode( PassNode.DEPTH, scene, camera ) );
|
|
290
|
-
|
|
291
|
-
addNodeClass( 'PassNode', PassNode );
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { registerNode } from '../core/Node.js';
|
|
1
2
|
import TempNode from '../core/TempNode.js';
|
|
2
|
-
import { uv } from '../accessors/
|
|
3
|
-
import {
|
|
3
|
+
import { uv } from '../accessors/UV.js';
|
|
4
|
+
import { Fn, nodeObject, vec2, vec3, float, If } from '../tsl/TSLBase.js';
|
|
4
5
|
import { NodeUpdateType } from '../core/constants.js';
|
|
5
6
|
import { uniform } from '../core/UniformNode.js';
|
|
6
7
|
import { dot, clamp, smoothstep, sign, step, floor } from '../math/MathNode.js';
|
|
@@ -8,7 +9,9 @@ import { Vector4 } from '../../math/Vector4.js';
|
|
|
8
9
|
import { output, property } from '../core/PropertyNode.js';
|
|
9
10
|
import PassNode from './PassNode.js';
|
|
10
11
|
import { mrt } from '../core/MRTNode.js';
|
|
11
|
-
import { normalView } from '../accessors/
|
|
12
|
+
import { normalView } from '../accessors/Normal.js';
|
|
13
|
+
import { convertToTexture } from '../utils/RTTNode.js';
|
|
14
|
+
|
|
12
15
|
import { NearestFilter } from '../../constants.js';
|
|
13
16
|
|
|
14
17
|
class PixelationNode extends TempNode {
|
|
@@ -106,7 +109,7 @@ class PixelationNode extends TempNode {
|
|
|
106
109
|
|
|
107
110
|
};
|
|
108
111
|
|
|
109
|
-
const pixelation =
|
|
112
|
+
const pixelation = Fn( () => {
|
|
110
113
|
|
|
111
114
|
const texel = sampleTexture();
|
|
112
115
|
|
|
@@ -136,7 +139,7 @@ class PixelationNode extends TempNode {
|
|
|
136
139
|
|
|
137
140
|
} );
|
|
138
141
|
|
|
139
|
-
const strength = dei.greaterThan( 0 ).
|
|
142
|
+
const strength = dei.greaterThan( 0 ).select( float( 1.0 ).sub( dei.mul( this.depthEdgeStrength ) ), nei.mul( this.normalEdgeStrength ).add( 1 ) );
|
|
140
143
|
|
|
141
144
|
return texel.mul( strength );
|
|
142
145
|
|
|
@@ -150,9 +153,9 @@ class PixelationNode extends TempNode {
|
|
|
150
153
|
|
|
151
154
|
}
|
|
152
155
|
|
|
153
|
-
|
|
156
|
+
PixelationNode.type = /*@__PURE__*/ registerNode( 'Pixelation', PixelationNode );
|
|
154
157
|
|
|
155
|
-
|
|
158
|
+
const pixelation = ( node, depthNode, normalNode, pixelSize = 6, normalEdgeStrength = 0.3, depthEdgeStrength = 0.4 ) => nodeObject( new PixelationNode( convertToTexture( node ), convertToTexture( depthNode ), convertToTexture( normalNode ), nodeObject( pixelSize ), nodeObject( normalEdgeStrength ), nodeObject( depthEdgeStrength ) ) );
|
|
156
159
|
|
|
157
160
|
class PixelationPassNode extends PassNode {
|
|
158
161
|
|
|
@@ -199,3 +202,5 @@ class PixelationPassNode extends PassNode {
|
|
|
199
202
|
export const pixelationPass = ( scene, camera, pixelSize, normalEdgeStrength, depthEdgeStrength ) => nodeObject( new PixelationPassNode( scene, camera, pixelSize, normalEdgeStrength, depthEdgeStrength ) );
|
|
200
203
|
|
|
201
204
|
export default PixelationPassNode;
|
|
205
|
+
|
|
206
|
+
PixelationPassNode.type = /*@__PURE__*/ registerNode( 'PixelationPass', PixelationPassNode );
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { registerNode } from '../core/Node.js';
|
|
1
2
|
import TempNode from '../core/TempNode.js';
|
|
2
|
-
import {
|
|
3
|
-
import { addNodeElement, nodeProxy } from '../shadernode/ShaderNode.js';
|
|
3
|
+
import { nodeProxy } from '../tsl/TSLBase.js';
|
|
4
4
|
|
|
5
5
|
class PosterizeNode extends TempNode {
|
|
6
6
|
|
|
@@ -25,8 +25,6 @@ class PosterizeNode extends TempNode {
|
|
|
25
25
|
|
|
26
26
|
export default PosterizeNode;
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
PosterizeNode.type = /*@__PURE__*/ registerNode( 'Posterize', PosterizeNode );
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
addNodeClass( 'PosterizeNode', PosterizeNode );
|
|
30
|
+
export const posterize = /*@__PURE__*/ nodeProxy( PosterizeNode );
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { registerNode } from '../core/Node.js';
|
|
1
2
|
import TempNode from '../core/TempNode.js';
|
|
2
|
-
import { nodeObject,
|
|
3
|
+
import { nodeObject, Fn, vec2, vec4 } from '../tsl/TSLBase.js';
|
|
3
4
|
import { uniform } from '../core/UniformNode.js';
|
|
4
|
-
import { uv } from '../accessors/
|
|
5
|
+
import { uv } from '../accessors/UV.js';
|
|
5
6
|
import { sin, cos } from '../math/MathNode.js';
|
|
7
|
+
import { convertToTexture } from '../utils/RTTNode.js';
|
|
6
8
|
|
|
7
9
|
class RGBShiftNode extends TempNode {
|
|
8
10
|
|
|
@@ -24,7 +26,7 @@ class RGBShiftNode extends TempNode {
|
|
|
24
26
|
|
|
25
27
|
const sampleTexture = ( uv ) => textureNode.uv( uv );
|
|
26
28
|
|
|
27
|
-
const rgbShift =
|
|
29
|
+
const rgbShift = Fn( () => {
|
|
28
30
|
|
|
29
31
|
const offset = vec2( cos( this.angle ), sin( this.angle ) ).mul( this.amount );
|
|
30
32
|
const cr = sampleTexture( uvNode.add( offset ) );
|
|
@@ -41,9 +43,8 @@ class RGBShiftNode extends TempNode {
|
|
|
41
43
|
|
|
42
44
|
}
|
|
43
45
|
|
|
44
|
-
export const rgbShift = ( node, amount, angle ) => nodeObject( new RGBShiftNode( nodeObject( node ).toTexture(), amount, angle ) );
|
|
45
|
-
|
|
46
|
-
addNodeElement( 'rgbShift', rgbShift );
|
|
47
|
-
|
|
48
46
|
export default RGBShiftNode;
|
|
49
47
|
|
|
48
|
+
RGBShiftNode.type = /*@__PURE__*/ registerNode( 'RGBShift', RGBShiftNode );
|
|
49
|
+
|
|
50
|
+
export const rgbShift = ( node, amount, angle ) => nodeObject( new RGBShiftNode( convertToTexture( node ), amount, angle ) );
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { registerNode } from '../core/Node.js';
|
|
1
2
|
import TempNode from '../core/TempNode.js';
|
|
2
|
-
import {
|
|
3
|
-
import { addNodeElement, nodeObject } from '../shadernode/ShaderNode.js';
|
|
3
|
+
import { addMethodChaining, nodeObject } from '../tsl/TSLCore.js';
|
|
4
4
|
|
|
5
|
-
import { SRGBColorSpace, NoToneMapping } from '../../constants.js';
|
|
5
|
+
import { LinearSRGBColorSpace, SRGBColorSpace, NoToneMapping } from '../../constants.js';
|
|
6
6
|
|
|
7
7
|
class RenderOutputNode extends TempNode {
|
|
8
8
|
|
|
@@ -24,8 +24,8 @@ class RenderOutputNode extends TempNode {
|
|
|
24
24
|
|
|
25
25
|
// tone mapping
|
|
26
26
|
|
|
27
|
-
const toneMapping = this.toneMapping !== null ? this.toneMapping : context.toneMapping;
|
|
28
|
-
const outputColorSpace = this.outputColorSpace !== null ? this.outputColorSpace : context.outputColorSpace;
|
|
27
|
+
const toneMapping = ( this.toneMapping !== null ? this.toneMapping : context.toneMapping ) || NoToneMapping;
|
|
28
|
+
const outputColorSpace = ( this.outputColorSpace !== null ? this.outputColorSpace : context.outputColorSpace ) || LinearSRGBColorSpace;
|
|
29
29
|
|
|
30
30
|
if ( toneMapping !== NoToneMapping ) {
|
|
31
31
|
|
|
@@ -37,7 +37,7 @@ class RenderOutputNode extends TempNode {
|
|
|
37
37
|
|
|
38
38
|
if ( outputColorSpace === SRGBColorSpace ) {
|
|
39
39
|
|
|
40
|
-
outputNode = outputNode.
|
|
40
|
+
outputNode = outputNode.toOutputColorSpace( outputColorSpace );
|
|
41
41
|
|
|
42
42
|
}
|
|
43
43
|
|
|
@@ -49,8 +49,8 @@ class RenderOutputNode extends TempNode {
|
|
|
49
49
|
|
|
50
50
|
export default RenderOutputNode;
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
RenderOutputNode.type = /*@__PURE__*/ registerNode( 'RenderOutput', RenderOutputNode );
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
export const renderOutput = ( color, toneMapping = null, outputColorSpace = null ) => nodeObject( new RenderOutputNode( nodeObject( color ), toneMapping, outputColorSpace ) );
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
addMethodChaining( 'renderOutput', renderOutput );
|