rc-js-util
Version:
A collection of TS and C++ utilities to help writing performant and correct applications, achieved through strict typing and (removable) invariant checking.
115 lines • 3.79 kB
TypeScript
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 { TTypedArrayCtor } from "../t-typed-array-ctor.js";
import { TPickExcept } from "../../../typescript/t-pick-except.js";
/**
* @public
*/
export type TVec4CtorArgs = [x: number, y: number, z: number, w: number];
/**
* @public
* Constructor for {@link Vec4}.
*/
export interface IVec4Ctor<TArray extends TTypedArray> {
/**
* The size in bytes of each element in the array.
*/
readonly BYTES_PER_ELEMENT: number;
readonly prototype: Vec4<TArray>;
readonly factory: ITypedArrayTupleFactory<Vec4<TArray>, TVec4CtorArgs>;
new (): Vec4<TArray>;
}
/**
* @public
* {@link Vec4}.
*/
export interface IReadonlyVec4<TArray extends TTypedArray> extends TPickExcept<Readonly<Vec4<TArray>>, "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 declare abstract class Vec4<TArray extends TTypedArray> extends ATypedArrayTuple<4, TArray> {
static f64: IVec4Ctor<Float64Array>;
static f32: IVec4Ctor<Float32Array>;
static i64: null;
static u64: null;
static u32: IVec4Ctor<Uint32Array>;
static i32: IVec4Ctor<Int32Array>;
static u16: IVec4Ctor<Uint16Array>;
static i16: IVec4Ctor<Int16Array>;
static u8c: IVec4Ctor<Uint8ClampedArray>;
static u8: IVec4Ctor<Uint8Array>;
static i8: IVec4Ctor<Int8Array>;
static getCtor<TCtor extends TTypedArrayCtor>(ctor: TCtor): IVec4Ctor<InstanceType<TCtor>>;
protected static constructors: Map<import("../t-typed-array-ctor.js").TFullSetTypedArrayCtor, Function>;
["constructor"]: IVec4Ctor<TArray>;
/**
* x
*/
0: number;
/**
* y
*/
1: number;
/**
* z
*/
2: number;
/**
* w
*/
3: number;
/**
* Component-wise equals.
*/
isEqualTo(_other: Vec4<TTypedArray>): boolean;
/**
* @param _packedRGBA - The number to be unpacked.
* @param _normalize - If true, normalize components between 0 - 1.
*/
setRGBAColor(_packedRGBA: number, _normalize?: boolean): Vec4<TArray>;
/**
* @param _normalized - Format of the color stored in the Vec4, if true 0 - 1, else 0 - 255.
*/
getPackedRGBAColor(_normalized?: boolean): number;
getX(): number;
getY(): number;
getZ(): number;
getW(): number;
update(_x: number, _y: number, _z: number, _w: number): void;
setX(_x: number): void;
setY(_y: number): void;
setZ(_z: number): void;
setW(_w: number): void;
getLoggableValue(): number[][];
/**
* If endianness is not supplied the platform's endianness will be used.
*/
copyFromBuffer(_memoryDataView: DataView, _pointer: number, _littleEndian?: boolean): void;
/**
* If endianness is not supplied the platform's endianness will be used.
*/
copyToBuffer(_memoryDataView: DataView, _pointer: number, _littleEndian?: boolean): void;
/**
* 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.
*/
castToBaseType(): TArray;
TTypeGuardVec4: true;
}
/**
* @public
* Float32 {@link Vec4}.
*/
export type TF32Vec4 = Vec4<Float32Array>;
/**
* @public
* Float64 {@link Vec4}.
*/
export type TF64Vec4 = Vec4<Float64Array>;
//# sourceMappingURL=vec4.d.ts.map