UNPKG

d2k

Version:

rendering engine from the Dark side of the Force - wip

27 lines (19 loc) 667 B
import { is } from 'u3s'; import { CONFIG } from '=>/3d-object-builder/base'; /** * @author monsieurbadia / https://monsieurbadia.com */ export const BABYLONScene = ( { RENDERING_ENGINE, config = CONFIG.BABYLON.SCENE } = {} ) => { const { engine } = RENDERING_ENGINE.coreData; const scene = new RENDERING_ENGINE.Scene( engine ); const cleanCache = _ => engine.wipeCaches( true ); // TODO: dynamic if ( is.contains( config.clearColor ) ) scene.clearColor = new RENDERING_ENGINE.Color3( ...config.clearColor ); scene.autoClear = config.autoClear; scene.beforeRender = cleanCache; RENDERING_ENGINE.coreData.scene = scene; return scene; };