@null3d/vite-plugin 0.0.0-stage → 0.1.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 +87 -2
- package/THIRD-PARTY-NOTICES.txt +413 -0
- package/dist/shader-compiler.stamp.json +4 -0
- package/dist/shader-compiler.wasm +0 -0
- package/lib/assets.d.ts +94 -0
- package/lib/assets.js +189 -0
- package/lib/client.d.ts +21 -0
- package/lib/compile-pool.d.ts +25 -0
- package/lib/compile-pool.js +90 -0
- package/lib/compile-worker.js +11 -0
- package/lib/compiler-calls.d.ts +26 -0
- package/lib/compiler-calls.js +97 -0
- package/lib/compiler-stamp.d.ts +8 -0
- package/lib/compiler-stamp.js +34 -0
- package/lib/compress.d.ts +47 -0
- package/lib/compress.js +391 -0
- package/lib/declarations.d.ts +10 -0
- package/lib/declarations.js +80 -0
- package/lib/engine-shaders-local.d.ts +6 -0
- package/lib/engine-shaders-local.js +75 -0
- package/lib/engine-shaders.d.ts +61 -0
- package/lib/engine-shaders.js +170 -0
- package/lib/hash-pool.d.ts +24 -0
- package/lib/hash-pool.js +84 -0
- package/lib/hash-worker.js +53 -0
- package/lib/hot.d.ts +53 -0
- package/lib/hot.js +101 -0
- package/lib/index.d.ts +122 -0
- package/lib/index.js +972 -0
- package/lib/material-builds.d.ts +91 -0
- package/lib/material-builds.js +236 -0
- package/lib/offline.d.ts +92 -0
- package/lib/offline.js +304 -0
- package/lib/pack.d.ts +30 -0
- package/lib/pack.js +112 -0
- package/lib/package-files.d.ts +12 -0
- package/lib/package-files.js +39 -0
- package/lib/paragraphs.d.ts +19 -0
- package/lib/paragraphs.js +131 -0
- package/lib/shader-cache.d.ts +59 -0
- package/lib/shader-cache.js +213 -0
- package/lib/shader-compiler.d.ts +258 -0
- package/lib/shader-compiler.js +169 -0
- package/lib/shader-types.d.ts +261 -0
- package/lib/shader-types.js +4 -0
- package/lib/wgsl.d.ts +118 -0
- package/lib/wgsl.js +447 -0
- package/lib/worker-preload.d.ts +30 -0
- package/lib/worker-preload.js +84 -0
- package/package.json +69 -5
|
@@ -0,0 +1,413 @@
|
|
|
1
|
+
Third-party code in the null3D Vite plugin
|
|
2
|
+
|
|
3
|
+
The @null3d/vite-plugin package ships a WebAssembly module, dist/shader-compiler.wasm, which the
|
|
4
|
+
build runs to compile the engine's WGSL. The module is built from the null3D crates and the Rust
|
|
5
|
+
crates below. Each section names the crates, their licenses, and the notices that a license asks a
|
|
6
|
+
copy to carry. The npm packages that the plugin depends on carry their own licenses.
|
|
7
|
+
|
|
8
|
+
The module also holds the text of every WGSL file in the engine's shader library
|
|
9
|
+
(crates/null3d-shaders/wgsl and its lib folder), so the projects whose code those shaders port
|
|
10
|
+
need their notices here too. They are named first.
|
|
11
|
+
|
|
12
|
+
==============================================================================
|
|
13
|
+
three.js: the shaders of the engine's shader library that its code ports
|
|
14
|
+
==============================================================================
|
|
15
|
+
|
|
16
|
+
The compiler holds the engine's ports of three.js 0.186.1's code, from
|
|
17
|
+
https://github.com/mrdoob/three.js: the GTAO and Poisson denoise passes, the wide line shaders,
|
|
18
|
+
the atmosphere and sky, the trace of the built-in room, and the coat, sheen, iridescence,
|
|
19
|
+
refraction and cutout code.
|
|
20
|
+
|
|
21
|
+
Copyright © 2010-2026 three.js authors
|
|
22
|
+
|
|
23
|
+
The MIT License, whose text is below.
|
|
24
|
+
|
|
25
|
+
==============================================================================
|
|
26
|
+
Filament: the specular anti-aliasing kernel, the anisotropic highlight and AgX's punchy look
|
|
27
|
+
==============================================================================
|
|
28
|
+
|
|
29
|
+
The engine's shader library follows Filament's specular anti-aliasing kernel, its anisotropic GGX
|
|
30
|
+
highlight and the two constants of AgX's punchy look, from https://github.com/google/filament.
|
|
31
|
+
|
|
32
|
+
Copyright 2023 The Android Open Source Project
|
|
33
|
+
|
|
34
|
+
Apache License, Version 2.0, whose text is below.
|
|
35
|
+
|
|
36
|
+
==============================================================================
|
|
37
|
+
KinoBokeh and Unity's post-processing stack v1: the depth of field
|
|
38
|
+
==============================================================================
|
|
39
|
+
|
|
40
|
+
The engine's depth-of-field shader ports KinoBokeh, by Keijiro Takahashi, from
|
|
41
|
+
https://github.com/keijiro/KinoBokeh, and follows the composite of Unity's post-processing stack
|
|
42
|
+
v1's depth of field, from https://github.com/Unity-Technologies/PostProcessing.
|
|
43
|
+
|
|
44
|
+
KinoBokeh: Copyright (C) 2016 Unity Technologies and Copyright (C) 2015 Keijiro Takahashi
|
|
45
|
+
Unity's post-processing stack v1: Copyright (c) 2014-2017, Unity Technologies
|
|
46
|
+
|
|
47
|
+
The MIT License, whose text is below.
|
|
48
|
+
|
|
49
|
+
==============================================================================
|
|
50
|
+
AMD FidelityFX: FSR 1's RCAS sharpening and SSSR's ray march
|
|
51
|
+
==============================================================================
|
|
52
|
+
|
|
53
|
+
The engine's final shader translates FidelityFX Super Resolution 1's RCAS filter, and its
|
|
54
|
+
screen-space reflection shader follows the structure of FidelityFX Stochastic Screen Space
|
|
55
|
+
Reflections, both from https://github.com/GPUOpen-Effects.
|
|
56
|
+
|
|
57
|
+
Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved.
|
|
58
|
+
|
|
59
|
+
The MIT License, whose text is below.
|
|
60
|
+
|
|
61
|
+
==============================================================================
|
|
62
|
+
Qualcomm Snapdragon Game Super Resolution 1: the render-scale upscale
|
|
63
|
+
==============================================================================
|
|
64
|
+
|
|
65
|
+
The engine's final shader ports Snapdragon Game Super Resolution 1's fragment shader, from
|
|
66
|
+
https://github.com/SnapdragonStudios/snapdragon-gsr, keeping Qualcomm's lanczos window, weighted
|
|
67
|
+
taps, edge vote and delta clamp.
|
|
68
|
+
|
|
69
|
+
Copyright (c) 2023, Qualcomm Innovation Center, Inc. All rights reserved.
|
|
70
|
+
|
|
71
|
+
BSD 3-Clause License, whose text is below.
|
|
72
|
+
|
|
73
|
+
==============================================================================
|
|
74
|
+
SMAA: the anti-aliasing of the moment transparency layer
|
|
75
|
+
==============================================================================
|
|
76
|
+
|
|
77
|
+
The shader library's moment transparency layer follows the SMAA 1x reference implementation's
|
|
78
|
+
three steps, from https://github.com/iryoku/smaa.
|
|
79
|
+
|
|
80
|
+
Copyright (C) 2013 Jorge Jimenez (jorge@iryoku.com)
|
|
81
|
+
Copyright (C) 2013 Jose I. Echevarria (joseignacioechevarria@gmail.com)
|
|
82
|
+
Copyright (C) 2013 Belen Masia (bmasia@unizar.es)
|
|
83
|
+
Copyright (C) 2013 Fernando Navarro (fernandn@microsoft.com)
|
|
84
|
+
Copyright (C) 2013 Diego Gutierrez (diegog@unizar.es)
|
|
85
|
+
|
|
86
|
+
The MIT License, whose text is below.
|
|
87
|
+
|
|
88
|
+
==============================================================================
|
|
89
|
+
naga, naga-types and naga_oil: WGSL parsing, validation and translation
|
|
90
|
+
==============================================================================
|
|
91
|
+
|
|
92
|
+
naga 30.0.1, naga-types 30.0.1 and naga_oil 0.23.0, from https://github.com/gfx-rs/wgpu and
|
|
93
|
+
https://github.com/bevyengine/naga_oil. Each is offered under the MIT License or the Apache
|
|
94
|
+
License 2.0, and null3D takes them under the MIT License.
|
|
95
|
+
|
|
96
|
+
Copyright the gfx-rs developers and the naga_oil contributors.
|
|
97
|
+
==============================================================================
|
|
98
|
+
serde, serde_json and the toml crates: the module's data formats
|
|
99
|
+
==============================================================================
|
|
100
|
+
|
|
101
|
+
serde 1.0.229, serde_core 1.0.229 and serde_json 1.0.151 are each offered under the MIT License
|
|
102
|
+
or the Apache License 2.0, and null3D takes them under the MIT License.
|
|
103
|
+
|
|
104
|
+
Copyright the serde authors.
|
|
105
|
+
|
|
106
|
+
toml 1.1.6, toml_datetime 1.1.1, toml_parser 1.1.3, toml_writer 1.1.2 and serde_spanned 1.1.1
|
|
107
|
+
are each offered under the MIT License or the Apache License 2.0, and null3D takes them under the
|
|
108
|
+
MIT License.
|
|
109
|
+
|
|
110
|
+
Copyright (c) the toml contributors.
|
|
111
|
+
|
|
112
|
+
==============================================================================
|
|
113
|
+
The remaining crates of the shader compiler
|
|
114
|
+
==============================================================================
|
|
115
|
+
|
|
116
|
+
Each crate below is offered under the MIT License or the Apache License 2.0, and null3D takes it
|
|
117
|
+
under the MIT License, except where the line gives another license or another choice. The version
|
|
118
|
+
is the one in the module, and each crate's own package carries its copyright notice.
|
|
119
|
+
|
|
120
|
+
- The Rust standard library: Copyright (c) The Rust Project Contributors.
|
|
121
|
+
- arrayvec 0.7.8, bit-set 0.10.0, bit-vec 0.9.1, bitflags 2.13.2, cfg-if 1.0.5, equivalent
|
|
122
|
+
1.0.2, half 2.7.1, hashbrown 0.17.1, indexmap 2.14.2, itoa 1.0.18, log 0.4.34, num-traits
|
|
123
|
+
0.2.19, once_cell 1.21.4, pin-project-lite 0.2.17, regex 1.13.1, regex-automata 0.4.18,
|
|
124
|
+
regex-syntax 0.8.11, rustc-hash 1.1.0, thiserror 2.0.21, unicode-width 0.2.2 and zerocopy
|
|
125
|
+
0.8.59: Copyright their authors.
|
|
126
|
+
- aho-corasick 1.1.5, memchr 2.8.3 and termcolor 1.4.1, each offered under the Unlicense or the
|
|
127
|
+
MIT License, and null3D takes them under the MIT License: Copyright (c) Andrew Gallant.
|
|
128
|
+
- data-encoding 2.11.1, libm 0.2.16, tracing 0.1.44, tracing-core 0.1.36, winnow 1.0.4 and zmij
|
|
129
|
+
1.0.23, under the MIT License: Copyright their authors.
|
|
130
|
+
- foldhash 0.2.0, under the Zlib License: Copyright (c) Orson Peters. Its license text follows.
|
|
131
|
+
- codespan-reporting 0.12.0 and 0.13.1, under the Apache License 2.0: Copyright (c) Brendan
|
|
132
|
+
Zabarauskas. The license text is in the package's LICENSE-APACHE file.
|
|
133
|
+
|
|
134
|
+
==============================================================================
|
|
135
|
+
The MIT License
|
|
136
|
+
==============================================================================
|
|
137
|
+
|
|
138
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
139
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
140
|
+
in the Software without restriction, including without limitation the rights
|
|
141
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
142
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
143
|
+
furnished to do so, subject to the following conditions:
|
|
144
|
+
|
|
145
|
+
The above copyright notice and this permission notice shall be included in all
|
|
146
|
+
copies or substantial portions of the Software.
|
|
147
|
+
|
|
148
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
149
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
150
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
151
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
152
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
153
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
154
|
+
SOFTWARE.
|
|
155
|
+
|
|
156
|
+
==============================================================================
|
|
157
|
+
The Zlib License, as foldhash ships it
|
|
158
|
+
==============================================================================
|
|
159
|
+
|
|
160
|
+
Copyright (c) 2024 Orson Peters
|
|
161
|
+
|
|
162
|
+
This software is provided 'as-is', without any express or implied warranty. In no event will the
|
|
163
|
+
authors be held liable for any damages arising from the use of this software.
|
|
164
|
+
|
|
165
|
+
Permission is granted to anyone to use this software for any purpose, including commercial
|
|
166
|
+
applications, and to alter it and redistribute it freely, subject to the following restrictions:
|
|
167
|
+
|
|
168
|
+
1. The origin of this software must not be misrepresented; you must not claim that you wrote the
|
|
169
|
+
original software. If you use this software in a product, an acknowledgment in the product
|
|
170
|
+
documentation would be appreciated but is not required.
|
|
171
|
+
|
|
172
|
+
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being
|
|
173
|
+
the original software.
|
|
174
|
+
|
|
175
|
+
3. This notice may not be removed or altered from any source distribution.
|
|
176
|
+
|
|
177
|
+
==============================================================================
|
|
178
|
+
The Apache License, Version 2.0, as Filament ships it
|
|
179
|
+
==============================================================================
|
|
180
|
+
|
|
181
|
+
Apache License
|
|
182
|
+
Version 2.0, January 2004
|
|
183
|
+
http://www.apache.org/licenses/
|
|
184
|
+
|
|
185
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
186
|
+
|
|
187
|
+
1. Definitions.
|
|
188
|
+
|
|
189
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
190
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
191
|
+
|
|
192
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
193
|
+
the copyright owner that is granting the License.
|
|
194
|
+
|
|
195
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
196
|
+
other entities that control, are controlled by, or are under common
|
|
197
|
+
control with that entity. For the purposes of this definition,
|
|
198
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
199
|
+
direction or management of such entity, whether by contract or
|
|
200
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
201
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
202
|
+
|
|
203
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
204
|
+
exercising permissions granted by this License.
|
|
205
|
+
|
|
206
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
207
|
+
including but not limited to software source code, documentation
|
|
208
|
+
source, and configuration files.
|
|
209
|
+
|
|
210
|
+
"Object" form shall mean any form resulting from mechanical
|
|
211
|
+
transformation or translation of a Source form, including but
|
|
212
|
+
not limited to compiled object code, generated documentation,
|
|
213
|
+
and conversions to other media types.
|
|
214
|
+
|
|
215
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
216
|
+
Object form, made available under the License, as indicated by a
|
|
217
|
+
copyright notice that is included in or attached to the work
|
|
218
|
+
(an example is provided in the Appendix below).
|
|
219
|
+
|
|
220
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
221
|
+
form, that is based on (or derived from) the Work and for which the
|
|
222
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
223
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
224
|
+
of this License, Derivative Works shall not include works that remain
|
|
225
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
226
|
+
the Work and Derivative Works thereof.
|
|
227
|
+
|
|
228
|
+
"Contribution" shall mean any work of authorship, including
|
|
229
|
+
the original version of the Work and any modifications or additions
|
|
230
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
231
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
232
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
233
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
234
|
+
means any form of electronic, verbal, or written communication sent
|
|
235
|
+
to the Licensor or its representatives, including but not limited to
|
|
236
|
+
communication on electronic mailing lists, source code control systems,
|
|
237
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
238
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
239
|
+
excluding communication that is conspicuously marked or otherwise
|
|
240
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
241
|
+
|
|
242
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
243
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
244
|
+
subsequently incorporated within the Work.
|
|
245
|
+
|
|
246
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
247
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
248
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
249
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
250
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
251
|
+
Work and such Derivative Works in Source or Object form.
|
|
252
|
+
|
|
253
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
254
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
255
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
256
|
+
(except as stated in this section) patent license to make, have made,
|
|
257
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
258
|
+
where such license applies only to those patent claims licensable
|
|
259
|
+
by such Contributor that are necessarily infringed by their
|
|
260
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
261
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
262
|
+
institute patent litigation against any entity (including a
|
|
263
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
264
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
265
|
+
or contributory patent infringement, then any patent licenses
|
|
266
|
+
granted to You under this License for that Work shall terminate
|
|
267
|
+
as of the date such litigation is filed.
|
|
268
|
+
|
|
269
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
270
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
271
|
+
modifications, and in Source or Object form, provided that You
|
|
272
|
+
meet the following conditions:
|
|
273
|
+
|
|
274
|
+
(a) You must give any other recipients of the Work or
|
|
275
|
+
Derivative Works a copy of this License; and
|
|
276
|
+
|
|
277
|
+
(b) You must cause any modified files to carry prominent notices
|
|
278
|
+
stating that You changed the files; and
|
|
279
|
+
|
|
280
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
281
|
+
that You distribute, all copyright, patent, trademark, and
|
|
282
|
+
attribution notices from the Source form of the Work,
|
|
283
|
+
excluding those notices that do not pertain to any part of
|
|
284
|
+
the Derivative Works; and
|
|
285
|
+
|
|
286
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
287
|
+
distribution, then any Derivative Works that You distribute must
|
|
288
|
+
include a readable copy of the attribution notices contained
|
|
289
|
+
within such NOTICE file, excluding those notices that do not
|
|
290
|
+
pertain to any part of the Derivative Works, in at least one
|
|
291
|
+
of the following places: within a NOTICE text file distributed
|
|
292
|
+
as part of the Derivative Works; within the Source form or
|
|
293
|
+
documentation, if provided along with the Derivative Works; or,
|
|
294
|
+
within a display generated by the Derivative Works, if and
|
|
295
|
+
wherever such third-party notices normally appear. The contents
|
|
296
|
+
of the NOTICE file are for informational purposes only and
|
|
297
|
+
do not modify the License. You may add Your own attribution
|
|
298
|
+
notices within Derivative Works that You distribute, alongside
|
|
299
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
300
|
+
that such additional attribution notices cannot be construed
|
|
301
|
+
as modifying the License.
|
|
302
|
+
|
|
303
|
+
You may add Your own copyright statement to Your modifications and
|
|
304
|
+
may provide additional or different license terms and conditions
|
|
305
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
306
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
307
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
308
|
+
the conditions stated in this License.
|
|
309
|
+
|
|
310
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
311
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
312
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
313
|
+
this License, without any additional terms or conditions.
|
|
314
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
315
|
+
the terms of any separate license agreement you may have executed
|
|
316
|
+
with Licensor regarding such Contributions.
|
|
317
|
+
|
|
318
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
319
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
320
|
+
except as required for reasonable and customary use in describing the
|
|
321
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
322
|
+
|
|
323
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
324
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
325
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
326
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
327
|
+
implied, including, without limitation, any warranties or conditions
|
|
328
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
329
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
330
|
+
appropriateness of using or redistributing the Work and assume any
|
|
331
|
+
risks associated with Your exercise of permissions under this License.
|
|
332
|
+
|
|
333
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
334
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
335
|
+
unless required by applicable law (such as deliberate and grossly
|
|
336
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
337
|
+
liable to You for damages, including any direct, indirect, special,
|
|
338
|
+
incidental, or consequential damages of any character arising as a
|
|
339
|
+
result of this License or out of the use or inability to use the
|
|
340
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
341
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
342
|
+
other commercial damages or losses), even if such Contributor
|
|
343
|
+
has been advised of the possibility of such damages.
|
|
344
|
+
|
|
345
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
346
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
347
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
348
|
+
or other liability obligations and/or rights consistent with this
|
|
349
|
+
License. However, in accepting such obligations, You may act only
|
|
350
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
351
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
352
|
+
defend, and hold each Contributor harmless for any liability
|
|
353
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
354
|
+
of your accepting any such warranty or additional liability.
|
|
355
|
+
|
|
356
|
+
END OF TERMS AND CONDITIONS
|
|
357
|
+
|
|
358
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
359
|
+
|
|
360
|
+
To apply the Apache License to your work, attach the following
|
|
361
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
362
|
+
replaced with your own identifying information. (Don't include
|
|
363
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
364
|
+
comment syntax for the file format. We also recommend that a
|
|
365
|
+
file or class name and description of purpose be included on the
|
|
366
|
+
same "printed page" as the copyright notice for easier
|
|
367
|
+
identification within third-party archives.
|
|
368
|
+
|
|
369
|
+
Copyright 2023 The Android Open Source Project
|
|
370
|
+
|
|
371
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
372
|
+
you may not use this file except in compliance with the License.
|
|
373
|
+
You may obtain a copy of the License at
|
|
374
|
+
|
|
375
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
376
|
+
|
|
377
|
+
Unless required by applicable law or agreed to in writing, software
|
|
378
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
379
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
380
|
+
See the License for the specific language governing permissions and
|
|
381
|
+
limitations under the License.
|
|
382
|
+
|
|
383
|
+
==============================================================================
|
|
384
|
+
The BSD 3-Clause License, as Qualcomm Snapdragon GSR ships it
|
|
385
|
+
==============================================================================
|
|
386
|
+
|
|
387
|
+
Copyright (c) 2023, Qualcomm Innovation Center, Inc. All rights reserved.
|
|
388
|
+
|
|
389
|
+
Redistribution and use in source and binary forms, with or without
|
|
390
|
+
modification, are permitted provided that the following conditions are met:
|
|
391
|
+
|
|
392
|
+
1. Redistributions of source code must retain the above copyright notice,
|
|
393
|
+
this list of conditions and the following disclaimer.
|
|
394
|
+
|
|
395
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
396
|
+
this list of conditions and the following disclaimer in the documentation
|
|
397
|
+
and/or other materials provided with the distribution.
|
|
398
|
+
|
|
399
|
+
3. Neither the name of the copyright holder nor the names of its contributors
|
|
400
|
+
may be used to endorse or promote products derived from this software
|
|
401
|
+
without specific prior written permission.
|
|
402
|
+
|
|
403
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
404
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
405
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
406
|
+
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
407
|
+
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
408
|
+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
409
|
+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
410
|
+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
411
|
+
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
412
|
+
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
413
|
+
POSSIBILITY OF SUCH DAMAGE.
|
|
Binary file
|
package/lib/assets.d.ts
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/** Options of the asset tool, as `assets optimize` takes them. */
|
|
2
|
+
export interface AssetOptions {
|
|
3
|
+
/** Add levels of detail to meshes of 64 triangles or more. The default is false. */
|
|
4
|
+
lod?: boolean;
|
|
5
|
+
/**
|
|
6
|
+
* Write each mesh's finer levels of detail and cluster bands as separate files beside the model,
|
|
7
|
+
* so the engine draws a coarse first picture at once and takes each finer part as it arrives. It
|
|
8
|
+
* needs `lod` or `clusters`. The default is false.
|
|
9
|
+
*/
|
|
10
|
+
stages?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Add a tree of cluster patches to each large static mesh of 20,000 triangles or more. The
|
|
13
|
+
* default is false.
|
|
14
|
+
*/
|
|
15
|
+
clusters?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Keep this share of each mesh's triangles, above 0 and up to 1, as far as `simplifyError`
|
|
18
|
+
* allows. The default, 1, keeps them all.
|
|
19
|
+
*/
|
|
20
|
+
simplify?: number;
|
|
21
|
+
/**
|
|
22
|
+
* The most that `simplify` may move a mesh's surface, as a share of the mesh's size. The
|
|
23
|
+
* default is 0.01.
|
|
24
|
+
*/
|
|
25
|
+
simplifyError?: number;
|
|
26
|
+
/** The largest side of a texture: a power of two up to 2048, the default. */
|
|
27
|
+
maxTextureSize?: number;
|
|
28
|
+
/** `size` encodes color and data maps in ETC1S, the default; `high` in UASTC. */
|
|
29
|
+
textureQuality?: 'size' | 'high';
|
|
30
|
+
/**
|
|
31
|
+
* Add the detail of each material's normal map to the roughness levels of its metal-rough map,
|
|
32
|
+
* which then takes UASTC, so distant bumpy surfaces do not flicker. The default is true.
|
|
33
|
+
*/
|
|
34
|
+
roughnessBake?: boolean;
|
|
35
|
+
/** Compress the model's buffers with meshopt, which the engine decodes on load. Default: true. */
|
|
36
|
+
meshopt?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Give each mesh that encloses space a blocker for software occlusion culling
|
|
39
|
+
* (`NULL3D_occluder`). The default is true.
|
|
40
|
+
*/
|
|
41
|
+
blockers?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Store the tree that raycasts walk for each mesh part of at least this many triangles
|
|
44
|
+
* (`NULL3D_mesh_bvh`), or for none with 0. The default is 20,000.
|
|
45
|
+
*/
|
|
46
|
+
bvh?: number;
|
|
47
|
+
}
|
|
48
|
+
/** The query that asks for an optimized model. */
|
|
49
|
+
export declare const OPTIMIZED_QUERY = "optimized";
|
|
50
|
+
/** An import of an optimized model: a `.glb` or `.gltf` file with the query. */
|
|
51
|
+
export declare const OPTIMIZED_MODEL: RegExp;
|
|
52
|
+
/** The address prefix and folder name of the optimized files, in the dev server and in a build. */
|
|
53
|
+
export declare const ASSET_FOLDER = "null3d-assets";
|
|
54
|
+
/** An optimized model in the cache: its folder's key and its file's name. */
|
|
55
|
+
export interface CachedModel {
|
|
56
|
+
key: string;
|
|
57
|
+
name: string;
|
|
58
|
+
/** The model file, and the texture files it names, by their paths from the cache's folder. */
|
|
59
|
+
files: string[];
|
|
60
|
+
}
|
|
61
|
+
/** The cache's folder in a project. */
|
|
62
|
+
export declare const cacheFolder: (root: string) => string;
|
|
63
|
+
/**
|
|
64
|
+
* The cache key of a model: the hash of the tool's identity, the options, and each file of the
|
|
65
|
+
* model, its own and those it names.
|
|
66
|
+
*/
|
|
67
|
+
export declare function modelKey(identity: string, options: object, files: readonly string[]): string;
|
|
68
|
+
/**
|
|
69
|
+
* What the asset tool is: the version it reports and a hash of its own code, which is the module the
|
|
70
|
+
* plugin loads and the files that share its name, the WebAssembly file among them. The version alone
|
|
71
|
+
* is not enough, because it stays `0.0.0` in the repository: a fix to the tool can change what a
|
|
72
|
+
* model encodes to without changing the key, and the cache would keep serving models that the tool
|
|
73
|
+
* wrote before the fix (code review H-17). A tool whose files cannot be read falls back to the
|
|
74
|
+
* version it reports.
|
|
75
|
+
*/
|
|
76
|
+
export declare function toolIdentity(version: string): string;
|
|
77
|
+
/**
|
|
78
|
+
* A hash of the module at `path` and of the files that share its name, a WebAssembly file among
|
|
79
|
+
* them, or null when they cannot be read. A tool's own file names its siblings, so one name covers
|
|
80
|
+
* the JavaScript that drives it and the module it runs.
|
|
81
|
+
*/
|
|
82
|
+
export declare function fileCodeHash(path: string): string | null;
|
|
83
|
+
/**
|
|
84
|
+
* Optimizes a model into the cache unless the cache has it, and returns where it is. The model's
|
|
85
|
+
* folder appears whole or not at all, so a stopped run leaves nothing half written.
|
|
86
|
+
*/
|
|
87
|
+
export declare function optimizedModel(root: string, path: string, options?: AssetOptions): Promise<CachedModel>;
|
|
88
|
+
/** The media type of an optimized file. */
|
|
89
|
+
export declare function assetType(file: string): string;
|
|
90
|
+
/**
|
|
91
|
+
* A cached file of a project by its path from the cache, such as `textures/<name>.ktx2`, for the
|
|
92
|
+
* dev server. A path of any other shape, which could reach outside the cache, gives nothing.
|
|
93
|
+
*/
|
|
94
|
+
export declare function cachedFile(root: string, path: string): Uint8Array | undefined;
|