-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TSL: Introduce
renderOutput()
(#28781)
* Introduce `renderOutput()` * cleanup * cleanup * update * Update webgpu_postprocessing_3dlut.html * cleanup * rename defaultColorTransform -> outputColorTransform
- Loading branch information
Showing
14 changed files
with
171 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import TempNode from '../core/TempNode.js'; | ||
import { addNodeClass } from '../core/Node.js'; | ||
import { addNodeElement, nodeObject } from '../shadernode/ShaderNode.js'; | ||
|
||
import { SRGBColorSpace, NoToneMapping } from '../../constants.js'; | ||
|
||
class RenderOutputNode extends TempNode { | ||
|
||
constructor( colorNode, toneMapping, outputColorSpace ) { | ||
|
||
super( 'vec4' ); | ||
|
||
this.colorNode = colorNode; | ||
this.toneMapping = toneMapping; | ||
this.outputColorSpace = outputColorSpace; | ||
|
||
this.isRenderOutput = true; | ||
|
||
} | ||
|
||
setup( { context } ) { | ||
|
||
let outputNode = this.colorNode || context.color; | ||
|
||
// tone mapping | ||
|
||
const toneMapping = this.toneMapping !== null ? this.toneMapping : context.toneMapping; | ||
const outputColorSpace = this.outputColorSpace !== null ? this.outputColorSpace : context.outputColorSpace; | ||
|
||
if ( toneMapping !== NoToneMapping ) { | ||
|
||
outputNode = outputNode.toneMapping( toneMapping ); | ||
|
||
} | ||
|
||
// output color space | ||
|
||
if ( outputColorSpace === SRGBColorSpace ) { | ||
|
||
outputNode = outputNode.linearToColorSpace( outputColorSpace ); | ||
|
||
} | ||
|
||
return outputNode; | ||
|
||
} | ||
|
||
} | ||
|
||
export default RenderOutputNode; | ||
|
||
export const renderOutput = ( color, toneMapping = null, outputColorSpace = null ) => nodeObject( new RenderOutputNode( nodeObject( color ), toneMapping, outputColorSpace ) ); | ||
|
||
addNodeElement( 'renderOutput', renderOutput ); | ||
|
||
addNodeClass( 'RenderOutputNode', RenderOutputNode ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.