@mlightcad/three-viewcube
Version:
A highly customizable standalone view cube addon for three.js
54 lines • 2.02 kB
TypeScript
import * as THREE from 'three';
/**
* Enum to define postion of the gizmo.
*/
export declare enum ObjectPosition {
LEFT_BOTTOM = 0,
LEFT_TOP = 1,
RIGHT_TOP = 2,
RIGHT_BOTTOM = 4
}
/**
* A customizable gizmo with fixed postion in viewport
*/
export declare class FixedPosGizmo<TEventMap extends THREE.Object3DEventMap = THREE.Object3DEventMap> extends THREE.Object3D<TEventMap> {
protected gizmoCamera: THREE.OrthographicCamera;
protected renderer: THREE.WebGLRenderer;
protected camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
protected gizmoDim: number;
protected gizmoPos: ObjectPosition;
/**
* Construct one instance of this gizmo
* @param camera Camera used in your canvas
* @param renderer Renderer used in your canvas
* @param dimension Size of area ocupied by this gizmo. Because width and height of this area is same,
* it is single value. The real size of the objet will be calculated automatically considering rotation.
* @param pos Position of the gizmo
*/
constructor(camera: THREE.PerspectiveCamera | THREE.OrthographicCamera, renderer: THREE.WebGLRenderer, dimension?: number, pos?: ObjectPosition);
/**
* Function called by constructor to initialize this gizmo. The children class can override this function
* to add its own initialization logic.
*/
initialize(): void;
/**
* Update and rerender this gizmo
*/
update(): void;
/**
* Free the GPU-related resources allocated by this instance. Call this method whenever this instance
* is no longer used in your app.
*/
dispose(): void;
protected updateOrientation(): void;
protected calculatePosInViewport(offsetX: number, offsetY: number, bbox: THREE.Box2): {
x: number;
y: number;
};
protected calculateViewportPos(): {
x: number;
y: number;
};
protected calculateViewportBbox(): THREE.Box2;
}
//# sourceMappingURL=fixedPosGizmo.d.ts.map