|
@@ -166,7 +166,7 @@
|
|
|
|
|
|
// Custom WGSL ( desaturate filter )
|
|
// Custom WGSL ( desaturate filter )
|
|
|
|
|
|
- const desaturateWGSLNode = wgslFn( `
|
|
|
|
|
|
+ const desaturateWGSLFn = wgslFn( `
|
|
fn desaturate( color:vec3<f32> ) -> vec3<f32> {
|
|
fn desaturate( color:vec3<f32> ) -> vec3<f32> {
|
|
|
|
|
|
let lum = vec3<f32>( 0.299, 0.587, 0.114 );
|
|
let lum = vec3<f32>( 0.299, 0.587, 0.114 );
|
|
@@ -176,8 +176,18 @@
|
|
}
|
|
}
|
|
` );
|
|
` );
|
|
|
|
|
|
|
|
+ // include example
|
|
|
|
+
|
|
|
|
+ const someWGSLFn = wgslFn( `
|
|
|
|
+ fn someFn( color:vec3<f32> ) -> vec3<f32> {
|
|
|
|
+
|
|
|
|
+ return desaturate( color );
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ `, [ desaturateWGSLFn ] );
|
|
|
|
+
|
|
material = new MeshBasicNodeMaterial();
|
|
material = new MeshBasicNodeMaterial();
|
|
- material.colorNode = desaturateWGSLNode( { color: texture( uvTexture ) } );
|
|
|
|
|
|
+ material.colorNode = someWGSLFn( { color: texture( uvTexture ) } );
|
|
materials.push( material );
|
|
materials.push( material );
|
|
|
|
|
|
// Custom WGSL ( get texture from keywords )
|
|
// Custom WGSL ( get texture from keywords )
|