threepipe
Version:
A 3D viewer framework built on top of three.js in TypeScript with a focus on quality rendering, modularity and extensibility.
51 lines • 2.28 kB
TypeScript
import { BufferGeometry, Event, NormalBufferAttributes, NormalOrGLBufferAttributes, Vector3 } from 'three';
import { IUiConfigContainer, UiObjectConfig } from 'uiconfig.js';
import { AnyOptions } from 'ts-browser-helpers';
import { IObject3D } from './IObject';
import { IImportResultUserData } from '../assetmanager';
export interface IGeometryUserData extends IImportResultUserData {
/**
* Automatically dispose geometry when not used by any object in the scene
* @default true
*/
disposeOnIdle?: boolean;
}
export interface IGeometry<Attributes extends NormalOrGLBufferAttributes = NormalBufferAttributes> extends BufferGeometry<Attributes, IGeometryEvent, IGeometryEventTypes>, IUiConfigContainer {
assetType: 'geometry';
setDirty(options?: IGeometrySetDirtyOptions): void;
refreshUi(): void;
uiConfig?: UiObjectConfig;
appliedMeshes: Set<IObject3D>;
/**
* Centers the geometry.
* @param offset - returns the offset applied to the geometry
* @param keepWorldPosition - Updates the attached meshes, so that the world position of the geometry remains the same.
* @param setDirty
*/
center(offset?: Vector3, keepWorldPosition?: boolean, setDirty?: boolean): this;
/**
* Same as center but returns a function to undo the centering
* @param offset
* @param keepWorldPosition
*/
center2(offset?: Vector3, keepWorldPosition?: boolean): () => void;
userData: IGeometryUserData;
/**
* Disposes the geometry from the GPU.
* Set force to false if not sure the geometry is used by any object in the scene.
* // todo add check for visible in scene also? or is that overkill
* @param force - when true, same as three.js dispose. when false, only disposes if disposeOnIdle not false and not used by any object in the scene. default: true
*/
dispose(force?: boolean): void;
_uiConfig?: UiObjectConfig;
}
export type IGeometryEventTypes = 'dispose' | 'geometryUpdate';
export type IGeometryEvent<T extends string = IGeometryEventTypes> = Event & {
type: T;
bubbleToObject?: boolean;
geometry?: IGeometry;
};
export type IGeometrySetDirtyOptions = AnyOptions & {
bubbleToObject?: boolean;
};
//# sourceMappingURL=IGeometry.d.ts.map