-
-
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.
* PackingNode: Move to TSL approach * update webgpu_mrt * DiscardNode: Move to TSL approach * HashNode: Move to TSL approach * no references to discard() without chaining * Update DiscardNode.js * Update DiscardNode.js * renames
- Loading branch information
Showing
10 changed files
with
33 additions
and
123 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,15 @@ | ||
import { Fn, addNodeElement } from '../shadernode/ShaderNode.js'; | ||
|
||
export const hash = Fn( ( [ seed ] ) => { | ||
|
||
// Taken from https://www.shadertoy.com/view/XlGcRh, originally from pcg-random.org | ||
|
||
const state = seed.toUint().mul( 747796405 ).add( 2891336453 ); | ||
const word = state.shiftRight( state.shiftRight( 28 ).add( 4 ) ).bitXor( state ).mul( 277803737 ); | ||
const result = word.shiftRight( 22 ).bitXor( word ); | ||
|
||
return result.toFloat().mul( 1 / 2 ** 32 ); // Convert to range [0, 1) | ||
|
||
} ); | ||
|
||
addNodeElement( 'hash', hash ); |
This file was deleted.
Oops, something went wrong.
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,8 @@ | ||
import { select } from '../math/CondNode.js'; | ||
import { expression } from '../code/ExpressionNode.js'; | ||
import { addNodeElement } from '../shadernode/ShaderNode.js'; | ||
|
||
export const Discard = ( conditional ) => ( conditional ? select( conditional, expression( 'discard' ) ) : expression( 'discard' ) ).append(); | ||
export const Return = () => expression( 'return' ).append(); | ||
|
||
addNodeElement( 'discard', Discard ); |
This file was deleted.
Oops, something went wrong.
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,4 @@ | ||
import { nodeObject } from '../shadernode/ShaderNode.js'; | ||
|
||
export const directionToColor = ( node ) => nodeObject( node ).mul( 0.5 ).add( 0.5 ); | ||
export const colorToDirection = ( node ) => nodeObject( node ).mul( 2.0 ).sub( 1 ); |
This file was deleted.
Oops, something went wrong.