UNPKG

@tolokoban/tgd

Version:

ToloGameDev library for WebGL2

61 lines 2.18 kB
import type { TgdContext } from "../../context"; import type { TgdInterfaceTransformable } from "../../interface"; import { type TgdMat4 } from "../../math"; import type { ArrayNumber3 } from "../../types"; import { TgdPainter } from "../painter"; export interface TgdPainterLODOptions { bbox: Readonly<{ min: Readonly<ArrayNumber3>; max: Readonly<ArrayNumber3>; }>; /** * This is a precentage of the size of the screen. * If the containing square of a LOD block has a surface * greater than `surfaceThreshold`, it will be splited in * 8 sub blocks. * * Default to .25 */ surfaceThreshold?: number; /** * Maximum number of octree subdivisions. * * - 0: there is only one mesh for the whole bbox. * - 1: there is one mesh for the whole bbox in low res, * and 8 meshes of parts of the bbox in high res. * - 2: all the meshes as 1 but the high res one are splitter in 8 * with even higher res. * - 3: etc... * * There is no upper limit for this number, but it must be positive. */ subdivisions: number; /** * `x`, `y` and `z` are integers between 0 and 2**`level` - `. * * This method will be called by TgdPainterLOD to create painters, * so it's TgdPainterLOD responsability to delete them. * This is done by calling `TgdPainterLOD.delete()` method. * * @returns `null` if this block is empty */ factory(x: number, y: number, z: number, level: number): Promise<Readonly<TgdPainter> | null>; } export declare class TgdPainterLOD extends TgdPainter implements TgdInterfaceTransformable { readonly context: TgdContext; private readonly options; readonly transfo: Readonly<{ matrix: TgdMat4; }>; private readonly group; private readonly cache; private readonly paintersToDelete; private isComputingOctree; constructor(context: TgdContext, options: TgdPainterLODOptions); delete(): void; paint(time: number, delta: number): void; private computeOctree; private getMeshPromise; debug(caption?: string): void; } //# sourceMappingURL=lod.d.ts.map