Skip to content

Commit

Permalink
WebGPURenderer: ChainMap - Clean up. (#28492)
Browse files Browse the repository at this point in the history
  • Loading branch information
Methuselah96 authored May 26, 2024
1 parent 3b639a0 commit d40187b
Showing 1 changed file with 18 additions and 48 deletions.
66 changes: 18 additions & 48 deletions examples/jsm/renderers/common/ChainMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,81 +8,51 @@ export default class ChainMap {

get( keys ) {

if ( Array.isArray( keys ) ) {
let map = this.weakMap;

let map = this.weakMap;
for ( let i = 0; i < keys.length; i ++ ) {

for ( let i = 0; i < keys.length; i ++ ) {
map = map.get( keys[ i ] );

map = map.get( keys[ i ] );

if ( map === undefined ) return undefined;

}

return map.get( keys[ keys.length - 1 ] );

} else {

return super.get( keys );
if ( map === undefined ) return undefined;

}

return map.get( keys[ keys.length - 1 ] );

}

set( keys, value ) {

if ( Array.isArray( keys ) ) {

let map = this.weakMap;

for ( let i = 0; i < keys.length; i ++ ) {

const key = keys[ i ];

if ( map.has( key ) === false ) map.set( key, new WeakMap() );
let map = this.weakMap;

map = map.get( key );
for ( let i = 0; i < keys.length; i ++ ) {

}
const key = keys[ i ];

return map.set( keys[ keys.length - 1 ], value );
if ( map.has( key ) === false ) map.set( key, new WeakMap() );

} else {

return super.set( keys, value );
map = map.get( key );

}

return map.set( keys[ keys.length - 1 ], value );

}

delete( keys ) {

if ( Array.isArray( keys ) ) {

let map = this.weakMap;

for ( let i = 0; i < keys.length; i ++ ) {

map = map.get( keys[ i ] );
let map = this.weakMap;

if ( map === undefined ) return false;
for ( let i = 0; i < keys.length; i ++ ) {

}
map = map.get( keys[ i ] );

return map.delete( keys[ keys.length - 1 ] );

} else {

return super.delete( keys );
if ( map === undefined ) return false;

}

}

dispose() {

this.weakMap.clear();
return map.delete( keys[ keys.length - 1 ] );

}

Expand Down

0 comments on commit d40187b

Please sign in to comment.