@thi.ng/webgl 6.5.7 → 6.6.1

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # Change Log
2
2
 
3
- - **Last updated**: 2023-10-23T07:37:38Z
3
+ - **Last updated**: 2023-10-25T12:40:55Z
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,13 @@ 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
+ ## [6.6.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/webgl@6.6.0) (2023-10-25)
13
+
14
+ #### 🚀 Features
15
+
16
+ - update DefShaderOpts & defShader() ([800318f](https://github.com/thi-ng/umbrella/commit/800318f))
17
+ - add `logger` option to use temp. logger for compiled GLSL output
18
+
12
19
  ## [6.5.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/webgl@6.5.0) (2023-09-19)
13
20
 
14
21
  #### 🚀 Features
package/README.md CHANGED
@@ -96,7 +96,7 @@ For Node.js REPL:
96
96
  const webgl = await import("@thi.ng/webgl");
97
97
  ```
98
98
 
99
- Package sizes (brotli'd, pre-treeshake): ESM: 11.44 KB
99
+ Package sizes (brotli'd, pre-treeshake): ESM: 11.41 KB
100
100
 
101
101
  ## Dependencies
102
102
 
@@ -125,25 +125,26 @@ directory are using this package.
125
125
 
126
126
  A selection:
127
127
 
128
- | Screenshot | Description | Live demo | Source |
129
- |:-----------------------------------------------------------------------------------------------------------------------------|:-----------------------------------------------------------------|:----------------------------------------------------------|:---------------------------------------------------------------------------------------|
130
- | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/shader-ast-evo.jpg" width="240"/> | Evolutionary shader generation using genetic programming | [Demo](https://demo.thi.ng/umbrella/shader-ast-evo/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/shader-ast-evo) |
131
- | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/shader-ast-noise.jpg" width="240"/> | HOF shader procedural noise function composition | [Demo](https://demo.thi.ng/umbrella/shader-ast-noise/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/shader-ast-noise) |
132
- | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/shader-ast/shader-ast-raymarch.jpg" width="240"/> | WebGL & JS canvas2D raymarch shader cross-compilation | [Demo](https://demo.thi.ng/umbrella/shader-ast-raymarch/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/shader-ast-raymarch) |
133
- | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/shader-ast-sdf2d.jpg" width="240"/> | WebGL & JS canvas 2D SDF | [Demo](https://demo.thi.ng/umbrella/shader-ast-sdf2d/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/shader-ast-sdf2d) |
134
- | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/shader-ast-tunnel.jpg" width="240"/> | WebGL & Canvas2D textured tunnel shader | [Demo](https://demo.thi.ng/umbrella/shader-ast-tunnel/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/shader-ast-tunnel) |
135
- | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/shader-graph.jpg" width="240"/> | Minimal shader graph developed during livestream #2 | [Demo](https://demo.thi.ng/umbrella/shader-graph/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/shader-graph) |
136
- | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/soa-ecs-100k.png" width="240"/> | Entity Component System w/ 100k 3D particles | [Demo](https://demo.thi.ng/umbrella/soa-ecs/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/soa-ecs) |
137
- | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/webgl-channel-mixer.jpg" width="240"/> | rdom & WebGL-based image channel editor | [Demo](https://demo.thi.ng/umbrella/webgl-channel-mixer/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/webgl-channel-mixer) |
138
- | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/webgl-cube.png" width="240"/> | WebGL multi-colored cube mesh | [Demo](https://demo.thi.ng/umbrella/webgl-cube/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/webgl-cube) |
139
- | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/webgl-cubemap.jpg" width="240"/> | WebGL cube maps with async texture loading | [Demo](https://demo.thi.ng/umbrella/webgl-cubemap/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/webgl-cubemap) |
140
- | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/webgl-float-fbo.jpg" width="240"/> | Drawing to floating point offscreen / multi-pass shader pipeline | [Demo](https://demo.thi.ng/umbrella/webgl-float-fbo/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/webgl-float-fbo) |
141
- | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/webgl-game-of-life.png" width="240"/> | Game of Life implemented as WebGL2 multi-pass shader pipeline | [Demo](https://demo.thi.ng/umbrella/webgl-game-of-life/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/webgl-game-of-life) |
142
- | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/webgl-grid.jpg" width="240"/> | WebGL instancing, animated grid | [Demo](https://demo.thi.ng/umbrella/webgl-grid/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/webgl-grid) |
143
- | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/webgl-msdf.jpg" width="240"/> | WebGL MSDF text rendering & particle system | [Demo](https://demo.thi.ng/umbrella/webgl-msdf/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/webgl-msdf) |
144
- | | Minimal multi-pass / GPGPU example | [Demo](https://demo.thi.ng/umbrella/webgl-multipass/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/webgl-multipass) |
145
- | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/webgl-shadertoy.jpg" width="240"/> | Shadertoy-like WebGL setup | [Demo](https://demo.thi.ng/umbrella/webgl-shadertoy/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/webgl-shadertoy) |
146
- | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/webgl-ssao.jpg" width="240"/> | WebGL screenspace ambient occlusion | [Demo](https://demo.thi.ng/umbrella/webgl-ssao/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/webgl-ssao) |
128
+ | Screenshot | Description | Live demo | Source |
129
+ |:-----------------------------------------------------------------------------------------------------------------------------|:-------------------------------------------------------------------|:----------------------------------------------------------|:---------------------------------------------------------------------------------------|
130
+ | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/shader-ast-easings.png" width="240"/> | Shader-AST meta-programming techniques for animated function plots | [Demo](https://demo.thi.ng/umbrella/shader-ast-easings/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/shader-ast-easings) |
131
+ | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/shader-ast-evo.jpg" width="240"/> | Evolutionary shader generation using genetic programming | [Demo](https://demo.thi.ng/umbrella/shader-ast-evo/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/shader-ast-evo) |
132
+ | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/shader-ast-noise.jpg" width="240"/> | HOF shader procedural noise function composition | [Demo](https://demo.thi.ng/umbrella/shader-ast-noise/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/shader-ast-noise) |
133
+ | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/shader-ast/shader-ast-raymarch.jpg" width="240"/> | WebGL & JS canvas2D raymarch shader cross-compilation | [Demo](https://demo.thi.ng/umbrella/shader-ast-raymarch/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/shader-ast-raymarch) |
134
+ | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/shader-ast-sdf2d.jpg" width="240"/> | WebGL & JS canvas 2D SDF | [Demo](https://demo.thi.ng/umbrella/shader-ast-sdf2d/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/shader-ast-sdf2d) |
135
+ | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/shader-ast-tunnel.jpg" width="240"/> | WebGL & Canvas2D textured tunnel shader | [Demo](https://demo.thi.ng/umbrella/shader-ast-tunnel/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/shader-ast-tunnel) |
136
+ | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/shader-graph.jpg" width="240"/> | Minimal shader graph developed during livestream #2 | [Demo](https://demo.thi.ng/umbrella/shader-graph/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/shader-graph) |
137
+ | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/soa-ecs-100k.png" width="240"/> | Entity Component System w/ 100k 3D particles | [Demo](https://demo.thi.ng/umbrella/soa-ecs/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/soa-ecs) |
138
+ | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/webgl-channel-mixer.jpg" width="240"/> | rdom & WebGL-based image channel editor | [Demo](https://demo.thi.ng/umbrella/webgl-channel-mixer/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/webgl-channel-mixer) |
139
+ | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/webgl-cube.png" width="240"/> | WebGL multi-colored cube mesh | [Demo](https://demo.thi.ng/umbrella/webgl-cube/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/webgl-cube) |
140
+ | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/webgl-cubemap.jpg" width="240"/> | WebGL cube maps with async texture loading | [Demo](https://demo.thi.ng/umbrella/webgl-cubemap/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/webgl-cubemap) |
141
+ | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/webgl-float-fbo.jpg" width="240"/> | Drawing to floating point offscreen / multi-pass shader pipeline | [Demo](https://demo.thi.ng/umbrella/webgl-float-fbo/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/webgl-float-fbo) |
142
+ | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/webgl-game-of-life.png" width="240"/> | Game of Life implemented as WebGL2 multi-pass shader pipeline | [Demo](https://demo.thi.ng/umbrella/webgl-game-of-life/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/webgl-game-of-life) |
143
+ | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/webgl-grid.jpg" width="240"/> | WebGL instancing, animated grid | [Demo](https://demo.thi.ng/umbrella/webgl-grid/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/webgl-grid) |
144
+ | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/webgl-msdf.jpg" width="240"/> | WebGL MSDF text rendering & particle system | [Demo](https://demo.thi.ng/umbrella/webgl-msdf/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/webgl-msdf) |
145
+ | | Minimal multi-pass / GPGPU example | [Demo](https://demo.thi.ng/umbrella/webgl-multipass/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/webgl-multipass) |
146
+ | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/webgl-shadertoy.jpg" width="240"/> | Shadertoy-like WebGL setup | [Demo](https://demo.thi.ng/umbrella/webgl-shadertoy/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/webgl-shadertoy) |
147
+ | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/webgl-ssao.jpg" width="240"/> | WebGL screenspace ambient occlusion | [Demo](https://demo.thi.ng/umbrella/webgl-ssao/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/webgl-ssao) |
147
148
 
148
149
  ## API
149
150
 
package/api/shader.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { Fn, Fn2, Fn3, Fn4, IBind, IDeref, IObjectOf, IRelease, NumericArray } from "@thi.ng/api";
2
+ import type { ILogger } from "@thi.ng/logger";
2
3
  import type { Func, Sym } from "@thi.ng/shader-ast";
3
4
  import type { GLSLTarget } from "@thi.ng/shader-ast-glsl";
4
5
  import type { ReadonlyVec } from "@thi.ng/vectors";
@@ -178,6 +179,10 @@ export interface ShaderPresetOpts<T> {
178
179
  state: Partial<ShaderState>;
179
180
  }
180
181
  export interface DefShaderOpts {
182
+ /**
183
+ * Logger to use for compiled shader output (if not given uses current {@link LOGGER}).
184
+ */
185
+ logger: ILogger;
181
186
  /**
182
187
  * Number of fractional digits for GLSL float literals
183
188
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/webgl",
3
- "version": "6.5.7",
3
+ "version": "6.6.1",
4
4
  "description": "WebGL & GLSL abstraction layer",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -40,20 +40,20 @@
40
40
  "dependencies": {
41
41
  "@thi.ng/adapt-dpi": "^2.2.21",
42
42
  "@thi.ng/api": "^8.9.6",
43
- "@thi.ng/associative": "^6.3.13",
43
+ "@thi.ng/associative": "^6.3.15",
44
44
  "@thi.ng/checks": "^3.4.6",
45
45
  "@thi.ng/equiv": "^2.1.31",
46
46
  "@thi.ng/errors": "^2.4.0",
47
47
  "@thi.ng/logger": "^1.4.22",
48
- "@thi.ng/matrices": "^2.2.1",
48
+ "@thi.ng/matrices": "^2.2.3",
49
49
  "@thi.ng/memoize": "^3.1.39",
50
- "@thi.ng/pixel": "^4.2.28",
51
- "@thi.ng/shader-ast": "^0.12.74",
52
- "@thi.ng/shader-ast-glsl": "^0.4.74",
53
- "@thi.ng/shader-ast-stdlib": "^0.14.20",
54
- "@thi.ng/transducers": "^8.8.4",
55
- "@thi.ng/vector-pools": "^3.1.79",
56
- "@thi.ng/vectors": "^7.7.21"
50
+ "@thi.ng/pixel": "^4.3.0",
51
+ "@thi.ng/shader-ast": "^0.12.76",
52
+ "@thi.ng/shader-ast-glsl": "^0.4.76",
53
+ "@thi.ng/shader-ast-stdlib": "^0.16.0",
54
+ "@thi.ng/transducers": "^8.8.6",
55
+ "@thi.ng/vector-pools": "^3.1.81",
56
+ "@thi.ng/vectors": "^7.8.0"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@microsoft/api-extractor": "^7.38.0",
@@ -219,5 +219,5 @@
219
219
  ],
220
220
  "year": 2014
221
221
  },
222
- "gitHead": "dc7eeaba72f3c3977f2d6cc201e595ed6d68e2ad\n"
222
+ "gitHead": "502e8fa937677ff7bc4fbd0906d8c8b4b0b471e5\n"
223
223
  }
package/shader.js CHANGED
@@ -153,8 +153,9 @@ export const defShader = (gl, spec, opts) => {
153
153
  const srcFS = isFunction(spec.fs)
154
154
  ? shaderSourceFromAST(spec, "fs", version, opts)
155
155
  : prepareShaderSource(spec, "fs", version);
156
- LOGGER.debug(srcVS);
157
- LOGGER.debug(srcFS);
156
+ const logger = opts?.logger || LOGGER;
157
+ logger.debug(srcVS);
158
+ logger.debug(srcFS);
158
159
  initShaderExtensions(gl, spec.ext);
159
160
  const vs = compileShader(gl, gl.VERTEX_SHADER, srcVS);
160
161
  const fs = compileShader(gl, gl.FRAGMENT_SHADER, srcFS);