Skip to main content

Class: MeshOptSimplifyModifierPlugin

Plugins.MeshOptSimplifyModifierPlugin

Simplify modifier using meshoptimizer library. Loads the library at runtime from a customisable cdn url.

Hierarchy

Properties

PluginType

Static Readonly PluginType: "MeshOptSimplifyModifierPlugin"

Overrides

SimplifyModifierPlugin.PluginType

Defined in

webgi/src/plugins/MeshOptSimplifyModifierPlugin.ts:13


SIMPLIFIER_URL

Static SIMPLIFIER_URL: string = 'https://unpkg.com/[email protected]/meshopt_simplifier.module.js'

Defined in

webgi/src/plugins/MeshOptSimplifyModifierPlugin.ts:26


rootNode

Readonly rootNode: HTMLHeadElement = document.head


errorThreshold

errorThreshold: number = 0.5

Defined in

webgi/src/plugins/MeshOptSimplifyModifierPlugin.ts:61


lockBorder

lockBorder: boolean = false

Defined in

webgi/src/plugins/MeshOptSimplifyModifierPlugin.ts:63


enabled

enabled: boolean = true

Inherited from

SimplifyModifierPlugin.enabled

Defined in

webgi/src/plugins/SimplifyModifierPlugin.ts:39


toJSON

toJSON: any = undefined

Inherited from

SimplifyModifierPlugin.toJSON

Defined in

webgi/src/plugins/SimplifyModifierPlugin.ts:40


simplifyFactor

simplifyFactor: number = 0.5

Factor of vertices to remove. eg 0.5 will remove half of the vertices. Default is 0.5 This is used when no factor or count is provided in the options to simplifyGeometry or simplifyGeometries.

Inherited from

SimplifyModifierPlugin.simplifyFactor

Defined in

webgi/src/plugins/SimplifyModifierPlugin.ts:61


_dirty

Protected _dirty: boolean = false

Inherited from

SimplifyModifierPlugin._dirty

Defined in

webgi/src/core/AViewerPlugin.ts:23


_viewer

Protected Optional _viewer: ViewerApp

Inherited from

SimplifyModifierPlugin._viewer

Defined in

webgi/src/core/AViewerPlugin.ts:27


_initializing

Protected Optional _initializing: Promise<void> = undefined

Defined in

webgi/src/plugins/MeshOptSimplifyModifierPlugin.ts:28


_script

Protected Optional _script: HTMLScriptElement

Defined in

webgi/src/plugins/MeshOptSimplifyModifierPlugin.ts:29

Accessors

dirty

get dirty(): boolean

Returns

boolean

Inherited from

SimplifyModifierPlugin.dirty

Defined in

webgi/src/core/AViewerPlugin.ts:16

set dirty(value): void

Parameters

NameType
valueboolean

Returns

void

Inherited from

SimplifyModifierPlugin.dirty

Defined in

webgi/src/core/AViewerPlugin.ts:20


viewer

get viewer(): undefined | TViewer

Returns

undefined | TViewer

Inherited from

SimplifyModifierPlugin.viewer

Defined in

webgi/src/core/AViewerPlugin.ts:29


initialized

get initialized(): boolean

Returns

boolean

Overrides

SimplifyModifierPlugin.initialized

Defined in

webgi/src/plugins/MeshOptSimplifyModifierPlugin.ts:21

Methods

onDispose

onDispose(viewer): Promise<void>

Parameters

NameType
viewerViewerApp

Returns

Promise<void>

Inherited from

SimplifyModifierPlugin.onDispose

Defined in

webgi/src/core/AViewerPlugin.ts:40


onRemove

onRemove(viewer): Promise<void>

Parameters

NameType
viewerViewerApp

Returns

Promise<void>

Inherited from

SimplifyModifierPlugin.onRemove

Defined in

webgi/src/core/AViewerPlugin.ts:44


fromJSON

fromJSON(data, meta?): null | MeshOptSimplifyModifierPlugin | Promise<null | MeshOptSimplifyModifierPlugin>

Parameters

NameType
dataany
meta?any

Returns

null | MeshOptSimplifyModifierPlugin | Promise<null | MeshOptSimplifyModifierPlugin>

