| DirectionalLight2, | DirectionalLight2, | ||||
| HemisphereLight2, | HemisphereLight2, | ||||
| IObject3D, | IObject3D, | ||||
| Object3D2, | |||||
| OrthographicCamera2, | |||||
| PerspectiveCamera2, | PerspectiveCamera2, | ||||
| PointLight2, | PointLight2, | ||||
| RectAreaLight2, | RectAreaLight2, | ||||
| } | } | ||||
| generators: Record<string, (params?: any)=>IObject3D> = { | generators: Record<string, (params?: any)=>IObject3D> = { | ||||
| ['object-empty']: (params: { | |||||
| position?: Vector3, | |||||
| name?: string, | |||||
| } = {})=>{ | |||||
| const obj = new Object3D2() | |||||
| params.position ? obj.position.copy(params.position) : obj.position.set(0, 0, 0) | |||||
| obj.name = params.name ?? 'New Object' | |||||
| return obj | |||||
| }, | |||||
| ['camera-perspective']: (params: { | ['camera-perspective']: (params: { | ||||
| controlsMode?: string, | controlsMode?: string, | ||||
| autoAspect?: boolean, | autoAspect?: boolean, | ||||
| camera.name = params.name ?? 'Perspective Camera' | camera.name = params.name ?? 'Perspective Camera' | ||||
| return camera | return camera | ||||
| }, | }, | ||||
| ['camera-orthographic']: (params: { | |||||
| controlsMode?: string, | |||||
| autoAspect?: boolean, | |||||
| frustumSize?: number, | |||||
| position?: Vector3, | |||||
| target?: Vector3, | |||||
| autoLookAtTarget?: boolean, | |||||
| name?: string, | |||||
| } = {})=>{ | |||||
| const camera = new OrthographicCamera2( | |||||
| params.controlsMode ?? '', | |||||
| this._viewer?.canvas, | |||||
| params.autoAspect, | |||||
| params.frustumSize, | |||||
| ) | |||||
| params.position ? camera.position.copy(params.position) : camera.position.set(0, 0, 5) | |||||
| params.target ? camera.target.copy(params.target) : camera.target.set(0, 0, 0) | |||||
| camera.autoLookAtTarget = params.autoLookAtTarget ?? true | |||||
| camera.setDirty() | |||||
| camera.name = params.name ?? 'Orthographic Camera' | |||||
| return camera | |||||
| }, | |||||
| ['light-directional']: (params: { | ['light-directional']: (params: { | ||||
| color?: number, | color?: number, | ||||
| intensity?: number, | intensity?: number, |