1 | import type { Maybe } from "./null.js";
|
2 | export type ArrayLikeIterable<T> = ArrayLike<T> & Iterable<T>;
|
3 | export type NumericArray = number[] | TypedArray;
|
4 | export type TypedArray = Float32Array | Float64Array | Int8Array | Int16Array | Int32Array | Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array;
|
5 | export type BigTypedArray = BigInt64Array | BigUint64Array;
|
6 | export type FloatArray = Float32Array | Float64Array;
|
7 | export type IntArray = Int8Array | Int16Array | Int32Array;
|
8 | export type UIntArray = Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array;
|
9 | export type FloatArrayConstructor = Float32ArrayConstructor | Float64ArrayConstructor;
|
10 | export type IntArrayConstructor = Int8ArrayConstructor | Int16ArrayConstructor | Int32ArrayConstructor;
|
11 | export type UIntArrayConstructor = Uint8ArrayConstructor | Uint8ClampedArrayConstructor | Uint16ArrayConstructor | Uint32ArrayConstructor;
|
12 | export type BigIntArrayConstructor = BigInt64ArrayConstructor | BigUint64ArrayConstructor;
|
13 | export type TypedArrayConstructor = FloatArrayConstructor | IntArrayConstructor | UIntArrayConstructor;
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 | export type Type = "u8" | "u8c" | "i8" | "u16" | "i16" | "u32" | "i32" | "f32" | "f64";
|
21 | export type BigType = "i64" | "u64";
|
22 | export type UintType = "u8" | "u8c" | "u16" | "u32";
|
23 | export type IntType = "i8" | "i16" | "i32";
|
24 | export type FloatType = "f32" | "f64";
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 | export declare enum GLType {
|
33 | I8 = 5120,
|
34 | U8 = 5121,
|
35 | I16 = 5122,
|
36 | U16 = 5123,
|
37 | I32 = 5124,
|
38 | U32 = 5125,
|
39 | F32 = 5126
|
40 | }
|
41 |
|
42 |
|
43 |
|
44 | export declare const GL2TYPE: Record<GLType, Type>;
|
45 |
|
46 |
|
47 |
|
48 |
|
49 |
|
50 |
|
51 |
|
52 |
|
53 | export declare const TYPE2GL: Record<Type, Maybe<GLType>>;
|
54 |
|
55 |
|
56 |
|
57 |
|
58 | export declare const SIZEOF: {
|
59 | u8: number;
|
60 | u8c: number;
|
61 | i8: number;
|
62 | u16: number;
|
63 | i16: number;
|
64 | u32: number;
|
65 | i32: number;
|
66 | i64: number;
|
67 | u64: number;
|
68 | f32: number;
|
69 | f64: number;
|
70 | };
|
71 |
|
72 |
|
73 |
|
74 |
|
75 | export declare const BIT_SHIFTS: {
|
76 | i8: number;
|
77 | u8: number;
|
78 | u8c: number;
|
79 | i16: number;
|
80 | u16: number;
|
81 | i32: number;
|
82 | u32: number;
|
83 | i64: number;
|
84 | u64: number;
|
85 | f32: number;
|
86 | f64: number;
|
87 | };
|
88 | export declare const FLOAT_ARRAY_CTORS: Record<FloatType, FloatArrayConstructor>;
|
89 | export declare const INT_ARRAY_CTORS: Record<IntType, IntArrayConstructor>;
|
90 | export declare const UINT_ARRAY_CTORS: Record<UintType, UIntArrayConstructor>;
|
91 | export declare const BIGINT_ARRAY_CTORS: Record<BigType, BigIntArrayConstructor>;
|
92 | export declare const TYPEDARRAY_CTORS: Record<Type, TypedArrayConstructor>;
|
93 | export interface TypedArrayTypeMap extends Record<Type | GLType, TypedArray> {
|
94 | u8: Uint8Array;
|
95 | u8c: Uint8ClampedArray;
|
96 | i8: Int8Array;
|
97 | u16: Uint16Array;
|
98 | i16: Int16Array;
|
99 | u32: Uint32Array;
|
100 | i32: Int32Array;
|
101 | f32: Float32Array;
|
102 | f64: Float64Array;
|
103 | [GLType.U8]: Uint8Array;
|
104 | [GLType.I8]: Int8Array;
|
105 | [GLType.U16]: Uint16Array;
|
106 | [GLType.I16]: Int16Array;
|
107 | [GLType.U32]: Uint32Array;
|
108 | [GLType.I32]: Int32Array;
|
109 | [GLType.F32]: Float32Array;
|
110 | }
|
111 | export interface BigTypedArrayTypeMap extends Record<BigType, BigTypedArray> {
|
112 | i64: BigInt64Array;
|
113 | u64: BigUint64Array;
|
114 | }
|
115 |
|
116 |
|
117 |
|
118 |
|
119 |
|
120 |
|
121 |
|
122 |
|
123 |
|
124 |
|
125 |
|
126 |
|
127 |
|
128 |
|
129 |
|
130 |
|
131 |
|
132 |
|
133 |
|
134 |
|
135 |
|
136 | export declare const asNativeType: (type: GLType | Type) => Type;
|
137 |
|
138 |
|
139 |
|
140 |
|
141 |
|
142 |
|
143 |
|
144 |
|
145 |
|
146 |
|
147 |
|
148 |
|
149 |
|
150 |
|
151 |
|
152 |
|
153 |
|
154 |
|
155 |
|
156 |
|
157 | export declare const asGLType: (type: GLType | Type) => GLType;
|
158 |
|
159 |
|
160 |
|
161 | export declare const asInt: (...args: number[]) => number[];
|
162 |
|
163 |
|
164 |
|
165 |
|
166 |
|
167 | export declare const sizeOf: (type: Type | BigType | GLType) => number;
|
168 |
|
169 |
|
170 |
|
171 |
|
172 |
|
173 |
|
174 | export declare function typedArray<T extends Type | GLType>(type: T, length: number): TypedArrayTypeMap[T];
|
175 | export declare function typedArray<T extends Type | GLType>(type: T, src: ArrayLike<number> | ArrayBufferLike): TypedArrayTypeMap[T];
|
176 | export declare function typedArray<T extends Type | GLType>(type: T, buf: ArrayBufferLike, byteOffset: number, length?: number): TypedArrayTypeMap[T];
|
177 | export declare function typedArray<T extends BigType>(type: T, length: number): BigTypedArrayTypeMap[T];
|
178 | export declare function typedArray<T extends BigType>(type: T, src: ArrayLike<bigint> | ArrayBufferLike): BigTypedArrayTypeMap[T];
|
179 | export declare function typedArray<T extends BigType>(type: T, buf: ArrayBufferLike, byteOffset: number, length?: number): BigTypedArrayTypeMap[T];
|
180 |
|
181 |
|
182 |
|
183 |
|
184 |
|
185 |
|
186 |
|
187 |
|
188 |
|
189 |
|
190 |
|
191 |
|
192 |
|
193 |
|
194 |
|
195 |
|
196 |
|
197 |
|
198 |
|
199 |
|
200 |
|
201 |
|
202 |
|
203 |
|
204 |
|
205 |
|
206 |
|
207 |
|
208 |
|
209 |
|
210 | export declare function typedArrayOfVec<T extends Type | GLType>(type: T, data: Iterable<ArrayLike<number>>, stride?: number): TypedArrayTypeMap[T];
|
211 | export declare function typedArrayOfVec<T extends BigType>(type: T, data: Iterable<ArrayLike<bigint>>, stride?: number): BigTypedArrayTypeMap[T];
|
212 |
|
213 |
|
214 |
|
215 |
|
216 |
|
217 |
|
218 | export declare const typedArrayType: (x: NumericArray) => Type;
|
219 |
|
220 |
|
221 |
|
222 |
|
223 |
|
224 |
|
225 | export declare const uintTypeForSize: (x: number) => UintType;
|
226 |
|
227 |
|
228 |
|
229 |
|
230 |
|
231 |
|
232 | export declare const intTypeForSize: (x: number) => IntType;
|
233 |
|
234 |
|
235 |
|
236 |
|
237 |
|
238 | export declare const uintTypeForBits: (x: number) => UintType;
|
239 |
|
240 |
|
241 |
|
242 |
|
243 |
|
244 | export declare const intTypeForBits: (x: number) => IntType;
|
245 |
|
246 |
|
247 |
|
248 |
|
249 |
|
250 |
|
251 | export declare const narrowInt: (t: IntType | "i64") => "i8" | "i16" | "i32";
|
252 |
|
253 |
|
254 |
|
255 |
|
256 |
|
257 |
|
258 | export declare const widenInt: (t: IntType) => "i16" | "i32" | "i64";
|
259 |
|
260 |
|
261 |
|
262 |
|
263 |
|
264 |
|
265 |
|
266 |
|
267 |
|
268 | export declare const narrowUint: (t: UintType | "u64") => "u8" | "u16" | "u32";
|
269 |
|
270 |
|
271 |
|
272 |
|
273 |
|
274 |
|
275 | export declare const widenUint: (t: UintType) => "u16" | "u32" | "u64";
|
276 |
|
277 |
|
278 |
|
279 |
|
280 |
|
281 |
|
282 | export declare const narrowFloat: (t: FloatType) => string;
|
283 |
|
284 |
|
285 |
|
286 |
|
287 |
|
288 |
|
289 | export declare const widenFloat: (t: FloatType) => string;
|
290 |
|
291 |
|
292 |
|
293 |
|
294 |
|
295 |
|
296 | export declare const narrowType: (t: Type | BigType) => string;
|
297 |
|
298 |
|
299 |
|
300 |
|
301 |
|
302 |
|
303 | export declare const widenType: (t: Type | BigType) => string;
|
304 |
|
\ | No newline at end of file |