Inherited from

SimplifyModifierPlugin.fromJSON

Defined in

webgi/src/core/AViewerPlugin.ts:56


exportState

exportState(): any

Returns

any

Inherited from

SimplifyModifierPlugin.exportState

Defined in

webgi/src/core/AViewerPlugin.ts:68


importState

importState(state): Promise<void>

Parameters

NameType
stateany

Returns

Promise<void>

Inherited from

SimplifyModifierPlugin.importState

Defined in

webgi/src/core/AViewerPlugin.ts:71


storeState

storeState(prefix?, storage?, data?): void

Parameters

NameType
prefix?string
storage?Storage
data?any

Returns

void

Inherited from

SimplifyModifierPlugin.storeState

Defined in

webgi/src/core/AViewerPlugin.ts:78


loadState

loadState(prefix?, storage?): Promise<void>

Parameters

NameType
prefix?string
storage?Storage

Returns

Promise<void>

Inherited from

SimplifyModifierPlugin.loadState

Defined in

webgi/src/core/AViewerPlugin.ts:88


initialize

initialize(): Promise<void>

Returns

Promise<void>

Overrides

SimplifyModifierPlugin.initialize

Defined in

webgi/src/plugins/MeshOptSimplifyModifierPlugin.ts:31


dispose

dispose(): void

Returns

void

Defined in

webgi/src/plugins/MeshOptSimplifyModifierPlugin.ts:52


onAdded

onAdded(viewer): Promise<void>

Parameters

NameType
viewerViewerApp

Returns

Promise<void>

Inherited from

SimplifyModifierPlugin.onAdded

Defined in

webgi/src/plugins/SimplifyModifierPlugin.ts:50


simplifyGeometries

simplifyGeometries(geometry?, options?): undefined | any[]

Parameters

NameType
geometry?any
options?SimplifyOptions

Returns

undefined | any[]

Inherited from

SimplifyModifierPlugin.simplifyGeometries

Defined in

webgi/src/plugins/SimplifyModifierPlugin.ts:63


simplifyGeometry

simplifyGeometry(geometry?, __namedParameters?): any

Parameters

NameType
geometry?any
__namedParametersSimplifyOptions

Returns

any

Inherited from

SimplifyModifierPlugin.simplifyGeometry

Defined in

webgi/src/plugins/SimplifyModifierPlugin.ts:81


simplifyAll

simplifyAll(root?, options?): Promise<undefined | any[]>

Parameters

NameType
root?IModel<any>
options?SimplifyOptions

Returns

Promise<undefined | any[]>

Inherited from

SimplifyModifierPlugin.simplifyAll

Defined in

webgi/src/plugins/SimplifyModifierPlugin.ts:155


simplifySelected

simplifySelected(): Promise<void>

Returns

Promise<void>

Inherited from

SimplifyModifierPlugin.simplifySelected

Defined in

webgi/src/plugins/SimplifyModifierPlugin.ts:180


_storeKey

Protected _storeKey(prefix?): string

Parameters

NameType
prefix?string

Returns

string

Inherited from

SimplifyModifierPlugin._storeKey

Defined in

webgi/src/core/AViewerPlugin.ts:64


_simplify

Protected _simplify(geometry, count): any

Sample for three.js addons SimplifyModifier: import {SimplifyModifier} from 'three/examples/jsm/modifiers/SimplifyModifier' protected _simplify(geometry: IGeometry, count: number): IGeometry { const modifier = new SimplifyModifier() return modifier.modify(geometry, count) as IGeometry }

Parameters

NameType
geometryBufferGeometry<NormalBufferAttributes, Event, string>
countnumber

Returns

any

Overrides

SimplifyModifierPlugin._simplify

Defined in

webgi/src/plugins/MeshOptSimplifyModifierPlugin.ts:65

Constructors

constructor

new MeshOptSimplifyModifierPlugin(initialize?, rootNode?)

Parameters

NameTypeDefault value
initializebooleantrue
rootNodeHTMLHeadElementdocument.head

Overrides

SimplifyModifierPlugin.constructor

Defined in

webgi/src/plugins/MeshOptSimplifyModifierPlugin.ts:15