// generated by diplomat-tool import type { FieldProgram } from "./FieldProgram.mjs" import type { FieldProgramBinaryOp } from "./FieldProgramBinaryOp.mjs" import type { FieldProgramDistanceKind } from "./FieldProgramDistanceKind.mjs" import type { FieldProgramUnaryOp } from "./FieldProgramUnaryOp.mjs" import type { FieldProgramValueType } from "./FieldProgramValueType.mjs" import type { NucleationError } from "./NucleationError.mjs" import type { pointer, codepoint } from "./diplomat-runtime.d.ts"; /** * Programmatic builder for a {@link FieldProgram}: append typed stack * instructions, then {@link FieldProgramBuilder::build} to validate and * obtain a {@link FieldProgram}. Consuming: every method after `build()` * (successful or not) returns `AlreadyConsumed`. */ export class FieldProgramBuilder { /** @internal */ get ffiValue(): pointer; /** @internal */ constructor(); static create(): FieldProgramBuilder; /** * Declare a new typed local slot and return its index. */ addSlot(valueType: FieldProgramValueType): number; pushConstScalar(value: number): void; pushConstVec3(x: number, y: number, z: number): void; pushConstBool(value: boolean): void; /** * Push the `Vec3` position the program is being evaluated at. */ pushPos(): void; loadLocal(slot: number): void; storeLocal(slot: number): void; /** * Discard the top of the stack. */ pop(): void; unaryOp(op: FieldProgramUnaryOp): void; binaryOp(op: FieldProgramBinaryOp): void; /** * Pop `(x, lo, hi)`, push `x` clamped to `[lo, hi]`. */ clamp(): void; /** * Pop `(a, b, cond)`, push `a` if `cond` else `b`. */ select(): void; /** * Pop `(x, y, z)`, push `Vec3([x, y, z])`. */ makeVec3(): void; /** * Pop a `Bool`; if true, stop the nearest enclosing repeat after * this iteration. Only valid inside `beginRepeat`/`endRepeat`. */ breakIf(): void; /** * Open a new statically bounded repeat block; subsequent * instructions append to its body until `endRepeat`. */ beginRepeat(count: number): void; /** * Close the innermost open repeat block. */ endRepeat(): void; /** * Declare which scalar slot holds the program's output. */ setOutput(slot: number): void; /** * Set the program's explicit, author-asserted finite bounds. */ setBounds(minX: number, minY: number, minZ: number, maxX: number, maxY: number, maxZ: number): void; setDistanceKind(kind: FieldProgramDistanceKind): void; /** * Validate and finalize. Consumes the builder even on failure. */ build(): FieldProgram; }