Class: MeshOptSimplifyModifierPlugin
Plugins.MeshOptSimplifyModifierPlugin
Simplify modifier using meshoptimizer library. Loads the library at runtime from a customisable cdn url.
Hierarchy
↳
MeshOptSimplifyModifierPlugin
Properties
PluginType
▪ Static Readonly PluginType: "MeshOptSimplifyModifierPlugin"
Overrides
SimplifyModifierPlugin.PluginType
SIMPLIFIER_URL
▪ Static SIMPLIFIER_URL: string = 'https://unpkg.com/[email protected]/meshopt_simplifier.module.js'
rootNode
• Readonly rootNode: HTMLHeadElement = document.head
errorThreshold
• errorThreshold: number = 0.5
lockBorder
• lockBorder: boolean = false
enabled
• enabled: boolean = true
Inherited from
SimplifyModifierPlugin.enabled
toJSON
• toJSON: any = undefined
Inherited from
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
_dirty
• Protected _dirty: boolean = false
Inherited from
_viewer
• Protected Optional _viewer: ViewerApp
Inherited from
SimplifyModifierPlugin._viewer
_initializing
• Protected Optional _initializing: Promise<void> = undefined
_script
• Protected Optional _script: HTMLScriptElement
Accessors
dirty
• get dirty(): boolean
Returns
boolean
Inherited from
SimplifyModifierPlugin.dirty
• set dirty(value): void
Parameters
| Name | Type |
|---|---|
value | boolean |
Returns
void
Inherited from
SimplifyModifierPlugin.dirty
viewer
• get viewer(): undefined | ViewerApp
Returns
undefined | ViewerApp
Inherited from
SimplifyModifierPlugin.viewer
initialized
• get initialized(): boolean
Returns
boolean
Overrides
SimplifyModifierPlugin.initialized
Methods
onDispose
▸ onDispose(viewer): Promise<void>
Parameters
| Name | Type |
|---|---|
viewer | ViewerApp |
Returns
Promise<void>
Inherited from
SimplifyModifierPlugin.onDispose
onRemove
▸ onRemove(viewer): Promise<void>
Parameters
| Name | Type |
|---|---|
viewer | ViewerApp |
Returns
Promise<void>
Inherited from
SimplifyModifierPlugin.onRemove
fromJSON
▸ fromJSON(data, meta?): null | MeshOptSimplifyModifierPlugin | Promise<null | MeshOptSimplifyModifierPlugin>
Parameters
| Name | Type |
|---|---|
data | any |
meta? | any |
Returns
null | MeshOptSimplifyModifierPlugin | Promise<null | MeshOptSimplifyModifierPlugin>
Inherited from
SimplifyModifierPlugin.fromJSON
exportState
▸ exportState(): any
Returns
any
Inherited from
SimplifyModifierPlugin.exportState
importState
▸ importState(state): Promise<void>
Parameters
| Name | Type |
|---|---|
state | any |
Returns
Promise<void>
Inherited from
SimplifyModifierPlugin.importState
storeState
▸ storeState(prefix?, storage?, data?): void
Parameters
| Name | Type |
|---|---|
prefix? | string |
storage? | Storage |
data? | any |
Returns
void
Inherited from
SimplifyModifierPlugin.storeState
loadState
▸ loadState(prefix?, storage?): Promise<void>
Parameters
| Name | Type |
|---|---|
prefix? | string |
storage? | Storage |
Returns
Promise<void>
Inherited from
SimplifyModifierPlugin.loadState
initialize
▸ initialize(): Promise<void>
Returns
Promise<void>
Overrides
SimplifyModifierPlugin.initialize
dispose
▸ dispose(): void
Returns
void
onAdded
▸ onAdded(viewer): Promise<void>
Parameters
| Name | Type |
|---|---|
viewer | ViewerApp |
Returns
Promise<void>
Inherited from
SimplifyModifierPlugin.onAdded
simplifyGeometries
▸ simplifyGeometries(geometry?, options?): undefined | any[]
Parameters
| Name | Type |
|---|---|
geometry? | any |
options? | SimplifyOptions |
Returns
undefined | any[]
Inherited from
SimplifyModifierPlugin.simplifyGeometries
simplifyGeometry
▸ simplifyGeometry(geometry?, __namedParameters?): any
Parameters
| Name | Type |
|---|---|
geometry? | any |
__namedParameters | SimplifyOptions |
Returns
any
Inherited from
SimplifyModifierPlugin.simplifyGeometry
simplifyAll
▸ simplifyAll(root?, options?): Promise<undefined | any[]>
Parameters
| Name | Type |
|---|---|
root? | IModel<any, IObject3DEventMap> |
options? | SimplifyOptions |
Returns
Promise<undefined | any[]>
Inherited from
SimplifyModifierPlugin.simplifyAll
simplifySelected
▸ simplifySelected(): Promise<void>
Returns
Promise<void>
Inherited from
SimplifyModifierPlugin.simplifySelected
_storeKey
▸ Protected _storeKey(prefix?): string
Parameters
| Name | Type |
|---|---|
prefix? | string |
Returns
string
Inherited from
SimplifyModifierPlugin._storeKey
_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
| Name | Type |
|---|---|
geometry | BufferGeometry<NormalBufferAttributes, BufferGeometryEventMap> |
count | number |
Returns
any
Overrides
SimplifyModifierPlugin._simplify
Constructors
constructor
• new MeshOptSimplifyModifierPlugin(initialize?, rootNode?)
Parameters
| Name | Type | Default value |
|---|---|---|
initialize | boolean | true |
rootNode | HTMLHeadElement | document.head |