-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add SepiaNode * add node to export * fix * condense sepia into tslFn * remove SepiaNode from Node.js * Update SepiaNode.js --------- Co-authored-by: Michael Herzog <[email protected]>
- Loading branch information
1 parent
bfe65cd
commit 76920df
Showing
2 changed files
with
22 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { addNodeElement, tslFn, vec3, vec4 } from '../shadernode/ShaderNode.js'; | ||
import { min } from '../math/MathNode.js'; | ||
import { dot } from '../math/MathNode.js'; | ||
|
||
import { property } from '../core/PropertyNode.js'; | ||
|
||
export const sepia = /*@__PURE__*/ tslFn( ( { color } ) => { | ||
|
||
const c = property( 'vec3', 'c' ).assign( color.rgb ); | ||
|
||
// https://github.com/evanw/glfx.js/blob/master/src/filters/adjust/sepia.js | ||
|
||
color.r = dot( c, vec3( 0.393, 0.769, 0.189 ) ); | ||
color.g = dot( c, vec3( 0.349, 0.686, 0.168 ) ); | ||
color.b = dot( c, vec3( 0.272, 0.534, 0.131 ) ); | ||
|
||
return vec4( min( vec3( 1.0 ), color.rgb ), 1.0 ); | ||
|
||
} ); | ||
|
||
addNodeElement( 'sepia', sepia ); |