|
|
|
|
|
|
|
|
IObjectProcessor, |
|
|
IObjectProcessor, |
|
|
ITexture, |
|
|
ITexture, |
|
|
PerspectiveCamera2, |
|
|
PerspectiveCamera2, |
|
|
RootScene, |
|
|
|
|
|
|
|
|
RootScene, TCameraControlsMode, |
|
|
} from '../core' |
|
|
} from '../core' |
|
|
import {ViewerRenderManager} from './ViewerRenderManager' |
|
|
import {ViewerRenderManager} from './ViewerRenderManager' |
|
|
import { |
|
|
import { |
|
|
|
|
|
|
|
|
import {DropzonePlugin, DropzonePluginOptions} from '../plugins/interaction/DropzonePlugin' |
|
|
import {DropzonePlugin, DropzonePluginOptions} from '../plugins/interaction/DropzonePlugin' |
|
|
import {uiConfig, uiFolderContainer, UiObjectConfig} from 'uiconfig.js' |
|
|
import {uiConfig, uiFolderContainer, UiObjectConfig} from 'uiconfig.js' |
|
|
import {IRenderTarget} from '../rendering' |
|
|
import {IRenderTarget} from '../rendering' |
|
|
|
|
|
import type {ProgressivePlugin} from '../plugins' |
|
|
import {TonemapPlugin} from '../plugins' |
|
|
import {TonemapPlugin} from '../plugins' |
|
|
import {VERSION} from './version' |
|
|
import {VERSION} from './version' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
*/ |
|
|
*/ |
|
|
tonemap?: boolean |
|
|
tonemap?: boolean |
|
|
|
|
|
|
|
|
|
|
|
camera?: { |
|
|
|
|
|
controlsMode?: TCameraControlsMode, |
|
|
|
|
|
position?: Vector3, |
|
|
|
|
|
target?: Vector3, |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* Options for the asset manager. |
|
|
* Options for the asset manager. |
|
|
*/ |
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// camera |
|
|
// camera |
|
|
|
|
|
|
|
|
const camera = new PerspectiveCamera2('orbit', this._canvas) |
|
|
|
|
|
|
|
|
const camera = new PerspectiveCamera2(options.camera?.controlsMode ?? 'orbit', this._canvas) |
|
|
camera.name = 'Default Camera' |
|
|
camera.name = 'Default Camera' |
|
|
camera.position.set(0, 0, 5) |
|
|
|
|
|
|
|
|
options.camera?.position ? camera.position.copy(options.camera.position) : camera.position.set(0, 0, 5) |
|
|
|
|
|
options.camera?.target ? camera.target.copy(options.camera.target) : camera.target.set(0, 0, 0) |
|
|
|
|
|
camera.setDirty() |
|
|
camera.userData.autoLookAtTarget = true // only for when controls are disabled / not available |
|
|
camera.userData.autoLookAtTarget = true // only for when controls are disabled / not available |
|
|
|
|
|
|
|
|
// Update camera controls postFrame if allowed to interact |
|
|
// Update camera controls postFrame if allowed to interact |
|
|
this.addEventListener('postFrame', () => { // todo: move inside RootScene. |
|
|
this.addEventListener('postFrame', () => { // todo: move inside RootScene. |
|
|
const cam = this._scene.mainCamera |
|
|
const cam = this._scene.mainCamera |
|
|
if (cam && cam.canUserInteract) { |
|
|
if (cam && cam.canUserInteract) { |
|
|
// todo |
|
|
|
|
|
// const d = this.getPluginByType<ProgressivePlugin>('Progressive')?.postFrameConvergedRecordingDelta() |
|
|
|
|
|
// // if (d && d > 0) delta = d |
|
|
|
|
|
// if (d !== undefined && d === 0) return // not converged yet. |
|
|
|
|
|
// // if d < 0 or undefined: not recording, do nothing |
|
|
|
|
|
|
|
|
const d = this.getPlugin<ProgressivePlugin>('Progressive')?.postFrameConvergedRecordingDelta() |
|
|
|
|
|
// if (d && d > 0) delta = d |
|
|
|
|
|
if (d !== undefined && d === 0) return // not converged yet. |
|
|
|
|
|
// if d < 0 or undefined: not recording, do nothing |
|
|
|
|
|
|
|
|
cam.controls?.update() |
|
|
cam.controls?.update() |
|
|
} |
|
|
} |