import { ATypedArrayTuple, TTypedArrayTupleMutativeMethods } from "../a-typed-array-tuple.js"; import { TTypedArray } from "../t-typed-array.js"; import { ITypedArrayTupleFactory } from "../i-typed-array-tuple-factory.js"; import { getVec4Ctor } from "./get-vec4-ctor.js"; import { TTypedArrayCtor } from "../t-typed-array-ctor.js"; import { TPickExcept } from "../../../typescript/t-pick-except.js"; import { populateTypedArrayConstructorMap } from "../../../runtime/rtti-interop.js"; /** * @public */ export type TVec4CtorArgs = [x: number, y: number, z: number, w: number]; /** * @public * Constructor for {@link Vec4}. */ export interface IVec4Ctor { readonly BASE: TTypedArrayCtor; /** * The size in bytes of each element in the array. */ readonly BYTES_PER_ELEMENT: number; readonly prototype: Vec4; readonly factory: ITypedArrayTupleFactory, TVec4CtorArgs>; new(): Vec4; } /** * @public * {@link Vec4}. */ export interface IReadonlyVec4 extends TPickExcept>, | "update" | "setX" | "setY" | "setZ" | "setW" | "copyFromBuffer" | TTypedArrayTupleMutativeMethods> { } /** * @public * Vector 4. * * @remarks * See static properties for constructors. Instances are not an extension of this class, but of the static members. */ export abstract class Vec4 extends ATypedArrayTuple<4, TArray> { public static f64: IVec4Ctor = getVec4Ctor(Float64Array); public static f32: IVec4Ctor = getVec4Ctor(Float32Array); public static i64 = null; // not supported public static u64 = null; // not supported public static u32: IVec4Ctor = getVec4Ctor(Uint32Array); public static i32: IVec4Ctor = getVec4Ctor(Int32Array); public static u16: IVec4Ctor = getVec4Ctor(Uint16Array); public static i16: IVec4Ctor = getVec4Ctor(Int16Array); public static u8c: IVec4Ctor = getVec4Ctor(Uint8ClampedArray); public static u8: IVec4Ctor = getVec4Ctor(Uint8Array); public static i8: IVec4Ctor = getVec4Ctor(Int8Array); public static getCtor(ctor: TCtor): IVec4Ctor> { return Vec4.constructors.get(ctor) as IVec4Ctor>; } protected static constructors = populateTypedArrayConstructorMap(Vec4); public ["constructor"]!: IVec4Ctor; /** * x */ public 0!: number; /** * y */ public 1!: number; /** * z */ public 2!: number; /** * w */ public 3!: number; /** * Component-wise equals. */ public isEqualTo(_other: Vec4): boolean { throw new Error(); } /** * @param _packedRGBA - The number to be unpacked. * @param _normalize - If true, normalize components between 0 - 1. */ public setRGBAColor(_packedRGBA: number, _normalize?: boolean): Vec4 { throw new Error(); } /** * @param _normalized - Format of the color stored in the Vec4, if true 0 - 1, else 0 - 255. */ public getPackedRGBAColor(_normalized?: boolean): number { throw new Error(); } public getX(): number { throw new Error(); } public getY(): number { throw new Error(); } public getZ(): number { throw new Error(); } public getW(): number { throw new Error(); } public update(_x: number, _y: number, _z: number, _w: number): void { throw new Error(); } public setX(_x: number): void { throw new Error(); } public setY(_y: number): void { throw new Error(); } public setZ(_z: number): void { throw new Error(); } public setW(_w: number): void { throw new Error(); } public getLoggableValue(): number[][] { throw new Error(); } /** * If endianness is not supplied the platform's endianness will be used. */ public copyFromBuffer ( _memoryDataView: DataView, _pointer: number, _littleEndian?: boolean, ) : void { throw new Error(); } /** * If endianness is not supplied the platform's endianness will be used. */ public copyToBuffer ( _memoryDataView: DataView, _pointer: number, _littleEndian?: boolean, ) : void { throw new Error(); } /** * Although the typed array tuples extend a typed array, they are not structurally compatible. * This function returns the argument passed without modification but cast as the underlying storage type, e.g. Float32Array. */ public castToBaseType(): TArray { throw new Error(); } public TTypeGuardVec4!: true; } /** * @public * Float32 {@link Vec4}. */ export type TF32Vec4 = Vec4; /** * @public * Float64 {@link Vec4}. */ export type TF64Vec4 = Vec4;