@shopware-ag/dive 2.3.2 → 2.3.4

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.
Files changed (42) hide show
  1. package/build/chunks/AssetCache-BGhI8x1d.cjs +1 -0
  2. package/build/chunks/{AssetCache-BXvm8HET.mjs → AssetCache-vZNrds4b.mjs} +4 -3
  3. package/build/chunks/{AssetLoader-B6SvP7k4.mjs → AssetLoader-CKgwQqPR.mjs} +6 -5
  4. package/build/chunks/AssetLoader-CPDaxCG0.cjs +5 -0
  5. package/build/chunks/DIVEShaderMaterial-Bt0d8oJB.mjs +3468 -0
  6. package/build/chunks/DIVEShaderMaterial-DE8YRWj9.cjs +1554 -0
  7. package/build/chunks/{FileTypes-DuSg6g55.mjs → FileTypes-CvRI-n62.mjs} +283 -256
  8. package/build/chunks/FileTypes-DdxvUmTD.cjs +33 -0
  9. package/build/chunks/{isFileTypeSupported-BayQNRd8.cjs → isFileTypeSupported-Crq0YXta.cjs} +1 -1
  10. package/build/chunks/{isFileTypeSupported-Bx-sXj7e.mjs → isFileTypeSupported-Da7WwOLq.mjs} +1 -1
  11. package/build/components/grid/Grid.d.ts +15 -3
  12. package/build/constants/GridColors.d.ts +2 -2
  13. package/build/dive.cjs +1 -1
  14. package/build/dive.mjs +11 -11
  15. package/build/engine/scene/Scene.d.ts +13 -0
  16. package/build/plugins/ar/index.cjs +1 -1
  17. package/build/plugins/ar/index.mjs +1 -1
  18. package/build/plugins/assetcache/index.cjs +1 -1
  19. package/build/plugins/assetcache/index.mjs +1 -1
  20. package/build/plugins/assetloader/index.cjs +1 -1
  21. package/build/plugins/assetloader/index.mjs +2 -2
  22. package/build/plugins/orbitcontroller/index.cjs +1 -1
  23. package/build/plugins/orbitcontroller/index.mjs +1 -1
  24. package/build/plugins/orientationdisplay/index.cjs +1 -1
  25. package/build/plugins/orientationdisplay/index.mjs +4 -3
  26. package/build/plugins/quickview/index.cjs +1 -1
  27. package/build/plugins/quickview/index.mjs +6 -5
  28. package/build/plugins/shader/index.cjs +1 -0
  29. package/build/plugins/shader/index.d.ts +1 -0
  30. package/build/plugins/shader/index.mjs +5 -0
  31. package/build/plugins/shader/src/index.d.ts +3 -0
  32. package/build/plugins/shader/src/material/DIVEShaderMaterial.d.ts +5 -0
  33. package/build/plugins/shader/src/shaders/DIVEShaderLib.d.ts +2 -0
  34. package/build/plugins/shader/src/shaders/grid/index.d.ts +40 -0
  35. package/build/plugins/state/index.cjs +1 -1
  36. package/build/plugins/state/index.mjs +501 -500
  37. package/build/plugins/toolbox/index.cjs +1 -1
  38. package/build/plugins/toolbox/index.mjs +10 -9
  39. package/package.json +6 -1
  40. package/build/chunks/AssetCache-8nTvkZ09.cjs +0 -1
  41. package/build/chunks/AssetLoader-CfC1TqJY.cjs +0 -5
  42. package/build/chunks/FileTypes-DbnYPUAi.cjs +0 -33
