@null3d/three-compat 0.0.0-stage → 0.0.0
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/LICENSE-APACHE +176 -0
- package/LICENSE-MIT +21 -0
- package/README.md +55 -2
- package/THIRD-PARTY-NOTICES.txt +38 -0
- package/lib/cineon.wgsl-curve-glsl-0-8037a6d76f7e58b8.js +24 -0
- package/lib/cineon.wgsl-curve-wgsl-0-aa981b4d4febd643.js +24 -0
- package/lib/cineon.wgsl.d.ts +6 -0
- package/lib/cineon.wgsl.js +32 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +9 -0
- package/lib/outline-blur.wgsl-effect-glsl-0-8bba256766a6abc5.js +24 -0
- package/lib/outline-blur.wgsl-effect-wgsl-0-eec3dd26791430a4.js +24 -0
- package/lib/outline-blur.wgsl.d.ts +12 -0
- package/lib/outline-blur.wgsl.js +32 -0
- package/lib/outline-composite.wgsl-effect-glsl-0-ec3ad62a51888ba2.js +24 -0
- package/lib/outline-composite.wgsl-effect-wgsl-0-299e4470a8cc82ed.js +24 -0
- package/lib/outline-composite.wgsl.d.ts +11 -0
- package/lib/outline-composite.wgsl.js +32 -0
- package/lib/outline-edge.wgsl-effect-glsl-0-3504093a25fda552.js +24 -0
- package/lib/outline-edge.wgsl-effect-wgsl-0-81e9ba5df0070101.js +24 -0
- package/lib/outline-edge.wgsl.d.ts +12 -0
- package/lib/outline-edge.wgsl.js +32 -0
- package/lib/outline.d.ts +62 -0
- package/lib/outline.js +153 -0
- package/lib/reinhard.wgsl-curve-glsl-0-5ed283fc6d5ae39f.js +24 -0
- package/lib/reinhard.wgsl-curve-wgsl-0-5a897a3e6bdd8e93.js +24 -0
- package/lib/reinhard.wgsl.d.ts +6 -0
- package/lib/reinhard.wgsl.js +32 -0
- package/lib/tone.d.ts +16 -0
- package/lib/tone.js +17 -0
- package/lib/version.d.ts +1 -0
- package/lib/version.js +3 -0
- package/package.json +54 -5
package/LICENSE-APACHE
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
package/LICENSE-MIT
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Ramesh Nair
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,56 @@
|
|
|
1
|
-
#
|
|
1
|
+
# three.js looks for null3D
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`@null3d/three-compat` gives null3D the looks that a port of a three.js scene asks for. The engine
|
|
4
|
+
keeps them out of its core. They are Reinhard's and Cineon's tone curves, and the soft outline of
|
|
5
|
+
three.js's `OutlinePass`, with its glow, its pulse and its blurred edge.
|
|
6
|
+
|
|
7
|
+
## Use
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { defineSketch } from '@null3d/engine';
|
|
11
|
+
import { cineon, createOutlinePass } from '@null3d/three-compat';
|
|
12
|
+
|
|
13
|
+
export default defineSketch((ctx) => {
|
|
14
|
+
ctx.post.set({ toneMapping: cineon });
|
|
15
|
+
const outline = createOutlinePass(ctx, { color: '#ffd060', glow: 1, pulsePeriod: 1.5 });
|
|
16
|
+
const hero = ctx.scene.createMesh({
|
|
17
|
+
mesh: ctx.geometry.box(),
|
|
18
|
+
material: ctx.materials.standard({ color: '#808080' }),
|
|
19
|
+
});
|
|
20
|
+
hero.setOutlined(true);
|
|
21
|
+
outline.set({ strength: 5 }); // From the next frame on.
|
|
22
|
+
return {};
|
|
23
|
+
});
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
A tone curve goes to `post.set({ toneMapping })` where the three.js scene sets
|
|
27
|
+
`renderer.toneMapping`. The curves take the exposed color, as the engine's own curves do, so leave
|
|
28
|
+
out the exposure that three.js multiplies in.
|
|
29
|
+
|
|
30
|
+
The outline draws around the meshes that `setOutlined(true)` marks, and the core draws the mask that
|
|
31
|
+
it reads. The add-on turns the mask's edge into three.js's soft edge, with the `OutlinePass` settings
|
|
32
|
+
`color`, `hiddenColor`, `strength`, `thickness`, `glow` and `pulsePeriod`. The core's crisp line is
|
|
33
|
+
off; a scene that also wants it sets `post.set({ outline: { width } })` after the call.
|
|
34
|
+
|
|
35
|
+
## Costs and limits
|
|
36
|
+
|
|
37
|
+
- The outline costs five full-screen passes. The edge draws at half the render size, two blurs
|
|
38
|
+
soften it at the same size, and two wider blurs at a quarter of the size make the glow. Together
|
|
39
|
+
they shade about 0.88 of the canvas's pixels and read about nine texels for each screen pixel.
|
|
40
|
+
The effect that adds them reads two more. The core also draws the outlined meshes twice more,
|
|
41
|
+
into the mask.
|
|
42
|
+
- `thickness` widens the blur, not the number of reads, because the kernel keeps four taps each way.
|
|
43
|
+
- `pulsePeriod` costs nothing beyond a cosine in the effect. The edge fades to a quarter of its
|
|
44
|
+
strength and back over the period.
|
|
45
|
+
- The edges join the scene's color before bloom and the tone curve, as three.js's `OutlinePass` adds
|
|
46
|
+
them before its output pass. A bright edge can bloom.
|
|
47
|
+
- The edge color is one color for every outlined mesh, as three.js's `OutlinePass` has one style for
|
|
48
|
+
its selected objects. The `patternTexture` option of three.js's pass has no setting.
|
|
49
|
+
- The add-on draws the outline's mask at half the render size, where three.js reads the full-size
|
|
50
|
+
mask in its overlay. A pixel at a soft edge can therefore differ by up to one texel.
|
|
51
|
+
- The add-on works on WebGPU and WebGL2, in every thread mode.
|
|
52
|
+
|
|
53
|
+
## Licence
|
|
54
|
+
|
|
55
|
+
MIT OR Apache-2.0, the engine's licences. See `LICENSE-MIT` and `LICENSE-APACHE` at the repository
|
|
56
|
+
root. The ported three.js code and its notice are in `THIRD-PARTY-NOTICES.txt`.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
Third-party code in @null3d/three-compat
|
|
2
|
+
|
|
3
|
+
The @null3d/three-compat package ships code from the projects below. Each section names the files
|
|
4
|
+
that hold the code, its licence, and the notices that the licence asks a copy to carry.
|
|
5
|
+
|
|
6
|
+
A build with the null3D Vite plugin writes this text into null3d-third-party-notices.txt beside
|
|
7
|
+
the page, after the engine's own notices. Keep that file with the build when you publish it, or
|
|
8
|
+
show its text in your game's credits.
|
|
9
|
+
|
|
10
|
+
==============================================================================
|
|
11
|
+
three.js: the Reinhard and Cineon tone curves, and the OutlinePass effect
|
|
12
|
+
==============================================================================
|
|
13
|
+
|
|
14
|
+
Ports of three.js 0.186.1, https://github.com/mrdoob/three.js: ReinhardToneMapping and
|
|
15
|
+
CineonToneMapping from src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.js, and
|
|
16
|
+
the edge detection, gaussian blur, pulse and overlay of examples/jsm/postprocessing/OutlinePass.js.
|
|
17
|
+
|
|
18
|
+
The MIT License
|
|
19
|
+
|
|
20
|
+
Copyright © 2010-2026 three.js authors
|
|
21
|
+
|
|
22
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
23
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
24
|
+
in the Software without restriction, including without limitation the rights
|
|
25
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
26
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
27
|
+
furnished to do so, subject to the following conditions:
|
|
28
|
+
|
|
29
|
+
The above copyright notice and this permission notice shall be included in
|
|
30
|
+
all copies or substantial portions of the Software.
|
|
31
|
+
|
|
32
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
33
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
34
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
35
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
36
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
37
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
38
|
+
THE SOFTWARE.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export default __null3dShader("[{\"webgl2\":{\"permutation\":0,\"wgsl\":null,\"glsl\":{\"main\":{\"vertex\":{\"source\":-1,\"uniformBlocks\":[],\"textures\":[]},\"fragment\":{\"source\":-2,\"uniformBlocks\":[{\"name\":\"Settings_block_0Fragment\",\"group\":0,\"binding\":0}],\"textures\":[{\"name\":\"_group_0_binding_1_fs\",\"group\":0,\"binding\":1,\"sampler\":null},{\"name\":\"_group_0_binding_9_fs\",\"group\":0,\"binding\":9,\"sampler\":{\"group\":0,\"binding\":10}},{\"name\":\"_group_0_binding_11_fs\",\"group\":0,\"binding\":11,\"sampler\":{\"group\":0,\"binding\":10}},{\"name\":\"_group_0_binding_12_fs\",\"group\":0,\"binding\":12,\"sampler\":null},{\"name\":\"_group_0_binding_13_fs\",\"group\":0,\"binding\":13,\"sampler\":{\"group\":0,\"binding\":10}}]}}}},\"webgl2_bloom\":{\"permutation\":32768,\"wgsl\":null,\"glsl\":{\"main\":{\"vertex\":{\"source\":-1,\"uniformBlocks\":[],\"textures\":[]},\"fragment\":{\"source\":-3,\"uniformBlocks\":[{\"name\":\"Settings_block_0Fragment\",\"group\":0,\"binding\":0},{\"name\":\"Bloom_block_1Fragment\",\"group\":0,\"binding\":2}],\"textures\":[{\"name\":\"_group_0_binding_1_fs\",\"group\":0,\"binding\":1,\"sampler\":null},{\"name\":\"_group_0_binding_3_fs\",\"group\":0,\"binding\":3,\"sampler\":{\"group\":0,\"binding\":8}},{\"name\":\"_group_0_binding_9_fs\",\"group\":0,\"binding\":9,\"sampler\":{\"group\":0,\"binding\":10}},{\"name\":\"_group_0_binding_11_fs\",\"group\":0,\"binding\":11,\"sampler\":{\"group\":0,\"binding\":10}},{\"name\":\"_group_0_binding_12_fs\",\"group\":0,\"binding\":12,\"sampler\":null},{\"name\":\"_group_0_binding_13_fs\",\"group\":0,\"binding\":13,\"sampler\":{\"group\":0,\"binding\":10}}]}}}},\"webgl2_fxaa\":{\"permutation\":256,\"wgsl\":null,\"glsl\":{\"main\":{\"vertex\":{\"source\":-1,\"uniformBlocks\":[],\"textures\":[]},\"fragment\":{\"source\":-4,\"uniformBlocks\":[{\"name\":\"Settings_block_0Fragment\",\"group\":0,\"binding\":0}],\"textures\":[{\"name\":\"_group_0_binding_1_fs\",\"group\":0,\"binding\":1,\"sampler\":null},{\"name\":\"_group_0_binding_9_fs\",\"group\":0,\"binding\":9,\"sampler\":{\"group\":0,\"binding\":10}},{\"name\":\"_group_0_binding_11_fs\",\"group\":0,\"binding\":11,\"sampler\":{\"group\":0,\"binding\":10}},{\"name\":\"_group_0_binding_12_fs\",\"group\":0,\"binding\":12,\"sampler\":null},{\"name\":\"_group_0_binding_13_fs\",\"group\":0,\"binding\":13,\"sampler\":{\"group\":0,\"binding\":10}}]}}}},\"webgl2_fxaa_bloom\":{\"permutation\":33024,\"wgsl\":null,\"glsl\":{\"main\":{\"vertex\":{\"source\":-1,\"uniformBlocks\":[],\"textures\":[]},\"fragment\":{\"source\":-5,\"uniformBlocks\":[{\"name\":\"Settings_block_0Fragment\",\"group\":0,\"binding\":0},{\"name\":\"Bloom_block_1Fragment\",\"group\":0,\"binding\":2}],\"textures\":[{\"name\":\"_group_0_binding_1_fs\",\"group\":0,\"binding\":1,\"sampler\":null},{\"name\":\"_group_0_binding_3_fs\",\"group\":0,\"binding\":3,\"sampler\":{\"group\":0,\"binding\":8}},{\"name\":\"_group_0_binding_9_fs\",\"group\":0,\"binding\":9,\"sampler\":{\"group\":0,\"binding\":10}},{\"name\":\"_group_0_binding_11_fs\",\"group\":0,\"binding\":11,\"sampler\":{\"group\":0,\"binding\":10}},{\"name\":\"_group_0_binding_12_fs\",\"group\":0,\"binding\":12,\"sampler\":null},{\"name\":\"_group_0_binding_13_fs\",\"group\":0,\"binding\":13,\"sampler\":{\"group\":0,\"binding\":10}}]}}}}}]");
|
|
2
|
+
|
|
3
|
+
function __null3dShader(text, hot, load, index, kind) {
|
|
4
|
+
const paths = __null3dShader.paths || (__null3dShader.paths = ["{\"blocks\":[],\"lists\":[]}", "{\"blocks\":[\"#version 300 es\",\"\\nuniform vec2 null3d_depth_mapping;\\n\",\"\\nprecision highp float;\",\"\\nprecision highp int;\\n\\n\",\"\\nvec4 triangle(highp uint vertex_1) {\\n float x = ((float(((vertex_1 << 1u) & 2u)) * 2.0) - 1.0);\\n float y = ((float((vertex_1 & 2u)) * 2.0) - 1.0);\\n return vec4(x, y, 0.5, 1.0);\\n}\\n\",\"\\nvoid main() {\\n highp uint vertex = uint(gl_VertexID);\\n vec4 _e1 = triangle(vertex);\\n gl_Position = _e1;\\n gl_Position.z = gl_Position.z * null3d_depth_mapping.x + gl_Position.w * null3d_depth_mapping.y;\\n return;\\n}\\n\",\"#version 300 es\\n\",\"\\nprecision highp int;\\n\",\"\\nstruct Output {\\n float exposure;\\n highp uint tone_mapping;\\n highp uint flags;\\n highp uint render_size;\\n};\",\"\\nstruct Settings {\\n Output output_;\\n vec4 vignette;\\n vec4 lut_scale;\\n vec4 lut_offset;\\n vec4 outline;\\n vec4 outline_hidden;\\n vec4 sharpen;\\n};\",\"\\nconst highp uint DISPLAY_COLOR = 1u;\",\"\\nconst highp uint VIGNETTE = 2u;\",\"\\nconst highp uint LUT = 4u;\",\"\\nconst highp uint GRADE = 256u;\",\"\\nconst highp uint UNMAPPED = 512u;\",\"\\nconst highp uint OUTLINE = 8u;\",\"\\nconst highp uint AUTO_EXPOSURE = 16u;\",\"\\nconst highp uint RESOLVE = 32u;\",\"\\nconst highp uint DITHER = 64u;\",\"\\nconst float GRADE_SCALE = 0.96875;\\n\",\"\\nlayout(std140) uniform Settings_block_0Fragment { Settings _group_0_binding_0_fs; };\\n\",\"\\nuniform highp sampler2D _group_0_binding_1_fs;\\n\",\"\\nuniform highp sampler3D _group_0_binding_9_fs;\\n\",\"\\nuniform highp sampler2D _group_0_binding_11_fs;\\n\",\"\\nuniform highp sampler2D _group_0_binding_12_fs;\\n\",\"\\nuniform highp sampler3D _group_0_binding_13_fs;\\n\",\"\\nfloat eye_factor = 1.0;\\n\",\"\\nlayout(location = 0) out vec4 _fs2p_location0;\\n\",\"\\nvec3 linear_to_srgb(vec3 c) {\\n vec3 low = (c * 12.92);\\n vec3 high = ((1.055 * pow(c, vec3(0.41666666))) - vec3(0.055));\\n return mix(high, low, lessThanEqual(c, vec3(0.0031308)));\\n}\\n\",\"\\nvec3 limit_hdr(vec3 c_1) {\\n bvec3 nan = greaterThan((floatBitsToUint(c_1) & uvec3(2147483647u)), uvec3(2139095040u));\\n return mix(min(c_1, vec3(65472.0)), vec3(0.0), nan);\\n}\\n\",\"\\nhighp uint pcg(highp uint v) {\\n highp uint state = ((v * 747796405u) + 2891336453u);\\n highp uint word = (((state >> ((state >> 28u) + 4u)) ^ state) * 277803737u);\\n return ((word >> 22u) ^ word);\\n}\\n\",\"\\nfloat pixel_noise(vec2 pixel) {\\n highp uint _e5 = pcg(uint(pixel.y));\\n highp uint _e7 = pcg((uint(pixel.x) + _e5));\\n return ((float(((_e7 & 65535u) + (_e7 >> 16u))) / 65535.0) - 1.0);\\n}\\n\",\"\\nfloat dither(vec2 pixel_1) {\\n float _e1 = pixel_noise(pixel_1);\\n return (_e1 / 255.0);\\n}\\n\",\"\\nfloat vignette_null3d_tonemap(vec2 pixel_2, vec2 size, vec4 shape) {\\n vec2 d = vec2(0.0);\\n if ((shape.x <= 0.0)) {\\n return 1.0;\\n }\\n d = (((pixel_2 / size) - vec2(0.5)) * shape.y);\\n float _e15 = d.x;\\n d.x = (_e15 * mix(1.0, (size.x / size.y), shape.w));\\n vec2 _e23 = d;\\n vec2 _e24 = d;\\n float light_1 = pow(max((1.0 - dot(_e23, _e24)), 1e-6), shape.z);\\n return max(mix((1.0 - shape.x), 1.0, light_1), 0.0);\\n}\\n\",\"\\nfloat eye_exposure() {\\n vec4 _e4 = texelFetch(_group_0_binding_12_fs, ivec2(0), 0);\\n highp uint _e21 = _group_0_binding_0_fs.output_.flags;\\n return (((_e21 & AUTO_EXPOSURE) != 0u) ? _e4.x : 1.0);\\n}\\n\",\"\\nvec2 level_uv(highp uvec2 size_1, highp uint halvings, vec2 uv, vec2 render) {\\n vec2 extent = vec2(size_1);\\n vec2 corner = ceil((render / vec2(float((1u << halvings)))));\\n vec2 origin = vec2(0.0, (extent.y - corner.y));\\n return ((origin + clamp((uv * corner), vec2(0.5), (corner - vec2(0.5)))) / extent);\\n}\\n\",\"\\nvec2 mask_at(vec2 uv_1, vec2 render_1) {\\n vec2 _e5 = level_uv(uvec2(textureSize(_group_0_binding_11_fs, 0).xy), 0u, uv_1, render_1);\\n vec4 _e9 = textureLod(_group_0_binding_11_fs, vec2(_e5), 0.0);\\n return _e9.xy;\\n}\\n\",\"\\nfloat unmapped_at(vec2 uv_2, vec2 render_2) {\\n highp uint _e15 = _group_0_binding_0_fs.output_.flags;\\n if (((_e15 & UNMAPPED) == 0u)) {\\n return 0.0;\\n }\\n vec2 _e26 = level_uv(uvec2(textureSize(_group_0_binding_11_fs, 0).xy), 0u, uv_2, render_2);\\n vec4 _e30 = textureLod(_group_0_binding_11_fs, vec2(_e26), 0.0);\\n return _e30.z;\\n}\\n\",\"\\nvec4 outlined(vec4 color_1, vec2 uv_3, vec2 size_2, vec2 render_3) {\\n vec2 found = vec2(0.0);\\n highp uint _e15 = _group_0_binding_0_fs.output_.flags;\\n if (((_e15 & OUTLINE) == 0u)) {\\n return color_1;\\n }\\n vec2 _e23 = mask_at(uv_3, render_3);\\n float inside = _e23.x;\\n if ((inside >= 1.0)) {\\n return color_1;\\n }\\n float _e43 = _group_0_binding_0_fs.outline.w;\\n vec2 across = vec2((_e43 / size_2.x), 0.0);\\n float _e65 = _group_0_binding_0_fs.outline.w;\\n vec2 down = vec2(0.0, (_e65 / size_2.y));\\n vec2 diagonal = ((across + down) * 0.70710677);\\n vec2 slant = ((across - down) * 0.70710677);\\n vec2 _e77 = mask_at((uv_3 + across), render_3);\\n vec2 _e79 = mask_at((uv_3 - across), render_3);\\n found = max(_e77, _e79);\\n vec2 _e82 = found;\\n vec2 _e84 = mask_at((uv_3 + down), render_3);\\n vec2 _e86 = mask_at((uv_3 - down), render_3);\\n found = max(_e82, max(_e84, _e86));\\n vec2 _e89 = found;\\n vec2 _e91 = mask_at((uv_3 + diagonal), render_3);\\n vec2 _e93 = mask_at((uv_3 - diagonal), render_3);\\n found = max(_e89, max(_e91, _e93));\\n vec2 _e96 = found;\\n vec2 _e98 = mask_at((uv_3 + slant), render_3);\\n vec2 _e100 = mask_at((uv_3 - slant), render_3);\\n found = max(_e96, max(_e98, _e100));\\n float _e104 = found.y;\\n float _e106 = found.x;\\n float _e123 = _group_0_binding_0_fs.outline_hidden.w;\\n float line = (max(_e104, (_e106 * _e123)) * (1.0 - inside));\\n if ((line <= 0.0)) {\\n return color_1;\\n }\\n float _e132 = found.y;\\n float _e134 = found.x;\\n float shown = (_e132 / max(_e134, 0.0001));\\n vec4 _e153 = _group_0_binding_0_fs.outline_hidden;\\n vec4 _e170 = _group_0_binding_0_fs.outline;\\n vec3 line_color = mix(_e153.xyz, _e170.xyz, shown);\\n return ((color_1 * (1.0 - line)) + (vec4(line_color, 1.0) * line));\\n}\\n\",\"\\nvec4 glow(vec2 uv_4) {\\n return vec4(0.0);\\n}\\n\",\"\\nvec4 with_glow(vec4 texel, vec4 light) {\\n return texel;\\n}\\n\",\"\\nbool display_color() {\\n highp uint _e15 = _group_0_binding_0_fs.output_.flags;\\n return ((_e15 & DISPLAY_COLOR) != 0u);\\n}\\n\",\"\\nfloat vignette(vec2 position_1, vec2 size_3) {\\n highp uint _e15 = _group_0_binding_0_fs.output_.flags;\\n if (((_e15 & VIGNETTE) == 0u)) {\\n return 1.0;\\n }\\n vec4 _e36 = _group_0_binding_0_fs.vignette;\\n float _e39 = vignette_null3d_tonemap(position_1, size_3, _e36);\\n return _e39;\\n}\\n\",\"\\nvec4 shaded(vec4 texel_1, float shade) {\\n return vec4((texel_1.xyz * shade), texel_1.w);\\n}\\n\",\"\\nvec4 scene_texel(highp ivec2 pixel_3) {\\n vec4 texel_3 = texelFetch(_group_0_binding_1_fs, pixel_3, 0);\\n float _e6 = eye_factor;\\n vec3 _e8 = limit_hdr((texel_3.xyz * _e6));\\n return vec4(_e8, texel_3.w);\\n}\\n\",\"\\nvec4 pixel_color(vec2 position_2) {\\n vec4 _e2 = scene_texel(ivec2(position_2));\\n return _e2;\\n}\\n\",\"\\nvec3 toneCurve(vec3 color_2) {\\n vec3 x = max(vec3(0.0), (color_2 - vec3(0.004)));\\n vec3 numerator = (x * ((vec3(6.2) * x) + vec3(0.5)));\\n vec3 denominator = ((x * ((vec3(6.2) * x) + vec3(1.7))) + vec3(0.06));\\n return pow((numerator / denominator), vec3(2.2));\\n}\\n\",\"\\nvec4 display(vec4 texel_2, vec2 uv_5, vec2 render_4) {\\n highp uint flags = _group_0_binding_0_fs.output_.flags;\\n if (((flags & DISPLAY_COLOR) != 0u)) {\\n return texel_2;\\n }\\n float coverage = min(texel_2.w, 1.0);\\n if ((coverage <= 0.0)) {\\n return vec4(0.0);\\n }\\n vec3 exposed = (texel_2.xyz / vec3(coverage));\\n vec3 _e31 = toneCurve(exposed);\\n vec3 mapped = clamp(_e31, vec3(0.0), vec3(1.0));\\n float _e36 = unmapped_at(uv_5, render_4);\\n vec3 shown_1 = mix(mapped, clamp(exposed, vec3(0.0), vec3(1.0)), _e36);\\n vec3 _e38 = linear_to_srgb(shown_1);\\n vec3 encoded = clamp(_e38, vec3(0.0), vec3(1.0));\\n return vec4((encoded * coverage), coverage);\\n}\\n\",\"\\nvec4 finish(vec4 color_3, vec2 position_3) {\\n bool local = false;\\n bool local_1 = false;\\n bool local_2 = false;\\n vec3 c_2 = vec3(0.0);\\n highp uint flags_1 = _group_0_binding_0_fs.output_.flags;\\n bool grades = ((flags_1 & 262u) != 0u);\\n bool _e20 = display_color();\\n if (_e20) {\\n local = !(grades);\\n } else {\\n local = false;\\n }\\n bool _e25 = local;\\n if (_e25) {\\n local_1 = ((flags_1 & DITHER) == 0u);\\n } else {\\n local_1 = false;\\n }\\n bool _e33 = local_1;\\n if (!(_e33)) {\\n local_2 = (color_3.w <= 0.0);\\n } else {\\n local_2 = true;\\n }\\n bool _e42 = local_2;\\n if (_e42) {\\n return color_3;\\n }\\n c_2 = (color_3.xyz / vec3(color_3.w));\\n if (((flags_1 & GRADE) != 0u)) {\\n vec3 _e52 = c_2;\\n vec3 at = ((sqrt(clamp(_e52, vec3(0.0), vec3(1.0))) * GRADE_SCALE) + vec3(0.015625));\\n vec4 _e63 = textureLod(_group_0_binding_13_fs, vec3(at), 0.0);\\n c_2 = _e63.xyz;\\n }\\n if (((flags_1 & LUT) != 0u)) {\\n vec3 _e69 = c_2;\\n vec4 _e85 = _group_0_binding_0_fs.lut_scale;\\n vec4 _e103 = _group_0_binding_0_fs.lut_offset;\\n vec3 at_1 = ((_e69 * _e85.xyz) + _e103.xyz);\\n vec4 _e109 = textureLod(_group_0_binding_9_fs, vec3(at_1), 0.0);\\n vec3 graded = _e109.xyz;\\n vec3 _e111 = c_2;\\n float _e128 = _group_0_binding_0_fs.lut_scale.w;\\n c_2 = mix(_e111, graded, _e128);\\n }\\n if (((flags_1 & RESOLVE) == 0u)) {\\n vec3 _e134 = c_2;\\n float _e136 = dither(position_3);\\n c_2 = clamp((_e134 + vec3(_e136)), vec3(0.0), vec3(1.0));\\n }\\n vec3 _e140 = c_2;\\n return vec4((_e140 * color_3.w), color_3.w);\\n}\\n\",\"\\nvoid main() {\\n vec4 position = gl_FragCoord;\\n vec4 color = vec4(0.0);\\n float _e0 = eye_exposure();\\n eye_factor = _e0;\\n highp uint packed_ = _group_0_binding_0_fs.output_.render_size;\\n vec2 render_5 = vec2(float((packed_ & 65535u)), float((packed_ >> 16u)));\\n highp uint _e40 = _group_0_binding_0_fs.output_.flags;\\n bool resolving = ((_e40 & RESOLVE) != 0u);\\n vec2 scene = vec2(uvec2(textureSize(_group_0_binding_1_fs, 0).xy));\\n vec2 origin_1 = (resolving ? vec2(0.0, (scene.y - render_5.y)) : vec2(0.0));\\n vec2 local_3 = (position.xy - origin_1);\\n vec2 size_4 = (resolving ? render_5 : scene);\\n bool whole = all(equal(render_5, size_4));\\n vec2 uv_6 = (local_3 / size_4);\\n vec4 _e63 = glow(uv_6);\\n float _e64 = vignette(local_3, size_4);\\n vec2 from_top = vec2(position.x, (size_4.y - position.y));\\n vec2 place = clamp((((from_top / size_4) * render_5) - vec2(0.5)), vec2(0.0), (render_5 - vec2(1.0)));\\n vec2 first = floor(place);\\n vec2 share = (place - first);\\n if (whole) {\\n vec4 _e84 = pixel_color(position.xy);\\n vec4 _e85 = with_glow(_e84, _e63);\\n vec4 _e86 = shaded(_e85, _e64);\\n vec4 _e87 = display(_e86, uv_6, render_5);\\n color = _e87;\\n }\\n vec4 _e89 = color;\\n vec4 _e90 = outlined(_e89, uv_6, size_4, render_5);\\n vec4 _e92 = finish(_e90, position.xy);\\n _fs2p_location0 = _e92;\\n return;\\n}\\n\",\"\\nstruct Bloom {\\n vec4 glow;\\n};\",\"\\nlayout(std140) uniform Bloom_block_1Fragment { Bloom _group_0_binding_2_fs; };\\n\",\"\\nuniform highp sampler2D _group_0_binding_3_fs;\\n\",\"\\nvec4 glow(vec2 uv_4) {\\n vec2 extent_1 = vec2(uvec2(textureSize(_group_0_binding_3_fs, 0).xy));\\n vec4 _e5 = _group_0_binding_2_fs.glow;\\n vec2 corner_1 = _e5.xy;\\n vec2 origin_1 = vec2(0.0, (extent_1.y - corner_1.y));\\n vec2 at = ((origin_1 + clamp((uv_4 * corner_1), vec2(0.5), (corner_1 - vec2(0.5)))) / extent_1);\\n float _e25 = _group_0_binding_2_fs.glow.z;\\n float _e27 = eye_factor;\\n vec4 _e32 = textureLod(_group_0_binding_3_fs, vec2(at), 0.0);\\n vec3 light_2 = ((_e25 * _e27) * _e32.xyz);\\n return vec4(light_2, max(light_2.x, max(light_2.y, light_2.z)));\\n}\\n\",\"\\nvec4 with_glow(vec4 texel, vec4 light) {\\n float _e3 = _group_0_binding_2_fs.glow.w;\\n if ((_e3 > 1.5)) {\\n vec3 screened = ((texel.xyz + light.xyz) - min((texel.xyz * light.xyz), vec3(1.0)));\\n return vec4(screened, max(texel.w, light.w));\\n }\\n float _e25 = _group_0_binding_2_fs.glow.w;\\n if ((_e25 > 0.5)) {\\n return (texel + light);\\n }\\n float _e33 = _group_0_binding_2_fs.glow.z;\\n return vec4(((texel.xyz * (1.0 - _e33)) + light.xyz), max(texel.w, light.w));\\n}\\n\",\"\\nvec4 finish(vec4 color_3, vec2 position_3) {\\n bool local = false;\\n bool local_1 = false;\\n bool local_2 = false;\\n vec3 c_2 = vec3(0.0);\\n highp uint flags_1 = _group_0_binding_0_fs.output_.flags;\\n bool grades = ((flags_1 & 262u) != 0u);\\n bool _e20 = display_color();\\n if (_e20) {\\n local = !(grades);\\n } else {\\n local = false;\\n }\\n bool _e25 = local;\\n if (_e25) {\\n local_1 = ((flags_1 & DITHER) == 0u);\\n } else {\\n local_1 = false;\\n }\\n bool _e33 = local_1;\\n if (!(_e33)) {\\n local_2 = (color_3.w <= 0.0);\\n } else {\\n local_2 = true;\\n }\\n bool _e42 = local_2;\\n if (_e42) {\\n return color_3;\\n }\\n c_2 = (color_3.xyz / vec3(color_3.w));\\n if (((flags_1 & GRADE) != 0u)) {\\n vec3 _e52 = c_2;\\n vec3 at_1 = ((sqrt(clamp(_e52, vec3(0.0), vec3(1.0))) * GRADE_SCALE) + vec3(0.015625));\\n vec4 _e63 = textureLod(_group_0_binding_13_fs, vec3(at_1), 0.0);\\n c_2 = _e63.xyz;\\n }\\n if (((flags_1 & LUT) != 0u)) {\\n vec3 _e69 = c_2;\\n vec4 _e85 = _group_0_binding_0_fs.lut_scale;\\n vec4 _e103 = _group_0_binding_0_fs.lut_offset;\\n vec3 at_2 = ((_e69 * _e85.xyz) + _e103.xyz);\\n vec4 _e109 = textureLod(_group_0_binding_9_fs, vec3(at_2), 0.0);\\n vec3 graded = _e109.xyz;\\n vec3 _e111 = c_2;\\n float _e128 = _group_0_binding_0_fs.lut_scale.w;\\n c_2 = mix(_e111, graded, _e128);\\n }\\n if (((flags_1 & RESOLVE) == 0u)) {\\n vec3 _e134 = c_2;\\n float _e136 = dither(position_3);\\n c_2 = clamp((_e134 + vec3(_e136)), vec3(0.0), vec3(1.0));\\n }\\n vec3 _e140 = c_2;\\n return vec4((_e140 * color_3.w), color_3.w);\\n}\\n\",\"\\nvoid main() {\\n vec4 position = gl_FragCoord;\\n vec4 color = vec4(0.0);\\n float _e0 = eye_exposure();\\n eye_factor = _e0;\\n highp uint packed_ = _group_0_binding_0_fs.output_.render_size;\\n vec2 render_5 = vec2(float((packed_ & 65535u)), float((packed_ >> 16u)));\\n highp uint _e40 = _group_0_binding_0_fs.output_.flags;\\n bool resolving = ((_e40 & RESOLVE) != 0u);\\n vec2 scene = vec2(uvec2(textureSize(_group_0_binding_1_fs, 0).xy));\\n vec2 origin_2 = (resolving ? vec2(0.0, (scene.y - render_5.y)) : vec2(0.0));\\n vec2 local_3 = (position.xy - origin_2);\\n vec2 size_4 = (resolving ? render_5 : scene);\\n bool whole = all(equal(render_5, size_4));\\n vec2 uv_6 = (local_3 / size_4);\\n vec4 _e63 = glow(uv_6);\\n float _e64 = vignette(local_3, size_4);\\n vec2 from_top = vec2(position.x, (size_4.y - position.y));\\n vec2 place = clamp((((from_top / size_4) * render_5) - vec2(0.5)), vec2(0.0), (render_5 - vec2(1.0)));\\n vec2 first = floor(place);\\n vec2 share = (place - first);\\n if (whole) {\\n vec4 _e84 = pixel_color(position.xy);\\n vec4 _e85 = with_glow(_e84, _e63);\\n vec4 _e86 = shaded(_e85, _e64);\\n vec4 _e87 = display(_e86, uv_6, render_5);\\n color = _e87;\\n }\\n vec4 _e89 = color;\\n vec4 _e90 = outlined(_e89, uv_6, size_4, render_5);\\n vec4 _e92 = finish(_e90, position.xy);\\n _fs2p_location0 = _e92;\\n return;\\n}\\n\",\"\\nconst float GRADE_SCALE = 0.96875;\",\"\\nconst float EDGE_THRESHOLD = 0.125;\",\"\\nconst float EDGE_THRESHOLD_MIN = 0.0625;\",\"\\nconst float REDUCE_MIN = 0.0078125;\",\"\\nconst vec3 LUMINANCE = vec3(0.2126, 0.7152, 0.0722);\\n\",\"\\nvec4 scene_texel(highp ivec2 pixel_3) {\\n vec4 texel_4 = texelFetch(_group_0_binding_1_fs, pixel_3, 0);\\n float _e6 = eye_factor;\\n vec3 _e8 = limit_hdr((texel_4.xyz * _e6));\\n return vec4(_e8, texel_4.w);\\n}\\n\",\"\\nvec4 squeeze(vec4 texel_2) {\\n bool _e0 = display_color();\\n if (_e0) {\\n return texel_2;\\n }\\n return vec4((texel_2.xyz / vec3((1.0 + dot(texel_2.xyz, LUMINANCE)))), texel_2.w);\\n}\\n\",\"\\nvec4 unsqueeze(vec4 c_2) {\\n bool _e0 = display_color();\\n if (_e0) {\\n return c_2;\\n }\\n float squeezed = min(dot(c_2.xyz, LUMINANCE), 0.999);\\n return vec4((c_2.xyz / vec3((1.0 - squeezed))), c_2.w);\\n}\\n\",\"\\nvec4 texel_at(highp ivec2 pixel_4, highp ivec2 first, highp ivec2 last) {\\n vec4 _e4 = scene_texel(min(max(pixel_4, first), last));\\n vec4 _e5 = squeeze(_e4);\\n return _e5;\\n}\\n\",\"\\nvec4 tap(vec2 point, highp ivec2 first_1, highp ivec2 last_1) {\\n vec2 corner_1 = (point - vec2(0.5));\\n highp ivec2 base = ivec2(floor(corner_1));\\n vec2 f = fract(corner_1);\\n vec4 _e9 = texel_at(base, first_1, last_1);\\n vec4 _e14 = texel_at((base + ivec2(1, 0)), first_1, last_1);\\n vec4 top = mix(_e9, _e14, f.x);\\n vec4 _e21 = texel_at((base + ivec2(0, 1)), first_1, last_1);\\n vec4 _e26 = texel_at((base + ivec2(1, 1)), first_1, last_1);\\n vec4 bottom = mix(_e21, _e26, f.x);\\n return mix(top, bottom, f.y);\\n}\\n\",\"\\nfloat luma(vec4 c_3) {\\n float y = dot(c_3.xyz, LUMINANCE);\\n bool _e5 = display_color();\\n return (_e5 ? y : sqrt(y));\\n}\\n\",\"\\nvec4 pixel_color(vec2 position_2, highp ivec2 first_2, highp ivec2 last_2) {\\n bool local = false;\\n highp ivec2 pixel_5 = ivec2(position_2);\\n vec4 _e2 = scene_texel(pixel_5);\\n vec4 _e3 = squeeze(_e2);\\n float _e4 = luma(_e3);\\n vec4 _e11 = texel_at((pixel_5 + ivec2(-1, -1)), first_2, last_2);\\n float _e12 = luma(_e11);\\n vec4 _e17 = texel_at((pixel_5 + ivec2(1, -1)), first_2, last_2);\\n float _e18 = luma(_e17);\\n vec4 _e23 = texel_at((pixel_5 + ivec2(-1, 1)), first_2, last_2);\\n float _e24 = luma(_e23);\\n vec4 _e29 = texel_at((pixel_5 + ivec2(1, 1)), first_2, last_2);\\n float _e30 = luma(_e29);\\n float lowest = min(_e4, min(min(_e12, _e18), min(_e24, _e30)));\\n float highest = max(_e4, max(max(_e12, _e18), max(_e24, _e30)));\\n if (((highest - lowest) < max(EDGE_THRESHOLD_MIN, (highest * EDGE_THRESHOLD)))) {\\n return _e2;\\n }\\n vec2 along = vec2(((_e24 + _e30) - (_e12 + _e18)), ((_e12 + _e24) - (_e18 + _e30)));\\n float reduce = max(((((_e12 + _e18) + _e24) + _e30) * 0.03125), REDUCE_MIN);\\n float scale = (1.0 / (min(abs(along.x), abs(along.y)) + reduce));\\n vec2 span = clamp((along * scale), vec2(-8.0), vec2(8.0));\\n vec4 _e77 = tap((position_2 - (span / vec2(6.0))), first_2, last_2);\\n vec4 _e82 = tap((position_2 + (span / vec2(6.0))), first_2, last_2);\\n vec4 inner = (0.5 * (_e77 + _e82));\\n vec4 _e91 = tap((position_2 - (span * 0.5)), first_2, last_2);\\n vec4 _e95 = tap((position_2 + (span * 0.5)), first_2, last_2);\\n vec4 outer = ((0.5 * inner) + (0.25 * (_e91 + _e95)));\\n float _e100 = luma(outer);\\n if (!((_e100 < lowest))) {\\n local = (_e100 > highest);\\n } else {\\n local = true;\\n }\\n bool _e107 = local;\\n vec4 _e109 = unsqueeze((_e107 ? inner : outer));\\n return _e109;\\n}\\n\",\"\\nvec4 display(vec4 texel_3, vec2 uv_5, vec2 render_4) {\\n highp uint flags = _group_0_binding_0_fs.output_.flags;\\n if (((flags & DISPLAY_COLOR) != 0u)) {\\n return texel_3;\\n }\\n float coverage = min(texel_3.w, 1.0);\\n if ((coverage <= 0.0)) {\\n return vec4(0.0);\\n }\\n vec3 exposed = (texel_3.xyz / vec3(coverage));\\n vec3 _e31 = toneCurve(exposed);\\n vec3 mapped = clamp(_e31, vec3(0.0), vec3(1.0));\\n float _e36 = unmapped_at(uv_5, render_4);\\n vec3 shown_1 = mix(mapped, clamp(exposed, vec3(0.0), vec3(1.0)), _e36);\\n vec3 _e38 = linear_to_srgb(shown_1);\\n vec3 encoded = clamp(_e38, vec3(0.0), vec3(1.0));\\n return vec4((encoded * coverage), coverage);\\n}\\n\",\"\\nvec4 finish(vec4 color_3, vec2 position_3) {\\n bool local_1 = false;\\n bool local_2 = false;\\n bool local_3 = false;\\n vec3 c_4 = vec3(0.0);\\n highp uint flags_1 = _group_0_binding_0_fs.output_.flags;\\n bool grades = ((flags_1 & 262u) != 0u);\\n bool _e20 = display_color();\\n if (_e20) {\\n local_1 = !(grades);\\n } else {\\n local_1 = false;\\n }\\n bool _e25 = local_1;\\n if (_e25) {\\n local_2 = ((flags_1 & DITHER) == 0u);\\n } else {\\n local_2 = false;\\n }\\n bool _e33 = local_2;\\n if (!(_e33)) {\\n local_3 = (color_3.w <= 0.0);\\n } else {\\n local_3 = true;\\n }\\n bool _e42 = local_3;\\n if (_e42) {\\n return color_3;\\n }\\n c_4 = (color_3.xyz / vec3(color_3.w));\\n if (((flags_1 & GRADE) != 0u)) {\\n vec3 _e52 = c_4;\\n vec3 at = ((sqrt(clamp(_e52, vec3(0.0), vec3(1.0))) * GRADE_SCALE) + vec3(0.015625));\\n vec4 _e63 = textureLod(_group_0_binding_13_fs, vec3(at), 0.0);\\n c_4 = _e63.xyz;\\n }\\n if (((flags_1 & LUT) != 0u)) {\\n vec3 _e69 = c_4;\\n vec4 _e85 = _group_0_binding_0_fs.lut_scale;\\n vec4 _e103 = _group_0_binding_0_fs.lut_offset;\\n vec3 at_1 = ((_e69 * _e85.xyz) + _e103.xyz);\\n vec4 _e109 = textureLod(_group_0_binding_9_fs, vec3(at_1), 0.0);\\n vec3 graded = _e109.xyz;\\n vec3 _e111 = c_4;\\n float _e128 = _group_0_binding_0_fs.lut_scale.w;\\n c_4 = mix(_e111, graded, _e128);\\n }\\n if (((flags_1 & RESOLVE) == 0u)) {\\n vec3 _e134 = c_4;\\n float _e136 = dither(position_3);\\n c_4 = clamp((_e134 + vec3(_e136)), vec3(0.0), vec3(1.0));\\n }\\n vec3 _e140 = c_4;\\n return vec4((_e140 * color_3.w), color_3.w);\\n}\\n\",\"\\nvoid main() {\\n vec4 position = gl_FragCoord;\\n vec4 color = vec4(0.0);\\n float _e0 = eye_exposure();\\n eye_factor = _e0;\\n highp uint packed_ = _group_0_binding_0_fs.output_.render_size;\\n vec2 render_5 = vec2(float((packed_ & 65535u)), float((packed_ >> 16u)));\\n highp uint _e40 = _group_0_binding_0_fs.output_.flags;\\n bool resolving = ((_e40 & RESOLVE) != 0u);\\n vec2 scene = vec2(uvec2(textureSize(_group_0_binding_1_fs, 0).xy));\\n vec2 origin_1 = (resolving ? vec2(0.0, (scene.y - render_5.y)) : vec2(0.0));\\n vec2 local_4 = (position.xy - origin_1);\\n vec2 size_4 = (resolving ? render_5 : scene);\\n bool whole = all(equal(render_5, size_4));\\n vec2 uv_6 = (local_4 / size_4);\\n vec4 _e63 = glow(uv_6);\\n float _e64 = vignette(local_4, size_4);\\n vec2 from_top = vec2(position.x, (size_4.y - position.y));\\n vec2 place = clamp((((from_top / size_4) * render_5) - vec2(0.5)), vec2(0.0), (render_5 - vec2(1.0)));\\n vec2 first_3 = floor(place);\\n vec2 share = (place - first_3);\\n if (whole) {\\n highp ivec2 corner_first = ivec2(origin_1);\\n highp ivec2 corner_last = ivec2(((origin_1 + render_5) - vec2(1.0)));\\n vec4 _e90 = pixel_color(position.xy, corner_first, corner_last);\\n vec4 _e91 = with_glow(_e90, _e63);\\n vec4 _e92 = shaded(_e91, _e64);\\n vec4 _e93 = display(_e92, uv_6, render_5);\\n color = _e93;\\n }\\n vec4 _e95 = color;\\n vec4 _e96 = outlined(_e95, uv_6, size_4, render_5);\\n vec4 _e98 = finish(_e96, position.xy);\\n _fs2p_location0 = _e98;\\n return;\\n}\\n\",\"\\nvec4 tap(vec2 point, highp ivec2 first_1, highp ivec2 last_1) {\\n vec2 corner_2 = (point - vec2(0.5));\\n highp ivec2 base = ivec2(floor(corner_2));\\n vec2 f = fract(corner_2);\\n vec4 _e9 = texel_at(base, first_1, last_1);\\n vec4 _e14 = texel_at((base + ivec2(1, 0)), first_1, last_1);\\n vec4 top = mix(_e9, _e14, f.x);\\n vec4 _e21 = texel_at((base + ivec2(0, 1)), first_1, last_1);\\n vec4 _e26 = texel_at((base + ivec2(1, 1)), first_1, last_1);\\n vec4 bottom = mix(_e21, _e26, f.x);\\n return mix(top, bottom, f.y);\\n}\\n\",\"\\nvec4 finish(vec4 color_3, vec2 position_3) {\\n bool local_1 = false;\\n bool local_2 = false;\\n bool local_3 = false;\\n vec3 c_4 = vec3(0.0);\\n highp uint flags_1 = _group_0_binding_0_fs.output_.flags;\\n bool grades = ((flags_1 & 262u) != 0u);\\n bool _e20 = display_color();\\n if (_e20) {\\n local_1 = !(grades);\\n } else {\\n local_1 = false;\\n }\\n bool _e25 = local_1;\\n if (_e25) {\\n local_2 = ((flags_1 & DITHER) == 0u);\\n } else {\\n local_2 = false;\\n }\\n bool _e33 = local_2;\\n if (!(_e33)) {\\n local_3 = (color_3.w <= 0.0);\\n } else {\\n local_3 = true;\\n }\\n bool _e42 = local_3;\\n if (_e42) {\\n return color_3;\\n }\\n c_4 = (color_3.xyz / vec3(color_3.w));\\n if (((flags_1 & GRADE) != 0u)) {\\n vec3 _e52 = c_4;\\n vec3 at_1 = ((sqrt(clamp(_e52, vec3(0.0), vec3(1.0))) * GRADE_SCALE) + vec3(0.015625));\\n vec4 _e63 = textureLod(_group_0_binding_13_fs, vec3(at_1), 0.0);\\n c_4 = _e63.xyz;\\n }\\n if (((flags_1 & LUT) != 0u)) {\\n vec3 _e69 = c_4;\\n vec4 _e85 = _group_0_binding_0_fs.lut_scale;\\n vec4 _e103 = _group_0_binding_0_fs.lut_offset;\\n vec3 at_2 = ((_e69 * _e85.xyz) + _e103.xyz);\\n vec4 _e109 = textureLod(_group_0_binding_9_fs, vec3(at_2), 0.0);\\n vec3 graded = _e109.xyz;\\n vec3 _e111 = c_4;\\n float _e128 = _group_0_binding_0_fs.lut_scale.w;\\n c_4 = mix(_e111, graded, _e128);\\n }\\n if (((flags_1 & RESOLVE) == 0u)) {\\n vec3 _e134 = c_4;\\n float _e136 = dither(position_3);\\n c_4 = clamp((_e134 + vec3(_e136)), vec3(0.0), vec3(1.0));\\n }\\n vec3 _e140 = c_4;\\n return vec4((_e140 * color_3.w), color_3.w);\\n}\\n\",\"\\nvoid main() {\\n vec4 position = gl_FragCoord;\\n vec4 color = vec4(0.0);\\n float _e0 = eye_exposure();\\n eye_factor = _e0;\\n highp uint packed_ = _group_0_binding_0_fs.output_.render_size;\\n vec2 render_5 = vec2(float((packed_ & 65535u)), float((packed_ >> 16u)));\\n highp uint _e40 = _group_0_binding_0_fs.output_.flags;\\n bool resolving = ((_e40 & RESOLVE) != 0u);\\n vec2 scene = vec2(uvec2(textureSize(_group_0_binding_1_fs, 0).xy));\\n vec2 origin_2 = (resolving ? vec2(0.0, (scene.y - render_5.y)) : vec2(0.0));\\n vec2 local_4 = (position.xy - origin_2);\\n vec2 size_4 = (resolving ? render_5 : scene);\\n bool whole = all(equal(render_5, size_4));\\n vec2 uv_6 = (local_4 / size_4);\\n vec4 _e63 = glow(uv_6);\\n float _e64 = vignette(local_4, size_4);\\n vec2 from_top = vec2(position.x, (size_4.y - position.y));\\n vec2 place = clamp((((from_top / size_4) * render_5) - vec2(0.5)), vec2(0.0), (render_5 - vec2(1.0)));\\n vec2 first_3 = floor(place);\\n vec2 share = (place - first_3);\\n if (whole) {\\n highp ivec2 corner_first = ivec2(origin_2);\\n highp ivec2 corner_last = ivec2(((origin_2 + render_5) - vec2(1.0)));\\n vec4 _e90 = pixel_color(position.xy, corner_first, corner_last);\\n vec4 _e91 = with_glow(_e90, _e63);\\n vec4 _e92 = shaded(_e91, _e64);\\n vec4 _e93 = display(_e92, uv_6, render_5);\\n color = _e93;\\n }\\n vec4 _e95 = color;\\n vec4 _e96 = outlined(_e95, uv_6, size_4, render_5);\\n vec4 _e98 = finish(_e96, position.xy);\\n _fs2p_location0 = _e98;\\n return;\\n}\\n\"],\"lists\":[[0,1,2,3,4,5],[6,2,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,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49],[6,2,7,8,9,50,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,51,52,27,28,29,30,31,32,33,34,35,36,37,38,53,54,41,42,43,44,45,46,47,55,56],[6,2,7,8,9,10,11,12,13,14,15,16,17,18,57,58,59,60,61,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,62,63,64,65,66,67,68,46,69,70,71],[6,2,7,8,9,50,10,11,12,13,14,15,16,17,18,57,58,59,60,61,20,21,22,23,24,25,26,51,52,27,28,29,30,31,32,33,34,35,36,37,38,53,54,41,42,43,62,63,64,65,72,67,68,46,69,73,74]]}"].map((json) => ({ json })));
|
|
5
|
+
const sourceOf = (n) => {
|
|
6
|
+
const path = paths[n < 0 ? 1 : 0];
|
|
7
|
+
const tables = path.tables || (path.tables = JSON.parse(path.json));
|
|
8
|
+
return tables.lists[n < 0 ? -1 - n : n].map((block) => tables.blocks[block]).join('');
|
|
9
|
+
};
|
|
10
|
+
const walk = (item) => {
|
|
11
|
+
for (const key in item) {
|
|
12
|
+
const field = item[key];
|
|
13
|
+
if (key === "source" && typeof field === 'number')
|
|
14
|
+
Object.defineProperty(item, key, { get: () => sourceOf(field), enumerable: true });
|
|
15
|
+
else if (field !== null && typeof field === 'object') walk(field);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
const shader = JSON.parse(text);
|
|
19
|
+
walk(shader);
|
|
20
|
+
if (hot !== undefined) shader.hot = hot;
|
|
21
|
+
if (load !== undefined)
|
|
22
|
+
shader.builds = (target, set) => load(kind, target, set).then((module) => module.default[index] || {});
|
|
23
|
+
return shader;
|
|
24
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export default __null3dShader("[{\"webgpu\":{\"permutation\":0,\"wgsl\":{\"source\":0,\"pipelines\":{\"main\":{\"vertex\":\"vs\",\"fragment\":\"fs\"}}},\"glsl\":null},\"webgpu_bloom\":{\"permutation\":32768,\"wgsl\":{\"source\":1,\"pipelines\":{\"main\":{\"vertex\":\"vs\",\"fragment\":\"fs\"}}},\"glsl\":null},\"webgpu_fxaa\":{\"permutation\":256,\"wgsl\":{\"source\":2,\"pipelines\":{\"main\":{\"vertex\":\"vs\",\"fragment\":\"fs\"}}},\"glsl\":null},\"webgpu_fxaa_bloom\":{\"permutation\":33024,\"wgsl\":{\"source\":3,\"pipelines\":{\"main\":{\"vertex\":\"vs\",\"fragment\":\"fs\"}}},\"glsl\":null}}]");
|
|
2
|
+
|
|
3
|
+
function __null3dShader(text, hot, load, index, kind) {
|
|
4
|
+
const paths = __null3dShader.paths || (__null3dShader.paths = ["{\"blocks\":[\"struct Output {\\n exposure: f32,\\n tone_mapping: u32,\\n flags: u32,\\n render_size: u32,\\n}\\n\",\"\\nstruct Settings {\\n output: Output,\\n vignette: vec4<f32>,\\n lut_scale: vec4<f32>,\\n lut_offset: vec4<f32>,\\n outline: vec4<f32>,\\n outline_hidden: vec4<f32>,\\n sharpen: vec4<f32>,\\n}\\n\",\"\\nconst ACES_INPUT: mat3x3<f32> = mat3x3<f32>(vec3<f32>(0.59719f, 0.076f, 0.0284f), vec3<f32>(0.35458f, 0.90834f, 0.13383f), vec3<f32>(0.04823f, 0.01566f, 0.83777f));\",\"\\nconst ACES_OUTPUT: mat3x3<f32> = mat3x3<f32>(vec3<f32>(1.60475f, -0.10208f, -0.00327f), vec3<f32>(-0.53108f, 1.10813f, -0.07276f), vec3<f32>(-0.07367f, -0.00605f, 1.07602f));\",\"\\nconst LINEAR_SRGB_TO_LINEAR_REC2020_: mat3x3<f32> = mat3x3<f32>(vec3<f32>(0.6274f, 0.0691f, 0.0164f), vec3<f32>(0.3293f, 0.9195f, 0.088f), vec3<f32>(0.0433f, 0.0113f, 0.8956f));\",\"\\nconst AGX_INSET: mat3x3<f32> = mat3x3<f32>(vec3<f32>(0.85662717f, 0.13731897f, 0.11189821f), vec3<f32>(0.09512124f, 0.761242f, 0.076799415f), vec3<f32>(0.048251607f, 0.10143904f, 0.81130236f));\",\"\\nconst AGX_OUTSET: mat3x3<f32> = mat3x3<f32>(vec3<f32>(1.1271006f, -0.14132977f, -0.14132977f), vec3<f32>(-0.11060664f, 1.1578237f, -0.11060664f), vec3<f32>(-0.016493939f, -0.016493939f, 1.2519364f));\",\"\\nconst LINEAR_REC2020_TO_LINEAR_SRGB: mat3x3<f32> = mat3x3<f32>(vec3<f32>(1.6605f, -0.1246f, -0.0182f), vec3<f32>(-0.5876f, 1.1329f, -0.1006f), vec3<f32>(-0.0728f, -0.0083f, 1.1187f));\",\"\\nconst AGX_PUNCHY_SATURATION: f32 = 1.4f;\",\"\\nconst DISPLAY_COLOR: u32 = 1u;\",\"\\nconst VIGNETTE: u32 = 2u;\",\"\\nconst LUT: u32 = 4u;\",\"\\nconst GRADE: u32 = 256u;\",\"\\nconst UNMAPPED: u32 = 512u;\",\"\\nconst OUTLINE: u32 = 8u;\",\"\\nconst AUTO_EXPOSURE: u32 = 16u;\",\"\\nconst RESOLVE: u32 = 32u;\",\"\\nconst DITHER: u32 = 64u;\",\"\\nconst SHARPEN: u32 = 128u;\",\"\\nconst GSR_EDGE: f32 = 0.03137255f;\",\"\\nconst GSR_TAP: f32 = 0.55f;\",\"\\nconst GSR_SHARPNESS: f32 = 2f;\",\"\\nconst GSR_DELTA_LIMIT: f32 = 0.09019608f;\",\"\\nconst RCAS_LEAST: f32 = 1e-4f;\",\"\\nconst RCAS_LIMIT: f32 = 0.1875f;\",\"\\nconst GRADE_SIZE: f32 = 32f;\",\"\\nconst GRADE_SCALE: f32 = 0.96875f;\",\"\\nconst GRADE_OFFSET: f32 = 0.015625f;\\n\",\"\\n@group(0) @binding(0)\",\"\\nvar<uniform> settings: Settings;\",\"\\n@group(0) @binding(1)\",\"\\nvar scene_color: texture_2d<f32>;\",\"\\n@group(0) @binding(9)\",\"\\nvar lut: texture_3d<f32>;\",\"\\n@group(0) @binding(10)\",\"\\nvar lut_sampler: sampler;\",\"\\n@group(0) @binding(11)\",\"\\nvar outline_mask: texture_2d<f32>;\",\"\\n@group(0) @binding(12)\",\"\\nvar exposure_texel: texture_2d<f32>;\",\"\\n@group(0) @binding(13)\",\"\\nvar grade_table: texture_3d<f32>;\",\"\\nvar<private> eye_factor: f32 = 1f;\\n\",\"\\nfn linear_to_srgb(c: vec3<f32>) -> vec3<f32> {\\n let low = (c * 12.92f);\\n let high = ((1.055f * pow(c, vec3(0.41666666f))) - vec3(0.055f));\\n return select(high, low, (c <= vec3(0.0031308f)));\\n}\\n\",\"\\nfn limit_hdr(c_1: vec3<f32>) -> vec3<f32> {\\n let nan = ((bitcast<vec3<u32>>(c_1) & vec3(2147483647u)) > vec3(2139095040u));\\n return select(min(c_1, vec3(65472f)), vec3(0f), nan);\\n}\\n\",\"\\nfn pcg(v: u32) -> u32 {\\n let state = ((v * 747796405u) + 2891336453u);\\n let word = (((state >> ((state >> 28u) + 4u)) ^ state) * 277803737u);\\n return ((word >> 22u) ^ word);\\n}\\n\",\"\\nfn pixel_noise(pixel: vec2<f32>) -> f32 {\\n let _e5 = pcg(u32(pixel.y));\\n let _e7 = pcg((u32(pixel.x) + _e5));\\n return ((f32(((_e7 & 65535u) + (_e7 >> 16u))) / 65535f) - 1f);\\n}\\n\",\"\\nfn dither(pixel_1: vec2<f32>) -> f32 {\\n let _e1 = pixel_noise(pixel_1);\\n return (_e1 / 255f);\\n}\\n\",\"\\nfn vignette_null3d_tonemap(pixel_2: vec2<f32>, size: vec2<f32>, shape: vec4<f32>) -> f32 {\\n var d: vec2<f32>;\\n\\n if (shape.x <= 0f) {\\n return 1f;\\n }\\n d = (((pixel_2 / size) - vec2(0.5f)) * shape.y);\\n let _e15 = d.x;\\n d.x = (_e15 * mix(1f, (size.x / size.y), shape.w));\\n let _e23 = d;\\n let _e24 = d;\\n let light_1 = pow(max((1f - dot(_e23, _e24)), 1e-6f), shape.z);\\n return max(mix((1f - shape.x), 1f, light_1), 0f);\\n}\\n\",\"\\nfn triangle(vertex_1: u32) -> vec4<f32> {\\n let x = ((f32(((vertex_1 << 1u) & 2u)) * 2f) - 1f);\\n let y = ((f32((vertex_1 & 2u)) * 2f) - 1f);\\n return vec4<f32>(x, y, 0.5f, 1f);\\n}\\n\",\"\\nfn eye_exposure() -> f32 {\\n let _e4 = textureLoad(exposure_texel, vec2(0i), 0i);\\n let _e9 = settings.output.flags;\\n return select(1f, _e4.x, ((_e9 & AUTO_EXPOSURE) != 0u));\\n}\\n\",\"\\nfn level_uv(size_1: vec2<u32>, halvings: u32, uv: vec2<f32>, render: vec2<f32>) -> vec2<f32> {\\n let extent = vec2<f32>(size_1);\\n let corner = ceil((render / vec2(f32((1u << halvings)))));\\n let origin = vec2(0f);\\n return ((origin + clamp((uv * corner), vec2(0.5f), (corner - vec2(0.5f)))) / extent);\\n}\\n\",\"\\nfn mask_at(uv_1: vec2<f32>, render_1: vec2<f32>) -> vec2<f32> {\\n let _e1 = textureDimensions(outline_mask);\\n let _e5 = level_uv(_e1, 0u, uv_1, render_1);\\n let _e9 = textureSampleLevel(outline_mask, lut_sampler, _e5, 0f);\\n return _e9.xy;\\n}\\n\",\"\\nfn unmapped_at(uv_2: vec2<f32>, render_2: vec2<f32>) -> f32 {\\n let _e3 = settings.output.flags;\\n if ((_e3 & UNMAPPED) == 0u) {\\n return 0f;\\n }\\n let _e10 = textureDimensions(outline_mask);\\n let _e14 = level_uv(_e10, 0u, uv_2, render_2);\\n let _e18 = textureSampleLevel(outline_mask, lut_sampler, _e14, 0f);\\n return _e18.z;\\n}\\n\",\"\\nfn outlined(color_1: vec4<f32>, uv_3: vec2<f32>, size_2: vec2<f32>, render_3: vec2<f32>) -> vec4<f32> {\\n var found: vec2<f32>;\\n\\n let _e3 = settings.output.flags;\\n if ((_e3 & OUTLINE) == 0u) {\\n return color_1;\\n }\\n let _e11 = mask_at(uv_3, render_3);\\n let inside = _e11.x;\\n if (inside >= 1f) {\\n return color_1;\\n }\\n let _e19 = settings.outline.w;\\n let across = vec2<f32>((_e19 / size_2.x), 0f);\\n let _e27 = settings.outline.w;\\n let down = vec2<f32>(0f, (_e27 / size_2.y));\\n let diagonal = ((across + down) * 0.70710677f);\\n let slant = ((across - down) * 0.70710677f);\\n let _e39 = mask_at((uv_3 + across), render_3);\\n let _e41 = mask_at((uv_3 - across), render_3);\\n found = max(_e39, _e41);\\n let _e44 = found;\\n let _e46 = mask_at((uv_3 + down), render_3);\\n let _e48 = mask_at((uv_3 - down), render_3);\\n found = max(_e44, max(_e46, _e48));\\n let _e51 = found;\\n let _e53 = mask_at((uv_3 + diagonal), render_3);\\n let _e55 = mask_at((uv_3 - diagonal), render_3);\\n found = max(_e51, max(_e53, _e55));\\n let _e58 = found;\\n let _e60 = mask_at((uv_3 + slant), render_3);\\n let _e62 = mask_at((uv_3 - slant), render_3);\\n found = max(_e58, max(_e60, _e62));\\n let _e66 = found.y;\\n let _e68 = found.x;\\n let _e72 = settings.outline_hidden.w;\\n let line = (max(_e66, (_e68 * _e72)) * (1f - inside));\\n if (line <= 0f) {\\n return color_1;\\n }\\n let _e81 = found.y;\\n let _e83 = found.x;\\n let shown = (_e81 / max(_e83, 1e-4f));\\n let _e89 = settings.outline_hidden;\\n let _e93 = settings.outline;\\n let line_color = mix(_e89.xyz, _e93.xyz, shown);\\n return ((color_1 * (1f - line)) + (vec4<f32>(line_color, 1f) * line));\\n}\\n\",\"\\nfn glow(uv_4: vec2<f32>) -> vec4<f32> {\\n return vec4(0f);\\n}\\n\",\"\\nfn with_glow(texel: vec4<f32>, light: vec4<f32>) -> vec4<f32> {\\n return texel;\\n}\\n\",\"\\nfn display_color() -> bool {\\n let _e3 = settings.output.flags;\\n return ((_e3 & DISPLAY_COLOR) != 0u);\\n}\\n\",\"\\nfn vignette(position_1: vec2<f32>, size_3: vec2<f32>) -> f32 {\\n let _e3 = settings.output.flags;\\n if ((_e3 & VIGNETTE) == 0u) {\\n return 1f;\\n }\\n let _e11 = settings.vignette;\\n let _e14 = vignette_null3d_tonemap(position_1, size_3, _e11);\\n return _e14;\\n}\\n\",\"\\nfn shaded(texel_1: vec4<f32>, shade: f32) -> vec4<f32> {\\n return vec4<f32>((texel_1.xyz * shade), texel_1.w);\\n}\\n\",\"\\nfn scene_texel(pixel_3: vec2<i32>) -> vec4<f32> {\\n let texel_3 = textureLoad(scene_color, pixel_3, 0i);\\n let _e6 = eye_factor;\\n let _e8 = limit_hdr((texel_3.xyz * _e6));\\n return vec4<f32>(_e8, texel_3.w);\\n}\\n\",\"\\nfn pixel_color(position_2: vec2<f32>) -> vec4<f32> {\\n let _e2 = scene_texel(vec2<i32>(position_2));\\n return _e2;\\n}\\n\",\"\\nfn toneCurve(color_2: vec3<f32>) -> vec3<f32> {\\n let x_1 = max(vec3(0f), (color_2 - vec3(4e-3f)));\\n let numerator = (x_1 * ((vec3(6.2f) * x_1) + vec3(0.5f)));\\n let denominator = ((x_1 * ((vec3(6.2f) * x_1) + vec3(1.7f))) + vec3(0.06f));\\n return pow((numerator / denominator), vec3(2.2f));\\n}\\n\",\"\\nfn display(texel_2: vec4<f32>, uv_5: vec2<f32>, render_4: vec2<f32>) -> vec4<f32> {\\n let flags = settings.output.flags;\\n if ((flags & DISPLAY_COLOR) != 0u) {\\n return texel_2;\\n }\\n let coverage = min(texel_2.w, 1f);\\n if (coverage <= 0f) {\\n return vec4(0f);\\n }\\n let exposed = (texel_2.xyz / vec3(coverage));\\n let _e19 = toneCurve(exposed);\\n let mapped = saturate(_e19);\\n let _e24 = unmapped_at(uv_5, render_4);\\n let shown_1 = mix(mapped, saturate(exposed), _e24);\\n let _e26 = linear_to_srgb(shown_1);\\n let encoded = saturate(_e26);\\n return vec4<f32>((encoded * coverage), coverage);\\n}\\n\",\"\\nfn finish(color_3: vec4<f32>, position_3: vec2<f32>) -> vec4<f32> {\\n var local: bool;\\n var local_1: bool;\\n var local_2: bool;\\n var c_2: vec3<f32>;\\n\\n let flags_1 = settings.output.flags;\\n let grades = ((flags_1 & 262u) != 0u);\\n let _e8 = display_color();\\n if _e8 {\\n local = !(grades);\\n } else {\\n local = false;\\n }\\n let _e13 = local;\\n if _e13 {\\n local_1 = ((flags_1 & DITHER) == 0u);\\n } else {\\n local_1 = false;\\n }\\n let _e21 = local_1;\\n if !(_e21) {\\n local_2 = (color_3.w <= 0f);\\n } else {\\n local_2 = true;\\n }\\n let _e30 = local_2;\\n if _e30 {\\n return color_3;\\n }\\n c_2 = (color_3.xyz / vec3(color_3.w));\\n if ((flags_1 & GRADE) != 0u) {\\n let _e40 = c_2;\\n let at = ((sqrt(saturate(_e40)) * GRADE_SCALE) + vec3(0.015625f));\\n let _e51 = textureSampleLevel(grade_table, lut_sampler, at, 0f);\\n c_2 = _e51.xyz;\\n }\\n if ((flags_1 & LUT) != 0u) {\\n let _e57 = c_2;\\n let _e60 = settings.lut_scale;\\n let _e65 = settings.lut_offset;\\n let at_1 = ((_e57 * _e60.xyz) + _e65.xyz);\\n let _e71 = textureSampleLevel(lut, lut_sampler, at_1, 0f);\\n let graded = _e71.xyz;\\n let _e73 = c_2;\\n let _e77 = settings.lut_scale.w;\\n c_2 = mix(_e73, graded, _e77);\\n }\\n if ((flags_1 & RESOLVE) == 0u) {\\n let _e83 = c_2;\\n let _e85 = dither(position_3);\\n c_2 = saturate((_e83 + vec3(_e85)));\\n }\\n let _e89 = c_2;\\n return vec4<f32>((_e89 * color_3.w), color_3.w);\\n}\\n\",\"\\n@vertex\",\"\\nfn vs(@builtin(vertex_index) vertex: u32) -> @builtin(position) vec4<f32> {\\n let _e1 = triangle(vertex);\\n return _e1;\\n}\\n\",\"\\n@fragment\",\"\\nfn fs(@builtin(position) position: vec4<f32>) -> @location(0) vec4<f32> {\\n var color: vec4<f32> = vec4(0f);\\n\\n let _e2 = eye_exposure();\\n eye_factor = _e2;\\n let packed = settings.output.render_size;\\n let render_5 = vec2<f32>(f32((packed & 65535u)), f32((packed >> 16u)));\\n let _e18 = settings.output.flags;\\n let resolving = ((_e18 & RESOLVE) != 0u);\\n let _e24 = textureDimensions(scene_color);\\n let scene = vec2<f32>(_e24);\\n let origin_1 = vec2(0f);\\n let local_3 = (position.xy - origin_1);\\n let size_4 = select(scene, render_5, resolving);\\n let whole = all((render_5 == size_4));\\n let uv_6 = (local_3 / size_4);\\n let _e35 = glow(uv_6);\\n let _e36 = vignette(local_3, size_4);\\n let from_top = position.xy;\\n let place = clamp((((from_top / size_4) * render_5) - vec2(0.5f)), vec2(0f), (render_5 - vec2(1f)));\\n let first = floor(place);\\n let share = (place - first);\\n if whole {\\n let _e52 = pixel_color(position.xy);\\n let _e53 = with_glow(_e52, _e35);\\n let _e54 = shaded(_e53, _e36);\\n let _e55 = display(_e54, uv_6, render_5);\\n color = _e55;\\n }\\n let _e57 = color;\\n let _e58 = outlined(_e57, uv_6, size_4, render_5);\\n let _e60 = finish(_e58, position.xy);\\n return _e60;\\n}\\n\",\"\\nstruct Bloom {\\n glow: vec4<f32>,\\n}\\n\",\"\\nvar<private> eye_factor: f32 = 1f;\",\"\\n@group(0) @binding(2)\",\"\\nvar<uniform> bloom: Bloom;\",\"\\n@group(0) @binding(3)\",\"\\nvar bloom_base: texture_2d<f32>;\",\"\\n@group(0) @binding(8)\",\"\\nvar bloom_sampler: sampler;\\n\",\"\\nfn glow(uv_4: vec2<f32>) -> vec4<f32> {\\n let _e1 = textureDimensions(bloom_base);\\n let extent_1 = vec2<f32>(_e1);\\n let _e5 = bloom.glow;\\n let corner_1 = _e5.xy;\\n let origin_1 = vec2(0f);\\n let at = ((origin_1 + clamp((uv_4 * corner_1), vec2(0.5f), (corner_1 - vec2(0.5f)))) / extent_1);\\n let _e22 = bloom.glow.z;\\n let _e24 = eye_factor;\\n let _e29 = textureSampleLevel(bloom_base, bloom_sampler, at, 0f);\\n let light_2 = ((_e22 * _e24) * _e29.xyz);\\n return vec4<f32>(light_2, max(light_2.x, max(light_2.y, light_2.z)));\\n}\\n\",\"\\nfn with_glow(texel: vec4<f32>, light: vec4<f32>) -> vec4<f32> {\\n let _e3 = bloom.glow.w;\\n if (_e3 > 1.5f) {\\n let screened = ((texel.xyz + light.xyz) - min((texel.xyz * light.xyz), vec3(1f)));\\n return vec4<f32>(screened, max(texel.w, light.w));\\n }\\n let _e25 = bloom.glow.w;\\n if (_e25 > 0.5f) {\\n return (texel + light);\\n }\\n let _e33 = bloom.glow.z;\\n return vec4<f32>(((texel.xyz * (1f - _e33)) + light.xyz), max(texel.w, light.w));\\n}\\n\",\"\\nfn finish(color_3: vec4<f32>, position_3: vec2<f32>) -> vec4<f32> {\\n var local: bool;\\n var local_1: bool;\\n var local_2: bool;\\n var c_2: vec3<f32>;\\n\\n let flags_1 = settings.output.flags;\\n let grades = ((flags_1 & 262u) != 0u);\\n let _e8 = display_color();\\n if _e8 {\\n local = !(grades);\\n } else {\\n local = false;\\n }\\n let _e13 = local;\\n if _e13 {\\n local_1 = ((flags_1 & DITHER) == 0u);\\n } else {\\n local_1 = false;\\n }\\n let _e21 = local_1;\\n if !(_e21) {\\n local_2 = (color_3.w <= 0f);\\n } else {\\n local_2 = true;\\n }\\n let _e30 = local_2;\\n if _e30 {\\n return color_3;\\n }\\n c_2 = (color_3.xyz / vec3(color_3.w));\\n if ((flags_1 & GRADE) != 0u) {\\n let _e40 = c_2;\\n let at_1 = ((sqrt(saturate(_e40)) * GRADE_SCALE) + vec3(0.015625f));\\n let _e51 = textureSampleLevel(grade_table, lut_sampler, at_1, 0f);\\n c_2 = _e51.xyz;\\n }\\n if ((flags_1 & LUT) != 0u) {\\n let _e57 = c_2;\\n let _e60 = settings.lut_scale;\\n let _e65 = settings.lut_offset;\\n let at_2 = ((_e57 * _e60.xyz) + _e65.xyz);\\n let _e71 = textureSampleLevel(lut, lut_sampler, at_2, 0f);\\n let graded = _e71.xyz;\\n let _e73 = c_2;\\n let _e77 = settings.lut_scale.w;\\n c_2 = mix(_e73, graded, _e77);\\n }\\n if ((flags_1 & RESOLVE) == 0u) {\\n let _e83 = c_2;\\n let _e85 = dither(position_3);\\n c_2 = saturate((_e83 + vec3(_e85)));\\n }\\n let _e89 = c_2;\\n return vec4<f32>((_e89 * color_3.w), color_3.w);\\n}\\n\",\"\\nfn fs(@builtin(position) position: vec4<f32>) -> @location(0) vec4<f32> {\\n var color: vec4<f32> = vec4(0f);\\n\\n let _e2 = eye_exposure();\\n eye_factor = _e2;\\n let packed = settings.output.render_size;\\n let render_5 = vec2<f32>(f32((packed & 65535u)), f32((packed >> 16u)));\\n let _e18 = settings.output.flags;\\n let resolving = ((_e18 & RESOLVE) != 0u);\\n let _e24 = textureDimensions(scene_color);\\n let scene = vec2<f32>(_e24);\\n let origin_2 = vec2(0f);\\n let local_3 = (position.xy - origin_2);\\n let size_4 = select(scene, render_5, resolving);\\n let whole = all((render_5 == size_4));\\n let uv_6 = (local_3 / size_4);\\n let _e35 = glow(uv_6);\\n let _e36 = vignette(local_3, size_4);\\n let from_top = position.xy;\\n let place = clamp((((from_top / size_4) * render_5) - vec2(0.5f)), vec2(0f), (render_5 - vec2(1f)));\\n let first = floor(place);\\n let share = (place - first);\\n if whole {\\n let _e52 = pixel_color(position.xy);\\n let _e53 = with_glow(_e52, _e35);\\n let _e54 = shaded(_e53, _e36);\\n let _e55 = display(_e54, uv_6, render_5);\\n color = _e55;\\n }\\n let _e57 = color;\\n let _e58 = outlined(_e57, uv_6, size_4, render_5);\\n let _e60 = finish(_e58, position.xy);\\n return _e60;\\n}\\n\",\"\\nconst GRADE_OFFSET: f32 = 0.015625f;\",\"\\nconst EDGE_THRESHOLD: f32 = 0.125f;\",\"\\nconst EDGE_THRESHOLD_MIN: f32 = 0.0625f;\",\"\\nconst REDUCE_MIN: f32 = 0.0078125f;\",\"\\nconst REDUCE_MUL: f32 = 0.125f;\",\"\\nconst SPAN_MAX: f32 = 8f;\",\"\\nconst LUMINANCE: vec3<f32> = vec3<f32>(0.2126f, 0.7152f, 0.0722f);\\n\",\"\\nfn scene_texel(pixel_3: vec2<i32>) -> vec4<f32> {\\n let texel_4 = textureLoad(scene_color, pixel_3, 0i);\\n let _e6 = eye_factor;\\n let _e8 = limit_hdr((texel_4.xyz * _e6));\\n return vec4<f32>(_e8, texel_4.w);\\n}\\n\",\"\\nfn squeeze(texel_2: vec4<f32>) -> vec4<f32> {\\n let _e0 = display_color();\\n if _e0 {\\n return texel_2;\\n }\\n return vec4<f32>((texel_2.xyz / vec3((1f + dot(texel_2.xyz, LUMINANCE)))), texel_2.w);\\n}\\n\",\"\\nfn unsqueeze(c_2: vec4<f32>) -> vec4<f32> {\\n let _e0 = display_color();\\n if _e0 {\\n return c_2;\\n }\\n let squeezed = min(dot(c_2.xyz, LUMINANCE), 0.999f);\\n return vec4<f32>((c_2.xyz / vec3((1f - squeezed))), c_2.w);\\n}\\n\",\"\\nfn texel_at(pixel_4: vec2<i32>, first: vec2<i32>, last: vec2<i32>) -> vec4<f32> {\\n let _e4 = scene_texel(clamp(pixel_4, first, last));\\n let _e5 = squeeze(_e4);\\n return _e5;\\n}\\n\",\"\\nfn tap(point: vec2<f32>, first_1: vec2<i32>, last_1: vec2<i32>) -> vec4<f32> {\\n let corner_1 = (point - vec2(0.5f));\\n let base = vec2<i32>(floor(corner_1));\\n let f = fract(corner_1);\\n let _e9 = texel_at(base, first_1, last_1);\\n let _e14 = texel_at((base + vec2<i32>(1i, 0i)), first_1, last_1);\\n let top = mix(_e9, _e14, f.x);\\n let _e21 = texel_at((base + vec2<i32>(0i, 1i)), first_1, last_1);\\n let _e26 = texel_at((base + vec2<i32>(1i, 1i)), first_1, last_1);\\n let bottom = mix(_e21, _e26, f.x);\\n return mix(top, bottom, f.y);\\n}\\n\",\"\\nfn luma(c_3: vec4<f32>) -> f32 {\\n let y_1 = dot(c_3.xyz, LUMINANCE);\\n let _e5 = display_color();\\n return select(sqrt(y_1), y_1, _e5);\\n}\\n\",\"\\nfn pixel_color(position_2: vec2<f32>, first_2: vec2<i32>, last_2: vec2<i32>) -> vec4<f32> {\\n var local: bool;\\n\\n let pixel_5 = vec2<i32>(position_2);\\n let _e2 = scene_texel(pixel_5);\\n let _e3 = squeeze(_e2);\\n let _e4 = luma(_e3);\\n let _e11 = texel_at((pixel_5 + vec2<i32>(-1i, -1i)), first_2, last_2);\\n let _e12 = luma(_e11);\\n let _e17 = texel_at((pixel_5 + vec2<i32>(1i, -1i)), first_2, last_2);\\n let _e18 = luma(_e17);\\n let _e23 = texel_at((pixel_5 + vec2<i32>(-1i, 1i)), first_2, last_2);\\n let _e24 = luma(_e23);\\n let _e29 = texel_at((pixel_5 + vec2<i32>(1i, 1i)), first_2, last_2);\\n let _e30 = luma(_e29);\\n let lowest = min(_e4, min(min(_e12, _e18), min(_e24, _e30)));\\n let highest = max(_e4, max(max(_e12, _e18), max(_e24, _e30)));\\n if ((highest - lowest) < max(EDGE_THRESHOLD_MIN, (highest * EDGE_THRESHOLD))) {\\n return _e2;\\n }\\n let along = vec2<f32>(((_e24 + _e30) - (_e12 + _e18)), ((_e12 + _e24) - (_e18 + _e30)));\\n let reduce = max(((((_e12 + _e18) + _e24) + _e30) * 0.03125f), REDUCE_MIN);\\n let scale = (1f / (min(abs(along.x), abs(along.y)) + reduce));\\n let span = clamp((along * scale), vec2(-8f), vec2(8f));\\n let _e77 = tap((position_2 - (span / vec2(6f))), first_2, last_2);\\n let _e82 = tap((position_2 + (span / vec2(6f))), first_2, last_2);\\n let inner = (0.5f * (_e77 + _e82));\\n let _e91 = tap((position_2 - (span * 0.5f)), first_2, last_2);\\n let _e95 = tap((position_2 + (span * 0.5f)), first_2, last_2);\\n let outer = ((0.5f * inner) + (0.25f * (_e91 + _e95)));\\n let _e100 = luma(outer);\\n if !((_e100 < lowest)) {\\n local = (_e100 > highest);\\n } else {\\n local = true;\\n }\\n let _e107 = local;\\n let _e109 = unsqueeze(select(outer, inner, _e107));\\n return _e109;\\n}\\n\",\"\\nfn display(texel_3: vec4<f32>, uv_5: vec2<f32>, render_4: vec2<f32>) -> vec4<f32> {\\n let flags = settings.output.flags;\\n if ((flags & DISPLAY_COLOR) != 0u) {\\n return texel_3;\\n }\\n let coverage = min(texel_3.w, 1f);\\n if (coverage <= 0f) {\\n return vec4(0f);\\n }\\n let exposed = (texel_3.xyz / vec3(coverage));\\n let _e19 = toneCurve(exposed);\\n let mapped = saturate(_e19);\\n let _e24 = unmapped_at(uv_5, render_4);\\n let shown_1 = mix(mapped, saturate(exposed), _e24);\\n let _e26 = linear_to_srgb(shown_1);\\n let encoded = saturate(_e26);\\n return vec4<f32>((encoded * coverage), coverage);\\n}\\n\",\"\\nfn finish(color_3: vec4<f32>, position_3: vec2<f32>) -> vec4<f32> {\\n var local_1: bool;\\n var local_2: bool;\\n var local_3: bool;\\n var c_4: vec3<f32>;\\n\\n let flags_1 = settings.output.flags;\\n let grades = ((flags_1 & 262u) != 0u);\\n let _e8 = display_color();\\n if _e8 {\\n local_1 = !(grades);\\n } else {\\n local_1 = false;\\n }\\n let _e13 = local_1;\\n if _e13 {\\n local_2 = ((flags_1 & DITHER) == 0u);\\n } else {\\n local_2 = false;\\n }\\n let _e21 = local_2;\\n if !(_e21) {\\n local_3 = (color_3.w <= 0f);\\n } else {\\n local_3 = true;\\n }\\n let _e30 = local_3;\\n if _e30 {\\n return color_3;\\n }\\n c_4 = (color_3.xyz / vec3(color_3.w));\\n if ((flags_1 & GRADE) != 0u) {\\n let _e40 = c_4;\\n let at = ((sqrt(saturate(_e40)) * GRADE_SCALE) + vec3(0.015625f));\\n let _e51 = textureSampleLevel(grade_table, lut_sampler, at, 0f);\\n c_4 = _e51.xyz;\\n }\\n if ((flags_1 & LUT) != 0u) {\\n let _e57 = c_4;\\n let _e60 = settings.lut_scale;\\n let _e65 = settings.lut_offset;\\n let at_1 = ((_e57 * _e60.xyz) + _e65.xyz);\\n let _e71 = textureSampleLevel(lut, lut_sampler, at_1, 0f);\\n let graded = _e71.xyz;\\n let _e73 = c_4;\\n let _e77 = settings.lut_scale.w;\\n c_4 = mix(_e73, graded, _e77);\\n }\\n if ((flags_1 & RESOLVE) == 0u) {\\n let _e83 = c_4;\\n let _e85 = dither(position_3);\\n c_4 = saturate((_e83 + vec3(_e85)));\\n }\\n let _e89 = c_4;\\n return vec4<f32>((_e89 * color_3.w), color_3.w);\\n}\\n\",\"\\nfn fs(@builtin(position) position: vec4<f32>) -> @location(0) vec4<f32> {\\n var color: vec4<f32> = vec4(0f);\\n\\n let _e2 = eye_exposure();\\n eye_factor = _e2;\\n let packed = settings.output.render_size;\\n let render_5 = vec2<f32>(f32((packed & 65535u)), f32((packed >> 16u)));\\n let _e18 = settings.output.flags;\\n let resolving = ((_e18 & RESOLVE) != 0u);\\n let _e24 = textureDimensions(scene_color);\\n let scene = vec2<f32>(_e24);\\n let origin_1 = vec2(0f);\\n let local_4 = (position.xy - origin_1);\\n let size_4 = select(scene, render_5, resolving);\\n let whole = all((render_5 == size_4));\\n let uv_6 = (local_4 / size_4);\\n let _e35 = glow(uv_6);\\n let _e36 = vignette(local_4, size_4);\\n let from_top = position.xy;\\n let place = clamp((((from_top / size_4) * render_5) - vec2(0.5f)), vec2(0f), (render_5 - vec2(1f)));\\n let first_3 = floor(place);\\n let share = (place - first_3);\\n if whole {\\n let corner_first = vec2<i32>(origin_1);\\n let corner_last = vec2<i32>(((origin_1 + render_5) - vec2(1f)));\\n let _e58 = pixel_color(position.xy, corner_first, corner_last);\\n let _e59 = with_glow(_e58, _e35);\\n let _e60 = shaded(_e59, _e36);\\n let _e61 = display(_e60, uv_6, render_5);\\n color = _e61;\\n }\\n let _e63 = color;\\n let _e64 = outlined(_e63, uv_6, size_4, render_5);\\n let _e66 = finish(_e64, position.xy);\\n return _e66;\\n}\\n\",\"\\nfn tap(point: vec2<f32>, first_1: vec2<i32>, last_1: vec2<i32>) -> vec4<f32> {\\n let corner_2 = (point - vec2(0.5f));\\n let base = vec2<i32>(floor(corner_2));\\n let f = fract(corner_2);\\n let _e9 = texel_at(base, first_1, last_1);\\n let _e14 = texel_at((base + vec2<i32>(1i, 0i)), first_1, last_1);\\n let top = mix(_e9, _e14, f.x);\\n let _e21 = texel_at((base + vec2<i32>(0i, 1i)), first_1, last_1);\\n let _e26 = texel_at((base + vec2<i32>(1i, 1i)), first_1, last_1);\\n let bottom = mix(_e21, _e26, f.x);\\n return mix(top, bottom, f.y);\\n}\\n\",\"\\nfn finish(color_3: vec4<f32>, position_3: vec2<f32>) -> vec4<f32> {\\n var local_1: bool;\\n var local_2: bool;\\n var local_3: bool;\\n var c_4: vec3<f32>;\\n\\n let flags_1 = settings.output.flags;\\n let grades = ((flags_1 & 262u) != 0u);\\n let _e8 = display_color();\\n if _e8 {\\n local_1 = !(grades);\\n } else {\\n local_1 = false;\\n }\\n let _e13 = local_1;\\n if _e13 {\\n local_2 = ((flags_1 & DITHER) == 0u);\\n } else {\\n local_2 = false;\\n }\\n let _e21 = local_2;\\n if !(_e21) {\\n local_3 = (color_3.w <= 0f);\\n } else {\\n local_3 = true;\\n }\\n let _e30 = local_3;\\n if _e30 {\\n return color_3;\\n }\\n c_4 = (color_3.xyz / vec3(color_3.w));\\n if ((flags_1 & GRADE) != 0u) {\\n let _e40 = c_4;\\n let at_1 = ((sqrt(saturate(_e40)) * GRADE_SCALE) + vec3(0.015625f));\\n let _e51 = textureSampleLevel(grade_table, lut_sampler, at_1, 0f);\\n c_4 = _e51.xyz;\\n }\\n if ((flags_1 & LUT) != 0u) {\\n let _e57 = c_4;\\n let _e60 = settings.lut_scale;\\n let _e65 = settings.lut_offset;\\n let at_2 = ((_e57 * _e60.xyz) + _e65.xyz);\\n let _e71 = textureSampleLevel(lut, lut_sampler, at_2, 0f);\\n let graded = _e71.xyz;\\n let _e73 = c_4;\\n let _e77 = settings.lut_scale.w;\\n c_4 = mix(_e73, graded, _e77);\\n }\\n if ((flags_1 & RESOLVE) == 0u) {\\n let _e83 = c_4;\\n let _e85 = dither(position_3);\\n c_4 = saturate((_e83 + vec3(_e85)));\\n }\\n let _e89 = c_4;\\n return vec4<f32>((_e89 * color_3.w), color_3.w);\\n}\\n\",\"\\nfn fs(@builtin(position) position: vec4<f32>) -> @location(0) vec4<f32> {\\n var color: vec4<f32> = vec4(0f);\\n\\n let _e2 = eye_exposure();\\n eye_factor = _e2;\\n let packed = settings.output.render_size;\\n let render_5 = vec2<f32>(f32((packed & 65535u)), f32((packed >> 16u)));\\n let _e18 = settings.output.flags;\\n let resolving = ((_e18 & RESOLVE) != 0u);\\n let _e24 = textureDimensions(scene_color);\\n let scene = vec2<f32>(_e24);\\n let origin_2 = vec2(0f);\\n let local_4 = (position.xy - origin_2);\\n let size_4 = select(scene, render_5, resolving);\\n let whole = all((render_5 == size_4));\\n let uv_6 = (local_4 / size_4);\\n let _e35 = glow(uv_6);\\n let _e36 = vignette(local_4, size_4);\\n let from_top = position.xy;\\n let place = clamp((((from_top / size_4) * render_5) - vec2(0.5f)), vec2(0f), (render_5 - vec2(1f)));\\n let first_3 = floor(place);\\n let share = (place - first_3);\\n if whole {\\n let corner_first = vec2<i32>(origin_2);\\n let corner_last = vec2<i32>(((origin_2 + render_5) - vec2(1f)));\\n let _e58 = pixel_color(position.xy, corner_first, corner_last);\\n let _e59 = with_glow(_e58, _e35);\\n let _e60 = shaded(_e59, _e36);\\n let _e61 = display(_e60, uv_6, render_5);\\n color = _e61;\\n }\\n let _e63 = color;\\n let _e64 = outlined(_e63, uv_6, size_4, render_5);\\n let _e66 = finish(_e64, position.xy);\\n return _e66;\\n}\\n\"],\"lists\":[[0,1,2,3,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,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68],[0,1,69,2,3,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,35,36,37,38,39,40,41,70,71,72,73,74,75,76,43,44,45,46,47,48,49,50,51,52,53,54,77,78,57,58,59,60,61,62,63,79,65,66,67,80],[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,81,82,83,84,85,86,87,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,88,89,90,91,92,93,94,62,95,96,65,66,67,97],[0,1,69,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,81,82,83,84,85,86,87,28,29,30,31,32,33,34,35,36,37,38,39,40,41,70,71,72,73,74,75,76,43,44,45,46,47,48,49,50,51,52,53,54,77,78,57,58,59,88,89,90,91,98,93,94,62,95,99,65,66,67,100]]}", "{\"blocks\":[],\"lists\":[]}"].map((json) => ({ json })));
|
|
5
|
+
const sourceOf = (n) => {
|
|
6
|
+
const path = paths[n < 0 ? 1 : 0];
|
|
7
|
+
const tables = path.tables || (path.tables = JSON.parse(path.json));
|
|
8
|
+
return tables.lists[n < 0 ? -1 - n : n].map((block) => tables.blocks[block]).join('');
|
|
9
|
+
};
|
|
10
|
+
const walk = (item) => {
|
|
11
|
+
for (const key in item) {
|
|
12
|
+
const field = item[key];
|
|
13
|
+
if (key === "source" && typeof field === 'number')
|
|
14
|
+
Object.defineProperty(item, key, { get: () => sourceOf(field), enumerable: true });
|
|
15
|
+
else if (field !== null && typeof field === 'object') walk(field);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
const shader = JSON.parse(text);
|
|
19
|
+
walk(shader);
|
|
20
|
+
if (hot !== undefined) shader.hot = hot;
|
|
21
|
+
if (load !== undefined)
|
|
22
|
+
shader.builds = (target, set) => load(kind, target, set).then((module) => module.default[index] || {});
|
|
23
|
+
return shader;
|
|
24
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export default __null3dShader("{\"kind\":\"toneCurve\",\"variants\":{},\"pieces\":{\"group\":{},\"fold\":{\"webgl2\":{\"permutation\":0,\"wgsl\":null,\"glsl\":{\"items\":[\"vec3 fxd496593f_toneCurve(vec3 fxd496593f_toneCurve_color) {\\n vec3 fxd496593f_toneCurve_x = max(vec3(0.0), (fxd496593f_toneCurve_color - vec3(0.004)));\\n vec3 fxd496593f_toneCurve_numerator = (fxd496593f_toneCurve_x * ((vec3(6.2) * fxd496593f_toneCurve_x) + vec3(0.5)));\\n vec3 fxd496593f_toneCurve_denominator = ((fxd496593f_toneCurve_x * ((vec3(6.2) * fxd496593f_toneCurve_x) + vec3(1.7))) + vec3(0.06));\\n return pow((fxd496593f_toneCurve_numerator / fxd496593f_toneCurve_denominator), vec3(2.2));\\n}\\n\"],\"run\":\"fxd496593f_toneCurve\",\"uniformBlocks\":[],\"textures\":[]}},\"webgpu\":{\"permutation\":0,\"wgsl\":{\"items\":[\"fn fxd496593f_toneCurve(fxd496593f_toneCurve_color: vec3<f32>) -> vec3<f32> {\\n let fxd496593f_toneCurve_x = max(vec3(0f), (fxd496593f_toneCurve_color - vec3(4e-3f)));\\n let fxd496593f_toneCurve_numerator = (fxd496593f_toneCurve_x * ((vec3(6.2f) * fxd496593f_toneCurve_x) + vec3(0.5f)));\\n let fxd496593f_toneCurve_denominator = ((fxd496593f_toneCurve_x * ((vec3(6.2f) * fxd496593f_toneCurve_x) + vec3(1.7f))) + vec3(0.06f));\\n return pow((fxd496593f_toneCurve_numerator / fxd496593f_toneCurve_denominator), vec3(2.2f));\\n}\\n\"],\"run\":\"fxd496593f_toneCurve\"},\"glsl\":null}}},\"permutations\":33024}", undefined, __null3dBuilds, 0, "toneCurve");
|
|
2
|
+
|
|
3
|
+
function __null3dShader(text, hot, load, index, kind) {
|
|
4
|
+
const paths = __null3dShader.paths || (__null3dShader.paths = ["{\"blocks\":[],\"lists\":[]}", "{\"blocks\":[],\"lists\":[]}"].map((json) => ({ json })));
|
|
5
|
+
const sourceOf = (n) => {
|
|
6
|
+
const path = paths[n < 0 ? 1 : 0];
|
|
7
|
+
const tables = path.tables || (path.tables = JSON.parse(path.json));
|
|
8
|
+
return tables.lists[n < 0 ? -1 - n : n].map((block) => tables.blocks[block]).join('');
|
|
9
|
+
};
|
|
10
|
+
const walk = (item) => {
|
|
11
|
+
for (const key in item) {
|
|
12
|
+
const field = item[key];
|
|
13
|
+
if (key === "source" && typeof field === 'number')
|
|
14
|
+
Object.defineProperty(item, key, { get: () => sourceOf(field), enumerable: true });
|
|
15
|
+
else if (field !== null && typeof field === 'object') walk(field);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
const shader = JSON.parse(text);
|
|
19
|
+
walk(shader);
|
|
20
|
+
if (hot !== undefined) shader.hot = hot;
|
|
21
|
+
if (load !== undefined)
|
|
22
|
+
shader.builds = (target, set) => load(kind, target, set).then((module) => module.default[index] || {});
|
|
23
|
+
return shader;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function __null3dBuilds(kind, target, set) {
|
|
27
|
+
const load = {
|
|
28
|
+
"toneCurve wgsl 0": () => import("./cineon.wgsl-curve-wgsl-0-aa981b4d4febd643.js"),
|
|
29
|
+
"toneCurve glsl 0": () => import("./cineon.wgsl-curve-glsl-0-8037a6d76f7e58b8.js"),
|
|
30
|
+
}[kind + ' ' + target + ' ' + set];
|
|
31
|
+
return load ? load() : Promise.resolve({ default: [] });
|
|
32
|
+
}
|
package/lib/index.d.ts
ADDED
package/lib/index.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// The three.js compatibility add-on for null3D: the tone curves that three.js has and the engine
|
|
2
|
+
// keeps out of its core, and the soft outline of three.js's OutlinePass. Both reach the engine
|
|
3
|
+
// through its own settings, the tone mapping and the outline mask, and through the public passes
|
|
4
|
+
// and effects. Built on the engine's public API only.
|
|
5
|
+
import { checkAddonVersion } from '@null3d/engine';
|
|
6
|
+
import { VERSION } from './version.js';
|
|
7
|
+
checkAddonVersion('@null3d/three-compat', VERSION);
|
|
8
|
+
export { createOutlinePass } from './outline.js';
|
|
9
|
+
export { cineon, reinhard } from './tone.js';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export default __null3dShader("[{\"webgl2\":{\"permutation\":0,\"wgsl\":null,\"glsl\":{\"main\":{\"vertex\":{\"source\":-1,\"uniformBlocks\":[],\"textures\":[]},\"fragment\":{\"source\":-2,\"uniformBlocks\":[{\"name\":\"EffectBlock_block_0Fragment\",\"group\":0,\"binding\":0}],\"textures\":[{\"name\":\"_group_0_binding_1_fs\",\"group\":0,\"binding\":1,\"sampler\":{\"group\":0,\"binding\":2}},{\"name\":\"_group_1_binding_0_fs\",\"group\":1,\"binding\":0,\"sampler\":{\"group\":1,\"binding\":8}}]}}}}}]");
|
|
2
|
+
|
|
3
|
+
function __null3dShader(text, hot, load, index, kind) {
|
|
4
|
+
const paths = __null3dShader.paths || (__null3dShader.paths = ["{\"blocks\":[],\"lists\":[]}", "{\"blocks\":[\"#version 300 es\",\"\\nuniform vec2 null3d_depth_mapping;\\n\",\"\\nprecision highp float;\",\"\\nprecision highp int;\\n\\n\",\"\\nvec4 triangle(highp uint vertex_1) {\\n float x = ((float(((vertex_1 << 1u) & 2u)) * 2.0) - 1.0);\\n float y = ((float((vertex_1 & 2u)) * 2.0) - 1.0);\\n return vec4(x, y, 0.5, 1.0);\\n}\\n\",\"\\nvoid main() {\\n highp uint vertex = uint(gl_VertexID);\\n vec4 _e1 = triangle(vertex);\\n gl_Position = _e1;\\n gl_Position.z = gl_Position.z * null3d_depth_mapping.x + gl_Position.w * null3d_depth_mapping.y;\\n return;\\n}\\n\",\"#version 300 es\\n\",\"\\nprecision highp int;\\n\",\"\\nstruct EffectBlock {\\n vec4 size;\\n vec4 clock;\\n mat4x4 inverse_projection;\\n vec4 u0_;\\n vec4 u1_;\\n vec4 u2_;\\n vec4 u3_;\\n vec4 u4_;\\n vec4 u5_;\\n vec4 u6_;\\n vec4 u7_;\\n vec4 drawn;\\n vec4 bloom;\\n};\",\"\\nstruct EffectInput {\\n vec4 color;\\n vec2 uv;\\n vec2 pixel;\\n vec2 size;\\n float time;\\n highp uint layer;\\n};\",\"\\nstruct Uniforms {\\n vec2 direction;\\n float kernelRadius;\\n};\",\"\\nlayout(std140) uniform EffectBlock_block_0Fragment { EffectBlock _group_0_binding_0_fs; };\\n\",\"\\nuniform highp sampler2D _group_0_binding_1_fs;\\n\",\"\\nhighp int custom_texture_layers[1] = int[1](0);\\n\",\"\\nuniform highp sampler2DArray _group_1_binding_0_fs;\\n\",\"\\nvec2 uniforms_0_ = vec2(0.0);\\n\",\"\\nfloat uniforms_1_ = 0.0;\\n\",\"\\nlayout(location = 0) out vec4 _fs2p_location0;\\n\",\"\\nvec4 effect_value(highp uint part) {\\n switch(part) {\\n case 0u: {\\n vec4 _e15 = _group_0_binding_0_fs.u0_;\\n return _e15;\\n }\\n case 1u: {\\n vec4 _e30 = _group_0_binding_0_fs.u1_;\\n return _e30;\\n }\\n case 2u: {\\n vec4 _e45 = _group_0_binding_0_fs.u2_;\\n return _e45;\\n }\\n case 3u: {\\n vec4 _e60 = _group_0_binding_0_fs.u3_;\\n return _e60;\\n }\\n case 4u: {\\n vec4 _e75 = _group_0_binding_0_fs.u4_;\\n return _e75;\\n }\\n case 5u: {\\n vec4 _e90 = _group_0_binding_0_fs.u5_;\\n return _e90;\\n }\\n case 6u: {\\n vec4 _e105 = _group_0_binding_0_fs.u6_;\\n return _e105;\\n }\\n default: {\\n vec4 _e120 = _group_0_binding_0_fs.u7_;\\n return _e120;\\n }\\n }\\n}\\n\",\"\\nvec2 effectPassUv(vec2 uv) {\\n return vec2(uv.x, (1.0 - uv.y));\\n}\\n\",\"\\nvec4 effectColor(vec2 uv_1) {\\n vec2 at = vec2(0.0);\\n vec4 _e14 = _group_0_binding_0_fs.size;\\n vec2 render = _e14.xy;\\n at = clamp((uv_1 * render), vec2(0.5), (render - vec2(0.5)));\\n float _e41 = _group_0_binding_0_fs.size.w;\\n float _e43 = at.y;\\n at.y = (_e41 - _e43);\\n vec2 _e45 = at;\\n vec4 _e60 = _group_0_binding_0_fs.size;\\n vec4 _e66 = textureLod(_group_0_binding_1_fs, vec2((_e45 / _e60.zw)), 0.0);\\n return _e66;\\n}\\n\",\"\\nvoid load_effect_uniforms(inout vec2 param, inout float param_1) {\\n vec2 local_8 = vec2(0.0);\\n float local_9 = 0.0;\\n vec4 _e1 = effect_value(0u);\\n local_8 = _e1.xy;\\n local_9 = _e1.z;\\n vec2 _e7 = local_8;\\n float _e9 = local_9;\\n param = _e7;\\n param_1 = _e9;\\n return;\\n}\\n\",\"\\nvoid load_custom_texture_layers() {\\n vec4 _e1 = effect_value(7u);\\n custom_texture_layers[0] = int(_e1.w);\\n return;\\n}\\n\",\"\\nfloat gaussian(float x, float sigma) {\\n return ((0.39894 * exp((((-0.5 * x) * x) / (sigma * sigma)))) / sigma);\\n}\\n\",\"\\nvec4 effect(vec4 param_2, vec2 param_3, vec2 param_4, vec2 param_5, float param_6, highp uint param_7) {\\n float weightSum = 0.0;\\n vec3 sum = vec3(0.0);\\n vec2 offset = vec2(0.0);\\n highp int i = 1;\\n vec2 _e8 = effectPassUv(param_3);\\n highp int _e11 = custom_texture_layers[0];\\n vec4 _e15 = textureLod(_group_1_binding_0_fs, vec3(_e8, _e11), 0.0);\\n highp int _e18 = custom_texture_layers[0];\\n vec4 center = ((_e18 >= 0) ? _e15 : vec4(1.0));\\n float _e24 = uniforms_1_;\\n float sigma_1 = (_e24 / 2.0);\\n float _e28 = gaussian(0.0, sigma_1);\\n weightSum = _e28;\\n float _e31 = weightSum;\\n sum = (center.xyz * _e31);\\n vec2 _e36 = uniforms_0_;\\n float _e40 = uniforms_1_;\\n vec2 delta = ((_e36 / param_5) * (_e40 / 4.0));\\n offset = delta;\\n bool loop_init = true;\\n while(true) {\\n if (!loop_init) {\\n highp int _e106 = i;\\n i = (_e106 + 1);\\n }\\n loop_init = false;\\n highp int _e46 = i;\\n if ((_e46 <= 4)) {\\n } else {\\n break;\\n }\\n {\\n float _e51 = uniforms_1_;\\n highp int _e52 = i;\\n float x_1 = ((_e51 * float(_e52)) / 4.0);\\n float _e57 = gaussian(x_1, sigma_1);\\n vec2 _e60 = offset;\\n vec2 _e62 = effectPassUv((param_3 + _e60));\\n highp int _e65 = custom_texture_layers[0];\\n vec4 _e69 = textureLod(_group_1_binding_0_fs, vec3(_e62, _e65), 0.0);\\n highp int _e72 = custom_texture_layers[0];\\n vec4 plus = ((_e72 >= 0) ? _e69 : vec4(1.0));\\n vec2 _e78 = offset;\\n vec2 _e80 = effectPassUv((param_3 - _e78));\\n highp int _e83 = custom_texture_layers[0];\\n vec4 _e87 = textureLod(_group_1_binding_0_fs, vec3(_e80, _e83), 0.0);\\n highp int _e90 = custom_texture_layers[0];\\n vec4 minus = ((_e90 >= 0) ? _e87 : vec4(1.0));\\n vec3 _e94 = sum;\\n sum = (_e94 + ((plus.xyz + minus.xyz) * _e57));\\n float _e100 = weightSum;\\n weightSum = (_e100 + (2.0 * _e57));\\n vec2 _e104 = offset;\\n offset = (_e104 + delta);\\n }\\n }\\n vec3 _e109 = sum;\\n float _e110 = weightSum;\\n return vec4((_e109 / vec3(_e110)), center.w);\\n}\\n\",\"\\nvoid main() {\\n vec4 position = gl_FragCoord;\\n vec2 local = vec2(0.0);\\n float local_1 = 0.0;\\n vec4 local_2 = vec4(0.0);\\n vec2 local_3 = vec2(0.0);\\n vec2 local_4 = vec2(0.0);\\n vec2 local_5 = vec2(0.0);\\n float local_6 = 0.0;\\n highp uint local_7 = 0u;\\n load_effect_uniforms(local, local_1);\\n vec2 _e3 = local;\\n float _e5 = local_1;\\n uniforms_0_ = _e3;\\n uniforms_1_ = _e5;\\n load_custom_texture_layers();\\n float _e29 = _group_0_binding_0_fs.clock.x;\\n local_6 = _e29;\\n local_7 = 0u;\\n vec4 drawn = _group_0_binding_0_fs.drawn;\\n if ((drawn.w > 0.5)) {\\n vec2 from_top = vec2(position.x, (drawn.z - position.y));\\n local_5 = drawn.xy;\\n local_4 = from_top;\\n local_3 = (from_top / drawn.xy);\\n vec2 _e58 = local_3;\\n vec4 _e59 = effectColor(_e58);\\n local_2 = _e59;\\n local_7 = (uint(drawn.w) - 1u);\\n vec4 _e77 = local_2;\\n vec2 _e79 = local_3;\\n vec2 _e81 = local_4;\\n vec2 _e83 = local_5;\\n float _e85 = local_6;\\n highp uint _e87 = local_7;\\n vec4 _e88 = effect(_e77, _e79, _e81, _e83, _e85, _e87);\\n _fs2p_location0 = _e88;\\n return;\\n }\\n float _e105 = _group_0_binding_0_fs.size.w;\\n vec2 from_top_1 = vec2(position.x, (_e105 - position.y));\\n vec4 _e113 = texelFetch(_group_0_binding_1_fs, ivec2(position.xy), 0);\\n local_2 = _e113;\\n vec4 _e128 = _group_0_binding_0_fs.size;\\n local_5 = _e128.xy;\\n local_4 = from_top_1;\\n vec4 _e144 = _group_0_binding_0_fs.size;\\n local_3 = (from_top_1 / _e144.xy);\\n vec4 _e160 = local_2;\\n vec2 _e162 = local_3;\\n vec2 _e164 = local_4;\\n vec2 _e166 = local_5;\\n float _e168 = local_6;\\n highp uint _e170 = local_7;\\n vec4 _e171 = effect(_e160, _e162, _e164, _e166, _e168, _e170);\\n _fs2p_location0 = _e171;\\n return;\\n}\\n\"],\"lists\":[[0,1,2,3,4,5],[6,2,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]]}"].map((json) => ({ json })));
|
|
5
|
+
const sourceOf = (n) => {
|
|
6
|
+
const path = paths[n < 0 ? 1 : 0];
|
|
7
|
+
const tables = path.tables || (path.tables = JSON.parse(path.json));
|
|
8
|
+
return tables.lists[n < 0 ? -1 - n : n].map((block) => tables.blocks[block]).join('');
|
|
9
|
+
};
|
|
10
|
+
const walk = (item) => {
|
|
11
|
+
for (const key in item) {
|
|
12
|
+
const field = item[key];
|
|
13
|
+
if (key === "source" && typeof field === 'number')
|
|
14
|
+
Object.defineProperty(item, key, { get: () => sourceOf(field), enumerable: true });
|
|
15
|
+
else if (field !== null && typeof field === 'object') walk(field);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
const shader = JSON.parse(text);
|
|
19
|
+
walk(shader);
|
|
20
|
+
if (hot !== undefined) shader.hot = hot;
|
|
21
|
+
if (load !== undefined)
|
|
22
|
+
shader.builds = (target, set) => load(kind, target, set).then((module) => module.default[index] || {});
|
|
23
|
+
return shader;
|
|
24
|
+
}
|