|
|
@@ -7278,23 +7278,6 @@ const inverse = /*@__PURE__*/ nodeProxyIntent( MathNode, MathNode.INVERSE ).setP
|
|
|
|
|
|
// 2 inputs
|
|
|
|
|
|
-/**
|
|
|
- * Returns `true` if `x` equals `y`.
|
|
|
- *
|
|
|
- * @tsl
|
|
|
- * @function
|
|
|
- * @param {Node | number} x - The first parameter.
|
|
|
- * @param {Node | number} y - The second parameter.
|
|
|
- * @deprecated since r175. Use {@link equal} instead.
|
|
|
- * @returns {Node<bool>}
|
|
|
- */
|
|
|
-const equals = ( x, y ) => { // @deprecated, r172
|
|
|
-
|
|
|
- warn( 'TSL: "equals" is deprecated. Use "equal" inside a vector instead, like: "bvec*( equal( ... ) )"' );
|
|
|
- return equal( x, y );
|
|
|
-
|
|
|
-};
|
|
|
-
|
|
|
/**
|
|
|
* Returns the least of the given values.
|
|
|
*
|
|
|
@@ -7575,24 +7558,6 @@ const smoothstepElement = ( x, low, high ) => smoothstep( low, high, x );
|
|
|
*/
|
|
|
const stepElement = ( x, edge ) => step( edge, x );
|
|
|
|
|
|
-/**
|
|
|
- * Returns the arc-tangent of the quotient of its parameters.
|
|
|
- *
|
|
|
- * @tsl
|
|
|
- * @function
|
|
|
- * @deprecated since r172. Use {@link atan} instead.
|
|
|
- *
|
|
|
- * @param {Node | number} y - The y parameter.
|
|
|
- * @param {Node | number} x - The x parameter.
|
|
|
- * @returns {Node}
|
|
|
- */
|
|
|
-const atan2 = ( y, x ) => { // @deprecated, r172
|
|
|
-
|
|
|
- warn( 'TSL: "atan2" is overloaded. Use "atan" instead.' );
|
|
|
- return atan( y, x );
|
|
|
-
|
|
|
-};
|
|
|
-
|
|
|
// GLSL alias function
|
|
|
|
|
|
const faceforward = faceForward;
|
|
|
@@ -7602,7 +7567,6 @@ const inversesqrt = inverseSqrt;
|
|
|
|
|
|
addMethodChaining( 'all', all );
|
|
|
addMethodChaining( 'any', any );
|
|
|
-addMethodChaining( 'equals', equals );
|
|
|
|
|
|
addMethodChaining( 'radians', radians );
|
|
|
addMethodChaining( 'degrees', degrees );
|
|
|
@@ -7634,7 +7598,6 @@ addMethodChaining( 'round', round );
|
|
|
addMethodChaining( 'reciprocal', reciprocal );
|
|
|
addMethodChaining( 'trunc', trunc );
|
|
|
addMethodChaining( 'fwidth', fwidth );
|
|
|
-addMethodChaining( 'atan2', atan2 );
|
|
|
addMethodChaining( 'min', min$1 );
|
|
|
addMethodChaining( 'max', max$1 );
|
|
|
addMethodChaining( 'step', stepElement );
|
|
|
@@ -12146,21 +12109,6 @@ class TextureNode extends UniformNode {
|
|
|
|
|
|
// @TODO: Move to TSL
|
|
|
|
|
|
- /**
|
|
|
- * @function
|
|
|
- * @deprecated since r172. Use {@link TextureNode#sample} instead.
|
|
|
- *
|
|
|
- * @param {Node} uvNode - The uv node.
|
|
|
- * @return {TextureNode} A texture node representing the texture sample.
|
|
|
- */
|
|
|
- uv( uvNode ) { // @deprecated, r172
|
|
|
-
|
|
|
- warn( 'TextureNode: .uv() has been renamed. Use .sample() instead.' );
|
|
|
-
|
|
|
- return this.sample( uvNode );
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* Samples the texture with the given uv node.
|
|
|
*
|
|
|
@@ -17025,24 +16973,6 @@ class StorageBufferNode extends BufferNode {
|
|
|
*/
|
|
|
const storage = ( value, type = null, count = 0 ) => new StorageBufferNode( value, type, count );
|
|
|
|
|
|
-/**
|
|
|
- * @tsl
|
|
|
- * @function
|
|
|
- * @deprecated since r171. Use `storage().setPBO( true )` instead.
|
|
|
- *
|
|
|
- * @param {StorageBufferAttribute|StorageInstancedBufferAttribute|BufferAttribute} value - The buffer data.
|
|
|
- * @param {?string} type - The buffer type (e.g. `'vec3'`).
|
|
|
- * @param {number} count - The buffer count.
|
|
|
- * @returns {StorageBufferNode}
|
|
|
- */
|
|
|
-const storageObject = ( value, type, count ) => { // @deprecated, r171
|
|
|
-
|
|
|
- warn( 'TSL: "storageObject()" is deprecated. Use "storage().setPBO( true )" instead.' );
|
|
|
-
|
|
|
- return storage( value, type, count ).setPBO( true );
|
|
|
-
|
|
|
-};
|
|
|
-
|
|
|
/**
|
|
|
* This class represents shader indices of different types. The following predefined node
|
|
|
* objects cover frequent use cases:
|
|
|
@@ -20002,69 +19932,6 @@ const unpremultiplyAlpha = /*@__PURE__*/ Fn( ( [ color ] ) => {
|
|
|
|
|
|
}, { color: 'vec4', return: 'vec4' } );
|
|
|
|
|
|
-
|
|
|
-// Deprecated
|
|
|
-
|
|
|
-/**
|
|
|
- * @tsl
|
|
|
- * @function
|
|
|
- * @deprecated since r171. Use {@link blendBurn} instead.
|
|
|
- *
|
|
|
- * @param {...any} params
|
|
|
- * @returns {Function}
|
|
|
- */
|
|
|
-const burn = ( ...params ) => { // @deprecated, r171
|
|
|
-
|
|
|
- warn( 'TSL: "burn" has been renamed. Use "blendBurn" instead.' );
|
|
|
- return blendBurn( params );
|
|
|
-
|
|
|
-};
|
|
|
-
|
|
|
-/**
|
|
|
- * @tsl
|
|
|
- * @function
|
|
|
- * @deprecated since r171. Use {@link blendDodge} instead.
|
|
|
- *
|
|
|
- * @param {...any} params
|
|
|
- * @returns {Function}
|
|
|
- */
|
|
|
-const dodge = ( ...params ) => { // @deprecated, r171
|
|
|
-
|
|
|
- warn( 'TSL: "dodge" has been renamed. Use "blendDodge" instead.' );
|
|
|
- return blendDodge( params );
|
|
|
-
|
|
|
-};
|
|
|
-
|
|
|
-/**
|
|
|
- * @tsl
|
|
|
- * @function
|
|
|
- * @deprecated since r171. Use {@link blendScreen} instead.
|
|
|
- *
|
|
|
- * @param {...any} params
|
|
|
- * @returns {Function}
|
|
|
- */
|
|
|
-const screen = ( ...params ) => { // @deprecated, r171
|
|
|
-
|
|
|
- warn( 'TSL: "screen" has been renamed. Use "blendScreen" instead.' );
|
|
|
- return blendScreen( params );
|
|
|
-
|
|
|
-};
|
|
|
-
|
|
|
-/**
|
|
|
- * @tsl
|
|
|
- * @function
|
|
|
- * @deprecated since r171. Use {@link blendOverlay} instead.
|
|
|
- *
|
|
|
- * @param {...any} params
|
|
|
- * @returns {Function}
|
|
|
- */
|
|
|
-const overlay = ( ...params ) => { // @deprecated, r171
|
|
|
-
|
|
|
- warn( 'TSL: "overlay" has been renamed. Use "blendOverlay" instead.' );
|
|
|
- return blendOverlay( params );
|
|
|
-
|
|
|
-};
|
|
|
-
|
|
|
/**
|
|
|
* Base class for all node materials.
|
|
|
*
|
|
|
@@ -29653,7 +29520,7 @@ class RenderObject {
|
|
|
|
|
|
}
|
|
|
|
|
|
- cacheKey = hash$1( cacheKey, this.camera.id, this.renderer.contextNode.id, this.renderer.contextNode.version );
|
|
|
+ cacheKey = hash$1( cacheKey, this.renderer.contextNode.id, this.renderer.contextNode.version );
|
|
|
|
|
|
return cacheKey;
|
|
|
|
|
|
@@ -29684,7 +29551,7 @@ class RenderObject {
|
|
|
|
|
|
}
|
|
|
|
|
|
-const _chainKeys$4 = [];
|
|
|
+const _chainKeys$3 = [];
|
|
|
|
|
|
/**
|
|
|
* This module manages the render objects of the renderer.
|
|
|
@@ -29774,22 +29641,31 @@ class RenderObjects {
|
|
|
|
|
|
const chainMap = this.getChainMap( passId );
|
|
|
|
|
|
- // reuse chainArray
|
|
|
- _chainKeys$4[ 0 ] = object;
|
|
|
- _chainKeys$4[ 1 ] = material;
|
|
|
- _chainKeys$4[ 2 ] = renderContext;
|
|
|
- _chainKeys$4[ 3 ] = lightsNode;
|
|
|
+ // set chain keys
|
|
|
|
|
|
- let renderObject = chainMap.get( _chainKeys$4 );
|
|
|
+ _chainKeys$3[ 0 ] = object;
|
|
|
+ _chainKeys$3[ 1 ] = material;
|
|
|
+ _chainKeys$3[ 2 ] = renderContext;
|
|
|
+ _chainKeys$3[ 3 ] = lightsNode;
|
|
|
+
|
|
|
+ //
|
|
|
+
|
|
|
+ let renderObject = chainMap.get( _chainKeys$3 );
|
|
|
|
|
|
if ( renderObject === undefined ) {
|
|
|
|
|
|
renderObject = this.createRenderObject( this.nodes, this.geometries, this.renderer, object, material, scene, camera, lightsNode, renderContext, clippingContext, passId );
|
|
|
|
|
|
- chainMap.set( _chainKeys$4, renderObject );
|
|
|
+ chainMap.set( _chainKeys$3, renderObject );
|
|
|
|
|
|
} else {
|
|
|
|
|
|
+ // update references
|
|
|
+
|
|
|
+ renderObject.camera = camera;
|
|
|
+
|
|
|
+ //
|
|
|
+
|
|
|
renderObject.updateClipping( clippingContext );
|
|
|
|
|
|
if ( renderObject.needsGeometryUpdate ) {
|
|
|
@@ -29816,7 +29692,14 @@ class RenderObjects {
|
|
|
|
|
|
}
|
|
|
|
|
|
- _chainKeys$4.length = 0;
|
|
|
+ // reset chain array
|
|
|
+
|
|
|
+ _chainKeys$3[ 0 ] = null;
|
|
|
+ _chainKeys$3[ 1 ] = null;
|
|
|
+ _chainKeys$3[ 2 ] = null;
|
|
|
+ _chainKeys$3[ 3 ] = null;
|
|
|
+
|
|
|
+ //
|
|
|
|
|
|
return renderObject;
|
|
|
|
|
|
@@ -31650,6 +31533,12 @@ class Bindings extends DataMap {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ if ( binding.isBuffer && binding.updateRanges.length > 0 ) {
|
|
|
+
|
|
|
+ binding.clearUpdateRanges();
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
if ( needsBindingsUpdate === true ) {
|
|
|
@@ -32063,7 +31952,7 @@ class RenderList {
|
|
|
|
|
|
}
|
|
|
|
|
|
-const _chainKeys$3 = [];
|
|
|
+const _chainKeys$2 = [];
|
|
|
|
|
|
/**
|
|
|
* This renderer module manages the render lists which are unique
|
|
|
@@ -32107,19 +31996,19 @@ class RenderLists {
|
|
|
|
|
|
const lists = this.lists;
|
|
|
|
|
|
- _chainKeys$3[ 0 ] = scene;
|
|
|
- _chainKeys$3[ 1 ] = camera;
|
|
|
+ _chainKeys$2[ 0 ] = scene;
|
|
|
+ _chainKeys$2[ 1 ] = camera;
|
|
|
|
|
|
- let list = lists.get( _chainKeys$3 );
|
|
|
+ let list = lists.get( _chainKeys$2 );
|
|
|
|
|
|
if ( list === undefined ) {
|
|
|
|
|
|
list = new RenderList( this.lighting, scene, camera );
|
|
|
- lists.set( _chainKeys$3, list );
|
|
|
+ lists.set( _chainKeys$2, list );
|
|
|
|
|
|
}
|
|
|
|
|
|
- _chainKeys$3.length = 0;
|
|
|
+ _chainKeys$2.length = 0;
|
|
|
|
|
|
return list;
|
|
|
|
|
|
@@ -40990,41 +40879,6 @@ const fog = Fn( ( [ color, factor ] ) => {
|
|
|
|
|
|
} );
|
|
|
|
|
|
-// Deprecated
|
|
|
-
|
|
|
-/**
|
|
|
- * @tsl
|
|
|
- * @function
|
|
|
- * @deprecated since r171. Use `fog( color, rangeFogFactor( near, far ) )` instead.
|
|
|
- *
|
|
|
- * @param {Node} color
|
|
|
- * @param {Node} near
|
|
|
- * @param {Node} far
|
|
|
- * @returns {Function}
|
|
|
- */
|
|
|
-function rangeFog( color, near, far ) { // @deprecated, r171
|
|
|
-
|
|
|
- warn( 'TSL: "rangeFog( color, near, far )" is deprecated. Use "fog( color, rangeFogFactor( near, far ) )" instead.' );
|
|
|
- return fog( color, rangeFogFactor( near, far ) );
|
|
|
-
|
|
|
-}
|
|
|
-
|
|
|
-/**
|
|
|
- * @tsl
|
|
|
- * @function
|
|
|
- * @deprecated since r171. Use `fog( color, densityFogFactor( density ) )` instead.
|
|
|
- *
|
|
|
- * @param {Node} color
|
|
|
- * @param {Node} density
|
|
|
- * @returns {Function}
|
|
|
- */
|
|
|
-function densityFog( color, density ) { // @deprecated, r171
|
|
|
-
|
|
|
- warn( 'TSL: "densityFog( color, density )" is deprecated. Use "fog( color, densityFogFactor( density ) )" instead.' );
|
|
|
- return fog( color, densityFogFactor( density ) );
|
|
|
-
|
|
|
-}
|
|
|
-
|
|
|
let min = null;
|
|
|
let max = null;
|
|
|
|
|
|
@@ -44202,12 +44056,6 @@ class ShadowNode extends ShadowBaseNode {
|
|
|
|
|
|
}
|
|
|
|
|
|
- if ( builder.material.shadowNode ) { // @deprecated, r171
|
|
|
-
|
|
|
- warn( 'NodeMaterial: ".shadowNode" is deprecated. Use ".castShadowNode" instead.' );
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
if ( builder.material.receivedShadowNode ) {
|
|
|
|
|
|
node = builder.material.receivedShadowNode( node );
|
|
|
@@ -47140,7 +46988,6 @@ var TSL = /*#__PURE__*/Object.freeze({
|
|
|
asin: asin,
|
|
|
assign: assign,
|
|
|
atan: atan,
|
|
|
- atan2: atan2,
|
|
|
atomicAdd: atomicAdd,
|
|
|
atomicAnd: atomicAnd,
|
|
|
atomicFunc: atomicFunc,
|
|
|
@@ -47183,7 +47030,6 @@ var TSL = /*#__PURE__*/Object.freeze({
|
|
|
builtinAOContext: builtinAOContext,
|
|
|
builtinShadowContext: builtinShadowContext,
|
|
|
bumpMap: bumpMap,
|
|
|
- burn: burn,
|
|
|
bvec2: bvec2,
|
|
|
bvec3: bvec3,
|
|
|
bvec4: bvec4,
|
|
|
@@ -47238,7 +47084,6 @@ var TSL = /*#__PURE__*/Object.freeze({
|
|
|
defined: defined,
|
|
|
degrees: degrees,
|
|
|
deltaTime: deltaTime,
|
|
|
- densityFog: densityFog,
|
|
|
densityFogFactor: densityFogFactor,
|
|
|
depth: depth,
|
|
|
depthPass: depthPass,
|
|
|
@@ -47253,14 +47098,12 @@ var TSL = /*#__PURE__*/Object.freeze({
|
|
|
disposeShadowMaterial: disposeShadowMaterial,
|
|
|
distance: distance,
|
|
|
div: div,
|
|
|
- dodge: dodge,
|
|
|
dot: dot,
|
|
|
drawIndex: drawIndex,
|
|
|
dynamicBufferAttribute: dynamicBufferAttribute,
|
|
|
element: element,
|
|
|
emissive: emissive,
|
|
|
equal: equal,
|
|
|
- equals: equals,
|
|
|
equirectUV: equirectUV,
|
|
|
exp: exp,
|
|
|
exp2: exp2,
|
|
|
@@ -47499,7 +47342,6 @@ var TSL = /*#__PURE__*/Object.freeze({
|
|
|
oscTriangle: oscTriangle,
|
|
|
output: output,
|
|
|
outputStruct: outputStruct,
|
|
|
- overlay: overlay,
|
|
|
overloadingFn: overloadingFn,
|
|
|
packHalf2x16: packHalf2x16,
|
|
|
packSnorm2x16: packSnorm2x16,
|
|
|
@@ -47537,7 +47379,6 @@ var TSL = /*#__PURE__*/Object.freeze({
|
|
|
radians: radians,
|
|
|
rand: rand,
|
|
|
range: range,
|
|
|
- rangeFog: rangeFog,
|
|
|
rangeFogFactor: rangeFogFactor,
|
|
|
reciprocal: reciprocal,
|
|
|
reference: reference,
|
|
|
@@ -47568,7 +47409,6 @@ var TSL = /*#__PURE__*/Object.freeze({
|
|
|
samplerComparison: samplerComparison,
|
|
|
saturate: saturate,
|
|
|
saturation: saturation,
|
|
|
- screen: screen,
|
|
|
screenCoordinate: screenCoordinate,
|
|
|
screenDPR: screenDPR,
|
|
|
screenSize: screenSize,
|
|
|
@@ -47606,7 +47446,6 @@ var TSL = /*#__PURE__*/Object.freeze({
|
|
|
stepElement: stepElement,
|
|
|
storage: storage,
|
|
|
storageBarrier: storageBarrier,
|
|
|
- storageObject: storageObject,
|
|
|
storageTexture: storageTexture,
|
|
|
string: string,
|
|
|
struct: struct,
|
|
|
@@ -48592,6 +48431,14 @@ class Uniform {
|
|
|
*/
|
|
|
this.offset = 0;
|
|
|
|
|
|
+ /**
|
|
|
+ * This property is set by {@link UniformsGroup} and marks
|
|
|
+ * the index position in the uniform array.
|
|
|
+ *
|
|
|
+ * @type {number}
|
|
|
+ */
|
|
|
+ this.index = -1;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -53649,7 +53496,7 @@ class GLSLNodeParser extends NodeParser {
|
|
|
}
|
|
|
|
|
|
const _outputNodeMap = new WeakMap();
|
|
|
-const _chainKeys$2 = [];
|
|
|
+const _chainKeys$1 = [];
|
|
|
const _cacheKeyValues = [];
|
|
|
|
|
|
/**
|
|
|
@@ -53778,13 +53625,13 @@ class Nodes extends DataMap {
|
|
|
|
|
|
// other groups are updated just when groupNode.needsUpdate is true
|
|
|
|
|
|
- _chainKeys$2[ 0 ] = groupNode;
|
|
|
- _chainKeys$2[ 1 ] = nodeUniformsGroup;
|
|
|
+ _chainKeys$1[ 0 ] = groupNode;
|
|
|
+ _chainKeys$1[ 1 ] = nodeUniformsGroup;
|
|
|
|
|
|
- let groupData = this.groupsData.get( _chainKeys$2 );
|
|
|
- if ( groupData === undefined ) this.groupsData.set( _chainKeys$2, groupData = {} );
|
|
|
+ let groupData = this.groupsData.get( _chainKeys$1 );
|
|
|
+ if ( groupData === undefined ) this.groupsData.set( _chainKeys$1, groupData = {} );
|
|
|
|
|
|
- _chainKeys$2.length = 0;
|
|
|
+ _chainKeys$1.length = 0;
|
|
|
|
|
|
if ( groupData.version !== groupNode.version ) {
|
|
|
|
|
|
@@ -54052,12 +53899,12 @@ class Nodes extends DataMap {
|
|
|
*/
|
|
|
getCacheKey( scene, lightsNode ) {
|
|
|
|
|
|
- _chainKeys$2[ 0 ] = scene;
|
|
|
- _chainKeys$2[ 1 ] = lightsNode;
|
|
|
+ _chainKeys$1[ 0 ] = scene;
|
|
|
+ _chainKeys$1[ 1 ] = lightsNode;
|
|
|
|
|
|
const callId = this.renderer.info.calls;
|
|
|
|
|
|
- const cacheKeyData = this.callHashCache.get( _chainKeys$2 ) || {};
|
|
|
+ const cacheKeyData = this.callHashCache.get( _chainKeys$1 ) || {};
|
|
|
|
|
|
if ( cacheKeyData.callId !== callId ) {
|
|
|
|
|
|
@@ -54075,13 +53922,13 @@ class Nodes extends DataMap {
|
|
|
cacheKeyData.callId = callId;
|
|
|
cacheKeyData.cacheKey = hashArray( _cacheKeyValues );
|
|
|
|
|
|
- this.callHashCache.set( _chainKeys$2, cacheKeyData );
|
|
|
+ this.callHashCache.set( _chainKeys$1, cacheKeyData );
|
|
|
|
|
|
_cacheKeyValues.length = 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
- _chainKeys$2.length = 0;
|
|
|
+ _chainKeys$1.length = 0;
|
|
|
|
|
|
return cacheKeyData.cacheKey;
|
|
|
|
|
|
@@ -54754,7 +54601,7 @@ class RenderBundle {
|
|
|
|
|
|
}
|
|
|
|
|
|
-const _chainKeys$1 = [];
|
|
|
+const _chainKeys = [];
|
|
|
|
|
|
/**
|
|
|
* This renderer module manages render bundles.
|
|
|
@@ -54788,19 +54635,19 @@ class RenderBundles {
|
|
|
|
|
|
const bundles = this.bundles;
|
|
|
|
|
|
- _chainKeys$1[ 0 ] = bundleGroup;
|
|
|
- _chainKeys$1[ 1 ] = camera;
|
|
|
+ _chainKeys[ 0 ] = bundleGroup;
|
|
|
+ _chainKeys[ 1 ] = camera;
|
|
|
|
|
|
- let bundle = bundles.get( _chainKeys$1 );
|
|
|
+ let bundle = bundles.get( _chainKeys );
|
|
|
|
|
|
if ( bundle === undefined ) {
|
|
|
|
|
|
bundle = new RenderBundle( bundleGroup, camera );
|
|
|
- bundles.set( _chainKeys$1, bundle );
|
|
|
+ bundles.set( _chainKeys, bundle );
|
|
|
|
|
|
}
|
|
|
|
|
|
- _chainKeys$1.length = 0;
|
|
|
+ _chainKeys.length = 0;
|
|
|
|
|
|
return bundle;
|
|
|
|
|
|
@@ -55011,7 +54858,7 @@ class NodeLibrary {
|
|
|
}
|
|
|
|
|
|
const _defaultLights = /*@__PURE__*/ new LightsNode();
|
|
|
-const _chainKeys = [];
|
|
|
+const _weakMap = /*@__PURE__*/ new WeakMap();
|
|
|
|
|
|
/**
|
|
|
* This renderer module manages the lights nodes which are unique
|
|
|
@@ -55021,18 +54868,8 @@ const _chainKeys = [];
|
|
|
* with the actual lights from the scene.
|
|
|
*
|
|
|
* @private
|
|
|
- * @augments ChainMap
|
|
|
*/
|
|
|
-class Lighting extends ChainMap {
|
|
|
-
|
|
|
- /**
|
|
|
- * Constructs a lighting management component.
|
|
|
- */
|
|
|
- constructor() {
|
|
|
-
|
|
|
- super();
|
|
|
-
|
|
|
- }
|
|
|
+class Lighting {
|
|
|
|
|
|
/**
|
|
|
* Creates a new lights node for the given array of lights.
|
|
|
@@ -55053,26 +54890,21 @@ class Lighting extends ChainMap {
|
|
|
* @param {Camera} camera - The camera.
|
|
|
* @return {LightsNode} The lights node.
|
|
|
*/
|
|
|
- getNode( scene, camera ) {
|
|
|
+ getNode( scene ) {
|
|
|
|
|
|
// ignore post-processing
|
|
|
|
|
|
if ( scene.isQuadMesh ) return _defaultLights;
|
|
|
|
|
|
- _chainKeys[ 0 ] = scene;
|
|
|
- _chainKeys[ 1 ] = camera;
|
|
|
-
|
|
|
- let node = this.get( _chainKeys );
|
|
|
+ let node = _weakMap.get( scene );
|
|
|
|
|
|
if ( node === undefined ) {
|
|
|
|
|
|
node = this.createNode();
|
|
|
- this.set( _chainKeys, node );
|
|
|
+ _weakMap.set( scene, node );
|
|
|
|
|
|
}
|
|
|
|
|
|
- _chainKeys.length = 0;
|
|
|
-
|
|
|
return node;
|
|
|
|
|
|
}
|
|
|
@@ -60845,6 +60677,51 @@ class UniformsGroup extends UniformBuffer {
|
|
|
*/
|
|
|
this.uniforms = [];
|
|
|
|
|
|
+ /**
|
|
|
+ * A cache for the uniform update ranges.
|
|
|
+ *
|
|
|
+ * @private
|
|
|
+ * @type {Map<number, {start: number, count: number}>}
|
|
|
+ */
|
|
|
+ this._updateRangeCache = new Map();
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Adds a uniform's update range to this buffer.
|
|
|
+ *
|
|
|
+ * @param {Uniform} uniform - The uniform.
|
|
|
+ */
|
|
|
+ addUniformUpdateRange( uniform ) {
|
|
|
+
|
|
|
+ const index = uniform.index;
|
|
|
+
|
|
|
+ if ( this._updateRangeCache.has( index ) !== true ) {
|
|
|
+
|
|
|
+ const updateRanges = this.updateRanges;
|
|
|
+
|
|
|
+ const start = uniform.offset;
|
|
|
+ const count = uniform.itemSize;
|
|
|
+
|
|
|
+ const range = { start, count };
|
|
|
+
|
|
|
+ updateRanges.push( range );
|
|
|
+
|
|
|
+ this._updateRangeCache.set( index, range );
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Clears all update ranges of this buffer.
|
|
|
+ */
|
|
|
+ clearUpdateRanges() {
|
|
|
+
|
|
|
+ this._updateRangeCache.clear();
|
|
|
+
|
|
|
+ super.clearUpdateRanges();
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -60954,6 +60831,7 @@ class UniformsGroup extends UniformBuffer {
|
|
|
}
|
|
|
|
|
|
uniform.offset = offset / bytesPerElement;
|
|
|
+ uniform.index = i;
|
|
|
|
|
|
offset += itemSize;
|
|
|
|
|
|
@@ -61033,6 +60911,8 @@ class UniformsGroup extends UniformBuffer {
|
|
|
b[ offset ] = a[ offset ] = v;
|
|
|
updated = true;
|
|
|
|
|
|
+ this.addUniformUpdateRange( uniform );
|
|
|
+
|
|
|
}
|
|
|
|
|
|
return updated;
|
|
|
@@ -61063,6 +60943,8 @@ class UniformsGroup extends UniformBuffer {
|
|
|
|
|
|
updated = true;
|
|
|
|
|
|
+ this.addUniformUpdateRange( uniform );
|
|
|
+
|
|
|
}
|
|
|
|
|
|
return updated;
|
|
|
@@ -61094,6 +60976,8 @@ class UniformsGroup extends UniformBuffer {
|
|
|
|
|
|
updated = true;
|
|
|
|
|
|
+ this.addUniformUpdateRange( uniform );
|
|
|
+
|
|
|
}
|
|
|
|
|
|
return updated;
|
|
|
@@ -61126,6 +61010,8 @@ class UniformsGroup extends UniformBuffer {
|
|
|
|
|
|
updated = true;
|
|
|
|
|
|
+ this.addUniformUpdateRange( uniform );
|
|
|
+
|
|
|
}
|
|
|
|
|
|
return updated;
|
|
|
@@ -61156,6 +61042,8 @@ class UniformsGroup extends UniformBuffer {
|
|
|
|
|
|
updated = true;
|
|
|
|
|
|
+ this.addUniformUpdateRange( uniform );
|
|
|
+
|
|
|
}
|
|
|
|
|
|
return updated;
|
|
|
@@ -61194,6 +61082,8 @@ class UniformsGroup extends UniformBuffer {
|
|
|
|
|
|
updated = true;
|
|
|
|
|
|
+ this.addUniformUpdateRange( uniform );
|
|
|
+
|
|
|
}
|
|
|
|
|
|
return updated;
|
|
|
@@ -61221,6 +61111,8 @@ class UniformsGroup extends UniformBuffer {
|
|
|
setArray( a, e, offset );
|
|
|
updated = true;
|
|
|
|
|
|
+ this.addUniformUpdateRange( uniform );
|
|
|
+
|
|
|
}
|
|
|
|
|
|
return updated;
|
|
|
@@ -62037,7 +61929,7 @@ ${ flowData.code }
|
|
|
|
|
|
if ( node.isNodeUniform && node.node.isTextureNode !== true && node.node.isBufferNode !== true ) {
|
|
|
|
|
|
- return shaderStage.charAt( 0 ) + '_' + node.name;
|
|
|
+ return node.name;
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -62442,32 +62334,56 @@ ${ flowData.code }
|
|
|
|
|
|
} else {
|
|
|
|
|
|
- const vectorType = this.getVectorType( uniform.type );
|
|
|
+ const groupName = uniform.groupNode.name;
|
|
|
|
|
|
- snippet = `${ vectorType } ${ this.getPropertyName( uniform, shaderStage ) };`;
|
|
|
+ // Check if this group has already been processed
|
|
|
+ if ( uniformGroups[ groupName ] === undefined ) {
|
|
|
|
|
|
- group = true;
|
|
|
+ // Get the shared uniform group that contains uniforms from all stages
|
|
|
+ const sharedUniformGroup = this.uniformGroups[ groupName ];
|
|
|
|
|
|
- }
|
|
|
+ if ( sharedUniformGroup !== undefined ) {
|
|
|
+
|
|
|
+ // Generate snippets for ALL uniforms in this shared group
|
|
|
+ const snippets = [];
|
|
|
+
|
|
|
+ for ( const sharedUniform of sharedUniformGroup.uniforms ) {
|
|
|
+
|
|
|
+ const type = sharedUniform.getType();
|
|
|
+ const vectorType = this.getVectorType( type );
|
|
|
+ const precision = sharedUniform.nodeUniform.node.precision;
|
|
|
+
|
|
|
+ let uniformSnippet = `${ vectorType } ${ sharedUniform.name };`;
|
|
|
+
|
|
|
+ if ( precision !== null ) {
|
|
|
+
|
|
|
+ uniformSnippet = precisionLib[ precision ] + ' ' + uniformSnippet;
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
- const precision = uniform.node.precision;
|
|
|
+ snippets.push( '\t' + uniformSnippet );
|
|
|
|
|
|
- if ( precision !== null ) {
|
|
|
+ }
|
|
|
+
|
|
|
+ uniformGroups[ groupName ] = snippets;
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
- snippet = precisionLib[ precision ] + ' ' + snippet;
|
|
|
+ }
|
|
|
+
|
|
|
+ group = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
- if ( group ) {
|
|
|
+ if ( ! group ) {
|
|
|
|
|
|
- snippet = '\t' + snippet;
|
|
|
+ const precision = uniform.node.precision;
|
|
|
|
|
|
- const groupName = uniform.groupNode.name;
|
|
|
- const groupSnippets = uniformGroups[ groupName ] || ( uniformGroups[ groupName ] = [] );
|
|
|
+ if ( precision !== null ) {
|
|
|
|
|
|
- groupSnippets.push( snippet );
|
|
|
+ snippet = precisionLib[ precision ] + ' ' + snippet;
|
|
|
|
|
|
- } else {
|
|
|
+ }
|
|
|
|
|
|
snippet = 'uniform ' + snippet;
|
|
|
|
|
|
@@ -62483,7 +62399,7 @@ ${ flowData.code }
|
|
|
|
|
|
const groupSnippets = uniformGroups[ name ];
|
|
|
|
|
|
- output += this._getGLSLUniformStruct( shaderStage + '_' + name, groupSnippets.join( '\n' ) ) + '\n';
|
|
|
+ output += this._getGLSLUniformStruct( name, groupSnippets.join( '\n' ) ) + '\n';
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -63272,24 +63188,38 @@ void main() {
|
|
|
|
|
|
} else {
|
|
|
|
|
|
- const uniformsStage = this.uniformGroups[ shaderStage ] || ( this.uniformGroups[ shaderStage ] = {} );
|
|
|
-
|
|
|
- let uniformsGroup = uniformsStage[ groupName ];
|
|
|
+ let uniformsGroup = this.uniformGroups[ groupName ];
|
|
|
|
|
|
if ( uniformsGroup === undefined ) {
|
|
|
|
|
|
- uniformsGroup = new NodeUniformsGroup( shaderStage + '_' + groupName, group );
|
|
|
- //uniformsGroup.setVisibility( gpuShaderStageLib[ shaderStage ] );
|
|
|
+ uniformsGroup = new NodeUniformsGroup( groupName, group );
|
|
|
|
|
|
- uniformsStage[ groupName ] = uniformsGroup;
|
|
|
+ this.uniformGroups[ groupName ] = uniformsGroup;
|
|
|
|
|
|
bindings.push( uniformsGroup );
|
|
|
|
|
|
+ } else {
|
|
|
+
|
|
|
+ // Add to bindings for this stage if not already present
|
|
|
+ if ( bindings.indexOf( uniformsGroup ) === -1 ) {
|
|
|
+
|
|
|
+ bindings.push( uniformsGroup );
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
uniformGPU = this.getNodeUniform( uniformNode, type );
|
|
|
|
|
|
- uniformsGroup.addUniform( uniformGPU );
|
|
|
+ // Only add uniform if not already present in the group (check by name to avoid duplicates across stages)
|
|
|
+ const uniformName = uniformGPU.name;
|
|
|
+ const alreadyExists = uniformsGroup.uniforms.some( u => u.name === uniformName );
|
|
|
+
|
|
|
+ if ( ! alreadyExists ) {
|
|
|
+
|
|
|
+ uniformsGroup.addUniform( uniformGPU );
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -74346,24 +74276,42 @@ class WGSLNodeBuilder extends NodeBuilder {
|
|
|
|
|
|
} else {
|
|
|
|
|
|
- const uniformsStage = this.uniformGroups[ shaderStage ] || ( this.uniformGroups[ shaderStage ] = {} );
|
|
|
-
|
|
|
- let uniformsGroup = uniformsStage[ groupName ];
|
|
|
+ let uniformsGroup = this.uniformGroups[ groupName ];
|
|
|
|
|
|
if ( uniformsGroup === undefined ) {
|
|
|
|
|
|
uniformsGroup = new NodeUniformsGroup( groupName, group );
|
|
|
uniformsGroup.setVisibility( gpuShaderStageLib[ shaderStage ] );
|
|
|
|
|
|
- uniformsStage[ groupName ] = uniformsGroup;
|
|
|
+ this.uniformGroups[ groupName ] = uniformsGroup;
|
|
|
|
|
|
bindings.push( uniformsGroup );
|
|
|
|
|
|
+ } else {
|
|
|
+
|
|
|
+ // Update visibility to include this shader stage (bitwise OR)
|
|
|
+ uniformsGroup.setVisibility( uniformsGroup.getVisibility() | gpuShaderStageLib[ shaderStage ] );
|
|
|
+
|
|
|
+ // Add to bindings for this stage if not already present
|
|
|
+ if ( bindings.indexOf( uniformsGroup ) === -1 ) {
|
|
|
+
|
|
|
+ bindings.push( uniformsGroup );
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
uniformGPU = this.getNodeUniform( uniformNode, type );
|
|
|
|
|
|
- uniformsGroup.addUniform( uniformGPU );
|
|
|
+ // Only add uniform if not already present in the group (check by name to avoid duplicates across stages)
|
|
|
+ const uniformName = uniformGPU.name;
|
|
|
+ const alreadyExists = uniformsGroup.uniforms.some( u => u.name === uniformName );
|
|
|
+
|
|
|
+ if ( ! alreadyExists ) {
|
|
|
+
|
|
|
+ uniformsGroup.addUniform( uniformGPU );
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -75163,16 +75111,36 @@ ${ flowData.code }
|
|
|
|
|
|
} else {
|
|
|
|
|
|
- const vectorType = this.getType( this.getVectorType( uniform.type ) );
|
|
|
const groupName = uniform.groupNode.name;
|
|
|
|
|
|
- const group = uniformGroups[ groupName ] || ( uniformGroups[ groupName ] = {
|
|
|
- index: uniformIndexes.binding ++,
|
|
|
- id: uniformIndexes.group,
|
|
|
- snippets: []
|
|
|
- } );
|
|
|
+ // Check if this group has already been processed
|
|
|
+ if ( uniformGroups[ groupName ] === undefined ) {
|
|
|
+
|
|
|
+ // Get the shared uniform group that contains uniforms from all stages
|
|
|
+ const sharedUniformGroup = this.uniformGroups[ groupName ];
|
|
|
+
|
|
|
+ if ( sharedUniformGroup !== undefined ) {
|
|
|
+
|
|
|
+ // Generate snippets for ALL uniforms in this shared group
|
|
|
+ const snippets = [];
|
|
|
+
|
|
|
+ for ( const sharedUniform of sharedUniformGroup.uniforms ) {
|
|
|
+
|
|
|
+ const type = sharedUniform.getType();
|
|
|
+ const vectorType = this.getType( this.getVectorType( type ) );
|
|
|
+ snippets.push( `\t${ sharedUniform.name } : ${ vectorType }` );
|
|
|
|
|
|
- group.snippets.push( `\t${ uniform.name } : ${ vectorType }` );
|
|
|
+ }
|
|
|
+
|
|
|
+ uniformGroups[ groupName ] = {
|
|
|
+ index: uniformIndexes.binding ++,
|
|
|
+ id: uniformIndexes.group,
|
|
|
+ snippets: snippets
|
|
|
+ };
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -76524,8 +76492,6 @@ class WebGPUBindingUtils {
|
|
|
|
|
|
}
|
|
|
|
|
|
- binding.clearUpdateRanges();
|
|
|
-
|
|
|
}
|
|
|
|
|
|
}
|