@thi.ng/webgl 5.0.14 → 6.0.4

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.
Files changed (61) hide show
  1. package/CHANGELOG.md +112 -213
  2. package/README.md +15 -5
  3. package/api/buffers.d.ts +1 -1
  4. package/api/canvas.d.ts +1 -1
  5. package/api/material.d.ts +1 -1
  6. package/api/model.d.ts +3 -3
  7. package/api/multipass.d.ts +4 -4
  8. package/api/shader.d.ts +12 -6
  9. package/api/texture.d.ts +1 -1
  10. package/buffer.d.ts +3 -3
  11. package/buffer.js +4 -4
  12. package/canvas.d.ts +2 -2
  13. package/canvas.js +6 -3
  14. package/checks.d.ts +1 -1
  15. package/checks.js +1 -1
  16. package/draw.d.ts +1 -1
  17. package/draw.js +4 -4
  18. package/error.d.ts +11 -3
  19. package/error.js +2 -5
  20. package/fbo.d.ts +1 -1
  21. package/fbo.js +5 -5
  22. package/geo/cube.d.ts +1 -1
  23. package/geo/cube.js +2 -2
  24. package/geo/quad.d.ts +1 -1
  25. package/geo/quad.js +14 -11
  26. package/index.d.ts +32 -32
  27. package/index.js +32 -32
  28. package/{api/logger.d.ts → logger.d.ts} +1 -1
  29. package/{api/logger.js → logger.js} +1 -1
  30. package/material.d.ts +2 -2
  31. package/matrices.d.ts +2 -2
  32. package/matrices.js +5 -2
  33. package/multipass.d.ts +1 -1
  34. package/multipass.js +33 -15
  35. package/package.json +151 -40
  36. package/rbo.d.ts +1 -1
  37. package/rbo.js +1 -1
  38. package/readpixels.d.ts +1 -1
  39. package/readpixels.js +1 -1
  40. package/shader.d.ts +6 -6
  41. package/shader.js +33 -23
  42. package/shaders/lambert.d.ts +3 -3
  43. package/shaders/lambert.js +43 -11
  44. package/shaders/phong.d.ts +3 -3
  45. package/shaders/phong.js +38 -10
  46. package/shaders/pipeline.d.ts +1 -1
  47. package/shaders/pipeline.js +5 -1
  48. package/syntax.d.ts +2 -2
  49. package/syntax.js +2 -2
  50. package/texture.d.ts +1 -1
  51. package/texture.js +10 -6
  52. package/textures/checkerboard.js +9 -2
  53. package/textures/stripes.js +8 -2
  54. package/uniforms.d.ts +2 -2
  55. package/uniforms.js +2 -2
  56. package/utils.d.ts +4 -4
  57. package/utils.js +1 -1
  58. package/lib/index.js +0 -1820
  59. package/lib/index.js.map +0 -1
  60. package/lib/index.umd.js +0 -1
  61. package/lib/index.umd.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -3,7 +3,7 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- ## [5.0.14](https://github.com/thi-ng/umbrella/compare/@thi.ng/webgl@5.0.13...@thi.ng/webgl@5.0.14) (2021-09-03)
6
+ ## [6.0.4](https://github.com/thi-ng/umbrella/compare/@thi.ng/webgl@6.0.3...@thi.ng/webgl@6.0.4) (2021-10-15)
7
7
 
8
8
  **Note:** Version bump only for package @thi.ng/webgl
9
9
 
@@ -11,7 +11,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
11
11
 
12
12
 
13
13
 
14
- ## [5.0.13](https://github.com/thi-ng/umbrella/compare/@thi.ng/webgl@5.0.12...@thi.ng/webgl@5.0.13) (2021-08-22)
14
+ ## [6.0.3](https://github.com/thi-ng/umbrella/compare/@thi.ng/webgl@6.0.2...@thi.ng/webgl@6.0.3) (2021-10-15)
15
15
 
16
16
  **Note:** Version bump only for package @thi.ng/webgl
17
17
 
@@ -19,315 +19,214 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
19
19
 
20
20
 
21
21
 
