66 ColorNodeUniform , Matrix3NodeUniform , Matrix4NodeUniform
77} from './WebGPUNodeUniform.js' ;
88import WebGPUNodeSampler from './WebGPUNodeSampler.js' ;
9- import { WebGPUNodeSampledTexture , WebGPUNodeSampledCubeTexture } from './WebGPUNodeSampledTexture.js' ;
9+ import { WebGPUNodeSampledTexture } from './WebGPUNodeSampledTexture.js' ;
1010
1111import WebGPUUniformBuffer from '../WebGPUUniformBuffer.js' ;
1212import { getVectorLength , getStrideLength } from '../WebGPUBufferUtils.js' ;
@@ -33,27 +33,27 @@ const wgslTypeLib = {
3333 int : 'i32' ,
3434 uint : 'u32' ,
3535 bool : 'bool' ,
36-
36+
3737 vec2 : 'vec2<f32>' ,
3838 ivec2 : 'vec2<i32>' ,
3939 uvec2 : 'vec2<u32>' ,
4040 bvec2 : 'vec2<bool>' ,
41-
41+
4242 vec3 : 'vec3<f32>' ,
4343 ivec3 : 'vec3<i32>' ,
4444 uvec3 : 'vec3<u32>' ,
4545 bvec3 : 'vec3<bool>' ,
46-
46+
4747 vec4 : 'vec4<f32>' ,
4848 ivec4 : 'vec4<i32>' ,
4949 uvec4 : 'vec4<u32>' ,
5050 bvec4 : 'vec4<bool>' ,
51-
51+
5252 mat3 : 'mat3x3<f32>' ,
5353 imat3 : 'mat3x3<i32>' ,
5454 umat3 : 'mat3x3<u32>' ,
5555 bmat3 : 'mat3x3<bool>' ,
56-
56+
5757 mat4 : 'mat4x4<f32>' ,
5858 imat4 : 'mat4x4<i32>' ,
5959 umat4 : 'mat4x4<u32>' ,
@@ -362,7 +362,7 @@ class WebGPUNodeBuilder extends NodeBuilder {
362362
363363 }
364364
365- getSampler ( textureProperty , uvSnippet , shaderStage = this . shaderStage ) {
365+ getTexture ( textureProperty , uvSnippet , biasSnippet , shaderStage = this . shaderStage ) {
366366
367367 if ( shaderStage === 'fragment' ) {
368368
@@ -380,18 +380,6 @@ class WebGPUNodeBuilder extends NodeBuilder {
380380
381381 }
382382
383- getTexture ( textureProperty , uvSnippet , shaderStage = this . shaderStage ) {
384-
385- return this . getSampler ( textureProperty , uvSnippet , shaderStage ) ;
386-
387- }
388-
389- getCubeTexture ( textureProperty , uvSnippet , shaderStage = this . shaderStage ) {
390-
391- return this . getSampler ( textureProperty , uvSnippet , shaderStage ) ;
392-
393- }
394-
395383 getPropertyName ( node , shaderStage = this . shaderStage ) {
396384
397385 if ( node . isNodeVary === true ) {
@@ -407,7 +395,7 @@ class WebGPUNodeBuilder extends NodeBuilder {
407395 const name = node . name ;
408396 const type = node . type ;
409397
410- if ( type === 'texture' || type === 'cubeTexture' ) {
398+ if ( type === 'texture' ) {
411399
412400 return name ;
413401
@@ -446,21 +434,10 @@ class WebGPUNodeBuilder extends NodeBuilder {
446434
447435 const bindings = this . bindings [ shaderStage ] ;
448436
449- if ( type === 'texture' || type === 'cubeTexture' ) {
437+ if ( type === 'texture' ) {
450438
451439 const sampler = new WebGPUNodeSampler ( `${ uniformNode . name } _sampler` , uniformNode . node ) ;
452-
453- let texture = null ;
454-
455- if ( type === 'texture' ) {
456-
457- texture = new WebGPUNodeSampledTexture ( uniformNode . name , uniformNode . node ) ;
458-
459- } else if ( type === 'cubeTexture' ) {
460-
461- texture = new WebGPUNodeSampledCubeTexture ( uniformNode . name , uniformNode . node ) ;
462-
463- }
440+ const texture = new WebGPUNodeSampledTexture ( uniformNode . name , uniformNode . node ) ;
464441
465442 // add first textures in sequence and group for last
466443 const lastBinding = bindings [ bindings . length - 1 ] ;
@@ -478,6 +455,7 @@ class WebGPUNodeBuilder extends NodeBuilder {
478455
479456 uniformGPU = [ texture ] ;
480457
458+
481459 }
482460
483461
@@ -674,16 +652,6 @@ class WebGPUNodeBuilder extends NodeBuilder {
674652
675653 snippet += `@group( 0 ) @binding( ${ index ++ } ) var ${ uniform . name } : texture_2d<f32>; ` ;
676654
677- } else if ( uniform . type === 'cubeTexture' ) {
678-
679- if ( shaderStage === 'fragment' ) {
680-
681- snippet += `@group( 0 ) @binding( ${ index ++ } ) var ${ uniform . name } _sampler : sampler; ` ;
682-
683- }
684-
685- snippet += `@group( 0 ) @binding( ${ index ++ } ) var ${ uniform . name } : texture_cube<f32>; ` ;
686-
687655 } else if ( uniform . type === 'buffer' ) {
688656
689657 const bufferNode = uniform . node ;
0 commit comments