You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
608 B

import LightingModel from '../core/LightingModel.js';
import { diffuseColor } from '../core/PropertyNode.js';
import { float } from '../shadernode/ShaderNode.js';
class ShadowMaskModel extends LightingModel {
constructor() {
super();
this.shadowNode = float( 1 ).toVar( 'shadowMask' );
}
direct( { shadowMask } ) {
this.shadowNode.mulAssign( shadowMask );
}
finish( context ) {
diffuseColor.a.mulAssign( this.shadowNode.oneMinus() );
context.outgoingLight.rgb.assign( diffuseColor.rgb ); // TODO: Optimize LightsNode to avoid this assignment
}
}
export default ShadowMaskModel;