Skip to content

Commit

Permalink
WebGPURenderer: add Texture state tracking to NodeMaterialObserver (#…
Browse files Browse the repository at this point in the history
…29421)

* texture tracking

* rework

* lint

* rework 2

---------

Co-authored-by: aardgoose <[email protected]>
  • Loading branch information
aardgoose and aardgoose authored Sep 16, 2024
1 parent 3ddd8de commit 4fd5360
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion src/materials/nodes/manager/NodeMaterialObserver.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,15 @@ class NodeMaterialObserver {

if ( typeof value === 'object' && value.clone !== undefined ) {

data[ property ] = value.clone();
if ( value.isTexture === true ) {

data[ property ] = { id: value.id, version: value.version };

} else {

data[ property ] = value.clone();

}

} else {

Expand Down Expand Up @@ -182,10 +190,23 @@ class NodeMaterialObserver {

}

} else if ( mtlValue.isTexture === true ) {

if ( value.id !== mtlValue.id || value.version !== mtlValue.version ) {

value.id = mtlValue.id;
value.version = mtlValue.version;

return false;

}

} else if ( value !== mtlValue ) {

materialData[ property ] = mtlValue;

return false;

}

}
Expand Down

0 comments on commit 4fd5360

Please sign in to comment.