@tolokoban/tgd
Version:
ToloGameDev library for WebGL2
125 lines • 3.92 kB
TypeScript
import type { TgdBuffer, TgdBufferOptionTarget, TgdBufferOptionUsage } from "../../buffer";
import { TgdContext } from "../../context";
import { TgdDataset } from "../../dataset";
import { type TgdMaterial } from "../../material";
import { TgdTransfo } from "../../math";
import { TgdPainter } from "../painter";
import type { ArrayNumber2, ArrayNumber4 } from "../../types";
type DatasetOption = TgdPainterSegments | InstanceDataset | (() => InstanceDataset);
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;
/**
* Multiply all the radii by this value.
*
* Default to `1`.
*/
radiusMultiplier?: number;
/**
* Material to apply to the resulting mesh.
*/
material?: TgdMaterial;
/**
* If a `TgdPainterSegments` is given, then the
* data will be shared between the painters.
*/
dataset: DatasetOption;
};
/**
* @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: TgdContext;
static createDataset({ attXYZR0, attUV0, attInfluence0, attXYZR1, attUV1, attInfluence1, buffer, usage, target, }?: Partial<{
attXYZR0: string;
attUV0: string;
attInfluence0: string;
attXYZR1: string;
attUV1: string;
attInfluence1: string;
buffer: TgdBuffer;
target: TgdBufferOptionTarget;
usage: TgdBufferOptionUsage;
}>): TgdDataset;
readonly transfo: TgdTransfo;
minRadius: number;
radiusMultiplier: number;
radiusConstant: number;
radiusSwitch: number;
instanceCount: number;
private readonly vao;
private readonly prg;
private readonly vertexCount;
private readonly material;
constructor(context: TgdContext, options: TgdPainterSegmentsOptions);
debug(caption?: string): void;
getBuffer(): TgdBuffer | undefined;
delete(): void;
paint(time: number, delta: 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;
getXYZR0(index: number): ArrayNumber4;
getXYZR1(index: number): ArrayNumber4;
/**
* @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;
/**
* You can rename the attributes if you need to use
* them in another Painter.
*/
readonly makeDataset: (args?: Partial<{
attXYZR0: string;
attUV0: string;
attInfluence0: string;
attXYZR1: string;
attUV1: string;
attInfluence1: string;
buffer: TgdBuffer;
target: TgdBufferOptionTarget;
usage: TgdBufferOptionUsage;
}>) => InstanceDataset;
}
export {};
//# sourceMappingURL=segments.d.ts.map