UNPKG

@pnext/three-loader

Version:

Potree loader for ThreeJS, converted and adapted to Typescript.

74 lines (73 loc) 2.48 kB
/** * Adapted from Potree.js http://potree.org * Potree License: https://github.com/potree/potree/blob/1.5/LICENSE */ import { Box3, BufferGeometry, EventDispatcher, Sphere, Vector3 } from 'three'; import { PointCloudOctreeGeometry } from './point-cloud-octree-geometry'; import { IPointCloudGeometryNode } from './types'; export interface NodeData { children: number; numPoints: number; name: string; } export declare class PointCloudOctreeGeometryNode extends EventDispatcher implements IPointCloudGeometryNode { id: number; name: string; pcoGeometry: PointCloudOctreeGeometry; index: number; level: number; spacing: number; hasChildren: boolean; readonly children: ReadonlyArray<PointCloudOctreeGeometryNode | null>; boundingBox: Box3; tightBoundingBox: Box3; boundingSphere: Sphere; mean: Vector3; numPoints: number; geometry: BufferGeometry | undefined; loaded: boolean; loading: boolean; failed: boolean; parent: PointCloudOctreeGeometryNode | null; oneTimeDisposeHandlers: (() => void)[]; isLeafNode: boolean; readonly isTreeNode: boolean; readonly isGeometryNode: boolean; private static idCount; constructor(name: string, pcoGeometry: PointCloudOctreeGeometry, boundingBox: Box3); dispose(): void; /** * Gets the url of the binary file for this node. */ getUrl(): string; /** * Gets the url of the hierarchy file for this node. */ getHierarchyUrl(): string; /** * Adds the specified node as a child of the current node. * * @param child * The node which is to be added as a child. */ addChild(child: PointCloudOctreeGeometryNode): void; /** * Calls the specified callback for the current node (if includeSelf is set to true) and all its * children. * * @param cb * The function which is to be called for each node. */ traverse(cb: (node: PointCloudOctreeGeometryNode) => void, includeSelf?: boolean): void; load(): Promise<void>; private canLoad; private loadPoints; private loadHierachyThenPoints; /** * Gets the url of the folder where the hierarchy is, relative to the octreeDir. */ private getHierarchyBaseUrl; private loadHierarchy; private getNodeData; addNode({ name, numPoints, children }: NodeData, pco: PointCloudOctreeGeometry, nodes: Map<string, PointCloudOctreeGeometryNode>): void; }