Bläddra i källkod

Add some docs.

master
Palash Bansal 2 år sedan
förälder
incheckning
dbecb15535
Inget konto är kopplat till bidragsgivarens mejladress

+ 7
- 0
src/assetmanager/AssetExporter.ts Visa fil

@@ -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']},

+ 8
- 2
src/assetmanager/AssetImporter.ts Visa fil

@@ -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 {

+ 6
- 0
src/assetmanager/AssetManager.ts Visa fil

@@ -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

+ 1
- 1
src/assetmanager/IExporter.ts Visa fil

@@ -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,


+ 7
- 1
src/assetmanager/MaterialManager.ts Visa fil

@@ -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,

+ 4
- 0
src/plugins/import/Rhino3dmLoadPlugin.ts Visa fil

@@ -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


+ 9
- 0
src/plugins/interaction/DropzonePlugin.ts Visa fil

@@ -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'

+ 6
- 1
src/plugins/interaction/FullScreenPlugin.ts Visa fil

@@ -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'> {

+ 6
- 0
src/plugins/pipeline/DepthBufferPlugin.ts Visa fil

@@ -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> {

+ 6
- 0
src/plugins/pipeline/NormalBufferPlugin.ts Visa fil

@@ -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> {

+ 4
- 2
typedoc.json Visa fil

@@ -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/**",

Laddar…
Avbryt
Spara