Kaynağa Gözat

Use IViewerPlugin instead of AViewerPlugin in tweakpane editor plugins, add new plugins to the editor example.

master
Palash Bansal 2 yıl önce
ebeveyn
işleme
6da3ef177b
No account linked to committer's email address

+ 6
- 1
examples/tweakpane-editor/script.ts Dosyayı Görüntüle

FullScreenPlugin, FullScreenPlugin,
GLTFAnimationPlugin, GLTFAnimationPlugin,
HalfFloatType, HalfFloatType,
HDRiGroundPlugin,
HemisphereLight, HemisphereLight,
KTX2LoadPlugin, KTX2LoadPlugin,
KTXLoadPlugin, KTXLoadPlugin,
TonemapPlugin, TonemapPlugin,
USDZLoadPlugin, USDZLoadPlugin,
ViewerUiConfigPlugin, ViewerUiConfigPlugin,
VignettePlugin,
} from 'threepipe' } from 'threepipe'
import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane'
import {TweakpaneEditorPlugin} from '@threepipe/plugin-tweakpane-editor' import {TweakpaneEditorPlugin} from '@threepipe/plugin-tweakpane-editor'
new NormalBufferPlugin(HalfFloatType, false), new NormalBufferPlugin(HalfFloatType, false),
new RenderTargetPreviewPlugin(false), new RenderTargetPreviewPlugin(false),
new FrameFadePlugin(), new FrameFadePlugin(),
new VignettePlugin(),
new HDRiGroundPlugin(false, true),
KTX2LoadPlugin, KTX2LoadPlugin,
KTXLoadPlugin, KTXLoadPlugin,
PLYLoadPlugin, PLYLoadPlugin,
['Viewer']: [ViewerUiConfigPlugin, SceneUiConfigPlugin, DropzonePlugin, FullScreenPlugin], ['Viewer']: [ViewerUiConfigPlugin, SceneUiConfigPlugin, DropzonePlugin, FullScreenPlugin],
['Interaction']: [PickingPlugin], ['Interaction']: [PickingPlugin],
['GBuffer']: [DepthBufferPlugin, NormalBufferPlugin], ['GBuffer']: [DepthBufferPlugin, NormalBufferPlugin],
['Post-processing']: [TonemapPlugin, ProgressivePlugin, FrameFadePlugin],
['Post-processing']: [TonemapPlugin, ProgressivePlugin, FrameFadePlugin, VignettePlugin],
['Animation']: [GLTFAnimationPlugin, CameraViewPlugin], ['Animation']: [GLTFAnimationPlugin, CameraViewPlugin],
['Extras']: [HDRiGroundPlugin, Rhino3dmLoadPlugin],
['Debug']: [RenderTargetPreviewPlugin], ['Debug']: [RenderTargetPreviewPlugin],
}) })



+ 2
- 2
plugins/tweakpane-editor/package-lock.json Dosyayı Görüntüle

{ {
"name": "@threepipe/plugin-tweakpane-editor", "name": "@threepipe/plugin-tweakpane-editor",
"version": "0.1.3",
"version": "0.1.4",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@threepipe/plugin-tweakpane-editor", "name": "@threepipe/plugin-tweakpane-editor",
"version": "0.1.3",
"version": "0.1.4",
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
"@threepipe/plugin-tweakpane": "file:./../tweakpane/src/", "@threepipe/plugin-tweakpane": "file:./../tweakpane/src/",

+ 2
- 2
plugins/tweakpane-editor/package.json Dosyayı Görüntüle

{ {
"name": "@threepipe/plugin-tweakpane-editor", "name": "@threepipe/plugin-tweakpane-editor",
"description": "Tweakpane Editor Plugin for ThreePipe", "description": "Tweakpane Editor Plugin for ThreePipe",
"version": "0.1.3",
"version": "0.1.4",
"devDependencies": { "devDependencies": {
"tippy.js": "^6.3.7" "tippy.js": "^6.3.7"
}, },
], ],
"replace": { "replace": {
"dependencies": { "dependencies": {
"threepipe": "^0.0.8",
"threepipe": "^0.0.16",
"@threepipe/plugin-tweakpane": "^0.1.2" "@threepipe/plugin-tweakpane": "^0.1.2"
} }
} }

+ 3
- 3
plugins/tweakpane-editor/src/TweakpaneEditorPlugin.ts Dosyayı Görüntüle

import { import {
AViewerPlugin,
AViewerPluginSync, AViewerPluginSync,
Class, Class,
createDiv, createDiv,
createStyles, createStyles,
FullScreenPlugin, FullScreenPlugin,
IViewerPlugin,
safeSetProperty, safeSetProperty,
ThreeViewer, ThreeViewer,
} from 'threepipe' } from 'threepipe'


private _selectedMode = 0 private _selectedMode = 0
modeKeys: string[] = [] modeKeys: string[] = []
modePlugins: Class<AViewerPlugin>[][] = []
modePlugins: Class<IViewerPlugin>[][] = []
modeDivs: (HTMLDivElement | undefined)[] = [] modeDivs: (HTMLDivElement | undefined)[] = []
// picking?: PickingPlugin // picking?: PickingPlugin
uiPlugin?: TweakpaneUiPlugin uiPlugin?: TweakpaneUiPlugin


loadPlugins(plugins: Record<string, Class<AViewerPlugin<any>>[]> = {}) {
loadPlugins(plugins: Record<string, Class<IViewerPlugin<any>>[]> = {}) {
if (!this._viewer) throw new Error('Plugin not added to viewer.') if (!this._viewer) throw new Error('Plugin not added to viewer.')
setupUtilButtonsBar(this._viewer, Object.values(plugins).flat()) setupUtilButtonsBar(this._viewer, Object.values(plugins).flat())



+ 3
- 3
plugins/tweakpane-editor/src/util-buttons.ts Dosyayı Görüntüle

import { import {
AViewerPlugin,
Class, Class,
createDiv, createDiv,
downloadBlob, downloadBlob,
FullScreenPlugin, FullScreenPlugin,
GLTFAnimationPlugin, GLTFAnimationPlugin,
IViewerPlugin,
ThreeViewer, ThreeViewer,
} from 'threepipe' } from 'threepipe'
import {autoRotateCC, collapse, download, expand, playIcon, resetSettings, snapshot, trash} from './icons' import {autoRotateCC, collapse, download, expand, playIcon, resetSettings, snapshot, trash} from './icons'
import tippy, {createSingleton} from 'tippy.js' import tippy, {createSingleton} from 'tippy.js'


export function createUtilButtons(viewer: ThreeViewer, allPlugins: Class<AViewerPlugin>[]) {
export function createUtilButtons(viewer: ThreeViewer, allPlugins: Class<IViewerPlugin>[]) {
return [ return [
{ {
id: 'reset-settings', id: 'reset-settings',
}) })
} }


export function setupUtilButtonsBar(viewer: ThreeViewer, allPlugins: Class<AViewerPlugin>[]) {
export function setupUtilButtonsBar(viewer: ThreeViewer, allPlugins: Class<IViewerPlugin>[]) {
const utilButtonsContainer = createDiv({ const utilButtonsContainer = createDiv({
classList: ['button-bar', 'util-buttons-container'], classList: ['button-bar', 'util-buttons-container'],
addToBody: false, addToBody: false,

Loading…
İptal
Kaydet