HollowBond/Public/ecma/Geometries/Debug/FrameGeometryDebug.ecma.js

38 lines
926 B
JavaScript

"use strict";
const FrameGeometryDebug = (function(){
const FrameGeometryDebug = function(hollow_bond){
const cache = {};
/**
* Obtiene o instancia una geometría de caja con las dimensiones exactas del marco.
* @param {number} width
* @param {number} height
* @param {number} depth
* @returns {THREE.BoxGeometry}
*/
this.get = (width, height, depth) => {
const key = `${width}_${height}_${depth}`;
if(!cache[key]){
cache[key] = new THREE.BoxGeometry(width, height, depth);
}
return cache[key];
};
this.reset = () => {
for(const key in cache){
if(cache[key]){
cache[key].dispose();
delete cache[key];
}
}
};
};
return FrameGeometryDebug;
})();