| @@ -4,6 +4,13 @@ import {BlobExt, ExportFileOptions, IAssetExporter, IExporter, IExportParser} fr | |||
| import {EXRExporter2, SimpleJSONExporter, SimpleTextExporter} from './export' | |||
| import {IRenderTarget} from '../rendering' | |||
| /** | |||
| * Asset Exporter | |||
| * | |||
| * Utility class to export objects, materials, textures, render targets, etc. | |||
| * Used in {@link AssetManager} to export assets. | |||
| * @category Asset Manager | |||
| */ | |||
| export class AssetExporter extends EventDispatcher<BaseEvent, 'exporterCreate' | 'exportFile'> implements IAssetExporter { | |||
| readonly exporters: IExporter[] = [ | |||
| {ctor: ()=>new SimpleJSONExporter(), ext: ['json']}, | |||
| @@ -24,6 +24,14 @@ export type IAssetImporterEvent = Event&{ | |||
| url?: string, loaded?: number, total?: number | |||
| loader?: ILoader, | |||
| } | |||
| /** | |||
| * Asset Importer | |||
| * | |||
| * Utility class to import assets from local files, blobs, urls, etc. | |||
| * Used in {@link AssetManager} to import assets. | |||
| * Acts as a wrapper over three.js LoadingManager and adds support for dynamically loading loaders, caching assets, better event dispatching and file tracking. | |||
| * @category Asset Manager | |||
| */ | |||
| export class AssetImporter extends EventDispatcher<IAssetImporterEvent, IAssetImporterEventTypes> implements IAssetImporter { | |||
| private _loadingManager: LoadingManager | |||
| @@ -54,8 +62,6 @@ export class AssetImporter extends EventDispatcher<IAssetImporterEvent, IAssetIm | |||
| this._loadingManager = new LoadingManager(this._onLoad, this._onProgress, this._onError) | |||
| this._loadingManager.onStart = this._onStart | |||
| this._loadingManager.setURLModifier(this._urlModifier) | |||
| // addDracoLoader() | |||
| } | |||
| get loadingManager(): LoadingManager { | |||
| @@ -67,6 +67,12 @@ export type ImportAddOptions = ImportAssetOptions & AddAssetOptions | |||
| export type AddRawOptions = ProcessRawOptions & AddAssetOptions | |||
| /** | |||
| * Asset Manager | |||
| * | |||
| * Utility class to manage import, export, and material management. | |||
| * @category Asset Manager | |||
| */ | |||
| export class AssetManager extends EventDispatcher<BaseEvent&{data: ImportResult}, 'loadAsset'> { | |||
| static readonly PluginType = 'AssetManager' | |||
| readonly viewer: ThreeViewer | |||
| @@ -22,7 +22,7 @@ export type ExportFileOptions = { | |||
| /** | |||
| * Export and bundle the viewer config (scene settings). | |||
| * only works for rootSceneModelRoot and supported only in GLTFExporter2 {@link GLTFExporter2Options.viewerConfig} | |||
| * {@default true} | |||
| * @default true | |||
| */ | |||
| viewerConfig?: boolean, | |||
| @@ -14,7 +14,13 @@ import {downloadFile} from 'ts-browser-helpers' | |||
| import {MaterialExtension} from '../materials' | |||
| import {generateUUID, isInScene} from '../three' | |||
| /** | |||
| * Material Manager | |||
| * Utility class to manage materials. | |||
| * Maintains a library of materials and material templates that can be used to manage or create new materials. | |||
| * Used in {@link AssetManager} to manage materials. | |||
| * @category Asset Manager | |||
| */ | |||
| export class MaterialManager<T = ''> extends EventDispatcher<BaseEvent, T> { | |||
| readonly templates: IMaterialTemplate[] = [ | |||
| PhysicalMaterial.MaterialTemplate, | |||
| @@ -1,6 +1,10 @@ | |||
| import {IViewerPluginSync, ThreeViewer} from '../../viewer' | |||
| import {Importer, Rhino3dmLoader2} from '../../assetmanager' | |||
| /** | |||
| * Adds support for loading Rhino `.3dm` files. | |||
| * @category Plugins | |||
| */ | |||
| export class Rhino3dmLoadPlugin implements IViewerPluginSync { | |||
| declare ['constructor']: typeof Rhino3dmLoadPlugin | |||
| @@ -14,6 +14,15 @@ export interface DropzonePluginOptions { | |||
| importOptions?: ImportFilesOptions | |||
| addOptions?: AddAssetOptions | |||
| } | |||
| /** | |||
| * Dropzone Plugin | |||
| * | |||
| * Adds a dropzone to the viewer for importing assets. | |||
| * | |||
| * Automatically imports and adds assets to the scene, the behavior can be configured. | |||
| * @category Plugins | |||
| */ | |||
| @uiFolderContainer('Dropzone') | |||
| export class DropzonePlugin extends AViewerPluginSync<'drop'> { | |||
| static readonly PluginType = 'Dropzone' | |||
| @@ -2,10 +2,15 @@ import {uiButton, uiFolderContainer} from 'uiconfig.js' | |||
| import {AViewerPluginSync} from '../../viewer' | |||
| /** | |||
| * A simple plugin that provides functions to enter, exit, toggle full screen mode and check if the viewer is in full screen mode. | |||
| * Full Screen Plugin | |||
| * | |||
| * A simple plugin that provides functions to {@link enter}, {@link exit}, {@link toggle} full screen mode and check if the viewer is in full screen mode with {@link isFullScreen}. | |||
| * | |||
| * Implementation from: | |||
| * https://stackoverflow.com/questions/50568474/how-to-enter-fullscreen-in-three-js | |||
| * | |||
| * @todo: try out some lib like https://github.com/sindresorhus/screenfull for proper cross browser support | |||
| * @category Plugins | |||
| */ | |||
| @uiFolderContainer('Full Screen') | |||
| export class FullScreenPlugin extends AViewerPluginSync<'enter'|'exit'> { | |||
| @@ -24,6 +24,12 @@ export type DepthBufferPluginEventTypes = '' | |||
| export type DepthBufferPluginTarget = WebGLRenderTarget | |||
| export type DepthBufferPluginPass = GBufferRenderPass<'depth', DepthBufferPluginTarget> | |||
| /** | |||
| * Depth Buffer Plugin | |||
| * | |||
| * Adds a pre-render pass to render the depth buffer to a render target that can be used as gbuffer or for postprocessing. | |||
| * @category Plugins | |||
| */ | |||
| @uiFolderContainer('Depth Buffer Plugin') | |||
| export class DepthBufferPlugin | |||
| extends PipelinePassPlugin<DepthBufferPluginPass, 'depth', DepthBufferPluginEventTypes> { | |||
| @@ -26,6 +26,12 @@ export type NormalBufferPluginEventTypes = '' | |||
| // type NormalBufferPluginTarget = WebGLMultipleRenderTargets | WebGLRenderTarget | |||
| export type NormalBufferPluginTarget = WebGLRenderTarget | |||
| export type NormalBufferPluginPass = GBufferRenderPass<'normal', NormalBufferPluginTarget> | |||
| /** | |||
| * Normal Buffer Plugin | |||
| * | |||
| * Adds a pre-render pass to render the normal buffer to a render target that can be used for postprocessing. | |||
| * @category Plugins | |||
| */ | |||
| @uiFolderContainer('Normal Buffer Plugin') | |||
| export class NormalBufferPlugin | |||
| extends PipelinePassPlugin<NormalBufferPluginPass, 'normal', NormalBufferPluginEventTypes> { | |||
| @@ -16,13 +16,15 @@ | |||
| "*": "https://repalash.com/uiconfig-tweakpane" | |||
| } | |||
| }, | |||
| "entryPoints": ["src/index.ts"], | |||
| "entryPoints": [ | |||
| "src/index.ts" | |||
| ], | |||
| "name": "ThreePipe", | |||
| "excludeExternals": true, | |||
| "readme": "none", | |||
| "categorizeByGroup": false, | |||
| "categoryOrder": [ | |||
| "Viewer", "*", "Others" | |||
| "Viewer", "Plugins", "Asset Manager", "*", "Others" | |||
| ], | |||
| "externalPattern": [ | |||
| "**/node_modules/**", | |||