import {Vec4} from "./math.js"; export function vec4_set(out: Vec4, x: number, y: number, z: number, w: number) { out[0] = x; out[1] = y; out[2] = z; out[3] = w; return out; } export function vec4_copy(out: Vec4, a: Vec4) { out[0] = a[0]; out[1] = a[1]; out[2] = a[2]; out[3] = a[3]; return out; } export function vec4_add(out: Vec4, a: Vec4, b: Vec4) { out[0] = a[0] + b[0]; out[1] = a[1] + b[1]; out[2] = a[2] + b[2]; out[3] = a[3] + b[3]; return out; } export function vec4_subtract(out: Vec4, a: Vec4, b: Vec4) { out[0] = a[0] - b[0]; out[1] = a[1] - b[1]; out[2] = a[2] - b[2]; out[3] = a[3] - b[3]; return out; } export function vec4_scale(out: Vec4, a: Vec4, b: number) { out[0] = a[0] * b; out[1] = a[1] * b; out[2] = a[2] * b; out[3] = a[3] * b; return out; } export function vec4_lerp(out: Vec4, a: Vec4, b: Vec4, t: number) { let ax = a[0]; let ay = a[1]; let az = a[2]; let aw = a[3]; out[0] = ax + t * (b[0] - ax); out[1] = ay + t * (b[1] - ay); out[2] = az + t * (b[2] - az); out[3] = aw + t * (b[3] - aw); return out; }