Skip to content

Commit fb0cfb1

Browse files
committed
Clean up.
1 parent 1745074 commit fb0cfb1

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/nodes/lighting/PointShadowNode.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import ShadowNode from './ShadowNode.js';
22
import { uniform } from '../core/UniformNode.js';
3-
import { float, vec3, If, Fn, nodeObject } from '../tsl/TSLBase.js';
3+
import { float, vec2, If, Fn, nodeObject } from '../tsl/TSLBase.js';
44
import { reference } from '../accessors/ReferenceNode.js';
55
import { cubeTexture } from '../accessors/CubeTextureNode.js';
66
import { renderGroup } from '../core/UniformGroupNode.js';
@@ -51,17 +51,17 @@ export const PointShadowFilter = /*@__PURE__*/ Fn( ( { depthTexture, bd3D, dp, s
5151
const mapSize = reference( 'mapSize', 'vec2', shadow ).setGroup( renderGroup );
5252

5353
const texelSize = float( 1 ).div( mapSize.x );
54-
const offset = radius.mul( texelSize );
55-
56-
return cubeTexture( depthTexture, bd3D.add( vec3( offset, offset, offset ) ) ).compare( dp )
57-
.add( cubeTexture( depthTexture, bd3D.add( vec3( offset, offset, offset.negate() ) ) ).compare( dp ) )
58-
.add( cubeTexture( depthTexture, bd3D.add( vec3( offset, offset.negate(), offset ) ) ).compare( dp ) )
59-
.add( cubeTexture( depthTexture, bd3D.add( vec3( offset, offset.negate(), offset.negate() ) ) ).compare( dp ) )
60-
.add( cubeTexture( depthTexture, bd3D.add( vec3( offset.negate(), offset, offset ) ) ).compare( dp ) )
61-
.add( cubeTexture( depthTexture, bd3D.add( vec3( offset.negate(), offset, offset.negate() ) ) ).compare( dp ) )
62-
.add( cubeTexture( depthTexture, bd3D.add( vec3( offset.negate(), offset.negate(), offset ) ) ).compare( dp ) )
63-
.add( cubeTexture( depthTexture, bd3D.add( vec3( offset.negate(), offset.negate(), offset.negate() ) ) ).compare( dp ) )
54+
const offset = vec2( - 1.0, 1.0 ).mul( radius ).mul( texelSize );
55+
56+
return cubeTexture( depthTexture, bd3D.add( offset.xyy ) ).compare( dp )
57+
.add( cubeTexture( depthTexture, bd3D.add( offset.yyy ) ).compare( dp ) )
58+
.add( cubeTexture( depthTexture, bd3D.add( offset.xyx ) ).compare( dp ) )
59+
.add( cubeTexture( depthTexture, bd3D.add( offset.yyx ) ).compare( dp ) )
6460
.add( cubeTexture( depthTexture, bd3D ).compare( dp ) )
61+
.add( cubeTexture( depthTexture, bd3D.add( offset.xxy ) ).compare( dp ) )
62+
.add( cubeTexture( depthTexture, bd3D.add( offset.yxy ) ).compare( dp ) )
63+
.add( cubeTexture( depthTexture, bd3D.add( offset.xxx ) ).compare( dp ) )
64+
.add( cubeTexture( depthTexture, bd3D.add( offset.yxx ) ).compare( dp ) )
6565
.mul( 1.0 / 9.0 );
6666

6767
} );

0 commit comments

Comments
 (0)