import { AbstractEngine } from '@babylonjs/core'; declare class FloatArena { private ab; private f32; private dv; private dirty; private listeners; private canResize; constructor(initialFloats?: number, maxFloats?: number); private isResizableAB; onRealloc(cb: () => void): void; private rebroadcast; ensureCapacity(nextF: number): void; write(offF: number, src: ArrayLike, lenF?: any): void; view(offF: number, lenF: number): Float32Array; dataView(): DataView; take(): Float32Array; isDirty(): boolean; markClean(): void; markDirty(): void; adopt(next: Float32Array): void; } type PendingField = { name: string; type: any; }; type ShadoConfig = { name?: string; useWasm?: boolean; }; declare function gpuStruct(meta?: ShadoConfig): (...args: any[]) => void; declare function field(typeOrIndex: any, maybeType?: any): (...args: any[]) => void; declare function readClassMeta(ctor: any): ShadoConfig; declare function readFields(ctor: any): PendingField[]; declare class ShadoStructSchema { readonly name: string; readonly fields: ReadonlyArray; readonly headerFloatCount: number; readonly embeddedStructs: Record; readonly structArrays: Record; readonly varArrays: Record; constructor(name: string, laidOut: FieldDef[], headerFloatCount: number); emitHeaderStructWGSL(): string; emitOffsetsWGSL(): string; emitHeaderStruct(): string; emitOffsets(): string; emitGLSLStorage(group?: number, startBinding?: number): string; emitWGSLStorage(): string; debugShaderCode(engine: any): void; materialIOFor(engine: any): { uniforms: string[]; samplers: string[]; }; } type ASCExtension = { /** Extra AssemblyScript source to concat into the module (strings, not files). */ source?: (schema: ShadoStructSchema) => string | string[]; /** After instantiate: add custom ops under this class' ops tree. */ bind?: (schema: any, exports: any, ops: any) => void; }; declare abstract class Shado { #private; private static _instanceCounter; private _bindingAlloc; private _dynamicMeta?; private _manualSchemas; private _extraStorages; private _samplers; private _vsBody; private _fsBody; private _built; private _schemas; private _isDisposed; private _engineObs?; private _engineNewSceneObs?; private _sceneObs; _dirty(): this; setDynamicMeta(meta: DynamicMeta): this; setSchemas(schemas: SchemaSpec[]): this; addExtraStorage(s: StorageSpec): this; setSamplers(symbols: string[]): this; setBodies(vsBody: string, fsBody: string): this; readonly headerRaw: ArrayBuffer; private static _schema; static backingPreference?: BackendKind; protected readonly _view: DataView; private _visibleCount; getVisibleCount(): number; private _backing; private _includeName; private _instanceId; protected _arena: FloatArena; protected _headerSeg: Segment; private _liveVecs; protected _varSeg: Record; protected _structSeg: Record; protected _engine: any; protected _structArrayCount: Record; protected _structArraySlots: Record; protected _structArrayUnsubs: Record void>>; protected _structArrayIndex: Record>; private _dirtyHandlers?; private _structVersion; private _lastSyncedStructVersion; private _lastSyncedBuffer; wasmModule?: { instance: WebAssembly.Instance; memory: WebAssembly.Memory; alloc: (n: number) => number; exports: Record; ops: any; ready?: boolean; }; static wasmCompiled?: boolean; static compiledWasmModule?: WebAssembly.Module; private __wasmBasePtr; private __wasmArenaFloats; private _useWasm; protected static get shadoBase(): ShadoBaseCtor; protected constructor(engine: AbstractEngine, childInstance?: boolean); protected getBaseOffset(): number; getWasmMemory(): WebAssembly.Memory | undefined; getWasmArenaBasePtr(): number; getStructArrayPtr(field: string): number; getStructArrayCapacity(field: string): number; getStructArrayStrideBytes(field: string): number; markArenaDirty(): void; protected getFieldOffset(field: string): number; prepareUnifiedForUpload(): Float32Array; static initialize(this: ShadoConcreteCtor, engine: any, { logShaderCode, logAscCode, backend, debugWasm, additionalFields, wasm }?: InitializeConfig): Promise; /** * Build schema for this instance (called once per instance). * This replaces the static getSchema() pattern. */ static buildSchema(): ShadoStructSchema; static initWasm(this: ShadoConcreteCtor, debugWasm?: boolean, wasmConfig?: { mode: 'runtime'; } | { mode: 'precompiled'; module: WebAssembly.Module | ArrayBuffer | Uint8Array; }): Promise; initWasmArena(bytesHint?: number): void; onDirty(cb: DirtyHandler): () => void; emitHeaderDirty(byteOffset?: number, byteLength?: number): void; generateWGSL(): string; protected pickPrimaryChild(): { parent: ShadoStructSchema; child: any; childField: string; }; protected instanceHeaderNames(): { visibleIndex: string; instances: string; }; protected instanceFieldNames(): { visibleIndex: string; translation: string; color: string; animation: string; }; static shaderIO(engine: any): { uniforms: string[]; samplers: string[]; }; get arena(): FloatArena; getSchema(): ShadoStructSchema; /** * Static method to build a schema for a class (used for static utilities). */ static getSchema(this: ShadoBaseCtor, extraFields?: PendingField[]): ShadoStructSchema; static debugShaderCode(this: ShadoBaseCtor, engine: any): void; static debugAscCode(this: ShadoBaseCtor): void; /** * Static method kept for backward compatibility. * New code should use instance.registerIncludes() instead. */ static registerIncludes(this: ShadoBaseCtor): void; /** * Register shader includes for this specific instance. * This uses the unique instance include name. */ generateWGSLPair(): { vs: string; fs: string; }; generateGLSLPair(): { vs: string; fs: string; }; getShaderNames(rewrite?: boolean): { vertex: string; fragment: string; }; setVarArray(field: string, data: Float32Array | number[]): void; private _opsBoundOnce; private _bakeOpsOnce; get ops(): any; protected _makeThinChild(field: string, ChildCtor: new (...args: any[]) => T, index: number): T; private _refreshStructArrayChildBases; tickInstances(field: string, deltaTime: number): void; protected _prepareForWasm(): number; protected syncStructArrayHeaderFields(): void; /** Create, attach, and return a child struct instance in the given var-array. */ addStructToArray(field: string): T; reserveStructArray(field: string, count: number): void; getStructArrayCount(field: string): number; setStructArrayCount(field: string, count: number): void; clearStructArray(field: string): void; copyStructArrayElement(field: string, fromIndex: number, toIndex: number): void; removeStructFromArray(field: string, index: number, mode?: 'swap' | 'stable'): Shado | undefined; commitAndBind(effect: any): void; commit(): void; bind(effect: any): void; bindMaterial(material: any): void; dispose(): void; protected onRefreshViewsIfGrown?(buf: ArrayBuffer): void; protected _lastMemBuf: ArrayBuffer | null; protected _refreshViewsIfGrown(): void; private _ensureArenaLayout; private _repack; getVarArrayPtr(field: string): number; getVarArrayCount(field: string): number; getVarArrayStrideFloats(field: string): number; } type ScalarType = 'f32' | 'i32' | 'u32'; type VectorType = 'vec2' | 'vec3' | 'vec4'; type MatrixType = 'mat2' | 'mat3' | 'mat4'; interface VarArrayType { arrayOf: FieldType; } type FieldType = ScalarType | VectorType | MatrixType | VarArrayType | StructRef; type BackendKind = 'storage' | 'datatex'; type WasmInitializeMode = false | 'off' | 'runtime' | { mode: 'off' | 'runtime' | 'precompiled'; module?: WebAssembly.Module | ArrayBuffer | Uint8Array; }; type InitializeConfig = { logShaderCode?: boolean; logAscCode?: boolean; backend?: BackendKind; debugWasm?: boolean; wasm?: WasmInitializeMode; additionalFields?: PendingField[]; extra?: any; }; interface GPUBacking { kind: BackendKind; commit(): void; bind(effect: any, includeName: string): void; bindMaterial?(material: any, includeName: string): void; dispose(): void; } interface FieldDef { name: string; type: FieldType; headerFloatOffset?: number; headerFloatSize?: number; } type Segment = { offF: number; lenF: number; capF: number; }; type ScalarTy = 'i32' | 'u32' | 'f32'; type UboField = { name: string; ty: ScalarTy; comment?: string; }; type SchemaSpec = { name: string; storageName: string; uboFields: UboField[]; }; type DynamicMeta = { storageName: string; bases?: Record; strides?: Record; counts?: Record; extraI32?: string[]; }; type StorageSpec = { storageName: string; access?: 'read' | 'read_write'; }; type ShadoStatics = { schema?: ShadoStructSchema; backingPreference?: BackendKind; getSchema(additionalFields: PendingField[]): ShadoStructSchema; registerIncludes(): void; buildSchema(): ShadoStructSchema; debugShaderCode(engine: any): void; debugAscCode(): void; shaderIO(engine: any): { uniforms: string[]; samplers: string[]; }; wasmCompiled?: boolean; compiledWasmModule?: WebAssembly.Module; ascExtension?: ASCExtension; }; type ShadoBaseCtor = ShadoStatics & { new?: any; }; declare const LAZY_CTOR: unique symbol; type LazyCtor = (() => T) & { [LAZY_CTOR]: true; }; type StructRef = { structOf: any; } | { structOf: LazyCtor; }; type ShadoConcreteCtor = (new (engine: any, ...args: any[]) => T) & ShadoStatics; interface StructArrayType { arrayOf: { structOf: ShadoConcreteCtor; }; } type ShadoAbstractCtor = ShadoBaseCtor & (abstract new (engine: any) => T); type DirtyEvent = { kind: 'header'; byteOffset?: number; byteLength?: number; } | { kind: 'var'; field: string; byteOffset?: number; byteLength?: number; } | { kind: 'struct-array'; field: string; index?: number; byteOffset?: number; byteLength?: number; }; type DirtyHandler = (ev: DirtyEvent) => void; export { type ASCExtension as A, type BackendKind as B, type DynamicMeta as D, type FieldType as F, type GPUBacking as G, type InitializeConfig as I, type LazyCtor as L, type MatrixType as M, type PendingField as P, type ShadoConfig as S, type UboField as U, type VarArrayType as V, type WasmInitializeMode as W, ShadoStructSchema as a, Shado as b, type ScalarType as c, type VectorType as d, type StructRef as e, type FieldDef as f, type Segment as g, type ScalarTy as h, type SchemaSpec as i, type StorageSpec as j, type ShadoStatics as k, type ShadoBaseCtor as l, LAZY_CTOR as m, type ShadoConcreteCtor as n, type StructArrayType as o, type ShadoAbstractCtor as p, type DirtyEvent as q, type DirtyHandler as r, gpuStruct as s, field as t, readClassMeta as u, readFields as v, FloatArena as w };