import type { IObjectOf } from "@thi.ng/api" ; import type { Sym , Term } from "@thi.ng/shader-ast" ; import { add , mul } from "@thi.ng/shader-ast/ast/ops" ; import type { ShaderPresetOpts } from "./api/shader.js" ; export const positionAttrib = ( opts , attribs , pos = "position" ) => opts . instancePos ? add ( attribs [ pos ] , attribs [ opts . instancePos ] ) : attribs [ pos ] ; export const colorAttrib = ( opts , attribs , fallback ) : Term < "vec3" > => opts . instanceColor ? mul ( attribs [ opts . instanceColor ] , fallback ) : opts . color ? mul ( attribs [ opts . color ] , fallback ) : fallback ;