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