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.
 
 
 
 
 

51 lines
1002 B

import TempNode from '../core/Node.js';
import { ShaderNode, mul, float } from '../shadernode/ShaderNodeBaseElements.js';
import { LinearToneMapping } from 'three';
// exposure only
export const LinearToneMappingNode = new ShaderNode( ( { color, exposure } ) => {
return mul( color, exposure );
} );
class ToneMappingNode extends TempNode {
constructor( toneMapping, exposureNode = float( 1 ), colorNode = null ) {
super( 'vec3' );
this.toneMapping = toneMapping;
this.exposureNode = exposureNode;
this.colorNode = colorNode;
}
construct( builder ) {
const colorNode = this.color || builder.context.color;
const toneMapping = this.toneMapping;
const toneMappingParams = { exposure: this.exposureNode, color: colorNode };
let outputNode = null;
if ( toneMapping === LinearToneMapping ) {
outputNode = LinearToneMappingNode.call( toneMappingParams );
} else {
outputNode = this.colorNode;
}
return outputNode;
}
}
export default ToneMappingNode;