@thi.ng/shader-ast-stdlib 0.18.0 → 0.18.2
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 +1 -1
- package/README.md +15 -14
- package/color/porter-duff.d.ts +23 -0
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -122,20 +122,21 @@ Several projects in this repo's
|
|
|
122
122
|
[/examples](https://github.com/thi-ng/umbrella/tree/develop/examples)
|
|
123
123
|
directory are using this package:
|
|
124
124
|
|
|
125
|
-
| Screenshot | Description
|
|
126
|
-
|
|
127
|
-
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/ascii-raymarch.jpg" width="240"/> | ASCII art raymarching with thi.ng/shader-ast & thi.ng/text-canvas
|
|
128
|
-
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/shader-ast/shader-ast-01.jpg" width="240"/> | 2D canvas shader emulation
|
|
129
|
-
| <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
|
|
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
|
|
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
|
|
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
|
|
133
|
-
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/shader-ast-sdf2d.jpg" width="240"/> | WebGL & JS canvas 2D SDF
|
|
134
|
-
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/shader-ast-tunnel.jpg" width="240"/> | WebGL & Canvas2D textured tunnel shader
|
|
135
|
-
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/shader-ast-workers.jpg" width="240"/> | Fork-join worker-based raymarch renderer (JS/CPU only)
|
|
136
|
-
| | Minimal multi-pass / GPGPU example
|
|
137
|
-
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/webgl-shadertoy.jpg" width="240"/> | Shadertoy-like WebGL setup
|
|
138
|
-
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/webgl-ssao.jpg" width="240"/> | WebGL screenspace ambient occlusion
|
|
125
|
+
| Screenshot | Description | Live demo | Source |
|
|
126
|
+
|:-----------------------------------------------------------------------------------------------------------------------------|:-------------------------------------------------------------------------|:----------------------------------------------------------|:---------------------------------------------------------------------------------------|
|
|
127
|
+
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/ascii-raymarch.jpg" width="240"/> | ASCII art raymarching with thi.ng/shader-ast & thi.ng/text-canvas | [Demo](https://demo.thi.ng/umbrella/ascii-raymarch/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/ascii-raymarch) |
|
|
128
|
+
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/shader-ast/shader-ast-01.jpg" width="240"/> | 2D canvas shader emulation | [Demo](https://demo.thi.ng/umbrella/shader-ast-canvas2d/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/shader-ast-canvas2d) |
|
|
129
|
+
| <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) |
|
|
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-ast-workers.jpg" width="240"/> | Fork-join worker-based raymarch renderer (JS/CPU only) | [Demo](https://demo.thi.ng/umbrella/shader-ast-workers/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/shader-ast-workers) |
|
|
136
|
+
| | 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) |
|
|
137
|
+
| <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) |
|
|
138
|
+
| <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) |
|
|
139
|
+
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/webgl-texture-paint.jpg" width="240"/> | Interactively drawing to & reading from a WebGL offscreen render texture | [Demo](https://demo.thi.ng/umbrella/webgl-texture-paint/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/webgl-texture-paint) |
|
|
139
140
|
|
|
140
141
|
## API
|
|
141
142
|
|
package/color/porter-duff.d.ts
CHANGED
|
@@ -11,6 +11,17 @@ import type { FloatTerm, Vec4Sym } from "@thi.ng/shader-ast";
|
|
|
11
11
|
* functions are used to extract blending coefficients for src/dest colors and
|
|
12
12
|
* are called with the alpha components of both colors.
|
|
13
13
|
*
|
|
14
|
+
* - `blendSrcOver(src, dest)`
|
|
15
|
+
* - `blendDestOver(src, dest)`
|
|
16
|
+
* - `blendSrcIn(src, dest)`
|
|
17
|
+
* - `blendDestIn(src, dest)`
|
|
18
|
+
* - `blendSrcOut(src, dest)`
|
|
19
|
+
* - `blendDestOut(src, dest)`
|
|
20
|
+
* - `blendSrcAtop(src, dest)`
|
|
21
|
+
* - `blendDestAtop(src, dest)`
|
|
22
|
+
* - `blendXor(src, dest)`
|
|
23
|
+
* - `blendPlus(src, dest)`
|
|
24
|
+
*
|
|
14
25
|
* Optimization only happens for cases where either `fa` and/or `fb` are
|
|
15
26
|
* {@link ZERO} or {@link ONE}.
|
|
16
27
|
*
|
|
@@ -23,7 +34,19 @@ import type { FloatTerm, Vec4Sym } from "@thi.ng/shader-ast";
|
|
|
23
34
|
* @param fb - dest coeff fn
|
|
24
35
|
*/
|
|
25
36
|
export declare const porterDuff: (name: string, fa: Fn2<FloatTerm, FloatTerm, FloatTerm>, fb: Fn2<FloatTerm, FloatTerm, FloatTerm>) => import("@thi.ng/shader-ast").TaggedFn2<"vec4", "vec4", "vec4">;
|
|
37
|
+
/**
|
|
38
|
+
* Multiplies RGB channels by alpha. Returns `vec4(col.r*col.a, col.g*col.a,
|
|
39
|
+
* col.b*col.a, col.a)`. See {@link postmultiplyAlpha} for reverse op.
|
|
40
|
+
*
|
|
41
|
+
* @param col
|
|
42
|
+
*/
|
|
26
43
|
export declare const premultiplyAlpha: (col: Vec4Sym) => import("@thi.ng/shader-ast").Lit<"vec4">;
|
|
44
|
+
/**
|
|
45
|
+
* Divides RGB channels by alpha. Returns `vec4(col.r/col.a, col.g/col.a,
|
|
46
|
+
* col.b/col.a, col.a)`. See {@link premultiplyAlpha} for reverse op.
|
|
47
|
+
*
|
|
48
|
+
* @param col
|
|
49
|
+
*/
|
|
27
50
|
export declare const postmultiplyAlpha: (col: Vec4Sym) => import("@thi.ng/shader-ast").Lit<"vec4">;
|
|
28
51
|
export declare const ZERO: () => import("@thi.ng/shader-ast").Lit<"float">;
|
|
29
52
|
export declare const ONE: () => import("@thi.ng/shader-ast").Lit<"float">;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/shader-ast-stdlib",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.2",
|
|
4
4
|
"description": "Function collection for modular GPGPU / shader programming with @thi.ng/shader-ast",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@thi.ng/api": "^8.9.
|
|
43
|
-
"@thi.ng/shader-ast": "^0.15.
|
|
42
|
+
"@thi.ng/api": "^8.9.29",
|
|
43
|
+
"@thi.ng/shader-ast": "^0.15.2"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@microsoft/api-extractor": "^7.40.1",
|
|
@@ -371,5 +371,5 @@
|
|
|
371
371
|
],
|
|
372
372
|
"year": 2019
|
|
373
373
|
},
|
|
374
|
-
"gitHead": "
|
|
374
|
+
"gitHead": "0d3bacf526db92363b43e81356e8cef18368272a\n"
|
|
375
375
|
}
|