vireglass 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 +202 -0
- package/NOTICE +10 -0
- package/README.md +216 -0
- package/android/build.gradle +15 -0
- package/android/src/main/AndroidManifest.xml +1 -0
- package/android/src/main/java/expo/modules/glasslens/GlassBackdropView.kt +335 -0
- package/android/src/main/java/expo/modules/glasslens/GlassLensModule.kt +49 -0
- package/android/src/main/java/expo/modules/glasslens/GlassLensView.kt +463 -0
- package/android/src/main/java/expo/modules/glasslens/GlassProbeView.kt +76 -0
- package/dist/adaptation-BSbbdExK.d.cts +78 -0
- package/dist/adaptation-BSbbdExK.d.ts +78 -0
- package/dist/adapters-BPB0D5nr.d.cts +357 -0
- package/dist/adapters-BgSc-smX.d.ts +357 -0
- package/dist/chunk-HF2AWZEZ.js +1741 -0
- package/dist/chunk-HF2AWZEZ.js.map +1 -0
- package/dist/chunk-JNRZNMJJ.js +20 -0
- package/dist/chunk-JNRZNMJJ.js.map +1 -0
- package/dist/index.cjs +2159 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +294 -0
- package/dist/index.d.ts +294 -0
- package/dist/index.js +286 -0
- package/dist/index.js.map +1 -0
- package/dist/material-CkUHUBoy.d.cts +408 -0
- package/dist/material-CkUHUBoy.d.ts +408 -0
- package/dist/react.cjs +73 -0
- package/dist/react.cjs.map +1 -0
- package/dist/react.d.cts +25 -0
- package/dist/react.d.ts +25 -0
- package/dist/react.js +59 -0
- package/dist/react.js.map +1 -0
- package/dist/web/index.cjs +1990 -0
- package/dist/web/index.cjs.map +1 -0
- package/dist/web/index.d.cts +148 -0
- package/dist/web/index.d.ts +148 -0
- package/dist/web/index.js +657 -0
- package/dist/web/index.js.map +1 -0
- package/expo-module.config.json +6 -0
- package/package.json +127 -0
- package/src/accessibility.ts +51 -0
- package/src/adaptation.ts +85 -0
- package/src/adapters.ts +362 -0
- package/src/concentric.ts +25 -0
- package/src/geometry.ts +151 -0
- package/src/glass-scale.ts +37 -0
- package/src/group-model.ts +224 -0
- package/src/index.ts +17 -0
- package/src/lens-shader.ts +547 -0
- package/src/material.ts +553 -0
- package/src/native/environment.ts +70 -0
- package/src/native/glass-group.tsx +107 -0
- package/src/native/glass-ink.tsx +44 -0
- package/src/native/glass-surface.tsx +477 -0
- package/src/native/index.ts +18 -0
- package/src/native/lens.ts +106 -0
- package/src/native/provider.tsx +58 -0
- package/src/native/surface-registry.ts +51 -0
- package/src/native/system-accessibility.ts +90 -0
- package/src/optics.ts +177 -0
- package/src/react.ts +102 -0
- package/src/reference-scene.ts +222 -0
- package/src/scroll-edge.ts +30 -0
- package/src/sdf.ts +149 -0
- package/src/surface-shader.ts +287 -0
- package/src/targets/agsl.ts +8 -0
- package/src/targets/glsl.ts +140 -0
- package/src/touch-response.ts +195 -0
- package/src/web/gl.ts +119 -0
- package/src/web/index.ts +3 -0
- package/src/web/probe.ts +312 -0
- package/src/web/reference-draw.ts +142 -0
- package/src/web/renderer.ts +524 -0
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
type VireGlassTint = {
|
|
2
|
+
r: number;
|
|
3
|
+
g: number;
|
|
4
|
+
b: number;
|
|
5
|
+
};
|
|
6
|
+
type VireGlassMaterial = {
|
|
7
|
+
/** Index of refraction of the medium. Water 1.33, glass 1.5, sapphire 1.77. */
|
|
8
|
+
ior: number;
|
|
9
|
+
/** Glass thickness, dp. Drives center magnification and absorption. */
|
|
10
|
+
thickness: number;
|
|
11
|
+
/** Bevel width, dp. Absolute: on real glass the rim doesn't depend on the piece's size. */
|
|
12
|
+
bevel: number;
|
|
13
|
+
/** Surface roughness: backdrop haziness and highlight blur. */
|
|
14
|
+
roughness: number;
|
|
15
|
+
/** Response to device orientation, 0 means the light is locked to the screen. */
|
|
16
|
+
environment: number;
|
|
17
|
+
/** Not physics but a legibility requirement: how strongly the glass has to separate its own
|
|
18
|
+
* lightness from the ink drawn over it. 0 means the glass is simply transparent. */
|
|
19
|
+
legibility: number;
|
|
20
|
+
/** Dimming layer UNDER the glass, 0..1. For the transparent (Clear) variant this is what
|
|
21
|
+
* provides legibility: that glass has no adaptation, and without dimming the ink drowns over
|
|
22
|
+
* bright content.
|
|
23
|
+
*
|
|
24
|
+
* Not to be confused with the mobile surface's `dim` prop: that one compensates for a platform
|
|
25
|
+
* capture quirk (BlurView can't see a scrim drawn over the content), while this is a property
|
|
26
|
+
* of the material itself. */
|
|
27
|
+
dimming: number;
|
|
28
|
+
/** Lightness of what the app draws OVER the glass: 1 is light icons and text, 0 is dark. A
|
|
29
|
+
* cause, not a knob: the calling screen knows it. */
|
|
30
|
+
ink: number;
|
|
31
|
+
/** Minimum PRESENCE of the element itself: how far its body must stand off in lightness from
|
|
32
|
+
* the backdrop behind it. Not the same as `legibility` — that's about the ink OVER the glass,
|
|
33
|
+
* this is about the element itself. Over a uniform backdrop the glass has nothing to refract,
|
|
34
|
+
* and the element disappears; for a control that's unacceptable. 0 means no presence is
|
|
35
|
+
* required.
|
|
36
|
+
*
|
|
37
|
+
* The sign is taken FROM THE BACKDROP, not from ink polarity: over dark the body lightens,
|
|
38
|
+
* over light it darkens. So the requirement works the same way on any backdrop. */
|
|
39
|
+
presence: number;
|
|
40
|
+
/** Surface film thickness, nm. This is where interference comes from: the optical path
|
|
41
|
+
* difference in the film becomes comparable to the wavelength, and the reflection picks up
|
|
42
|
+
* iridescence. 0 means no film. */
|
|
43
|
+
film: number;
|
|
44
|
+
};
|
|
45
|
+
declare const MATERIAL_RANGES: {
|
|
46
|
+
readonly ior: readonly [1, 2];
|
|
47
|
+
readonly thickness: readonly [0, 60];
|
|
48
|
+
readonly bevel: readonly [0, 40];
|
|
49
|
+
readonly roughness: readonly [0, 1];
|
|
50
|
+
readonly environment: readonly [0, 1];
|
|
51
|
+
readonly legibility: readonly [0, 1];
|
|
52
|
+
readonly dimming: readonly [0, 0.5];
|
|
53
|
+
readonly ink: readonly [0, 1];
|
|
54
|
+
readonly presence: readonly [0, 0.6];
|
|
55
|
+
readonly film: readonly [0, 900];
|
|
56
|
+
};
|
|
57
|
+
type VireGlassNumericKey = keyof typeof MATERIAL_RANGES;
|
|
58
|
+
/** Radius over which the LOCAL backdrop lightness is taken, dp. Not per-pixel: otherwise the
|
|
59
|
+
* glass chases individual strokes and a halo appears around letters beneath it. */
|
|
60
|
+
declare const ADAPT_RADIUS = 22;
|
|
61
|
+
/** Lens dimming on product surfaces — a flat fill over the backdrop. */
|
|
62
|
+
declare const PRODUCT_DIM = 0.2;
|
|
63
|
+
/** The values the shaders need. Assembled from the material, never set by hand. */
|
|
64
|
+
type VireGlassOptics = {
|
|
65
|
+
blur: number;
|
|
66
|
+
refraction: number;
|
|
67
|
+
refractionScale: number;
|
|
68
|
+
/** Bevel width in dp — an absolute property of the medium. */
|
|
69
|
+
bevelDp: number;
|
|
70
|
+
/** Radius over which the rim gathers light around the element. */
|
|
71
|
+
gatherRadiusDp: number;
|
|
72
|
+
fresnel: number;
|
|
73
|
+
fresnelPower: number;
|
|
74
|
+
specular: number;
|
|
75
|
+
specularPower: number;
|
|
76
|
+
dispersion: number;
|
|
77
|
+
tint: VireGlassTint;
|
|
78
|
+
tintStrength: number;
|
|
79
|
+
edgeDensity: number;
|
|
80
|
+
environment: number;
|
|
81
|
+
legibility: number;
|
|
82
|
+
/** Dimming of the content under the glass — the very layer of the Clear variant. */
|
|
83
|
+
dimming: number;
|
|
84
|
+
ink: number;
|
|
85
|
+
/** Minimum presence of the element against the backdrop — in units of lightness. */
|
|
86
|
+
presence: number;
|
|
87
|
+
adaptRadius: number;
|
|
88
|
+
bodyDensity: number;
|
|
89
|
+
edgeLight: number;
|
|
90
|
+
/** Film thickness, nm — passed straight to the shader: the path difference is computed in the
|
|
91
|
+
* same units. */
|
|
92
|
+
film: number;
|
|
93
|
+
/** Strength of reflection iridescence. */
|
|
94
|
+
iridescence: number;
|
|
95
|
+
/** Strength of the edge diffraction fringes. */
|
|
96
|
+
diffraction: number;
|
|
97
|
+
/** How much the body is tinted by the color of its surroundings. */
|
|
98
|
+
colorPickup: number;
|
|
99
|
+
/** Index of refraction: the shader computes ray bending from it via Snell's law. */
|
|
100
|
+
ior: number;
|
|
101
|
+
/** Plate thickness, dp — before the correction for element size. */
|
|
102
|
+
thicknessDp: number;
|
|
103
|
+
/** Spread of the index between the red and blue channels — dispersion. */
|
|
104
|
+
iorSpread: number;
|
|
105
|
+
};
|
|
106
|
+
declare const VIREGLASS_MATERIAL_V4: VireGlassMaterial;
|
|
107
|
+
/**
|
|
108
|
+
* Glass, not water. v4's index of refraction, 1.33, is water: almost no reflection at the rim,
|
|
109
|
+
* almost no dispersion, 2% magnification. On screen that surface honestly reads as "nothing much",
|
|
110
|
+
* and it was being mistaken for glass that wasn't rendering at all.
|
|
111
|
+
*
|
|
112
|
+
* 1.5 is ordinary glass. The effects follow from it on their own: reflection at the rim twice as
|
|
113
|
+
* strong, dispersion one and a half times, ambient color pickup at its ceiling. Thickness is
|
|
114
|
+
* raised a little too: it drives magnification, but absorption comes along with it, and
|
|
115
|
+
* absorption is blackness.
|
|
116
|
+
*/
|
|
117
|
+
declare const VIREGLASS_MATERIAL_V5: VireGlassMaterial;
|
|
118
|
+
/**
|
|
119
|
+
* Frosted sheet glass. The sheet sits over a LIVE screen, and it can't be transparent: transport
|
|
120
|
+
* buttons and progress used to read right through it — the layout looked broken. Dimming doesn't
|
|
121
|
+
* fix this (a flat scrim over a sharp picture doesn't hide it), so roughness is raised instead: it
|
|
122
|
+
* drives `u_frost`, a floor on backdrop blur that the adaptive-blur ceiling doesn't reach.
|
|
123
|
+
*/
|
|
124
|
+
declare const VIREGLASS_SHEET_MATERIAL: VireGlassMaterial;
|
|
125
|
+
/** The product's material. Consumers use this, not a specific version by name. */
|
|
126
|
+
/**
|
|
127
|
+
* Glass under large text (the lyrics panel in the player).
|
|
128
|
+
*
|
|
129
|
+
* The product material with NO change to optics — only `legibility` is raised. That's exactly its
|
|
130
|
+
* reason to exist: "text on me must stay readable." It adds density locally — denser over light
|
|
131
|
+
* and busy backdrops, more transparent over an even dark one.
|
|
132
|
+
*
|
|
133
|
+
* A dedicated thick material (thickness 52, ior 1.58) used to sit here and was removed: medium
|
|
134
|
+
* absorption grows with thickness, and the panel picked up a black fringe around its perimeter —
|
|
135
|
+
* a sooty plate instead of glass. Don't turn thickness into a legibility knob; that's what
|
|
136
|
+
* `legibility` is for.
|
|
137
|
+
*/
|
|
138
|
+
declare const VIREGLASS_LYRICS_MATERIAL: VireGlassMaterial;
|
|
139
|
+
/**
|
|
140
|
+
* Glass for controls — buttons, tiles, anything that gets pressed.
|
|
141
|
+
*
|
|
142
|
+
* THICK AND CLEAR, not the baseline: wider bevel, thickness up by half, higher index of
|
|
143
|
+
* refraction and almost no roughness. Baseline glass is a lens over a calm backdrop; a control has
|
|
144
|
+
* to read as an object you can pick up, and that's not done by a fill but by volume: a wide bevel
|
|
145
|
+
* gives the rim something to catch, and thickness gives it depth.
|
|
146
|
+
*
|
|
147
|
+
* Thickness is set by BUILDUP AT THE RIM: on the reference control the stripe image under the
|
|
148
|
+
* element bulges there by a factor of 1.85; ours came out at 1.36 at 30. Saturation sets in around
|
|
149
|
+
* 44, and any extra thickness past that only adds absorption — hence 44, not more.
|
|
150
|
+
*
|
|
151
|
+
* It also drags `tintStrength` (= `absorption(thickness)`) along with it, and on the path WITHOUT
|
|
152
|
+
* a native lens that sets body density: there the element is denser by 2.4 percentage points. On
|
|
153
|
+
* the web the surface has no body at all; the effect only shows on Android below 13.
|
|
154
|
+
*
|
|
155
|
+
* `presence` is raised for the same reason: a piece of background is allowed to disappear over a
|
|
156
|
+
* uniform canvas, a control isn't — it has to be visible before it's been tapped.
|
|
157
|
+
*
|
|
158
|
+
* IMPORTANT about size. The bevel is specified by the medium in dp and doesn't depend on the
|
|
159
|
+
* element's size, but the geometry clamps it to half the smaller half-size (`MAX_BEVEL_FRACTION`).
|
|
160
|
+
* On a 52 dp button that's 13 instead of 16 — a small element made of this glass ends up being
|
|
161
|
+
* bevel all the way through. That's by design: a small piece of thick glass is supposed to look
|
|
162
|
+
* like a lens, not a slab.
|
|
163
|
+
*/
|
|
164
|
+
declare const VIREGLASS_CONTROL_MATERIAL: VireGlassMaterial;
|
|
165
|
+
declare const VIREGLASS_MATERIAL: VireGlassMaterial;
|
|
166
|
+
/**
|
|
167
|
+
* An element that CARRIES app ink (an icon, a line of text, cover art) has to keep it legible —
|
|
168
|
+
* that's the reason `legibility` exists. An element with no ink has nothing to separate lightness
|
|
169
|
+
* from, so the requirement is turned off for it: the model just promises it plain transparent
|
|
170
|
+
* glass.
|
|
171
|
+
*
|
|
172
|
+
* The rule lives here, not with the consumer: otherwise the same icon button would get different
|
|
173
|
+
* legibility on the web and on Android.
|
|
174
|
+
*/
|
|
175
|
+
declare function materialForInk(material: VireGlassMaterial, carriesInk: boolean): VireGlassMaterial;
|
|
176
|
+
/**
|
|
177
|
+
* The transparent material variant (Clear). It has no adaptation — the glass stays consistently
|
|
178
|
+
* more transparent, content beneath it shows through almost as-is, and legibility of the ink is
|
|
179
|
+
* held by the dimming layer instead. Fit only where the reference's three conditions hold: the
|
|
180
|
+
* element sits over media, the content can tolerate dimming, and the ink over it is large and
|
|
181
|
+
* bright.
|
|
182
|
+
*/
|
|
183
|
+
declare const VIREGLASS_CLEAR_MATERIAL: VireGlassMaterial;
|
|
184
|
+
/**
|
|
185
|
+
* ACTIVE STATE as a state of the MEDIUM, not a highlight drawn over it.
|
|
186
|
+
*
|
|
187
|
+
* An active element is denser, clearer glass: higher index of refraction, thicker body, wider
|
|
188
|
+
* bevel, less roughness. A bright rim, a strong highlight and greater presence all follow from
|
|
189
|
+
* these causes on their own — assembling them separately would produce a state that doesn't occur
|
|
190
|
+
* in real glass.
|
|
191
|
+
*
|
|
192
|
+
* `environment` is deliberately left untouched here. It sets how much the body is tinted by
|
|
193
|
+
* what's beneath it, and at full strength an active button over cover art turned into a colored
|
|
194
|
+
* blob: the state read as "smudged" rather than "selected." A state indicator must not depend on
|
|
195
|
+
* the backdrop — otherwise any image sliding underneath the element would fake it.
|
|
196
|
+
*/
|
|
197
|
+
declare function activeMaterial(material: VireGlassMaterial, on: number): VireGlassMaterial;
|
|
198
|
+
declare function resolveMaterial(patch?: Partial<VireGlassMaterial>): VireGlassMaterial;
|
|
199
|
+
/** Causes → effects. All of the transition's physics lives in `optics.ts`. */
|
|
200
|
+
declare function resolveOptics(patch?: Partial<VireGlassMaterial>): VireGlassOptics;
|
|
201
|
+
/**
|
|
202
|
+
* Frozen snapshots of the EFFECTS from the previous model. Kept as reference points until v4
|
|
203
|
+
* settles: they can't be converted to causes — some of the values are internally inconsistent
|
|
204
|
+
* (exactly why the move was made in the first place), and any "equivalent" material would be a
|
|
205
|
+
* lie.
|
|
206
|
+
*/
|
|
207
|
+
declare const LEGACY_OPTICS: {
|
|
208
|
+
readonly 'v3-manual': {
|
|
209
|
+
readonly blur: 4.32;
|
|
210
|
+
readonly refraction: 0.49;
|
|
211
|
+
readonly refractionScale: 1.05;
|
|
212
|
+
readonly bevelDp: 12.6;
|
|
213
|
+
readonly gatherRadiusDp: 40;
|
|
214
|
+
readonly fresnel: 0.77;
|
|
215
|
+
readonly fresnelPower: 2.86;
|
|
216
|
+
readonly specular: 0.3;
|
|
217
|
+
readonly specularPower: 74.58;
|
|
218
|
+
readonly dispersion: 0.54;
|
|
219
|
+
readonly tint: {
|
|
220
|
+
readonly r: 0.4;
|
|
221
|
+
readonly g: 0.4;
|
|
222
|
+
readonly b: 0.44;
|
|
223
|
+
};
|
|
224
|
+
readonly tintStrength: 0.35;
|
|
225
|
+
readonly edgeDensity: 1.5;
|
|
226
|
+
readonly environment: 0.27;
|
|
227
|
+
readonly legibility: 0.55;
|
|
228
|
+
readonly dimming: 0;
|
|
229
|
+
readonly ink: 1;
|
|
230
|
+
readonly presence: 0;
|
|
231
|
+
readonly adaptRadius: 22;
|
|
232
|
+
readonly bodyDensity: 0.14;
|
|
233
|
+
readonly edgeLight: 0.35;
|
|
234
|
+
readonly film: 0;
|
|
235
|
+
readonly iridescence: 0;
|
|
236
|
+
readonly diffraction: 0;
|
|
237
|
+
readonly colorPickup: 0;
|
|
238
|
+
readonly ior: 1.5;
|
|
239
|
+
readonly thicknessDp: 16;
|
|
240
|
+
readonly iorSpread: 0;
|
|
241
|
+
};
|
|
242
|
+
readonly v2: {
|
|
243
|
+
readonly blur: 5;
|
|
244
|
+
readonly refraction: 0.95;
|
|
245
|
+
readonly refractionScale: 1.34;
|
|
246
|
+
readonly bevelDp: 14;
|
|
247
|
+
readonly gatherRadiusDp: 40;
|
|
248
|
+
readonly fresnel: 0.72;
|
|
249
|
+
readonly fresnelPower: 2.4;
|
|
250
|
+
readonly specular: 0.38;
|
|
251
|
+
readonly specularPower: 46;
|
|
252
|
+
readonly dispersion: 0.3;
|
|
253
|
+
readonly tint: {
|
|
254
|
+
readonly r: 0.4;
|
|
255
|
+
readonly g: 0.4;
|
|
256
|
+
readonly b: 0.44;
|
|
257
|
+
};
|
|
258
|
+
readonly tintStrength: 0.1;
|
|
259
|
+
readonly edgeDensity: 3.63;
|
|
260
|
+
readonly environment: 0;
|
|
261
|
+
readonly legibility: 0;
|
|
262
|
+
readonly dimming: 0;
|
|
263
|
+
readonly ink: 1;
|
|
264
|
+
readonly presence: 0;
|
|
265
|
+
readonly adaptRadius: 22;
|
|
266
|
+
readonly bodyDensity: 0.14;
|
|
267
|
+
readonly edgeLight: 0.35;
|
|
268
|
+
readonly film: 0;
|
|
269
|
+
readonly iridescence: 0;
|
|
270
|
+
readonly diffraction: 0;
|
|
271
|
+
readonly colorPickup: 0;
|
|
272
|
+
readonly ior: 1.5;
|
|
273
|
+
readonly thicknessDp: 16;
|
|
274
|
+
readonly iorSpread: 0;
|
|
275
|
+
};
|
|
276
|
+
readonly v1: {
|
|
277
|
+
readonly blur: 12;
|
|
278
|
+
readonly refraction: 0.55;
|
|
279
|
+
readonly refractionScale: 1.14;
|
|
280
|
+
readonly bevelDp: 10;
|
|
281
|
+
readonly gatherRadiusDp: 40;
|
|
282
|
+
readonly fresnel: 0.5;
|
|
283
|
+
readonly fresnelPower: 3.2;
|
|
284
|
+
readonly specular: 0.42;
|
|
285
|
+
readonly specularPower: 58;
|
|
286
|
+
readonly dispersion: 0.22;
|
|
287
|
+
readonly tint: {
|
|
288
|
+
readonly r: 0.4;
|
|
289
|
+
readonly g: 0.4;
|
|
290
|
+
readonly b: 0.44;
|
|
291
|
+
};
|
|
292
|
+
readonly tintStrength: 0.16;
|
|
293
|
+
readonly edgeDensity: 3.63;
|
|
294
|
+
readonly environment: 0;
|
|
295
|
+
readonly legibility: 0;
|
|
296
|
+
readonly dimming: 0;
|
|
297
|
+
readonly ink: 1;
|
|
298
|
+
readonly presence: 0;
|
|
299
|
+
readonly adaptRadius: 22;
|
|
300
|
+
readonly bodyDensity: 0.14;
|
|
301
|
+
readonly edgeLight: 0.35;
|
|
302
|
+
readonly film: 0;
|
|
303
|
+
readonly iridescence: 0;
|
|
304
|
+
readonly diffraction: 0;
|
|
305
|
+
readonly colorPickup: 0;
|
|
306
|
+
readonly ior: 1.5;
|
|
307
|
+
readonly thicknessDp: 16;
|
|
308
|
+
readonly iorSpread: 0;
|
|
309
|
+
};
|
|
310
|
+
};
|
|
311
|
+
type LegacyOpticsName = keyof typeof LEGACY_OPTICS;
|
|
312
|
+
declare const LEGACY_NAMES: LegacyOpticsName[];
|
|
313
|
+
/** Material presets: points in the space of CAUSES, not a set of ready-made effects. */
|
|
314
|
+
declare const MATERIAL_PRESETS: {
|
|
315
|
+
readonly water: VireGlassMaterial;
|
|
316
|
+
readonly glass: {
|
|
317
|
+
readonly ior: 1.45;
|
|
318
|
+
readonly thickness: 25;
|
|
319
|
+
readonly bevel: 12.6;
|
|
320
|
+
readonly roughness: 0.17;
|
|
321
|
+
readonly environment: number;
|
|
322
|
+
readonly legibility: number;
|
|
323
|
+
readonly dimming: number;
|
|
324
|
+
readonly ink: number;
|
|
325
|
+
readonly presence: number;
|
|
326
|
+
readonly film: number;
|
|
327
|
+
};
|
|
328
|
+
readonly crystal: {
|
|
329
|
+
readonly ior: 1.7;
|
|
330
|
+
readonly thickness: 30;
|
|
331
|
+
readonly bevel: 16;
|
|
332
|
+
readonly roughness: 0.02;
|
|
333
|
+
readonly environment: number;
|
|
334
|
+
readonly legibility: number;
|
|
335
|
+
readonly dimming: number;
|
|
336
|
+
readonly ink: number;
|
|
337
|
+
readonly presence: number;
|
|
338
|
+
readonly film: number;
|
|
339
|
+
};
|
|
340
|
+
readonly frosted: {
|
|
341
|
+
readonly roughness: 0.55;
|
|
342
|
+
readonly ior: number;
|
|
343
|
+
readonly thickness: number;
|
|
344
|
+
readonly bevel: number;
|
|
345
|
+
readonly environment: number;
|
|
346
|
+
readonly legibility: number;
|
|
347
|
+
readonly dimming: number;
|
|
348
|
+
readonly ink: number;
|
|
349
|
+
readonly presence: number;
|
|
350
|
+
readonly film: number;
|
|
351
|
+
};
|
|
352
|
+
readonly thick: {
|
|
353
|
+
readonly thickness: 48;
|
|
354
|
+
readonly bevel: 22;
|
|
355
|
+
readonly ior: number;
|
|
356
|
+
readonly roughness: number;
|
|
357
|
+
readonly environment: number;
|
|
358
|
+
readonly legibility: number;
|
|
359
|
+
readonly dimming: number;
|
|
360
|
+
readonly ink: number;
|
|
361
|
+
readonly presence: number;
|
|
362
|
+
readonly film: number;
|
|
363
|
+
};
|
|
364
|
+
readonly thin: {
|
|
365
|
+
readonly thickness: 4;
|
|
366
|
+
readonly bevel: 3;
|
|
367
|
+
readonly ior: number;
|
|
368
|
+
readonly roughness: number;
|
|
369
|
+
readonly environment: number;
|
|
370
|
+
readonly legibility: number;
|
|
371
|
+
readonly dimming: number;
|
|
372
|
+
readonly ink: number;
|
|
373
|
+
readonly presence: number;
|
|
374
|
+
readonly film: number;
|
|
375
|
+
};
|
|
376
|
+
readonly iridescent: {
|
|
377
|
+
readonly ior: 1.5;
|
|
378
|
+
readonly thickness: 8;
|
|
379
|
+
readonly bevel: 6;
|
|
380
|
+
readonly film: 620;
|
|
381
|
+
readonly roughness: number;
|
|
382
|
+
readonly environment: number;
|
|
383
|
+
readonly legibility: number;
|
|
384
|
+
readonly dimming: number;
|
|
385
|
+
readonly ink: number;
|
|
386
|
+
readonly presence: number;
|
|
387
|
+
};
|
|
388
|
+
};
|
|
389
|
+
type MaterialPresetName = keyof typeof MATERIAL_PRESETS;
|
|
390
|
+
declare const PRESET_NAMES: MaterialPresetName[];
|
|
391
|
+
declare const EFFECTS: readonly ["backdrop", "blur", "refraction", "fresnel", "bevel", "specular", "dispersion", "tint", "environment", "legibility", "interference", "diffraction"];
|
|
392
|
+
type VireGlassEffect = (typeof EFFECTS)[number];
|
|
393
|
+
type VireGlassToggles = Record<VireGlassEffect, boolean>;
|
|
394
|
+
declare const ALL_EFFECTS_ON: VireGlassToggles;
|
|
395
|
+
/**
|
|
396
|
+
* A toggle zeroes out an EFFECT, it isn't a branch in the shader: the ON/OFF comparison runs on
|
|
397
|
+
* one shader variant, otherwise two different programs would be getting compared. It operates on
|
|
398
|
+
* optics, not on the material: a cause can't be zeroed out — it drags half a dozen effects along
|
|
399
|
+
* with it. `backdrop` isn't handled by a toggle here: it decides whether to mount the BlurView at
|
|
400
|
+
* all.
|
|
401
|
+
*/
|
|
402
|
+
declare function applyToggles(optics: VireGlassOptics, toggles?: Partial<VireGlassToggles>): VireGlassOptics;
|
|
403
|
+
/** Order = the `u_debug` value in both shaders. Bench-only. */
|
|
404
|
+
declare const DEBUG_MODES: readonly ["normal", "sdf", "mask", "edge", "fresnel", "refraction", "backdrop", "specular", "dispersion", "normals", "spectral", "adapt", "probe"];
|
|
405
|
+
type VireGlassDebugMode = (typeof DEBUG_MODES)[number];
|
|
406
|
+
declare function debugIndex(mode: VireGlassDebugMode): number;
|
|
407
|
+
|
|
408
|
+
export { ADAPT_RADIUS as A, DEBUG_MODES as D, EFFECTS as E, LEGACY_NAMES as L, MATERIAL_PRESETS as M, PRESET_NAMES as P, type VireGlassOptics as V, ALL_EFFECTS_ON as a, LEGACY_OPTICS as b, type LegacyOpticsName as c, MATERIAL_RANGES as d, type MaterialPresetName as e, PRODUCT_DIM as f, VIREGLASS_CLEAR_MATERIAL as g, VIREGLASS_CONTROL_MATERIAL as h, VIREGLASS_LYRICS_MATERIAL as i, VIREGLASS_MATERIAL as j, VIREGLASS_MATERIAL_V4 as k, VIREGLASS_MATERIAL_V5 as l, VIREGLASS_SHEET_MATERIAL as m, type VireGlassDebugMode as n, type VireGlassEffect as o, type VireGlassMaterial as p, type VireGlassNumericKey as q, type VireGlassTint as r, type VireGlassToggles as s, activeMaterial as t, applyToggles as u, debugIndex as v, materialForInk as w, resolveMaterial as x, resolveOptics as y };
|