| @@ -9,6 +9,8 @@ export type {NormalBufferPluginEventTypes, NormalBufferPluginPass, NormalBufferP | |||
| // ui | |||
| export {RenderTargetPreviewPlugin} from './ui/RenderTargetPreviewPlugin' | |||
| export {ViewerUiConfigPlugin} from './ui/ViewerUiConfigPlugin' | |||
| export {SceneUiConfigPlugin} from './ui/SceneUiConfigPlugin' | |||
| // interaction | |||
| export {DropzonePlugin, type DropzonePluginOptions} from './interaction/DropzonePlugin' | |||
| @@ -16,3 +18,6 @@ export {FullScreenPlugin} from './interaction/FullScreenPlugin' | |||
| // import | |||
| export {Rhino3dmLoadPlugin} from './import/Rhino3dmLoadPlugin' | |||
| // postprocessing | |||
| export {TonemapPlugin} from './postprocessing/TonemapPlugin' | |||
| @@ -0,0 +1,20 @@ | |||
| import {AViewerPluginSync, ThreeViewer} from '../../viewer' | |||
| import {serialize} from 'ts-browser-helpers' | |||
| import {RootScene} from '../../core' | |||
| export class SceneUiConfigPlugin extends AViewerPluginSync<''> { | |||
| static readonly PluginType = 'SceneUiConfigPlugin' | |||
| enabled = true | |||
| serializeWithViewer = false | |||
| constructor() { | |||
| super() | |||
| this.uiConfig = {} | |||
| } | |||
| onAdded(viewer: ThreeViewer) { | |||
| super.onAdded(viewer) | |||
| this.uiConfig = viewer.scene.uiConfig | |||
| this._scene = viewer.scene | |||
| } | |||
| @serialize('scene') | |||
| protected _scene: RootScene | undefined | |||
| } | |||
| @@ -0,0 +1,27 @@ | |||
| import {AViewerPluginSync, ThreeViewer} from '../../viewer' | |||
| import {serialize} from 'ts-browser-helpers' | |||
| export class ViewerUiConfigPlugin extends AViewerPluginSync<''> { | |||
| static readonly PluginType = 'ViewerUiConfigPlugin' | |||
| enabled = true | |||
| serializeWithViewer = false | |||
| constructor() { | |||
| super() | |||
| this.uiConfig = {} | |||
| } | |||
| onAdded(viewer: ThreeViewer) { | |||
| super.onAdded(viewer) | |||
| this.uiConfig = viewer.uiConfig | |||
| } | |||
| @serialize('viewer') | |||
| protected _viewer: ThreeViewer | undefined // todo: fix deserialization throwing error | |||
| // toJSON(): any { | |||
| // return this._viewer?.toJSON() ?? {} | |||
| // } | |||
| // fromJSON(data: ISerializedViewerConfig, meta?: SerializationMetaType): this | null { | |||
| // this._viewer?.fromJSON(data, meta) | |||
| // return this | |||
| // } | |||
| } | |||