@@ -0,0 +1,1554 @@
1
+ "use strict";const H=require("three"),ie=`
2
+ varying vec2 vUv;
3
+ uniform mat3 uvTransform;
4
+
5
+ void main() {
6
+
7
+ vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
8
+
9
+ gl_Position = vec4( position.xy, 1.0, 1.0 );
10
+
11
+ }
12
+ `,ne=`
13
+ uniform sampler2D t2D;
14
+ uniform float backgroundIntensity;
15
+
16
+ varying vec2 vUv;
17
+
18
+ void main() {
19
+
20
+ vec4 texColor = texture2D( t2D, vUv );
21
+
22
+ #ifdef DECODE_VIDEO_TEXTURE
23
+
24
+ // use inline sRGB decode until browsers properly support SRGB8_APLHA8 with video textures
25
+
26
+ texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );
27
+
28
+ #endif
29
+
30
+ texColor.rgb *= backgroundIntensity;
31
+
32
+ gl_FragColor = texColor;
33
+
34
+ #include <tonemapping_fragment>
35
+ #include <colorspace_fragment>
36
+
37
+ }
38
+ `,re=`
39
+ varying vec3 vWorldDirection;
40
+
41
+ #include <common>
42
+
43
+ void main() {
44
+
45
+ vWorldDirection = transformDirection( position, modelMatrix );
46
+
47
+ #include <begin_vertex>
48
+ #include <project_vertex>
49
+
50
+ gl_Position.z = gl_Position.w; // set z to camera.far
51
+
52
+ }
53
+ `,ae=`
54
+
55
+ #ifdef ENVMAP_TYPE_CUBE
56
+
57
+ uniform samplerCube envMap;
58
+
59
+ #elif defined( ENVMAP_TYPE_CUBE_UV )
60
+
61
+ uniform sampler2D envMap;
62
+
63
+ #endif
64
+
65
+ uniform float flipEnvMap;
66
+ uniform float backgroundBlurriness;
67
+ uniform float backgroundIntensity;
68
+ uniform mat3 backgroundRotation;
69
+
70
+ varying vec3 vWorldDirection;
71
+
72
+ #include <cube_uv_reflection_fragment>
73
+
74
+ void main() {
75
+
76
+ #ifdef ENVMAP_TYPE_CUBE
77
+
78
+ vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );
79
+
80
+ #elif defined( ENVMAP_TYPE_CUBE_UV )
81
+
82
+ vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );
83
+
84
+ #else
85
+
86
+ vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
87
+
88
+ #endif
89
+
90
+ texColor.rgb *= backgroundIntensity;
91
+
92
+ gl_FragColor = texColor;
93
+
94
+ #include <tonemapping_fragment>
95
+ #include <colorspace_fragment>
96
+
97
+ }
98
+ `,se=`
99
+ varying vec3 vWorldDirection;
100
+
101
+ #include <common>
102
+
103
+ void main() {
104
+
105
+ vWorldDirection = transformDirection( position, modelMatrix );
106
+
107
+ #include <begin_vertex>
108
+ #include <project_vertex>
109
+
110
+ gl_Position.z = gl_Position.w; // set z to camera.far
111
+
112
+ }
113
+ `,le=`
114
+ uniform samplerCube tCube;
115
+ uniform float tFlip;
116
+ uniform float opacity;
117
+
118
+ varying vec3 vWorldDirection;
119
+
120
+ void main() {
121
+
122
+ vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
123
+
124
+ gl_FragColor = texColor;
125
+ gl_FragColor.a *= opacity;
126
+
127
+ #include <tonemapping_fragment>
128
+ #include <colorspace_fragment>
129
+
130
+ }
131
+ `,oe=`
132
+ #include <common>
133
+ #include <batching_pars_vertex>
134
+ #include <uv_pars_vertex>
135
+ #include <displacementmap_pars_vertex>
136
+ #include <morphtarget_pars_vertex>
137
+ #include <skinning_pars_vertex>
138
+ #include <logdepthbuf_pars_vertex>
139
+ #include <clipping_planes_pars_vertex>
140
+
141
+ // This is used for computing an equivalent of gl_FragCoord.z that is as high precision as possible.
142
+ // Some platforms compute gl_FragCoord at a lower precision which makes the manually computed value better for
143
+ // depth-based postprocessing effects. Reproduced on iPad with A10 processor / iPadOS 13.3.1.
144
+ varying vec2 vHighPrecisionZW;
145
+
146
+ void main() {
147
+
148
+ #include <uv_vertex>
149
+
150
+ #include <batching_vertex>
151
+ #include <skinbase_vertex>
152
+
153
+ #include <morphinstance_vertex>
154
+
155
+ #ifdef USE_DISPLACEMENTMAP
156
+
157
+ #include <beginnormal_vertex>
158
+ #include <morphnormal_vertex>
159
+ #include <skinnormal_vertex>
160
+
161
+ #endif
162
+
163
+ #include <begin_vertex>
164
+ #include <morphtarget_vertex>
165
+ #include <skinning_vertex>
166
+ #include <displacementmap_vertex>
167
+ #include <project_vertex>
168
+ #include <logdepthbuf_vertex>
169
+ #include <clipping_planes_vertex>
170
+
171
+ vHighPrecisionZW = gl_Position.zw;
172
+
173
+ }
174
+ `,ce=`
175
+ #if DEPTH_PACKING == 3200
176
+
177
+ uniform float opacity;
178
+
179
+ #endif
180
+
181
+ #include <common>
182
+ #include <packing>
183
+ #include <uv_pars_fragment>
184
+ #include <map_pars_fragment>
185
+ #include <alphamap_pars_fragment>
186
+ #include <alphatest_pars_fragment>
187
+ #include <alphahash_pars_fragment>
188
+ #include <logdepthbuf_pars_fragment>
189
+ #include <clipping_planes_pars_fragment>
190
+
191
+ varying vec2 vHighPrecisionZW;
192
+
193
+ void main() {
194
+
195
+ vec4 diffuseColor = vec4( 1.0 );
196
+ #include <clipping_planes_fragment>
197
+
198
+ #if DEPTH_PACKING == 3200
199
+
200
+ diffuseColor.a = opacity;
201
+
202
+ #endif
203
+
204
+ #include <map_fragment>
205
+ #include <alphamap_fragment>
206
+ #include <alphatest_fragment>
207
+ #include <alphahash_fragment>
208
+
209
+ #include <logdepthbuf_fragment>
210
+
211
+ // Higher precision equivalent of gl_FragCoord.z. This assumes depthRange has been left to its default values.
212
+ float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;
213
+
214
+ #if DEPTH_PACKING == 3200
215
+
216
+ gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
217
+
218
+ #elif DEPTH_PACKING == 3201
219
+
220
+ gl_FragColor = packDepthToRGBA( fragCoordZ );
221
+
222
+ #endif
223
+
224
+ }
225
+ `,ue=`
226
+ #define DISTANCE
227
+
228
+ varying vec3 vWorldPosition;
229
+
230
+ #include <common>
231
+ #include <batching_pars_vertex>
232
+ #include <uv_pars_vertex>
233
+ #include <displacementmap_pars_vertex>
234
+ #include <morphtarget_pars_vertex>
235
+ #include <skinning_pars_vertex>
236
+ #include <clipping_planes_pars_vertex>
237
+
238
+ void main() {
239
+
240
+ #include <uv_vertex>
241
+
242
+ #include <batching_vertex>
243
+ #include <skinbase_vertex>
244
+
245
+ #include <morphinstance_vertex>
246
+
247
+ #ifdef USE_DISPLACEMENTMAP
248
+
249
+ #include <beginnormal_vertex>
250
+ #include <morphnormal_vertex>
251
+ #include <skinnormal_vertex>
252
+
253
+ #endif
254
+
255
+ #include <begin_vertex>
256
+ #include <morphtarget_vertex>
257
+ #include <skinning_vertex>
258
+ #include <displacementmap_vertex>
259
+ #include <project_vertex>
260
+ #include <worldpos_vertex>
261
+ #include <clipping_planes_vertex>
262
+
263
+ vWorldPosition = worldPosition.xyz;
264
+
265
+ }
266
+ `,he=`
267
+ #define DISTANCE
268
+
269
+ uniform vec3 referencePosition;
270
+ uniform float nearDistance;
271
+ uniform float farDistance;
272
+ varying vec3 vWorldPosition;
273
+
274
+ #include <common>
275
+ #include <packing>
276
+ #include <uv_pars_fragment>
277
+ #include <map_pars_fragment>
278
+ #include <alphamap_pars_fragment>
279
+ #include <alphatest_pars_fragment>
280
+ #include <alphahash_pars_fragment>
281
+ #include <clipping_planes_pars_fragment>
282
+
283
+ void main () {
284
+
285
+ vec4 diffuseColor = vec4( 1.0 );
286
+ #include <clipping_planes_fragment>
287
+
288
+ #include <map_fragment>
289
+ #include <alphamap_fragment>
290
+ #include <alphatest_fragment>
291
+ #include <alphahash_fragment>
292
+
293
+ float dist = length( vWorldPosition - referencePosition );
294
+ dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
295
+ dist = saturate( dist ); // clamp to [ 0, 1 ]
296
+
297
+ gl_FragColor = packDepthToRGBA( dist );
298
+
299
+ }
300
+ `,de=`
301
+ varying vec3 vWorldDirection;
302
+
303
+ #include <common>
304
+
305
+ void main() {
306
+
307
+ vWorldDirection = transformDirection( position, modelMatrix );
308
+
309
+ #include <begin_vertex>
310
+ #include <project_vertex>
311
+
312
+ }
313
+ `,me=`
314
+ uniform sampler2D tEquirect;
315
+
316
+ varying vec3 vWorldDirection;
317
+
318
+ #include <common>
319
+
320
+ void main() {
321
+
322
+ vec3 direction = normalize( vWorldDirection );
323
+
324
+ vec2 sampleUV = equirectUv( direction );
325
+
326
+ gl_FragColor = texture2D( tEquirect, sampleUV );
327
+
328
+ #include <tonemapping_fragment>
329
+ #include <colorspace_fragment>
330
+
331
+ }
332
+ `,pe=`
333
+ uniform float scale;
334
+ attribute float lineDistance;
335
+
336
+ varying float vLineDistance;
337
+
338
+ #include <common>
339
+ #include <uv_pars_vertex>
340
+ #include <color_pars_vertex>
341
+ #include <fog_pars_vertex>
342
+ #include <morphtarget_pars_vertex>
343
+ #include <logdepthbuf_pars_vertex>
344
+ #include <clipping_planes_pars_vertex>
345
+
346
+ void main() {
347
+
348
+ vLineDistance = scale * lineDistance;
349
+
350
+ #include <uv_vertex>
351
+ #include <color_vertex>
352
+ #include <morphinstance_vertex>
353
+ #include <morphcolor_vertex>
354
+ #include <begin_vertex>
355
+ #include <morphtarget_vertex>
356
+ #include <project_vertex>
357
+ #include <logdepthbuf_vertex>
358
+ #include <clipping_planes_vertex>
359
+ #include <fog_vertex>
360
+
361
+ }
362
+ `,_e=`
363
+ uniform vec3 diffuse;
364
+ uniform float opacity;
365
+
366
+ uniform float dashSize;
367
+ uniform float totalSize;
368
+
369
+ varying float vLineDistance;
370
+
371
+ #include <common>
372
+ #include <color_pars_fragment>
373
+ #include <uv_pars_fragment>
374
+ #include <map_pars_fragment>
375
+ #include <fog_pars_fragment>
376
+ #include <logdepthbuf_pars_fragment>
377
+ #include <clipping_planes_pars_fragment>
378
+
379
+ void main() {
380
+
381
+ vec4 diffuseColor = vec4( diffuse, opacity );
382
+ #include <clipping_planes_fragment>
383
+
384
+ if ( mod( vLineDistance, totalSize ) > dashSize ) {
385
+
386
+ discard;
387
+
388
+ }
389
+
390
+ vec3 outgoingLight = vec3( 0.0 );
391
+
392
+ #include <logdepthbuf_fragment>
393
+ #include <map_fragment>
394
+ #include <color_fragment>
395
+
396
+ outgoingLight = diffuseColor.rgb; // simple shader
397
+
398
+ #include <opaque_fragment>
399
+ #include <tonemapping_fragment>
400
+ #include <colorspace_fragment>
401
+ #include <fog_fragment>
402
+ #include <premultiplied_alpha_fragment>
403
+
404
+ }
405
+ `,ge=`
406
+ #include <common>
407
+ #include <batching_pars_vertex>
408
+ #include <uv_pars_vertex>
409
+ #include <envmap_pars_vertex>
410
+ #include <color_pars_vertex>
411
+ #include <fog_pars_vertex>
412
+ #include <morphtarget_pars_vertex>
413
+ #include <skinning_pars_vertex>
414
+ #include <logdepthbuf_pars_vertex>
415
+ #include <clipping_planes_pars_vertex>
416
+
417
+ void main() {
418
+
419
+ #include <uv_vertex>
420
+ #include <color_vertex>
421
+ #include <morphinstance_vertex>
422
+ #include <morphcolor_vertex>
423
+ #include <batching_vertex>
424
+
425
+ #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
426
+
427
+ #include <beginnormal_vertex>
428
+ #include <morphnormal_vertex>
429
+ #include <skinbase_vertex>
430
+ #include <skinnormal_vertex>
431
+ #include <defaultnormal_vertex>
432
+
433
+ #endif
434
+
435
+ #include <begin_vertex>
436
+ #include <morphtarget_vertex>
437
+ #include <skinning_vertex>
438
+ #include <project_vertex>
439
+ #include <logdepthbuf_vertex>
440
+ #include <clipping_planes_vertex>
441
+
442
+ #include <worldpos_vertex>
443
+ #include <envmap_vertex>
444
+ #include <fog_vertex>
445
+
446
+ }
447
+ `,fe=`
448
+ uniform vec3 diffuse;
449
+ uniform float opacity;
450
+
451
+ #ifndef FLAT_SHADED
452
+
453
+ varying vec3 vNormal;
454
+
455
+ #endif
456
+
457
+ #include <common>
458
+ #include <dithering_pars_fragment>
459
+ #include <color_pars_fragment>
460
+ #include <uv_pars_fragment>
461
+ #include <map_pars_fragment>
462
+ #include <alphamap_pars_fragment>
463
+ #include <alphatest_pars_fragment>
464
+ #include <alphahash_pars_fragment>
465
+ #include <aomap_pars_fragment>
466
+ #include <lightmap_pars_fragment>
467
+ #include <envmap_common_pars_fragment>
468
+ #include <envmap_pars_fragment>
469
+ #include <fog_pars_fragment>
470
+ #include <specularmap_pars_fragment>
471
+ #include <logdepthbuf_pars_fragment>
472
+ #include <clipping_planes_pars_fragment>
473
+
474
+ void main() {
475
+
476
+ vec4 diffuseColor = vec4( diffuse, opacity );
477
+ #include <clipping_planes_fragment>
478
+
479
+ #include <logdepthbuf_fragment>
480
+ #include <map_fragment>
481
+ #include <color_fragment>
482
+ #include <alphamap_fragment>
483
+ #include <alphatest_fragment>
484
+ #include <alphahash_fragment>
485
+ #include <specularmap_fragment>
486
+
487
+ ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
488
+
489
+ // accumulation (baked indirect lighting only)
490
+ #ifdef USE_LIGHTMAP
491
+
492
+ vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
493
+ reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
494
+
495
+ #else
496
+
497
+ reflectedLight.indirectDiffuse += vec3( 1.0 );
498
+
499
+ #endif
500
+
501
+ // modulation
502
+ #include <aomap_fragment>
503
+
504
+ reflectedLight.indirectDiffuse *= diffuseColor.rgb;
505
+
506
+ vec3 outgoingLight = reflectedLight.indirectDiffuse;
507
+
508
+ #include <envmap_fragment>
509
+
510
+ #include <opaque_fragment>
511
+ #include <tonemapping_fragment>
512
+ #include <colorspace_fragment>
513
+ #include <fog_fragment>
514
+ #include <premultiplied_alpha_fragment>
515
+ #include <dithering_fragment>
516
+
517
+ }
518
+ `,ve=`
519
+ #define LAMBERT
520
+
521
+ varying vec3 vViewPosition;
522
+
523
+ #include <common>
524
+ #include <batching_pars_vertex>
525
+ #include <uv_pars_vertex>
526
+ #include <displacementmap_pars_vertex>
527
+ #include <envmap_pars_vertex>
528
+ #include <color_pars_vertex>
529
+ #include <fog_pars_vertex>
530
+ #include <normal_pars_vertex>
531
+ #include <morphtarget_pars_vertex>
532
+ #include <skinning_pars_vertex>
533
+ #include <shadowmap_pars_vertex>
534
+ #include <logdepthbuf_pars_vertex>
535
+ #include <clipping_planes_pars_vertex>
536
+
537
+ void main() {
538
+
539
+ #include <uv_vertex>
540
+ #include <color_vertex>
541
+ #include <morphinstance_vertex>
542
+ #include <morphcolor_vertex>
543
+ #include <batching_vertex>
544
+
545
+ #include <beginnormal_vertex>
546
+ #include <morphnormal_vertex>
547
+ #include <skinbase_vertex>
548
+ #include <skinnormal_vertex>
549
+ #include <defaultnormal_vertex>
550
+ #include <normal_vertex>
551
+
552
+ #include <begin_vertex>
553
+ #include <morphtarget_vertex>
554
+ #include <skinning_vertex>
555
+ #include <displacementmap_vertex>
556
+ #include <project_vertex>
557
+ #include <logdepthbuf_vertex>
558
+ #include <clipping_planes_vertex>
559
+
560
+ vViewPosition = - mvPosition.xyz;
561
+
562
+ #include <worldpos_vertex>
563
+ #include <envmap_vertex>
564
+ #include <shadowmap_vertex>
565
+ #include <fog_vertex>
566
+
567
+ }
568
+ `,xe=`
569
+ #define LAMBERT
570
+
571
+ uniform vec3 diffuse;
572
+ uniform vec3 emissive;
573
+ uniform float opacity;
574
+
575
+ #include <common>
576
+ #include <packing>
577
+ #include <dithering_pars_fragment>
578
+ #include <color_pars_fragment>
579
+ #include <uv_pars_fragment>
580
+ #include <map_pars_fragment>
581
+ #include <alphamap_pars_fragment>
582
+ #include <alphatest_pars_fragment>
583
+ #include <alphahash_pars_fragment>
584
+ #include <aomap_pars_fragment>
585
+ #include <lightmap_pars_fragment>
586
+ #include <emissivemap_pars_fragment>
587
+ #include <envmap_common_pars_fragment>
588
+ #include <envmap_pars_fragment>
589
+ #include <fog_pars_fragment>
590
+ #include <bsdfs>
591
+ #include <lights_pars_begin>
592
+ #include <normal_pars_fragment>
593
+ #include <lights_lambert_pars_fragment>
594
+ #include <shadowmap_pars_fragment>
595
+ #include <bumpmap_pars_fragment>
596
+ #include <normalmap_pars_fragment>
597
+ #include <specularmap_pars_fragment>
598
+ #include <logdepthbuf_pars_fragment>
599
+ #include <clipping_planes_pars_fragment>
600
+
601
+ void main() {
602
+
603
+ vec4 diffuseColor = vec4( diffuse, opacity );
604
+ #include <clipping_planes_fragment>
605
+
606
+ ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
607
+ vec3 totalEmissiveRadiance = emissive;
608
+
609
+ #include <logdepthbuf_fragment>
610
+ #include <map_fragment>
611
+ #include <color_fragment>
612
+ #include <alphamap_fragment>
613
+ #include <alphatest_fragment>
614
+ #include <alphahash_fragment>
615
+ #include <specularmap_fragment>
616
+ #include <normal_fragment_begin>
617
+ #include <normal_fragment_maps>
618
+ #include <emissivemap_fragment>
619
+
620
+ // accumulation
621
+ #include <lights_lambert_fragment>
622
+ #include <lights_fragment_begin>
623
+ #include <lights_fragment_maps>
624
+ #include <lights_fragment_end>
625
+
626
+ // modulation
627
+ #include <aomap_fragment>
628
+
629
+ vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
630
+
631
+ #include <envmap_fragment>
632
+ #include <opaque_fragment>
633
+ #include <tonemapping_fragment>
634
+ #include <colorspace_fragment>
635
+ #include <fog_fragment>
636
+ #include <premultiplied_alpha_fragment>
637
+ #include <dithering_fragment>
638
+
639
+ }
640
+ `,ye=`
641
+ #define MATCAP
642
+
643
+ varying vec3 vViewPosition;
644
+
645
+ #include <common>
646
+ #include <batching_pars_vertex>
647
+ #include <uv_pars_vertex>
648
+ #include <color_pars_vertex>
649
+ #include <displacementmap_pars_vertex>
650
+ #include <fog_pars_vertex>
651
+ #include <normal_pars_vertex>
652
+ #include <morphtarget_pars_vertex>
653
+ #include <skinning_pars_vertex>
654
+
655
+ #include <logdepthbuf_pars_vertex>
656
+ #include <clipping_planes_pars_vertex>
657
+
658
+ void main() {
659
+
660
+ #include <uv_vertex>
661
+ #include <color_vertex>
662
+ #include <morphinstance_vertex>
663
+ #include <morphcolor_vertex>
664
+ #include <batching_vertex>
665
+
666
+ #include <beginnormal_vertex>
667
+ #include <morphnormal_vertex>
668
+ #include <skinbase_vertex>
669
+ #include <skinnormal_vertex>
670
+ #include <defaultnormal_vertex>
671
+ #include <normal_vertex>
672
+
673
+ #include <begin_vertex>
674
+ #include <morphtarget_vertex>
675
+ #include <skinning_vertex>
676
+ #include <displacementmap_vertex>
677
+ #include <project_vertex>
678
+
679
+ #include <logdepthbuf_vertex>
680
+ #include <clipping_planes_vertex>
681
+ #include <fog_vertex>
682
+
683
+ vViewPosition = - mvPosition.xyz;
684
+
685
+ }
686
+ `,be=`
687
+ #define MATCAP
688
+
689
+ uniform vec3 diffuse;
690
+ uniform float opacity;
691
+ uniform sampler2D matcap;
692
+
693
+ varying vec3 vViewPosition;
694
+
695
+ #include <common>
696
+ #include <dithering_pars_fragment>
697
+ #include <color_pars_fragment>
698
+ #include <uv_pars_fragment>
699
+ #include <map_pars_fragment>
700
+ #include <alphamap_pars_fragment>
701
+ #include <alphatest_pars_fragment>
702
+ #include <alphahash_pars_fragment>
703
+ #include <fog_pars_fragment>
704
+ #include <normal_pars_fragment>
705
+ #include <bumpmap_pars_fragment>
706
+ #include <normalmap_pars_fragment>
707
+ #include <logdepthbuf_pars_fragment>
708
+ #include <clipping_planes_pars_fragment>
709
+
710
+ void main() {
711
+
712
+ vec4 diffuseColor = vec4( diffuse, opacity );
713
+ #include <clipping_planes_fragment>
714
+
715
+ #include <logdepthbuf_fragment>
716
+ #include <map_fragment>
717
+ #include <color_fragment>
718
+ #include <alphamap_fragment>
719
+ #include <alphatest_fragment>
720
+ #include <alphahash_fragment>
721
+ #include <normal_fragment_begin>
722
+ #include <normal_fragment_maps>
723
+
724
+ vec3 viewDir = normalize( vViewPosition );
725
+ vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
726
+ vec3 y = cross( viewDir, x );
727
+ vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; // 0.495 to remove artifacts caused by undersized matcap disks
728
+
729
+ #ifdef USE_MATCAP
730
+
731
+ vec4 matcapColor = texture2D( matcap, uv );
732
+
733
+ #else
734
+
735
+ vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); // default if matcap is missing
736
+
737
+ #endif
738
+
739
+ vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
740
+
741
+ #include <opaque_fragment>
742
+ #include <tonemapping_fragment>
743
+ #include <colorspace_fragment>
744
+ #include <fog_fragment>
745
+ #include <premultiplied_alpha_fragment>
746
+ #include <dithering_fragment>
747
+
748
+ }
749
+ `,Me=`
750
+ #define NORMAL
751
+
752
+ #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
753
+
754
+ varying vec3 vViewPosition;
755
+
756
+ #endif
757
+
758
+ #include <common>
759
+ #include <batching_pars_vertex>
760
+ #include <uv_pars_vertex>
761
+ #include <displacementmap_pars_vertex>
762
+ #include <normal_pars_vertex>
763
+ #include <morphtarget_pars_vertex>
764
+ #include <skinning_pars_vertex>
765
+ #include <logdepthbuf_pars_vertex>
766
+ #include <clipping_planes_pars_vertex>
767
+
768
+ void main() {
769
+
770
+ #include <uv_vertex>
771
+ #include <batching_vertex>
772
+
773
+ #include <beginnormal_vertex>
774
+ #include <morphinstance_vertex>
775
+ #include <morphnormal_vertex>
776
+ #include <skinbase_vertex>
777
+ #include <skinnormal_vertex>
778
+ #include <defaultnormal_vertex>
779
+ #include <normal_vertex>
780
+
781
+ #include <begin_vertex>
782
+ #include <morphtarget_vertex>
783
+ #include <skinning_vertex>
784
+ #include <displacementmap_vertex>
785
+ #include <project_vertex>
786
+ #include <logdepthbuf_vertex>
787
+ #include <clipping_planes_vertex>
788
+
789
+ #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
790
+
791
+ vViewPosition = - mvPosition.xyz;
792
+
793
+ #endif
794
+
795
+ }
796
+ `,we=`
797
+ #define NORMAL
798
+
799
+ uniform float opacity;
800
+
801
+ #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
802
+
803
+ varying vec3 vViewPosition;
804
+
805
+ #endif
806
+
807
+ #include <packing>
808
+ #include <uv_pars_fragment>
809
+ #include <normal_pars_fragment>
810
+ #include <bumpmap_pars_fragment>
811
+ #include <normalmap_pars_fragment>
812
+ #include <logdepthbuf_pars_fragment>
813
+ #include <clipping_planes_pars_fragment>
814
+
815
+ void main() {
816
+
817
+ vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );
818
+
819
+ #include <clipping_planes_fragment>
820
+ #include <logdepthbuf_fragment>
821
+ #include <normal_fragment_begin>
822
+ #include <normal_fragment_maps>
823
+
824
+ gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );
825
+
826
+ #ifdef OPAQUE
827
+
828
+ gl_FragColor.a = 1.0;
829
+
830
+ #endif
831
+
832
+ }
833
+ `,Ce=`
834
+ #define PHONG
835
+
836
+ varying vec3 vViewPosition;
837
+
838
+ #include <common>
839
+ #include <batching_pars_vertex>
840
+ #include <uv_pars_vertex>
841
+ #include <displacementmap_pars_vertex>
842
+ #include <envmap_pars_vertex>
843
+ #include <color_pars_vertex>
844
+ #include <fog_pars_vertex>
845
+ #include <normal_pars_vertex>
846
+ #include <morphtarget_pars_vertex>
847
+ #include <skinning_pars_vertex>
848
+ #include <shadowmap_pars_vertex>
849
+ #include <logdepthbuf_pars_vertex>
850
+ #include <clipping_planes_pars_vertex>
851
+
852
+ void main() {
853
+
854
+ #include <uv_vertex>
855
+ #include <color_vertex>
856
+ #include <morphcolor_vertex>
857
+ #include <batching_vertex>
858
+
859
+ #include <beginnormal_vertex>
860
+ #include <morphinstance_vertex>
861
+ #include <morphnormal_vertex>
862
+ #include <skinbase_vertex>
863
+ #include <skinnormal_vertex>
864
+ #include <defaultnormal_vertex>
865
+ #include <normal_vertex>
866
+
867
+ #include <begin_vertex>
868
+ #include <morphtarget_vertex>
869
+ #include <skinning_vertex>
870
+ #include <displacementmap_vertex>
871
+ #include <project_vertex>
872
+ #include <logdepthbuf_vertex>
873
+ #include <clipping_planes_vertex>
874
+
875
+ vViewPosition = - mvPosition.xyz;
876
+
877
+ #include <worldpos_vertex>
878
+ #include <envmap_vertex>
879
+ #include <shadowmap_vertex>
880
+ #include <fog_vertex>
881
+
882
+ }
883
+ `,Se=`
884
+ #define PHONG
885
+
886
+ uniform vec3 diffuse;
887
+ uniform vec3 emissive;
888
+ uniform vec3 specular;
889
+ uniform float shininess;
890
+ uniform float opacity;
891
+
892
+ #include <common>
893
+ #include <packing>
894
+ #include <dithering_pars_fragment>
895
+ #include <color_pars_fragment>
896
+ #include <uv_pars_fragment>
897
+ #include <map_pars_fragment>
898
+ #include <alphamap_pars_fragment>
899
+ #include <alphatest_pars_fragment>
900
+ #include <alphahash_pars_fragment>
901
+ #include <aomap_pars_fragment>
902
+ #include <lightmap_pars_fragment>
903
+ #include <emissivemap_pars_fragment>
904
+ #include <envmap_common_pars_fragment>
905
+ #include <envmap_pars_fragment>
906
+ #include <fog_pars_fragment>
907
+ #include <bsdfs>
908
+ #include <lights_pars_begin>
909
+ #include <normal_pars_fragment>
910
+ #include <lights_phong_pars_fragment>
911
+ #include <shadowmap_pars_fragment>
912
+ #include <bumpmap_pars_fragment>
913
+ #include <normalmap_pars_fragment>
914
+ #include <specularmap_pars_fragment>
915
+ #include <logdepthbuf_pars_fragment>
916
+ #include <clipping_planes_pars_fragment>
917
+
918
+ void main() {
919
+
920
+ vec4 diffuseColor = vec4( diffuse, opacity );
921
+ #include <clipping_planes_fragment>
922
+
923
+ ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
924
+ vec3 totalEmissiveRadiance = emissive;
925
+
926
+ #include <logdepthbuf_fragment>
927
+ #include <map_fragment>
928
+ #include <color_fragment>
929
+ #include <alphamap_fragment>
930
+ #include <alphatest_fragment>
931
+ #include <alphahash_fragment>
932
+ #include <specularmap_fragment>
933
+ #include <normal_fragment_begin>
934
+ #include <normal_fragment_maps>
935
+ #include <emissivemap_fragment>
936
+
937
+ // accumulation
938
+ #include <lights_phong_fragment>
939
+ #include <lights_fragment_begin>
940
+ #include <lights_fragment_maps>
941
+ #include <lights_fragment_end>
942
+
943
+ // modulation
944
+ #include <aomap_fragment>
945
+
946
+ vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
947
+
948
+ #include <envmap_fragment>
949
+ #include <opaque_fragment>
950
+ #include <tonemapping_fragment>
951
+ #include <colorspace_fragment>
952
+ #include <fog_fragment>
953
+ #include <premultiplied_alpha_fragment>
954
+ #include <dithering_fragment>
955
+
956
+ }
957
+ `,Fe=`
958
+ #define STANDARD
959
+
960
+ varying vec3 vViewPosition;
961
+
962
+ #ifdef USE_TRANSMISSION
963
+
964
+ varying vec3 vWorldPosition;
965
+
966
+ #endif
967
+
968
+ #include <common>
969
+ #include <batching_pars_vertex>
970
+ #include <uv_pars_vertex>
971
+ #include <displacementmap_pars_vertex>
972
+ #include <color_pars_vertex>
973
+ #include <fog_pars_vertex>
974
+ #include <normal_pars_vertex>
975
+ #include <morphtarget_pars_vertex>
976
+ #include <skinning_pars_vertex>
977
+ #include <shadowmap_pars_vertex>
978
+ #include <logdepthbuf_pars_vertex>
979
+ #include <clipping_planes_pars_vertex>
980
+
981
+ void main() {
982
+
983
+ #include <uv_vertex>
984
+ #include <color_vertex>
985
+ #include <morphinstance_vertex>
986
+ #include <morphcolor_vertex>
987
+ #include <batching_vertex>
988
+
989
+ #include <beginnormal_vertex>
990
+ #include <morphnormal_vertex>
991
+ #include <skinbase_vertex>
992
+ #include <skinnormal_vertex>
993
+ #include <defaultnormal_vertex>
994
+ #include <normal_vertex>
995
+
996
+ #include <begin_vertex>
997
+ #include <morphtarget_vertex>
998
+ #include <skinning_vertex>
999
+ #include <displacementmap_vertex>
1000
+ #include <project_vertex>
1001
+ #include <logdepthbuf_vertex>
1002
+ #include <clipping_planes_vertex>
1003
+
1004
+ vViewPosition = - mvPosition.xyz;
1005
+
1006
+ #include <worldpos_vertex>
1007
+ #include <shadowmap_vertex>
1008
+ #include <fog_vertex>
1009
+
1010
+ #ifdef USE_TRANSMISSION
1011
+
1012
+ vWorldPosition = worldPosition.xyz;
1013
+
1014
+ #endif
1015
+ }
1016
+ `,ze=`
1017
+ #define STANDARD
1018
+
1019
+ #ifdef PHYSICAL
1020
+ #define IOR
1021
+ #define USE_SPECULAR
1022
+ #endif
1023
+
1024
+ uniform vec3 diffuse;
1025
+ uniform vec3 emissive;
1026
+ uniform float roughness;
1027
+ uniform float metalness;
1028
+ uniform float opacity;
1029
+
1030
+ #ifdef IOR
1031
+ uniform float ior;
1032
+ #endif
1033
+
1034
+ #ifdef USE_SPECULAR
1035
+ uniform float specularIntensity;
1036
+ uniform vec3 specularColor;
1037
+
1038
+ #ifdef USE_SPECULAR_COLORMAP
1039
+ uniform sampler2D specularColorMap;
1040
+ #endif
1041
+
1042
+ #ifdef USE_SPECULAR_INTENSITYMAP
1043
+ uniform sampler2D specularIntensityMap;
1044
+ #endif
1045
+ #endif
1046
+
1047
+ #ifdef USE_CLEARCOAT
1048
+ uniform float clearcoat;
1049
+ uniform float clearcoatRoughness;
1050
+ #endif
1051
+
1052
+ #ifdef USE_IRIDESCENCE
1053
+ uniform float iridescence;
1054
+ uniform float iridescenceIOR;
1055
+ uniform float iridescenceThicknessMinimum;
1056
+ uniform float iridescenceThicknessMaximum;
1057
+ #endif
1058
+
1059
+ #ifdef USE_SHEEN
1060
+ uniform vec3 sheenColor;
1061
+ uniform float sheenRoughness;
1062
+
1063
+ #ifdef USE_SHEEN_COLORMAP
1064
+ uniform sampler2D sheenColorMap;
1065
+ #endif
1066
+
1067
+ #ifdef USE_SHEEN_ROUGHNESSMAP
1068
+ uniform sampler2D sheenRoughnessMap;
1069
+ #endif
1070
+ #endif
1071
+
1072
+ #ifdef USE_ANISOTROPY
1073
+ uniform vec2 anisotropyVector;
1074
+
1075
+ #ifdef USE_ANISOTROPYMAP
1076
+ uniform sampler2D anisotropyMap;
1077
+ #endif
1078
+ #endif
1079
+
1080
+ varying vec3 vViewPosition;
1081
+
1082
+ #include <common>
1083
+ #include <packing>
1084
+ #include <dithering_pars_fragment>
1085
+ #include <color_pars_fragment>
1086
+ #include <uv_pars_fragment>
1087
+ #include <map_pars_fragment>
1088
+ #include <alphamap_pars_fragment>
1089
+ #include <alphatest_pars_fragment>
1090
+ #include <alphahash_pars_fragment>
1091
+ #include <aomap_pars_fragment>
1092
+ #include <lightmap_pars_fragment>
1093
+ #include <emissivemap_pars_fragment>
1094
+ #include <iridescence_fragment>
1095
+ #include <cube_uv_reflection_fragment>
1096
+ #include <envmap_common_pars_fragment>
1097
+ #include <envmap_physical_pars_fragment>
1098
+ #include <fog_pars_fragment>
1099
+ #include <lights_pars_begin>
1100
+ #include <normal_pars_fragment>
1101
+ #include <lights_physical_pars_fragment>
1102
+ #include <transmission_pars_fragment>
1103
+ #include <shadowmap_pars_fragment>
1104
+ #include <bumpmap_pars_fragment>
1105
+ #include <normalmap_pars_fragment>
1106
+ #include <clearcoat_pars_fragment>
1107
+ #include <iridescence_pars_fragment>
1108
+ #include <roughnessmap_pars_fragment>
1109
+ #include <metalnessmap_pars_fragment>
1110
+ #include <logdepthbuf_pars_fragment>
1111
+ #include <clipping_planes_pars_fragment>
1112
+
1113
+ void main() {
1114
+
1115
+ vec4 diffuseColor = vec4( diffuse, opacity );
1116
+ #include <clipping_planes_fragment>
1117
+
1118
+ ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
1119
+ vec3 totalEmissiveRadiance = emissive;
1120
+
1121
+ #include <logdepthbuf_fragment>
1122
+ #include <map_fragment>
1123
+ #include <color_fragment>
1124
+ #include <alphamap_fragment>
1125
+ #include <alphatest_fragment>
1126
+ #include <alphahash_fragment>
1127
+ #include <roughnessmap_fragment>
1128
+ #include <metalnessmap_fragment>
1129
+ #include <normal_fragment_begin>
1130
+ #include <normal_fragment_maps>
1131
+ #include <clearcoat_normal_fragment_begin>
1132
+ #include <clearcoat_normal_fragment_maps>
1133
+ #include <emissivemap_fragment>
1134
+
1135
+ // accumulation
1136
+ #include <lights_physical_fragment>
1137
+ #include <lights_fragment_begin>
1138
+ #include <lights_fragment_maps>
1139
+ #include <lights_fragment_end>
1140
+
1141
+ // modulation
1142
+ #include <aomap_fragment>
1143
+
1144
+ vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
1145
+ vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
1146
+
1147
+ #include <transmission_fragment>
1148
+
1149
+ vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
1150
+
1151
+ #ifdef USE_SHEEN
1152
+
1153
+ // Sheen energy compensation approximation calculation can be found at the end of
1154
+ // https://drive.google.com/file/d/1T0D1VSyR4AllqIJTQAraEIzjlb5h4FKH/view?usp=sharing
1155
+ float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );
1156
+
1157
+ outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;
1158
+
1159
+ #endif
1160
+
1161
+ #ifdef USE_CLEARCOAT
1162
+
1163
+ float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );
1164
+
1165
+ vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
1166
+
1167
+ outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
1168
+
1169
+ #endif
1170
+
1171
+ #include <opaque_fragment>
1172
+ #include <tonemapping_fragment>
1173
+ #include <colorspace_fragment>
1174
+ #include <fog_fragment>
1175
+ #include <premultiplied_alpha_fragment>
1176
+ #include <dithering_fragment>
1177
+
1178
+ }
1179
+ `,Ee=`
1180
+ #define TOON
1181
+
1182
+ varying vec3 vViewPosition;
1183
+
1184
+ #include <common>
1185
+ #include <batching_pars_vertex>
1186
+ #include <uv_pars_vertex>
1187
+ #include <displacementmap_pars_vertex>
1188
+ #include <color_pars_vertex>
1189
+ #include <fog_pars_vertex>
1190
+ #include <normal_pars_vertex>
1191
+ #include <morphtarget_pars_vertex>
1192
+ #include <skinning_pars_vertex>
1193
+ #include <shadowmap_pars_vertex>
1194
+ #include <logdepthbuf_pars_vertex>
1195
+ #include <clipping_planes_pars_vertex>
1196
+
1197
+ void main() {
1198
+
1199
+ #include <uv_vertex>
1200
+ #include <color_vertex>
1201
+ #include <morphinstance_vertex>
1202
+ #include <morphcolor_vertex>
1203
+ #include <batching_vertex>
1204
+
1205
+ #include <beginnormal_vertex>
1206
+ #include <morphnormal_vertex>
1207
+ #include <skinbase_vertex>
1208
+ #include <skinnormal_vertex>
1209
+ #include <defaultnormal_vertex>
1210
+ #include <normal_vertex>
1211
+
1212
+ #include <begin_vertex>
1213
+ #include <morphtarget_vertex>
1214
+ #include <skinning_vertex>
1215
+ #include <displacementmap_vertex>
1216
+ #include <project_vertex>
1217
+ #include <logdepthbuf_vertex>
1218
+ #include <clipping_planes_vertex>
1219
+
1220
+ vViewPosition = - mvPosition.xyz;
1221
+
1222
+ #include <worldpos_vertex>
1223
+ #include <shadowmap_vertex>
1224
+ #include <fog_vertex>
1225
+
1226
+ }
1227
+ `,Ae=`
1228
+ #define TOON
1229
+
1230
+ uniform vec3 diffuse;
1231
+ uniform vec3 emissive;
1232
+ uniform float opacity;
1233
+
1234
+ #include <common>
1235
+ #include <packing>
1236
+ #include <dithering_pars_fragment>
1237
+ #include <color_pars_fragment>
1238
+ #include <uv_pars_fragment>
1239
+ #include <map_pars_fragment>
1240
+ #include <alphamap_pars_fragment>
1241
+ #include <alphatest_pars_fragment>
1242
+ #include <alphahash_pars_fragment>
1243
+ #include <aomap_pars_fragment>
1244
+ #include <lightmap_pars_fragment>
1245
+ #include <emissivemap_pars_fragment>
1246
+ #include <gradientmap_pars_fragment>
1247
+ #include <fog_pars_fragment>
1248
+ #include <bsdfs>
1249
+ #include <lights_pars_begin>
1250
+ #include <normal_pars_fragment>
1251
+ #include <lights_toon_pars_fragment>
1252
+ #include <shadowmap_pars_fragment>
1253
+ #include <bumpmap_pars_fragment>
1254
+ #include <normalmap_pars_fragment>
1255
+ #include <logdepthbuf_pars_fragment>
1256
+ #include <clipping_planes_pars_fragment>
1257
+
1258
+ void main() {
1259
+
1260
+ vec4 diffuseColor = vec4( diffuse, opacity );
1261
+ #include <clipping_planes_fragment>
1262
+
1263
+ ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
1264
+ vec3 totalEmissiveRadiance = emissive;
1265
+
1266
+ #include <logdepthbuf_fragment>
1267
+ #include <map_fragment>
1268
+ #include <color_fragment>
1269
+ #include <alphamap_fragment>
1270
+ #include <alphatest_fragment>
1271
+ #include <alphahash_fragment>
1272
+ #include <normal_fragment_begin>
1273
+ #include <normal_fragment_maps>
1274
+ #include <emissivemap_fragment>
1275
+
1276
+ // accumulation
1277
+ #include <lights_toon_fragment>
1278
+ #include <lights_fragment_begin>
1279
+ #include <lights_fragment_maps>
1280
+ #include <lights_fragment_end>
1281
+
1282
+ // modulation
1283
+ #include <aomap_fragment>
1284
+
1285
+ vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
1286
+
1287
+ #include <opaque_fragment>
1288
+ #include <tonemapping_fragment>
1289
+ #include <colorspace_fragment>
1290
+ #include <fog_fragment>
1291
+ #include <premultiplied_alpha_fragment>
1292
+ #include <dithering_fragment>
1293
+
1294
+ }
1295
+ `,ke=`
1296
+ uniform float size;
1297
+ uniform float scale;
1298
+
1299
+ #include <common>
1300
+ #include <color_pars_vertex>
1301
+ #include <fog_pars_vertex>
1302
+ #include <morphtarget_pars_vertex>
1303
+ #include <logdepthbuf_pars_vertex>
1304
+ #include <clipping_planes_pars_vertex>
1305
+
1306
+ #ifdef USE_POINTS_UV
1307
+
1308
+ varying vec2 vUv;
1309
+ uniform mat3 uvTransform;
1310
+
1311
+ #endif
1312
+
1313
+ void main() {
1314
+
1315
+ #ifdef USE_POINTS_UV
1316
+
1317
+ vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
1318
+
1319
+ #endif
1320
+
1321
+ #include <color_vertex>
1322
+ #include <morphinstance_vertex>
1323
+ #include <morphcolor_vertex>
1324
+ #include <begin_vertex>
1325
+ #include <morphtarget_vertex>
1326
+ #include <project_vertex>
1327
+
1328
+ gl_PointSize = size;
1329
+
1330
+ #ifdef USE_SIZEATTENUATION
1331
+
1332
+ bool isPerspective = isPerspectiveMatrix( projectionMatrix );
1333
+
1334
+ if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
1335
+
1336
+ #endif
1337
+
1338
+ #include <logdepthbuf_vertex>
1339
+ #include <clipping_planes_vertex>
1340
+ #include <worldpos_vertex>
1341
+ #include <fog_vertex>
1342
+
1343
+ }
1344
+ `,De=`
1345
+ uniform vec3 diffuse;
1346
+ uniform float opacity;
1347
+
1348
+ #include <common>
1349
+ #include <color_pars_fragment>
1350
+ #include <map_particle_pars_fragment>
1351
+ #include <alphatest_pars_fragment>
1352
+ #include <alphahash_pars_fragment>
1353
+ #include <fog_pars_fragment>
1354
+ #include <logdepthbuf_pars_fragment>
1355
+ #include <clipping_planes_pars_fragment>
1356
+
1357
+ void main() {
1358
+
1359
+ vec4 diffuseColor = vec4( diffuse, opacity );
1360
+ #include <clipping_planes_fragment>
1361
+
1362
+ vec3 outgoingLight = vec3( 0.0 );
1363
+
1364
+ #include <logdepthbuf_fragment>
1365
+ #include <map_particle_fragment>
1366
+ #include <color_fragment>
1367
+ #include <alphatest_fragment>
1368
+ #include <alphahash_fragment>
1369
+
1370
+ outgoingLight = diffuseColor.rgb;
1371
+
1372
+ #include <opaque_fragment>
1373
+ #include <tonemapping_fragment>
1374
+ #include <colorspace_fragment>
1375
+ #include <fog_fragment>
1376
+ #include <premultiplied_alpha_fragment>
1377
+
1378
+ }
1379
+ `,Pe=`
1380
+ #include <common>
1381
+ #include <batching_pars_vertex>
1382
+ #include <fog_pars_vertex>
1383
+ #include <morphtarget_pars_vertex>
1384
+ #include <skinning_pars_vertex>
1385
+ #include <logdepthbuf_pars_vertex>
1386
+ #include <shadowmap_pars_vertex>
1387
+
1388
+ void main() {
1389
+
1390
+ #include <batching_vertex>
1391
+
1392
+ #include <beginnormal_vertex>
1393
+ #include <morphinstance_vertex>
1394
+ #include <morphnormal_vertex>
1395
+ #include <skinbase_vertex>
1396
+ #include <skinnormal_vertex>
1397
+ #include <defaultnormal_vertex>
1398
+
1399
+ #include <begin_vertex>
1400
+ #include <morphtarget_vertex>
1401
+ #include <skinning_vertex>
1402
+ #include <project_vertex>
1403
+ #include <logdepthbuf_vertex>
1404
+
1405
+ #include <worldpos_vertex>
1406
+ #include <shadowmap_vertex>
1407
+ #include <fog_vertex>
1408
+
1409
+ }
1410
+ `,Le=`
1411
+ uniform vec3 color;
1412
+ uniform float opacity;
1413
+
1414
+ #include <common>
1415
+ #include <packing>
1416
+ #include <fog_pars_fragment>
1417
+ #include <bsdfs>
1418
+ #include <lights_pars_begin>
1419
+ #include <logdepthbuf_pars_fragment>
1420
+ #include <shadowmap_pars_fragment>
1421
+ #include <shadowmask_pars_fragment>
1422
+
1423
+ void main() {
1424
+
1425
+ #include <logdepthbuf_fragment>
1426
+
1427
+ gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
1428
+
1429
+ #include <tonemapping_fragment>
1430
+ #include <colorspace_fragment>
1431
+ #include <fog_fragment>
1432
+
1433
+ }
1434
+ `,Te=`
1435
+ uniform float rotation;
1436
+ uniform vec2 center;
1437
+
1438
+ #include <common>
1439
+ #include <uv_pars_vertex>
1440
+ #include <fog_pars_vertex>
1441
+ #include <logdepthbuf_pars_vertex>
1442
+ #include <clipping_planes_pars_vertex>
1443
+
1444
+ void main() {
1445
+
1446
+ #include <uv_vertex>
1447
+
1448
+ vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );
1449
+
1450
+ vec2 scale;
1451
+ scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );
1452
+ scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );
1453
+
1454
+ #ifndef USE_SIZEATTENUATION
1455
+
1456
+ bool isPerspective = isPerspectiveMatrix( projectionMatrix );
1457
+
1458
+ if ( isPerspective ) scale *= - mvPosition.z;
1459
+
1460
+ #endif
1461
+
1462
+ vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
1463
+
1464
+ vec2 rotatedPosition;
1465
+ rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
1466
+ rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
1467
+
1468
+ mvPosition.xy += rotatedPosition;
1469
+
1470
+ gl_Position = projectionMatrix * mvPosition;
1471
+
1472
+ #include <logdepthbuf_vertex>
1473
+ #include <clipping_planes_vertex>
1474
+ #include <fog_vertex>
1475
+
1476
+ }
1477
+ `,Re=`
1478
+ uniform vec3 diffuse;
1479
+ uniform float opacity;
1480
+
1481
+ #include <common>
1482
+ #include <uv_pars_fragment>
1483
+ #include <map_pars_fragment>
1484
+ #include <alphamap_pars_fragment>
1485
+ #include <alphatest_pars_fragment>
1486
+ #include <alphahash_pars_fragment>
1487
+ #include <fog_pars_fragment>
1488
+ #include <logdepthbuf_pars_fragment>
1489
+ #include <clipping_planes_pars_fragment>
1490
+
1491
+ void main() {
1492
+
1493
+ vec4 diffuseColor = vec4( diffuse, opacity );
1494
+ #include <clipping_planes_fragment>
1495
+
1496
+ vec3 outgoingLight = vec3( 0.0 );
1497
+
1498
+ #include <logdepthbuf_fragment>
1499
+ #include <map_fragment>
1500
+ #include <alphamap_fragment>
1501
+ #include <alphatest_fragment>
1502
+ #include <alphahash_fragment>
1503
+
1504
+ outgoingLight = diffuseColor.rgb;
1505
+
1506
+ #include <opaque_fragment>
1507
+ #include <tonemapping_fragment>
1508
+ #include <colorspace_fragment>
1509
+ #include <fog_fragment>
1510
+
1511
+ }
1512
+ `,g={background_vert:ie,background_frag:ne,backgroundCube_vert:re,backgroundCube_frag:ae,cube_vert:se,cube_frag:le,depth_vert:oe,depth_frag:ce,distanceRGBA_vert:ue,distanceRGBA_frag:he,equirect_vert:de,equirect_frag:me,linedashed_vert:pe,linedashed_frag:_e,meshbasic_vert:ge,meshbasic_frag:fe,meshlambert_vert:ve,meshlambert_frag:xe,meshmatcap_vert:ye,meshmatcap_frag:be,meshnormal_vert:Me,meshnormal_frag:we,meshphong_vert:Ce,meshphong_frag:Se,meshphysical_vert:Fe,meshphysical_frag:ze,meshtoon_vert:Ee,meshtoon_frag:Ae,points_vert:ke,points_frag:De,shadow_vert:Pe,shadow_frag:Le,sprite_vert:Te,sprite_frag:Re},Be="",E="srgb",O="srgb-linear",Ie="display-p3",ee="display-p3-linear",W="linear",Y="srgb",Z="rec709",Q="p3";class f{constructor(e,t,i,n,r,l,o,h,a){f.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,i,n,r,l,o,h,a)}set(e,t,i,n,r,l,o,h,a){const s=this.elements;return s[0]=e,s[1]=n,s[2]=o,s[3]=t,s[4]=r,s[5]=h,s[6]=i,s[7]=l,s[8]=a,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,n=t.elements,r=this.elements,l=i[0],o=i[3],h=i[6],a=i[1],s=i[4],u=i[7],p=i[2],d=i[5],_=i[8],v=n[0],w=n[3],S=n[6],D=n[1],P=n[4],F=n[7],M=n[2],L=n[5],I=n[8];return r[0]=l*v+o*D+h*M,r[3]=l*w+o*P+h*L,r[6]=l*S+o*F+h*I,r[1]=a*v+s*D+u*M,r[4]=a*w+s*P+u*L,r[7]=a*S+s*F+u*I,r[2]=p*v+d*D+_*M,r[5]=p*w+d*P+_*L,r[8]=p*S+d*F+_*I,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[1],n=e[2],r=e[3],l=e[4],o=e[5],h=e[6],a=e[7],s=e[8];return t*l*s-t*o*a-i*r*s+i*o*h+n*r*a-n*l*h}invert(){const e=this.elements,t=e[0],i=e[1],n=e[2],r=e[3],l=e[4],o=e[5],h=e[6],a=e[7],s=e[8],u=s*l-o*a,p=o*h-s*r,d=a*r-l*h,_=t*u+i*p+n*d;if(_===0)return this.set(0,0,0,0,0,0,0,0,0);const v=1/_;return e[0]=u*v,e[1]=(n*a-s*i)*v,e[2]=(o*i-n*l)*v,e[3]=p*v,e[4]=(s*t-n*h)*v,e[5]=(n*r-o*t)*v,e[6]=d*v,e[7]=(i*h-a*t)*v,e[8]=(l*t-i*r)*v,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,i,n,r,l,o){const h=Math.cos(r),a=Math.sin(r);return this.set(i*h,i*a,-i*(h*l+a*o)+l+e,-n*a,n*h,-n*(-a*l+h*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(N.makeScale(e,t)),this}rotate(e){return this.premultiply(N.makeRotation(-e)),this}translate(e,t){return this.premultiply(N.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,i,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,i=e.elements;for(let n=0;n<9;n++)if(t[n]!==i[n])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const N=new f,X=new f().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),K=new f().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),T={[O]:{transfer:W,primaries:Z,toReference:m=>m,fromReference:m=>m},[E]:{transfer:Y,primaries:Z,toReference:m=>m.convertSRGBToLinear(),fromReference:m=>m.convertLinearToSRGB()},[ee]:{transfer:W,primaries:Q,toReference:m=>m.applyMatrix3(K),fromReference:m=>m.applyMatrix3(X)},[Ie]:{transfer:Y,primaries:Q,toReference:m=>m.convertSRGBToLinear().applyMatrix3(K),fromReference:m=>m.applyMatrix3(X).convertLinearToSRGB()}},Ne=new Set([O,ee]),C={enabled:!0,_workingColorSpace:O,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(m){if(!Ne.has(m))throw new Error(`Unsupported working color space, "${m}".`);this._workingColorSpace=m},convert:function(m,e,t){if(this.enabled===!1||e===t||!e||!t)return m;const i=T[e].toReference,n=T[t].fromReference;return n(i(m))},fromWorkingColorSpace:function(m,e){return this.convert(m,this._workingColorSpace,e)},toWorkingColorSpace:function(m,e){return this.convert(m,e,this._workingColorSpace)},getPrimaries:function(m){return T[m].primaries},getTransfer:function(m){return m===Be?W:T[m].transfer}};function U(m){return m<.04045?m*.0773993808:Math.pow(m*.9478672986+.0521327014,2.4)}function q(m){return m<.0031308?m*12.92:1.055*Math.pow(m,.41666)-.055}function Ue(m){const e={};for(const t in m){e[t]={};for(const i in m[t]){const n=m[t][i];n&&(n.isColor||n.isMatrix3||n.isMatrix4||n.isVector2||n.isVector3||n.isVector4||n.isTexture||n.isQuaternion)?n.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][i]=null):e[t][i]=n.clone():Array.isArray(n)?e[t][i]=n.slice():e[t][i]=n}}return e}function b(m){const e={};for(let t=0;t<m.length;t++){const i=Ue(m[t]);for(const n in i)e[n]=i[n]}return e}function A(m,e,t){return Math.max(e,Math.min(t,m))}function qe(m,e){return(m%e+e)%e}function G(m,e,t){return(1-t)*m+t*e}class k{constructor(e=0,t=0){k.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,i=this.y,n=e.elements;return this.x=n[0]*t+n[3]*i+n[6],this.y=n[1]*t+n[4]*i+n[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(A(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y;return t*t+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const i=Math.cos(t),n=Math.sin(t),r=this.x-e.x,l=this.y-e.y;return this.x=r*i-l*n+e.x,this.y=r*n+l*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Ge{constructor(e=0,t=0,i=0,n=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=i,this._w=n}static slerpFlat(e,t,i,n,r,l,o){let h=i[n+0],a=i[n+1],s=i[n+2],u=i[n+3];const p=r[l+0],d=r[l+1],_=r[l+2],v=r[l+3];if(o===0){e[t+0]=h,e[t+1]=a,e[t+2]=s,e[t+3]=u;return}if(o===1){e[t+0]=p,e[t+1]=d,e[t+2]=_,e[t+3]=v;return}if(u!==v||h!==p||a!==d||s!==_){let w=1-o;const S=h*p+a*d+s*_+u*v,D=S>=0?1:-1,P=1-S*S;if(P>Number.EPSILON){const M=Math.sqrt(P),L=Math.atan2(M,S*D);w=Math.sin(w*L)/M,o=Math.sin(o*L)/M}const F=o*D;if(h=h*w+p*F,a=a*w+d*F,s=s*w+_*F,u=u*w+v*F,w===1-o){const M=1/Math.sqrt(h*h+a*a+s*s+u*u);h*=M,a*=M,s*=M,u*=M}}e[t]=h,e[t+1]=a,e[t+2]=s,e[t+3]=u}static multiplyQuaternionsFlat(e,t,i,n,r,l){const o=i[n],h=i[n+1],a=i[n+2],s=i[n+3],u=r[l],p=r[l+1],d=r[l+2],_=r[l+3];return e[t]=o*_+s*u+h*d-a*p,e[t+1]=h*_+s*p+a*u-o*d,e[t+2]=a*_+s*d+o*p-h*u,e[t+3]=s*_-o*u-h*p-a*d,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,i,n){return this._x=e,this._y=t,this._z=i,this._w=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const i=e._x,n=e._y,r=e._z,l=e._order,o=Math.cos,h=Math.sin,a=o(i/2),s=o(n/2),u=o(r/2),p=h(i/2),d=h(n/2),_=h(r/2);switch(l){case"XYZ":this._x=p*s*u+a*d*_,this._y=a*d*u-p*s*_,this._z=a*s*_+p*d*u,this._w=a*s*u-p*d*_;break;case"YXZ":this._x=p*s*u+a*d*_,this._y=a*d*u-p*s*_,this._z=a*s*_-p*d*u,this._w=a*s*u+p*d*_;break;case"ZXY":this._x=p*s*u-a*d*_,this._y=a*d*u+p*s*_,this._z=a*s*_+p*d*u,this._w=a*s*u-p*d*_;break;case"ZYX":this._x=p*s*u-a*d*_,this._y=a*d*u+p*s*_,this._z=a*s*_-p*d*u,this._w=a*s*u+p*d*_;break;case"YZX":this._x=p*s*u+a*d*_,this._y=a*d*u+p*s*_,this._z=a*s*_-p*d*u,this._w=a*s*u-p*d*_;break;case"XZY":this._x=p*s*u-a*d*_,this._y=a*d*u-p*s*_,this._z=a*s*_+p*d*u,this._w=a*s*u+p*d*_;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+l)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const i=t/2,n=Math.sin(i);return this._x=e.x*n,this._y=e.y*n,this._z=e.z*n,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,i=t[0],n=t[4],r=t[8],l=t[1],o=t[5],h=t[9],a=t[2],s=t[6],u=t[10],p=i+o+u;if(p>0){const d=.5/Math.sqrt(p+1);this._w=.25/d,this._x=(s-h)*d,this._y=(r-a)*d,this._z=(l-n)*d}else if(i>o&&i>u){const d=2*Math.sqrt(1+i-o-u);this._w=(s-h)/d,this._x=.25*d,this._y=(n+l)/d,this._z=(r+a)/d}else if(o>u){const d=2*Math.sqrt(1+o-i-u);this._w=(r-a)/d,this._x=(n+l)/d,this._y=.25*d,this._z=(h+s)/d}else{const d=2*Math.sqrt(1+u-i-o);this._w=(l-n)/d,this._x=(r+a)/d,this._y=(h+s)/d,this._z=.25*d}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return i<Number.EPSILON?(i=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(A(this.dot(e),-1,1)))}rotateTowards(e,t){const i=this.angleTo(e);if(i===0)return this;const n=Math.min(1,t/i);return this.slerp(e,n),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const i=e._x,n=e._y,r=e._z,l=e._w,o=t._x,h=t._y,a=t._z,s=t._w;return this._x=i*s+l*o+n*a-r*h,this._y=n*s+l*h+r*o-i*a,this._z=r*s+l*a+i*h-n*o,this._w=l*s-i*o-n*h-r*a,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const i=this._x,n=this._y,r=this._z,l=this._w;let o=l*e._w+i*e._x+n*e._y+r*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=l,this._x=i,this._y=n,this._z=r,this;const h=1-o*o;if(h<=Number.EPSILON){const d=1-t;return this._w=d*l+t*this._w,this._x=d*i+t*this._x,this._y=d*n+t*this._y,this._z=d*r+t*this._z,this.normalize(),this}const a=Math.sqrt(h),s=Math.atan2(a,o),u=Math.sin((1-t)*s)/a,p=Math.sin(t*s)/a;return this._w=l*u+this._w*p,this._x=i*u+this._x*p,this._y=n*u+this._y*p,this._z=r*u+this._z*p,this._onChangeCallback(),this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),i=Math.random(),n=Math.sqrt(1-i),r=Math.sqrt(i);return this.set(n*Math.sin(e),n*Math.cos(e),r*Math.sin(t),r*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class B{constructor(e=0,t=0,i=0){B.prototype.isVector3=!0,this.x=e,this.y=t,this.z=i}set(e,t,i){return i===void 0&&(i=this.z),this.x=e,this.y=t,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(J.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(J.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,i=this.y,n=this.z,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6]*n,this.y=r[1]*t+r[4]*i+r[7]*n,this.z=r[2]*t+r[5]*i+r[8]*n,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,i=this.y,n=this.z,r=e.elements,l=1/(r[3]*t+r[7]*i+r[11]*n+r[15]);return this.x=(r[0]*t+r[4]*i+r[8]*n+r[12])*l,this.y=(r[1]*t+r[5]*i+r[9]*n+r[13])*l,this.z=(r[2]*t+r[6]*i+r[10]*n+r[14])*l,this}applyQuaternion(e){const t=this.x,i=this.y,n=this.z,r=e.x,l=e.y,o=e.z,h=e.w,a=2*(l*n-o*i),s=2*(o*t-r*n),u=2*(r*i-l*t);return this.x=t+h*a+l*u-o*s,this.y=i+h*s+o*a-r*u,this.z=n+h*u+r*s-l*a,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,i=this.y,n=this.z,r=e.elements;return this.x=r[0]*t+r[4]*i+r[8]*n,this.y=r[1]*t+r[5]*i+r[9]*n,this.z=r[2]*t+r[6]*i+r[10]*n,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const i=e.x,n=e.y,r=e.z,l=t.x,o=t.y,h=t.z;return this.x=n*h-r*o,this.y=r*l-i*h,this.z=i*o-n*l,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return V.copy(this).projectOnVector(e),this.sub(V)}reflect(e){return this.sub(V.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(A(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y,n=this.z-e.z;return t*t+i*i+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,i){const n=Math.sin(t)*e;return this.x=n*Math.sin(i),this.y=Math.cos(t)*e,this.z=n*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),n=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=n,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,i=Math.sqrt(1-t*t);return this.x=i*Math.cos(e),this.y=t,this.z=i*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const V=new B,J=new Ge,te={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},z={h:0,s:0,l:0},R={h:0,s:0,l:0};function j(m,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?m+(e-m)*6*t:t<1/2?e:t<2/3?m+(e-m)*6*(2/3-t):m}class y{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,i)}set(e,t,i){if(t===void 0&&i===void 0){const n=e;n&&n.isColor?this.copy(n):typeof n=="number"?this.setHex(n):typeof n=="string"&&this.setStyle(n)}else this.setRGB(e,t,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=E){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,C.toWorkingColorSpace(this,t),this}setRGB(e,t,i,n=C.workingColorSpace){return this.r=e,this.g=t,this.b=i,C.toWorkingColorSpace(this,n),this}setHSL(e,t,i,n=C.workingColorSpace){if(e=qe(e,1),t=A(t,0,1),i=A(i,0,1),t===0)this.r=this.g=this.b=i;else{const r=i<=.5?i*(1+t):i+t-i*t,l=2*i-r;this.r=j(l,r,e+1/3),this.g=j(l,r,e),this.b=j(l,r,e-1/3)}return C.toWorkingColorSpace(this,n),this}setStyle(e,t=E){function i(r){r!==void 0&&parseFloat(r)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let n;if(n=/^(\w+)\(([^\)]*)\)/.exec(e)){let r;const l=n[1],o=n[2];switch(l){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,t);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,t);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(e)){const r=n[1],l=r.length;if(l===3)return this.setRGB(parseInt(r.charAt(0),16)/15,parseInt(r.charAt(1),16)/15,parseInt(r.charAt(2),16)/15,t);if(l===6)return this.setHex(parseInt(r,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=E){const i=te[e.toLowerCase()];return i!==void 0?this.setHex(i,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=U(e.r),this.g=U(e.g),this.b=U(e.b),this}copyLinearToSRGB(e){return this.r=q(e.r),this.g=q(e.g),this.b=q(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=E){return C.fromWorkingColorSpace(x.copy(this),e),Math.round(A(x.r*255,0,255))*65536+Math.round(A(x.g*255,0,255))*256+Math.round(A(x.b*255,0,255))}getHexString(e=E){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=C.workingColorSpace){C.fromWorkingColorSpace(x.copy(this),t);const i=x.r,n=x.g,r=x.b,l=Math.max(i,n,r),o=Math.min(i,n,r);let h,a;const s=(o+l)/2;if(o===l)h=0,a=0;else{const u=l-o;switch(a=s<=.5?u/(l+o):u/(2-l-o),l){case i:h=(n-r)/u+(n<r?6:0);break;case n:h=(r-i)/u+2;break;case r:h=(i-n)/u+4;break}h/=6}return e.h=h,e.s=a,e.l=s,e}getRGB(e,t=C.workingColorSpace){return C.fromWorkingColorSpace(x.copy(this),t),e.r=x.r,e.g=x.g,e.b=x.b,e}getStyle(e=E){C.fromWorkingColorSpace(x.copy(this),e);const t=x.r,i=x.g,n=x.b;return e!==E?`color(${e} ${t.toFixed(3)} ${i.toFixed(3)} ${n.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(i*255)},${Math.round(n*255)})`}offsetHSL(e,t,i){return this.getHSL(z),this.setHSL(z.h+e,z.s+t,z.l+i)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,i){return this.r=e.r+(t.r-e.r)*i,this.g=e.g+(t.g-e.g)*i,this.b=e.b+(t.b-e.b)*i,this}lerpHSL(e,t){this.getHSL(z),e.getHSL(R);const i=G(z.h,R.h,t),n=G(z.s,R.s,t),r=G(z.l,R.l,t);return this.setHSL(i,n,r),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,i=this.g,n=this.b,r=e.elements;return this.r=r[0]*t+r[3]*i+r[6]*n,this.g=r[1]*t+r[4]*i+r[7]*n,this.b=r[2]*t+r[5]*i+r[8]*n,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const x=new y;y.NAMES=te;const c={common:{diffuse:{value:new y(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new f},alphaMap:{value:null},alphaMapTransform:{value:new f},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new f}},envmap:{envMap:{value:null},envMapRotation:{value:new f},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new f}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new f}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new f},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new f},normalScale:{value:new k(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new f},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new f}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new f}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new f}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new y(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new y(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new f},alphaTest:{value:0},uvTransform:{value:new f}},sprite:{diffuse:{value:new y(16777215)},opacity:{value:1},center:{value:new k(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new f},alphaMap:{value:null},alphaMapTransform:{value:new f},alphaTest:{value:0}}},$={basic:{uniforms:b([c.common,c.specularmap,c.envmap,c.aomap,c.lightmap,c.fog]),vertexShader:g.meshbasic_vert,fragmentShader:g.meshbasic_frag},lambert:{uniforms:b([c.common,c.specularmap,c.envmap,c.aomap,c.lightmap,c.emissivemap,c.bumpmap,c.normalmap,c.displacementmap,c.fog,c.lights,{emissive:{value:new y(0)}}]),vertexShader:g.meshlambert_vert,fragmentShader:g.meshlambert_frag},phong:{uniforms:b([c.common,c.specularmap,c.envmap,c.aomap,c.lightmap,c.emissivemap,c.bumpmap,c.normalmap,c.displacementmap,c.fog,c.lights,{emissive:{value:new y(0)},specular:{value:new y(1118481)},shininess:{value:30}}]),vertexShader:g.meshphong_vert,fragmentShader:g.meshphong_frag},standard:{uniforms:b([c.common,c.envmap,c.aomap,c.lightmap,c.emissivemap,c.bumpmap,c.normalmap,c.displacementmap,c.roughnessmap,c.metalnessmap,c.fog,c.lights,{emissive:{value:new y(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:g.meshphysical_vert,fragmentShader:g.meshphysical_frag},toon:{uniforms:b([c.common,c.aomap,c.lightmap,c.emissivemap,c.bumpmap,c.normalmap,c.displacementmap,c.gradientmap,c.fog,c.lights,{emissive:{value:new y(0)}}]),vertexShader:g.meshtoon_vert,fragmentShader:g.meshtoon_frag},matcap:{uniforms:b([c.common,c.bumpmap,c.normalmap,c.displacementmap,c.fog,{matcap:{value:null}}]),vertexShader:g.meshmatcap_vert,fragmentShader:g.meshmatcap_frag},points:{uniforms:b([c.points,c.fog]),vertexShader:g.points_vert,fragmentShader:g.points_frag},dashed:{uniforms:b([c.common,c.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:g.linedashed_vert,fragmentShader:g.linedashed_frag},depth:{uniforms:b([c.common,c.displacementmap]),vertexShader:g.depth_vert,fragmentShader:g.depth_frag},normal:{uniforms:b([c.common,c.bumpmap,c.normalmap,c.displacementmap,{opacity:{value:1}}]),vertexShader:g.meshnormal_vert,fragmentShader:g.meshnormal_frag},sprite:{uniforms:b([c.sprite,c.fog]),vertexShader:g.sprite_vert,fragmentShader:g.sprite_frag},background:{uniforms:{uvTransform:{value:new f},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:g.background_vert,fragmentShader:g.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new f}},vertexShader:g.backgroundCube_vert,fragmentShader:g.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:g.cube_vert,fragmentShader:g.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:g.equirect_vert,fragmentShader:g.equirect_frag},distanceRGBA:{uniforms:b([c.common,c.displacementmap,{referencePosition:{value:new B},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:g.distanceRGBA_vert,fragmentShader:g.distanceRGBA_frag},shadow:{uniforms:b([c.lights,c.fog,{color:{value:new y(0)},opacity:{value:1}}]),vertexShader:g.shadow_vert,fragmentShader:g.shadow_frag}};$.physical={uniforms:b([$.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new f},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new f},clearcoatNormalScale:{value:new k(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new f},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new f},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new f},sheen:{value:0},sheenColor:{value:new y(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new f},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new f},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new f},transmissionSamplerSize:{value:new k},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new f},attenuationDistance:{value:0},attenuationColor:{value:new y(0)},specularColor:{value:new y(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new f},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new f},anisotropyVector:{value:new k},anisotropyMap:{value:null},anisotropyMapTransform:{value:new f}}]),vertexShader:g.meshphysical_vert,fragmentShader:g.meshphysical_frag};const Ve=`varying vec3 vWorldPosition;
1513
+
1514
+ void main() {
1515
+ vec4 worldPos = modelMatrix * vec4(position, 1.0);
1516
+ vWorldPosition = worldPos.xyz;
1517
+ gl_Position = projectionMatrix * viewMatrix * worldPos;
1518
+ }`,je=`uniform float uGridSize;
1519
+ uniform float uMajorLineEvery;
1520
+ uniform vec3 uMinorLineColor;
1521
+ uniform vec3 uMajorLineColor;
1522
+ uniform float uFadeDistance;
1523
+
1524
+ varying vec3 vWorldPosition;
1525
+
1526
+ void main() {
1527
+ vec2 coord = vWorldPosition.xz;
1528
+
1529
+ // Minor grid
1530
+ vec2 minorCoord = coord / uGridSize;
1531
+ vec2 minorGrid = abs(fract(minorCoord - 0.5) - 0.5) / fwidth(minorCoord);
1532
+ float lineMinor = min(minorGrid.x, minorGrid.y);
1533
+
1534
+ // Major grid
1535
+ float majorSize = uGridSize * uMajorLineEvery;
1536
+ vec2 majorCoord = coord / majorSize;
1537
+ vec2 majorGrid = abs(fract(majorCoord - 0.5) - 0.5) / fwidth(majorCoord);
1538
+ float lineMajor = min(majorGrid.x, majorGrid.y);
1539
+
1540
+ // Line alpha: minor = 1px, major = 2px wide
1541
+ float minorAlpha = 1.0 - min(lineMinor, 1.0);
1542
+ float majorAlpha = 1.0 - min(lineMajor / 2.0, 1.0);
1543
+
1544
+ float alpha = max(minorAlpha, majorAlpha);
1545
+ vec3 color = mix(uMinorLineColor, uMajorLineColor, step(minorAlpha, majorAlpha));
1546
+
1547
+ // Radial fade from camera
1548
+ float dist = length(vWorldPosition.xz - cameraPosition.xz);
1549
+ alpha *= 1.0 - smoothstep(uFadeDistance * 0.5, uFadeDistance, dist);
1550
+
1551
+ if (alpha < 0.001) discard;
1552
+
1553
+ gl_FragColor = vec4(color, alpha);
1554
+ }`,He={uniforms:{uGridSize:{value:1},uMajorLineEvery:{value:10},uMinorLineColor:{value:new H.Color("#dddddd")},uMajorLineColor:{value:new H.Color("#888888")},uFadeDistance:{value:10}},vertexShader:Ve,fragmentShader:je},We={...$,grid:He};class $e extends H.ShaderMaterial{}exports.DIVEShaderLib=We;exports.DIVEShaderMaterial=$e;