diff --git a/examples-jsm/changes.patch b/examples-jsm/changes.patch index a505cdce7..40c6a9f4d 100644 --- a/examples-jsm/changes.patch +++ b/examples-jsm/changes.patch @@ -1004,7 +1004,7 @@ index 190fe8c5..d873bb24 100644 this.name = name; diff --git a/examples-jsm/examples/nodes/core/NodeBuilder.ts b/examples-jsm/examples/nodes/core/NodeBuilder.ts -index 64472992..a7600328 100644 +index 0777751e..90fcf21c 100644 --- a/examples-jsm/examples/nodes/core/NodeBuilder.ts +++ b/examples-jsm/examples/nodes/core/NodeBuilder.ts @@ -8,7 +8,7 @@ import NodeCache from './NodeCache.js'; @@ -1016,10 +1016,10 @@ index 64472992..a7600328 100644 import { NumberNodeUniform, -@@ -30,17 +30,41 @@ import { - IntType, - UnsignedIntType, - Float16BufferAttribute, +@@ -34,17 +34,41 @@ import { + LinearMipmapNearestFilter, + NearestMipmapLinearFilter, + LinearMipmapLinearFilter, + Object3D, + Material, + Mesh, @@ -1062,7 +1062,7 @@ index 64472992..a7600328 100644 const typeFromLength = new Map([ [2, 'vec2'], -@@ -50,7 +74,16 @@ const typeFromLength = new Map([ +@@ -54,7 +78,16 @@ const typeFromLength = new Map([ [16, 'mat4'], ]); @@ -1080,7 +1080,7 @@ index 64472992..a7600328 100644 [Int8Array, 'int'], [Int16Array, 'int'], [Int32Array, 'int'], -@@ -60,17 +93,93 @@ const typeFromArray = new Map([ +@@ -64,17 +97,93 @@ const typeFromArray = new Map([ [Float32Array, 'float'], ]); @@ -1180,7 +1180,7 @@ index 64472992..a7600328 100644 this.renderer = renderer; this.parser = parser; this.scene = scene; -@@ -119,17 +228,17 @@ class NodeBuilder { +@@ -123,17 +232,17 @@ class NodeBuilder { this.cache = new NodeCache(); this.globalCache = this.cache; @@ -1201,7 +1201,7 @@ index 64472992..a7600328 100644 return new CubeRenderTarget(size, options); } -@@ -139,17 +248,17 @@ class NodeBuilder { +@@ -143,17 +252,17 @@ class NodeBuilder { return new PMREMGenerator(this.renderer); } @@ -1224,7 +1224,7 @@ index 64472992..a7600328 100644 let sharedBinding = uniformsGroupCache.get(nodes); -@@ -182,11 +291,11 @@ class NodeBuilder { +@@ -186,11 +295,11 @@ class NodeBuilder { return bindingsArray; } @@ -1238,16 +1238,25 @@ index 64472992..a7600328 100644 if (this.nodes.includes(node) === false) { this.nodes.push(node); -@@ -218,7 +327,7 @@ class NodeBuilder { +@@ -222,7 +331,7 @@ class NodeBuilder { return this.chaining[this.chaining.length - 1]; } +- isFilteredTexture(texture) { ++ isFilteredTexture(texture: Texture) { + return ( + texture.magFilter === LinearFilter || + texture.magFilter === LinearMipmapNearestFilter || +@@ -235,7 +344,7 @@ class NodeBuilder { + ); + } + - addChain(node) { + addChain(node: Node) { /* if ( this.chaining.indexOf( node ) !== - 1 ) { -@@ -230,7 +339,7 @@ class NodeBuilder { +@@ -247,7 +356,7 @@ class NodeBuilder { this.chaining.push(node); } @@ -1256,7 +1265,7 @@ index 64472992..a7600328 100644 const lastChain = this.chaining.pop(); if (lastChain !== node) { -@@ -238,21 +347,21 @@ class NodeBuilder { +@@ -255,21 +364,21 @@ class NodeBuilder { } } @@ -1282,7 +1291,7 @@ index 64472992..a7600328 100644 this.context = context; } -@@ -260,7 +369,7 @@ class NodeBuilder { +@@ -277,7 +386,7 @@ class NodeBuilder { return this.context; } @@ -1291,7 +1300,7 @@ index 64472992..a7600328 100644 this.cache = cache; } -@@ -268,14 +377,14 @@ class NodeBuilder { +@@ -285,14 +394,14 @@ class NodeBuilder { return this.cache; } @@ -1308,7 +1317,7 @@ index 64472992..a7600328 100644 return false; } -@@ -299,15 +408,45 @@ class NodeBuilder { +@@ -316,15 +425,45 @@ class NodeBuilder { return false; } @@ -1363,7 +1372,7 @@ index 64472992..a7600328 100644 if (value === null) { if (type === 'float' || type === 'int' || type === 'uint') value = 0; else if (type === 'bool') value = false; -@@ -318,26 +457,26 @@ class NodeBuilder { +@@ -335,26 +474,26 @@ class NodeBuilder { } if (type === 'float') return toFloat(value); @@ -1399,7 +1408,7 @@ index 64472992..a7600328 100644 } else if (typeLength > 4) { return `${this.getType(type)}()`; } -@@ -345,17 +484,17 @@ class NodeBuilder { +@@ -362,17 +501,17 @@ class NodeBuilder { throw new Error(`NodeBuilder: Type '${type}' not found in generate constant attempt.`); } @@ -1420,7 +1429,7 @@ index 64472992..a7600328 100644 const attributes = this.attributes; // find attribute -@@ -375,19 +514,19 @@ class NodeBuilder { +@@ -392,19 +531,19 @@ class NodeBuilder { return attribute; } @@ -1447,7 +1456,7 @@ index 64472992..a7600328 100644 return ( type === 'void' || type === 'property' || -@@ -403,10 +542,10 @@ class NodeBuilder { +@@ -420,10 +559,10 @@ class NodeBuilder { return false; } @@ -1460,7 +1469,7 @@ index 64472992..a7600328 100644 if (type === IntType) return 'int'; if (type === UnsignedIntType) return 'uint'; } -@@ -414,7 +553,7 @@ class NodeBuilder { +@@ -431,7 +570,7 @@ class NodeBuilder { return 'float'; } @@ -1469,7 +1478,7 @@ index 64472992..a7600328 100644 if (type === 'mat2') return 'vec2'; if (type === 'mat3') return 'vec3'; if (type === 'mat4') return 'vec4'; -@@ -422,7 +561,7 @@ class NodeBuilder { +@@ -439,7 +578,7 @@ class NodeBuilder { return this.getComponentType(type); } @@ -1478,7 +1487,7 @@ index 64472992..a7600328 100644 type = this.getVectorType(type); if (type === 'float' || type === 'bool' || type === 'int' || type === 'uint') return type; -@@ -438,7 +577,7 @@ class NodeBuilder { +@@ -455,7 +594,7 @@ class NodeBuilder { return 'float'; } @@ -1487,7 +1496,7 @@ index 64472992..a7600328 100644 if (type === 'color') return 'vec3'; if (type === 'texture' || type === 'cubeTexture' || type === 'storageTexture' || type === 'texture3D') return 'vec4'; -@@ -446,23 +585,23 @@ class NodeBuilder { +@@ -463,23 +602,23 @@ class NodeBuilder { return type; } @@ -1519,7 +1528,7 @@ index 64472992..a7600328 100644 const array = dataAttribute.array; const itemSize = attribute.itemSize; -@@ -477,28 +616,28 @@ class NodeBuilder { +@@ -494,28 +633,28 @@ class NodeBuilder { return this.getTypeFromLength(itemSize, arrayType); } @@ -1556,7 +1565,7 @@ index 64472992..a7600328 100644 const componentType = this.getComponentType(type); if (componentType === 'int' || componentType === 'uint') return type; -@@ -524,7 +663,11 @@ class NodeBuilder { +@@ -541,7 +680,11 @@ class NodeBuilder { return lastStack; } @@ -1569,7 +1578,7 @@ index 64472992..a7600328 100644 cache = cache === null ? (node.isGlobal(this) ? this.globalCache : this.cache) : cache; let nodeData = cache.getData(node); -@@ -537,16 +680,16 @@ class NodeBuilder { +@@ -554,16 +697,16 @@ class NodeBuilder { if (nodeData[shaderStage] === undefined) nodeData[shaderStage] = {}; @@ -1589,7 +1598,7 @@ index 64472992..a7600328 100644 const nodeData = this.getDataFromNode(node); let bufferAttribute = nodeData.bufferAttribute; -@@ -564,7 +707,7 @@ class NodeBuilder { +@@ -581,7 +724,7 @@ class NodeBuilder { return bufferAttribute; } @@ -1598,7 +1607,7 @@ index 64472992..a7600328 100644 const nodeData = this.getDataFromNode(node, shaderStage); if (nodeData.structType === undefined) { -@@ -579,7 +722,12 @@ class NodeBuilder { +@@ -596,7 +739,12 @@ class NodeBuilder { return node; } @@ -1612,7 +1621,7 @@ index 64472992..a7600328 100644 const nodeData = this.getDataFromNode(node, shaderStage, this.globalCache); let nodeUniform = nodeData.uniform; -@@ -597,7 +745,12 @@ class NodeBuilder { +@@ -614,7 +762,12 @@ class NodeBuilder { return nodeUniform; } @@ -1626,7 +1635,7 @@ index 64472992..a7600328 100644 const nodeData = this.getDataFromNode(node, shaderStage); let nodeVar = nodeData.variable; -@@ -617,7 +770,7 @@ class NodeBuilder { +@@ -634,7 +787,7 @@ class NodeBuilder { return nodeVar; } @@ -1635,7 +1644,7 @@ index 64472992..a7600328 100644 const nodeData = this.getDataFromNode(node, 'any'); let nodeVarying = nodeData.varying; -@@ -638,7 +791,7 @@ class NodeBuilder { +@@ -655,7 +808,7 @@ class NodeBuilder { return nodeVarying; } @@ -1644,7 +1653,7 @@ index 64472992..a7600328 100644 const nodeData = this.getDataFromNode(node); let nodeCode = nodeData.code; -@@ -657,7 +810,7 @@ class NodeBuilder { +@@ -674,7 +827,7 @@ class NodeBuilder { return nodeCode; } @@ -1653,7 +1662,7 @@ index 64472992..a7600328 100644 if (code === '') return this; code = this.tab + code; -@@ -671,7 +824,7 @@ class NodeBuilder { +@@ -688,7 +841,7 @@ class NodeBuilder { return this; } @@ -1662,7 +1671,7 @@ index 64472992..a7600328 100644 this.flow.code += code; return this; -@@ -689,11 +842,11 @@ class NodeBuilder { +@@ -706,11 +859,11 @@ class NodeBuilder { return this; } @@ -1676,7 +1685,7 @@ index 64472992..a7600328 100644 const output = node.getNodeType(this); const flowData = this.flowChildNode(node, output); -@@ -703,7 +856,9 @@ class NodeBuilder { +@@ -720,7 +873,9 @@ class NodeBuilder { return flowData; } @@ -1687,7 +1696,7 @@ index 64472992..a7600328 100644 const fn = new FunctionNode(); const previous = this.currentFunctionNode; -@@ -717,7 +872,7 @@ class NodeBuilder { +@@ -734,7 +889,7 @@ class NodeBuilder { return fn; } @@ -1696,7 +1705,7 @@ index 64472992..a7600328 100644 const layout = shaderNode.layout; let inputs; -@@ -725,13 +880,13 @@ class NodeBuilder { +@@ -742,13 +897,13 @@ class NodeBuilder { if (shaderNode.isArrayInput) { inputs = []; @@ -1712,7 +1721,7 @@ index 64472992..a7600328 100644 inputs[input.name] = new ParameterNode(input.type, input.name); } } -@@ -748,14 +903,14 @@ class NodeBuilder { +@@ -765,14 +920,14 @@ class NodeBuilder { return flowData; } @@ -1729,7 +1738,7 @@ index 64472992..a7600328 100644 code: '', }; -@@ -770,7 +925,7 @@ class NodeBuilder { +@@ -787,7 +942,7 @@ class NodeBuilder { flow.result = node.build(this, output); } @@ -1738,7 +1747,7 @@ index 64472992..a7600328 100644 this.flow = previousFlow; this.vars = previousVars; -@@ -786,10 +941,10 @@ class NodeBuilder { +@@ -803,10 +958,10 @@ class NodeBuilder { return null; } @@ -1751,7 +1760,7 @@ index 64472992..a7600328 100644 code: '', }; -@@ -802,7 +957,12 @@ class NodeBuilder { +@@ -819,7 +974,12 @@ class NodeBuilder { return flow; } @@ -1765,7 +1774,7 @@ index 64472992..a7600328 100644 const previousShaderStage = this.shaderStage; this.setShaderStage(shaderStage); -@@ -824,19 +984,15 @@ class NodeBuilder { +@@ -841,19 +1001,15 @@ class NodeBuilder { return this.attributes.concat(this.bufferAttributes); } @@ -1789,7 +1798,7 @@ index 64472992..a7600328 100644 let snippet = ''; const vars = this.vars[shaderStage]; -@@ -850,11 +1006,9 @@ class NodeBuilder { +@@ -867,11 +1023,9 @@ class NodeBuilder { return snippet; } @@ -1803,7 +1812,7 @@ index 64472992..a7600328 100644 const codes = this.codes[shaderStage]; let code = ''; -@@ -869,10 +1023,10 @@ class NodeBuilder { +@@ -886,10 +1040,10 @@ class NodeBuilder { } getHash() { @@ -1816,7 +1825,7 @@ index 64472992..a7600328 100644 this.shaderStage = shaderStage; } -@@ -880,7 +1034,7 @@ class NodeBuilder { +@@ -897,7 +1051,7 @@ class NodeBuilder { return this.shaderStage; } @@ -1825,7 +1834,7 @@ index 64472992..a7600328 100644 this.buildStage = buildStage; } -@@ -938,7 +1092,7 @@ class NodeBuilder { +@@ -955,7 +1109,7 @@ class NodeBuilder { return this; } @@ -1834,7 +1843,7 @@ index 64472992..a7600328 100644 if (type === 'float' || type === 'int' || type === 'uint') return new NumberNodeUniform(uniformNode); if (type === 'vec2' || type === 'ivec2' || type === 'uvec2') return new Vector2NodeUniform(uniformNode); if (type === 'vec3' || type === 'ivec3' || type === 'uvec3') return new Vector3NodeUniform(uniformNode); -@@ -956,7 +1110,7 @@ class NodeBuilder { +@@ -973,7 +1127,7 @@ class NodeBuilder { return createNodeMaterialFromType(type); } @@ -7234,7 +7243,7 @@ index 97a42577..4491def1 100644 } diff --git a/examples-jsm/examples/renderers/webgpu/nodes/WGSLNodeBuilder.ts b/examples-jsm/examples/renderers/webgpu/nodes/WGSLNodeBuilder.ts -index 31885165..9e94705b 100644 +index b2e4437e..f6b2da51 100644 --- a/examples-jsm/examples/renderers/webgpu/nodes/WGSLNodeBuilder.ts +++ b/examples-jsm/examples/renderers/webgpu/nodes/WGSLNodeBuilder.ts @@ -1,4 +1,4 @@ @@ -7274,7 +7283,7 @@ index 31885165..9e94705b 100644 if (shaderStage === 'fragment') { if (depthSnippet) { return `textureSample( ${textureProperty}, ${textureProperty}_sampler, ${uvSnippet}, ${depthSnippet} )`; -@@ -216,7 +224,12 @@ class WGSLNodeBuilder extends NodeBuilder { +@@ -220,7 +228,12 @@ class WGSLNodeBuilder extends NodeBuilder { return `threejs_biquadraticTexture( ${textureProperty}, ${uvSnippet}, i32( ${levelSnippet} ) )`; } @@ -7288,7 +7297,7 @@ index 31885165..9e94705b 100644 this._include('repeatWrapping'); const dimension = `textureDimensions( ${textureProperty}, 0 )`; -@@ -224,7 +237,13 @@ class WGSLNodeBuilder extends NodeBuilder { +@@ -228,7 +241,13 @@ class WGSLNodeBuilder extends NodeBuilder { return `textureLoad( ${textureProperty}, threejs_repeatWrapping( ${uvSnippet}, ${dimension} ), i32( ${levelSnippet} ) )`; } @@ -7303,7 +7312,7 @@ index 31885165..9e94705b 100644 if (depthSnippet) { return `textureLoad( ${textureProperty}, ${uvIndexSnippet}, ${depthSnippet}, ${levelSnippet} )`; } else { -@@ -258,11 +277,11 @@ class WGSLNodeBuilder extends NodeBuilder { +@@ -262,11 +281,11 @@ class WGSLNodeBuilder extends NodeBuilder { } generateTextureGrad( @@ -7320,7 +7329,7 @@ index 31885165..9e94705b 100644 shaderStage = this.shaderStage, ) { if (shaderStage === 'fragment') { -@@ -274,11 +293,11 @@ class WGSLNodeBuilder extends NodeBuilder { +@@ -278,11 +297,11 @@ class WGSLNodeBuilder extends NodeBuilder { } generateTextureCompare( @@ -7337,7 +7346,7 @@ index 31885165..9e94705b 100644 shaderStage = this.shaderStage, ) { if (shaderStage === 'fragment') { -@@ -291,11 +310,11 @@ class WGSLNodeBuilder extends NodeBuilder { +@@ -295,11 +314,11 @@ class WGSLNodeBuilder extends NodeBuilder { } generateTextureLevel( @@ -7354,7 +7363,7 @@ index 31885165..9e94705b 100644 shaderStage = this.shaderStage, ) { let snippet = null; -@@ -316,7 +335,7 @@ class WGSLNodeBuilder extends NodeBuilder { +@@ -320,7 +339,7 @@ class WGSLNodeBuilder extends NodeBuilder { return snippet; } @@ -7363,7 +7372,7 @@ index 31885165..9e94705b 100644 if (node.isNodeVarying === true && node.needsInterpolation === true) { if (shaderStage === 'vertex') { return `varyings.${node.name}`; -@@ -378,7 +397,12 @@ class WGSLNodeBuilder extends NodeBuilder { +@@ -382,7 +401,12 @@ class WGSLNodeBuilder extends NodeBuilder { } } @@ -7377,7 +7386,7 @@ index 31885165..9e94705b 100644 const uniformNode = super.getUniformFromNode(node, type, shaderStage, name); const nodeData = this.getDataFromNode(node, shaderStage, this.globalCache); -@@ -502,7 +526,7 @@ class WGSLNodeBuilder extends NodeBuilder { +@@ -495,7 +519,7 @@ class WGSLNodeBuilder extends NodeBuilder { return 'vertexIndex'; } @@ -7386,7 +7395,7 @@ index 31885165..9e94705b 100644 const layout = shaderNode.layout; const flowData = this.flowShaderNode(shaderNode); -@@ -563,8 +587,8 @@ ${flowData.code} +@@ -556,8 +580,8 @@ ${flowData.code} return snippets.join(',\n\t'); } @@ -7397,7 +7406,7 @@ index 31885165..9e94705b 100644 if (shaderStage === 'compute') { this.getBuiltin('global_invocation_id', 'id', 'vec3', 'attribute'); -@@ -642,8 +666,8 @@ ${flowData.code} +@@ -635,8 +659,8 @@ ${flowData.code} return `\n${snippets.join('\n')}\n`; } @@ -7408,7 +7417,7 @@ index 31885165..9e94705b 100644 if (shaderStage === 'vertex') { this.getBuiltin('position', 'Vertex', 'vec4', 'vertex'); -@@ -679,7 +703,7 @@ ${flowData.code} +@@ -672,7 +696,7 @@ ${flowData.code} return shaderStage === 'vertex' ? this._getWGSLStruct('VaryingsStruct', '\t' + code) : code; } @@ -7418,10 +7427,10 @@ index 31885165..9e94705b 100644 const bindingSnippets = []; diff --git a/examples-jsm/examples/renderers/webgpu/nodes/WGSLNodeFunction.ts b/examples-jsm/examples/renderers/webgpu/nodes/WGSLNodeFunction.ts -index 3abfc4ad..b68c95bb 100644 +index c96f6407..4f3d4e49 100644 --- a/examples-jsm/examples/renderers/webgpu/nodes/WGSLNodeFunction.ts +++ b/examples-jsm/examples/renderers/webgpu/nodes/WGSLNodeFunction.ts -@@ -68,7 +68,7 @@ const parse = source => { +@@ -105,7 +105,7 @@ const parse = source => { }; class WGSLNodeFunction extends NodeFunction { diff --git a/three.js b/three.js index 4d57598ea..2328b0a75 160000 --- a/three.js +++ b/three.js @@ -1 +1 @@ -Subproject commit 4d57598ea8a90489d1dc7a86312bdf348daa37a8 +Subproject commit 2328b0a75c6280a907d527c47f151971eacde778 diff --git a/types/three/examples/jsm/nodes/core/NodeBuilder.d.ts b/types/three/examples/jsm/nodes/core/NodeBuilder.d.ts index 06c80670a..01b90507e 100644 --- a/types/three/examples/jsm/nodes/core/NodeBuilder.d.ts +++ b/types/three/examples/jsm/nodes/core/NodeBuilder.d.ts @@ -1,4 +1,4 @@ -import { BufferGeometry, Material, Object3D, Renderer } from "three"; +import { BufferGeometry, Material, Object3D, Renderer, Texture } from "three"; import FogNode from "../fog/FogNode.js"; import LightsNode from "../lighting/LightsNode.js"; import { NodeShaderStage } from "./constants.js"; @@ -58,6 +58,7 @@ export default abstract class NodeBuilder { setHashNode(node: Node, hash: string): void; addNode(node: Node): void; get currentNode(): Node; + isFilteredTexture(texture: Texture): boolean; getMethod(method: string): string; getNodeFromHash(hash: string): Node;