|
@@ -34,7 +34,7 @@
|
|
|
|
|
|
import { TeapotGeometry } from './jsm/geometries/TeapotGeometry.js';
|
|
import { TeapotGeometry } from './jsm/geometries/TeapotGeometry.js';
|
|
|
|
|
|
- import { ShaderNode, vec3, dot } from 'three-nodes/ShaderNode.js';
|
|
|
|
|
|
+ import { ShaderNode, vec3, dot, sampler } from 'three-nodes/ShaderNode.js';
|
|
|
|
|
|
import Stats from './jsm/libs/stats.module.js';
|
|
import Stats from './jsm/libs/stats.module.js';
|
|
|
|
|
|
@@ -160,6 +160,23 @@
|
|
material.colorNode = desaturateWGSLNode.call( { color: new Nodes.TextureNode( texture ) } );
|
|
material.colorNode = desaturateWGSLNode.call( { color: new Nodes.TextureNode( texture ) } );
|
|
materials.push( material );
|
|
materials.push( material );
|
|
|
|
|
|
|
|
+ // Custom WGSL ( get texture from keywords )
|
|
|
|
+
|
|
|
|
+ const getWGSLTextureSample = new Nodes.FunctionNode( `
|
|
|
|
+ fn getWGSLTextureSample( tex: texture_2d<f32>, tex_sampler: sampler, uv:vec2<f32> ) -> vec4<f32> {
|
|
|
|
+
|
|
|
|
+ return textureSample( tex, tex_sampler, uv ) * vec4<f32>( 0.0, 1.0, 0.0, 1.0 );
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ ` );
|
|
|
|
+
|
|
|
|
+ const textureNode = new Nodes.TextureNode( texture );
|
|
|
|
+ //getWGSLTextureSample.keywords = { tex: textureNode, tex_sampler: sampler( textureNode ) };
|
|
|
|
+
|
|
|
|
+ material = new Nodes.MeshBasicNodeMaterial();
|
|
|
|
+ material.colorNode = getWGSLTextureSample.call( { tex: textureNode, tex_sampler: textureNode, uv: new Nodes.UVNode() } );
|
|
|
|
+ materials.push( material );
|
|
|
|
+
|
|
//
|
|
//
|
|
// Geometry
|
|
// Geometry
|
|
//
|
|
//
|