Skip to content

Commit

Permalink
AnalyticLightNode: Fix object.receiveShadow toggle.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mugen87 committed Jul 21, 2024
1 parent 6899412 commit be1bd9f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/nodes/lighting/AnalyticLightNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import LightingNode from './LightingNode.js';
import { NodeUpdateType } from '../core/constants.js';
import { uniform } from '../core/UniformNode.js';
import { addNodeClass } from '../core/Node.js';
import { float, If, vec2, vec3, vec4 } from '../shadernode/ShaderNode.js';
import { float, int, If, vec2, vec3, vec4 } from '../shadernode/ShaderNode.js';
import { reference } from '../accessors/ReferenceNode.js';
import { texture } from '../accessors/TextureNode.js';
import { positionWorld } from '../accessors/PositionNode.js';
Expand Down Expand Up @@ -87,6 +87,7 @@ class AnalyticLightNode extends LightingNode {
const shadowIntensity = reference( 'intensity', 'float', shadow );
const bias = reference( 'bias', 'float', shadow );
const normalBias = reference( 'normalBias', 'float', shadow );
const receiveShadow = reference( 'receiveShadow', 'int', object );

const position = object.material.shadowPositionNode || positionWorld;

Expand Down Expand Up @@ -173,7 +174,7 @@ class AnalyticLightNode extends LightingNode {


this.shadowMap = shadowMap;
this.colorNode = this.colorNode.mul( mix( 1, shadowNode, shadowIntensity ) );
this.colorNode = this.colorNode.mul( receiveShadow.greaterThan( int( 0 ) ).cond( mix( 1, shadowNode, shadowIntensity ), float( 1.0 ) ) );
this._shadowColorNode = this.colorNode;

this.shadowNode = shadowNode;
Expand Down

0 comments on commit be1bd9f

Please sign in to comment.