@maucwerk/glimmer 1.2.0 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -2
- package/dist/environment/sun.d.ts +9 -0
- package/dist/settings/schema.d.ts +40 -0
- package/dist/story/schema.d.ts +24 -0
- package/dist/vite/glimmer.mjs +34 -5
- package/dist/vite/glimmer.umd.js +8 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -865,7 +865,7 @@ Access-Control-Allow-Methods: GET
|
|
|
865
865
|
## Package Structure
|
|
866
866
|
|
|
867
867
|
```
|
|
868
|
-
@maucwerk/glimmer@1.2.
|
|
868
|
+
@maucwerk/glimmer@1.2.2
|
|
869
869
|
├── dist/
|
|
870
870
|
│ ├── index.d.ts # Main TypeScript declarations
|
|
871
871
|
│ ├── vite/
|
|
@@ -880,7 +880,15 @@ The package supports both ESM and CommonJS with complete TypeScript declarations
|
|
|
880
880
|
|
|
881
881
|
## Version History
|
|
882
882
|
|
|
883
|
-
### v1.2.
|
|
883
|
+
### v1.2.2 (Current)
|
|
884
|
+
|
|
885
|
+
- ✅ CSM actually renders: shadow maps enabled, materials registered, bias controls; bird edges tuned for readability
|
|
886
|
+
|
|
887
|
+
### v1.2.1
|
|
888
|
+
|
|
889
|
+
- ✅ CSM fix: materials are registered with the cascade rig (setupMaterial), so shadows actually render
|
|
890
|
+
|
|
891
|
+
### v1.2.0
|
|
884
892
|
|
|
885
893
|
- ✅ **CSM shadows** - Opt-in cascaded shadow maps (`sun.csm`) for crisp shadows on large sites
|
|
886
894
|
|
|
@@ -48,6 +48,15 @@ export declare class Sun {
|
|
|
48
48
|
* Recreated only when the cascade configuration itself changes.
|
|
49
49
|
*/
|
|
50
50
|
private sync_csm;
|
|
51
|
+
/**
|
|
52
|
+
* CSM only affects materials explicitly registered via setupMaterial.
|
|
53
|
+
* Walk the scene and register every lit built-in material (re-run when
|
|
54
|
+
* models load later). Custom ShaderMaterials are left alone.
|
|
55
|
+
*/
|
|
56
|
+
private setup_csm_materials;
|
|
57
|
+
private models_watched;
|
|
58
|
+
/** Register materials of models that load after the CSM rig was created. */
|
|
59
|
+
private watch_model_loads;
|
|
51
60
|
private teardown_csm;
|
|
52
61
|
dispose(): void;
|
|
53
62
|
}
|
|
@@ -23,16 +23,23 @@ export declare const ShadowCsmSettingsSchema: z.ZodObject<{
|
|
|
23
23
|
max_far: z.ZodDefault<z.ZodNumber>;
|
|
24
24
|
/** Shadow bias for the cascade lights. */
|
|
25
25
|
shadow_bias: z.ZodDefault<z.ZodNumber>;
|
|
26
|
+
/**
|
|
27
|
+
* Shadow normal bias in world units. Pushes the shadow lookup along the
|
|
28
|
+
* surface normal; the main cure for acne/moiré on large flat surfaces.
|
|
29
|
+
*/
|
|
30
|
+
shadow_normal_bias: z.ZodDefault<z.ZodNumber>;
|
|
26
31
|
}, "strip", z.ZodTypeAny, {
|
|
27
32
|
cascades: number;
|
|
28
33
|
shadow_map_size: number;
|
|
29
34
|
max_far: number;
|
|
30
35
|
shadow_bias: number;
|
|
36
|
+
shadow_normal_bias: number;
|
|
31
37
|
}, {
|
|
32
38
|
cascades?: number | undefined;
|
|
33
39
|
shadow_map_size?: number | undefined;
|
|
34
40
|
max_far?: number | undefined;
|
|
35
41
|
shadow_bias?: number | undefined;
|
|
42
|
+
shadow_normal_bias?: number | undefined;
|
|
36
43
|
}>;
|
|
37
44
|
export type ShadowCsmSettingsType = z.infer<typeof ShadowCsmSettingsSchema>;
|
|
38
45
|
export declare const SunSettingsSchema: z.ZodObject<{
|
|
@@ -73,16 +80,23 @@ export declare const SunSettingsSchema: z.ZodObject<{
|
|
|
73
80
|
max_far: z.ZodDefault<z.ZodNumber>;
|
|
74
81
|
/** Shadow bias for the cascade lights. */
|
|
75
82
|
shadow_bias: z.ZodDefault<z.ZodNumber>;
|
|
83
|
+
/**
|
|
84
|
+
* Shadow normal bias in world units. Pushes the shadow lookup along the
|
|
85
|
+
* surface normal; the main cure for acne/moiré on large flat surfaces.
|
|
86
|
+
*/
|
|
87
|
+
shadow_normal_bias: z.ZodDefault<z.ZodNumber>;
|
|
76
88
|
}, "strip", z.ZodTypeAny, {
|
|
77
89
|
cascades: number;
|
|
78
90
|
shadow_map_size: number;
|
|
79
91
|
max_far: number;
|
|
80
92
|
shadow_bias: number;
|
|
93
|
+
shadow_normal_bias: number;
|
|
81
94
|
}, {
|
|
82
95
|
cascades?: number | undefined;
|
|
83
96
|
shadow_map_size?: number | undefined;
|
|
84
97
|
max_far?: number | undefined;
|
|
85
98
|
shadow_bias?: number | undefined;
|
|
99
|
+
shadow_normal_bias?: number | undefined;
|
|
86
100
|
}>>;
|
|
87
101
|
}, "strip", z.ZodTypeAny, {
|
|
88
102
|
color: number;
|
|
@@ -99,6 +113,7 @@ export declare const SunSettingsSchema: z.ZodObject<{
|
|
|
99
113
|
shadow_map_size: number;
|
|
100
114
|
max_far: number;
|
|
101
115
|
shadow_bias: number;
|
|
116
|
+
shadow_normal_bias: number;
|
|
102
117
|
} | undefined;
|
|
103
118
|
}, {
|
|
104
119
|
color?: number | undefined;
|
|
@@ -115,6 +130,7 @@ export declare const SunSettingsSchema: z.ZodObject<{
|
|
|
115
130
|
shadow_map_size?: number | undefined;
|
|
116
131
|
max_far?: number | undefined;
|
|
117
132
|
shadow_bias?: number | undefined;
|
|
133
|
+
shadow_normal_bias?: number | undefined;
|
|
118
134
|
} | undefined;
|
|
119
135
|
}>;
|
|
120
136
|
export type SunSettingsType = z.infer<typeof SunSettingsSchema>;
|
|
@@ -159,16 +175,23 @@ export declare const EnvironmentSchema: z.ZodObject<{
|
|
|
159
175
|
max_far: z.ZodDefault<z.ZodNumber>;
|
|
160
176
|
/** Shadow bias for the cascade lights. */
|
|
161
177
|
shadow_bias: z.ZodDefault<z.ZodNumber>;
|
|
178
|
+
/**
|
|
179
|
+
* Shadow normal bias in world units. Pushes the shadow lookup along the
|
|
180
|
+
* surface normal; the main cure for acne/moiré on large flat surfaces.
|
|
181
|
+
*/
|
|
182
|
+
shadow_normal_bias: z.ZodDefault<z.ZodNumber>;
|
|
162
183
|
}, "strip", z.ZodTypeAny, {
|
|
163
184
|
cascades: number;
|
|
164
185
|
shadow_map_size: number;
|
|
165
186
|
max_far: number;
|
|
166
187
|
shadow_bias: number;
|
|
188
|
+
shadow_normal_bias: number;
|
|
167
189
|
}, {
|
|
168
190
|
cascades?: number | undefined;
|
|
169
191
|
shadow_map_size?: number | undefined;
|
|
170
192
|
max_far?: number | undefined;
|
|
171
193
|
shadow_bias?: number | undefined;
|
|
194
|
+
shadow_normal_bias?: number | undefined;
|
|
172
195
|
}>>;
|
|
173
196
|
}, "strip", z.ZodTypeAny, {
|
|
174
197
|
color: number;
|
|
@@ -185,6 +208,7 @@ export declare const EnvironmentSchema: z.ZodObject<{
|
|
|
185
208
|
shadow_map_size: number;
|
|
186
209
|
max_far: number;
|
|
187
210
|
shadow_bias: number;
|
|
211
|
+
shadow_normal_bias: number;
|
|
188
212
|
} | undefined;
|
|
189
213
|
}, {
|
|
190
214
|
color?: number | undefined;
|
|
@@ -201,6 +225,7 @@ export declare const EnvironmentSchema: z.ZodObject<{
|
|
|
201
225
|
shadow_map_size?: number | undefined;
|
|
202
226
|
max_far?: number | undefined;
|
|
203
227
|
shadow_bias?: number | undefined;
|
|
228
|
+
shadow_normal_bias?: number | undefined;
|
|
204
229
|
} | undefined;
|
|
205
230
|
}>>;
|
|
206
231
|
transparent: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -223,6 +248,7 @@ export declare const EnvironmentSchema: z.ZodObject<{
|
|
|
223
248
|
shadow_map_size: number;
|
|
224
249
|
max_far: number;
|
|
225
250
|
shadow_bias: number;
|
|
251
|
+
shadow_normal_bias: number;
|
|
226
252
|
} | undefined;
|
|
227
253
|
} | undefined;
|
|
228
254
|
}, {
|
|
@@ -243,6 +269,7 @@ export declare const EnvironmentSchema: z.ZodObject<{
|
|
|
243
269
|
shadow_map_size?: number | undefined;
|
|
244
270
|
max_far?: number | undefined;
|
|
245
271
|
shadow_bias?: number | undefined;
|
|
272
|
+
shadow_normal_bias?: number | undefined;
|
|
246
273
|
} | undefined;
|
|
247
274
|
} | undefined;
|
|
248
275
|
transparent?: boolean | undefined;
|
|
@@ -380,16 +407,23 @@ export declare const SettingsSchema: z.ZodObject<{
|
|
|
380
407
|
max_far: z.ZodDefault<z.ZodNumber>;
|
|
381
408
|
/** Shadow bias for the cascade lights. */
|
|
382
409
|
shadow_bias: z.ZodDefault<z.ZodNumber>;
|
|
410
|
+
/**
|
|
411
|
+
* Shadow normal bias in world units. Pushes the shadow lookup along the
|
|
412
|
+
* surface normal; the main cure for acne/moiré on large flat surfaces.
|
|
413
|
+
*/
|
|
414
|
+
shadow_normal_bias: z.ZodDefault<z.ZodNumber>;
|
|
383
415
|
}, "strip", z.ZodTypeAny, {
|
|
384
416
|
cascades: number;
|
|
385
417
|
shadow_map_size: number;
|
|
386
418
|
max_far: number;
|
|
387
419
|
shadow_bias: number;
|
|
420
|
+
shadow_normal_bias: number;
|
|
388
421
|
}, {
|
|
389
422
|
cascades?: number | undefined;
|
|
390
423
|
shadow_map_size?: number | undefined;
|
|
391
424
|
max_far?: number | undefined;
|
|
392
425
|
shadow_bias?: number | undefined;
|
|
426
|
+
shadow_normal_bias?: number | undefined;
|
|
393
427
|
}>>;
|
|
394
428
|
}, "strip", z.ZodTypeAny, {
|
|
395
429
|
color: number;
|
|
@@ -406,6 +440,7 @@ export declare const SettingsSchema: z.ZodObject<{
|
|
|
406
440
|
shadow_map_size: number;
|
|
407
441
|
max_far: number;
|
|
408
442
|
shadow_bias: number;
|
|
443
|
+
shadow_normal_bias: number;
|
|
409
444
|
} | undefined;
|
|
410
445
|
}, {
|
|
411
446
|
color?: number | undefined;
|
|
@@ -422,6 +457,7 @@ export declare const SettingsSchema: z.ZodObject<{
|
|
|
422
457
|
shadow_map_size?: number | undefined;
|
|
423
458
|
max_far?: number | undefined;
|
|
424
459
|
shadow_bias?: number | undefined;
|
|
460
|
+
shadow_normal_bias?: number | undefined;
|
|
425
461
|
} | undefined;
|
|
426
462
|
}>>;
|
|
427
463
|
transparent: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -444,6 +480,7 @@ export declare const SettingsSchema: z.ZodObject<{
|
|
|
444
480
|
shadow_map_size: number;
|
|
445
481
|
max_far: number;
|
|
446
482
|
shadow_bias: number;
|
|
483
|
+
shadow_normal_bias: number;
|
|
447
484
|
} | undefined;
|
|
448
485
|
} | undefined;
|
|
449
486
|
}, {
|
|
@@ -464,6 +501,7 @@ export declare const SettingsSchema: z.ZodObject<{
|
|
|
464
501
|
shadow_map_size?: number | undefined;
|
|
465
502
|
max_far?: number | undefined;
|
|
466
503
|
shadow_bias?: number | undefined;
|
|
504
|
+
shadow_normal_bias?: number | undefined;
|
|
467
505
|
} | undefined;
|
|
468
506
|
} | undefined;
|
|
469
507
|
transparent?: boolean | undefined;
|
|
@@ -577,6 +615,7 @@ export declare const SettingsSchema: z.ZodObject<{
|
|
|
577
615
|
shadow_map_size: number;
|
|
578
616
|
max_far: number;
|
|
579
617
|
shadow_bias: number;
|
|
618
|
+
shadow_normal_bias: number;
|
|
580
619
|
} | undefined;
|
|
581
620
|
} | undefined;
|
|
582
621
|
};
|
|
@@ -622,6 +661,7 @@ export declare const SettingsSchema: z.ZodObject<{
|
|
|
622
661
|
shadow_map_size?: number | undefined;
|
|
623
662
|
max_far?: number | undefined;
|
|
624
663
|
shadow_bias?: number | undefined;
|
|
664
|
+
shadow_normal_bias?: number | undefined;
|
|
625
665
|
} | undefined;
|
|
626
666
|
} | undefined;
|
|
627
667
|
transparent?: boolean | undefined;
|
package/dist/story/schema.d.ts
CHANGED
|
@@ -125,16 +125,19 @@ export declare const StorySlideSchema: z.ZodObject<{
|
|
|
125
125
|
shadow_map_size: z.ZodDefault<z.ZodNumber>;
|
|
126
126
|
max_far: z.ZodDefault<z.ZodNumber>;
|
|
127
127
|
shadow_bias: z.ZodDefault<z.ZodNumber>;
|
|
128
|
+
shadow_normal_bias: z.ZodDefault<z.ZodNumber>;
|
|
128
129
|
}, "strip", z.ZodTypeAny, {
|
|
129
130
|
cascades: number;
|
|
130
131
|
shadow_map_size: number;
|
|
131
132
|
max_far: number;
|
|
132
133
|
shadow_bias: number;
|
|
134
|
+
shadow_normal_bias: number;
|
|
133
135
|
}, {
|
|
134
136
|
cascades?: number | undefined;
|
|
135
137
|
shadow_map_size?: number | undefined;
|
|
136
138
|
max_far?: number | undefined;
|
|
137
139
|
shadow_bias?: number | undefined;
|
|
140
|
+
shadow_normal_bias?: number | undefined;
|
|
138
141
|
}>>;
|
|
139
142
|
}, "strip", z.ZodTypeAny, {
|
|
140
143
|
color: number;
|
|
@@ -151,6 +154,7 @@ export declare const StorySlideSchema: z.ZodObject<{
|
|
|
151
154
|
shadow_map_size: number;
|
|
152
155
|
max_far: number;
|
|
153
156
|
shadow_bias: number;
|
|
157
|
+
shadow_normal_bias: number;
|
|
154
158
|
} | undefined;
|
|
155
159
|
}, {
|
|
156
160
|
color?: number | undefined;
|
|
@@ -167,6 +171,7 @@ export declare const StorySlideSchema: z.ZodObject<{
|
|
|
167
171
|
shadow_map_size?: number | undefined;
|
|
168
172
|
max_far?: number | undefined;
|
|
169
173
|
shadow_bias?: number | undefined;
|
|
174
|
+
shadow_normal_bias?: number | undefined;
|
|
170
175
|
} | undefined;
|
|
171
176
|
}>>;
|
|
172
177
|
transparent: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -189,6 +194,7 @@ export declare const StorySlideSchema: z.ZodObject<{
|
|
|
189
194
|
shadow_map_size: number;
|
|
190
195
|
max_far: number;
|
|
191
196
|
shadow_bias: number;
|
|
197
|
+
shadow_normal_bias: number;
|
|
192
198
|
} | undefined;
|
|
193
199
|
} | undefined;
|
|
194
200
|
}, {
|
|
@@ -209,6 +215,7 @@ export declare const StorySlideSchema: z.ZodObject<{
|
|
|
209
215
|
shadow_map_size?: number | undefined;
|
|
210
216
|
max_far?: number | undefined;
|
|
211
217
|
shadow_bias?: number | undefined;
|
|
218
|
+
shadow_normal_bias?: number | undefined;
|
|
212
219
|
} | undefined;
|
|
213
220
|
} | undefined;
|
|
214
221
|
transparent?: boolean | undefined;
|
|
@@ -322,6 +329,7 @@ export declare const StorySlideSchema: z.ZodObject<{
|
|
|
322
329
|
shadow_map_size: number;
|
|
323
330
|
max_far: number;
|
|
324
331
|
shadow_bias: number;
|
|
332
|
+
shadow_normal_bias: number;
|
|
325
333
|
} | undefined;
|
|
326
334
|
} | undefined;
|
|
327
335
|
} | undefined;
|
|
@@ -367,6 +375,7 @@ export declare const StorySlideSchema: z.ZodObject<{
|
|
|
367
375
|
shadow_map_size?: number | undefined;
|
|
368
376
|
max_far?: number | undefined;
|
|
369
377
|
shadow_bias?: number | undefined;
|
|
378
|
+
shadow_normal_bias?: number | undefined;
|
|
370
379
|
} | undefined;
|
|
371
380
|
} | undefined;
|
|
372
381
|
transparent?: boolean | undefined;
|
|
@@ -512,6 +521,7 @@ export declare const StorySlideSchema: z.ZodObject<{
|
|
|
512
521
|
shadow_map_size: number;
|
|
513
522
|
max_far: number;
|
|
514
523
|
shadow_bias: number;
|
|
524
|
+
shadow_normal_bias: number;
|
|
515
525
|
} | undefined;
|
|
516
526
|
} | undefined;
|
|
517
527
|
} | undefined;
|
|
@@ -589,6 +599,7 @@ export declare const StorySlideSchema: z.ZodObject<{
|
|
|
589
599
|
shadow_map_size?: number | undefined;
|
|
590
600
|
max_far?: number | undefined;
|
|
591
601
|
shadow_bias?: number | undefined;
|
|
602
|
+
shadow_normal_bias?: number | undefined;
|
|
592
603
|
} | undefined;
|
|
593
604
|
} | undefined;
|
|
594
605
|
transparent?: boolean | undefined;
|
|
@@ -700,16 +711,19 @@ export declare const StorySchema: z.ZodObject<{
|
|
|
700
711
|
shadow_map_size: z.ZodDefault<z.ZodNumber>;
|
|
701
712
|
max_far: z.ZodDefault<z.ZodNumber>;
|
|
702
713
|
shadow_bias: z.ZodDefault<z.ZodNumber>;
|
|
714
|
+
shadow_normal_bias: z.ZodDefault<z.ZodNumber>;
|
|
703
715
|
}, "strip", z.ZodTypeAny, {
|
|
704
716
|
cascades: number;
|
|
705
717
|
shadow_map_size: number;
|
|
706
718
|
max_far: number;
|
|
707
719
|
shadow_bias: number;
|
|
720
|
+
shadow_normal_bias: number;
|
|
708
721
|
}, {
|
|
709
722
|
cascades?: number | undefined;
|
|
710
723
|
shadow_map_size?: number | undefined;
|
|
711
724
|
max_far?: number | undefined;
|
|
712
725
|
shadow_bias?: number | undefined;
|
|
726
|
+
shadow_normal_bias?: number | undefined;
|
|
713
727
|
}>>;
|
|
714
728
|
}, "strip", z.ZodTypeAny, {
|
|
715
729
|
color: number;
|
|
@@ -726,6 +740,7 @@ export declare const StorySchema: z.ZodObject<{
|
|
|
726
740
|
shadow_map_size: number;
|
|
727
741
|
max_far: number;
|
|
728
742
|
shadow_bias: number;
|
|
743
|
+
shadow_normal_bias: number;
|
|
729
744
|
} | undefined;
|
|
730
745
|
}, {
|
|
731
746
|
color?: number | undefined;
|
|
@@ -742,6 +757,7 @@ export declare const StorySchema: z.ZodObject<{
|
|
|
742
757
|
shadow_map_size?: number | undefined;
|
|
743
758
|
max_far?: number | undefined;
|
|
744
759
|
shadow_bias?: number | undefined;
|
|
760
|
+
shadow_normal_bias?: number | undefined;
|
|
745
761
|
} | undefined;
|
|
746
762
|
}>>;
|
|
747
763
|
transparent: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -764,6 +780,7 @@ export declare const StorySchema: z.ZodObject<{
|
|
|
764
780
|
shadow_map_size: number;
|
|
765
781
|
max_far: number;
|
|
766
782
|
shadow_bias: number;
|
|
783
|
+
shadow_normal_bias: number;
|
|
767
784
|
} | undefined;
|
|
768
785
|
} | undefined;
|
|
769
786
|
}, {
|
|
@@ -784,6 +801,7 @@ export declare const StorySchema: z.ZodObject<{
|
|
|
784
801
|
shadow_map_size?: number | undefined;
|
|
785
802
|
max_far?: number | undefined;
|
|
786
803
|
shadow_bias?: number | undefined;
|
|
804
|
+
shadow_normal_bias?: number | undefined;
|
|
787
805
|
} | undefined;
|
|
788
806
|
} | undefined;
|
|
789
807
|
transparent?: boolean | undefined;
|
|
@@ -897,6 +915,7 @@ export declare const StorySchema: z.ZodObject<{
|
|
|
897
915
|
shadow_map_size: number;
|
|
898
916
|
max_far: number;
|
|
899
917
|
shadow_bias: number;
|
|
918
|
+
shadow_normal_bias: number;
|
|
900
919
|
} | undefined;
|
|
901
920
|
} | undefined;
|
|
902
921
|
} | undefined;
|
|
@@ -942,6 +961,7 @@ export declare const StorySchema: z.ZodObject<{
|
|
|
942
961
|
shadow_map_size?: number | undefined;
|
|
943
962
|
max_far?: number | undefined;
|
|
944
963
|
shadow_bias?: number | undefined;
|
|
964
|
+
shadow_normal_bias?: number | undefined;
|
|
945
965
|
} | undefined;
|
|
946
966
|
} | undefined;
|
|
947
967
|
transparent?: boolean | undefined;
|
|
@@ -1087,6 +1107,7 @@ export declare const StorySchema: z.ZodObject<{
|
|
|
1087
1107
|
shadow_map_size: number;
|
|
1088
1108
|
max_far: number;
|
|
1089
1109
|
shadow_bias: number;
|
|
1110
|
+
shadow_normal_bias: number;
|
|
1090
1111
|
} | undefined;
|
|
1091
1112
|
} | undefined;
|
|
1092
1113
|
} | undefined;
|
|
@@ -1164,6 +1185,7 @@ export declare const StorySchema: z.ZodObject<{
|
|
|
1164
1185
|
shadow_map_size?: number | undefined;
|
|
1165
1186
|
max_far?: number | undefined;
|
|
1166
1187
|
shadow_bias?: number | undefined;
|
|
1188
|
+
shadow_normal_bias?: number | undefined;
|
|
1167
1189
|
} | undefined;
|
|
1168
1190
|
} | undefined;
|
|
1169
1191
|
transparent?: boolean | undefined;
|
|
@@ -1257,6 +1279,7 @@ export declare const StorySchema: z.ZodObject<{
|
|
|
1257
1279
|
shadow_map_size: number;
|
|
1258
1280
|
max_far: number;
|
|
1259
1281
|
shadow_bias: number;
|
|
1282
|
+
shadow_normal_bias: number;
|
|
1260
1283
|
} | undefined;
|
|
1261
1284
|
} | undefined;
|
|
1262
1285
|
} | undefined;
|
|
@@ -1342,6 +1365,7 @@ export declare const StorySchema: z.ZodObject<{
|
|
|
1342
1365
|
shadow_map_size?: number | undefined;
|
|
1343
1366
|
max_far?: number | undefined;
|
|
1344
1367
|
shadow_bias?: number | undefined;
|
|
1368
|
+
shadow_normal_bias?: number | undefined;
|
|
1345
1369
|
} | undefined;
|
|
1346
1370
|
} | undefined;
|
|
1347
1371
|
transparent?: boolean | undefined;
|
package/dist/vite/glimmer.mjs
CHANGED
|
@@ -2985,7 +2985,12 @@ const Nc = b.object({
|
|
|
2985
2985
|
/** Farthest distance covered by the cascades, in world units. */
|
|
2986
2986
|
max_far: b.number().default(2e3),
|
|
2987
2987
|
/** Shadow bias for the cascade lights. */
|
|
2988
|
-
shadow_bias: b.number().default(
|
|
2988
|
+
shadow_bias: b.number().default(2e-4),
|
|
2989
|
+
/**
|
|
2990
|
+
* Shadow normal bias in world units. Pushes the shadow lookup along the
|
|
2991
|
+
* surface normal; the main cure for acne/moiré on large flat surfaces.
|
|
2992
|
+
*/
|
|
2993
|
+
shadow_normal_bias: b.number().default(0.1)
|
|
2989
2994
|
}), zc = b.object({
|
|
2990
2995
|
color: b.number().default(16711680),
|
|
2991
2996
|
intensity: b.number().default(1),
|
|
@@ -5477,6 +5482,7 @@ class Il {
|
|
|
5477
5482
|
_(this, "csm", null);
|
|
5478
5483
|
_(this, "csm_key", null);
|
|
5479
5484
|
_(this, "csm_callback", null);
|
|
5485
|
+
_(this, "models_watched", !1);
|
|
5480
5486
|
this.viewer = e, this.scene = e.scene, this.settings = t, this.environment = n, this.model_manager = s, this.sun_settings = this.settings.get("environment").sun, this.settings.addEventListener("update", (i) => {
|
|
5481
5487
|
const o = i.detail;
|
|
5482
5488
|
this.sun_settings = o.environment.sun, this.update();
|
|
@@ -5629,7 +5635,7 @@ class Il {
|
|
|
5629
5635
|
*/
|
|
5630
5636
|
sync_csm(e) {
|
|
5631
5637
|
const t = this.sun_settings.csm, n = JSON.stringify(t), s = new p.Vector3(-e.position[0], -e.position[1], -e.position[2]).normalize();
|
|
5632
|
-
!this.csm || this.csm_key !== n ? (this.teardown_csm(), this.csm = new dl({
|
|
5638
|
+
!this.csm || this.csm_key !== n ? (this.teardown_csm(), this.viewer.renderer.shadowMap.enabled = !0, this.csm = new dl({
|
|
5633
5639
|
camera: this.viewer.camera,
|
|
5634
5640
|
parent: this.scene,
|
|
5635
5641
|
cascades: t.cascades,
|
|
@@ -5640,12 +5646,35 @@ class Il {
|
|
|
5640
5646
|
lightDirection: s.clone(),
|
|
5641
5647
|
lightIntensity: e.intensity
|
|
5642
5648
|
}), this.csm.lights.forEach((i) => {
|
|
5643
|
-
i.color.set(e.color), i.intensity = e.intensity;
|
|
5649
|
+
i.color.set(e.color), i.intensity = e.intensity, i.shadow.normalBias = t.shadow_normal_bias;
|
|
5644
5650
|
}), this.csm_callback = () => {
|
|
5645
5651
|
var i;
|
|
5646
5652
|
(i = this.csm) == null || i.update();
|
|
5647
|
-
}, this.viewer.register_animation_callback(this.csm_callback), this.csm_key = n) : (this.csm.lightDirection.copy(s), this.csm.lightIntensity = e.intensity, this.csm.lights.forEach((i) => {
|
|
5648
|
-
i.color.set(e.color), i.intensity = e.intensity;
|
|
5653
|
+
}, this.viewer.register_animation_callback(this.csm_callback), this.csm_key = n, this.watch_model_loads()) : (this.csm.lightDirection.copy(s), this.csm.lightIntensity = e.intensity, this.csm.lights.forEach((i) => {
|
|
5654
|
+
i.color.set(e.color), i.intensity = e.intensity, i.shadow.normalBias = t.shadow_normal_bias;
|
|
5655
|
+
})), this.setup_csm_materials();
|
|
5656
|
+
}
|
|
5657
|
+
/**
|
|
5658
|
+
* CSM only affects materials explicitly registered via setupMaterial.
|
|
5659
|
+
* Walk the scene and register every lit built-in material (re-run when
|
|
5660
|
+
* models load later). Custom ShaderMaterials are left alone.
|
|
5661
|
+
*/
|
|
5662
|
+
setup_csm_materials() {
|
|
5663
|
+
!this.csm || !this.csm_key || this.scene.traverse((e) => {
|
|
5664
|
+
const t = e;
|
|
5665
|
+
if (!t.isMesh) return;
|
|
5666
|
+
const n = Array.isArray(t.material) ? t.material : [t.material];
|
|
5667
|
+
for (const s of n) {
|
|
5668
|
+
if (!s) continue;
|
|
5669
|
+
const i = s;
|
|
5670
|
+
(i.isMeshStandardMaterial || i.isMeshLambertMaterial || i.isMeshPhongMaterial) && i.userData.csm_setup_key !== this.csm_key && (this.csm.setupMaterial(i), i.userData.csm_setup_key = this.csm_key, i.needsUpdate = !0);
|
|
5671
|
+
}
|
|
5672
|
+
});
|
|
5673
|
+
}
|
|
5674
|
+
/** Register materials of models that load after the CSM rig was created. */
|
|
5675
|
+
watch_model_loads() {
|
|
5676
|
+
this.models_watched || (this.models_watched = !0, this.model_manager.addEventListener("loaded", () => {
|
|
5677
|
+
this.setup_csm_materials();
|
|
5649
5678
|
}));
|
|
5650
5679
|
}
|
|
5651
5680
|
teardown_csm() {
|