UNPKG

@tolokoban/tgd

Version:

ToloGameDev library for WebGL2

90 lines 2.68 kB
import { TgdDataset } from "../../dataset"; import { TgdPainter } from "../painter"; import { ArrayNumber2, ArrayNumber4 } from "../../types"; import { TgdTexture2D } from "../../texture"; import { TgdCamera } from "../../camera"; import { TgdMaterial } from "../../material"; export type TgdPainterSegmentsOptions = { /** * Number of faces around the cylinder. * Min is 3. * Default to **3**. */ roundness: number; /** * With orthographic camera, this is a value in pixels. */ minRadius: number; /** * Material to apply to the resulting mesh. */ material?: TgdMaterial; }; /** * @example * ``` * const factory = new TgdPainterSegmentsData() * factory.add( * [0, 0, 0, .2], * [1, 0, 0, .1], * ) * factory.add( * [0, 0, 0, .2], * [0, 1, 0, .1], * ) * factory.add( * [0, 0, 0, .2], * [0, 0, 1, .1], * ) * const segments = new TgdPainterSegments( * segment, factory * ) * ``` */ export declare class TgdPainterSegments extends TgdPainter { protected readonly context: { gl: WebGL2RenderingContext; camera: TgdCamera; }; colorTexture: TgdTexture2D; minRadius: number; radiusMultiplier: number; radiusConstant: number; radiusSwitch: number; private readonly vao; private readonly prg; private readonly vertexCount; private readonly instanceCount; private readonly material; constructor(context: { gl: WebGL2RenderingContext; camera: TgdCamera; }, options: Partial<TgdPainterSegmentsOptions> & { makeDataset: () => InstanceDataset; }); delete(): void; paint(time: number, delay: number): void; } type InstanceDataset = TgdDataset; export declare class TgdPainterSegmentsData { private _count; private readonly attXYZR0; private readonly attUV0; private readonly attInfluence0; private readonly attXYZR1; private readonly attUV1; private readonly attInfluence1; get count(): number; /** * @param XYZR0 (x,y,z) and radius of point A. * @param XYZR1 (x,y,z) and radius of point B. * @param UV0 Texture coordinates for point A. * @param UV1 Texture coordinates for point B. * @param radiusMultiplierInfluence0 If you put 0, the radius won't change regardless to the currently applied radius multiplicator. * @param radiusMultiplierInfluence1 */ add(XYZR0: ArrayNumber4, XYZR1: ArrayNumber4, UV0?: ArrayNumber2, UV1?: ArrayNumber2, radiusMultiplierInfluence0?: number, radiusMultiplierInfluence1?: number): void; readonly makeDataset: () => InstanceDataset; } export {}; //# sourceMappingURL=segments.d.ts.map