UNPKG

@tolokoban/tgd

Version:

ToloGameDev library for WebGL2

95 lines 2.88 kB
import { TgdDataset } from "../../dataset"; import { TgdPainter } from "../painter"; import { ArrayNumber2, ArrayNumber4 } from "../../types"; import { TgdTexture2D } from "../../texture"; import { TgdCamera } from "../../camera"; export type TgdPainterSegmentsOptions = { /** * How round the tip will be? * - **0** means that the tip is flat. * - **1** will gives you a triangled tip. * - **>1** starts to have a semi-circle shape. * * **0** is the fastest to render, but you will have * a bad connection at joints between segments. * * Default to **3**. */ roundness: number; /** * With orthographic camera, this is a value in pixels. */ minRadius: number; }; /** * @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; light: number; shiftZ: number; contrast: number; specularIntensity: number; specularExponent: number; private readonly vao; private readonly prg; private readonly vertexCount; private readonly instanceCount; 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 attAxyzr; private readonly attAuv; private readonly attAinfluence; private readonly attBxyzr; private readonly attBuv; private readonly attBinfluence; get count(): number; /** * @param Axyzr (x,y,z) and radius of point A. * @param Bxyzr (x,y,z) and radius of point B. * @param Auv Texture coordinates for point A. * @param Buv Texture coordinates for point B. * @param radiusMultiplierInfluenceA If you put 0, the radius won't change regardless to the currently applied radius multiplicator. * @param radiusMultiplierInfluenceB */ add(Axyzr: ArrayNumber4, Bxyzr: ArrayNumber4, Auv?: ArrayNumber2, Buv?: ArrayNumber2, radiusMultiplierInfluenceA?: number, radiusMultiplierInfluenceB?: number): void; readonly makeDataset: () => InstanceDataset; } export {}; //# sourceMappingURL=segments.d.ts.map