@thi.ng/wasm-api-webgl 0.1.14 → 0.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -1
- package/README.md +1 -1
- package/generated/api.d.ts +15 -15
- package/generated/api.js +251 -472
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2024-
|
|
3
|
+
- **Last updated**: 2024-11-10T17:11:51Z
|
|
4
4
|
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
|
|
5
5
|
|
|
6
6
|
All notable changes to this project will be documented in this file.
|
|
@@ -9,6 +9,19 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
|
|
|
9
9
|
**Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
|
|
10
10
|
and/or version bumps of transitive dependencies.
|
|
11
11
|
|
|
12
|
+
### [0.1.16](https://github.com/thi-ng/umbrella/tree/@thi.ng/wasm-api-webgl@0.1.16) (2024-11-10)
|
|
13
|
+
|
|
14
|
+
#### ♻️ Refactoring
|
|
15
|
+
|
|
16
|
+
- regenerate typescript bindings ([07e939a](https://github.com/thi-ng/umbrella/commit/07e939a))
|
|
17
|
+
- regenerate TS bindings ([c540cb4](https://github.com/thi-ng/umbrella/commit/c540cb4))
|
|
18
|
+
|
|
19
|
+
### [0.1.15](https://github.com/thi-ng/umbrella/tree/@thi.ng/wasm-api-webgl@0.1.15) (2024-11-09)
|
|
20
|
+
|
|
21
|
+
#### ♻️ Refactoring
|
|
22
|
+
|
|
23
|
+
- regenerate typescript sources ([9055e0e](https://github.com/thi-ng/umbrella/commit/9055e0e))
|
|
24
|
+
|
|
12
25
|
## [0.1.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/wasm-api-webgl@0.1.0) (2024-08-18)
|
|
13
26
|
|
|
14
27
|
#### 🚀 Features
|
package/README.md
CHANGED
package/generated/api.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Generated by @thi.ng/wasm-api-bindgen at 2024-
|
|
2
|
+
* Generated by @thi.ng/wasm-api-bindgen at 2024-11-10T16:53:44.121Z
|
|
3
3
|
* DO NOT EDIT!
|
|
4
4
|
*/
|
|
5
|
-
import { WasmStringPtr, type WasmTypeBase
|
|
5
|
+
import { WasmStringPtr, type WasmTypeBase } from "@thi.ng/wasm-api";
|
|
6
6
|
import type { GLType as ModelAttribType } from "@thi.ng/api";
|
|
7
7
|
import type { DrawMode, TextureFilter, TextureFormat, TextureRepeat, TextureTarget, TextureType } from "@thi.ng/webgl";
|
|
8
8
|
/**
|
|
@@ -43,7 +43,7 @@ export interface WebGLContextOpts extends WasmTypeBase {
|
|
|
43
43
|
*/
|
|
44
44
|
readonly stencil: number;
|
|
45
45
|
}
|
|
46
|
-
export declare const $WebGLContextOpts: WasmTypeConstructor<WebGLContextOpts>;
|
|
46
|
+
export declare const $WebGLContextOpts: import("@thi.ng/wasm-api").WasmTypeConstructor<WebGLContextOpts>;
|
|
47
47
|
export declare enum WebGLPowerPreference {
|
|
48
48
|
default = 0,
|
|
49
49
|
high_performance = 1,
|
|
@@ -65,23 +65,23 @@ export interface ShaderSpec extends WasmTypeBase {
|
|
|
65
65
|
*/
|
|
66
66
|
readonly uniforms: ShaderUniformSpec[];
|
|
67
67
|
}
|
|
68
|
-
export declare const $ShaderSpec: WasmTypeConstructor<ShaderSpec>;
|
|
68
|
+
export declare const $ShaderSpec: import("@thi.ng/wasm-api").WasmTypeConstructor<ShaderSpec>;
|
|
69
69
|
export interface ShaderAttribSpec extends WasmTypeBase {
|
|
70
70
|
readonly name: WasmStringPtr;
|
|
71
71
|
readonly type: ShaderAttribType;
|
|
72
72
|
}
|
|
73
|
-
export declare const $ShaderAttribSpec: WasmTypeConstructor<ShaderAttribSpec>;
|
|
73
|
+
export declare const $ShaderAttribSpec: import("@thi.ng/wasm-api").WasmTypeConstructor<ShaderAttribSpec>;
|
|
74
74
|
export interface ShaderVaryingSpec extends WasmTypeBase {
|
|
75
75
|
readonly name: WasmStringPtr;
|
|
76
76
|
readonly type: ShaderAttribType;
|
|
77
77
|
}
|
|
78
|
-
export declare const $ShaderVaryingSpec: WasmTypeConstructor<ShaderVaryingSpec>;
|
|
78
|
+
export declare const $ShaderVaryingSpec: import("@thi.ng/wasm-api").WasmTypeConstructor<ShaderVaryingSpec>;
|
|
79
79
|
export interface ShaderUniformSpec extends WasmTypeBase {
|
|
80
80
|
readonly name: WasmStringPtr;
|
|
81
81
|
readonly type: UniformType;
|
|
82
82
|
readonly default: UniformValue;
|
|
83
83
|
}
|
|
84
|
-
export declare const $ShaderUniformSpec: WasmTypeConstructor<ShaderUniformSpec>;
|
|
84
|
+
export declare const $ShaderUniformSpec: import("@thi.ng/wasm-api").WasmTypeConstructor<ShaderUniformSpec>;
|
|
85
85
|
export interface ModelSpec extends WasmTypeBase {
|
|
86
86
|
/**
|
|
87
87
|
* Slice of model attribute specs
|
|
@@ -113,7 +113,7 @@ export interface ModelSpec extends WasmTypeBase {
|
|
|
113
113
|
readonly numInstances: number;
|
|
114
114
|
readonly mode: DrawMode;
|
|
115
115
|
}
|
|
116
|
-
export declare const $ModelSpec: WasmTypeConstructor<ModelSpec>;
|
|
116
|
+
export declare const $ModelSpec: import("@thi.ng/wasm-api").WasmTypeConstructor<ModelSpec>;
|
|
117
117
|
export interface ModelAttribSpec extends WasmTypeBase {
|
|
118
118
|
readonly name: WasmStringPtr;
|
|
119
119
|
readonly data: ModelAttribData;
|
|
@@ -131,7 +131,7 @@ export interface ModelAttribSpec extends WasmTypeBase {
|
|
|
131
131
|
*/
|
|
132
132
|
readonly size: number;
|
|
133
133
|
}
|
|
134
|
-
export declare const $ModelAttribSpec: WasmTypeConstructor<ModelAttribSpec>;
|
|
134
|
+
export declare const $ModelAttribSpec: import("@thi.ng/wasm-api").WasmTypeConstructor<ModelAttribSpec>;
|
|
135
135
|
export interface ModelAttribData extends WasmTypeBase {
|
|
136
136
|
/**
|
|
137
137
|
* Zig type: `ConstI8Slice`
|
|
@@ -162,7 +162,7 @@ export interface ModelAttribData extends WasmTypeBase {
|
|
|
162
162
|
*/
|
|
163
163
|
readonly f32: Float32Array;
|
|
164
164
|
}
|
|
165
|
-
export declare const $ModelAttribData: WasmTypeConstructor<ModelAttribData>;
|
|
165
|
+
export declare const $ModelAttribData: import("@thi.ng/wasm-api").WasmTypeConstructor<ModelAttribData>;
|
|
166
166
|
export interface AttribUpdateSpec extends WasmTypeBase {
|
|
167
167
|
readonly data: ModelAttribData;
|
|
168
168
|
readonly type: ModelAttribType;
|
|
@@ -174,13 +174,13 @@ export interface AttribUpdateSpec extends WasmTypeBase {
|
|
|
174
174
|
*/
|
|
175
175
|
readonly offset: number;
|
|
176
176
|
}
|
|
177
|
-
export declare const $AttribUpdateSpec: WasmTypeConstructor<AttribUpdateSpec>;
|
|
177
|
+
export declare const $AttribUpdateSpec: import("@thi.ng/wasm-api").WasmTypeConstructor<AttribUpdateSpec>;
|
|
178
178
|
export interface ModelUniform extends WasmTypeBase {
|
|
179
179
|
readonly name: WasmStringPtr;
|
|
180
180
|
readonly type: UniformType;
|
|
181
181
|
readonly value: UniformValue;
|
|
182
182
|
}
|
|
183
|
-
export declare const $ModelUniform: WasmTypeConstructor<ModelUniform>;
|
|
183
|
+
export declare const $ModelUniform: import("@thi.ng/wasm-api").WasmTypeConstructor<ModelUniform>;
|
|
184
184
|
export interface UniformValue extends WasmTypeBase {
|
|
185
185
|
/**
|
|
186
186
|
* Zig type: `f32`
|
|
@@ -199,7 +199,7 @@ export interface UniformValue extends WasmTypeBase {
|
|
|
199
199
|
*/
|
|
200
200
|
readonly vec4: Float32Array;
|
|
201
201
|
}
|
|
202
|
-
export declare const $UniformValue: WasmTypeConstructor<UniformValue>;
|
|
202
|
+
export declare const $UniformValue: import("@thi.ng/wasm-api").WasmTypeConstructor<UniformValue>;
|
|
203
203
|
export interface TextureSpec extends WasmTypeBase {
|
|
204
204
|
readonly img: ImageData;
|
|
205
205
|
/**
|
|
@@ -221,7 +221,7 @@ export interface TextureSpec extends WasmTypeBase {
|
|
|
221
221
|
readonly wrap: TextureRepeat;
|
|
222
222
|
readonly imgType: ImageType;
|
|
223
223
|
}
|
|
224
|
-
export declare const $TextureSpec: WasmTypeConstructor<TextureSpec>;
|
|
224
|
+
export declare const $TextureSpec: import("@thi.ng/wasm-api").WasmTypeConstructor<TextureSpec>;
|
|
225
225
|
export interface ImageData extends WasmTypeBase {
|
|
226
226
|
/**
|
|
227
227
|
* Zig type: `u32`
|
|
@@ -244,7 +244,7 @@ export interface ImageData extends WasmTypeBase {
|
|
|
244
244
|
*/
|
|
245
245
|
readonly f32: Float32Array;
|
|
246
246
|
}
|
|
247
|
-
export declare const $ImageData: WasmTypeConstructor<ImageData>;
|
|
247
|
+
export declare const $ImageData: import("@thi.ng/wasm-api").WasmTypeConstructor<ImageData>;
|
|
248
248
|
export declare enum ImageType {
|
|
249
249
|
none = 0,
|
|
250
250
|
u8 = 1,
|
package/generated/api.js
CHANGED
|
@@ -1,52 +1,36 @@
|
|
|
1
|
-
import { Pointer, WasmStringPtr } from "@thi.ng/wasm-api";
|
|
1
|
+
import { defType, Pointer, WasmStringPtr } from "@thi.ng/wasm-api";
|
|
2
2
|
import { __array, __instanceArray, __slice32, __primslice32 } from "@thi.ng/wasm-api/memory";
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
return mem.u8[base + 4];
|
|
35
|
-
},
|
|
36
|
-
get powerPreference() {
|
|
37
|
-
return mem.u8[base + 5];
|
|
38
|
-
},
|
|
39
|
-
get premultipliedAlpha() {
|
|
40
|
-
return mem.u8[base + 6];
|
|
41
|
-
},
|
|
42
|
-
get preserveDrawingBuffer() {
|
|
43
|
-
return mem.u8[base + 7];
|
|
44
|
-
},
|
|
45
|
-
get stencil() {
|
|
46
|
-
return mem.u8[base + 8];
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
}
|
|
3
|
+
const __str = (mem, base, isConst = true) => new WasmStringPtr(mem, base, isConst);
|
|
4
|
+
const $WebGLContextOpts = defType(1, 9, (mem, base) => {
|
|
5
|
+
return {
|
|
6
|
+
get alpha() {
|
|
7
|
+
return mem.u8[base];
|
|
8
|
+
},
|
|
9
|
+
get antialias() {
|
|
10
|
+
return mem.u8[base + 1];
|
|
11
|
+
},
|
|
12
|
+
get depth() {
|
|
13
|
+
return mem.u8[base + 2];
|
|
14
|
+
},
|
|
15
|
+
get desynchronized() {
|
|
16
|
+
return mem.u8[base + 3];
|
|
17
|
+
},
|
|
18
|
+
get failIfMajorPerformanceCaveat() {
|
|
19
|
+
return mem.u8[base + 4];
|
|
20
|
+
},
|
|
21
|
+
get powerPreference() {
|
|
22
|
+
return mem.u8[base + 5];
|
|
23
|
+
},
|
|
24
|
+
get premultipliedAlpha() {
|
|
25
|
+
return mem.u8[base + 6];
|
|
26
|
+
},
|
|
27
|
+
get preserveDrawingBuffer() {
|
|
28
|
+
return mem.u8[base + 7];
|
|
29
|
+
},
|
|
30
|
+
get stencil() {
|
|
31
|
+
return mem.u8[base + 8];
|
|
32
|
+
}
|
|
33
|
+
};
|
|
50
34
|
});
|
|
51
35
|
var WebGLPowerPreference = /* @__PURE__ */ ((WebGLPowerPreference2) => {
|
|
52
36
|
WebGLPowerPreference2[WebGLPowerPreference2["default"] = 0] = "default";
|
|
@@ -54,441 +38,236 @@ var WebGLPowerPreference = /* @__PURE__ */ ((WebGLPowerPreference2) => {
|
|
|
54
38
|
WebGLPowerPreference2[WebGLPowerPreference2["low_power"] = 2] = "low_power";
|
|
55
39
|
return WebGLPowerPreference2;
|
|
56
40
|
})(WebGLPowerPreference || {});
|
|
57
|
-
const $ShaderSpec = (mem) =>
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
},
|
|
77
|
-
get vs() {
|
|
78
|
-
return $vs || ($vs = new WasmStringPtr(mem, base, true));
|
|
79
|
-
},
|
|
80
|
-
get fs() {
|
|
81
|
-
return $fs || ($fs = new WasmStringPtr(mem, base + 4, true));
|
|
82
|
-
},
|
|
83
|
-
get attribs() {
|
|
84
|
-
return __slice32(mem, $ShaderAttribSpec, base + 8);
|
|
85
|
-
},
|
|
86
|
-
get varying() {
|
|
87
|
-
return __slice32(mem, $ShaderVaryingSpec, base + 16);
|
|
88
|
-
},
|
|
89
|
-
get uniforms() {
|
|
90
|
-
return __slice32(mem, $ShaderUniformSpec, base + 24);
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
}
|
|
41
|
+
const $ShaderSpec = defType(4, 32, (mem, base) => {
|
|
42
|
+
let $vs, $fs;
|
|
43
|
+
return {
|
|
44
|
+
get vs() {
|
|
45
|
+
return $vs || ($vs = __str(mem, base));
|
|
46
|
+
},
|
|
47
|
+
get fs() {
|
|
48
|
+
return $fs || ($fs = __str(mem, base + 4));
|
|
49
|
+
},
|
|
50
|
+
get attribs() {
|
|
51
|
+
return __slice32(mem, $ShaderAttribSpec, base + 8);
|
|
52
|
+
},
|
|
53
|
+
get varying() {
|
|
54
|
+
return __slice32(mem, $ShaderVaryingSpec, base + 16);
|
|
55
|
+
},
|
|
56
|
+
get uniforms() {
|
|
57
|
+
return __slice32(mem, $ShaderUniformSpec, base + 24);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
94
60
|
});
|
|
95
|
-
const $ShaderAttribSpec = (mem) =>
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}
|
|
105
|
-
instance: (base) => {
|
|
106
|
-
let $name = null;
|
|
107
|
-
return {
|
|
108
|
-
get __base() {
|
|
109
|
-
return base;
|
|
110
|
-
},
|
|
111
|
-
get __bytes() {
|
|
112
|
-
return mem.u8.subarray(base, base + 8);
|
|
113
|
-
},
|
|
114
|
-
get name() {
|
|
115
|
-
return $name || ($name = new WasmStringPtr(mem, base, true));
|
|
116
|
-
},
|
|
117
|
-
get type() {
|
|
118
|
-
return mem.u8[base + 4];
|
|
119
|
-
}
|
|
120
|
-
};
|
|
121
|
-
}
|
|
61
|
+
const $ShaderAttribSpec = defType(4, 8, (mem, base) => {
|
|
62
|
+
let $name;
|
|
63
|
+
return {
|
|
64
|
+
get name() {
|
|
65
|
+
return $name || ($name = __str(mem, base));
|
|
66
|
+
},
|
|
67
|
+
get type() {
|
|
68
|
+
return mem.u8[base + 4];
|
|
69
|
+
}
|
|
70
|
+
};
|
|
122
71
|
});
|
|
123
|
-
const $ShaderVaryingSpec = (mem) =>
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
}
|
|
133
|
-
instance: (base) => {
|
|
134
|
-
let $name = null;
|
|
135
|
-
return {
|
|
136
|
-
get __base() {
|
|
137
|
-
return base;
|
|
138
|
-
},
|
|
139
|
-
get __bytes() {
|
|
140
|
-
return mem.u8.subarray(base, base + 8);
|
|
141
|
-
},
|
|
142
|
-
get name() {
|
|
143
|
-
return $name || ($name = new WasmStringPtr(mem, base, true));
|
|
144
|
-
},
|
|
145
|
-
get type() {
|
|
146
|
-
return mem.u8[base + 4];
|
|
147
|
-
}
|
|
148
|
-
};
|
|
149
|
-
}
|
|
72
|
+
const $ShaderVaryingSpec = defType(4, 8, (mem, base) => {
|
|
73
|
+
let $name;
|
|
74
|
+
return {
|
|
75
|
+
get name() {
|
|
76
|
+
return $name || ($name = __str(mem, base));
|
|
77
|
+
},
|
|
78
|
+
get type() {
|
|
79
|
+
return mem.u8[base + 4];
|
|
80
|
+
}
|
|
81
|
+
};
|
|
150
82
|
});
|
|
151
|
-
const $ShaderUniformSpec = (mem) =>
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
get __base() {
|
|
165
|
-
return base;
|
|
166
|
-
},
|
|
167
|
-
get __bytes() {
|
|
168
|
-
return mem.u8.subarray(base, base + 32);
|
|
169
|
-
},
|
|
170
|
-
get name() {
|
|
171
|
-
return $name || ($name = new WasmStringPtr(mem, base, true));
|
|
172
|
-
},
|
|
173
|
-
get type() {
|
|
174
|
-
return mem.u8[base + 4];
|
|
175
|
-
},
|
|
176
|
-
get default() {
|
|
177
|
-
return $UniformValue(mem).instance(base + 16);
|
|
178
|
-
}
|
|
179
|
-
};
|
|
180
|
-
}
|
|
83
|
+
const $ShaderUniformSpec = defType(16, 32, (mem, base) => {
|
|
84
|
+
let $name;
|
|
85
|
+
return {
|
|
86
|
+
get name() {
|
|
87
|
+
return $name || ($name = __str(mem, base));
|
|
88
|
+
},
|
|
89
|
+
get type() {
|
|
90
|
+
return mem.u8[base + 4];
|
|
91
|
+
},
|
|
92
|
+
get default() {
|
|
93
|
+
return $UniformValue(mem).instance(base + 16);
|
|
94
|
+
}
|
|
95
|
+
};
|
|
181
96
|
});
|
|
182
|
-
const $ModelSpec = (mem) =>
|
|
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
|
-
get textures() {
|
|
210
|
-
return __primslice32(mem, mem.i32, base + 24, 2);
|
|
211
|
-
},
|
|
212
|
-
get shader() {
|
|
213
|
-
return mem.i32[base + 32 >>> 2];
|
|
214
|
-
},
|
|
215
|
-
get num() {
|
|
216
|
-
return mem.u32[base + 36 >>> 2];
|
|
217
|
-
},
|
|
218
|
-
get numInstances() {
|
|
219
|
-
return mem.u32[base + 40 >>> 2];
|
|
220
|
-
},
|
|
221
|
-
get mode() {
|
|
222
|
-
return mem.u8[base + 44];
|
|
223
|
-
}
|
|
224
|
-
};
|
|
225
|
-
}
|
|
97
|
+
const $ModelSpec = defType(4, 48, (mem, base) => {
|
|
98
|
+
return {
|
|
99
|
+
get attribs() {
|
|
100
|
+
return __slice32(mem, $ModelAttribSpec, base);
|
|
101
|
+
},
|
|
102
|
+
get instances() {
|
|
103
|
+
return __slice32(mem, $ModelAttribSpec, base + 8);
|
|
104
|
+
},
|
|
105
|
+
get uniforms() {
|
|
106
|
+
return __slice32(mem, $ModelUniform, base + 16);
|
|
107
|
+
},
|
|
108
|
+
get textures() {
|
|
109
|
+
return __primslice32(mem, mem.i32, base + 24, 2);
|
|
110
|
+
},
|
|
111
|
+
get shader() {
|
|
112
|
+
return mem.i32[base + 32 >>> 2];
|
|
113
|
+
},
|
|
114
|
+
get num() {
|
|
115
|
+
return mem.u32[base + 36 >>> 2];
|
|
116
|
+
},
|
|
117
|
+
get numInstances() {
|
|
118
|
+
return mem.u32[base + 40 >>> 2];
|
|
119
|
+
},
|
|
120
|
+
get mode() {
|
|
121
|
+
return mem.u8[base + 44];
|
|
122
|
+
}
|
|
123
|
+
};
|
|
226
124
|
});
|
|
227
|
-
const $ModelAttribSpec = (mem) =>
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
get data() {
|
|
250
|
-
return $ModelAttribData(mem).instance(base + 4);
|
|
251
|
-
},
|
|
252
|
-
get type() {
|
|
253
|
-
return mem.u16[base + 12 >>> 1];
|
|
254
|
-
},
|
|
255
|
-
get offset() {
|
|
256
|
-
return mem.u32[base + 16 >>> 2];
|
|
257
|
-
},
|
|
258
|
-
get stride() {
|
|
259
|
-
return mem.u32[base + 20 >>> 2];
|
|
260
|
-
},
|
|
261
|
-
get size() {
|
|
262
|
-
return mem.u32[base + 24 >>> 2];
|
|
263
|
-
}
|
|
264
|
-
};
|
|
265
|
-
}
|
|
125
|
+
const $ModelAttribSpec = defType(4, 28, (mem, base) => {
|
|
126
|
+
let $name;
|
|
127
|
+
return {
|
|
128
|
+
get name() {
|
|
129
|
+
return $name || ($name = __str(mem, base));
|
|
130
|
+
},
|
|
131
|
+
get data() {
|
|
132
|
+
return $ModelAttribData(mem).instance(base + 4);
|
|
133
|
+
},
|
|
134
|
+
get type() {
|
|
135
|
+
return mem.u16[base + 12 >>> 1];
|
|
136
|
+
},
|
|
137
|
+
get offset() {
|
|
138
|
+
return mem.u32[base + 16 >>> 2];
|
|
139
|
+
},
|
|
140
|
+
get stride() {
|
|
141
|
+
return mem.u32[base + 20 >>> 2];
|
|
142
|
+
},
|
|
143
|
+
get size() {
|
|
144
|
+
return mem.u32[base + 24 >>> 2];
|
|
145
|
+
}
|
|
146
|
+
};
|
|
266
147
|
});
|
|
267
|
-
const $ModelAttribData = (mem) =>
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
get i16() {
|
|
292
|
-
return __primslice32(mem, mem.i16, base, 1);
|
|
293
|
-
},
|
|
294
|
-
get u16() {
|
|
295
|
-
return __primslice32(mem, mem.u16, base, 1);
|
|
296
|
-
},
|
|
297
|
-
get u32() {
|
|
298
|
-
return __primslice32(mem, mem.i32, base, 2);
|
|
299
|
-
},
|
|
300
|
-
get i32() {
|
|
301
|
-
return __primslice32(mem, mem.u32, base, 2);
|
|
302
|
-
},
|
|
303
|
-
get f32() {
|
|
304
|
-
return __primslice32(mem, mem.f32, base, 2);
|
|
305
|
-
}
|
|
306
|
-
};
|
|
307
|
-
}
|
|
148
|
+
const $ModelAttribData = defType(4, 8, (mem, base) => {
|
|
149
|
+
return {
|
|
150
|
+
get u8() {
|
|
151
|
+
return __primslice32(mem, mem.i8, base, 0);
|
|
152
|
+
},
|
|
153
|
+
get i8() {
|
|
154
|
+
return __primslice32(mem, mem.u8, base, 0);
|
|
155
|
+
},
|
|
156
|
+
get i16() {
|
|
157
|
+
return __primslice32(mem, mem.i16, base, 1);
|
|
158
|
+
},
|
|
159
|
+
get u16() {
|
|
160
|
+
return __primslice32(mem, mem.u16, base, 1);
|
|
161
|
+
},
|
|
162
|
+
get u32() {
|
|
163
|
+
return __primslice32(mem, mem.i32, base, 2);
|
|
164
|
+
},
|
|
165
|
+
get i32() {
|
|
166
|
+
return __primslice32(mem, mem.u32, base, 2);
|
|
167
|
+
},
|
|
168
|
+
get f32() {
|
|
169
|
+
return __primslice32(mem, mem.f32, base, 2);
|
|
170
|
+
}
|
|
171
|
+
};
|
|
308
172
|
});
|
|
309
|
-
const $AttribUpdateSpec = (mem) =>
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
get __base() {
|
|
322
|
-
return base;
|
|
323
|
-
},
|
|
324
|
-
get __bytes() {
|
|
325
|
-
return mem.u8.subarray(base, base + 16);
|
|
326
|
-
},
|
|
327
|
-
get data() {
|
|
328
|
-
return $ModelAttribData(mem).instance(base);
|
|
329
|
-
},
|
|
330
|
-
get type() {
|
|
331
|
-
return mem.u16[base + 8 >>> 1];
|
|
332
|
-
},
|
|
333
|
-
get offset() {
|
|
334
|
-
return mem.u32[base + 12 >>> 2];
|
|
335
|
-
}
|
|
336
|
-
};
|
|
337
|
-
}
|
|
173
|
+
const $AttribUpdateSpec = defType(4, 16, (mem, base) => {
|
|
174
|
+
return {
|
|
175
|
+
get data() {
|
|
176
|
+
return $ModelAttribData(mem).instance(base);
|
|
177
|
+
},
|
|
178
|
+
get type() {
|
|
179
|
+
return mem.u16[base + 8 >>> 1];
|
|
180
|
+
},
|
|
181
|
+
get offset() {
|
|
182
|
+
return mem.u32[base + 12 >>> 2];
|
|
183
|
+
}
|
|
184
|
+
};
|
|
338
185
|
});
|
|
339
|
-
const $ModelUniform = (mem) =>
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
get __base() {
|
|
353
|
-
return base;
|
|
354
|
-
},
|
|
355
|
-
get __bytes() {
|
|
356
|
-
return mem.u8.subarray(base, base + 32);
|
|
357
|
-
},
|
|
358
|
-
get name() {
|
|
359
|
-
return $name || ($name = new WasmStringPtr(mem, base, true));
|
|
360
|
-
},
|
|
361
|
-
get type() {
|
|
362
|
-
return mem.u8[base + 4];
|
|
363
|
-
},
|
|
364
|
-
get value() {
|
|
365
|
-
return $UniformValue(mem).instance(base + 16);
|
|
366
|
-
}
|
|
367
|
-
};
|
|
368
|
-
}
|
|
186
|
+
const $ModelUniform = defType(16, 32, (mem, base) => {
|
|
187
|
+
let $name;
|
|
188
|
+
return {
|
|
189
|
+
get name() {
|
|
190
|
+
return $name || ($name = __str(mem, base));
|
|
191
|
+
},
|
|
192
|
+
get type() {
|
|
193
|
+
return mem.u8[base + 4];
|
|
194
|
+
},
|
|
195
|
+
get value() {
|
|
196
|
+
return $UniformValue(mem).instance(base + 16);
|
|
197
|
+
}
|
|
198
|
+
};
|
|
369
199
|
});
|
|
370
|
-
const $UniformValue = (mem) =>
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
get float() {
|
|
389
|
-
return mem.f32[base >>> 2];
|
|
390
|
-
},
|
|
391
|
-
get vec2() {
|
|
392
|
-
const addr = base >>> 2;
|
|
393
|
-
return mem.f32.subarray(addr, addr + 2);
|
|
394
|
-
},
|
|
395
|
-
get vec3() {
|
|
396
|
-
const addr = base >>> 2;
|
|
397
|
-
return mem.f32.subarray(addr, addr + 3);
|
|
398
|
-
},
|
|
399
|
-
get vec4() {
|
|
400
|
-
const addr = base >>> 2;
|
|
401
|
-
return mem.f32.subarray(addr, addr + 4);
|
|
402
|
-
}
|
|
403
|
-
};
|
|
404
|
-
}
|
|
200
|
+
const $UniformValue = defType(16, 16, (mem, base) => {
|
|
201
|
+
return {
|
|
202
|
+
get float() {
|
|
203
|
+
return mem.f32[base >>> 2];
|
|
204
|
+
},
|
|
205
|
+
get vec2() {
|
|
206
|
+
const addr = base >>> 2;
|
|
207
|
+
return mem.f32.subarray(addr, addr + 2);
|
|
208
|
+
},
|
|
209
|
+
get vec3() {
|
|
210
|
+
const addr = base >>> 2;
|
|
211
|
+
return mem.f32.subarray(addr, addr + 3);
|
|
212
|
+
},
|
|
213
|
+
get vec4() {
|
|
214
|
+
const addr = base >>> 2;
|
|
215
|
+
return mem.f32.subarray(addr, addr + 4);
|
|
216
|
+
}
|
|
217
|
+
};
|
|
405
218
|
});
|
|
406
|
-
const $TextureSpec = (mem) =>
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
get target() {
|
|
440
|
-
return mem.u16[base + 16 >>> 1];
|
|
441
|
-
},
|
|
442
|
-
get type() {
|
|
443
|
-
return mem.u16[base + 18 >>> 1];
|
|
444
|
-
},
|
|
445
|
-
get filter() {
|
|
446
|
-
return mem.u16[base + 20 >>> 1];
|
|
447
|
-
},
|
|
448
|
-
get wrap() {
|
|
449
|
-
return mem.u16[base + 22 >>> 1];
|
|
450
|
-
},
|
|
451
|
-
get imgType() {
|
|
452
|
-
return mem.u8[base + 24];
|
|
453
|
-
}
|
|
454
|
-
};
|
|
455
|
-
}
|
|
219
|
+
const $TextureSpec = defType(4, 28, (mem, base) => {
|
|
220
|
+
return {
|
|
221
|
+
get img() {
|
|
222
|
+
return $ImageData(mem).instance(base);
|
|
223
|
+
},
|
|
224
|
+
get width() {
|
|
225
|
+
return mem.u16[base + 8 >>> 1];
|
|
226
|
+
},
|
|
227
|
+
get height() {
|
|
228
|
+
return mem.u16[base + 10 >>> 1];
|
|
229
|
+
},
|
|
230
|
+
get depth() {
|
|
231
|
+
return mem.u16[base + 12 >>> 1];
|
|
232
|
+
},
|
|
233
|
+
get format() {
|
|
234
|
+
return mem.u16[base + 14 >>> 1];
|
|
235
|
+
},
|
|
236
|
+
get target() {
|
|
237
|
+
return mem.u16[base + 16 >>> 1];
|
|
238
|
+
},
|
|
239
|
+
get type() {
|
|
240
|
+
return mem.u16[base + 18 >>> 1];
|
|
241
|
+
},
|
|
242
|
+
get filter() {
|
|
243
|
+
return mem.u16[base + 20 >>> 1];
|
|
244
|
+
},
|
|
245
|
+
get wrap() {
|
|
246
|
+
return mem.u16[base + 22 >>> 1];
|
|
247
|
+
},
|
|
248
|
+
get imgType() {
|
|
249
|
+
return mem.u8[base + 24];
|
|
250
|
+
}
|
|
251
|
+
};
|
|
456
252
|
});
|
|
457
|
-
const $ImageData = (mem) =>
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
get none() {
|
|
476
|
-
return mem.u32[base >>> 2];
|
|
477
|
-
},
|
|
478
|
-
get u8() {
|
|
479
|
-
return __primslice32(mem, mem.u8, base, 0);
|
|
480
|
-
},
|
|
481
|
-
get u16() {
|
|
482
|
-
return __primslice32(mem, mem.u16, base, 1);
|
|
483
|
-
},
|
|
484
|
-
get u32() {
|
|
485
|
-
return __primslice32(mem, mem.u32, base, 2);
|
|
486
|
-
},
|
|
487
|
-
get f32() {
|
|
488
|
-
return __primslice32(mem, mem.f32, base, 2);
|
|
489
|
-
}
|
|
490
|
-
};
|
|
491
|
-
}
|
|
253
|
+
const $ImageData = defType(4, 8, (mem, base) => {
|
|
254
|
+
return {
|
|
255
|
+
get none() {
|
|
256
|
+
return mem.u32[base >>> 2];
|
|
257
|
+
},
|
|
258
|
+
get u8() {
|
|
259
|
+
return __primslice32(mem, mem.u8, base, 0);
|
|
260
|
+
},
|
|
261
|
+
get u16() {
|
|
262
|
+
return __primslice32(mem, mem.u16, base, 1);
|
|
263
|
+
},
|
|
264
|
+
get u32() {
|
|
265
|
+
return __primslice32(mem, mem.u32, base, 2);
|
|
266
|
+
},
|
|
267
|
+
get f32() {
|
|
268
|
+
return __primslice32(mem, mem.f32, base, 2);
|
|
269
|
+
}
|
|
270
|
+
};
|
|
492
271
|
});
|
|
493
272
|
var ImageType = /* @__PURE__ */ ((ImageType2) => {
|
|
494
273
|
ImageType2[ImageType2["none"] = 0] = "none";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/wasm-api-webgl",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.16",
|
|
4
4
|
"description": "WebGL bridge API for hybrid TypeScript & WASM (Zig) applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"build:esbuild": "esbuild --format=esm --platform=neutral --target=es2022 --tsconfig=tsconfig.json --outdir=. src/**/*.ts",
|
|
30
30
|
"build:types": "npx wasm-api-bindgen -a analytics.json --config src/typedefs-config.json --lang ts -o src/generated/api.ts --lang zig -o zig/api.zig src/typedefs.json",
|
|
31
31
|
"clean": "bun ../../tools/src/clean-package.ts",
|
|
32
|
-
"doc": "typedoc --
|
|
32
|
+
"doc": "typedoc --options ../../typedoc.json --out doc src/index.ts",
|
|
33
33
|
"doc:ae": "mkdir -p .ae/doc .ae/temp && api-extractor run --local --verbose",
|
|
34
34
|
"doc:readme": "bun ../../tools/src/module-stats.ts && bun ../../tools/src/readme.ts",
|
|
35
35
|
"pub": "yarn npm publish --access public",
|
|
@@ -37,15 +37,15 @@
|
|
|
37
37
|
"tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@thi.ng/api": "^8.11.
|
|
41
|
-
"@thi.ng/errors": "^2.5.
|
|
42
|
-
"@thi.ng/wasm-api": "^2.
|
|
43
|
-
"@thi.ng/wasm-api-dom": "^1.0.
|
|
44
|
-
"@thi.ng/webgl": "^6.9.
|
|
40
|
+
"@thi.ng/api": "^8.11.12",
|
|
41
|
+
"@thi.ng/errors": "^2.5.18",
|
|
42
|
+
"@thi.ng/wasm-api": "^2.2.0",
|
|
43
|
+
"@thi.ng/wasm-api-dom": "^1.0.9",
|
|
44
|
+
"@thi.ng/webgl": "^6.9.25"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@microsoft/api-extractor": "^7.47.9",
|
|
48
|
-
"@thi.ng/wasm-api-bindgen": "^0.
|
|
48
|
+
"@thi.ng/wasm-api-bindgen": "^0.8.0",
|
|
49
49
|
"esbuild": "^0.24.0",
|
|
50
50
|
"typedoc": "^0.26.7",
|
|
51
51
|
"typescript": "^5.6.2"
|
|
@@ -96,5 +96,5 @@
|
|
|
96
96
|
"status": "alpha",
|
|
97
97
|
"year": 2024
|
|
98
98
|
},
|
|
99
|
-
"gitHead": "
|
|
99
|
+
"gitHead": "ef89090bb19fc5bca23be5da8cfce05b82ff4ad1\n"
|
|
100
100
|
}
|