@spearwolf/twopoint5d
Version:
Create 2.5D realtime graphics and pixelart with WebGL and three.js
42 lines • 1.6 kB
TypeScript
import type { OrthographicCamera, PerspectiveCamera } from 'three/webgpu';
import { Box3, Matrix4, Plane, Vector2, Vector3 } from 'three/webgpu';
import { Map2DTileCoordsUtil, type TilesWithinCoords } from './Map2DTileCoordsUtil.js';
import type { IMap2DTileCoords, IMap2DVisibilitor, IMap2DVisibleTiles } from './types.js';
interface TileBox {
id: string;
x: number;
y: number;
coords?: TilesWithinCoords;
box?: Box3;
frustumBox?: Box3;
centerWorld?: Vector3;
distanceToCamera?: number;
map2dTile?: IMap2DTileCoords;
primary?: boolean;
}
export declare class CameraBasedVisibility implements IMap2DVisibilitor {
#private;
static readonly Plane: Plane;
frustumBoxScale: number;
lookAtCenter: boolean;
depth: number;
camera?: PerspectiveCamera | OrthographicCamera;
planeWorld: Plane;
planeOrigin: Vector3;
pointOnPlane?: Vector3;
planeCoords2D: Vector2;
matrixWorld: Matrix4;
map2dTileCoords: Map2DTileCoordsUtil;
readonly visibles: TileBox[];
constructor(camera?: PerspectiveCamera | OrthographicCamera);
private dependenciesChanged;
private invalidateTileCoordsCacheIfChanged;
computeVisibleTiles(previousTiles: IMap2DTileCoords[], [centerX, centerY]: [number, number], map2dTileCoords: Map2DTileCoordsUtil, matrixWorld: Matrix4): IMap2DVisibleTiles | undefined;
private findPointOnPlaneThatIsInViewFrustum;
private acquireTileBox;
private findVisibleTiles;
private convertToPlaneCoords2D;
private setBox;
}
export {};
//# sourceMappingURL=CameraBasedVisibility.d.ts.map