"use strict"; const HoleMaterialGame = (function(){ const HoleMaterialGame = function(hollow_bond){ const self = this; const cache = {}; const themes_source = (hollow_bond && hollow_bond.themes) ? hollow_bond.themes : new ThemeManager(hollow_bond); this.get_material = (theme_key = null) => { const key = theme_key || themes_source.current_theme || "level_0"; if(cache[key]){ return cache[key]; } const theme = themes_source.get(key); const shader_def = (theme && theme.shaders && theme.shaders.hole) ? theme.shaders.hole : (theme && theme.shaders && theme.shaders.walls); cache[key] = new THREE.ShaderMaterial({ vertexShader: shader_def.vertex, fragmentShader: shader_def.fragment, side: THREE.DoubleSide }); return cache[key]; }; this.reset = () => { for(const key in cache){ if(cache[key] && cache[key].dispose){ cache[key].dispose(); } } }; }; return HoleMaterialGame; })();