import { mat2 , mat3 , mat4 , vec2 , vec3 , vec4 } from 'gl-matrix' ; /** Namespace that comprises various gl-matrix extensions (also cleans up documentation). */ namespace gl_matrix_extensions { param x returns export function sign ( x ) { return x > 0.0 ? 1.0 : x < 0.0 ? - 1.0 : 0.0 ; } param x param min param max returns export function clamp ( x , min , max ) { return Math . max ( min , Math . min ( max , x ) ) ; } param x returns export function fract ( x ) { return x > 0 ? x - Math . floor ( x ) : x - Math . ceil ( x ) ; } /**
     * A vec2 placeholder to overcome the gl-matrix out interface.
     */ export function v2 ( ) { return vec2 . create ( ) ; } param out param x param min param max returns export function clamp2 ( out , x , min , max ) { out [ 0 ] = Math . max ( min [ 0 ] , Math . min ( max [ 0 ] , x [ 0 ] ) ) ; out [ 1 ] = Math . max ( min [ 1 ] , Math . min ( max [ 1 ] , x [ 1 ] ) ) ; return out ; } param out param x returns export function abs2 ( out , x ) { out [ 0 ] = Math . abs ( x [ 0 ] ) ; out [ 1 ] = Math . abs ( x [ 1 ] ) ; return out ; } /**
     * A vec3 placeholder to overcome the gl-matrix out interface.
     */ export function v3 ( ) { return vec3 . create ( ) ; } param out param x param min param max returns export function clamp3 ( out , x , min , max ) { out [ 0 ] = Math . max ( min [ 0 ] , Math . min ( max [ 0 ] , x [ 0 ] ) ) ; out [ 1 ] = Math . max ( min [ 1 ] , Math . min ( max [ 1 ] , x [ 1 ] ) ) ; out [ 2 ] = Math . max ( min [ 2 ] , Math . min ( max [ 2 ] , x [ 2 ] ) ) ; return out ; } param out param x returns export function abs3 ( out , x ) { out [ 0 ] = Math . abs ( x [ 0 ] ) ; out [ 1 ] = Math . abs ( x [ 1 ] ) ; out [ 2 ] = Math . abs ( x [ 2 ] ) ; return out ; } const one256ths = 1.0 / 256.0 ; param out param x returns export function encode_float24x1_to_uint8x3 ( out , x ) { out [ 0 ] = Math . floor ( x * 256.0 ) ; out [ 1 ] = Math . floor ( fract ( x * 256.0 ) * 256.0 ) ; out [ 2 ] = Math . floor ( fract ( x * 65536.0 ) * 256.0 ) ; return out ; } param x returns export function decode_float24x1_from_uint8x3 ( x ) { return ( x [ 0 ] + ( x [ 1 ] + x [ 2 ] * one256ths ) * one256ths ) * one256ths ; } param out param x returns export function encode_uint24_to_rgb8 ( out , x ) { out [ 0 ] = ( x >>> 0 ) & 0xFF ; out [ 1 ] = ( x >>> 8 ) & 0xFF ; out [ 2 ] = ( x >>> 16 ) & 0xFF ; return out ; } param out param x returns export function encode_uint32_to_rgba8 ( out , x ) { out [ 0 ] = ( x >>> 0 ) & 0xFF ; out [ 1 ] = ( x >>> 8 ) & 0xFF ; out [ 2 ] = ( x >>> 16 ) & 0xFF ; out [ 3 ] = ( x >>> 24 ) & 0xFF ; return out ; } param x returns export function decode_uint24_from_rgb8 ( x ) { return x [ 0 ] + ( x [ 1 ] << 8 ) + ( x [ 2 ] << 16 ) ; } param x returns export function decode_uint32_from_rgba8 ( x ) { return x [ 0 ] + ( x [ 1 ] << 8 ) + ( x [ 2 ] << 16 ) + ( x [ 3 ] << 24 ) >>> 0 ; } param x returns export function fromVec4 ( x ) { if ( x [ 3 ] === 0 ) { return vec3 . fromValues ( x [ 0 ] , x [ 1 ] , x [ 2 ] ) ; } return vec3 . fromValues ( x [ 0 ] / x [ 3 ] , x [ 1 ] / x [ 3 ] , x [ 2 ] / x [ 3 ] ) ; } /**
     * A vec4 placeholder to overcome the gl-matrix out interface.
     */ export function v4 ( ) { return vec4 . create ( ) ; } param out param x param min param max returns export function clamp4 ( out , x , min , max ) { out [ 0 ] = Math . max ( min [ 0 ] , Math . min ( max [ 0 ] , x [ 0 ] ) ) ; out [ 1 ] = Math . max ( min [ 1 ] , Math . min ( max [ 1 ] , x [ 1 ] ) ) ; out [ 2 ] = Math . max ( min [ 2 ] , Math . min ( max [ 2 ] , x [ 2 ] ) ) ; out [ 3 ] = Math . max ( min [ 3 ] , Math . min ( max [ 3 ] , x [ 3 ] ) ) ; return out ; } param out param x returns export function abs4 ( out , x ) { out [ 0 ] = Math . abs ( x [ 0 ] ) ; out [ 1 ] = Math . abs ( x [ 1 ] ) ; out [ 2 ] = Math . abs ( x [ 2 ] ) ; out [ 3 ] = Math . abs ( x [ 3 ] ) ; return out ; } param x returns export function fromVec3 ( x ) { return vec4 . fromValues ( x [ 0 ] , x [ 1 ] , x [ 2 ] , 1.0 ) ; } param v2str returns export function parseVec2 ( v2str ) { if ( v2str === undefined || v2str === '' ) { return undefined ; } let numbers = [ ] ; try { numbers = JSON . parse ( `[${ v2str }]` ) ; } catch ( error ) { return undefined ; } return numbers . length !== 2 || isNaN ( numbers [ 0 ] ) || isNaN ( numbers [ 1 ] ) ? undefined : vec2 . clone ( numbers ) ; } param v3str returns export function parseVec3 ( v3str ) { if ( v3str === undefined || v3str === '' ) { return undefined ; } let numbers = [ ] ; try { numbers = JSON . parse ( `[${ v3str }]` ) ; } catch ( error ) { return undefined ; } return numbers . length !== 3 || isNaN ( numbers [ 0 ] ) || isNaN ( numbers [ 1 ] ) || isNaN ( numbers [ 2 ] ) ? undefined : vec3 . clone ( numbers ) ; } param v4str returns export function parseVec4 ( v4str ) { if ( v4str === undefined || v4str === '' ) { return undefined ; } let numbers = [ ] ; try { numbers = JSON . parse ( `[${ v4str }]` ) ; } catch ( error ) { return undefined ; } return numbers . length !== 4 || isNaN ( numbers [ 0 ] ) || isNaN ( numbers [ 1 ] ) || isNaN ( numbers [ 2 ] ) || isNaN ( numbers [ 3 ] ) ? undefined : vec4 . clone ( numbers ) ; } param value1 param value2 param interpolation returns export function mix ( value1 , value2 , interpolation ) { return value1 * ( 1.0 - interpolation ) + value2 * interpolation ; } /**
     * A mat2 placeholder to overcome the gl-matrix out interface.
     */ export function m2 ( ) { return mat2 . create ( ) ; } /**
     * A mat3 placeholder to overcome the gl-matrix out interface.
     */ export function m3 ( ) { return mat3 . create ( ) ; } /**
     * A mat4 placeholder to overcome the gl-matrix out interface.
     */ export function m4 ( ) { return mat4 . create ( ) ; } } export = gl_matrix_extensions ;