UNPKG

threepipe

Version:

A modern 3D viewer framework built on top of three.js, written in TypeScript, designed to make creating high-quality, modular, and extensible 3D experiences on the web simple and enjoyable.

64 lines 2.85 kB
import { AViewerPluginSync, ThreeViewer } from '../../viewer'; import { IGeometry, IObject3D } from '../../core'; import { ValOrArr } from 'ts-browser-helpers'; export interface SimplifyOptions { /** * Number of vertices to remove. * Factor is not used when count is set. */ count?: number; /** * Factor of vertices to remove. eg 0.5 will remove half of the vertices. */ factor?: number; /** * Replace the geometry with the simplified version in all meshes that use it. */ replace?: boolean; /** * Displace the simplified geometry in the scene. Only used when replace is true * If set to true, the geometry will be disposed when replaced. * Default is false. * This will automatically be done when disposeOnIdle is not false in the geometry.userData. */ disposeOnReplace?: boolean; } /** * Boilerplate for implementing a plugin for simplifying geometries. * This is a base class and cannot be used directly. * See {@link MeshOptSimplifyModifierPlugin} the [simplify-modifier-plugin](https://threepipe.org/examples/#simplify-modifier-plugin) example for a sample implementation. */ export declare abstract class SimplifyModifierPlugin extends AViewerPluginSync { static readonly PluginType: string; enabled: boolean; toJSON: any; constructor(); get initialized(): boolean; initialize(): Promise<void>; private _pickingPlugin?; onAdded(viewer: ThreeViewer): void; /** * 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. */ simplifyFactor: number; simplifyGeometries(geometry?: ValOrArr<IGeometry>, options?: SimplifyOptions): IGeometry<import("three").NormalBufferAttributes, import("three").BufferGeometryEventMap>[] | undefined; simplifyGeometry(geometry?: IGeometry, { factor, count, replace, disposeOnReplace, }?: SimplifyOptions): IGeometry | undefined; /** * 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 * } * ` * @param geometry * @param count */ protected abstract _simplify(geometry: IGeometry, count: number): IGeometry; simplifyAll(root?: IObject3D, options?: SimplifyOptions): Promise<IGeometry<import("three").NormalBufferAttributes, import("three").BufferGeometryEventMap>[] | undefined>; simplifySelected(): Promise<void>; } //# sourceMappingURL=SimplifyModifierPlugin.d.ts.map