@realsee/five
Version:
Realsee Renderer SDK
112 lines (111 loc) • 4.71 kB
TypeScript
import * as THREE from 'three';
export type RegionBoundingVolumeJson = {
region: number[];
};
export type BoxBoundingVolumeJson = {
box: number[];
};
export type SphereBoundingVolumeJson = {
sphere: number[];
};
export type BoundingVolumeJson = RegionBoundingVolumeJson | BoxBoundingVolumeJson | SphereBoundingVolumeJson;
export declare enum VolumePlaneIntersect {
Outside = -1,
Intersecting = 0,
Inside = 1
}
export declare class CullingVolume {
static get MASK_OUTSIDE(): number;
static get MASK_INSIDE(): number;
static get MASK_INDETERMINATE(): number;
planes: THREE.Plane[];
constructor(planes?: THREE.Plane[]);
setFromFrustum(frustum: THREE.Frustum): this;
setFromCamera(camera: THREE.Camera): this;
applyMatrix4(matrix: THREE.Matrix4): void;
copy(cullingVolume: CullingVolume): this;
clone(): CullingVolume;
computeVisibility(boundingVolume: BoundingVolume): VolumePlaneIntersect;
computeVisibilityWithPlaneMask(boundingVolume: BoundingVolume, parentPlaneMask: number): number;
}
export interface BoundingVolume {
type: 'box' | 'sphere' | 'regin';
applyMatrix4(matrix: THREE.Matrix4): this;
getBoundingBox(target: THREE.Box3): THREE.Box3;
toGeometry(): THREE.BufferGeometry;
getCenter(result: THREE.Vector3): THREE.Vector3;
distanceSquaredToPoint(point: THREE.Vector3): number;
distanceToPoint(point: THREE.Vector3): number;
distanceToPlane(plane: THREE.Plane): number;
intersectPlane(plane: THREE.Plane): VolumePlaneIntersect;
intersectRay(ray: THREE.Ray, threshold?: number, far?: number): boolean;
clone(): BoundingVolume;
copy(boundingVolume: this): this;
fromJson(json: any): this;
toJson(): BoundingVolumeJson;
}
export declare class BoxBoundingVolume implements BoundingVolume {
type: "box";
center: THREE.Vector3;
halfSize: THREE.Vector3;
rotation: THREE.Matrix3;
constructor();
fromJson({ box }: BoxBoundingVolumeJson): this;
toJson(): BoxBoundingVolumeJson;
copy(boxBoundingVolume: BoxBoundingVolume): this;
clone(): BoxBoundingVolume;
applyMatrix4(matrix: THREE.Matrix4): this;
getCenter(result: THREE.Vector3): THREE.Vector3;
distanceSquaredToPoint(point: THREE.Vector3): number;
distanceToPoint(point: THREE.Vector3): number;
distanceToPlane(plane: THREE.Plane): number;
getBoundingBox(target: THREE.Box3): THREE.Box3;
toGeometry(): THREE.BufferGeometry;
intersectPlane(plane: THREE.Plane): VolumePlaneIntersect;
intersectRay(ray: THREE.Ray, threshold?: number, far?: number): boolean;
}
export declare class SphereBoundingVolume implements BoundingVolume {
type: "sphere";
center: THREE.Vector3;
radius: number;
constructor();
fromJson({ sphere }: SphereBoundingVolumeJson): this;
toJson(): SphereBoundingVolumeJson;
copy(sphereBoundingVolume: SphereBoundingVolume): this;
clone(): SphereBoundingVolume;
getBoundingBox(target: THREE.Box3): THREE.Box3;
toGeometry(): THREE.BufferGeometry;
applyMatrix4(matrix: THREE.Matrix4): this;
getCenter(result: THREE.Vector3): THREE.Vector3;
distanceSquaredToPoint(point: THREE.Vector3): number;
distanceToPoint(point: THREE.Vector3): number;
distanceToPlane(plane: THREE.Plane): number;
intersectPlane(plane: THREE.Plane): VolumePlaneIntersect;
intersectRay(ray: THREE.Ray, threshold?: number, far?: number): boolean;
}
export declare class RegionBoundingVolume implements BoundingVolume {
type: "regin";
west: number;
south: number;
east: number;
north: number;
minHeight: number;
maxHeight: number;
constructor();
fromJson({ region }: RegionBoundingVolumeJson): this;
toJson(): RegionBoundingVolumeJson;
copy(regionBoundingVolume: RegionBoundingVolume): this;
clone(): RegionBoundingVolume;
getBoundingBox(target: THREE.Box3): THREE.Box3;
toGeometry(): THREE.BufferGeometry;
applyMatrix4(matrix: THREE.Matrix4): this;
getCenter(result: THREE.Vector3): THREE.Vector3;
distanceToPoint(point: THREE.Vector3): number;
distanceSquaredToPoint(point: THREE.Vector3): number;
distanceToPlane(plane: THREE.Plane): number;
intersectPlane(plane: THREE.Plane): VolumePlaneIntersect;
intersectRay(ray: THREE.Ray, threshold?: number, far?: number): boolean;
}
export declare function isBoundingVolume(obj: any): obj is BoundingVolume;
export declare function makeBoundingVolume(header: BoundingVolumeJson | BoundingVolume): BoundingVolume;
export declare function createDebugBoundingMesh(boundingVolume: BoundingVolume, level?: number): THREE.LineSegments<THREE.BufferGeometry, THREE.LineBasicMaterial> | null;