declare module "dyno/types" { import type * as THREE from "three"; export type BoolTypes = "bool" | "bvec2" | "bvec3" | "bvec4"; export type IntTypes = "int" | "ivec2" | "ivec3" | "ivec4"; export type UintTypes = "uint" | "uvec2" | "uvec3" | "uvec4"; export type AllIntTypes = IntTypes | UintTypes; export type FloatTypes = "float" | "vec2" | "vec3" | "vec4"; export type ScalarTypes = "uint" | "int" | "float"; export type Vector2Types = "vec2" | "ivec2" | "uvec2"; export type Vector3Types = "vec3" | "ivec3" | "uvec3"; export type Vector4Types = "vec4" | "ivec4" | "uvec4"; export type VectorTypes = Vector2Types | Vector3Types | Vector4Types; export type MatFloatTypes = "mat2" | "mat2x2" | "mat2x3" | "mat2x4" | "mat3" | "mat3x2" | "mat3x3" | "mat3x4" | "mat4" | "mat4x2" | "mat4x3" | "mat4x4"; export type SquareMatTypes = "mat2" | "mat3" | "mat4" | "mat2x2" | "mat3x3" | "mat4x4"; export type AllFloatTypes = FloatTypes | MatFloatTypes; export type SignedTypes = IntTypes | FloatTypes; export type AllSignedTypes = SignedTypes | MatFloatTypes; export type ValueTypes = FloatTypes | IntTypes | UintTypes; export type AllValueTypes = AllFloatTypes | IntTypes | UintTypes; export type SimpleTypes = BoolTypes | AllValueTypes; export type VectorElementType = A extends FloatTypes ? "float" : A extends IntTypes ? "int" : A extends UintTypes ? "uint" : never; export type SameSizeVec = T extends ScalarTypes ? "float" : T extends "vec2" | "ivec2" | "uvec2" ? "vec2" : T extends "vec3" | "ivec3" | "uvec3" ? "vec3" : T extends "vec4" | "ivec4" | "uvec4" ? "vec4" : never; export type SameSizeUvec = T extends ScalarTypes ? "uint" : T extends "vec2" | "ivec2" | "uvec2" ? "uvec2" : T extends "vec3" | "ivec3" | "uvec3" ? "uvec3" : T extends "vec4" | "ivec4" | "uvec4" ? "uvec4" : never; export type SameSizeIvec = T extends ScalarTypes ? "int" : T extends "vec2" | "ivec2" | "uvec2" ? "ivec2" : T extends "vec3" | "ivec3" | "uvec3" ? "ivec3" : T extends "vec4" | "ivec4" | "uvec4" ? "ivec4" : never; export type SamplerTypes = "sampler2D" | "sampler2DArray" | "sampler3D" | "samplerCube"; export type UsamplerTypes = "usampler2D" | "usampler2DArray" | "usampler3D" | "usamplerCube"; export type IsamplerTypes = "isampler2D" | "isampler2DArray" | "isampler3D" | "isamplerCube"; export type NormalSamplerTypes = SamplerTypes | UsamplerTypes | IsamplerTypes; export type SamplerShadowTypes = "sampler2DShadow" | "sampler2DArrayShadow" | "samplerCubeShadow"; export type AllSamplerTypes = NormalSamplerTypes | SamplerShadowTypes; export type Sampler2DTypes = "sampler2D" | "usampler2D" | "isampler2D" | "sampler2DShadow"; export type Sampler2DArrayTypes = "sampler2DArray" | "usampler2DArray" | "isampler2DArray" | "sampler2DArrayShadow"; export type Sampler3DTypes = "sampler3D" | "usampler3D" | "isampler3D"; export type SamplerCubeTypes = "samplerCube" | "usamplerCube" | "isamplerCube" | "samplerCubeShadow"; export function isBoolType(type: DynoType): boolean; export function isScalarType(type: DynoType): boolean; export function isIntType(type: DynoType): boolean; export function isUintType(type: DynoType): boolean; export function isFloatType(type: DynoType): boolean; export function isMatFloatType(type: DynoType): boolean; export function isAllFloatType(type: DynoType): boolean; export function isVector2Type(type: DynoType): boolean; export function isVector3Type(type: DynoType): boolean; export function isVector4Type(type: DynoType): boolean; export function isVectorType(type: DynoType): boolean; export function isMat2(type: DynoType): boolean; export function isMat3(type: DynoType): boolean; export function isMat4(type: DynoType): boolean; export function vectorElementType(type: A): VectorElementType; export function vectorDim(type: A): number; export function sameSizeVec(type: T): SameSizeVec; export function sameSizeUvec(type: T): SameSizeUvec; export function sameSizeIvec(type: T): SameSizeIvec; export type BaseType = SimpleTypes | AllSamplerTypes; export type UserType = { type: string; }; export type DynoType = BaseType | UserType; export type DynoJsType = T extends "bool" ? boolean : T extends "uint" ? number : T extends "int" ? number : T extends "float" ? number : T extends "bvec2" ? [boolean, boolean] : T extends "uvec2" ? THREE.Vector2 | [number, number] | Uint32Array : T extends "ivec2" ? THREE.Vector2 | [number, number] | Int32Array : T extends "vec2" ? THREE.Vector2 | [number, number] | Float32Array : T extends "bvec3" ? [boolean, boolean, boolean] : T extends "uvec3" ? THREE.Vector3 | [number, number, number] | Uint32Array : T extends "ivec3" ? THREE.Vector3 | [number, number, number] | Int32Array : T extends "vec3" ? THREE.Vector3 | THREE.Color | [number, number, number] | Float32Array : T extends "bvec4" ? [boolean, boolean, boolean, boolean] : T extends "uvec4" ? THREE.Vector4 | [number, number, number, number] | Uint32Array : T extends "ivec4" ? THREE.Vector4 | [number, number, number, number] | Int32Array : T extends "vec4" ? THREE.Vector4 | THREE.Quaternion | [number, number, number, number] | Float32Array : T extends "mat2" ? THREE.Matrix2 | Float32Array : T extends "mat2x2" ? THREE.Matrix2 | Float32Array : T extends "mat2x3" ? Float32Array : T extends "mat2x4" ? Float32Array : T extends "mat3" ? THREE.Matrix3 | Float32Array : T extends "mat3x2" ? Float32Array : T extends "mat3x3" ? THREE.Matrix3 | Float32Array : T extends "mat3x4" ? Float32Array : T extends "mat4" ? THREE.Matrix4 | Float32Array : T extends "mat4x2" ? Float32Array : T extends "mat4x3" ? Float32Array : T extends "mat4x4" ? THREE.Matrix4 | Float32Array : T extends "usampler2D" ? THREE.Texture : T extends "isampler2D" ? THREE.Texture : T extends "sampler2D" ? THREE.Texture : T extends "sampler2DShadow" ? THREE.Texture : T extends "usampler2DArray" ? THREE.DataArrayTexture : T extends "isampler2DArray" ? THREE.DataArrayTexture : T extends "sampler2DArray" ? THREE.DataArrayTexture : T extends "sampler2DArrayShadow" ? THREE.Texture : T extends "usampler3D" ? THREE.DataArrayTexture : T extends "isampler3D" ? THREE.DataArrayTexture : T extends "sampler3D" ? THREE.DataArrayTexture : T extends "usamplerCube" ? THREE.DataArrayTexture : T extends "isamplerCube" ? THREE.DataArrayTexture : T extends "samplerCube" ? THREE.DataArrayTexture : T extends "samplerCubeShadow" ? THREE.Texture : unknown; export function typeLiteral(type: DynoType): string; export function numberAsInt(value: number): string; export function numberAsUint(value: number): string; export function numberAsFloat(value: number): string; } declare module "dyno/value" { import type { Dyno, IOTypes } from "dyno/base"; import { type DynoJsType, type DynoType, type SimpleTypes } from "dyno/types"; export type DynoVal = DynoValue | HasDynoOut; export function valType(val: DynoVal): T; export interface HasDynoOut { dynoOut(): DynoValue; } export class DynoValue { type: T; private __isDynoValue; constructor(type: T); } export class DynoOutput extends DynoValue { dyno: Dyno; key: string; constructor(dyno: Dyno, key: string); } export class DynoLiteral extends DynoValue { literal: string; constructor(type: T, literal: string); getLiteral(): string; } export function dynoLiteral(type: T, literal: string): DynoLiteral; export class DynoConst extends DynoLiteral { value: DynoJsType; constructor(type: T, value: DynoJsType); getLiteral(): string; } export function dynoConst(type: T, value: DynoJsType): DynoConst; export function literalZero(type: SimpleTypes): string; export function literalOne(type: SimpleTypes): string; export function literalNegOne(type: SimpleTypes): string; } declare module "dyno/base" { import type { IUniform } from "three"; import type { DynoType } from "dyno/types"; import { type DynoVal, DynoValue, type HasDynoOut } from "dyno/value"; export class Compilation { globals: Set; statements: string[]; uniforms: Record; declares: Set; updaters: (() => void)[]; sequence: number; indent: string; constructor({ indent }?: { indent?: string; }); nextSequence(): number; } export type IOTypes = Record; type GenerateContext = { inputs: { [K in keyof InTypes]?: string; }; outputs: { [K in keyof OutTypes]?: string; }; compile: Compilation; }; export class Dyno { inTypes: InTypes; outTypes: OutTypes; inputs: { [K in keyof InTypes]?: DynoVal; }; update?: () => void; globals?: ({ inputs, outputs, compile, }: GenerateContext) => string[]; statements?: ({ inputs, outputs, compile, }: GenerateContext) => string[]; generate: ({ inputs, outputs, compile, }: GenerateContext) => { globals?: string[]; statements?: string[]; uniforms?: Record; }; constructor({ inTypes, outTypes, inputs, update, globals, statements, generate, }: { inTypes?: InTypes; outTypes?: OutTypes; inputs?: { [K in keyof InTypes]?: DynoVal; }; update?: () => void; globals?: ({ inputs, outputs, compile, }: GenerateContext) => string[]; statements?: ({ inputs, outputs, compile, }: GenerateContext) => string[]; generate?: ({ inputs, outputs, compile, }: GenerateContext) => { globals?: string[]; statements?: string[]; uniforms?: Record; }; }); get outputs(): { [K in keyof OutTypes]: DynoVal; }; apply(inputs: { [K in keyof InTypes]?: DynoVal; }): { [K in keyof OutTypes]: DynoVal; }; compile({ inputs, outputs, compile, }: { inputs: { [K in keyof InTypes]?: string; }; outputs: { [K in keyof OutTypes]?: string; }; compile: Compilation; }): string[]; } export type DynoBlockType = (inputs: { [K in keyof InTypes]?: DynoVal; }, outputs: { [K in keyof OutTypes]?: DynoVal; }, { roots }: { roots: Dyno[]; }) => { [K in keyof OutTypes]?: DynoVal; } | undefined; export class DynoBlock extends Dyno { construct: DynoBlockType; constructor({ inTypes, outTypes, inputs, update, globals, construct, }: { inTypes?: InTypes; outTypes?: OutTypes; inputs?: { [K in keyof InTypes]?: DynoVal; }; update?: () => void; globals?: ({ inputs, outputs, compile, }: GenerateContext) => string[]; construct: DynoBlockType; }); generateBlock({ inputs, outputs, compile, }: { inputs: { [K in keyof InTypes]?: string; }; outputs: { [K in keyof OutTypes]?: string; }; compile: Compilation; }): { statements: string[]; }; } export function dynoBlock, OutTypes extends Record>(inTypes: InTypes, outTypes: OutTypes, construct: DynoBlockType, { update, globals }?: { update?: () => void; globals?: () => string[]; }): DynoBlock; export function dyno, OutTypes extends Record>({ inTypes, outTypes, inputs, update, globals, statements, generate, }: { inTypes: InTypes; outTypes: OutTypes; inputs?: { [K in keyof InTypes]?: DynoVal; }; update?: () => void; globals?: ({ inputs, outputs, compile, }: GenerateContext) => string[]; statements?: ({ inputs, outputs, compile, }: GenerateContext) => string[]; generate?: ({ inputs, outputs, compile, }: GenerateContext) => { globals?: string[]; statements?: string[]; uniforms?: Record; }; }): Dyno; export function dynoDeclare(name: string, type: DynoType, count?: number): string; export function unindentLines(s: string): string[]; export function unindent(s: string): string; export class UnaryOp extends Dyno<{ a: A; }, { [key in OutKey]: OutType; }> implements HasDynoOut { constructor({ a, outKey, outTypeFunc, }: { a: DynoVal; outKey: OutKey; outTypeFunc: (aType: A) => OutType; }); outKey: OutKey; dynoOut(): DynoValue; } export class BinaryOp extends Dyno<{ a: A; b: B; }, { [key in OutKey]: OutType; }> implements HasDynoOut { constructor({ a, b, outKey, outTypeFunc, }: { a: DynoVal; b: DynoVal; outKey: OutKey; outTypeFunc: (aType: A, bType: B) => OutType; }); outKey: OutKey; dynoOut(): DynoValue; } export class TrinaryOp extends Dyno<{ a: A; b: B; c: C; }, { [key in OutKey]: OutType; }> implements HasDynoOut { constructor({ a, b, c, outKey, outTypeFunc, }: { a: DynoVal; b: DynoVal; c: DynoVal; outKey: OutKey; outTypeFunc: (aType: A, bType: B, cType: C) => OutType; }); outKey: OutKey; dynoOut(): DynoValue; } } declare module "dyno/splats" { import { Dyno, UnaryOp } from "dyno/base"; import { type DynoVal, type DynoValue, type HasDynoOut } from "dyno/value"; export const Gsplat: { type: "Gsplat"; }; export const TPackedSplats: { type: "PackedSplats"; }; export const numPackedSplats: (packedSplats: DynoVal) => DynoVal<"int">; export const readPackedSplat: (packedSplats: DynoVal, index: DynoVal<"int">) => DynoVal; export const readPackedSplatRange: (packedSplats: DynoVal, index: DynoVal<"int">, base: DynoVal<"int">, count: DynoVal<"int">) => DynoVal; export const splitGsplat: (gsplat: DynoVal) => SplitGsplat; export const combineGsplat: ({ gsplat, flags, index, center, scales, quaternion, rgba, rgb, opacity, x, y, z, r, g, b, }: { gsplat?: DynoVal; flags?: DynoVal<"uint">; index?: DynoVal<"int">; center?: DynoVal<"vec3">; scales?: DynoVal<"vec3">; quaternion?: DynoVal<"vec4">; rgba?: DynoVal<"vec4">; rgb?: DynoVal<"vec3">; opacity?: DynoVal<"float">; x?: DynoVal<"float">; y?: DynoVal<"float">; z?: DynoVal<"float">; r?: DynoVal<"float">; g?: DynoVal<"float">; b?: DynoVal<"float">; }) => DynoVal; export const gsplatNormal: (gsplat: DynoVal) => DynoVal<"vec3">; export const transformGsplat: (gsplat: DynoVal, { scale, rotate, translate, recolor, }: { scale?: DynoVal<"float">; rotate?: DynoVal<"vec4">; translate?: DynoVal<"vec3">; recolor?: DynoVal<"vec4">; }) => DynoVal; export const defineGsplat: string; export const definePackedSplats: string; export class NumPackedSplats extends UnaryOp { constructor({ packedSplats, }: { packedSplats: DynoVal; }); } export class ReadPackedSplat extends Dyno<{ packedSplats: typeof TPackedSplats; index: "int"; }, { gsplat: typeof Gsplat; }> implements HasDynoOut { constructor({ packedSplats, index, }: { packedSplats?: DynoVal; index?: DynoVal<"int">; }); dynoOut(): DynoValue; } export class ReadPackedSplatRange extends Dyno<{ packedSplats: typeof TPackedSplats; index: "int"; base: "int"; count: "int"; }, { gsplat: typeof Gsplat; }> implements HasDynoOut { constructor({ packedSplats, index, base, count, }: { packedSplats?: DynoVal; index?: DynoVal<"int">; base?: DynoVal<"int">; count?: DynoVal<"int">; }); dynoOut(): DynoValue; } export class SplitGsplat extends Dyno<{ gsplat: typeof Gsplat; }, { flags: "uint"; active: "bool"; index: "int"; center: "vec3"; scales: "vec3"; quaternion: "vec4"; rgba: "vec4"; rgb: "vec3"; opacity: "float"; x: "float"; y: "float"; z: "float"; r: "float"; g: "float"; b: "float"; }> { constructor({ gsplat }: { gsplat?: DynoVal; }); } export class CombineGsplat extends Dyno<{ gsplat: typeof Gsplat; flags: "uint"; index: "int"; center: "vec3"; scales: "vec3"; quaternion: "vec4"; rgba: "vec4"; rgb: "vec3"; opacity: "float"; x: "float"; y: "float"; z: "float"; r: "float"; g: "float"; b: "float"; }, { gsplat: typeof Gsplat; }> implements HasDynoOut { constructor({ gsplat, flags, index, center, scales, quaternion, rgba, rgb, opacity, x, y, z, r, g, b, }: { gsplat?: DynoVal; flags?: DynoVal<"uint">; index?: DynoVal<"int">; center?: DynoVal<"vec3">; scales?: DynoVal<"vec3">; quaternion?: DynoVal<"vec4">; rgba?: DynoVal<"vec4">; rgb?: DynoVal<"vec3">; opacity?: DynoVal<"float">; x?: DynoVal<"float">; y?: DynoVal<"float">; z?: DynoVal<"float">; r?: DynoVal<"float">; g?: DynoVal<"float">; b?: DynoVal<"float">; }); dynoOut(): DynoValue; } export const defineGsplatNormal: string; export class GsplatNormal extends UnaryOp { constructor({ gsplat }: { gsplat: DynoVal; }); } export class TransformGsplat extends Dyno<{ gsplat: typeof Gsplat; scale: "float"; rotate: "vec4"; translate: "vec3"; recolor: "vec4"; }, { gsplat: typeof Gsplat; }> implements HasDynoOut { constructor({ gsplat, scale, rotate, translate, recolor, }: { gsplat?: DynoVal; scale?: DynoVal<"float">; rotate?: DynoVal<"vec4">; translate?: DynoVal<"vec3">; recolor?: DynoVal<"vec4">; }); dynoOut(): DynoValue; } } declare module "dyno/output" { import { Dyno } from "dyno/base"; import { Gsplat } from "dyno/splats"; import { type DynoVal, type DynoValue, type HasDynoOut } from "dyno/value"; export const outputPackedSplat: (gsplat: DynoVal) => OutputPackedSplat; export const outputRgba8: (rgba8: DynoVal<"vec4">) => OutputRgba8; export class OutputPackedSplat extends Dyno<{ gsplat: typeof Gsplat; }, { output: "uvec4"; }> implements HasDynoOut<"uvec4"> { constructor({ gsplat }: { gsplat?: DynoVal; }); dynoOut(): DynoValue<"uvec4">; } export class OutputRgba8 extends Dyno<{ rgba8: "vec4"; }, { rgba8: "vec4"; }> implements HasDynoOut<"vec4"> { constructor({ rgba8 }: { rgba8?: DynoVal<"vec4">; }); dynoOut(): DynoValue<"vec4">; } } declare module "dyno/uniforms" { import { Dyno } from "dyno/base"; import type { DynoJsType, DynoType } from "dyno/types"; import { type DynoValue, type HasDynoOut } from "dyno/value"; export const uniform: >(key: string, type: DynoType, value: V) => DynoUniform; export const dynoBool: (value?: boolean, key?: string) => DynoBool; export const dynoUint: (value?: number, key?: string) => DynoUint; export const dynoInt: (value?: number, key?: string) => DynoInt; export const dynoFloat: (value?: number, key?: string) => DynoFloat; export const dynoBvec2: >(value: V, key?: string) => DynoBvec2; export const dynoUvec2: >(value: V, key?: string) => DynoUvec2; export const dynoIvec2: >(value: V, key?: string) => DynoIvec2; export const dynoVec2: >(value: V, key?: string) => DynoVec2; export const dynoBvec3: >(value: V, key?: string) => DynoBvec3; export const dynoUvec3: >(value: V, key?: string) => DynoUvec3; export const dynoIvec3: >(value: V, key?: string) => DynoIvec3; export const dynoVec3: >(value: V, key?: string) => DynoVec3; export const dynoBvec4: >(value: V, key?: string) => DynoBvec4; export const dynoUvec4: >(value: V, key?: string) => DynoUvec4; export const dynoIvec4: >(value: V, key?: string) => DynoIvec4; export const dynoVec4: >(value: V, key?: string) => DynoVec4; export const dynoMat2: >(value: V, key?: string) => DynoMat2; export const dynoMat2x2: >(value: V, key?: string) => DynoMat2x2; export const dynoMat2x3: >(value: V, key?: string) => DynoMat2x3; export const dynoMat2x4: >(value: V, key?: string) => DynoMat2x4; export const dynoMat3: >(value: V, key?: string) => DynoMat3; export const dynoMat3x2: >(value: V, key?: string) => DynoMat3x2; export const dynoMat3x3: >(value: V, key?: string) => DynoMat3x3; export const dynoMat3x4: >(value: V, key?: string) => DynoMat3x4; export const dynoMat4: >(value: V, key?: string) => DynoMat4; export const dynoMat4x2: >(value: V, key?: string) => DynoMat4x2; export const dynoMat4x3: >(value: V, key?: string) => DynoMat4x3; export const dynoMat4x4: >(value: V, key?: string) => DynoMat4x4; export const dynoUsampler2D: >(value: V, key?: string) => DynoUsampler2D; export const dynoIsampler2D: >(value: V, key?: string) => DynoIsampler2D; export const dynoSampler2D: >(value: V, key?: string) => DynoSampler2D; export const dynoUsampler2DArray: >(value: V, key?: string) => DynoUsampler2DArray; export const dynoIsampler2DArray: >(key: string, value: V) => DynoIsampler2DArray; export const dynoSampler2DArray: >(value: V, key?: string) => DynoSampler2DArray; export const dynoUsampler3D: >(value: V, key?: string) => DynoUsampler3D; export const dynoIsampler3D: >(value: V, key?: string) => DynoIsampler3D; export const dynoSampler3D: >(value: V, key?: string) => DynoSampler3D; export const dynoUsamplerCube: >(value: V, key?: string) => DynoUsamplerCube; export const dynoIsamplerCube: >(value: V, key?: string) => DynoIsamplerCube; export const dynoSamplerCube: >(value: V, key?: string) => DynoSamplerCube; export const dynoSampler2DShadow: >(value: V, key?: string) => DynoSampler2DShadow; export const dynoSampler2DArrayShadow: >(value: V, key?: string) => DynoSampler2DArrayShadow; export const dynoSamplerCubeShadow: >(value: V, key?: string) => DynoSamplerCubeShadow; export class DynoUniform = DynoJsType> extends Dyno, { [key in K]: T; }> implements HasDynoOut { type: T; count?: number; outKey: K; value: V; uniform: { value: V; type?: string; }; constructor({ key, type, count, value, update, globals, }: { key?: K; type: T; count?: number; value: V; update?: (value: V) => V | undefined; globals?: ({ inputs, outputs, }: { inputs: unknown; outputs: { [key in K]?: string; }; }) => string[]; }); dynoOut(): DynoValue; } export class DynoBool extends DynoUniform<"bool", K, boolean> { constructor({ key, value, update, }: { key?: K; value: boolean; update?: (value: boolean) => boolean | undefined; }); } export class DynoUint extends DynoUniform<"uint", K, number> { constructor({ key, value, update, }: { key?: K; value: number; update?: (value: number) => number | undefined; }); } export class DynoInt extends DynoUniform<"int", K, number> { constructor({ key, value, update, }: { key?: K; value: number; update?: (value: number) => number | undefined; }); } export class DynoFloat extends DynoUniform<"float", K, number> { constructor({ key, value, update, }: { key?: K; value: number; update?: (value: number) => number | undefined; }); } export class DynoBvec2> extends DynoUniform<"bvec2", K, V> { constructor({ key, value, update, }: { key?: K; value: V; update?: (value: V) => V | undefined; }); } export class DynoUvec2> extends DynoUniform<"uvec2", K, V> { constructor({ key, value, update, }: { key?: K; value: V; update?: (value: V) => V | undefined; }); } export class DynoIvec2> extends DynoUniform<"ivec2", K, V> { constructor({ key, value, update, }: { key?: K; value: V; update?: (value: V) => V | undefined; }); } export class DynoVec2> extends DynoUniform<"vec2", K, V> { constructor({ key, value, update, }: { key?: K; value: V; update?: (value: V) => V | undefined; }); } export class DynoBvec3> extends DynoUniform<"bvec3", K, V> { constructor({ key, value, update, }: { key?: K; value: V; update?: (value: V) => V | undefined; }); } export class DynoUvec3, K extends string = "value"> extends DynoUniform<"uvec3", K, V> { constructor({ key, value, update, }: { key?: K; value: V; update?: (value: V) => V | undefined; }); } export class DynoIvec3, K extends string = "value"> extends DynoUniform<"ivec3", K, V> { constructor({ key, value, update, }: { key?: K; value: V; update?: (value: V) => V | undefined; }); } export class DynoVec3, K extends string = "value"> extends DynoUniform<"vec3", K, V> { constructor({ key, value, update, }: { key?: K; value: V; update?: (value: V) => V | undefined; }); } export class DynoBvec4> extends DynoUniform<"bvec4", K, V> { constructor({ key, value, update, }: { key?: K; value: V; update?: (value: V) => V | undefined; }); } export class DynoUvec4> extends DynoUniform<"uvec4", K, V> { constructor({ key, value, update, }: { key?: K; value: V; update?: (value: V) => V | undefined; }); } export class DynoIvec4> extends DynoUniform<"ivec4", K, V> { constructor({ key, value, update, }: { key?: K; value: V; update?: (value: V) => V | undefined; }); } export class DynoVec4, K extends string = "value"> extends DynoUniform<"vec4", K, V> { constructor({ key, value, update, }: { key?: K; value: V; update?: (value: V) => V | undefined; }); } export class DynoMat2> extends DynoUniform<"mat2", K, V> { constructor({ key, value, update, }: { key?: K; value: V; update?: (value: V) => V | undefined; }); } export class DynoMat2x2> extends DynoUniform<"mat2x2", K, V> { constructor({ key, value, update, }: { key?: K; value: V; update?: (value: V) => V | undefined; }); } export class DynoMat2x3> extends DynoUniform<"mat2x3", K, V> { constructor({ key, value, update, }: { key?: K; value: V; update?: (value: V) => V | undefined; }); } export class DynoMat2x4> extends DynoUniform<"mat2x4", K, V> { constructor({ key, value, update, }: { key?: K; value: V; update?: (value: V) => V | undefined; }); } export class DynoMat3> extends DynoUniform<"mat3", K, V> { constructor({ key, value, update, }: { key?: K; value: V; update?: (value: V) => V | undefined; }); } export class DynoMat3x2> extends DynoUniform<"mat3x2", K, V> { constructor({ key, value, update, }: { key?: K; value: V; update?: (value: V) => V | undefined; }); } export class DynoMat3x3> extends DynoUniform<"mat3x3", K, V> { constructor({ key, value, update, }: { key?: K; value: V; update?: (value: V) => V | undefined; }); } export class DynoMat3x4> extends DynoUniform<"mat3x4", K, V> { constructor({ key, value, update, }: { key?: K; value: V; update?: (value: V) => V | undefined; }); } export class DynoMat4> extends DynoUniform<"mat4", K, V> { constructor({ key, value, update, }: { key?: K; value: V; update?: (value: V) => V | undefined; }); } export class DynoMat4x2> extends DynoUniform<"mat4x2", K, V> { constructor({ key, value, update, }: { key?: K; value: V; update?: (value: V) => V | undefined; }); } export class DynoMat4x3> extends DynoUniform<"mat4x3", K, V> { constructor({ key, value, update, }: { key?: K; value: V; update?: (value: V) => V | undefined; }); } export class DynoMat4x4> extends DynoUniform<"mat4x4", K, V> { constructor({ key, value, update, }: { key?: K; value: V; update?: (value: V) => V | undefined; }); } export class DynoUsampler2D> extends DynoUniform<"usampler2D", K, V> { constructor({ key, value, update, }: { key?: K; value: V; update?: (value: V) => V | undefined; }); } export class DynoIsampler2D> extends DynoUniform<"isampler2D", K, V> { constructor({ key, value, update, }: { key?: K; value: V; update?: (value: V) => V | undefined; }); } export class DynoSampler2D> extends DynoUniform<"sampler2D", K, V> { constructor({ key, value, update, }: { key?: K; value: V; update?: (value: V) => V | undefined; }); } export class DynoUsampler2DArray> extends DynoUniform<"usampler2DArray", K, V> { constructor({ key, value, update, }: { key?: K; value: V; update?: (value: V) => V | undefined; }); } export class DynoIsampler2DArray> extends DynoUniform<"isampler2DArray", K, V> { constructor({ key, value, update, }: { key?: K; value: V; update?: (value: V) => V | undefined; }); } export class DynoSampler2DArray> extends DynoUniform<"sampler2DArray", K, V> { constructor({ key, value, update, }: { key?: K; value: V; update?: (value: V) => V | undefined; }); } export class DynoUsampler3D> extends DynoUniform<"usampler3D", K, V> { constructor({ key, value, update, }: { key?: K; value: V; update?: (value: V) => V | undefined; }); } export class DynoIsampler3D> extends DynoUniform<"isampler3D", K, V> { constructor({ key, value, update, }: { key?: K; value: V; update?: (value: V) => V | undefined; }); } export class DynoSampler3D> extends DynoUniform<"sampler3D", K, V> { constructor({ key, value, update, }: { key?: K; value: V; update?: (value: V) => V | undefined; }); } export class DynoUsamplerCube> extends DynoUniform<"usamplerCube", K, V> { constructor({ key, value, update, }: { key?: K; value: V; update?: (value: V) => V | undefined; }); } export class DynoIsamplerCube> extends DynoUniform<"isamplerCube", K, V> { constructor({ key, value, update, }: { key?: K; value: V; update?: (value: V) => V | undefined; }); } export class DynoSamplerCube> extends DynoUniform<"samplerCube", K, V> { constructor({ key, value, update, }: { key?: K; value: V; update?: (value: V) => V | undefined; }); } export class DynoSampler2DShadow> extends DynoUniform<"sampler2DShadow", K, V> { constructor({ key, value, update, }: { key?: K; value: V; update?: (value: V) => V | undefined; }); } export class DynoSampler2DArrayShadow> extends DynoUniform<"sampler2DArrayShadow", K, V> { constructor({ key, value, update, }: { key?: K; value: V; update?: (value: V) => V | undefined; }); } export class DynoSamplerCubeShadow> extends DynoUniform<"samplerCubeShadow", K, V> { constructor({ key, value, update, }: { key?: K; value: V; update?: (value: V) => V | undefined; }); } } declare module "defines" { export const LN_SCALE_MIN = -9; export const LN_SCALE_MAX = 9; export const LN_RESCALE: number; export const SCALE_MIN: number; export const SCALE_MAX: number; export const SPLAT_TEX_WIDTH_BITS = 11; export const SPLAT_TEX_HEIGHT_BITS = 11; export const SPLAT_TEX_DEPTH_BITS = 11; export const SPLAT_TEX_LAYER_BITS: number; export const SPLAT_TEX_WIDTH: number; export const SPLAT_TEX_HEIGHT: number; export const SPLAT_TEX_DEPTH: number; export const SPLAT_TEX_MIN_HEIGHT = 1; export const SPLAT_TEX_WIDTH_MASK: number; export const SPLAT_TEX_HEIGHT_MASK: number; export const SPLAT_TEX_DEPTH_MASK: number; export const WASM_SPLAT_SORT = true; } declare module "utils" { import { Gunzip } from "fflate"; import * as THREE from "three"; export function floatBitsToUint(f: number): number; export function uintBitsToFloat(u: number): number; export function toHalf(f: number): number; export function fromHalf(h: number): number; export function floatToUint8(v: number): number; export function floatToSint8(v: number): number; export function Uint8ToFloat(v: number): number; export function Sint8ToFloat(v: number): number; export class DataCache { maxItems: number; asyncFetch: (key: string) => Promise; items: { key: string; data: unknown; }[]; constructor({ asyncFetch, maxItems, }: { asyncFetch: (key: string) => Promise; maxItems?: number; }); getFetch(key: string): Promise; } export function mapObject(obj: Record, fn: (value: unknown, key: string) => unknown): Record; export function mapFilterObject(obj: Record, fn: (value: unknown, key: string) => unknown): Record; export function getArrayBuffers(ctx: unknown): Transferable[]; export function newArray(n: number, initFunction: (index: number) => T): T[]; export class FreeList { items: T[]; allocate: (args: Args) => T; dispose?: (item: T) => void; valid: (item: T, args: Args) => boolean; constructor({ allocate, dispose, valid, }: { allocate: (args: Args) => T; dispose?: (item: T) => void; valid: (item: T, args: Args) => boolean; }); alloc(args: Args): T; free(item: T): void; disposeAll(): void; } export function setPackedSplat(packedSplats: Uint32Array, index: number, x: number, y: number, z: number, scaleX: number, scaleY: number, scaleZ: number, quatX: number, quatY: number, quatZ: number, quatW: number, opacity: number, r: number, g: number, b: number): void; export function setPackedSplatCenter(packedSplats: Uint32Array, index: number, x: number, y: number, z: number): void; export function setPackedSplatScales(packedSplats: Uint32Array, index: number, scaleX: number, scaleY: number, scaleZ: number): void; export function setPackedSplatQuat(packedSplats: Uint32Array, index: number, quatX: number, quatY: number, quatZ: number, quatW: number): void; export function setPackedSplatRgb(packedSplats: Uint32Array, index: number, r: number, g: number, b: number): void; export function setPackedSplatOpacity(packedSplats: Uint32Array, index: number, opacity: number): void; export function unpackSplat(packedSplats: Uint32Array, index: number): { center: THREE.Vector3; scales: THREE.Vector3; quaternion: THREE.Quaternion; color: THREE.Color; opacity: number; }; export function getTextureSize(numSplats: number): { width: number; height: number; depth: number; maxSplats: number; }; export function isMobile(): boolean; export function isAndroid(): boolean; export function isOculus(): boolean; export function flipPixels(pixels: Uint8Array, width: number, height: number): Uint8Array; export function pixelsToPngUrl(pixels: Uint8Array, width: number, height: number): string; export function cloneClock(clock: THREE.Clock): THREE.Clock; export function omitUndefined(obj: T): Partial; export const IDENT_VERTEX_SHADER: string; export function averagePositions(positions: THREE.Vector3[]): THREE.Vector3; export function averageQuaternions(quaternions: THREE.Quaternion[]): THREE.Quaternion; export function coinciDist(matrix1: THREE.Matrix4, matrix2: THREE.Matrix4): { distance: number; coincidence: number; }; export function withinDist({ matrix1, matrix2, maxDistance, }: { matrix1: THREE.Matrix4; matrix2: THREE.Matrix4; maxDistance: number; }): boolean; export function withinCoinciDist({ matrix1, matrix2, maxDistance, minCoincidence, }: { matrix1: THREE.Matrix4; matrix2: THREE.Matrix4; maxDistance: number; minCoincidence?: number; }): boolean; export function coorientDist(matrix1: THREE.Matrix4, matrix2: THREE.Matrix4): { distance: number; coorient: number; }; export function withinCoorientDist({ matrix1, matrix2, maxDistance, minCoorient, }: { matrix1: THREE.Matrix4; matrix2: THREE.Matrix4; maxDistance: number; minCoorient?: number; }): boolean; export function epsilonSign(value: number, epsilon?: number): number; export function encodeQuatXyz888(q: THREE.Quaternion): number; export function decodeQuatXyz888(encoded: number, out: THREE.Quaternion): THREE.Quaternion; /** * Encodes a THREE.Quaternion into a 24‐bit integer. * * Bit layout (LSB → MSB): * - Bits 0–7: quantized U (8 bits) * - Bits 8–15: quantized V (8 bits) * - Bits 16–23: quantized angle θ (8 bits) from [0,π] * * This version uses folded octahedral mapping (all inline). */ export function encodeQuatOctXy88R8(q: THREE.Quaternion): number; /** * Decodes a 24‐bit encoded quaternion (packed in a number) back to a THREE.Quaternion. * * Assumes the same bit layout as in encodeQuatOctXy88R8. */ export function decodeQuatOctXy88R8(encoded: number, out: THREE.Quaternion): THREE.Quaternion; /** * Encodes a THREE.Quaternion into a 24‑bit unsigned integer * by converting it to Euler angles (roll, pitch, yaw). * The Euler angles are assumed to be in radians in the range [-π, π]. * Each angle is normalized to [0,1] and quantized to 8 bits. * Bit layout (LSB→MSB): * - Bits 0–7: roll (quantized) * - Bits 8–15: pitch (quantized) * - Bits 16–23: yaw (quantized) */ export function encodeQuatEulerXyz888(q: THREE.Quaternion): number; /** * Decodes a 24‑bit unsigned integer into a THREE.Quaternion * by unpacking three 8‑bit values (roll, pitch, yaw) in the range [0,255] * and then converting them back to Euler angles in [-π, π] and to a quaternion. */ export function decodeQuatEulerXyz888(encoded: number, out: THREE.Quaternion): THREE.Quaternion; export function encodeSh1Rgb(sh1Array: Uint32Array, index: number, sh1Rgb: Float32Array): void; export function encodeSh2Rgb(sh2Array: Uint32Array, index: number, sh2Rgb: Float32Array): void; export function encodeSh3Rgb(sh3Array: Uint32Array, index: number, sh3Rgb: Float32Array): void; export function decompressPartialGzip(fileBytes: Uint8Array, numBytes: number): Uint8Array; export class GunzipReader { fileBytes: Uint8Array; chunkBytes: number; offset: number; chunks: Uint8Array[]; totalBytes: number; gunzip: Gunzip; constructor({ fileBytes, chunkBytes, }: { fileBytes: Uint8Array; chunkBytes?: number; }); read(numBytes: number): Uint8Array; } } declare module "dyno/program" { import * as THREE from "three"; import { type Dyno, type IOTypes } from "dyno/base"; export class DynoProgram { graph: Dyno; template: DynoProgramTemplate; inputs: Record; outputs: Record; shader: string; uniforms: Record; updaters: (() => void)[]; constructor({ graph, inputs, outputs, template, }: { graph: Dyno; inputs?: Record; outputs?: Record; template: DynoProgramTemplate; }); prepareMaterial(): THREE.RawShaderMaterial; update(): void; } export class DynoProgramTemplate { before: string; between: string; after: string; indent: string; constructor(template: string); generate({ globals, statements, }: { globals: Set; statements: string[]; }): string; } } declare module "dyno/mathTypes" { import { type AllFloatTypes, type AllIntTypes, type AllSignedTypes, type AllValueTypes, type BaseType, type BoolTypes, type FloatTypes, type IntTypes, type SignedTypes, type UintTypes, type ValueTypes } from "dyno/types"; export type AddOutput = BaseType & (A extends B ? A : A extends "int" ? B extends IntTypes ? B : never : B extends "int" ? A extends IntTypes ? A : never : A extends "uint" ? B extends UintTypes ? B : never : B extends "uint" ? A extends UintTypes ? A : never : A extends "float" ? B extends AllFloatTypes ? B : never : B extends "float" ? A extends AllFloatTypes ? A : never : never); export type SubOutput = AddOutput; export type MulOutput = BaseType & (A extends "int" ? B extends IntTypes ? B : never : B extends "int" ? A extends IntTypes ? A : never : A extends "uint" ? B extends UintTypes ? B : never : B extends "uint" ? A extends UintTypes ? A : never : A extends "float" ? B extends AllFloatTypes ? B : never : B extends "float" ? A extends AllFloatTypes ? A : never : A extends IntTypes ? B extends A ? A : never : B extends IntTypes ? A extends B ? A : never : A extends UintTypes ? B extends A ? A : never : B extends UintTypes ? A extends B ? A : never : A extends "vec2" ? B extends "vec2" | "mat2" | "mat2x2" ? "vec2" : B extends "mat3x2" ? "vec3" : B extends "mat4x2" ? "vec4" : never : A extends "vec3" ? B extends "mat2x3" ? "vec2" : B extends "vec3" | "mat3" | "mat3x3" ? "vec3" : B extends "mat4x3" ? "vec4" : never : A extends "vec4" ? B extends "mat2x4" ? "vec2" : B extends "mat3x4" ? "vec3" : B extends "vec4" | "mat4" | "mat4x4" ? "vec4" : never : B extends "vec2" ? A extends "mat2" | "mat2x2" ? "vec2" : A extends "mat2x3" ? "vec3" : A extends "mat2x4" ? "vec4" : never : B extends "vec3" ? A extends "mat3x2" ? "vec2" : A extends "mat3" | "mat3x3" ? "vec3" : A extends "mat3x4" ? "vec4" : never : B extends "vec4" ? A extends "mat4x2" ? "vec2" : A extends "mat4x3" ? "vec3" : A extends "mat4" | "mat4x4" ? "vec4" : never : A extends "mat2" | "mat2x2" ? B extends "mat2" | "mat2x2" ? "mat2" : B extends "mat3x2" ? "mat3x2" : B extends "mat4x2" ? "mat4x2" : never : A extends "mat2x3" ? B extends "mat2" | "mat2x2" ? "mat2x3" : B extends "mat3x2" ? "mat3" : B extends "mat4x2" ? "mat4x3" : never : A extends "mat2x4" ? B extends "mat2" | "mat2x2" ? "mat2x4" : B extends "mat3x2" ? "mat3x4" : B extends "mat4x2" ? "mat4" : never : A extends "mat3x2" ? B extends "mat2x3" ? "mat2" : B extends "mat3" | "mat3x3" ? "mat3x2" : B extends "mat4x3" ? "mat4x2" : never : A extends "mat3" | "mat3x3" ? B extends "mat2x3" ? "mat2x3" : B extends "mat3" | "mat3x3" ? "mat3" : B extends "mat4x3" ? "mat4x3" : never : A extends "mat3x4" ? B extends "mat2x3" ? "mat2x4" : B extends "mat3" | "mat3x3" ? "mat3x4" : B extends "mat4x3" ? "mat4" : never : A extends "mat4x2" ? B extends "mat2x4" ? "mat2" : B extends "mat3x4" ? "mat3x2" : B extends "mat4" | "mat4x4" ? "mat4x2" : never : A extends "mat4x3" ? B extends "mat2x4" ? "mat2x3" : B extends "mat3x4" ? "mat3" : B extends "mat4" | "mat4x4" ? "mat4x3" : never : A extends "mat4" | "mat4x4" ? B extends "mat2x4" ? "mat2x4" : B extends "mat3x4" ? "mat3x4" : B extends "mat4" | "mat4x4" ? "mat4" : never : never); export type DivOutput = AddOutput; export type IModOutput = BaseType & (A extends B ? A : A extends "int" ? B extends IntTypes ? B : never : B extends "int" ? A extends IntTypes ? A : never : A extends "uint" ? B extends UintTypes ? B : never : B extends "uint" ? A extends UintTypes ? A : never : never); export type ModOutput = BaseType & (A extends B ? A : B extends "float" ? A : never); export type PowOutput = BaseType & (A extends B ? A : never); export type MinOutput = BaseType & (A extends B ? A : B extends "float" ? A extends FloatTypes ? A : never : B extends "int" ? A extends IntTypes ? A : never : B extends "uint" ? A extends UintTypes ? A : never : never); export type MaxOutput = MinOutput; export type ClampOutput = BaseType & (B extends "float" ? A extends FloatTypes ? A : never : B extends "int" ? A extends IntTypes ? A : never : B extends "uint" ? A extends UintTypes ? A : never : never); export type MixOutput = BaseType & (T extends A ? A : T extends "float" ? A : T extends "bool" ? A extends "float" ? A : never : T extends "bvec2" ? A extends "vec2" ? A : never : T extends "bvec3" ? A extends "vec3" ? A : never : T extends "bvec4" ? A extends "vec4" ? A : never : never); export type StepOutput = BaseType & (A extends B ? B : A extends "float" ? B : never); export type SmoothstepOutput = BaseType & (A extends B ? (A extends C ? C : A extends "float" ? C : never) : never); export type IsNanOutput = BaseType & (A extends "float" ? "bool" : A extends "vec2" ? "bvec2" : A extends "vec3" ? "bvec3" : A extends "vec4" ? "bvec4" : never); export type IsInfOutput = IsNanOutput; export function addOutputType(a: A, b: B, operation?: string): AddOutput; export function subOutputType(a: A, b: B): SubOutput; export function mulOutputType(a: A, b: B): MulOutput; export function divOutputType(a: A, b: B): DivOutput; export function imodOutputType(a: A, b: B): IModOutput; export function modOutputType(a: A, b: B): ModOutput; export function modfOutputType(a: A): A; export function negOutputType(a: A): A; export function absOutputType(a: A): A; export function signOutputType(a: A): A; export function floorOutputType(a: A): A; export function ceilOutputType(a: A): A; export function truncOutputType(a: A): A; export function roundOutputType(a: A): A; export function fractOutputType(a: A): A; export function powOutputType(a: A): A; export function expOutputType(a: A): A; export function exp2OutputType(a: A): A; export function logOutputType(a: A): A; export function log2OutputType(a: A): A; export function sqrOutputType(a: A): A; export function sqrtOutputType(a: A): A; export function inversesqrtOutputType(a: A): A; export function minOutputType(a: A, b: B, operation?: string): MinOutput; export function maxOutputType(a: A, b: B): MaxOutput; export function clampOutputType(a: A, b: B, _c: B): ClampOutput; export function mixOutputType(a: A, b: A, c: C): MixOutput; export function stepOutputType(a: A, b: B): StepOutput; export function smoothstepOutputType(a: A, b: B, c: C): SmoothstepOutput; export function isNanOutputType(a: A, operation?: string): IsNanOutput; export function isInfOutputType(a: A): IsInfOutput; } declare module "dyno/math" { import { BinaryOp, Dyno, TrinaryOp, UnaryOp } from "dyno/base"; import { type AddOutput, type ClampOutput, type DivOutput, type IModOutput, type IsInfOutput, type IsNanOutput, type MaxOutput, type MinOutput, type MixOutput, type ModOutput, type MulOutput, type SmoothstepOutput, type StepOutput, type SubOutput } from "dyno/mathTypes"; import type { AllIntTypes, AllSignedTypes, AllValueTypes, BoolTypes, FloatTypes, SignedTypes, ValueTypes } from "dyno/types"; import { type DynoVal } from "dyno/value"; export const add: (a: DynoVal, b: DynoVal) => DynoVal>; export const sub: (a: DynoVal, b: DynoVal) => DynoVal>; export const mul: (a: DynoVal, b: DynoVal) => DynoVal>; export const div: (a: DynoVal, b: DynoVal) => DynoVal>; export const imod: (a: DynoVal, b: DynoVal) => DynoVal>; export const mod: (a: DynoVal, b: DynoVal) => DynoVal>; export const modf: (a: DynoVal) => { fract: DynoVal; integer: DynoVal; }; export const neg: (a: DynoVal) => DynoVal; export const abs: (a: DynoVal) => DynoVal; export const sign: (a: DynoVal) => DynoVal; export const floor: (a: DynoVal) => DynoVal; export const ceil: (a: DynoVal) => DynoVal; export const trunc: (a: DynoVal) => DynoVal; export const round: (a: DynoVal) => DynoVal; export const fract: (a: DynoVal) => DynoVal; export const pow: (a: DynoVal, b: DynoVal) => DynoVal; export const exp: (a: DynoVal) => DynoVal; export const exp2: (a: DynoVal) => DynoVal; export const log: (a: DynoVal) => DynoVal; export const log2: (a: DynoVal) => DynoVal; export const sqr: (a: DynoVal) => DynoVal; export const sqrt: (a: DynoVal) => DynoVal; export const inversesqrt: (a: DynoVal) => DynoVal; export const min: (a: DynoVal, b: DynoVal) => DynoVal>; export const max: (a: DynoVal, b: DynoVal) => DynoVal>; export const clamp: (a: DynoVal, min: DynoVal, max: DynoVal) => DynoVal>; export const mix: (a: DynoVal, b: DynoVal, t: DynoVal) => DynoVal>; export const step: (edge: DynoVal, x: DynoVal) => DynoVal>; export const smoothstep: (edge0: DynoVal, edge1: DynoVal, x: DynoVal) => DynoVal>; export const isNan: (a: DynoVal) => DynoVal>; export const isInf: (a: DynoVal) => DynoVal>; export class Add extends BinaryOp, "sum"> { constructor({ a, b }: { a: DynoVal; b: DynoVal; }); } export class Sub extends BinaryOp, "difference"> { constructor({ a, b }: { a: DynoVal; b: DynoVal; }); } export class Mul extends BinaryOp, "product"> { constructor({ a, b }: { a: DynoVal; b: DynoVal; }); } export class Div extends BinaryOp, "quotient"> { constructor({ a, b }: { a: DynoVal; b: DynoVal; }); } export class IMod extends BinaryOp, "remainder"> { constructor({ a, b }: { a: DynoVal; b: DynoVal; }); } export class Mod extends BinaryOp, "remainder"> { constructor({ a, b }: { a: DynoVal; b: DynoVal; }); } export class Modf extends Dyno<{ a: A; }, { fract: A; integer: A; }> { constructor({ a }: { a: DynoVal; }); } export class Neg extends UnaryOp { constructor({ a }: { a: DynoVal; }); } export class Abs extends UnaryOp { constructor({ a }: { a: DynoVal; }); } export class Sign extends UnaryOp { constructor({ a }: { a: DynoVal; }); } export class Floor extends UnaryOp { constructor({ a }: { a: DynoVal; }); } export class Ceil extends UnaryOp { constructor({ a }: { a: DynoVal; }); } export class Trunc extends UnaryOp { constructor({ a }: { a: DynoVal; }); } export class Round extends UnaryOp { constructor({ a }: { a: DynoVal; }); } export class Fract extends UnaryOp { constructor({ a }: { a: DynoVal; }); } export class Pow extends BinaryOp { constructor({ a, b }: { a: DynoVal; b: DynoVal; }); } export class Exp extends UnaryOp { constructor({ a }: { a: DynoVal; }); } export class Exp2 extends UnaryOp { constructor({ a }: { a: DynoVal; }); } export class Log extends UnaryOp { constructor({ a }: { a: DynoVal; }); } export class Log2 extends UnaryOp { constructor({ a }: { a: DynoVal; }); } export class Sqr extends UnaryOp { constructor({ a }: { a: DynoVal; }); } export class Sqrt extends UnaryOp { constructor({ a }: { a: DynoVal; }); } export class InverseSqrt extends UnaryOp { constructor({ a }: { a: DynoVal; }); } export class Min extends BinaryOp, "min"> { constructor({ a, b }: { a: DynoVal; b: DynoVal; }); } export class Max extends BinaryOp, "max"> { constructor({ a, b }: { a: DynoVal; b: DynoVal; }); } export class Clamp extends TrinaryOp, "clamp"> { constructor({ a, min, max, }: { a: DynoVal; min: DynoVal; max: DynoVal; }); } export class Mix extends TrinaryOp, "mix"> { constructor({ a, b, t }: { a: DynoVal; b: DynoVal; t: DynoVal; }); } export class Step extends BinaryOp, "step"> { constructor({ edge, x }: { edge: DynoVal; x: DynoVal; }); } export class Smoothstep extends TrinaryOp, "smoothstep"> { constructor({ edge0, edge1, x, }: { edge0: DynoVal; edge1: DynoVal; x: DynoVal; }); } export class IsNan extends UnaryOp, "isNan"> { constructor({ a }: { a: DynoVal; }); } export class IsInf extends UnaryOp, "isInf"> { constructor({ a }: { a: DynoVal; }); } } declare module "dyno/logic" { import { BinaryOp, TrinaryOp, UnaryOp } from "dyno/base"; import { type AllIntTypes, type BoolTypes, type IntTypes, type ScalarTypes, type SimpleTypes, type UintTypes, type ValueTypes } from "dyno/types"; import { type DynoVal } from "dyno/value"; export const and: (a: DynoVal, b: DynoVal) => DynoVal; export const or: (a: DynoVal, b: DynoVal) => DynoVal; export const xor: (a: DynoVal, b: DynoVal) => DynoVal; export const not: (a: DynoVal) => DynoVal; export const lessThan: (a: DynoVal, b: DynoVal) => DynoVal>; export const lessThanEqual: (a: DynoVal, b: DynoVal) => DynoVal>; export const greaterThan: (a: DynoVal, b: DynoVal) => DynoVal>; export const greaterThanEqual: (a: DynoVal, b: DynoVal) => DynoVal>; export const equal: (a: DynoVal, b: DynoVal) => DynoVal>; export const notEqual: (a: DynoVal, b: DynoVal) => DynoVal>; export const any: (a: DynoVal) => DynoVal<"bool">; export const all: (a: DynoVal) => DynoVal<"bool">; export const select: (cond: DynoVal<"bool">, t: DynoVal, f: DynoVal) => DynoVal; export const compXor: (a: DynoVal) => DynoVal>; export class And extends BinaryOp { constructor({ a, b }: { a: DynoVal; b: DynoVal; }); } export class Or extends BinaryOp { constructor({ a, b }: { a: DynoVal; b: DynoVal; }); } export class Xor extends BinaryOp { constructor({ a, b }: { a: DynoVal; b: DynoVal; }); } export class Not extends UnaryOp { constructor({ a }: { a: DynoVal; }); } export class LessThan extends BinaryOp, "lessThan"> { constructor({ a, b }: { a: DynoVal; b: DynoVal; }); } export class LessThanEqual extends BinaryOp, "lessThanEqual"> { constructor({ a, b }: { a: DynoVal; b: DynoVal; }); } export class GreaterThan extends BinaryOp, "greaterThan"> { constructor({ a, b }: { a: DynoVal; b: DynoVal; }); } export class GreaterThanEqual extends BinaryOp, "greaterThanEqual"> { constructor({ a, b }: { a: DynoVal; b: DynoVal; }); } export class Equal extends BinaryOp, "equal"> { constructor({ a, b }: { a: DynoVal; b: DynoVal; }); } export class NotEqual extends BinaryOp, "notEqual"> { constructor({ a, b }: { a: DynoVal; b: DynoVal; }); } export class Any extends UnaryOp { constructor({ a }: { a: DynoVal; }); } export class All extends UnaryOp { constructor({ a }: { a: DynoVal; }); } export class Select extends TrinaryOp<"bool", T, T, T, "select"> { constructor({ cond, t, f, }: { cond: DynoVal<"bool">; t: DynoVal; f: DynoVal; }); } type CompareOutput = T extends ScalarTypes ? "bool" : T extends "ivec2" | "uvec2" | "vec2" ? "bvec2" : T extends "ivec3" | "uvec3" | "vec3" ? "bvec3" : T extends "ivec4" | "uvec4" | "vec4" ? "bvec4" : never; type EqualOutput = A extends ScalarTypes ? "bool" : A extends BoolTypes ? A : A extends "ivec2" | "uvec2" | "vec2" ? "bvec2" : A extends "ivec3" | "uvec3" | "vec3" ? "bvec3" : A extends "ivec4" | "uvec4" | "vec4" ? "bvec4" : never; type NotEqualOutput = EqualOutput; type CompXorOutput = A extends BoolTypes ? "bool" : A extends IntTypes ? "int" : A extends UintTypes ? "uint" : never; export class CompXor extends UnaryOp, "compXor"> { constructor({ a }: { a: DynoVal; }); } } declare module "dyno/convert" { import { UnaryOp } from "dyno/base"; import { type SimpleTypes } from "dyno/types"; import type { DynoVal } from "dyno/value"; export const bool: (value: DynoVal) => DynoVal<"bool">; export const int: (value: DynoVal) => DynoVal<"int">; export const uint: (value: DynoVal) => DynoVal<"uint">; export const float: (value: DynoVal) => DynoVal<"float">; export const bvec2: (value: DynoVal) => DynoVal<"bvec2">; export const bvec3: (value: DynoVal) => DynoVal<"bvec3">; export const bvec4: (value: DynoVal) => DynoVal<"bvec4">; export const ivec2: (value: DynoVal) => DynoVal<"ivec2">; export const ivec3: (value: DynoVal) => DynoVal<"ivec3">; export const ivec4: (value: DynoVal) => DynoVal<"ivec4">; export const uvec2: (value: DynoVal) => DynoVal<"uvec2">; export const uvec3: (value: DynoVal) => DynoVal<"uvec3">; export const uvec4: (value: DynoVal) => DynoVal<"uvec4">; export const vec2: (value: DynoVal) => DynoVal<"vec2">; export const vec3: (value: DynoVal) => DynoVal<"vec3">; export const vec4: (value: DynoVal) => DynoVal<"vec4">; export const mat2: (value: DynoVal) => DynoVal<"mat2">; export const mat3: (value: DynoVal) => DynoVal<"mat3">; export const mat4: (value: DynoVal) => DynoVal<"mat4">; export const floatBitsToInt: (value: DynoVal<"float">) => DynoVal<"int">; export const floatBitsToUint: (value: DynoVal<"float">) => DynoVal<"uint">; export const intBitsToFloat: (value: DynoVal<"int">) => DynoVal<"float">; export const uintBitsToFloat: (value: DynoVal<"uint">) => DynoVal<"float">; export const packSnorm2x16: (value: DynoVal<"vec2">) => DynoVal<"uint">; export const unpackSnorm2x16: (value: DynoVal<"uint">) => DynoVal<"vec2">; export const packUnorm2x16: (value: DynoVal<"vec2">) => DynoVal<"uint">; export const unpackUnorm2x16: (value: DynoVal<"uint">) => DynoVal<"vec2">; export const packHalf2x16: (value: DynoVal<"vec2">) => DynoVal<"uint">; export const unpackHalf2x16: (value: DynoVal<"uint">) => DynoVal<"vec2">; export const uintToRgba8: (value: DynoVal<"uint">) => DynoVal<"vec4">; export class SimpleCast extends UnaryOp { constructor({ value, outType, outKey, }: { value: DynoVal; outType: OutType; outKey: OutKey; }); } export class Bool extends SimpleCast<"bool" | "int" | "uint" | "float", "bool", "bool"> { constructor({ value, }: { value: DynoVal<"bool" | "int" | "uint" | "float">; }); } export class Int extends SimpleCast<"bool" | "int" | "uint" | "float", "int", "int"> { constructor({ value, }: { value: DynoVal<"bool" | "int" | "uint" | "float">; }); } export class Uint extends SimpleCast<"bool" | "int" | "uint" | "float", "uint", "uint"> { constructor({ value, }: { value: DynoVal<"bool" | "int" | "uint" | "float">; }); } export class Float extends SimpleCast<"bool" | "int" | "uint" | "float", "float", "float"> { constructor({ value, }: { value: DynoVal<"bool" | "int" | "uint" | "float">; }); } export class BVec2 extends SimpleCast<"bool" | "bvec2" | "ivec2" | "uvec2" | "vec2", "bvec2", "bvec2"> { constructor({ value, }: { value: DynoVal<"bool" | "bvec2" | "ivec2" | "uvec2" | "vec2">; }); } export class BVec3 extends SimpleCast<"bool" | "bvec3" | "ivec3" | "uvec3" | "vec3", "bvec3", "bvec3"> { constructor({ value, }: { value: DynoVal<"bool" | "bvec3" | "ivec3" | "uvec3" | "vec3">; }); } export class BVec4 extends SimpleCast<"bool" | "bvec4" | "ivec4" | "uvec4" | "vec4", "bvec4", "bvec4"> { constructor({ value, }: { value: DynoVal<"bool" | "bvec4" | "ivec4" | "uvec4" | "vec4">; }); } export class IVec2 extends SimpleCast<"int" | "bvec2" | "ivec2" | "uvec2" | "vec2", "ivec2", "ivec2"> { constructor({ value, }: { value: DynoVal<"int" | "bvec2" | "ivec2" | "uvec2" | "vec2">; }); } export class IVec3 extends SimpleCast<"int" | "bvec3" | "ivec3" | "uvec3" | "vec3", "ivec3", "ivec3"> { constructor({ value, }: { value: DynoVal<"int" | "bvec3" | "ivec3" | "uvec3" | "vec3">; }); } export class IVec4 extends SimpleCast<"int" | "bvec4" | "ivec4" | "uvec4" | "vec4", "ivec4", "ivec4"> { constructor({ value, }: { value: DynoVal<"int" | "bvec4" | "ivec4" | "uvec4" | "vec4">; }); } export class UVec2 extends SimpleCast<"uint" | "ivec2" | "bvec2" | "uvec2" | "vec2", "uvec2", "uvec2"> { constructor({ value, }: { value: DynoVal<"uint" | "ivec2" | "bvec2" | "uvec2" | "vec2">; }); } export class UVec3 extends SimpleCast<"uint" | "ivec3" | "bvec3" | "uvec3" | "vec3", "uvec3", "uvec3"> { constructor({ value, }: { value: DynoVal<"uint" | "ivec3" | "bvec3" | "uvec3" | "vec3">; }); } export class UVec4 extends SimpleCast<"uint" | "ivec4" | "bvec4" | "uvec4" | "vec4", "uvec4", "uvec4"> { constructor({ value, }: { value: DynoVal<"uint" | "ivec4" | "bvec4" | "uvec4" | "vec4">; }); } export class Vec2 extends SimpleCast<"float" | "bvec2" | "ivec2" | "uvec2" | "vec2" | "vec3" | "vec4", "vec2", "vec2"> { constructor({ value, }: { value: DynoVal<"float" | "bvec2" | "ivec2" | "uvec2" | "vec2" | "vec3" | "vec4">; }); } export class Vec3 extends SimpleCast<"float" | "bvec3" | "ivec3" | "uvec3" | "vec3" | "vec2" | "vec4", "vec3", "vec3"> { constructor({ value, }: { value: DynoVal<"float" | "bvec3" | "ivec3" | "uvec3" | "vec3" | "vec2" | "vec4">; }); } export class Vec4 extends SimpleCast<"float" | "bvec4" | "ivec4" | "uvec4" | "vec4", "vec4", "vec4"> { constructor({ value, }: { value: DynoVal<"float" | "bvec4" | "ivec4" | "uvec4" | "vec4">; }); } export class Mat2 extends SimpleCast<"float" | "mat2" | "mat3" | "mat4", "mat2", "mat2"> { constructor({ value, }: { value: DynoVal<"float" | "mat2" | "mat3" | "mat4">; }); } export class Mat3 extends SimpleCast<"float" | "mat2" | "mat3" | "mat4", "mat3", "mat3"> { constructor({ value, }: { value: DynoVal<"float" | "mat2" | "mat3" | "mat4">; }); } export class Mat4 extends SimpleCast<"float" | "mat2" | "mat3" | "mat4", "mat4", "mat4"> { constructor({ value, }: { value: DynoVal<"float" | "mat2" | "mat3" | "mat4">; }); } export class FloatBitsToInt extends UnaryOp<"float", "int", "int"> { constructor({ value }: { value: DynoVal<"float">; }); } export class FloatBitsToUint extends UnaryOp<"float", "uint", "uint"> { constructor({ value }: { value: DynoVal<"float">; }); } export class IntBitsToFloat extends UnaryOp<"int", "float", "float"> { constructor({ value }: { value: DynoVal<"int">; }); } export class UintBitsToFloat extends UnaryOp<"uint", "float", "float"> { constructor({ value }: { value: DynoVal<"uint">; }); } export class PackSnorm2x16 extends UnaryOp<"vec2", "uint", "uint"> { constructor({ value }: { value: DynoVal<"vec2">; }); } export class UnpackSnorm2x16 extends UnaryOp<"uint", "vec2", "vec2"> { constructor({ value }: { value: DynoVal<"uint">; }); } export class PackUnorm2x16 extends UnaryOp<"vec2", "uint", "uint"> { constructor({ value }: { value: DynoVal<"vec2">; }); } export class UnpackUnorm2x16 extends UnaryOp<"uint", "vec2", "vec2"> { constructor({ value }: { value: DynoVal<"uint">; }); } export class PackHalf2x16 extends UnaryOp<"vec2", "uint", "uint"> { constructor({ value }: { value: DynoVal<"vec2">; }); } export class UnpackHalf2x16 extends UnaryOp<"uint", "vec2", "vec2"> { constructor({ value }: { value: DynoVal<"uint">; }); } export class UintToRgba8 extends UnaryOp<"uint", "vec4", "rgba8"> { constructor({ value }: { value: DynoVal<"uint">; }); } } declare module "dyno/vecmat" { import { BinaryOp, Dyno, TrinaryOp, UnaryOp } from "dyno/base"; import { type FloatTypes, type IntTypes, type MatFloatTypes, type SquareMatTypes, type UintTypes, type VectorElementType, type VectorTypes } from "dyno/types"; import { type DynoVal, type DynoValue, type HasDynoOut } from "dyno/value"; export const length: (a: DynoVal) => DynoVal<"float">; export const distance: (a: DynoVal, b: DynoVal) => DynoVal<"float">; export const dot: (a: DynoVal, b: DynoVal) => DynoVal<"float">; export const cross: (a: DynoVal<"vec3">, b: DynoVal<"vec3">) => DynoVal<"vec3">; export const normalize: (a: DynoVal) => DynoVal; export const faceforward: (a: DynoVal, b: DynoVal, c: DynoVal) => DynoVal; export const reflectVec: (incident: DynoVal, normal: DynoVal) => DynoVal; export const refractVec: (incident: DynoVal, normal: DynoVal, eta: DynoVal<"float">) => DynoVal; export const split: (vector: DynoVal) => Split; export const combine: >({ vector, vectorType, x, y, z, w, r, g, b, a, }: { vector?: DynoVal; vectorType?: V; x?: DynoVal; y?: DynoVal; z?: DynoVal; w?: DynoVal; r?: DynoVal; g?: DynoVal; b?: DynoVal; a?: DynoVal; }) => DynoVal; export const projectH: (a: DynoVal) => DynoVal>; export const extendVec: (a: DynoVal, b: DynoVal<"float">) => DynoVal>; export const swizzle: (a: DynoVal, select: S) => DynoVal>>; export const compMult: (a: DynoVal, b: DynoVal) => DynoVal; export const outer: (a: DynoVal, b: DynoVal) => DynoVal>; export const transpose: (a: DynoVal) => DynoVal>; export const determinant: (a: DynoVal) => DynoVal<"float">; export const inverse: (a: DynoVal) => DynoVal; export class Length extends UnaryOp { constructor({ a }: { a: DynoVal; }); } export class Distance extends BinaryOp { constructor({ a, b }: { a: DynoVal; b: DynoVal; }); } export class Dot extends BinaryOp { constructor({ a, b }: { a: DynoVal; b: DynoVal; }); } export class Cross extends BinaryOp<"vec3", "vec3", "vec3", "cross"> { constructor({ a, b }: { a: DynoVal<"vec3">; b: DynoVal<"vec3">; }); } export class Normalize extends UnaryOp { constructor({ a }: { a: DynoVal; }); } type ProjectHOutput = A extends "vec3" ? "vec2" : A extends "vec4" ? "vec3" : never; export class ProjectH extends UnaryOp, "projected"> { constructor({ a }: { a: DynoVal; }); } type ExtendVecOutput = A extends "float" ? "vec2" : A extends "vec2" ? "vec3" : A extends "vec3" ? "vec4" : never; export class ExtendVec extends BinaryOp, "extend"> { constructor({ a, b }: { a: DynoVal; b: DynoVal<"float">; }); } export class FaceForward extends TrinaryOp { constructor({ a, b, c }: { a: DynoVal; b: DynoVal; c: DynoVal; }); } export class ReflectVec extends BinaryOp { constructor({ incident, normal, }: { incident: DynoVal; normal: DynoVal; }); } export class RefractVec extends TrinaryOp { constructor({ incident, normal, eta, }: { incident: DynoVal; normal: DynoVal; eta: DynoVal<"float">; }); } export class CompMult extends BinaryOp { constructor({ a, b }: { a: DynoVal; b: DynoVal; }); } type OuterOutput = A extends "vec2" ? B extends "vec2" ? "mat2" : B extends "vec3" ? "mat3x2" : B extends "vec4" ? "mat4x2" : never : A extends "vec3" ? B extends "vec2" ? "mat2x3" : B extends "vec3" ? "mat3" : B extends "vec4" ? "mat4x3" : never : A extends "vec4" ? B extends "vec2" ? "mat2x4" : B extends "vec3" ? "mat3x4" : B extends "vec4" ? "mat4" : never : never; export class Outer extends BinaryOp, "outer"> { constructor({ a, b }: { a: DynoVal; b: DynoVal; }); } type TransposeOutput = A extends SquareMatTypes ? A : A extends "mat2x3" ? "mat3x2" : A extends "mat2x4" ? "mat4x2" : A extends "mat3x2" ? "mat2x3" : A extends "mat3x4" ? "mat4x3" : A extends "mat4x2" ? "mat2x4" : A extends "mat4x3" ? "mat3x4" : never; export class Transpose extends UnaryOp, "transpose"> { constructor({ a }: { a: DynoVal; }); } export class Determinant extends UnaryOp { constructor({ a }: { a: DynoVal; }); } export class Inverse extends UnaryOp { constructor({ a }: { a: DynoVal; }); } type SplitOutTypes = A extends "vec2" ? { x: "float"; y: "float"; r: "float"; g: "float"; } : A extends "vec3" ? { x: "float"; y: "float"; z: "float"; r: "float"; g: "float"; b: "float"; } : A extends "vec4" ? { x: "float"; y: "float"; z: "float"; w: "float"; r: "float"; g: "float"; b: "float"; a: "float"; } : A extends "ivec2" ? { x: "int"; y: "int"; r: "int"; g: "int"; } : A extends "ivec3" ? { x: "int"; y: "int"; z: "int"; r: "int"; g: "int"; b: "int"; } : A extends "ivec4" ? { x: "int"; y: "int"; z: "int"; w: "int"; r: "int"; g: "int"; b: "int"; a: "int"; } : A extends "uvec2" ? { x: "uint"; y: "uint"; r: "uint"; g: "uint"; } : A extends "uvec3" ? { x: "uint"; y: "uint"; z: "uint"; r: "uint"; g: "uint"; b: "uint"; } : A extends "uvec4" ? { x: "uint"; y: "uint"; z: "uint"; w: "uint"; r: "uint"; g: "uint"; b: "uint"; a: "uint"; } : never; export class Split extends Dyno<{ vector: V; }, SplitOutTypes> { constructor({ vector }: { vector: DynoVal; }); } export class Combine> extends Dyno & { vector: V; }, { vector: V; }> implements HasDynoOut { constructor({ vector, vectorType, x, y, z, w, r, g, b, a, }: { vector?: DynoVal; vectorType?: V; x?: DynoVal; y?: DynoVal; z?: DynoVal; w?: DynoVal; r?: DynoVal; g?: DynoVal; b?: DynoVal; a?: DynoVal; }); dynoOut(): DynoValue; } type SwizzleOutput = A extends FloatTypes ? Len extends 1 ? "float" : Len extends 2 ? "vec2" : Len extends 3 ? "vec3" : Len extends 4 ? "vec4" : never : A extends IntTypes ? Len extends 1 ? "int" : Len extends 2 ? "ivec2" : Len extends 3 ? "ivec3" : Len extends 4 ? "ivec4" : never : A extends UintTypes ? Len extends 1 ? "uint" : Len extends 2 ? "uvec2" : Len extends 3 ? "uvec3" : Len extends 4 ? "uvec4" : never : never; type SwizzleSelectLen = S extends Swizzle1Select ? 1 : S extends Swizzle2Select ? 2 : S extends Swizzle3Select ? 3 : S extends Swizzle4Select ? 4 : never; type Swizzle1Select = `${"x" | "y" | "z" | "w"}|${"r" | "g" | "b" | "a"}`; type Swizzle2Select = `${"x" | "y" | "z" | "w"}${"x" | "y" | "z" | "w"}` | `${"r" | "g" | "b" | "a"}${"r" | "g" | "b" | "a"}`; type Swizzle3Select = `${"x" | "y" | "z" | "w"}${"x" | "y" | "z" | "w"}${"x" | "y" | "z" | "w"}` | `${"r" | "g" | "b" | "a"}${"r" | "g" | "b" | "a"}${"r" | "g" | "b" | "a"}`; type Swizzle4Select = `${"x" | "y" | "z" | "w"}${"x" | "y" | "z" | "w"}${"x" | "y" | "z" | "w"}${"x" | "y" | "z" | "w"}` | `${"r" | "g" | "b" | "a"}${"r" | "g" | "b" | "a"}${"r" | "g" | "b" | "a"}${"r" | "g" | "b" | "a"}`; type SwizzleSelect = Swizzle1Select | Swizzle2Select | Swizzle3Select | Swizzle4Select; export class Swizzle extends UnaryOp>, "swizzle"> { constructor({ vector, select }: { vector: DynoVal; select: S; }); } } declare module "dyno/util" { import { Dyno, DynoBlock } from "dyno/base"; import { type ValueTypes } from "dyno/types"; import { type DynoVal, type DynoValue, type HasDynoOut } from "dyno/value"; export const remapIndex: (index: DynoVal<"int">, from: DynoVal<"int">, to: DynoVal<"int">) => DynoVal<"int">; export const pcgMix: (value: DynoVal) => DynoVal<"uint">; export const pcgNext: (state: DynoVal<"uint">) => DynoVal<"uint">; export const pcgHash: (state: DynoVal<"uint">) => DynoVal<"uint">; export const hash: (value: DynoVal) => DynoVal<"uint">; export const hash2: (value: DynoVal) => DynoVal<"uvec2">; export const hash3: (value: DynoVal) => DynoVal<"uvec3">; export const hash4: (value: DynoVal) => DynoVal<"uvec4">; export const hashFloat: (value: DynoVal) => DynoVal<"float">; export const hashVec2: (value: DynoVal) => DynoVal<"vec2">; export const hashVec3: (value: DynoVal) => DynoVal<"vec3">; export const hashVec4: (value: DynoVal) => DynoVal<"vec4">; export class DynoRemapIndex extends Dyno<{ from: "int"; to: "int"; index: "int"; }, { index: "int"; }> implements HasDynoOut<"int"> { constructor({ from, to, index, }: { from: DynoVal<"int">; to: DynoVal<"int">; index: DynoVal<"int">; }); dynoOut(): DynoValue<"int">; } export class PcgNext extends Dyno<{ state: T; }, { state: "uint"; }> implements HasDynoOut<"uint"> { constructor({ state }: { state: DynoVal; }); dynoOut(): DynoValue<"uint">; } export class PcgHash extends Dyno<{ state: "uint"; }, { hash: "uint"; }> implements HasDynoOut<"uint"> { constructor({ state }: { state: DynoVal<"uint">; }); dynoOut(): DynoValue<"uint">; } export class PcgMix extends Dyno<{ value: T; }, { state: "uint"; }> implements HasDynoOut<"uint"> { constructor({ value }: { value: DynoVal; }); dynoOut(): DynoValue<"uint">; } export class Hash extends DynoBlock<{ value: T; }, { hash: "uint"; }> implements HasDynoOut<"uint"> { constructor({ value }: { value: DynoVal; }); dynoOut(): DynoValue<"uint">; } export class Hash2 extends DynoBlock<{ value: T; }, { hash: "uvec2"; }> implements HasDynoOut<"uvec2"> { constructor({ value }: { value: DynoVal; }); dynoOut(): DynoValue<"uvec2">; } export class Hash3 extends DynoBlock<{ value: T; }, { hash: "uvec3"; }> implements HasDynoOut<"uvec3"> { constructor({ value }: { value: DynoVal; }); dynoOut(): DynoValue<"uvec3">; } export class Hash4 extends DynoBlock<{ value: T; }, { hash: "uvec4"; }> implements HasDynoOut<"uvec4"> { constructor({ value }: { value: DynoVal; }); dynoOut(): DynoValue<"uvec4">; } export class HashFloat extends DynoBlock<{ value: T; }, { hash: "float"; }> implements HasDynoOut<"float"> { constructor({ value }: { value: DynoVal; }); dynoOut(): DynoValue<"float">; } export class HashVec2 extends DynoBlock<{ value: T; }, { hash: "vec2"; }> implements HasDynoOut<"vec2"> { constructor({ value }: { value: DynoVal; }); dynoOut(): DynoValue<"vec2">; } export class HashVec3 extends DynoBlock<{ value: T; }, { hash: "vec3"; }> implements HasDynoOut<"vec3"> { constructor({ value }: { value: DynoVal; }); dynoOut(): DynoValue<"vec3">; } export class HashVec4 extends DynoBlock<{ value: T; }, { hash: "vec4"; }> implements HasDynoOut<"vec4"> { constructor({ value }: { value: DynoVal; }); dynoOut(): DynoValue<"vec4">; } } declare module "dyno/transform" { import { Dyno } from "dyno/base"; import type { DynoVal } from "dyno/value"; export const transformPos: (position: DynoVal<"vec3">, { scale, scales, rotate, translate, }: { scale?: DynoVal<"float">; scales?: DynoVal<"vec3">; rotate?: DynoVal<"vec4">; translate?: DynoVal<"vec3">; }) => DynoVal<"vec3">; export const transformRay: (ray: DynoVal<"vec3">, { scale, scales, rotate, }: { scale?: DynoVal<"float">; scales?: DynoVal<"vec3">; rotate?: DynoVal<"vec4">; }) => DynoVal<"vec3">; export const transformQuat: (quaternion: DynoVal<"vec4">, { rotate }: { rotate?: DynoVal<"vec4">; }) => DynoVal<"vec4">; export class TransformPosition extends Dyno<{ position: "vec3"; scale: "float"; scales: "vec3"; rotate: "vec4"; translate: "vec3"; }, { position: "vec3"; }> { constructor({ position, scale, scales, rotate, translate, }: { position?: DynoVal<"vec3">; scale?: DynoVal<"float">; scales?: DynoVal<"vec3">; rotate?: DynoVal<"vec4">; translate?: DynoVal<"vec3">; }); } export class TransformRay extends Dyno<{ ray: "vec3"; scale: "float"; scales: "vec3"; rotate: "vec4"; }, { ray: "vec3"; }> { constructor({ ray, scale, scales, rotate, }: { ray?: DynoVal<"vec3">; scale?: DynoVal<"float">; scales?: DynoVal<"vec3">; rotate?: DynoVal<"vec4">; }); } export class TransformQuaternion extends Dyno<{ quaternion: "vec4"; rotate: "vec4"; }, { quaternion: "vec4"; }> { constructor({ quaternion, rotate, }: { quaternion?: DynoVal<"vec4">; rotate?: DynoVal<"vec4">; }); } } declare module "dyno/control" { export const dynoIf: () => never; export const dynoSwitch: () => never; export const dynoFor: () => never; export const comment: () => never; export const arrayIndex: () => never; export const arrayLength: () => never; } declare module "dyno/texture" { import { Dyno } from "dyno/base"; import type { AllSamplerTypes, IsamplerTypes, NormalSamplerTypes, Sampler2DArrayTypes, Sampler2DTypes, Sampler3DTypes, SamplerCubeTypes, SamplerShadowTypes, SamplerTypes, UsamplerTypes } from "dyno/types"; import { type DynoVal, type DynoValue, type HasDynoOut } from "dyno/value"; export const textureSize: (texture: DynoVal, lod?: DynoVal<"int">) => DynoVal>; export const texture: (texture: DynoVal, coord: DynoVal>, bias?: DynoVal<"float">) => DynoVal>; export const texelFetch: (texture: DynoVal, coord: DynoVal>, lod?: DynoVal<"int">) => DynoVal>; export class TextureSize extends Dyno<{ texture: T; lod: "int"; }, { size: TextureSizeType; }> implements HasDynoOut> { constructor({ texture, lod }: { texture: DynoVal; lod?: DynoVal<"int">; }); dynoOut(): DynoValue>; } export class Texture extends Dyno<{ texture: T; coord: TextureCoordType; bias: "float"; }, { sample: TextureReturnType; }> implements HasDynoOut> { constructor({ texture, coord, bias, }: { texture: DynoVal; coord: DynoVal>; bias?: DynoVal<"float">; }); dynoOut(): DynoValue>; } export class TexelFetch extends Dyno<{ texture: T; coord: TextureSizeType; lod: "int"; }, { texel: TextureReturnType; }> implements HasDynoOut> { constructor({ texture, coord, lod, }: { texture: DynoVal; coord: DynoVal>; lod?: DynoVal<"int">; }); dynoOut(): DynoValue>; } type TextureSizeType = T extends Sampler2DTypes | SamplerCubeTypes ? "ivec2" : T extends Sampler3DTypes | Sampler2DArrayTypes ? "ivec3" : never; type TextureCoordType = T extends Sampler2DTypes ? "vec2" : T extends Sampler3DTypes | Sampler2DArrayTypes | SamplerCubeTypes | Sampler2DArrayTypes ? "vec3" : T extends "samperCubeShadow" | "sampler2DArrayShadow" ? "vec4" : never; type TextureReturnType = T extends SamplerTypes ? "vec4" : T extends UsamplerTypes ? "uvec4" : T extends IsamplerTypes ? "ivec4" : T extends SamplerShadowTypes ? "float" : never; } declare module "dyno/trig" { import { BinaryOp, UnaryOp } from "dyno/base"; import type { FloatTypes } from "dyno/types"; import type { DynoVal } from "dyno/value"; export const radians: (degrees: DynoVal) => DynoVal; export const degrees: (radians: DynoVal) => DynoVal; export const sin: (radians: DynoVal) => DynoVal; export const cos: (radians: DynoVal) => DynoVal; export const tan: (radians: DynoVal) => DynoVal; export const asin: (sin: DynoVal) => DynoVal; export const acos: (cos: DynoVal) => DynoVal; export const atan: (tan: DynoVal) => DynoVal; export const atan2: (y: DynoVal, x: DynoVal) => DynoVal; export const sinh: (x: DynoVal) => DynoVal; export const cosh: (x: DynoVal) => DynoVal; export const tanh: (x: DynoVal) => DynoVal; export const asinh: (x: DynoVal) => DynoVal; export const acosh: (x: DynoVal) => DynoVal; export const atanh: (x: DynoVal) => DynoVal; export class Radians extends UnaryOp { constructor({ degrees }: { degrees: DynoVal; }); } export class Degrees extends UnaryOp { constructor({ radians }: { radians: DynoVal; }); } export class Sin extends UnaryOp { constructor({ radians }: { radians: DynoVal; }); } export class Cos extends UnaryOp { constructor({ radians }: { radians: DynoVal; }); } export class Tan extends UnaryOp { constructor({ radians }: { radians: DynoVal; }); } export class Asin extends UnaryOp { constructor({ sin }: { sin: DynoVal; }); } export class Acos extends UnaryOp { constructor({ cos }: { cos: DynoVal; }); } export class Atan extends UnaryOp { constructor({ tan }: { tan: DynoVal; }); } export class Atan2 extends BinaryOp { constructor({ y, x }: { y: DynoVal; x: DynoVal; }); } export class Sinh extends UnaryOp { constructor({ x }: { x: DynoVal; }); } export class Cosh extends UnaryOp { constructor({ x }: { x: DynoVal; }); } export class Tanh extends UnaryOp { constructor({ x }: { x: DynoVal; }); } export class Asinh extends UnaryOp { constructor({ x }: { x: DynoVal; }); } export class Acosh extends UnaryOp { constructor({ x }: { x: DynoVal; }); } export class Atanh extends UnaryOp { constructor({ x }: { x: DynoVal; }); } } declare module "dyno" { export * from "dyno/types"; export * from "dyno/base"; export * from "dyno/value"; export * from "dyno/output"; export * from "dyno/uniforms"; export * from "dyno/program"; export * from "dyno/math"; export * from "dyno/logic"; export * from "dyno/util"; export * from "dyno/splats"; export * from "dyno/transform"; export * from "dyno/control"; export * from "dyno/convert"; export * from "dyno/texture"; export * from "dyno/trig"; export * from "dyno/vecmat"; } declare module "SplatEdit" { import * as THREE from "three"; import { DynoUniform, type DynoVal, Gsplat } from "dyno"; export enum SplatEditSdfType { ALL = "all", PLANE = "plane", SPHERE = "sphere", BOX = "box", ELLIPSOID = "ellipsoid", CYLINDER = "cylinder", CAPSULE = "capsule", INFINITE_CONE = "infinite_cone" } export enum SplatEditRgbaBlendMode { MULTIPLY = "multiply", SET_RGB = "set_rgb", ADD_RGBA = "add_rgba" } export type SplatEditSdfOptions = { type?: SplatEditSdfType; invert?: boolean; opacity?: number; color?: THREE.Color; displace?: THREE.Vector3; radius?: number; }; export class SplatEditSdf extends THREE.Object3D { type: SplatEditSdfType; invert: boolean; opacity: number; color: THREE.Color; displace: THREE.Vector3; radius: number; constructor(options?: SplatEditSdfOptions); } export type SplatEditOptions = { name?: string; rgbaBlendMode?: SplatEditRgbaBlendMode; sdfSmooth?: number; softEdge?: number; invert?: boolean; sdfs?: SplatEditSdf[]; }; export class SplatEdit extends THREE.Object3D { ordering: number; rgbaBlendMode: SplatEditRgbaBlendMode; sdfSmooth: number; softEdge: number; invert: boolean; sdfs: SplatEditSdf[] | null; static nextOrdering: number; constructor(options?: SplatEditOptions); addSdf(sdf: SplatEditSdf): void; removeSdf(sdf: SplatEditSdf): void; } export class SplatEdits { maxSdfs: number; numSdfs: number; sdfData: Uint32Array; sdfFloatData: Float32Array; sdfTexture: THREE.DataTexture; dynoSdfArray: DynoUniform; maxEdits: number; numEdits: number; editData: Uint32Array; editFloatData: Float32Array; dynoNumEdits: DynoUniform<"int", "numEdits">; dynoEdits: DynoUniform<"uvec4", "edits">; constructor({ maxSdfs, maxEdits }: { maxSdfs?: number; maxEdits?: number; }); private newSdfTexture; private newEdits; private ensureCapacity; private updateEditData; private updateEditFloatData; private encodeEdit; private updateSdfData; private updateSdfFloatData; private encodeSdf; update(edits: { edit: SplatEdit; sdfs: SplatEditSdf[]; }[]): { updated: boolean; dynoUpdated: boolean; }; modify(gsplat: DynoVal): DynoVal; } export const SdfArray: { type: "SdfArray"; }; export const defineSdfArray: string; export const defineEdit: string; } declare module "SplatGenerator" { import * as THREE from "three"; import type { SplatEdit } from "SplatEdit"; import { type Dyno, DynoFloat, type DynoVal, DynoVec3, DynoVec4, Gsplat } from "dyno"; export type GsplatGenerator = Dyno<{ index: "int"; }, { gsplat: typeof Gsplat; }>; export type GsplatModifier = Dyno<{ gsplat: typeof Gsplat; }, { gsplat: typeof Gsplat; }>; export class SplatModifier { modifier: GsplatModifier; cache: Map; constructor(modifier: GsplatModifier); apply(generator: GsplatGenerator): GsplatGenerator; } export class SplatTransformer { scale: DynoFloat; rotate: DynoVec4; translate: DynoVec3; constructor(); modify(gsplat: DynoVal): DynoVal; updateFromMatrix(transform: THREE.Matrix4): boolean; update(object: THREE.Object3D): boolean; } export class SplatGenerator extends THREE.Object3D { numSplats: number; generator?: GsplatGenerator; generatorError?: unknown; frameUpdate?: ({ object, time, deltaTime, viewToWorld, globalEdits, }: { object: SplatGenerator; time: number; deltaTime: number; viewToWorld: THREE.Matrix4; globalEdits: SplatEdit[]; }) => void; version: number; constructor({ numSplats, generator, construct, update, }: { numSplats?: number; generator?: GsplatGenerator; construct?: (object: SplatGenerator) => { generator?: GsplatGenerator; numSplats?: number; frameUpdate?: (object: SplatGenerator) => void; }; update?: ({ object, time, deltaTime, viewToWorld, globalEdits, }: { object: SplatGenerator; time: number; deltaTime: number; viewToWorld: THREE.Matrix4; globalEdits: SplatEdit[]; }) => void; }); updateVersion(): void; set needsUpdate(value: boolean); } } declare module "Readback" { import * as THREE from "three"; import { type Dyno } from "dyno"; import { DynoProgram, DynoProgramTemplate } from "dyno/program"; export type Rgba8Readback = Dyno<{ index: "int"; }, { rgba8: "vec4"; }>; export type ReadbackBuffer = ArrayBuffer | Uint8Array | Int8Array | Uint16Array | Int16Array | Uint32Array | Int32Array | Float32Array; export class Readback { renderer?: THREE.WebGLRenderer; target?: THREE.WebGLArrayRenderTarget; capacity: number; count: number; constructor({ renderer }?: { renderer?: THREE.WebGLRenderer; }); dispose(): void; ensureBuffer(count: number, buffer: B): B; ensureCapacity(capacity: number): void; prepareProgramMaterial(reader: Rgba8Readback): { program: DynoProgram; material: THREE.RawShaderMaterial; }; private saveRenderState; private resetRenderState; private process; private read; render({ reader, count, renderer, }: { reader: Rgba8Readback; count: number; renderer?: THREE.WebGLRenderer; }): void; readback({ readback, }: { readback: B; }): Promise; renderReadback({ reader, count, renderer, readback, }: { reader: Rgba8Readback; count: number; renderer?: THREE.WebGLRenderer; readback: B; }): Promise; getTexture(): THREE.DataArrayTexture | undefined; static programTemplate: DynoProgramTemplate | null; static readbackProgram: Map; static geometry: THREE.PlaneGeometry; static mesh: THREE.Mesh; static scene: THREE.Scene; static camera: THREE.Camera; } } declare module "RgbaArray" { import * as THREE from "three"; import { type PackedSplats } from "PackedSplats"; import { Readback, type Rgba8Readback } from "Readback"; import { DynoUniform, type DynoVal } from "dyno"; export type RgbaArrayOptions = { capacity?: number; array?: Uint8Array; count?: number; }; export class RgbaArray { capacity: number; count: number; array: Uint8Array | null; readback: Readback | null; source: THREE.DataArrayTexture | null; needsUpdate: boolean; dyno: DynoUniform; constructor(options?: RgbaArrayOptions); dispose(): void; ensureCapacity(capacity: number): Uint8Array; getTexture(): THREE.DataArrayTexture; private maybeUpdateSource; render({ reader, count, renderer, }: { reader: Rgba8Readback; count: number; renderer: THREE.WebGLRenderer; }): void; fromPackedSplats({ packedSplats, base, count, renderer, }: { packedSplats: PackedSplats; base: number; count: number; renderer: THREE.WebGLRenderer; }): this; read(): Promise; private static emptySource; static getEmpty(): THREE.DataArrayTexture; private static dynos; private static makeDynos; } export const TRgbaArray: { type: "RgbaArray"; }; export const defineRgbaArray: string; export function readRgbaArray(rgba: DynoVal, index: DynoVal<"int">): DynoVal<"vec4">; } declare module "SplatSkinning" { import * as THREE from "three"; import type { SplatMesh } from "SplatMesh"; import { DynoUniform, type DynoVal, Gsplat } from "dyno"; export type SplatSkinningOptions = { mesh: SplatMesh; numSplats?: number; numBones?: number; }; export class SplatSkinning { mesh: SplatMesh; numSplats: number; skinData: Uint16Array; skinTexture: THREE.DataArrayTexture; numBones: number; boneData: Float32Array; boneTexture: THREE.DataTexture; uniform: DynoUniform; constructor(options: SplatSkinningOptions); modify(gsplat: DynoVal): DynoVal; setRestQuatPos(boneIndex: number, quat: THREE.Quaternion, pos: THREE.Vector3): void; setBoneQuatPos(boneIndex: number, quat: THREE.Quaternion, pos: THREE.Vector3): void; setSplatBones(splatIndex: number, boneIndices: THREE.Vector4, weights: THREE.Vector4): void; updateBones(): void; } export const GsplatSkinning: { type: "GsplatSkinning"; }; export const defineGsplatSkinning: string; export const defineApplyGsplatSkinning: string; } declare module "SplatMesh" { import * as THREE from "three"; import { PackedSplats } from "PackedSplats"; import { type RgbaArray } from "RgbaArray"; import { SplatEdit } from "SplatEdit"; import { type GsplatModifier, SplatGenerator, SplatTransformer } from "SplatGenerator"; import type { SplatFileType } from "SplatLoader"; import type { SplatSkinning } from "SplatSkinning"; import { DynoFloat, DynoUsampler2DArray, type DynoVal, DynoVec4, Gsplat } from "dyno"; export type SplatMeshOptions = { url?: string; fileBytes?: Uint8Array | ArrayBuffer; fileType?: SplatFileType; packedSplats?: PackedSplats; maxSplats?: number; constructSplats?: (splats: PackedSplats) => Promise | void; onLoad?: (mesh: SplatMesh) => Promise | void; editable?: boolean; onFrame?: ({ mesh, time, deltaTime, }: { mesh: SplatMesh; time: number; deltaTime: number; }) => void; objectModifier?: GsplatModifier; worldModifier?: GsplatModifier; }; export type SplatMeshContext = { transform: SplatTransformer; viewToWorld: SplatTransformer; worldToView: SplatTransformer; viewToObject: SplatTransformer; recolor: DynoVec4; time: DynoFloat; deltaTime: DynoFloat; }; export class SplatMesh extends SplatGenerator { initialized: Promise; isInitialized: boolean; packedSplats: PackedSplats; recolor: THREE.Color; opacity: number; context: SplatMeshContext; onFrame?: ({ mesh, time, deltaTime, }: { mesh: SplatMesh; time: number; deltaTime: number; }) => void; objectModifier?: GsplatModifier; worldModifier?: GsplatModifier; enableViewToObject: boolean; enableViewToWorld: boolean; enableWorldToView: boolean; skinning: SplatSkinning | null; edits: SplatEdit[] | null; editable: boolean; private rgbaDisplaceEdits; splatRgba: RgbaArray | null; maxSh: number; constructor(options?: SplatMeshOptions); asyncInitialize(options: SplatMeshOptions): Promise; static staticInitialized: Promise; static isStaticInitialized: boolean; static dynoTime: DynoFloat<"value">; static staticInitialize(): Promise; pushSplat(center: THREE.Vector3, scales: THREE.Vector3, quaternion: THREE.Quaternion, opacity: number, color: THREE.Color): void; forEachSplat(callback: (index: number, center: THREE.Vector3, scales: THREE.Vector3, quaternion: THREE.Quaternion, opacity: number, color: THREE.Color) => void): void; dispose(): void; constructGenerator({ transform, viewToObject, recolor }: SplatMeshContext): void; updateGenerator(): void; update({ time, viewToWorld, deltaTime, globalEdits, }: { time: number; viewToWorld: THREE.Matrix4; deltaTime: number; globalEdits: SplatEdit[]; }): void; raycast(raycaster: THREE.Raycaster, intersects: { distance: number; point: THREE.Vector3; object: THREE.Object3D; }[]): void; private ensureShTextures; } export function evaluateSH1(gsplat: DynoVal, sh1: DynoUsampler2DArray<"sh1", THREE.DataArrayTexture>, viewDir: DynoVal<"vec3">): DynoVal<"vec3">; export function evaluateSH2(gsplat: DynoVal, sh2: DynoVal<"usampler2DArray">, viewDir: DynoVal<"vec3">): DynoVal<"vec3">; export function evaluateSH3(gsplat: DynoVal, sh3: DynoVal<"usampler2DArray">, viewDir: DynoVal<"vec3">): DynoVal<"vec3">; } declare module "ply" { export type PlyPropertyType = "char" | "uchar" | "short" | "ushort" | "int" | "uint" | "float" | "double"; export type PlyElement = { name: string; count: number; properties: Record; }; export type PlyProperty = { isList: boolean; type: PlyPropertyType; countType?: PlyPropertyType; }; export type SplatCallback = (index: number, x: number, y: number, z: number, scaleX: number, scaleY: number, scaleZ: number, quatX: number, quatY: number, quatZ: number, quatW: number, opacity: number, r: number, g: number, b: number) => void; export type SplatShCallback = (index: number, sh1: Float32Array, sh2?: Float32Array, sh3?: Float32Array) => void; export class PlyReader { fileBytes: Uint8Array; header: string; littleEndian: boolean; elements: Record; comments: string[]; data: DataView | null; static defaultPointScale: number; numSplats: number; constructor({ fileBytes }: { fileBytes: Uint8Array | ArrayBuffer; }); parseHeader(): Promise; parseData(elementCallback: (element: PlyElement) => null | ((index: number, item: Record) => void)): void; parseSplats(splatCallback: SplatCallback, shCallback?: SplatShCallback): void; injectRgba(rgba: Uint8Array): void; } export const SH_C0 = 0.28209479177387814; } declare module "splatWorker" { export class SplatWorker { worker: Worker; messages: Record void; reject: (reason?: unknown) => void; }>; messageIdNext: number; constructor(); makeMessageId(): number; makeMessagePromiseId(): { id: number; promise: Promise; }; onMessage(event: MessageEvent): void; call(name: string, args: unknown): Promise; } export function setWorkerPool(count?: number): void; export function allocWorker(): Promise; export function freeWorker(worker: SplatWorker): void; export function withWorker(callback: (worker: SplatWorker) => Promise): Promise; } declare module "SplatLoader" { import { FileLoader, Loader, type LoadingManager } from "three"; import { PackedSplats } from "PackedSplats"; import { SplatMesh } from "SplatMesh"; export class SplatLoader extends Loader { fileLoader: FileLoader; fileType?: SplatFileType; constructor(manager?: LoadingManager); load(url: string, onLoad?: (decoded: PackedSplats) => void, onProgress?: (event: ProgressEvent) => void, onError?: (error: unknown) => void): void; loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise; parse(packedSplats: PackedSplats): SplatMesh; } export enum SplatFileType { PLY = "ply", WLG0 = "wlg0", SPZ = "spz", SPLAT = "splat", KSPLAT = "ksplat" } export function getSplatFileType(fileBytes: Uint8Array): SplatFileType | undefined; export function getFileExtension(pathOrUrl: string): string; export function unpackSplats({ input, fileType, pathOrUrl, }: { input: Uint8Array | ArrayBuffer; fileType?: SplatFileType; pathOrUrl?: string; }): Promise<{ packedArray: Uint32Array; numSplats: number; extra?: Record; }>; } declare module "PackedSplats" { import * as THREE from "three"; import type { GsplatGenerator } from "SplatGenerator"; import { type SplatFileType } from "SplatLoader"; import { DynoProgram, DynoProgramTemplate, DynoUniform } from "dyno"; import { TPackedSplats } from "dyno/splats"; export type PackedSplatsOptions = { url?: string; fileBytes?: Uint8Array | ArrayBuffer; fileType?: SplatFileType; maxSplats?: number; packedArray?: Uint32Array; numSplats?: number; construct?: (splats: PackedSplats) => Promise | void; extra?: Record; }; export class PackedSplats { maxSplats: number; numSplats: number; packedArray: Uint32Array | null; extra: Record; initialized: Promise; isInitialized: boolean; target: THREE.WebGLArrayRenderTarget | null; source: THREE.DataArrayTexture | null; needsUpdate: boolean; dyno: DynoUniform; constructor(options?: PackedSplatsOptions); reinitialize(options: PackedSplatsOptions): void; initialize(options: PackedSplatsOptions): void; asyncInitialize(options: PackedSplatsOptions): Promise; dispose(): void; ensureSplats(numSplats: number): Uint32Array; ensureSplatsSh(level: number, numSplats: number): Uint32Array; getSplat(index: number): { center: THREE.Vector3; scales: THREE.Vector3; quaternion: THREE.Quaternion; opacity: number; color: THREE.Color; }; setSplat(index: number, center: THREE.Vector3, scales: THREE.Vector3, quaternion: THREE.Quaternion, opacity: number, color: THREE.Color): void; pushSplat(center: THREE.Vector3, scales: THREE.Vector3, quaternion: THREE.Quaternion, opacity: number, color: THREE.Color): void; forEachSplat(callback: (index: number, center: THREE.Vector3, scales: THREE.Vector3, quaternion: THREE.Quaternion, opacity: number, color: THREE.Color) => void): void; ensureGenerate(maxSplats: number): boolean; generateMapping(splatCounts: number[]): { maxSplats: number; mapping: { base: number; count: number; }[]; }; getTexture(): THREE.DataArrayTexture; private maybeUpdateSource; private static emptySource; static getEmpty(): THREE.DataArrayTexture; prepareProgramMaterial(generator: GsplatGenerator): { program: DynoProgram; material: THREE.RawShaderMaterial; }; private saveRenderState; private resetRenderState; generate({ generator, base, count, renderer, }: { generator: GsplatGenerator; base: number; count: number; renderer: THREE.WebGLRenderer; }): { nextBase: number; }; static programTemplate: DynoProgramTemplate | null; static generatorProgram: Map; static geometry: THREE.PlaneGeometry; static mesh: THREE.Mesh; static scene: THREE.Scene; static camera: THREE.Camera; } export const dynoPackedSplats: (packedSplats?: PackedSplats) => DynoPackedSplats; export class DynoPackedSplats extends DynoUniform { packedSplats?: PackedSplats; constructor({ packedSplats }?: { packedSplats?: PackedSplats; }); } } declare module "SplatAccumulator" { import * as THREE from "three"; import { PackedSplats } from "PackedSplats"; import type { GsplatGenerator, SplatGenerator, SplatModifier } from "SplatGenerator"; export type GeneratorMapping = { node: SplatGenerator; generator?: GsplatGenerator; version: number; base: number; count: number; }; export class SplatAccumulator { splats: PackedSplats; toWorld: THREE.Matrix4; mapping: GeneratorMapping[]; refCount: number; splatsVersion: number; mappingVersion: number; ensureGenerate(maxSplats: number): void; generateSplats({ renderer, modifier, generators, forceUpdate, originToWorld, }: { renderer: THREE.WebGLRenderer; modifier: SplatModifier; generators: GeneratorMapping[]; forceUpdate?: boolean; originToWorld: THREE.Matrix4; }): boolean; hasCorrespondence(other: SplatAccumulator): boolean; } } declare module "SplatGeometry" { import * as THREE from "three"; export class SplatGeometry extends THREE.InstancedBufferGeometry { ordering: Uint32Array; attribute: THREE.InstancedBufferAttribute; constructor(ordering: Uint32Array, activeSplats: number); update(ordering: Uint32Array, activeSplats: number): void; } } declare module "ForgeViewpoint" { import * as THREE from "three"; import type { ForgeRenderer } from "ForgeRenderer"; import type { SplatAccumulator } from "SplatAccumulator"; import { SplatGeometry } from "SplatGeometry"; export type ForgeViewpointOptions = { autoUpdate?: boolean; camera?: THREE.Camera; viewToWorld?: THREE.Matrix4; target?: { width: number; height: number; doubleBuffer?: boolean; superXY?: number; }; onTextureUpdated?: (texture: THREE.Texture) => void; sortRadial?: boolean; sortDistance?: number; sortCoorient?: boolean; depthBias?: number; sort360?: boolean; }; export class ForgeViewpoint { forge: ForgeRenderer; autoUpdate: boolean; camera?: THREE.Camera; viewToWorld: THREE.Matrix4; lastTime: number | null; target?: THREE.WebGLRenderTarget; private back?; onTextureUpdated?: (texture: THREE.Texture) => void; encodeLinear: boolean; superXY: number; private superPixels?; private pixels?; sortRadial: boolean; sortDistance?: number; sortCoorient?: boolean; depthBias?: number; sort360?: boolean; display: { accumulator: SplatAccumulator; viewToWorld: THREE.Matrix4; geometry: SplatGeometry; } | null; private sorting; private pending; private sortingCheck; private readback; private orderingFreelist; constructor(options: ForgeViewpointOptions & { forge: ForgeRenderer; }); dispose(): void; setAutoUpdate(autoUpdate: boolean): void; prepare({ scene, camera, viewToWorld, update, forceOrigin, }: { scene: THREE.Scene; camera?: THREE.Camera; viewToWorld?: THREE.Matrix4; update?: boolean; forceOrigin?: boolean; }): Promise; renderTarget({ scene, camera, }: { scene: THREE.Scene; camera?: THREE.Camera; }): void; readTarget(): Promise; prepareRenderPixels({ scene, camera, viewToWorld, update, forceOrigin, }: { scene: THREE.Scene; camera?: THREE.Camera; viewToWorld?: THREE.Matrix4; update?: boolean; forceOrigin?: boolean; }): Promise>; autoPoll({ accumulator }: { accumulator?: SplatAccumulator; }): void; private driveSort; private sortUpdate; private updateDisplay; static EMPTY_TEXTURE: THREE.Texture; private static dynos; private static makeSorter; } } declare module "shaders" { export function getShaders(): Record; } declare module "ForgeRenderer" { import * as THREE from "three"; import { ForgeViewpoint, type ForgeViewpointOptions } from "ForgeViewpoint"; import { RgbaArray } from "RgbaArray"; import { SplatAccumulator } from "SplatAccumulator"; import { SplatGenerator } from "SplatGenerator"; export type ForgeRendererOptions = { renderer: THREE.WebGLRenderer; clock?: THREE.Clock; autoUpdate?: boolean; preUpdate?: boolean; originDistance?: number; maxStdDev?: number; enable2DGS?: boolean; preBlurAmount?: number; blurAmount?: number; falloff?: number; clipXY?: number; view?: ForgeViewpointOptions; }; export class ForgeRenderer extends THREE.Mesh { renderer: THREE.WebGLRenderer; material: THREE.ShaderMaterial; uniforms: ReturnType; autoUpdate: boolean; preUpdate: boolean; originDistance: number; maxStdDev: number; enable2DGS: boolean; preBlurAmount: number; blurAmount: number; falloff: number; clipXY: number; time?: number; deltaTime?: number; clock: THREE.Clock; active: SplatAccumulator; private freeAccumulators; private accumulatorCount; defaultView: ForgeViewpoint; autoViewpoints: ForgeViewpoint[]; private rotateToAccumulator; private translateToAccumulator; private modifier; private lastFrame; private lastUpdateTime; private defaultCameras; viewpoint: ForgeViewpoint; private pendingUpdate; private envViewpoint; private static cubeRender; private static pmrem; constructor(options: ForgeRendererOptions); static makeUniforms(): { renderSize: { value: THREE.Vector2; }; numSplats: { value: number; }; renderToViewQuat: { value: THREE.Quaternion; }; renderToViewPos: { value: THREE.Vector3; }; maxStdDev: { value: number; }; enable2DGS: { value: boolean; }; preBlurAmount: { value: number; }; blurAmount: { value: number; }; falloff: { value: number; }; clipXY: { value: number; }; packedSplats: { type: string; value: THREE.DataArrayTexture; }; time: { value: number; }; deltaTime: { value: number; }; encodeLinear: { value: boolean; }; debugFlag: { value: boolean; }; }; private canAllocAccumulator; private maybeAllocAccumulator; releaseAccumulator(accumulator: SplatAccumulator): void; newViewpoint(options: ForgeViewpointOptions): ForgeViewpoint; onBeforeRender(renderer: THREE.WebGLRenderer, scene: THREE.Scene, camera: THREE.Camera): void; prepareViewpoint(viewpoint?: ForgeViewpoint): void; update({ scene, viewToWorld, }: { scene: THREE.Scene; viewToWorld?: THREE.Matrix4; }): void; updateInternal({ scene, originToWorld, viewToWorld, }: { scene: THREE.Scene; originToWorld?: THREE.Matrix4; viewToWorld?: THREE.Matrix4; }): boolean; private compileScene; renderEnvMap({ renderer, scene, worldCenter, size, near, far, hideObjects, update, }: { renderer?: THREE.WebGLRenderer; scene: THREE.Scene; worldCenter: THREE.Vector3; size?: number; near?: number; far?: number; hideObjects?: THREE.Object3D[]; update?: boolean; }): Promise; recurseSetEnvMap(root: THREE.Object3D, envMap: THREE.Texture): void; getRgba({ generator, rgba, }: { generator: SplatGenerator; rgba?: RgbaArray; }): RgbaArray; readRgba({ generator, rgba, }: { generator: SplatGenerator; rgba?: RgbaArray; }): Promise; } } declare module "controls" { import * as THREE from "three"; export class ForgeControls { fpsMovement: FpsMovement; pointerControls: PointerControls; lastTime: number; constructor({ canvas }: { canvas: HTMLCanvasElement; }); update(control: THREE.Object3D): void; } export class FpsMovement { moveSpeed: number; rollSpeed: number; stickThreshold: number; rotateSpeed: number; keycodeMoveMapping: { [key: string]: THREE.Vector3; }; keycodeRotateMapping: { [key: string]: THREE.Vector3; }; gamepadMapping: { [button: number]: "shift" | "ctrl" | "rollLeft" | "rollRight"; }; capsMultiplier: number; shiftMultiplier: number; ctrlMultiplier: number; xr?: THREE.WebXRManager; enable: boolean; keydown: { [key: string]: boolean; }; keycode: { [key: string]: boolean; }; constructor({ moveSpeed, rollSpeed, stickThreshold, rotateSpeed, keycodeMoveMapping, keycodeRotateMapping, gamepadMapping, capsMultiplier, shiftMultiplier, ctrlMultiplier, xr, }?: { moveSpeed?: number; rollSpeed?: number; stickThreshold?: number; rotateSpeed?: number; keycodeMoveMapping?: { [key: string]: THREE.Vector3; }; keycodeRotateMapping?: { [key: string]: THREE.Vector3; }; gamepadMapping?: { [button: number]: "shift" | "ctrl" | "rollLeft" | "rollRight"; }; capsMultiplier?: number; shiftMultiplier?: number; ctrlMultiplier?: number; xr?: THREE.WebXRManager; }); update(deltaTime: number, control: THREE.Object3D): void; } type PointerState = { initial: THREE.Vector2; last: THREE.Vector2; position: THREE.Vector2; pointerId: number; button?: number; timeStamp: DOMHighResTimeStamp; }; export class PointerControls { canvas: HTMLCanvasElement; rotateSpeed: number; slideSpeed: number; scrollSpeed: number; reverseRotate: boolean; reverseSlide: boolean; reverseSwipe: boolean; reverseScroll: boolean; moveInertia: number; rotateInertia: number; enable: boolean; doublePress: ({ position, intervalMs, }: { position: THREE.Vector2; intervalMs: number; }) => void; doublePressLimitMs: number; doublePressDistance: number; lastUp: { position: THREE.Vector2; time: number; } | null; rotating: PointerState | null; sliding: PointerState | null; dualPress: boolean; scroll: THREE.Vector3; rotateVelocity: THREE.Vector3; moveVelocity: THREE.Vector3; constructor({ canvas, rotateSpeed, slideSpeed, scrollSpeed, reverseRotate, reverseSlide, reverseSwipe, reverseScroll, moveInertia, rotateInertia, doublePress, }: { canvas: HTMLCanvasElement; rotateSpeed?: number; slideSpeed?: number; scrollSpeed?: number; reverseRotate?: boolean; reverseSlide?: boolean; reverseSwipe?: boolean; reverseScroll?: boolean; moveInertia?: number; rotateInertia?: number; doublePress?: ({ position, intervalMs, }: { position: THREE.Vector2; intervalMs: number; }) => void; }); getPointerPosition(event: PointerEvent): THREE.Vector2; update(deltaTime: number, control: THREE.Object3D): void; } } declare module "generators/static" { import * as THREE from "three"; import { SplatGenerator } from "SplatGenerator"; export function staticBox({ box, cells, dotScale, color, opacity, }: { box: THREE.Box3; cells: THREE.Vector3; dotScale: number; color?: THREE.Color; opacity?: number; }): SplatGenerator; } declare module "generators/snow" { import * as THREE from "three"; import { SplatGenerator } from "SplatGenerator"; export const DEFAULT_SNOW: { box: THREE.Box3; density: number; fallDirection: THREE.Vector3; fallVelocity: number; wanderScale: number; wanderVariance: number; color1: THREE.Color; color2: THREE.Color; minScale: number; maxScale: number; anisoScale: THREE.Vector3; }; export const DEFAULT_RAIN: { box: THREE.Box3; density: number; fallDirection: THREE.Vector3; fallVelocity: number; wanderScale: number; wanderVariance: number; color1: THREE.Color; color2: THREE.Color; minScale: number; maxScale: number; anisoScale: THREE.Vector3; }; export function snowBox({ box, minY, numSplats, density, anisoScale, minScale, maxScale, fallDirection, fallVelocity, wanderScale, wanderVariance, color1, color2, opacity, onFrame, }: { box?: THREE.Box3; minY?: number; numSplats?: number; density?: number; anisoScale?: THREE.Vector3; minScale?: number; maxScale?: number; fallDirection?: THREE.Vector3; fallVelocity?: number; wanderScale?: number; wanderVariance?: number; color1?: THREE.Color; color2?: THREE.Color; opacity?: number; onFrame?: ({ object, time, deltaTime, }: { object: SplatGenerator; time: number; deltaTime: number; }) => void; }): { snow: SplatGenerator; min: import("dyno").DynoVec3; max: import("dyno").DynoVec3; minY: import("dyno").DynoFloat; color1: import("dyno").DynoVec3; color2: import("dyno").DynoVec3; opacity: import("dyno").DynoFloat; fallVelocity: import("dyno").DynoFloat; wanderVariance: import("dyno").DynoFloat; wanderScale: import("dyno").DynoFloat; fallDirection: import("dyno").DynoVec3; minScale: import("dyno").DynoFloat; maxScale: import("dyno").DynoFloat; anisoScale: import("dyno").DynoVec3; }; export type SNOW_RESULT_TYPE = ReturnType; } declare module "generators" { export * from "generators/static"; export * from "generators/snow"; } declare module "hands" { import { type Object3D, Quaternion, Vector3, type WebXRManager } from "three"; import { SplatMesh } from "SplatMesh"; export enum JointEnum { w = "wrist", t0 = "thumb-metacarpal", t1 = "thumb-phalanx-proximal", t2 = "thumb-phalanx-distal", t3 = "thumb-tip", i0 = "index-finger-metacarpal", i1 = "index-finger-phalanx-proximal", i2 = "index-finger-phalanx-intermediate", i3 = "index-finger-phalanx-distal", i4 = "index-finger-tip", m0 = "middle-finger-metacarpal", m1 = "middle-finger-phalanx-proximal", m2 = "middle-finger-phalanx-intermediate", m3 = "middle-finger-phalanx-distal", m4 = "middle-finger-tip", r0 = "ring-finger-metacarpal", r1 = "ring-finger-phalanx-proximal", r2 = "ring-finger-phalanx-intermediate", r3 = "ring-finger-phalanx-distal", r4 = "ring-finger-tip", p0 = "pinky-finger-metacarpal", p1 = "pinky-finger-phalanx-proximal", p2 = "pinky-finger-phalanx-intermediate", p3 = "pinky-finger-phalanx-distal", p4 = "pinky-finger-tip" } export type JointId = keyof typeof JointEnum; export const JOINT_IDS: JointId[]; export const NUM_JOINTS: number; export const JOINT_INDEX: { [key in JointId]: number; }; export const JOINT_RADIUS: { [key in JointId]: number; }; export const JOINT_SEGMENTS: JointId[][]; export const JOINT_SEGMENT_STEPS: number[][]; export const JOINT_TIPS: JointId[]; export const FINGER_TIPS: JointId[]; export enum Hand { left = "left", right = "right" } export const HANDS: Hand[]; export type Joint = { position: Vector3; quaternion: Quaternion; radius: number; }; export type HandJoints = { [key in JointId]?: Joint; }; export type HandsJoints = { [key in Hand]?: HandJoints; }; export class XrHands { hands: HandsJoints; last: HandsJoints; values: Record; tests: Record; lastTests: Record; updated: boolean; update({ xr, xrFrame }: { xr: WebXRManager; xrFrame: XRFrame; }): void; makeGhostMesh(): SplatMesh; distance(handA: Hand, jointA: JointId, handB: Hand, jointB: JointId, last?: boolean): number; separation(handA: Hand, jointA: JointId, handB: Hand, jointB: JointId, last?: boolean): number; touching(handA: Hand, jointA: JointId, handB: Hand, jointB: JointId, last?: boolean): number; allTipsTouching(hand: Hand, last?: boolean): number; triTipsTouching(hand: Hand, last?: boolean): number; } export class HandMovement { xrHands: XrHands; control: Object3D; moveInertia: number; rotateInertia: number; lastGrip: { [key in Hand]?: Vector3; }; lastPivot: Vector3; rotateVelocity: number; velocity: Vector3; constructor({ xrHands, control, moveInertia, rotateInertia, }: { xrHands: XrHands; control: Object3D; moveInertia?: number; rotateInertia?: number; }); update(deltaTime: number): void; } } declare module "spz" { import { GunzipReader } from "utils"; export class SpzReader { fileBytes: Uint8Array; reader: GunzipReader; version: number; numSplats: number; shDegree: number; fractionalBits: number; flags: number; flagAntiAlias: boolean; reserved: number; parsed: boolean; constructor({ fileBytes }: { fileBytes: Uint8Array | ArrayBuffer; }); parseSplats(centerCallback: (index: number, x: number, y: number, z: number) => void, alphaCallback: (index: number, alpha: number) => void, rgbCallback: (index: number, r: number, g: number, b: number) => void, scalesCallback: (index: number, scaleX: number, scaleY: number, scaleZ: number) => void, quatCallback: (index: number, quatX: number, quatY: number, quatZ: number, quatW: number) => void, shCallback?: (index: number, sh1: Float32Array, sh2?: Float32Array, sh3?: Float32Array) => void): void; } } declare module "splatConstructors" { import * as THREE from "three"; import { PackedSplats } from "PackedSplats"; import { SplatMesh } from "SplatMesh"; export function constructGrid({ splats, extents, stepSize, pointRadius, pointShadowScale, opacity, color, }: { splats: PackedSplats; extents: THREE.Box3; stepSize?: number; pointRadius?: number; pointShadowScale?: number; opacity?: number; color?: THREE.Color | ((color: THREE.Color, point: THREE.Vector3) => void); }): void; export function constructAxes({ splats, scale, axisRadius, axisShadowScale, origins, }: { splats: PackedSplats; scale?: number; axisRadius?: number; axisShadowScale?: number; origins?: THREE.Vector3[]; }): void; export function constructSpherePoints({ splats, origin, radius, maxDepth, filter, pointRadius, pointThickness, color, }: { splats: PackedSplats; origin?: THREE.Vector3; radius?: number; maxDepth?: number; filter?: ((point: THREE.Vector3) => boolean) | null; pointRadius?: number; pointThickness?: number; color?: THREE.Color | ((color: THREE.Color, point: THREE.Vector3) => void); }): void; export function textSplats({ text, font, fontSize, color, rgb, dotRadius, textAlign, lineHeight, }: { text: string; font?: string; fontSize?: number; color?: THREE.Color; rgb?: THREE.Color; dotRadius?: number; textAlign?: "left" | "center" | "right" | "start" | "end"; lineHeight?: number; }): SplatMesh; export function imageSplats({ url, dotRadius, subXY, forEachSplat, }: { url: string; dotRadius?: number; subXY?: number; forEachSplat?: (width: number, height: number, index: number, center: THREE.Vector3, scales: THREE.Vector3, quaternion: THREE.Quaternion, opacity: number, color: THREE.Color) => number | null; }): SplatMesh; } declare module "vrButton" { import type * as THREE from "three"; export class VRButton { static createButton(renderer: THREE.WebGLRenderer, sessionInit?: XRSessionInit): HTMLElement | null; static registerSessionGrantedListener(): null | undefined; static xrSessionIsGranted: boolean; } } declare module "index" { export { ForgeRenderer, type ForgeRendererOptions } from "ForgeRenderer"; export { ForgeViewpoint, type ForgeViewpointOptions } from "ForgeViewpoint"; export * as dyno from "dyno"; export { SplatLoader, unpackSplats, SplatFileType, getSplatFileType, } from "SplatLoader"; export { PlyReader } from "ply"; export { SpzReader } from "spz"; export { PackedSplats, type PackedSplatsOptions } from "PackedSplats"; export { SplatGenerator, type GsplatGenerator, SplatModifier, type GsplatModifier, SplatTransformer, } from "SplatGenerator"; export { SplatAccumulator, type GeneratorMapping } from "SplatAccumulator"; export { Readback, type Rgba8Readback, type ReadbackBuffer } from "Readback"; export { SplatMesh, type SplatMeshOptions, type SplatMeshContext, } from "SplatMesh"; export { SplatSkinning, type SplatSkinningOptions } from "SplatSkinning"; export { SplatEdit, type SplatEditOptions, SplatEditSdf, type SplatEditSdfOptions, SplatEditSdfType, SplatEditRgbaBlendMode, SplatEdits, } from "SplatEdit"; export { constructGrid, constructAxes, constructSpherePoints, imageSplats, textSplats, } from "splatConstructors"; export * as generators from "generators"; export { VRButton } from "vrButton"; export { type JointId, JointEnum, JOINT_IDS, NUM_JOINTS, JOINT_INDEX, JOINT_RADIUS, JOINT_SEGMENTS, JOINT_SEGMENT_STEPS, JOINT_TIPS, FINGER_TIPS, Hand, HANDS, type Joint, type HandJoints, type HandsJoints, XrHands, HandMovement, } from "hands"; export { ForgeControls, FpsMovement, PointerControls } from "controls"; export { isMobile, isAndroid, isOculus, flipPixels, pixelsToPngUrl, toHalf, fromHalf, floatToUint8, floatToSint8, Uint8ToFloat, Sint8ToFloat, setPackedSplat, unpackSplat, } from "utils"; export * as utils from "utils"; } declare module "worker" { }