Skip to content

Commit

Permalink
RenderObject: Fix material cache key regression.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mugen87 committed Jul 22, 2024
1 parent 4755144 commit 76887ef
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/renderers/common/RenderObject.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,14 +195,19 @@ export default class RenderObject {

const value = material[ property ];

let valueKey;
let valueKey = value;

if ( value !== null ) {
if ( value ) {

// some material values require a formatting

const type = typeof value;

if ( type === 'number' ) valueKey = value !== 0 ? '1' : '0'; // Convert to on/off, important for clearcoat, transmission, etc
else if ( type === 'object' ) {
if ( type === 'number' ) {

valueKey = value !== 0 ? '1' : '0'; // Convert to on/off, important for clearcoat, transmission, etc

} else if ( type === 'object' ) {

valueKey = '{';

Expand All @@ -216,10 +221,6 @@ export default class RenderObject {

}

} else {

valueKey = String( value );

}

cacheKey += /*property + ':' +*/ valueKey + ',';
Expand Down

0 comments on commit 76887ef

Please sign in to comment.