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.
169 lines • 4.36 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 { IReadonlyVec4, Vec4 } from "../vec4/vec4.js";
import { TPickExcept } from "../../../typescript/t-pick-except.js";
/**
* @public
*/
export type TMat4CtorArgs = [
c1r1: number,
c2r1: number,
c3r1: number,
c4r1: number,
c1r2: number,
c2r2: number,
c3r2: number,
c4r2: number,
c1r3: number,
c2r3: number,
c3r3: number,
c4r3: number,
c1r4: number,
c2r4: number,
c3r4: number,
c4r4: number
];
/**
* @public
* Constructor for {@link Mat4}.
*/
export interface IMat4Ctor<TArray extends TTypedArray> {
readonly BASE: TTypedArrayCtor;
/**
* The size in bytes of each element in the array.
*/
readonly BYTES_PER_ELEMENT: number;
readonly prototype: Mat4<TArray>;
readonly factory: ITypedArrayTupleFactory<Mat4<TArray>, TMat4CtorArgs>;
new (): Mat4<TArray>;
}
/**
* @public
* {@link Mat4}.
*/
export interface IReadonlyMat4<TArray extends TTypedArray> extends TPickExcept<Readonly<Mat4<TArray>>, "setValueAt" | "setRow" | "copyFromBuffer" | TTypedArrayTupleMutativeMethods> {
}
/**
* @public
* Row major 4x4 matrix.
*
* @remarks
* See static properties for constructors. Instances are not an extension of this class, but of the static members.
*/
export declare abstract class Mat4<TArray extends TTypedArray> extends ATypedArrayTuple<16, TArray> {
static f64: IMat4Ctor<Float64Array>;
static f32: IMat4Ctor<Float32Array>;
static i64: null;
static u64: null;
static u32: IMat4Ctor<Uint32Array>;
static i32: IMat4Ctor<Int32Array>;
static u16: IMat4Ctor<Uint16Array>;
static i16: IMat4Ctor<Int16Array>;
static u8c: IMat4Ctor<Uint8ClampedArray>;
static u8: IMat4Ctor<Uint8Array>;
static i8: IMat4Ctor<Int8Array>;
static getCtor<TCtor extends TTypedArrayCtor>(ctor: TCtor): IMat4Ctor<InstanceType<TCtor>>;
protected static constructors: Map<import("../t-typed-array-ctor.js").TFullSetTypedArrayCtor, Function>;
["constructor"]: IMat4Ctor<TArray>;
/**
* c1r1
*/
0: number;
/**
* c2r1
*/
1: number;
/**
* c3r1
*/
2: number;
/**
* c4r1
*/
3: number;
/**
* c1r2
*/
4: number;
/**
* c2r2
*/
5: number;
/**
* c3r2
*/
6: number;
/**
* c4r2
*/
7: number;
/**
* c1r3
*/
8: number;
/**
* c2r3
*/
9: number;
/**
* c3r3
*/
10: number;
/**
* c4r3
*/
11: number;
/**
* c1r4
*/
12: number;
/**
* c2r4
*/
13: number;
/**
* c3r4
*/
14: number;
/**
* c4r4
*/
15: number;
/**
* Component-wise equals.
*/
isEqualTo(_other: Mat4<TTypedArray>): boolean;
setIdentityMatrix(): Mat4<TArray>;
getValueAt(_column: number, _row: number): number;
setValueAt(_column: number, _row: number, _value: number): void;
getRow<TResult extends TTypedArray = TArray>(_row: number, _writeTo?: Vec4<TResult>): Vec4<TResult>;
setRow(_row: number, _writeFrom: IReadonlyVec4<TTypedArray>): 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;
protected TTypeGuardMat4: true;
}
/**
* @public
* Float32 {@link Mat4}.
*/
export type TF32Mat4 = Mat4<Float32Array>;
/**
* @public
* Float64 {@link Mat4}.
*/
export type TF64Mat4 = Mat4<Float64Array>;
//# sourceMappingURL=mat4.d.ts.map