22
- # [5.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/webgl@4.0.16...@thi.ng/webgl@5.0.0) (2021-06-08)
23
-
24
-
25
- ### Code Refactoring
26
-
27
- * **webgl:** update multipass texture uniforms ([86d363a](https://github.com/thi-ng/umbrella/commit/86d363aa80c1861388bccd9fb57000afd96e4257))
28
-
29
-
30
- ### Features
31
-
32
- * **webgl:** add passCopy() HOF pass gen ([fb6b5b7](https://github.com/thi-ng/umbrella/commit/fb6b5b76d16a75d157499f7ccf46c777a063131e))
33
-
34
-
35
- ### BREAKING CHANGES
36
-
37
- * **webgl:** replace input tex `sampler2D[]` array w/ named inputs
38
-
39
- - new unis: `input0`, `input1`, etc. to sync w/ same approach as
40
- already used for outputs
41
- - new approach also simplifies texture lookups in shader-ast code
42
-
43
-
44
-
45
-
46
-
47
- # [4.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/webgl@3.3.15...@thi.ng/webgl@4.0.0) (2021-02-20)
48
-
49
-
50
- ### Bug Fixes
51
-
52
- * **webgl:** update compileAttribPool() ([6b5dd8e](https://github.com/thi-ng/umbrella/commit/6b5dd8e0c5167ac44a7d0358ccd106b7899fbccf))
53
-
54
-
55
- ### Code Refactoring
56
-
57
- * **webgl:** update attrib type handling ([542850b](https://github.com/thi-ng/umbrella/commit/542850bc0f9c93abe8634f9d899e391905ff93ec))
58
-
59
-
60
- ### BREAKING CHANGES
61
-
62
- * **webgl:** attrib buffer data type use string consts
63
-
64
- - part of unified umbrella-wide changes to thi.ng/api Type alias
65
- (see a333d4182)
66
-
67
-
68
-
69
-
70
-
71
- # [3.3.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/webgl@3.2.1...@thi.ng/webgl@3.3.0) (2020-08-20)
72
-
73
-
74
- ### Features
75
-
76
- * **webgl:** only warn once re: unknown uni/attrib ([7490aa1](https://github.com/thi-ng/umbrella/commit/7490aa1e0d8e69c0be2f0c63f72373983898f04c))
77
-
78
-
79
-
80
-
81
-
82
- # [3.2.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/webgl@3.1.1...@thi.ng/webgl@3.2.0) (2020-08-16)
83
-
84
-
85
- ### Features
86
-
87
- * **webgl:** store texture filter/wrap mode ([8a7420e](https://github.com/thi-ng/umbrella/commit/8a7420ee708e92a1670c47330c6c1b262b76cc87))
88
-
89
-
90
-
91
-
92
-
93
- ## [3.1.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/webgl@3.1.0...@thi.ng/webgl@3.1.1) (2020-08-12)
94
-
95
-
96
- ### Bug Fixes
97
-
98
- * **webgl:** update/add DrawOpts, add unbindTextures() ([27021fa](https://github.com/thi-ng/umbrella/commit/27021facca516e3d9c598f017819fe0314c72af4))
99
-
100
-
101
-
102
-
103
-
104
- # [3.1.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/webgl@3.0.4...@thi.ng/webgl@3.1.0) (2020-08-12)
105
-
106
-
107
- ### Features
108
-
109
- * **webgl:** add DrawFlags opts for draw() ([800382b](https://github.com/thi-ng/umbrella/commit/800382ba1a67a5dd9f8a4edc17f6d791bfa2c627))
110
- * **webgl:** add opt unbind flag for .configure() ([0e5cc2b](https://github.com/thi-ng/umbrella/commit/0e5cc2bc5b632c7d418715c936d4cc6152b4a57c))
111
-
22
+ ## [6.0.2](https://github.com/thi-ng/umbrella/compare/@thi.ng/webgl@6.0.1...@thi.ng/webgl@6.0.2) (2021-10-13)
112
23
 
24
+ **Note:** Version bump only for package @thi.ng/webgl
113
25
 
114
26
 
115
27
 
116
- ## [3.0.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/webgl@3.0.0...@thi.ng/webgl@3.0.1) (2020-08-08)
117
28
 
118
29
 
119
- ### Bug Fixes
30
+ ## [6.0.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/webgl@6.0.0...@thi.ng/webgl@6.0.1) (2021-10-13)
120
31
 
121
- * **webgl:** unbind texture after configured ([9612cdd](https://github.com/thi-ng/umbrella/commit/9612cdd86130ccb780eeda2971e780f0c8dc2b52))
32
+ **Note:** Version bump only for package @thi.ng/webgl
122
33
 
123
34
 
124
35
 
125
36
 
126
37
 
127
- # [3.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/webgl@2.0.11...@thi.ng/webgl@3.0.0) (2020-07-28)
38
+ # [6.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/webgl@5.0.14...@thi.ng/webgl@6.0.0) (2021-10-12)
128
39
 
129
40
 
130
- ### Bug Fixes
41
+ ### Build System
131
42
 
132
- * **webgl:** bind FBO in readTexture() ([6cb4448](https://github.com/thi-ng/umbrella/commit/6cb4448f75811e9a266ff81065da03ccdf138b6d))
43
+ * major update of ALL pkgs (export maps, ESM only) ([0d1d6ea](https://github.com/thi-ng/umbrella/commit/0d1d6ea9fab2a645d6c5f2bf2591459b939c09b6))
133
44
 
134
45
 
135
46
  ### Features
136
47
 
137
- * **webgl:** add varying int support (webgl2) ([c812800](https://github.com/thi-ng/umbrella/commit/c812800cb8d61a19b892a7f802fd03820c7e7310))
138
- * **webgl:** add/update opts for defQuadModel() ([13b7d9e](https://github.com/thi-ng/umbrella/commit/13b7d9e5ad26622702cfd4f1c4957da50ab704ed))
48
+ * **webgl:** add DefShaderOpts, rename ShaderOpts ([ef46bf5](https://github.com/thi-ng/umbrella/commit/ef46bf55eaa1deff12b0268b880bc33f4878acba))
139
49
 
140
50
 
141
51
  ### BREAKING CHANGES
142
52
 
143
- * **webgl:** add/update opts for defQuadModel()
144
-
145
- - update callsite in defMultiPass()
146
-
147
-
148
-
53
+ * discontinue CommonJS & UMD versions
149
54
 
55
+ - only ESM modules will be published from now on
56
+ - CJS obsolete due to ESM support in recent versions of node:
57
+ - i.e. launch NodeJS via:
58
+ - `node --experimental-specifier-resolution=node --experimental-repl-await`
59
+ - in the node REPL use `await import(...)` instead of `require()`
60
+ - UMD obsolete due to widespread browser support for ESM
150
61
 
151
- # [2.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/webgl@1.0.17...@thi.ng/webgl@2.0.0) (2020-06-07)
62
+ Also:
63
+ - normalize/restructure/reorg all package.json files
64
+ - cleanup all build scripts, remove obsolete
65
+ - switch from mocha to @thi.ng/testament for all tests
152
66
 
153
67
 
154
- ### Code Refactoring
155
68
 
156
- * **webgl:** remove adaptDPI() ([6d49da6](https://github.com/thi-ng/umbrella/commit/6d49da610bec87fef96c77a39f1181002872f2ba))
157
-
158
-
159
- ### BREAKING CHANGES
160
-
161
- * **webgl:** re-use adaptDPI() from new @thi.ng/adapt-dpi pkg
162
-
163
- - update deps
164
69
 
165
70
 
166
71
 
72
+ # [5.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/webgl@4.0.16...@thi.ng/webgl@5.0.0) (2021-06-08)
167
73
 
74
+ ### Code Refactoring
168
75
 
169
- ## [1.0.7](https://github.com/thi-ng/umbrella/compare/@thi.ng/webgl@1.0.6...@thi.ng/webgl@1.0.7) (2020-04-21)
76
+ - **webgl:** update multipass texture uniforms ([86d363a](https://github.com/thi-ng/umbrella/commit/86d363aa80c1861388bccd9fb57000afd96e4257))
170
77
 
78
+ ### Features
171
79
 
172
- ### Bug Fixes
80
+ - **webgl:** add passCopy() HOF pass gen ([fb6b5b7](https://github.com/thi-ng/umbrella/commit/fb6b5b76d16a75d157499f7ccf46c777a063131e))
173
81
 
174
- * **webgl:** unbind fbo after configure ([25414b5](https://github.com/thi-ng/umbrella/commit/25414b598211c05597714bc07d16a5f6a6249e5f))
82
+ ### BREAKING CHANGES
175
83
 
84
+ - **webgl:** replace input tex `sampler2D[]` array w/ named inputs
85
+ - new unis: `input0`, `input1`, etc. to sync w/ same approach as already used for outputs
86
+ - new approach also simplifies texture lookups in shader-ast code
176
87
 
88
+ # [4.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/webgl@3.3.15...@thi.ng/webgl@4.0.0) (2021-02-20)
177
89
 
90
+ ### Bug Fixes
178
91
 
92
+ - **webgl:** update compileAttribPool() ([6b5dd8e](https://github.com/thi-ng/umbrella/commit/6b5dd8e0c5167ac44a7d0358ccd106b7899fbccf))
179
93
 
180
- ## [1.0.5](https://github.com/thi-ng/umbrella/compare/@thi.ng/webgl@1.0.4...@thi.ng/webgl@1.0.5) (2020-04-11)
94
+ ### Code Refactoring
181
95
 
96
+ - **webgl:** update attrib type handling ([542850b](https://github.com/thi-ng/umbrella/commit/542850bc0f9c93abe8634f9d899e391905ff93ec))
182
97
 
183
- ### Bug Fixes
98
+ ### BREAKING CHANGES
184
99
 
185
- * **webgl:** `disableVertexAttribArray` in `Shader.unbind` ([d3eab37](https://github.com/thi-ng/umbrella/commit/d3eab37cb5e356aa80207ce445926844cc072261))
186
- * **webgl:** add missing braces ([5e6d5bf](https://github.com/thi-ng/umbrella/commit/5e6d5bfa3b0529ec7c448d2ec1dde04716fb597e))
100
+ - **webgl:** attrib buffer data type use string consts
101
+ - part of unified umbrella-wide changes to thi.ng/api Type alias (see a333d4182)
187
102
 
103
+ # [3.3.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/webgl@3.2.1...@thi.ng/webgl@3.3.0) (2020-08-20)
188
104
 
105
+ ### Features
189
106
 
107
+ - **webgl:** only warn once re: unknown uni/attrib ([7490aa1](https://github.com/thi-ng/umbrella/commit/7490aa1e0d8e69c0be2f0c63f72373983898f04c))
190
108
 
109
+ # [3.2.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/webgl@3.1.1...@thi.ng/webgl@3.2.0) (2020-08-16)
191
110
 
192
- ## [1.0.4](https://github.com/thi-ng/umbrella/compare/@thi.ng/webgl@1.0.3...@thi.ng/webgl@1.0.4) (2020-04-07)
111
+ ### Features
193
112
 
113
+ - **webgl:** store texture filter/wrap mode ([8a7420e](https://github.com/thi-ng/umbrella/commit/8a7420ee708e92a1670c47330c6c1b262b76cc87))
194
114
 
195
- ### Bug Fixes
115
+ ## [3.1.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/webgl@3.1.0...@thi.ng/webgl@3.1.1) (2020-08-12)
196
116
 
197
- * **webgl:** fix [#217](https://github.com/thi-ng/umbrella/issues/217), use logger for shader src ([501c82d](https://github.com/thi-ng/umbrella/commit/501c82dbde7cbb385f35ff8149cfc98e4c6e6405))
117
+ ### Bug Fixes
198
118
 
119
+ - **webgl:** update/add DrawOpts, add unbindTextures() ([27021fa](https://github.com/thi-ng/umbrella/commit/27021facca516e3d9c598f017819fe0314c72af4))
199
120
 
121
+ # [3.1.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/webgl@3.0.4...@thi.ng/webgl@3.1.0) (2020-08-12)
200
122
 
123
+ ### Features
201
124
 
125
+ - **webgl:** add DrawFlags opts for draw() ([800382b](https://github.com/thi-ng/umbrella/commit/800382ba1a67a5dd9f8a4edc17f6d791bfa2c627))
126
+ - **webgl:** add opt unbind flag for .configure() ([0e5cc2b](https://github.com/thi-ng/umbrella/commit/0e5cc2bc5b632c7d418715c936d4cc6152b4a57c))
202
127
 
203
- # [1.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/webgl@0.3.4...@thi.ng/webgl@1.0.0) (2020-03-28)
128
+ ## [3.0.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/webgl@3.0.0...@thi.ng/webgl@3.0.1) (2020-08-08)
204
129
 
130
+ ### Bug Fixes
205
131
 
206
- ### Code Refactoring
132
+ - **webgl:** unbind texture after configured ([9612cdd](https://github.com/thi-ng/umbrella/commit/9612cdd86130ccb780eeda2971e780f0c8dc2b52))
207
133
 
208
- * **webgl:** rename factory functions ([633f693](https://github.com/thi-ng/umbrella/commit/633f69387a9ddf35919b9b6dd108068a9e05aec7))
134
+ # [3.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/webgl@2.0.11...@thi.ng/webgl@3.0.0) (2020-07-28)
209
135
 
136
+ ### Bug Fixes
210
137
 
211
- ### Features
138
+ - **webgl:** bind FBO in readTexture() ([6cb4448](https://github.com/thi-ng/umbrella/commit/6cb4448f75811e9a266ff81065da03ccdf138b6d))
212
139
 
213
- * **webgl:** add DrawMode enums ([5adaa23](https://github.com/thi-ng/umbrella/commit/5adaa23c5aa06b2229cb55d216f424b367875217))
140
+ ### Features
214
141
 
142
+ - **webgl:** add varying int support (webgl2) ([c812800](https://github.com/thi-ng/umbrella/commit/c812800cb8d61a19b892a7f802fd03820c7e7310))
143
+ - **webgl:** add/update opts for defQuadModel() ([13b7d9e](https://github.com/thi-ng/umbrella/commit/13b7d9e5ad26622702cfd4f1c4957da50ab704ed))
215
144
 
216
- ### BREAKING CHANGES
145
+ ### BREAKING CHANGES
217
146
 
218
- * **webgl:** #210, rename factory functions (`defXXX`)
147
+ - **webgl:** add/update opts for defQuadModel()
148
+ - update callsite in defMultiPass()
219
149
 
220
- - rename buffer() => defBuffer()
221
- - rename fbo() => defFBO()
222
- - rename rbo() => defRBO()
223
- - rename multipass() => defMultiPass()
224
- - rename shader() => defShader()
225
- - rename texture() => defTexture()
226
- - rename cubeMap() => defTextureCubeMap()
227
- - rename floatTexture() => defTextureFloat()
228
- - rename cube() => defCubeModel()
229
- - rename quad() => defQuadModel()
150
+ # [2.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/webgl@1.0.17...@thi.ng/webgl@2.0.0) (2020-06-07)
230
151
 
152
+ ### Code Refactoring
231
153
 
154
+ - **webgl:** remove adaptDPI() ([6d49da6](https://github.com/thi-ng/umbrella/commit/6d49da610bec87fef96c77a39f1181002872f2ba))
232
155
 
156
+ ### BREAKING CHANGES
233
157
 
158
+ - **webgl:** re-use adaptDPI() from new @thi.ng/adapt-dpi pkg
159
+ - update deps
234
160
 
235
- # [0.3.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/webgl@0.2.4...@thi.ng/webgl@0.3.0) (2020-02-25)
161
+ ## [1.0.7](https://github.com/thi-ng/umbrella/compare/@thi.ng/webgl@1.0.6...@thi.ng/webgl@1.0.7) (2020-04-21)
236
162
 
163
+ ### Bug Fixes
237
164
 
238
- ### Features
165
+ - **webgl:** unbind fbo after configure ([25414b5](https://github.com/thi-ng/umbrella/commit/25414b598211c05597714bc07d16a5f6a6249e5f))
239
166
 
240
- * **webgl:** update Texture.config() default handling ([4c62d87](https://github.com/thi-ng/umbrella/commit/4c62d87016d6e73899d9c080e9c9f7fb03d841f2))
167
+ ## [1.0.5](https://github.com/thi-ng/umbrella/compare/@thi.ng/webgl@1.0.4...@thi.ng/webgl@1.0.5) (2020-04-11)
241
168
 
169
+ ### Bug Fixes
242
170
 
171
+ - **webgl:** `disableVertexAttribArray` in `Shader.unbind` ([d3eab37](https://github.com/thi-ng/umbrella/commit/d3eab37cb5e356aa80207ce445926844cc072261))
172
+ - **webgl:** add missing braces ([5e6d5bf](https://github.com/thi-ng/umbrella/commit/5e6d5bfa3b0529ec7c448d2ec1dde04716fb597e))
243
173
 
174
+ ## [1.0.4](https://github.com/thi-ng/umbrella/compare/@thi.ng/webgl@1.0.3...@thi.ng/webgl@1.0.4) (2020-04-07)
244
175
 
176
+ ### Bug Fixes
245
177
 
246
- ## [0.2.3](https://github.com/thi-ng/umbrella/compare/@thi.ng/webgl@0.2.2...@thi.ng/webgl@0.2.3) (2020-01-24)
178
+ - **webgl:** fix [#217](https://github.com/thi-ng/umbrella/issues/217), use logger for shader src ([501c82d](https://github.com/thi-ng/umbrella/commit/501c82dbde7cbb385f35ff8149cfc98e4c6e6405))
247
179
 
248
- ### Bug Fixes
180
+ # [1.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/webgl@0.3.4...@thi.ng/webgl@1.0.0) (2020-03-28)
249
181
 
250
- * **webgl:** webgl1 depth texture ([5c86165](https://github.com/thi-ng/umbrella/commit/5c861659c353076d01153d3258d3d98bc5113a1c))
182
+ ### Code Refactoring
251
183
 
252
- ## [0.2.2](https://github.com/thi-ng/umbrella/compare/@thi.ng/webgl@0.2.1...@thi.ng/webgl@0.2.2) (2019-11-30)
184
+ - **webgl:** rename factory functions ([633f693](https://github.com/thi-ng/umbrella/commit/633f69387a9ddf35919b9b6dd108068a9e05aec7))
253
185
 
254
- ### Bug Fixes
186
+ ### Features
255
187
 
256
- * **webgl:** fix PHONG shader preset, minor update LAMBERT ([792379f](https://github.com/thi-ng/umbrella/commit/792379fd507cbc9ef684a1b255f3152cb55092b9))
257
- * **webgl:** use LOGGER for warnings ([14d5025](https://github.com/thi-ng/umbrella/commit/14d502556717e1e0aded784294401ec0afc6d733))
188
+ - **webgl:** add DrawMode enums ([5adaa23](https://github.com/thi-ng/umbrella/commit/5adaa23c5aa06b2229cb55d216f424b367875217))
258
189
 
259
- ## [0.2.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/webgl@0.2.0...@thi.ng/webgl@0.2.1) (2019-11-09)
190
+ ### BREAKING CHANGES
260
191
 
261
- ### Bug Fixes
192
+ - **webgl:** #210, rename factory functions (`defXXX`)
193
+ - rename buffer() => defBuffer()
194
+ - rename fbo() => defFBO()
195
+ - rename rbo() => defRBO()
196
+ - rename multipass() => defMultiPass()
197
+ - rename shader() => defShader()
198
+ - rename texture() => defTexture()
199
+ - rename cubeMap() => defTextureCubeMap()
200
+ - rename floatTexture() => defTextureFloat()
201
+ - rename cube() => defCubeModel()
202
+ - rename quad() => defQuadModel()
262
203
 
263
- * **webgl:** add LOGGER, update initUniforms() ([4719110](https://github.com/thi-ng/umbrella/commit/471911084c8db79930cf273f222f345318671953))
264
- * **webgl:** ensure system defaults for all uniforms, update equiv checks ([39dc83f](https://github.com/thi-ng/umbrella/commit/39dc83ff49c97fb7ba70f7bbf0f7244d612c7fc8))
204
+ # [0.3.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/webgl@0.2.4...@thi.ng/webgl@0.3.0) (2020-02-25)
265
205
 
266
- # [0.2.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/webgl@0.1.7...@thi.ng/webgl@0.2.0) (2019-09-21)
206
+ ### Features
267
207
 
268
- ### Bug Fixes
208
+ - **webgl:** update Texture.config() default handling ([4c62d87](https://github.com/thi-ng/umbrella/commit/4c62d87016d6e73899d9c080e9c9f7fb03d841f2))
269
209
 
270
- * **webgl:** update extension handling in shader(), add ExtensionInfo ([12abaa0](https://github.com/thi-ng/umbrella/commit/12abaa0))
271
- * **webgl:** update samplerXX[] uniform decl types ([48b8906](https://github.com/thi-ng/umbrella/commit/48b8906))
210
+ ## [0.2.3](https://github.com/thi-ng/umbrella/compare/@thi.ng/webgl@0.2.2...@thi.ng/webgl@0.2.3) (2020-01-24)
272
211
 
273
- ### Features
212
+ ### Bug Fixes
274
213
 
275
- * **webgl:** add blending & stencil enums/types ([c8898a0](https://github.com/thi-ng/umbrella/commit/c8898a0))
276
- * **webgl:** add initial coll of blend mode presets ([58e0b04](https://github.com/thi-ng/umbrella/commit/58e0b04))
277
- * **webgl:** add readPixels/readTexture(), add ReadableTextureFormat ([355f785](https://github.com/thi-ng/umbrella/commit/355f785))
278
- * **webgl:** add renderExt to TextureFormatDecl, add FBO tex fmt checks ([180e89c](https://github.com/thi-ng/umbrella/commit/180e89c))
279
- * **webgl:** migrate multipass() & types from webgl-shadertoy pkg, reorg ([2aa31ce](https://github.com/thi-ng/umbrella/commit/2aa31ce))
280
- * **webgl:** update multipass / PassOpts ([95aba16](https://github.com/thi-ng/umbrella/commit/95aba16))
281
- * **webgl:** update texture config, split api.ts into mult files ([052552f](https://github.com/thi-ng/umbrella/commit/052552f))
282
- * **webgl:** update Texture.configure, store target, format, type, size ([9131310](https://github.com/thi-ng/umbrella/commit/9131310))
214
+ - **webgl:** webgl1 depth texture ([5c86165](https://github.com/thi-ng/umbrella/commit/5c861659c353076d01153d3258d3d98bc5113a1c))
283
215
 
284
- ## [0.1.3](https://github.com/thi-ng/umbrella/compare/@thi.ng/webgl@0.1.2...@thi.ng/webgl@0.1.3) (2019-07-31)
216
+ ## [0.2.2](https://github.com/thi-ng/umbrella/compare/@thi.ng/webgl@0.2.1...@thi.ng/webgl@0.2.2) (2019-11-30)
285
217
 
286
- ### Bug Fixes
218
+ ### Bug Fixes
287
219
 
288
- * **webgl:** update check for WEBGL_draw_buffers ([7df09d1](https://github.com/thi-ng/umbrella/commit/7df09d1))
220
+ - **webgl:** fix PHONG shader preset, minor update LAMBERT ([792379f](https://github.com/thi-ng/umbrella/commit/792379fd507cbc9ef684a1b255f3152cb55092b9))
221
+ - **webgl:** use LOGGER for warnings ([14d5025](https://github.com/thi-ng/umbrella/commit/14d502556717e1e0aded784294401ec0afc6d733))
289
222
 
290
- # 0.1.0 (2019-07-07)
223
+ ## [0.2.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/webgl@0.2.0...@thi.ng/webgl@0.2.1) (2019-11-09)
291
224
 
292
- ### Bug Fixes
225
+ ### Bug Fixes
293
226
 
294
- * **webgl:** also disable prefixes in prepareShaderSource() ([18ca4b5](https://github.com/thi-ng/umbrella/commit/18ca4b5))
295
- * **webgl:** apply ModelSpec mode in compileModel, fix/simplify draw fns ([67334a6](https://github.com/thi-ng/umbrella/commit/67334a6))
296
- * **webgl:** EXPORT_FRAGCOL webgl2 default out ([684e7fc](https://github.com/thi-ng/umbrella/commit/684e7fc))
297
- * **webgl:** gl2 texStorage2D() levels ([3d36527](https://github.com/thi-ng/umbrella/commit/3d36527))
298
- * **webgl:** uniform array & output var handling ([7e559a1](https://github.com/thi-ng/umbrella/commit/7e559a1))
299
- * **webgl:** update GPGPU texture & shader handling ([ce286ad](https://github.com/thi-ng/umbrella/commit/ce286ad))
300
- * **webgl:** update lambert shader preset ([2fea507](https://github.com/thi-ng/umbrella/commit/2fea507))
301
- * **webgl:** update texture mipmap config & handling ([2a5b87f](https://github.com/thi-ng/umbrella/commit/2a5b87f))
227
+ - **webgl:** add LOGGER, update initUniforms() ([4719110](https://github.com/thi-ng/umbrella/commit/471911084c8db79930cf273f222f345318671953))
228
+ - **webgl:** ensure system defaults for all uniforms, update equiv checks ([39dc83f](https://github.com/thi-ng/umbrella/commit/39dc83ff49c97fb7ba70f7bbf0f7244d612c7fc8))
302
229
 
303
- ### Features
230
+ # [0.2.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/webgl@0.1.7...@thi.ng/webgl@0.2.0) (2019-09-21)
304
231
 
305
- * **webgl:** add (incomplete) texture format specs ([cf7c408](https://github.com/thi-ng/umbrella/commit/cf7c408))
306
- * **webgl:** add ALIAS_TEXTURE GLSL macro ([4640ce4](https://github.com/thi-ng/umbrella/commit/4640ce4))
307
- * **webgl:** add AttribPool support, update shader ext handling, add screen2d() ([f8081f2](https://github.com/thi-ng/umbrella/commit/f8081f2))
308
- * **webgl:** add cube modelspec factory ([29791fd](https://github.com/thi-ng/umbrella/commit/29791fd))
309
- * **webgl:** add cubemap support & cubeMap() factory fn ([ad43a1c](https://github.com/thi-ng/umbrella/commit/ad43a1c))
310
- * **webgl:** add glCanvas() extension support ([07edcd0](https://github.com/thi-ng/umbrella/commit/07edcd0))
311
- * **webgl:** add glCanvas() factory fn & WebGLCanvasOpts ([a60eb2e](https://github.com/thi-ng/umbrella/commit/a60eb2e))
312
- * **webgl:** add gpgpu skeleton ([582b57a](https://github.com/thi-ng/umbrella/commit/582b57a))
313
- * **webgl:** add GPGPU texture config support ([393e04e](https://github.com/thi-ng/umbrella/commit/393e04e))
314
- * **webgl:** add IDeref support for uniform values ([d7679d6](https://github.com/thi-ng/umbrella/commit/d7679d6))
315
- * **webgl:** add initial AttribPool & VAO support, update ModelSpec & draw fns ([41cf85f](https://github.com/thi-ng/umbrella/commit/41cf85f))
316
- * **webgl:** add more GLSL/WebGL2 types ([648ed52](https://github.com/thi-ng/umbrella/commit/648ed52))
317
- * **webgl:** add option to throw error if missing GL extension ([b5da3b2](https://github.com/thi-ng/umbrella/commit/b5da3b2))
318
- * **webgl:** add screen2d() arity to extract screen size from gl ctx ([7f38f10](https://github.com/thi-ng/umbrella/commit/7f38f10))
319
- * **webgl:** add texture format consts / decls, GLSL types ([b243ebb](https://github.com/thi-ng/umbrella/commit/b243ebb))
320
- * **webgl:** add texture gens, add opt uv support for lambert shader ([4a1a5b9](https://github.com/thi-ng/umbrella/commit/4a1a5b9))
321
- * **webgl:** add texture lookup shader snippets ([8af4943](https://github.com/thi-ng/umbrella/commit/8af4943))
322
- * **webgl:** add webgl resource factory fns, update buffer() arg order ([131e551](https://github.com/thi-ng/umbrella/commit/131e551))
323
- * **webgl:** add WebGL2 support for FBO/Texture, add floatTexture() ctor fn ([8941d82](https://github.com/thi-ng/umbrella/commit/8941d82))
324
- * **webgl:** allow depth textures as fbo depth buffer, various refactorings ([d72ca70](https://github.com/thi-ng/umbrella/commit/d72ca70))
325
- * **webgl:** convert fullscreen quad into fn, uv's optional ([610f37b](https://github.com/thi-ng/umbrella/commit/610f37b))
326
- * **webgl:** import webgl pkg, ported & updated from CLJ thi.ng/geom ([f4c0634](https://github.com/thi-ng/umbrella/commit/f4c0634))
327
- * **webgl:** initial integration of shader-ast ([73faffd](https://github.com/thi-ng/umbrella/commit/73faffd))
328
- * **webgl:** TS strictNullChecks, assertions, minor type updates ([ad672c7](https://github.com/thi-ng/umbrella/commit/ad672c7))
329
- * **webgl:** update GLSL syntax impls, migrate Shader.fromSpec() ([02f94d7](https://github.com/thi-ng/umbrella/commit/02f94d7))
330
- * **webgl:** update GLSL_HEADER & LAMBERT shader preset ([05f5059](https://github.com/thi-ng/umbrella/commit/05f5059))
331
- * **webgl:** update shaderSourceFromAST(), update shader presets, remove prefixes ([6aa5715](https://github.com/thi-ng/umbrella/commit/6aa5715))
332
- * **webgl:** update uniform setters, update deps ([2be6a23](https://github.com/thi-ng/umbrella/commit/2be6a23))
333
- * **webgl:** update/add array type UniformDecl's ([1f19196](https://github.com/thi-ng/umbrella/commit/1f19196))
232
+ ### Bug Fixes
package/README.md CHANGED
@@ -83,15 +83,24 @@ Largely declarative WebGL 1.0 / 2.0 abstraction layer, partially ported
83
83
  yarn add @thi.ng/webgl
84
84
  ```
85
85
 
86
+ ES module import:
87
+
86
88
  ```html
87
- // ES module
88
- <script type="module" src="https://unpkg.com/@thi.ng/webgl?module" crossorigin></script>
89
+ <script type="module" src="https://cdn.skypack.dev/@thi.ng/webgl"></script>
90
+ ```
91
+
92
+ [Skypack documentation](https://docs.skypack.dev/)
93
+
94
+ For Node.js REPL:
95
+
96
+ ```text
97
+ # with flag only for < v16
98
+ node --experimental-repl-await
89
99
 
90
- // UMD
91
- <script src="https://unpkg.com/@thi.ng/webgl/lib/index.umd.js" crossorigin></script>
100
+ > const webgl = await import("@thi.ng/webgl");
92
101
  ```
93
102
 
94
- Package sizes (gzipped, pre-treeshake): ESM: 11.90 KB / CJS: 12.10 KB / UMD: 11.88 KB
103
+ Package sizes (gzipped, pre-treeshake): ESM: 12.14 KB
95
104
 
96
105
  ## Dependencies
97
106
 
@@ -101,6 +110,7 @@ Package sizes (gzipped, pre-treeshake): ESM: 11.90 KB / CJS: 12.10 KB / UMD: 11.
101
110
  - [@thi.ng/checks](https://github.com/thi-ng/umbrella/tree/develop/packages/checks)
102
111
  - [@thi.ng/equiv](https://github.com/thi-ng/umbrella/tree/develop/packages/equiv)
103
112
  - [@thi.ng/errors](https://github.com/thi-ng/umbrella/tree/develop/packages/errors)
113
+ - [@thi.ng/logger](https://github.com/thi-ng/umbrella/tree/develop/packages/logger)
104
114
  - [@thi.ng/matrices](https://github.com/thi-ng/umbrella/tree/develop/packages/matrices)
105
115
  - [@thi.ng/memoize](https://github.com/thi-ng/umbrella/tree/develop/packages/memoize)
106
116
  - [@thi.ng/pixel](https://github.com/thi-ng/umbrella/tree/develop/packages/pixel)
package/api/buffers.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { IBind, IRelease } from "@thi.ng/api";
2
- import type { ITexture } from "./texture";
2
+ import type { ITexture } from "./texture.js";
3
3
  export declare type IndexBufferData = Uint16Array | Uint32Array;
4
4
  export interface IWebGLBuffer<T> extends IBind<void>, IRelease {
5
5
  set(data: T, mode?: GLenum): void;
package/api/canvas.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { WebGLExtensionMap } from "./ext";
1
+ import type { WebGLExtensionMap } from "./ext.js";
2
2
  export interface WeblGLCanvasOpts {
3
3
  canvas: string | HTMLCanvasElement;
4
4
  parent: HTMLElement;
package/api/material.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { GLVec3 } from "./glsl";
1
+ import type { GLVec3 } from "./glsl.js";
2
2
  export interface Material {
3
3
  ambientCol: GLVec3;
4
4
  diffuseCol: GLVec3;
package/api/model.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import type { GLType, IObjectOf, Type } from "@thi.ng/api";
2
2
  import type { AttribPool } from "@thi.ng/vector-pools";
3
- import type { IndexBufferSpec, IWebGLBuffer } from "./buffers";
4
- import type { AttribBufferData, IShader, UniformValues } from "./shader";
5
- import type { ITexture } from "./texture";
3
+ import type { IndexBufferSpec, IWebGLBuffer } from "./buffers.js";
4
+ import type { AttribBufferData, IShader, UniformValues } from "./shader.js";
5
+ import type { ITexture } from "./texture.js";
6
6
  export declare enum DrawMode {
7
7
  POINTS = 0,
8
8
  LINES = 1,
@@ -1,9 +1,9 @@
1
1
  import type { IObjectOf } from "@thi.ng/api";
2
2
  import type { AttribPool } from "@thi.ng/vector-pools";
3
- import type { IFbo, IndexBufferSpec } from "./buffers";
4
- import type { InstancingSpec, ModelAttributeSpecs, ModelSpec } from "./model";
5
- import type { ShaderAttribSpecs, ShaderFn, ShaderState, ShaderVaryingSpecs, UniformDecl, UniformValues } from "./shader";
6
- import type { ITexture, TextureOpts } from "./texture";
3
+ import type { IFbo, IndexBufferSpec } from "./buffers.js";
4
+ import type { InstancingSpec, ModelAttributeSpecs, ModelSpec } from "./model.js";
5
+ import type { ShaderAttribSpecs, ShaderFn, ShaderState, ShaderVaryingSpecs, UniformDecl, UniformValues } from "./shader.js";
6
+ import type { ITexture, TextureOpts } from "./texture.js";
7
7
  export interface Multipass {
8
8
  start(): void;
9
9
  stop(): void;
package/api/shader.d.ts CHANGED
@@ -2,11 +2,11 @@ import type { Fn, Fn2, Fn3, Fn4, IBind, IDeref, IObjectOf, IRelease, NumericArra
2
2
  import type { Func, Sym } from "@thi.ng/shader-ast";
3
3
  import type { GLSLTarget } from "@thi.ng/shader-ast-glsl";
4
4
  import type { ReadonlyVec } from "@thi.ng/vectors";
5
- import type { BlendEquation, BlendFunc } from "./blend";
6
- import type { ExtensionBehaviors } from "./ext";
7
- import type { GLIntVec, GLIntVec2, GLIntVec3, GLIntVec4, GLMat2, GLMat3, GLMat4, GLSL, GLSLArrayType, GLSLScalarType, GLUintVec, GLVec, GLVec2, GLVec3, GLVec4 } from "./glsl";
8
- import type { ModelAttributeSpecs, ModelSpec } from "./model";
9
- import type { StencilFnParams, StencilOpParams } from "./stencil";
5
+ import type { BlendEquation, BlendFunc } from "./blend.js";
6
+ import type { ExtensionBehaviors } from "./ext.js";
7
+ import type { GLIntVec, GLIntVec2, GLIntVec3, GLIntVec4, GLMat2, GLMat3, GLMat4, GLSL, GLSLArrayType, GLSLScalarType, GLUintVec, GLVec, GLVec2, GLVec3, GLVec4 } from "./glsl.js";
8
+ import type { ModelAttributeSpecs, ModelSpec } from "./model.js";
9
+ import type { StencilFnParams, StencilOpParams } from "./stencil.js";
10
10
  export interface GLSLSyntax {
11
11
  number: number;
12
12
  attrib: Fn3<string, ShaderAttribSpec, GLSLDeclPrefixes, string>;
@@ -169,7 +169,7 @@ export interface ShaderState {
169
169
  */
170
170
  stencilMask: number;
171
171
  }
172
- export interface ShaderOpts<T> {
172
+ export interface ShaderPresetOpts<T> {
173
173
  instancePos: string;
174
174
  instanceColor: string;
175
175
  color: string;
@@ -177,6 +177,12 @@ export interface ShaderOpts<T> {
177
177
  material: Partial<T>;
178
178
  state: Partial<ShaderState>;
179
179
  }
180
+ export interface DefShaderOpts {
181
+ /**
182
+ * Number of fractional digits for GLSL float literals
183
+ */
184
+ prec: number;
185
+ }
180
186
  export interface IShader extends IBind<ModelSpec>, IRelease {
181
187
  gl: WebGLRenderingContext;
182
188
  attribs: IObjectOf<ShaderAttrib>;
package/api/texture.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { IBind, IObjectOf, IRelease } from "@thi.ng/api";
2
- import type { IConfigure } from "./buffers";
2
+ import type { IConfigure } from "./buffers.js";
3
3
  export declare enum TextureFormat {
4
4
  ALPHA = 6406,
5
5
  DEPTH_COMPONENT = 6402,
package/buffer.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { TypedArray } from "@thi.ng/api";
1
+ import { TypedArray } from "@thi.ng/api/typedarray";
2
2
  import type { AttribPool } from "@thi.ng/vector-pools";
3
- import type { IndexBufferSpec, IWebGLBuffer } from "./api/buffers";
4
- import { ModelAttributeSpecs, ModelSpec } from "./api/model";
3
+ import type { IndexBufferSpec, IWebGLBuffer } from "./api/buffers.js";
4
+ import { ModelAttributeSpecs, ModelSpec } from "./api/model.js";
5
5
  export declare class WebGLArrayBuffer<T extends TypedArray> implements IWebGLBuffer<T> {
6
6
  gl: WebGLRenderingContext;
7
7
  buffer: WebGLBuffer;
package/buffer.js CHANGED
@@ -1,7 +1,7 @@
1
- import { asGLType } from "@thi.ng/api";
2
- import { DrawMode, } from "./api/model";
3
- import { isGL2Context } from "./checks";
4
- import { error } from "./error";
1
+ import { asGLType } from "@thi.ng/api/typedarray";
2
+ import { DrawMode, } from "./api/model.js";
3
+ import { isGL2Context } from "./checks.js";
4
+ import { error } from "./error.js";
5
5
  export class WebGLArrayBuffer {
6
6
  constructor(gl, data, target = gl.ARRAY_BUFFER, mode = gl.STATIC_DRAW) {
7
7
  this.gl = gl;
package/canvas.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import type { WeblGLCanvasOpts } from "./api/canvas";
2
- import type { WebGLExtensionMap } from "./api/ext";
1
+ import type { WeblGLCanvasOpts } from "./api/canvas.js";
2
+ import type { WebGLExtensionMap } from "./api/ext.js";
3
3
  export declare const glCanvas: (opts?: Partial<WeblGLCanvasOpts>) => {
4
4
  canvas: HTMLCanvasElement;
5
5
  gl: WebGLRenderingContext;