UNPKG

@vci/quick-three

Version:

quick three

35 lines (33 loc) 1.11 kB
import { Scene } from "three"; import { mergeDeep } from "@vci/helper/src/object"; function createScene(option) { const { qt, name } = mergeDeep( { qt: null, name: null, position: [0, 100, 0], aspect: 1, fov: 50, near: 0.001, far: 1e3 }, option ); const scene = new Scene(); if (qt) { qt.scene = scene; qt.scenes.set("core", scene); if (qt.debug && qt.gui) { const key = `scene@${scene.uuid}`; const gui = qt.gui.guis[key] = qt.gui.guis.scene.addFolder(name || key).close(); gui.add(scene, "visible").listen(); gui.add(scene, "backgroundBlurriness", 0, 1).listen(); gui.add(scene, "backgroundIntensity", 0, 2).listen(); gui.add(scene.backgroundRotation, "x", 0, Math.PI * 2).name("backgroundRotation.x").listen(); gui.add(scene.backgroundRotation, "y", 0, Math.PI * 2).name("backgroundRotation.y").listen(); gui.add(scene.backgroundRotation, "z", 0, Math.PI * 2).name("backgroundRotation.z").listen(); } } return scene; } export { createScene };