UNPKG

@tolokoban/tgd

Version:

ToloGameDev library for WebGL2

118 lines 3.2 kB
import type { TgdContext } from "../../context"; import { type TgdCodeBloc } from "../../shader"; import { TgdTexture2D } from "../../texture"; import { TgdPainter } from "../painter"; interface TgdPainterPointsCloudMorphingData { /** * Flatten array of points: * `[ x1, y1, z1, radius1, x2, y2, z2, radius2, ... ]` */ point: Float32Array; /** * Flatten array of UVs: * `[ u1, v1, u2, v2, ... ]` */ uv?: Float32Array; } export interface TgdPainterPointsCloudMorphingOptions { name?: string; data: [TgdPainterPointsCloudMorphingData, TgdPainterPointsCloudMorphingData][]; /** * Mix between two point clouds. * * Default to `0.0`. */ mix?: number; /** * Multiply the radius of each point by this value. * * Default to 1. */ radiusMultiplier?: number; /** * Depending on the radius and the distance to the camera, * the point can be invisible. * This value is the minimum size of the point in pixels. * * Default to 0. */ minSizeInPixels?: number; texture?: TgdTexture2D; /** * The content of a fragment shader function that takes * `vec4 color` as argument and must return a `vec4` color. * * The following uniforms are available: * * ```glsl * uniform float uniSpecularExponent; * uniform float uniSpecularIntensity; * uniform float uniShadowThickness; * uniform float uniShadowIntensity; * uniform float uniLight; * ``` * * You can also use `TgdPainterPointsCloud.fragCode*()` static functions * to provide preset functions. */ fragCode?: TgdCodeBloc; /** * Default to 10 */ specularExponent?: number; /** * Default to 0.33 */ specularIntensity?: number; /** * Default to 0.5 */ shadowIntensity?: number; /** * Default to 1 */ shadowThickness?: number; /** * Default to 1 */ light?: number; } export declare class TgdPainterPointsCloudMorphing extends TgdPainter { readonly context: TgdContext; /** * Draw spheres with simple diffuse/specular material. */ static fragCodeSphere(options?: Partial<{ specularExponent: number; specularIntensity: number; shadowThickness: number; shadowIntensity: number; light: number; }>): TgdCodeBloc; /** * Mixing between two clouds: 0.0 (firts) and 1.0 (second). */ mix: number; texture: TgdTexture2D; radiusMultiplier: number; minSizeInPixels: number; specularExponent: number; specularIntensity: number; shadowIntensity: number; shadowThickness: number; light: number; private readonly textureMustBeDeleted; private readonly datasets; private readonly program; private readonly vaos; private readonly counts; constructor(context: TgdContext, options: TgdPainterPointsCloudMorphingOptions); delete(): void; paint(): void; private createDataset; get count(): number; private get vao(); private createProgram; } export {}; //# sourceMappingURL=points-cloud-morphing.d.ts.map