super-three 0.169.1 → 0.170.1
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 +24628 -24228
- package/build/three.core.js +37002 -0
- package/build/three.core.min.js +6 -0
- package/build/three.module.js +10519 -47108
- package/build/three.module.min.js +1 -1
- package/build/three.tsl.js +533 -0
- package/build/three.tsl.min.js +6 -0
- package/build/three.webgpu.js +17071 -53583
- package/build/three.webgpu.min.js +1 -1
- package/build/three.webgpu.nodes.js +17134 -53623
- package/build/three.webgpu.nodes.min.js +1 -1
- package/examples/jsm/Addons.js +3 -3
- package/examples/jsm/animation/MMDAnimationHelper.js +2 -0
- package/examples/jsm/animation/MMDPhysics.js +2 -0
- package/examples/jsm/capabilities/WebGPU.js +1 -10
- package/examples/jsm/controls/ArcballControls.js +25 -21
- package/examples/jsm/controls/OrbitControls.js +41 -9
- package/examples/jsm/controls/PointerLockControls.js +2 -5
- package/examples/jsm/controls/TransformControls.js +22 -6
- package/examples/jsm/csm/CSM.js +2 -2
- package/examples/jsm/csm/CSMFrustum.js +7 -4
- package/examples/jsm/csm/CSMHelper.js +2 -0
- package/examples/jsm/csm/CSMShadowNode.js +437 -0
- package/examples/jsm/curves/NURBSCurve.js +34 -3
- package/examples/jsm/exporters/GLTFExporter.js +138 -71
- package/examples/jsm/exporters/KTX2Exporter.js +35 -12
- package/examples/jsm/exporters/MMDExporter.js +6 -0
- package/examples/jsm/exporters/USDZExporter.js +21 -3
- package/examples/jsm/geometries/DecalGeometry.js +70 -21
- package/examples/jsm/geometries/InstancedPointsGeometry.js +2 -0
- package/examples/jsm/helpers/TextureHelperGPU.js +175 -0
- package/examples/jsm/interactive/HTMLMesh.js +1 -0
- package/examples/jsm/lighting/TiledLighting.js +18 -0
- package/examples/jsm/lights/RectAreaLightTexturesLib.js +1 -1
- package/examples/jsm/lines/LineGeometry.js +25 -0
- package/examples/jsm/lines/LineMaterial.js +0 -1
- package/examples/jsm/lines/LineSegmentsGeometry.js +2 -0
- package/examples/jsm/lines/webgpu/Line2.js +2 -1
- package/examples/jsm/lines/webgpu/LineSegments2.js +2 -16
- package/examples/jsm/lines/webgpu/Wireframe.js +57 -0
- package/examples/jsm/loaders/3DMLoader.js +1 -0
- package/examples/jsm/loaders/3MFLoader.js +91 -0
- package/examples/jsm/loaders/FBXLoader.js +12 -2
- package/examples/jsm/loaders/GLTFLoader.js +2 -0
- package/examples/jsm/loaders/KTX2Loader.js +143 -49
- package/examples/jsm/loaders/LDrawLoader.js +22 -136
- package/examples/jsm/loaders/LottieLoader.js +1 -0
- package/examples/jsm/loaders/MMDLoader.js +3 -0
- package/examples/jsm/loaders/MaterialXLoader.js +2 -2
- package/examples/jsm/materials/LDrawConditionalLineMaterial.js +143 -0
- package/examples/jsm/materials/LDrawConditionalLineNodeMaterial.js +114 -0
- package/examples/jsm/math/ColorSpaces.js +76 -0
- package/examples/jsm/misc/ProgressiveLightMap.js +52 -40
- package/examples/jsm/misc/ProgressiveLightMapGPU.js +293 -0
- package/examples/jsm/misc/VolumeSlice.js +1 -0
- package/examples/jsm/objects/InstancedPoints.js +2 -4
- package/examples/jsm/objects/LensflareMesh.js +4 -2
- package/examples/jsm/objects/SkyMesh.js +5 -3
- package/examples/jsm/objects/Water2Mesh.js +7 -3
- package/examples/jsm/objects/WaterMesh.js +12 -10
- package/examples/jsm/postprocessing/AfterimagePass.js +14 -3
- package/examples/jsm/postprocessing/SSRPass.js +6 -0
- package/examples/jsm/renderers/CSS2DRenderer.js +6 -3
- package/examples/jsm/renderers/CSS3DRenderer.js +7 -4
- package/examples/jsm/shaders/FXAAShader.js +225 -224
- package/examples/jsm/transpiler/AST.js +2 -2
- package/examples/jsm/transpiler/GLSLDecoder.js +57 -25
- package/examples/jsm/transpiler/ShaderToyDecoder.js +1 -1
- package/examples/jsm/transpiler/TSLEncoder.js +11 -6
- package/{src/nodes → examples/jsm/tsl}/display/AfterImageNode.js +18 -21
- package/{src/nodes → examples/jsm/tsl}/display/AnaglyphPassNode.js +2 -6
- package/{src/nodes → examples/jsm/tsl}/display/AnamorphicNode.js +12 -18
- package/{src/nodes → examples/jsm/tsl}/display/BleachBypass.js +1 -3
- package/{src/nodes → examples/jsm/tsl}/display/BloomNode.js +12 -41
- package/{src/nodes → examples/jsm/tsl}/display/DenoiseNode.js +60 -47
- package/{src/nodes → examples/jsm/tsl}/display/DepthOfFieldNode.js +4 -9
- package/{src/nodes → examples/jsm/tsl}/display/DotScreenNode.js +2 -9
- package/examples/jsm/tsl/display/FXAANode.js +316 -0
- package/{src/nodes → examples/jsm/tsl}/display/FilmNode.js +4 -7
- package/{src/nodes → examples/jsm/tsl}/display/GTAONode.js +73 -78
- package/{src/nodes → examples/jsm/tsl}/display/GaussianBlurNode.js +78 -42
- package/examples/jsm/tsl/display/LensflareNode.js +161 -0
- package/{src/nodes → examples/jsm/tsl}/display/Lut3DNode.js +3 -5
- package/{src/nodes → examples/jsm/tsl}/display/MotionBlur.js +2 -3
- package/examples/jsm/tsl/display/OutlineNode.js +434 -0
- package/{src/nodes → examples/jsm/tsl}/display/ParallaxBarrierPassNode.js +2 -5
- package/{src/nodes → examples/jsm/tsl}/display/PixelationPassNode.js +5 -17
- package/{src/nodes → examples/jsm/tsl}/display/RGBShiftNode.js +2 -6
- package/examples/jsm/tsl/display/SMAANode.js +620 -0
- package/{src/nodes → examples/jsm/tsl}/display/SSAAPassNode.js +10 -25
- package/examples/jsm/tsl/display/SSRNode.js +366 -0
- package/{src/nodes → examples/jsm/tsl}/display/Sepia.js +1 -2
- package/{src/nodes → examples/jsm/tsl}/display/SobelOperatorNode.js +4 -12
- package/{src/nodes → examples/jsm/tsl}/display/StereoCompositePassNode.js +9 -11
- package/{src/nodes → examples/jsm/tsl}/display/StereoPassNode.js +10 -11
- package/examples/jsm/tsl/display/TRAAPassNode.js +355 -0
- package/{src/nodes → examples/jsm/tsl}/display/TransitionNode.js +3 -7
- package/examples/jsm/tsl/display/hashBlur.js +24 -0
- package/examples/jsm/tsl/lighting/TiledLightsNode.js +389 -0
- package/examples/jsm/utils/SceneOptimizer.js +410 -0
- package/examples/jsm/utils/UVsDebug.js +1 -1
- package/examples/jsm/utils/{TextureUtilsGPU.js → WebGPUTextureUtils.js} +2 -1
- package/examples/jsm/webxr/OculusHandPointerModel.js +21 -21
- package/examples/jsm/webxr/Text2D.js +6 -6
- package/package.json +4 -4
- package/src/Three.Core.js +178 -0
- package/src/Three.TSL.js +526 -0
- package/src/Three.WebGPU.Nodes.js +9 -186
- package/src/Three.WebGPU.js +8 -186
- package/src/Three.js +1 -177
- package/src/animation/AnimationClip.js +2 -2
- package/src/animation/AnimationObjectGroup.js +2 -2
- package/src/audio/Audio.js +38 -0
- package/src/cameras/PerspectiveCamera.js +6 -6
- package/src/cameras/StereoCamera.js +2 -2
- package/src/constants.js +1 -6
- package/src/core/BufferGeometry.js +48 -8
- package/src/core/InterleavedBuffer.js +4 -4
- package/src/core/Object3D.js +2 -2
- package/src/extras/core/Curve.js +3 -3
- package/src/extras/core/Shape.js +2 -2
- package/src/geometries/CylinderGeometry.js +2 -2
- package/src/geometries/EdgesGeometry.js +2 -2
- package/src/geometries/LatheGeometry.js +2 -2
- package/src/lights/SpotLightShadow.js +2 -2
- package/src/materials/LineDashedMaterial.js +0 -1
- package/src/materials/Material.js +2 -2
- package/src/materials/MeshPhongMaterial.js +1 -1
- package/src/materials/MeshPhysicalMaterial.js +2 -2
- package/src/materials/MeshStandardMaterial.js +2 -2
- package/src/materials/nodes/Line2NodeMaterial.js +32 -13
- package/src/materials/nodes/LineDashedNodeMaterial.js +4 -2
- package/src/materials/nodes/NodeMaterial.js +93 -23
- package/src/materials/nodes/SpriteNodeMaterial.js +11 -2
- package/src/materials/nodes/manager/NodeMaterialObserver.js +119 -7
- package/src/math/ColorManagement.js +143 -102
- package/src/math/Line3.js +2 -2
- package/src/math/Quaternion.js +2 -2
- package/src/math/Spherical.js +3 -3
- package/src/math/Vector2.js +7 -7
- package/src/math/Vector3.js +9 -9
- package/src/math/Vector4.js +22 -9
- package/src/nodes/Nodes.js +2 -21
- package/src/nodes/TSL.js +9 -25
- package/src/nodes/accessors/Arrays.js +27 -0
- package/src/nodes/accessors/BuiltinNode.js +26 -0
- package/src/nodes/accessors/Camera.js +0 -1
- package/src/nodes/accessors/ClippingNode.js +76 -42
- package/src/nodes/accessors/InstanceNode.js +17 -20
- package/src/nodes/accessors/InstancedMeshNode.js +26 -0
- package/src/nodes/accessors/Lights.js +32 -0
- package/src/nodes/accessors/SceneNode.js +35 -1
- package/src/nodes/accessors/StorageBufferNode.js +61 -19
- package/src/nodes/accessors/StorageTextureNode.js +10 -4
- package/src/nodes/accessors/TextureNode.js +1 -1
- package/src/nodes/accessors/VelocityNode.js +13 -3
- package/src/nodes/code/FunctionCallNode.js +16 -5
- package/src/nodes/code/ScriptableNode.js +4 -4
- package/src/nodes/core/Node.js +1 -0
- package/src/nodes/core/NodeBuilder.js +31 -14
- package/src/nodes/core/NodeUtils.js +28 -0
- package/src/nodes/core/VarNode.js +15 -3
- package/src/nodes/core/constants.js +6 -0
- package/src/nodes/display/BlendModes.js +99 -0
- package/src/nodes/display/ColorAdjustment.js +53 -4
- package/src/nodes/display/ColorSpaceFunctions.js +5 -5
- package/src/nodes/display/ColorSpaceNode.js +27 -39
- package/src/nodes/display/PassNode.js +6 -4
- package/src/nodes/display/ToneMappingNode.js +1 -1
- package/src/nodes/display/ToonOutlinePassNode.js +3 -3
- package/src/nodes/display/ViewportDepthNode.js +48 -1
- package/src/nodes/functions/PhysicalLightingModel.js +21 -15
- package/src/nodes/functions/material/getAlphaHashThreshold.js +70 -0
- package/src/nodes/functions/material/getGeometryRoughness.js +8 -2
- package/src/nodes/functions/material/getParallaxCorrectNormal.js +22 -0
- package/src/nodes/gpgpu/ComputeNode.js +9 -1
- package/src/nodes/lighting/AnalyticLightNode.js +23 -419
- package/src/nodes/lighting/LightsNode.js +24 -12
- package/src/nodes/lighting/PointLightNode.js +41 -22
- package/src/nodes/lighting/PointShadowNode.js +254 -0
- package/src/nodes/lighting/RectAreaLightNode.js +3 -0
- package/src/nodes/lighting/ShadowNode.js +593 -0
- package/src/nodes/lighting/SpotLightNode.js +14 -2
- package/src/nodes/utils/LoopNode.js +2 -2
- package/src/nodes/utils/Oscillators.js +6 -0
- package/src/nodes/utils/PostProcessingUtils.js +89 -0
- package/src/nodes/utils/RTTNode.js +9 -1
- package/src/nodes/utils/ReflectorNode.js +101 -15
- package/src/nodes/utils/StorageArrayElementNode.js +2 -2
- package/src/nodes/utils/Timer.js +29 -0
- package/src/objects/BatchedMesh.js +472 -296
- package/src/objects/ClippingGroup.js +19 -0
- package/src/objects/Skeleton.js +2 -2
- package/src/renderers/WebGLRenderer.js +183 -109
- package/src/renderers/common/Animation.js +23 -11
- package/src/renderers/common/Attributes.js +4 -0
- package/src/renderers/common/Backend.js +2 -0
- package/src/renderers/common/Background.js +15 -5
- package/src/renderers/common/Bindings.js +23 -6
- package/src/renderers/common/ClippingContext.js +77 -85
- package/src/renderers/common/Constants.js +2 -1
- package/src/renderers/common/Geometries.js +20 -0
- package/src/renderers/common/IndirectStorageBufferAttribute.js +15 -0
- package/src/renderers/common/Lighting.js +45 -0
- package/src/renderers/common/PostProcessingUtils.js +86 -0
- package/src/renderers/common/RenderList.js +48 -17
- package/src/renderers/common/RenderLists.js +4 -2
- package/src/renderers/common/RenderObject.js +45 -28
- package/src/renderers/common/RenderObjects.js +12 -6
- package/src/renderers/common/Renderer.js +222 -77
- package/src/renderers/common/Textures.js +41 -17
- package/src/renderers/common/UniformsGroup.js +16 -4
- package/src/renderers/common/extras/PMREMGenerator.js +89 -13
- package/src/renderers/common/nodes/NodeLibrary.js +2 -15
- package/src/renderers/common/nodes/NodeStorageBuffer.js +2 -3
- package/src/renderers/common/nodes/NodeUniform.js +42 -0
- package/src/renderers/common/nodes/Nodes.js +2 -2
- package/src/renderers/shaders/ShaderChunk/colorspace_pars_fragment.glsl.js +4 -24
- package/src/renderers/shaders/ShaderChunk/emissivemap_fragment.glsl.js +8 -0
- package/src/renderers/shaders/ShaderChunk/map_fragment.glsl.js +2 -2
- package/src/renderers/webgl/WebGLBackground.js +20 -1
- package/src/renderers/webgl/WebGLBufferRenderer.js +2 -6
- package/src/renderers/webgl/WebGLCapabilities.js +0 -7
- package/src/renderers/webgl/WebGLGeometries.js +0 -28
- package/src/renderers/webgl/WebGLIndexedBufferRenderer.js +2 -6
- package/src/renderers/webgl/WebGLProgram.js +24 -28
- package/src/renderers/webgl/WebGLPrograms.js +5 -2
- package/src/renderers/webgl/WebGLState.js +37 -1
- package/src/renderers/webgl/WebGLTextures.js +29 -12
- package/src/renderers/webgl-fallback/WebGLBackend.js +111 -37
- package/src/renderers/webgl-fallback/WebGLBufferRenderer.js +2 -7
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +43 -12
- package/src/renderers/webgl-fallback/utils/WebGLState.js +26 -1
- package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +37 -9
- package/src/renderers/webgpu/WebGPUBackend.js +152 -56
- package/src/renderers/webgpu/WebGPURenderer.Nodes.js +1 -1
- package/src/renderers/webgpu/WebGPURenderer.js +1 -1
- package/src/renderers/webgpu/nodes/BasicNodeLibrary.js +0 -8
- package/src/renderers/webgpu/nodes/StandardNodeLibrary.js +13 -34
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +192 -92
- package/src/renderers/webgpu/nodes/WGSLNodeFunction.js +12 -4
- package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +15 -2
- package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +72 -7
- package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +29 -9
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +29 -7
- package/src/renderers/webgpu/utils/WebGPUUtils.js +0 -1
- package/src/renderers/webxr/WebXRManager.js +4 -4
- package/src/textures/Source.js +2 -2
- package/src/textures/Texture.js +2 -2
- package/examples/jsm/cameras/CinematicCamera.js +0 -208
- package/src/nodes/display/BlendMode.js +0 -54
- package/src/nodes/display/FXAANode.js +0 -332
- package/src/nodes/utils/OscNode.js +0 -85
- package/src/nodes/utils/TimerNode.js +0 -97
- /package/examples/jsm/utils/{TextureUtils.js → WebGLTextureUtils.js} +0 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import Node from '../core/Node.js';
|
|
2
|
+
import { nodeProxy } from '../tsl/TSLBase.js';
|
|
3
|
+
|
|
4
|
+
class BuiltinNode extends Node {
|
|
5
|
+
|
|
6
|
+
constructor( name ) {
|
|
7
|
+
|
|
8
|
+
super( 'float' );
|
|
9
|
+
|
|
10
|
+
this.name = name;
|
|
11
|
+
|
|
12
|
+
this.isBuiltinNode = true;
|
|
13
|
+
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
generate( /* builder */ ) {
|
|
17
|
+
|
|
18
|
+
return this.name;
|
|
19
|
+
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export default BuiltinNode;
|
|
25
|
+
|
|
26
|
+
export const builtin = nodeProxy( BuiltinNode );
|
|
@@ -4,7 +4,6 @@ import { Vector3 } from '../../math/Vector3.js';
|
|
|
4
4
|
|
|
5
5
|
export const cameraNear = /*@__PURE__*/ uniform( 'float' ).label( 'cameraNear' ).setGroup( renderGroup ).onRenderUpdate( ( { camera } ) => camera.near );
|
|
6
6
|
export const cameraFar = /*@__PURE__*/ uniform( 'float' ).label( 'cameraFar' ).setGroup( renderGroup ).onRenderUpdate( ( { camera } ) => camera.far );
|
|
7
|
-
export const cameraLogDepth = /*@__PURE__*/ uniform( 'float' ).label( 'cameraLogDepth' ).setGroup( renderGroup ).onRenderUpdate( ( { camera } ) => 2.0 / ( Math.log( camera.far + 1.0 ) / Math.LN2 ) );
|
|
8
7
|
export const cameraProjectionMatrix = /*@__PURE__*/ uniform( 'mat4' ).label( 'cameraProjectionMatrix' ).setGroup( renderGroup ).onRenderUpdate( ( { camera } ) => camera.projectionMatrix );
|
|
9
8
|
export const cameraProjectionMatrixInverse = /*@__PURE__*/ uniform( 'mat4' ).label( 'cameraProjectionMatrixInverse' ).setGroup( renderGroup ).onRenderUpdate( ( { camera } ) => camera.projectionMatrixInverse );
|
|
10
9
|
export const cameraViewMatrix = /*@__PURE__*/ uniform( 'mat4' ).label( 'cameraViewMatrix' ).setGroup( renderGroup ).onRenderUpdate( ( { camera } ) => camera.matrixWorldInverse );
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
|
|
2
2
|
import Node from '../core/Node.js';
|
|
3
|
-
import { nodeObject } from '../tsl/TSLBase.js';
|
|
3
|
+
import { nodeObject, Fn, bool, float } from '../tsl/TSLBase.js';
|
|
4
4
|
import { positionView } from './Position.js';
|
|
5
|
-
import { diffuseColor
|
|
6
|
-
import { Fn } from '../tsl/TSLBase.js';
|
|
5
|
+
import { diffuseColor } from '../core/PropertyNode.js';
|
|
7
6
|
import { Loop } from '../utils/LoopNode.js';
|
|
8
7
|
import { smoothstep } from '../math/MathNode.js';
|
|
9
8
|
import { uniformArray } from './UniformArrayNode.js';
|
|
9
|
+
import { builtin } from './BuiltinNode.js';
|
|
10
10
|
|
|
11
11
|
class ClippingNode extends Node {
|
|
12
12
|
|
|
@@ -29,69 +29,73 @@ class ClippingNode extends Node {
|
|
|
29
29
|
super.setup( builder );
|
|
30
30
|
|
|
31
31
|
const clippingContext = builder.clippingContext;
|
|
32
|
-
const {
|
|
32
|
+
const { intersectionPlanes, unionPlanes } = clippingContext;
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
const numUnionClippingPlanes = localClipIntersection ? numClippingPlanes - localClippingCount : numClippingPlanes;
|
|
34
|
+
this.hardwareClipping = builder.material.hardwareClipping;
|
|
36
35
|
|
|
37
36
|
if ( this.scope === ClippingNode.ALPHA_TO_COVERAGE ) {
|
|
38
37
|
|
|
39
|
-
return this.setupAlphaToCoverage(
|
|
38
|
+
return this.setupAlphaToCoverage( intersectionPlanes, unionPlanes );
|
|
39
|
+
|
|
40
|
+
} else if ( this.scope === ClippingNode.HARDWARE ) {
|
|
41
|
+
|
|
42
|
+
return this.setupHardwareClipping( unionPlanes, builder );
|
|
40
43
|
|
|
41
44
|
} else {
|
|
42
45
|
|
|
43
|
-
return this.setupDefault(
|
|
46
|
+
return this.setupDefault( intersectionPlanes, unionPlanes );
|
|
44
47
|
|
|
45
48
|
}
|
|
46
49
|
|
|
47
50
|
}
|
|
48
51
|
|
|
49
|
-
setupAlphaToCoverage(
|
|
52
|
+
setupAlphaToCoverage( intersectionPlanes, unionPlanes ) {
|
|
50
53
|
|
|
51
54
|
return Fn( () => {
|
|
52
55
|
|
|
53
|
-
const
|
|
56
|
+
const distanceToPlane = float().toVar( 'distanceToPlane' );
|
|
57
|
+
const distanceGradient = float().toVar( 'distanceToGradient' );
|
|
54
58
|
|
|
55
|
-
const
|
|
56
|
-
const distanceGradient = property( 'float', 'distanceToGradient' );
|
|
59
|
+
const clipOpacity = float( 1 ).toVar( 'clipOpacity' );
|
|
57
60
|
|
|
58
|
-
const
|
|
61
|
+
const numUnionPlanes = unionPlanes.length;
|
|
59
62
|
|
|
60
|
-
|
|
63
|
+
if ( ! this.hardwareClipping && numUnionPlanes > 0 ) {
|
|
61
64
|
|
|
62
|
-
|
|
65
|
+
const clippingPlanes = uniformArray( unionPlanes );
|
|
63
66
|
|
|
64
|
-
|
|
67
|
+
Loop( numUnionPlanes, ( { i } ) => {
|
|
65
68
|
|
|
66
|
-
|
|
69
|
+
const plane = clippingPlanes.element( i );
|
|
67
70
|
|
|
68
|
-
|
|
69
|
-
|
|
71
|
+
distanceToPlane.assign( positionView.dot( plane.xyz ).negate().add( plane.w ) );
|
|
72
|
+
distanceGradient.assign( distanceToPlane.fwidth().div( 2.0 ) );
|
|
70
73
|
|
|
71
|
-
|
|
74
|
+
clipOpacity.mulAssign( smoothstep( distanceGradient.negate(), distanceGradient, distanceToPlane ) );
|
|
72
75
|
|
|
73
|
-
|
|
76
|
+
} );
|
|
74
77
|
|
|
75
|
-
}
|
|
78
|
+
}
|
|
76
79
|
|
|
77
|
-
|
|
80
|
+
const numIntersectionPlanes = intersectionPlanes.length;
|
|
78
81
|
|
|
79
|
-
|
|
82
|
+
if ( numIntersectionPlanes > 0 ) {
|
|
80
83
|
|
|
81
|
-
|
|
84
|
+
const clippingPlanes = uniformArray( intersectionPlanes );
|
|
85
|
+
const intersectionClipOpacity = float( 1 ).toVar( 'intersectionClipOpacity' );
|
|
82
86
|
|
|
83
|
-
Loop(
|
|
87
|
+
Loop( numIntersectionPlanes, ( { i } ) => {
|
|
84
88
|
|
|
85
|
-
plane = clippingPlanes.element( i );
|
|
89
|
+
const plane = clippingPlanes.element( i );
|
|
86
90
|
|
|
87
91
|
distanceToPlane.assign( positionView.dot( plane.xyz ).negate().add( plane.w ) );
|
|
88
92
|
distanceGradient.assign( distanceToPlane.fwidth().div( 2.0 ) );
|
|
89
93
|
|
|
90
|
-
|
|
94
|
+
intersectionClipOpacity.mulAssign( smoothstep( distanceGradient.negate(), distanceGradient, distanceToPlane ).oneMinus() );
|
|
91
95
|
|
|
92
96
|
} );
|
|
93
97
|
|
|
94
|
-
clipOpacity.mulAssign(
|
|
98
|
+
clipOpacity.mulAssign( intersectionClipOpacity.oneMinus() );
|
|
95
99
|
|
|
96
100
|
}
|
|
97
101
|
|
|
@@ -103,30 +107,35 @@ class ClippingNode extends Node {
|
|
|
103
107
|
|
|
104
108
|
}
|
|
105
109
|
|
|
106
|
-
setupDefault(
|
|
110
|
+
setupDefault( intersectionPlanes, unionPlanes ) {
|
|
107
111
|
|
|
108
112
|
return Fn( () => {
|
|
109
113
|
|
|
110
|
-
const
|
|
114
|
+
const numUnionPlanes = unionPlanes.length;
|
|
111
115
|
|
|
112
|
-
|
|
116
|
+
if ( ! this.hardwareClipping && numUnionPlanes > 0 ) {
|
|
113
117
|
|
|
114
|
-
|
|
118
|
+
const clippingPlanes = uniformArray( unionPlanes );
|
|
115
119
|
|
|
116
|
-
|
|
117
|
-
positionView.dot( plane.xyz ).greaterThan( plane.w ).discard();
|
|
120
|
+
Loop( numUnionPlanes, ( { i } ) => {
|
|
118
121
|
|
|
119
|
-
|
|
122
|
+
const plane = clippingPlanes.element( i );
|
|
123
|
+
positionView.dot( plane.xyz ).greaterThan( plane.w ).discard();
|
|
124
|
+
|
|
125
|
+
} );
|
|
120
126
|
|
|
121
|
-
|
|
127
|
+
}
|
|
122
128
|
|
|
123
|
-
|
|
129
|
+
const numIntersectionPlanes = intersectionPlanes.length;
|
|
124
130
|
|
|
125
|
-
|
|
131
|
+
if ( numIntersectionPlanes > 0 ) {
|
|
126
132
|
|
|
127
|
-
|
|
133
|
+
const clippingPlanes = uniformArray( intersectionPlanes );
|
|
134
|
+
const clipped = bool( true ).toVar( 'clipped' );
|
|
128
135
|
|
|
129
|
-
|
|
136
|
+
Loop( numIntersectionPlanes, ( { i } ) => {
|
|
137
|
+
|
|
138
|
+
const plane = clippingPlanes.element( i );
|
|
130
139
|
clipped.assign( positionView.dot( plane.xyz ).greaterThan( plane.w ).and( clipped ) );
|
|
131
140
|
|
|
132
141
|
} );
|
|
@@ -139,13 +148,38 @@ class ClippingNode extends Node {
|
|
|
139
148
|
|
|
140
149
|
}
|
|
141
150
|
|
|
151
|
+
setupHardwareClipping( unionPlanes, builder ) {
|
|
152
|
+
|
|
153
|
+
const numUnionPlanes = unionPlanes.length;
|
|
154
|
+
|
|
155
|
+
builder.enableHardwareClipping( numUnionPlanes );
|
|
156
|
+
|
|
157
|
+
return Fn( () => {
|
|
158
|
+
|
|
159
|
+
const clippingPlanes = uniformArray( unionPlanes );
|
|
160
|
+
const hw_clip_distances = builtin( builder.getClipDistance() );
|
|
161
|
+
|
|
162
|
+
Loop( numUnionPlanes, ( { i } ) => {
|
|
163
|
+
|
|
164
|
+
const plane = clippingPlanes.element( i );
|
|
165
|
+
|
|
166
|
+
const distance = positionView.dot( plane.xyz ).sub( plane.w ).negate();
|
|
167
|
+
hw_clip_distances.element( i ).assign( distance );
|
|
168
|
+
|
|
169
|
+
} );
|
|
170
|
+
|
|
171
|
+
} )();
|
|
172
|
+
|
|
173
|
+
}
|
|
174
|
+
|
|
142
175
|
}
|
|
143
176
|
|
|
144
177
|
ClippingNode.ALPHA_TO_COVERAGE = 'alphaToCoverage';
|
|
145
178
|
ClippingNode.DEFAULT = 'default';
|
|
179
|
+
ClippingNode.HARDWARE = 'hardware';
|
|
146
180
|
|
|
147
181
|
export default ClippingNode;
|
|
148
182
|
|
|
149
183
|
export const clipping = () => nodeObject( new ClippingNode() );
|
|
150
|
-
|
|
151
184
|
export const clippingAlpha = () => nodeObject( new ClippingNode( ClippingNode.ALPHA_TO_COVERAGE ) );
|
|
185
|
+
export const hardwareClipping = () => nodeObject( new ClippingNode( ClippingNode.HARDWARE ) );
|
|
@@ -20,11 +20,13 @@ class InstanceNode extends Node {
|
|
|
20
20
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
constructor(
|
|
23
|
+
constructor( count, instanceMatrix, instanceColor ) {
|
|
24
24
|
|
|
25
25
|
super( 'void' );
|
|
26
26
|
|
|
27
|
-
this.
|
|
27
|
+
this.count = count;
|
|
28
|
+
this.instanceMatrix = instanceMatrix;
|
|
29
|
+
this.instanceColor = instanceColor;
|
|
28
30
|
|
|
29
31
|
this.instanceMatrixNode = null;
|
|
30
32
|
|
|
@@ -39,28 +41,25 @@ class InstanceNode extends Node {
|
|
|
39
41
|
|
|
40
42
|
setup( builder ) {
|
|
41
43
|
|
|
42
|
-
|
|
43
|
-
let instanceColorNode = this.instanceColorNode;
|
|
44
|
+
const { count, instanceMatrix, instanceColor } = this;
|
|
44
45
|
|
|
45
|
-
|
|
46
|
+
let { instanceMatrixNode, instanceColorNode } = this;
|
|
46
47
|
|
|
47
48
|
if ( instanceMatrixNode === null ) {
|
|
48
49
|
|
|
49
|
-
const instanceAttribute = instanceMesh.instanceMatrix;
|
|
50
|
-
|
|
51
50
|
// Both WebGPU and WebGL backends have UBO max limited to 64kb. Matrix count number bigger than 1000 ( 16 * 4 * 1000 = 64kb ) will fallback to attribute.
|
|
52
51
|
|
|
53
|
-
if (
|
|
52
|
+
if ( count <= 1000 ) {
|
|
54
53
|
|
|
55
|
-
instanceMatrixNode = buffer(
|
|
54
|
+
instanceMatrixNode = buffer( instanceMatrix.array, 'mat4', Math.max( count, 1 ) ).element( instanceIndex );
|
|
56
55
|
|
|
57
56
|
} else {
|
|
58
57
|
|
|
59
|
-
const buffer = new InstancedInterleavedBuffer(
|
|
58
|
+
const buffer = new InstancedInterleavedBuffer( instanceMatrix.array, 16, 1 );
|
|
60
59
|
|
|
61
60
|
this.buffer = buffer;
|
|
62
61
|
|
|
63
|
-
const bufferFn =
|
|
62
|
+
const bufferFn = instanceMatrix.usage === DynamicDrawUsage ? instancedDynamicBufferAttribute : instancedBufferAttribute;
|
|
64
63
|
|
|
65
64
|
const instanceBuffers = [
|
|
66
65
|
// F.Signature -> bufferAttribute( array, type, stride, offset )
|
|
@@ -78,13 +77,11 @@ class InstanceNode extends Node {
|
|
|
78
77
|
|
|
79
78
|
}
|
|
80
79
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
if ( instanceColorAttribute && instanceColorNode === null ) {
|
|
80
|
+
if ( instanceColor && instanceColorNode === null ) {
|
|
84
81
|
|
|
85
|
-
const buffer = new InstancedBufferAttribute(
|
|
82
|
+
const buffer = new InstancedBufferAttribute( instanceColor.array, 3 );
|
|
86
83
|
|
|
87
|
-
const bufferFn =
|
|
84
|
+
const bufferFn = instanceColor.usage === DynamicDrawUsage ? instancedDynamicBufferAttribute : instancedBufferAttribute;
|
|
88
85
|
|
|
89
86
|
this.bufferColor = buffer;
|
|
90
87
|
|
|
@@ -123,15 +120,15 @@ class InstanceNode extends Node {
|
|
|
123
120
|
|
|
124
121
|
update( /*frame*/ ) {
|
|
125
122
|
|
|
126
|
-
if ( this.
|
|
123
|
+
if ( this.instanceMatrix.usage !== DynamicDrawUsage && this.buffer != null && this.instanceMatrix.version !== this.buffer.version ) {
|
|
127
124
|
|
|
128
|
-
this.buffer.version = this.
|
|
125
|
+
this.buffer.version = this.instanceMatrix.version;
|
|
129
126
|
|
|
130
127
|
}
|
|
131
128
|
|
|
132
|
-
if ( this.
|
|
129
|
+
if ( this.instanceColor && this.instanceColor.usage !== DynamicDrawUsage && this.bufferColor != null && this.instanceColor.version !== this.bufferColor.version ) {
|
|
133
130
|
|
|
134
|
-
this.bufferColor.version = this.
|
|
131
|
+
this.bufferColor.version = this.instanceColor.version;
|
|
135
132
|
|
|
136
133
|
}
|
|
137
134
|
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import InstanceNode from './InstanceNode.js';
|
|
2
|
+
import { nodeProxy } from '../tsl/TSLBase.js';
|
|
3
|
+
|
|
4
|
+
class InstancedMeshNode extends InstanceNode {
|
|
5
|
+
|
|
6
|
+
static get type() {
|
|
7
|
+
|
|
8
|
+
return 'InstancedMeshNode';
|
|
9
|
+
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
constructor( instanceMesh ) {
|
|
13
|
+
|
|
14
|
+
const { count, instanceMatrix, instanceColor } = instanceMesh;
|
|
15
|
+
|
|
16
|
+
super( count, instanceMatrix, instanceColor );
|
|
17
|
+
|
|
18
|
+
this.instanceMesh = instanceMesh;
|
|
19
|
+
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export default InstancedMeshNode;
|
|
25
|
+
|
|
26
|
+
export const instancedMesh = /*@__PURE__*/ nodeProxy( InstancedMeshNode );
|
|
@@ -2,6 +2,7 @@ import { uniform } from '../core/UniformNode.js';
|
|
|
2
2
|
import { renderGroup } from '../core/UniformGroupNode.js';
|
|
3
3
|
import { Vector3 } from '../../math/Vector3.js';
|
|
4
4
|
import { cameraViewMatrix } from './Camera.js';
|
|
5
|
+
import { positionWorld } from './Position.js';
|
|
5
6
|
|
|
6
7
|
let uniformsLib;
|
|
7
8
|
|
|
@@ -17,6 +18,37 @@ function getLightData( light ) {
|
|
|
17
18
|
|
|
18
19
|
}
|
|
19
20
|
|
|
21
|
+
export function lightShadowMatrix( light ) {
|
|
22
|
+
|
|
23
|
+
const data = getLightData( light );
|
|
24
|
+
|
|
25
|
+
return data.shadowMatrix || ( data.shadowMatrix = uniform( 'mat4' ).setGroup( renderGroup ).onRenderUpdate( () => {
|
|
26
|
+
|
|
27
|
+
light.shadow.updateMatrices( light );
|
|
28
|
+
|
|
29
|
+
return light.shadow.matrix;
|
|
30
|
+
|
|
31
|
+
} ) );
|
|
32
|
+
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function lightProjectionUV( light ) {
|
|
36
|
+
|
|
37
|
+
const data = getLightData( light );
|
|
38
|
+
|
|
39
|
+
if ( data.projectionUV === undefined ) {
|
|
40
|
+
|
|
41
|
+
const spotLightCoord = lightShadowMatrix( light ).mul( positionWorld );
|
|
42
|
+
|
|
43
|
+
data.projectionUV = spotLightCoord.xyz.div( spotLightCoord.w );
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return data.projectionUV;
|
|
49
|
+
|
|
50
|
+
}
|
|
51
|
+
|
|
20
52
|
export function lightPosition( light ) {
|
|
21
53
|
|
|
22
54
|
const data = getLightData( light );
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
+
import { UVMapping } from '../../constants.js';
|
|
2
|
+
import { Euler } from '../../math/Euler.js';
|
|
3
|
+
import { Matrix4 } from '../../math/Matrix4.js';
|
|
1
4
|
import Node from '../core/Node.js';
|
|
2
|
-
import {
|
|
5
|
+
import { renderGroup } from '../core/UniformGroupNode.js';
|
|
6
|
+
import { nodeImmutable, uniform } from '../tsl/TSLBase.js';
|
|
3
7
|
import { reference } from './ReferenceNode.js';
|
|
4
8
|
|
|
9
|
+
const _e1 = /*@__PURE__*/ new Euler();
|
|
10
|
+
const _m1 = /*@__PURE__*/ new Matrix4();
|
|
11
|
+
|
|
5
12
|
class SceneNode extends Node {
|
|
6
13
|
|
|
7
14
|
static get type() {
|
|
@@ -34,6 +41,31 @@ class SceneNode extends Node {
|
|
|
34
41
|
|
|
35
42
|
output = reference( 'backgroundIntensity', 'float', scene );
|
|
36
43
|
|
|
44
|
+
} else if ( scope === SceneNode.BACKGROUND_ROTATION ) {
|
|
45
|
+
|
|
46
|
+
output = uniform( 'mat4' ).label( 'backgroundRotation' ).setGroup( renderGroup ).onRenderUpdate( () => {
|
|
47
|
+
|
|
48
|
+
const background = scene.background;
|
|
49
|
+
|
|
50
|
+
if ( background !== null && background.isTexture && background.mapping !== UVMapping ) {
|
|
51
|
+
|
|
52
|
+
_e1.copy( scene.backgroundRotation );
|
|
53
|
+
|
|
54
|
+
// accommodate left-handed frame
|
|
55
|
+
_e1.x *= - 1; _e1.y *= - 1; _e1.z *= - 1;
|
|
56
|
+
|
|
57
|
+
_m1.makeRotationFromEuler( _e1 );
|
|
58
|
+
|
|
59
|
+
} else {
|
|
60
|
+
|
|
61
|
+
_m1.identity();
|
|
62
|
+
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return _m1;
|
|
66
|
+
|
|
67
|
+
} );
|
|
68
|
+
|
|
37
69
|
} else {
|
|
38
70
|
|
|
39
71
|
console.error( 'THREE.SceneNode: Unknown scope:', scope );
|
|
@@ -48,8 +80,10 @@ class SceneNode extends Node {
|
|
|
48
80
|
|
|
49
81
|
SceneNode.BACKGROUND_BLURRINESS = 'backgroundBlurriness';
|
|
50
82
|
SceneNode.BACKGROUND_INTENSITY = 'backgroundIntensity';
|
|
83
|
+
SceneNode.BACKGROUND_ROTATION = 'backgroundRotation';
|
|
51
84
|
|
|
52
85
|
export default SceneNode;
|
|
53
86
|
|
|
54
87
|
export const backgroundBlurriness = /*@__PURE__*/ nodeImmutable( SceneNode, SceneNode.BACKGROUND_BLURRINESS );
|
|
55
88
|
export const backgroundIntensity = /*@__PURE__*/ nodeImmutable( SceneNode, SceneNode.BACKGROUND_INTENSITY );
|
|
89
|
+
export const backgroundRotation = /*@__PURE__*/ nodeImmutable( SceneNode, SceneNode.BACKGROUND_ROTATION );
|
|
@@ -2,7 +2,8 @@ import BufferNode from './BufferNode.js';
|
|
|
2
2
|
import { bufferAttribute } from './BufferAttributeNode.js';
|
|
3
3
|
import { nodeObject, varying } from '../tsl/TSLBase.js';
|
|
4
4
|
import { storageElement } from '../utils/StorageArrayElementNode.js';
|
|
5
|
-
import {
|
|
5
|
+
import { NodeAccess } from '../core/constants.js';
|
|
6
|
+
import { getTypeFromLength } from '../core/NodeUtils.js';
|
|
6
7
|
|
|
7
8
|
class StorageBufferNode extends BufferNode {
|
|
8
9
|
|
|
@@ -12,16 +13,23 @@ class StorageBufferNode extends BufferNode {
|
|
|
12
13
|
|
|
13
14
|
}
|
|
14
15
|
|
|
15
|
-
constructor( value, bufferType, bufferCount = 0 ) {
|
|
16
|
+
constructor( value, bufferType = null, bufferCount = 0 ) {
|
|
17
|
+
|
|
18
|
+
if ( bufferType === null && ( value.isStorageBufferAttribute || value.isStorageInstancedBufferAttribute ) ) {
|
|
19
|
+
|
|
20
|
+
bufferType = getTypeFromLength( value.itemSize );
|
|
21
|
+
bufferCount = value.count;
|
|
22
|
+
|
|
23
|
+
}
|
|
16
24
|
|
|
17
25
|
super( value, bufferType, bufferCount );
|
|
18
26
|
|
|
19
27
|
this.isStorageBufferNode = true;
|
|
20
28
|
|
|
21
|
-
this.access =
|
|
29
|
+
this.access = NodeAccess.READ_WRITE;
|
|
22
30
|
this.isAtomic = false;
|
|
31
|
+
this.isPBO = false;
|
|
23
32
|
|
|
24
|
-
this.bufferObject = false;
|
|
25
33
|
this.bufferCount = bufferCount;
|
|
26
34
|
|
|
27
35
|
this._attribute = null;
|
|
@@ -66,7 +74,7 @@ class StorageBufferNode extends BufferNode {
|
|
|
66
74
|
|
|
67
75
|
getInputType( /*builder*/ ) {
|
|
68
76
|
|
|
69
|
-
return 'storageBuffer';
|
|
77
|
+
return this.value.isIndirectStorageBufferAttribute ? 'indirectStorageBuffer' : 'storageBuffer';
|
|
70
78
|
|
|
71
79
|
}
|
|
72
80
|
|
|
@@ -76,14 +84,20 @@ class StorageBufferNode extends BufferNode {
|
|
|
76
84
|
|
|
77
85
|
}
|
|
78
86
|
|
|
79
|
-
|
|
87
|
+
setPBO( value ) {
|
|
80
88
|
|
|
81
|
-
this.
|
|
89
|
+
this.isPBO = value;
|
|
82
90
|
|
|
83
91
|
return this;
|
|
84
92
|
|
|
85
93
|
}
|
|
86
94
|
|
|
95
|
+
getPBO() {
|
|
96
|
+
|
|
97
|
+
return this.isPBO;
|
|
98
|
+
|
|
99
|
+
}
|
|
100
|
+
|
|
87
101
|
setAccess( value ) {
|
|
88
102
|
|
|
89
103
|
this.access = value;
|
|
@@ -94,7 +108,7 @@ class StorageBufferNode extends BufferNode {
|
|
|
94
108
|
|
|
95
109
|
toReadOnly() {
|
|
96
110
|
|
|
97
|
-
return this.setAccess(
|
|
111
|
+
return this.setAccess( NodeAccess.READ_ONLY );
|
|
98
112
|
|
|
99
113
|
}
|
|
100
114
|
|
|
@@ -112,27 +126,49 @@ class StorageBufferNode extends BufferNode {
|
|
|
112
126
|
|
|
113
127
|
}
|
|
114
128
|
|
|
115
|
-
|
|
129
|
+
getAttributeData() {
|
|
116
130
|
|
|
117
|
-
if (
|
|
131
|
+
if ( this._attribute === null ) {
|
|
118
132
|
|
|
119
|
-
|
|
133
|
+
this._attribute = bufferAttribute( this.value );
|
|
134
|
+
this._varying = varying( this._attribute );
|
|
120
135
|
|
|
121
136
|
}
|
|
122
137
|
|
|
123
|
-
|
|
138
|
+
return {
|
|
139
|
+
attribute: this._attribute,
|
|
140
|
+
varying: this._varying
|
|
141
|
+
};
|
|
124
142
|
|
|
125
|
-
|
|
143
|
+
}
|
|
126
144
|
|
|
127
|
-
|
|
128
|
-
|
|
145
|
+
getNodeType( builder ) {
|
|
146
|
+
|
|
147
|
+
if ( builder.isAvailable( 'storageBuffer' ) || builder.isAvailable( 'indirectStorageBuffer' ) ) {
|
|
148
|
+
|
|
149
|
+
return super.getNodeType( builder );
|
|
129
150
|
|
|
130
151
|
}
|
|
131
152
|
|
|
153
|
+
const { attribute } = this.getAttributeData();
|
|
132
154
|
|
|
133
|
-
|
|
155
|
+
return attribute.getNodeType( builder );
|
|
134
156
|
|
|
135
|
-
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
generate( builder ) {
|
|
160
|
+
|
|
161
|
+
if ( builder.isAvailable( 'storageBuffer' ) || builder.isAvailable( 'indirectStorageBuffer' ) ) {
|
|
162
|
+
|
|
163
|
+
return super.generate( builder );
|
|
164
|
+
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
const { attribute, varying } = this.getAttributeData();
|
|
168
|
+
|
|
169
|
+
const output = varying.build( builder );
|
|
170
|
+
|
|
171
|
+
builder.registerTransform( output, attribute );
|
|
136
172
|
|
|
137
173
|
return output;
|
|
138
174
|
|
|
@@ -142,6 +178,12 @@ class StorageBufferNode extends BufferNode {
|
|
|
142
178
|
|
|
143
179
|
export default StorageBufferNode;
|
|
144
180
|
|
|
145
|
-
// Read-Write Storage
|
|
146
181
|
export const storage = ( value, type, count ) => nodeObject( new StorageBufferNode( value, type, count ) );
|
|
147
|
-
|
|
182
|
+
|
|
183
|
+
export const storageObject = ( value, type, count ) => { // @deprecated, r171
|
|
184
|
+
|
|
185
|
+
console.warn( 'THREE.TSL: "storageObject()" is deprecated. Use "storage().setPBO( true )" instead.' );
|
|
186
|
+
|
|
187
|
+
return storage( value, type, count ).setPBO( true );
|
|
188
|
+
|
|
189
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import TextureNode from './TextureNode.js';
|
|
2
2
|
import { nodeProxy } from '../tsl/TSLBase.js';
|
|
3
|
-
import {
|
|
3
|
+
import { NodeAccess } from '../core/constants.js';
|
|
4
4
|
|
|
5
5
|
class StorageTextureNode extends TextureNode {
|
|
6
6
|
|
|
@@ -18,7 +18,7 @@ class StorageTextureNode extends TextureNode {
|
|
|
18
18
|
|
|
19
19
|
this.isStorageTextureNode = true;
|
|
20
20
|
|
|
21
|
-
this.access =
|
|
21
|
+
this.access = NodeAccess.WRITE_ONLY;
|
|
22
22
|
|
|
23
23
|
}
|
|
24
24
|
|
|
@@ -62,15 +62,21 @@ class StorageTextureNode extends TextureNode {
|
|
|
62
62
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
+
toReadWrite() {
|
|
66
|
+
|
|
67
|
+
return this.setAccess( NodeAccess.READ_WRITE );
|
|
68
|
+
|
|
69
|
+
}
|
|
70
|
+
|
|
65
71
|
toReadOnly() {
|
|
66
72
|
|
|
67
|
-
return this.setAccess(
|
|
73
|
+
return this.setAccess( NodeAccess.READ_ONLY );
|
|
68
74
|
|
|
69
75
|
}
|
|
70
76
|
|
|
71
77
|
toWriteOnly() {
|
|
72
78
|
|
|
73
|
-
return this.setAccess(
|
|
79
|
+
return this.setAccess( NodeAccess.WRITE_ONLY );
|
|
74
80
|
|
|
75
81
|
}
|
|
76
82
|
|
|
@@ -126,7 +126,7 @@ class TextureNode extends UniformNode {
|
|
|
126
126
|
|
|
127
127
|
const texture = this.value;
|
|
128
128
|
|
|
129
|
-
if ( builder.isFlipY() && ( texture.isRenderTargetTexture === true || texture.isFramebufferTexture === true || texture.isDepthTexture === true ) ) {
|
|
129
|
+
if ( builder.isFlipY() && ( ( texture.image instanceof ImageBitmap && texture.flipY === true ) || texture.isRenderTargetTexture === true || texture.isFramebufferTexture === true || texture.isDepthTexture === true ) ) {
|
|
130
130
|
|
|
131
131
|
if ( this.sampler ) {
|
|
132
132
|
|