| "popmotion": "^11.0.5", | "popmotion": "^11.0.5", | ||||
| "stats.js": "^0.17.0", | "stats.js": "^0.17.0", | ||||
| "ts-browser-helpers": "^0.16.2", | "ts-browser-helpers": "^0.16.2", | ||||
| "uiconfig.js": "^0.1.3" | |||||
| "uiconfig.js": "^0.1.5" | |||||
| }, | }, | ||||
| "devDependencies": { | "devDependencies": { | ||||
| "@rollup/plugin-json": "^6.0.0", | "@rollup/plugin-json": "^6.0.0", | ||||
| "license": "MIT" | "license": "MIT" | ||||
| }, | }, | ||||
| "node_modules/uiconfig.js": { | "node_modules/uiconfig.js": { | ||||
| "version": "0.1.3", | |||||
| "resolved": "https://registry.npmjs.org/uiconfig.js/-/uiconfig.js-0.1.3.tgz", | |||||
| "integrity": "sha512-Q3eXWGrwXO46lkjfCsMQX6fsMKLmg4u4rrvZMkRJlQiDmsQyCaDdIJy7CMKrBWWfL9e6f4w+66SHAb+u4rOL2g==", | |||||
| "version": "0.1.5", | |||||
| "resolved": "https://registry.npmjs.org/uiconfig.js/-/uiconfig.js-0.1.5.tgz", | |||||
| "integrity": "sha512-qsNfb0cnMTpTk9rp6i6wXHJh3w02vxoi2GceYwRfqjqtgmGeFahAuQpdN6d0qR8V0ALs54eyfDOljo50ccNXgw==", | |||||
| "license": "MIT" | "license": "MIT" | ||||
| }, | }, | ||||
| "node_modules/unbox-primitive": { | "node_modules/unbox-primitive": { |
| "popmotion": "^11.0.5", | "popmotion": "^11.0.5", | ||||
| "stats.js": "^0.17.0", | "stats.js": "^0.17.0", | ||||
| "ts-browser-helpers": "^0.16.2", | "ts-browser-helpers": "^0.16.2", | ||||
| "uiconfig.js": "^0.1.3" | |||||
| "uiconfig.js": "^0.1.5" | |||||
| }, | }, | ||||
| "peerDependencies": { | "peerDependencies": { | ||||
| "three": "https://github.com/repalash/three.js-modded/releases/download/v0.158.1004/package.tgz" | "three": "https://github.com/repalash/three.js-modded/releases/download/v0.158.1004/package.tgz" | ||||
| }, | }, | ||||
| "//": { | "//": { | ||||
| "dependencies": { | "dependencies": { | ||||
| "uiconfig.js": "^0.1.3", | |||||
| "uiconfig.js": "^0.1.5", | |||||
| "ts-browser-helpers": "^0.16.2", | "ts-browser-helpers": "^0.16.2", | ||||
| "three": "https://github.com/repalash/three.js-modded/releases/download/v0.158.1004/package.tgz", | "three": "https://github.com/repalash/three.js-modded/releases/download/v0.158.1004/package.tgz", | ||||
| "three-f": "https://github.com/repalash/three.js-modded/archive/refs/tags/v0.158.1004.tar.gz", | "three-f": "https://github.com/repalash/three.js-modded/archive/refs/tags/v0.158.1004.tar.gz", |
| return | return | ||||
| } | } | ||||
| // todo do same in blueprint editor | |||||
| if (SVGTextureLoader.USE_CANVAS_TEXTURE && (v.src?.endsWith('.svg') || v.src?.startsWith('data:image/svg'))) { | if (SVGTextureLoader.USE_CANVAS_TEXTURE && (v.src?.endsWith('.svg') || v.src?.startsWith('data:image/svg'))) { | ||||
| // due to windows bug which cannot load svg files in webgl without a width and height | // due to windows bug which cannot load svg files in webgl without a width and height | ||||
| const canvas = document.createElement('canvas') | const canvas = document.createElement('canvas') |
| uiConfig: UiObjectConfig = { | uiConfig: UiObjectConfig = { | ||||
| type: 'folder', | type: 'folder', | ||||
| label: 'Asset Export', | label: 'Asset Export', | ||||
| expanded: true, | |||||
| children: [ | children: [ | ||||
| { | { | ||||
| type: 'input', | type: 'input', | ||||
| { | { | ||||
| type: 'folder', | type: 'folder', | ||||
| label: 'GLB Export', | label: 'GLB Export', | ||||
| expanded: true, | |||||
| children: [ | children: [ | ||||
| { | { | ||||
| type: 'checkbox', | type: 'checkbox', |
| target?: DepthBufferPluginTarget | target?: DepthBufferPluginTarget | ||||
| @uiImage('Depth Buffer' /* {readOnly: true}*/) texture?: Texture | |||||
| @uiImage('Depth Buffer', {readOnly: true}) texture?: Texture | |||||
| // @uiConfig() // not supported in this material yet | // @uiConfig() // not supported in this material yet | ||||
| readonly material: MeshDepthMaterial = new MeshDepthMaterialOverride({ | readonly material: MeshDepthMaterial = new MeshDepthMaterialOverride({ |
| target?: GBufferPluginTarget | target?: GBufferPluginTarget | ||||
| // @uiConfig(/* {readOnly: true}*/) // todo: fix bug in uiconfig or tpImageGenerator because of which 0 index is not showing in the UI, when we uncomment this | |||||
| // @uiConfig({readOnly: true}) // todo: fix bug in uiconfig or tpImageGenerator because of which 0 index is not showing in the UI, when we uncomment this | |||||
| textures: Texture[] = [] | textures: Texture[] = [] | ||||
| @uiImage(/* {readOnly: true}*/) | |||||
| @uiImage(undefined, {readOnly: true}) | |||||
| get normalDepthTexture(): ITexture|undefined { | get normalDepthTexture(): ITexture|undefined { | ||||
| return this.textures[0] | return this.textures[0] | ||||
| } | } | ||||
| @uiImage(/* {readOnly: true}*/) | |||||
| @uiImage(undefined, {readOnly: true}) | |||||
| get flagsTexture(): ITexture|undefined { | get flagsTexture(): ITexture|undefined { | ||||
| return this.textures[1] | return this.textures[1] | ||||
| } | } | ||||
| @uiImage(/* {readOnly: true}*/) | |||||
| @uiImage(undefined, {readOnly: true}) | |||||
| get depthTexture(): (ITexture&DepthTexture)|undefined { | get depthTexture(): (ITexture&DepthTexture)|undefined { | ||||
| return this.target?.depthTexture | return this.target?.depthTexture | ||||
| } | } |
| public static readonly PluginType = 'NormalBufferPlugin' | public static readonly PluginType = 'NormalBufferPlugin' | ||||
| target?: NormalBufferPluginTarget | target?: NormalBufferPluginTarget | ||||
| @uiImage('Normal Buffer' /* {readOnly: true}*/) texture?: Texture | |||||
| @uiImage('Normal Buffer', {readOnly: true}) texture?: Texture | |||||
| readonly material: MeshNormalMaterial = new MeshNormalMaterialOverride({ | readonly material: MeshNormalMaterial = new MeshNormalMaterialOverride({ | ||||
| blending: NoBlending, | blending: NoBlending, | ||||
| }) | }) |
| @serialize() @uiInput('Frame count') maxFrameCount: number | @serialize() @uiInput('Frame count') maxFrameCount: number | ||||
| // @uiImage('Last Texture' /* {readOnly: true}*/) texture?: Texture | |||||
| // @uiImage('Last Texture', {readOnly: true}) texture?: Texture | |||||
| get texture(): Texture | undefined { | get texture(): Texture | undefined { | ||||
| return this.target?.texture | return this.target?.texture | ||||
| return this._viewer ? Array.from(this._targets.values()).map(t => t.texture) : [] | return this._viewer ? Array.from(this._targets.values()).map(t => t.texture) : [] | ||||
| } | } | ||||
| @uiImage('Last Texture' /* {readOnly: true}*/) | |||||
| @uiImage('Last Texture', {readOnly: true}) | |||||
| get mainTexture() { | get mainTexture() { | ||||
| return this._viewer ? this.getTarget(this._viewer.scene.mainCamera)?.texture : undefined | return this._viewer ? this.getTarget(this._viewer.scene.mainCamera)?.texture : undefined | ||||
| } | } |
| dependencies = [GBufferPlugin] | dependencies = [GBufferPlugin] | ||||
| target?: SSAOPluginTarget | target?: SSAOPluginTarget | ||||
| @uiImage('SSAO Buffer' /* {readOnly: true}*/) texture?: Texture | |||||
| @uiImage('SSAO Buffer', {readOnly: true}) texture?: Texture | |||||
| @uiConfig() declare protected _pass?: SSAOPluginPass | @uiConfig() declare protected _pass?: SSAOPluginPass | ||||
| } | } | ||||
| @serialize() | @serialize() | ||||
| @uiDropdown('Shadow Map Type', ['BasicShadowMap', 'PCFShadowMap', 'PCFSoftShadowMap', 'VSMShadowMap'].map((v, i) => ({label: v, value: i}))) | |||||
| @uiDropdown('Shadow Map Type', ['BasicShadowMap', 'PCFShadowMap', 'PCFSoftShadowMap', 'VSMShadowMap'].map((v, i) => ({label: v, value: i})), {tags: ['advanced']}) | |||||
| @bindToValue({obj: 'shadowMap', key: 'type', onChange: RenderManager.prototype._shadowMapTypeChanged}) | @bindToValue({obj: 'shadowMap', key: 'type', onChange: RenderManager.prototype._shadowMapTypeChanged}) | ||||
| shadowMapType: ShadowMapType | shadowMapType: ShadowMapType | ||||
| this.reset() | this.reset() | ||||
| } | } | ||||
| @uiConfig(undefined, {label: 'Passes'}) | |||||
| @uiConfig(undefined, {label: 'Passes', tags: ['advanced'], order: 1000}) | |||||
| private _passes: IPipelinePass[] = [] | private _passes: IPipelinePass[] = [] | ||||
| private _pipeline: IPassID[] = [] | private _pipeline: IPassID[] = [] | ||||
| private _passesNeedsUpdate = true | private _passesNeedsUpdate = true | ||||
| @onChange2(RenderManager.prototype.rebuildPipeline) | @onChange2(RenderManager.prototype.rebuildPipeline) | ||||
| public autoBuildPipeline = true | public autoBuildPipeline = true | ||||
| @uiButton('Rebuild Pipeline', {sendArgs: false}) | |||||
| @uiButton('Rebuild Pipeline', {sendArgs: false, tags: ['advanced']}) | |||||
| rebuildPipeline(setDirty = true): void { | rebuildPipeline(setDirty = true): void { | ||||
| this._passesNeedsUpdate = true | this._passesNeedsUpdate = true | ||||
| if (setDirty) this._updated({change: 'rebuild'}) | if (setDirty) this._updated({change: 'rebuild'}) |
| renderEnabled = true | renderEnabled = true | ||||
| renderStats: GLStatsJS | renderStats: GLStatsJS | ||||
| readonly assetManager: AssetManager | readonly assetManager: AssetManager | ||||
| @uiConfig() @serialize('renderManager') | |||||
| /** | |||||
| * The Scene attached to the viewer, this cannot be changed. | |||||
| * @type {RootScene} | |||||
| */ | |||||
| @uiConfig(undefined, {label: 'Scene', expanded: true}) @serialize('scene') | |||||
| private readonly _scene: RootScene | |||||
| @uiConfig(undefined, {label: 'Rendering', expanded: true}) @serialize('renderManager') | |||||
| readonly renderManager: ViewerRenderManager | readonly renderManager: ViewerRenderManager | ||||
| get materialManager() { | get materialManager() { | ||||
| return this.assetManager.materials | return this.assetManager.materials | ||||
| private readonly _canvas: HTMLCanvasElement | private readonly _canvas: HTMLCanvasElement | ||||
| // this can be used by other plugins to add ui elements alongside the canvas | // this can be used by other plugins to add ui elements alongside the canvas | ||||
| private readonly _container: HTMLElement // todo: add a way to move the canvas to a new container... and dispatch event... | private readonly _container: HTMLElement // todo: add a way to move the canvas to a new container... and dispatch event... | ||||
| /** | |||||
| * The Scene attached to the viewer, this cannot be changed. | |||||
| * @type {RootScene} | |||||
| */ | |||||
| @uiConfig() @serialize('scene') | |||||
| private readonly _scene: RootScene | |||||
| private _needsResize = false | private _needsResize = false | ||||
| private _isRenderingFrame = false | private _isRenderingFrame = false | ||||
| private _objectProcessor: IObjectProcessor = { | private _objectProcessor: IObjectProcessor = { |