import type { IObjectOf } from "@thi.ng/api" ; import { isNumber } from "@thi.ng/checks/is-number" ; import { IDENT44 } from "@thi.ng/matrices/constants" ; import { mulM44 } from "@thi.ng/matrices/mulm" ; import { normal44 } from "@thi.ng/matrices/normal-mat" ; import { ortho } from "@thi.ng/matrices/ortho" ; import type { ReadonlyVec } from "@thi.ng/vectors" ; import type { GLMat4 } from "./api/glsl.js" ; import type { ShaderUniforms } from "./api/shader.js" ; const $ = ( a , b , id ) => a [ id ] || b [ id ] . defaultVal || IDENT44 ; param model export const autoNormalMatrix1 = ( model = "model" ) => ( shaderU , specU ) => < GLMat4 > normal44 ( [ ] , $ ( specU , shaderU , model ) ) ; param model param view export const autoNormalMatrix2 = ( model = "model" , view = "view" ) => ( shaderU , specU ) => < GLMat4 > ( normal44 ( null , mulM44 ( [ ] , $ ( specU , shaderU , view ) , $ ( specU , shaderU , model ) ) ) ) ; param width param height export function screen2d ( width , height ) ; export function screen2d ( gl ) ; export function screen2d ( a , b ? ) { return isNumber ( a ) ? ortho ( [ ] , 0 , a , b ! , 0 , - 1 , 1 ) : ortho ( [ ] , 0 , a . drawingBufferWidth , a . drawingBufferHeight , 0 , - 1 , 1 ) ; }