@spiffcommerce/preview 3.6.2-rc.8 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/dist/index.esm.js +1576 -38
  2. package/dist/index.umd.js +1 -0
  3. package/package.json +4 -6
  4. package/dist/_tslib.esm.js +0 -33
  5. package/dist/animation.esm.js +0 -1364
  6. package/dist/assetCache.esm.js +0 -6
  7. package/dist/assetCache.esm2.js +0 -825
  8. package/dist/blurPostProcess.esm.js +0 -327
  9. package/dist/bumpVertex.esm.js +0 -497
  10. package/dist/compatibilityOptions.esm.js +0 -68
  11. package/dist/configuration.esm.js +0 -121
  12. package/dist/core.esm.js +0 -8135
  13. package/dist/dynamicTexture.esm.js +0 -105
  14. package/dist/dynamicTexture.esm2.js +0 -238
  15. package/dist/easing.esm.js +0 -130
  16. package/dist/effectFallbacks.esm.js +0 -378
  17. package/dist/engine.esm.js +0 -25504
  18. package/dist/glbLoaderExtensions.esm.js +0 -690
  19. package/dist/glowLayer.esm.js +0 -1621
  20. package/dist/glowLayerManager.esm.js +0 -50
  21. package/dist/guid.esm.js +0 -21
  22. package/dist/hdrFilteringFunctions.esm.js +0 -816
  23. package/dist/helperFunctions.esm.js +0 -5145
  24. package/dist/material.esm.js +0 -115
  25. package/dist/material.esm2.js +0 -5245
  26. package/dist/math.axis.esm.js +0 -35
  27. package/dist/math.color.esm.js +0 -1661
  28. package/dist/math.path.esm.js +0 -15
  29. package/dist/math.size.esm.js +0 -137
  30. package/dist/mesh.esm.js +0 -11170
  31. package/dist/modelContainer.esm.js +0 -1895
  32. package/dist/node.esm.js +0 -795
  33. package/dist/pbrBRDFFunctions.esm.js +0 -124
  34. package/dist/pbrMaterial.esm.js +8 -8739
  35. package/dist/productAnimations.esm.js +0 -182
  36. package/dist/productCamera.esm.js +0 -14
  37. package/dist/productCamera.esm2.js +0 -3870
  38. package/dist/renderConstants.esm.js +0 -116
  39. package/dist/renderingPipeline.esm.js +0 -18
  40. package/dist/renderingPipeline.esm2.js +1 -3594
  41. package/dist/sceneLoaderFlags.esm.js +0 -51
  42. package/dist/types.esm.js +0 -30
  43. package/dist/variants.esm.js +0 -16
  44. package/dist/variants.esm2.js +0 -3097
  45. package/dist/webRequest.esm.js +0 -7777
@@ -1,497 +0,0 @@
1
- import { E as Engine, e as ShaderStore } from './engine.esm.js';
2
-
3
- /**
4
- * This groups all the flags used to control the materials channel.
5
- */
6
- class MaterialFlags {
7
- /**
8
- * Are diffuse textures enabled in the application.
9
- */
10
- static get DiffuseTextureEnabled() {
11
- return this._DiffuseTextureEnabled;
12
- }
13
- static set DiffuseTextureEnabled(value) {
14
- if (this._DiffuseTextureEnabled === value) {
15
- return;
16
- }
17
- this._DiffuseTextureEnabled = value;
18
- Engine.MarkAllMaterialsAsDirty(1);
19
- }
20
- /**
21
- * Are detail textures enabled in the application.
22
- */
23
- static get DetailTextureEnabled() {
24
- return this._DetailTextureEnabled;
25
- }
26
- static set DetailTextureEnabled(value) {
27
- if (this._DetailTextureEnabled === value) {
28
- return;
29
- }
30
- this._DetailTextureEnabled = value;
31
- Engine.MarkAllMaterialsAsDirty(1);
32
- }
33
- /**
34
- * Are decal maps enabled in the application.
35
- */
36
- static get DecalMapEnabled() {
37
- return this._DecalMapEnabled;
38
- }
39
- static set DecalMapEnabled(value) {
40
- if (this._DecalMapEnabled === value) {
41
- return;
42
- }
43
- this._DecalMapEnabled = value;
44
- Engine.MarkAllMaterialsAsDirty(1);
45
- }
46
- /**
47
- * Are ambient textures enabled in the application.
48
- */
49
- static get AmbientTextureEnabled() {
50
- return this._AmbientTextureEnabled;
51
- }
52
- static set AmbientTextureEnabled(value) {
53
- if (this._AmbientTextureEnabled === value) {
54
- return;
55
- }
56
- this._AmbientTextureEnabled = value;
57
- Engine.MarkAllMaterialsAsDirty(1);
58
- }
59
- /**
60
- * Are opacity textures enabled in the application.
61
- */
62
- static get OpacityTextureEnabled() {
63
- return this._OpacityTextureEnabled;
64
- }
65
- static set OpacityTextureEnabled(value) {
66
- if (this._OpacityTextureEnabled === value) {
67
- return;
68
- }
69
- this._OpacityTextureEnabled = value;
70
- Engine.MarkAllMaterialsAsDirty(1);
71
- }
72
- /**
73
- * Are reflection textures enabled in the application.
74
- */
75
- static get ReflectionTextureEnabled() {
76
- return this._ReflectionTextureEnabled;
77
- }
78
- static set ReflectionTextureEnabled(value) {
79
- if (this._ReflectionTextureEnabled === value) {
80
- return;
81
- }
82
- this._ReflectionTextureEnabled = value;
83
- Engine.MarkAllMaterialsAsDirty(1);
84
- }
85
- /**
86
- * Are emissive textures enabled in the application.
87
- */
88
- static get EmissiveTextureEnabled() {
89
- return this._EmissiveTextureEnabled;
90
- }
91
- static set EmissiveTextureEnabled(value) {
92
- if (this._EmissiveTextureEnabled === value) {
93
- return;
94
- }
95
- this._EmissiveTextureEnabled = value;
96
- Engine.MarkAllMaterialsAsDirty(1);
97
- }
98
- /**
99
- * Are specular textures enabled in the application.
100
- */
101
- static get SpecularTextureEnabled() {
102
- return this._SpecularTextureEnabled;
103
- }
104
- static set SpecularTextureEnabled(value) {
105
- if (this._SpecularTextureEnabled === value) {
106
- return;
107
- }
108
- this._SpecularTextureEnabled = value;
109
- Engine.MarkAllMaterialsAsDirty(1);
110
- }
111
- /**
112
- * Are bump textures enabled in the application.
113
- */
114
- static get BumpTextureEnabled() {
115
- return this._BumpTextureEnabled;
116
- }
117
- static set BumpTextureEnabled(value) {
118
- if (this._BumpTextureEnabled === value) {
119
- return;
120
- }
121
- this._BumpTextureEnabled = value;
122
- Engine.MarkAllMaterialsAsDirty(1);
123
- }
124
- /**
125
- * Are lightmap textures enabled in the application.
126
- */
127
- static get LightmapTextureEnabled() {
128
- return this._LightmapTextureEnabled;
129
- }
130
- static set LightmapTextureEnabled(value) {
131
- if (this._LightmapTextureEnabled === value) {
132
- return;
133
- }
134
- this._LightmapTextureEnabled = value;
135
- Engine.MarkAllMaterialsAsDirty(1);
136
- }
137
- /**
138
- * Are refraction textures enabled in the application.
139
- */
140
- static get RefractionTextureEnabled() {
141
- return this._RefractionTextureEnabled;
142
- }
143
- static set RefractionTextureEnabled(value) {
144
- if (this._RefractionTextureEnabled === value) {
145
- return;
146
- }
147
- this._RefractionTextureEnabled = value;
148
- Engine.MarkAllMaterialsAsDirty(1);
149
- }
150
- /**
151
- * Are color grading textures enabled in the application.
152
- */
153
- static get ColorGradingTextureEnabled() {
154
- return this._ColorGradingTextureEnabled;
155
- }
156
- static set ColorGradingTextureEnabled(value) {
157
- if (this._ColorGradingTextureEnabled === value) {
158
- return;
159
- }
160
- this._ColorGradingTextureEnabled = value;
161
- Engine.MarkAllMaterialsAsDirty(1);
162
- }
163
- /**
164
- * Are fresnels enabled in the application.
165
- */
166
- static get FresnelEnabled() {
167
- return this._FresnelEnabled;
168
- }
169
- static set FresnelEnabled(value) {
170
- if (this._FresnelEnabled === value) {
171
- return;
172
- }
173
- this._FresnelEnabled = value;
174
- Engine.MarkAllMaterialsAsDirty(4);
175
- }
176
- /**
177
- * Are clear coat textures enabled in the application.
178
- */
179
- static get ClearCoatTextureEnabled() {
180
- return this._ClearCoatTextureEnabled;
181
- }
182
- static set ClearCoatTextureEnabled(value) {
183
- if (this._ClearCoatTextureEnabled === value) {
184
- return;
185
- }
186
- this._ClearCoatTextureEnabled = value;
187
- Engine.MarkAllMaterialsAsDirty(1);
188
- }
189
- /**
190
- * Are clear coat bump textures enabled in the application.
191
- */
192
- static get ClearCoatBumpTextureEnabled() {
193
- return this._ClearCoatBumpTextureEnabled;
194
- }
195
- static set ClearCoatBumpTextureEnabled(value) {
196
- if (this._ClearCoatBumpTextureEnabled === value) {
197
- return;
198
- }
199
- this._ClearCoatBumpTextureEnabled = value;
200
- Engine.MarkAllMaterialsAsDirty(1);
201
- }
202
- /**
203
- * Are clear coat tint textures enabled in the application.
204
- */
205
- static get ClearCoatTintTextureEnabled() {
206
- return this._ClearCoatTintTextureEnabled;
207
- }
208
- static set ClearCoatTintTextureEnabled(value) {
209
- if (this._ClearCoatTintTextureEnabled === value) {
210
- return;
211
- }
212
- this._ClearCoatTintTextureEnabled = value;
213
- Engine.MarkAllMaterialsAsDirty(1);
214
- }
215
- /**
216
- * Are sheen textures enabled in the application.
217
- */
218
- static get SheenTextureEnabled() {
219
- return this._SheenTextureEnabled;
220
- }
221
- static set SheenTextureEnabled(value) {
222
- if (this._SheenTextureEnabled === value) {
223
- return;
224
- }
225
- this._SheenTextureEnabled = value;
226
- Engine.MarkAllMaterialsAsDirty(1);
227
- }
228
- /**
229
- * Are anisotropic textures enabled in the application.
230
- */
231
- static get AnisotropicTextureEnabled() {
232
- return this._AnisotropicTextureEnabled;
233
- }
234
- static set AnisotropicTextureEnabled(value) {
235
- if (this._AnisotropicTextureEnabled === value) {
236
- return;
237
- }
238
- this._AnisotropicTextureEnabled = value;
239
- Engine.MarkAllMaterialsAsDirty(1);
240
- }
241
- /**
242
- * Are thickness textures enabled in the application.
243
- */
244
- static get ThicknessTextureEnabled() {
245
- return this._ThicknessTextureEnabled;
246
- }
247
- static set ThicknessTextureEnabled(value) {
248
- if (this._ThicknessTextureEnabled === value) {
249
- return;
250
- }
251
- this._ThicknessTextureEnabled = value;
252
- Engine.MarkAllMaterialsAsDirty(1);
253
- }
254
- /**
255
- * Are refraction intensity textures enabled in the application.
256
- */
257
- static get RefractionIntensityTextureEnabled() {
258
- return this._ThicknessTextureEnabled;
259
- }
260
- static set RefractionIntensityTextureEnabled(value) {
261
- if (this._RefractionIntensityTextureEnabled === value) {
262
- return;
263
- }
264
- this._RefractionIntensityTextureEnabled = value;
265
- Engine.MarkAllMaterialsAsDirty(1);
266
- }
267
- /**
268
- * Are translucency intensity textures enabled in the application.
269
- */
270
- static get TranslucencyIntensityTextureEnabled() {
271
- return this._ThicknessTextureEnabled;
272
- }
273
- static set TranslucencyIntensityTextureEnabled(value) {
274
- if (this._TranslucencyIntensityTextureEnabled === value) {
275
- return;
276
- }
277
- this._TranslucencyIntensityTextureEnabled = value;
278
- Engine.MarkAllMaterialsAsDirty(1);
279
- }
280
- /**
281
- * Are translucency intensity textures enabled in the application.
282
- */
283
- static get IridescenceTextureEnabled() {
284
- return this._IridescenceTextureEnabled;
285
- }
286
- static set IridescenceTextureEnabled(value) {
287
- if (this._IridescenceTextureEnabled === value) {
288
- return;
289
- }
290
- this._IridescenceTextureEnabled = value;
291
- Engine.MarkAllMaterialsAsDirty(1);
292
- }
293
- }
294
- // Flags used to enable or disable a type of texture for all Standard Materials
295
- MaterialFlags._DiffuseTextureEnabled = true;
296
- MaterialFlags._DetailTextureEnabled = true;
297
- MaterialFlags._DecalMapEnabled = true;
298
- MaterialFlags._AmbientTextureEnabled = true;
299
- MaterialFlags._OpacityTextureEnabled = true;
300
- MaterialFlags._ReflectionTextureEnabled = true;
301
- MaterialFlags._EmissiveTextureEnabled = true;
302
- MaterialFlags._SpecularTextureEnabled = true;
303
- MaterialFlags._BumpTextureEnabled = true;
304
- MaterialFlags._LightmapTextureEnabled = true;
305
- MaterialFlags._RefractionTextureEnabled = true;
306
- MaterialFlags._ColorGradingTextureEnabled = true;
307
- MaterialFlags._FresnelEnabled = true;
308
- MaterialFlags._ClearCoatTextureEnabled = true;
309
- MaterialFlags._ClearCoatBumpTextureEnabled = true;
310
- MaterialFlags._ClearCoatTintTextureEnabled = true;
311
- MaterialFlags._SheenTextureEnabled = true;
312
- MaterialFlags._AnisotropicTextureEnabled = true;
313
- MaterialFlags._ThicknessTextureEnabled = true;
314
- MaterialFlags._RefractionIntensityTextureEnabled = true;
315
- MaterialFlags._TranslucencyIntensityTextureEnabled = true;
316
- MaterialFlags._IridescenceTextureEnabled = true;
317
-
318
- // Do not edit.
319
- const name$7 = "sceneUboDeclaration";
320
- const shader$7 = `layout(std140,column_major) uniform;
321
- mat4 viewProjectionR;
322
- mat4 view;
323
- // Sideeffect
324
- ShaderStore.IncludesShadersStore[name$7] = shader$7;
325
-
326
- // Do not edit.
327
- const name$6 = "samplerFragmentDeclaration";
328
- const shader$6 = `#ifdef _DEFINENAME_
329
- #if _DEFINENAME_DIRECTUV==1
330
- #define v_VARYINGNAME_UV vMainUV1
331
- #elif _DEFINENAME_DIRECTUV==2
332
- #define v_VARYINGNAME_UV vMainUV2
333
- #elif _DEFINENAME_DIRECTUV==3
334
- #define v_VARYINGNAME_UV vMainUV3
335
- #elif _DEFINENAME_DIRECTUV==4
336
- #define v_VARYINGNAME_UV vMainUV4
337
- #elif _DEFINENAME_DIRECTUV==5
338
- #define v_VARYINGNAME_UV vMainUV5
339
- #elif _DEFINENAME_DIRECTUV==6
340
- #define v_VARYINGNAME_UV vMainUV6
341
- #else
342
- varying vec2 v_VARYINGNAME_UV;
343
- uniform sampler2D _SAMPLERNAME_Sampler;
344
- `;
345
- // Sideeffect
346
- ShaderStore.IncludesShadersStore[name$6] = shader$6;
347
-
348
- // Do not edit.
349
- const name$5 = "imageProcessingDeclaration";
350
- const shader$5 = `#ifdef EXPOSURE
351
- uniform float exposureLinear;
352
- #ifdef CONTRAST
353
- uniform float contrast;
354
- #if defined(VIGNETTE) || defined(DITHER)
355
- uniform vec2 vInverseScreenSize;
356
- #ifdef VIGNETTE
357
- uniform vec4 vignetteSettings1;
358
- #ifdef COLORCURVES
359
- uniform vec4 vCameraColorCurveNegative;
360
- #ifdef COLORGRADING
361
- #ifdef COLORGRADING3D
362
- uniform highp sampler3D txColorTransform;
363
- uniform sampler2D txColorTransform;
364
- uniform vec4 colorTransformSettings;
365
- #ifdef DITHER
366
- uniform float ditherIntensity;
367
- `;
368
- // Sideeffect
369
- ShaderStore.IncludesShadersStore[name$5] = shader$5;
370
-
371
- // Do not edit.
372
- const name$4 = "imageProcessingFunctions";
373
- const shader$4 = `#if defined(COLORGRADING) && !defined(COLORGRADING3D)
374
- /**
375
- vec3 sampleTexture3D(sampler2D colorTransform,vec3 color,vec2 sampler3dSetting)
376
- float sliceContinuous=(color.g-sampler3dSetting.x)*sampler3dSetting.y;
377
- float sliceContinuous=(color.b-sampler3dSetting.x)*sampler3dSetting.y;
378
- float sliceInteger=floor(sliceContinuous);
379
- vec2 sliceUV=color.rb;
380
- vec2 sliceUV=color.rg;
381
- sliceUV.x*=sliceSize;
382
- color.rgb=result.rgb;
383
- color.rgb=result.bgr;
384
- return color;
385
- #ifdef TONEMAPPING_ACES
386
- const mat3 ACESInputMat=mat3(
387
- #define CUSTOM_IMAGEPROCESSINGFUNCTIONS_DEFINITIONS
388
- vec4 applyImageProcessing(vec4 result) {
389
- #ifdef EXPOSURE
390
- result.rgb*=exposureLinear;
391
- #ifdef VIGNETTE
392
- vec2 viewportXY=gl_FragCoord.xy*vInverseScreenSize;
393
- vec3 vignetteColorMultiplier=mix(vignetteColor,vec3(1,1,1),vignette);
394
- #ifdef VIGNETTEBLENDMODEOPAQUE
395
- result.rgb=mix(vignetteColor,result.rgb,vignette);
396
- #endif
397
- #ifdef TONEMAPPING
398
- #ifdef TONEMAPPING_ACES
399
- result.rgb=ACESFitted(result.rgb);
400
- const float tonemappingCalibration=1.590579;
401
- #endif
402
- result.rgb=toGammaSpace(result.rgb);
403
- vec3 resultHighContrast=result.rgb*result.rgb*(3.0-2.0*result.rgb);
404
- #ifdef COLORGRADING
405
- vec3 colorTransformInput=result.rgb*colorTransformSettings.xxx+colorTransformSettings.yyy;
406
- vec3 colorTransformOutput=texture(txColorTransform,colorTransformInput).rgb;
407
- vec3 colorTransformOutput=sampleTexture3D(txColorTransform,colorTransformInput,colorTransformSettings.yz).rgb;
408
- result.rgb=mix(result.rgb,colorTransformOutput,colorTransformSettings.www);
409
- #ifdef COLORCURVES
410
- float luma=getLuminance(result.rgb);
411
- #ifdef DITHER
412
- float rand=getRand(gl_FragCoord.xy*vInverseScreenSize);
413
- #define CUSTOM_IMAGEPROCESSINGFUNCTIONS_UPDATERESULT_ATEND
414
- return result;
415
- // Sideeffect
416
- ShaderStore.IncludesShadersStore[name$4] = shader$4;
417
-
418
- // Do not edit.
419
- const name$3 = "bumpFragmentMainFunctions";
420
- const shader$3 = `#if defined(BUMP) || defined(CLEARCOAT_BUMP) || defined(ANISOTROPIC) || defined(DETAIL)
421
- #if defined(TANGENT) && defined(NORMAL)
422
- varying mat3 vTBN;
423
- #ifdef OBJECTSPACE_NORMALMAP
424
- uniform mat4 normalMatrix;
425
- mat4 toNormalMatrix(mat4 wMatrix)
426
- mat4 toNormalMatrix(mat4 m)
427
- #endif
428
- vec3 perturbNormalBase(mat3 cotangentFrame,vec3 normal,float scale)
429
- normal=normalize(normal*vec3(scale,scale,1.0));
430
- return normalize(cotangentFrame*normal);
431
- `;
432
- // Sideeffect
433
- ShaderStore.IncludesShadersStore[name$3] = shader$3;
434
-
435
- // Do not edit.
436
- const name$2 = "bumpFragmentFunctions";
437
- const shader$2 = `#if defined(BUMP)
438
- #include<samplerFragmentDeclaration>(_DEFINENAME_,BUMP,_VARYINGNAME_,Bump,_SAMPLERNAME_,bump)
439
- #endif
440
- #if defined(DETAIL)
441
- #include<samplerFragmentDeclaration>(_DEFINENAME_,DETAIL,_VARYINGNAME_,Detail,_SAMPLERNAME_,detail)
442
- #endif
443
- #if defined(BUMP) && defined(PARALLAX)
444
- const float minSamples=4.;
445
- `;
446
- // Sideeffect
447
- ShaderStore.IncludesShadersStore[name$2] = shader$2;
448
-
449
- // Do not edit.
450
- const name$1 = "bumpFragment";
451
- const shader$1 = `vec2 uvOffset=vec2(0.0,0.0);
452
- #ifdef NORMALXYSCALE
453
- float normalScale=1.0;
454
- float normalScale=vBumpInfos.y;
455
- float normalScale=1.0;
456
- #if defined(TANGENT) && defined(NORMAL)
457
- mat3 TBN=vTBN;
458
- vec2 TBNUV=gl_FrontFacing ? vBumpUV : -vBumpUV;
459
- vec2 TBNUV=gl_FrontFacing ? vDetailUV : -vDetailUV;
460
- #elif defined(ANISOTROPIC)
461
- #if defined(TANGENT) && defined(NORMAL)
462
- mat3 TBN=vTBN;
463
- vec2 TBNUV=gl_FrontFacing ? vMainUV1 : -vMainUV1;
464
- #endif
465
- #ifdef PARALLAX
466
- mat3 invTBN=transposeMat3(TBN);
467
- uvOffset=parallaxOcclusion(invTBN*-viewDirectionW,invTBN*normalW,vBumpUV,vBumpInfos.z);
468
- uvOffset=parallaxOffset(invTBN*viewDirectionW,vBumpInfos.z);
469
- #endif
470
- #ifdef DETAIL
471
- vec4 detailColor=texture2D(detailSampler,vDetailUV+uvOffset);
472
- #ifdef BUMP
473
- #ifdef OBJECTSPACE_NORMALMAP
474
- #define CUSTOM_FRAGMENT_BUMP_FRAGMENT
475
- normalW=normalize(texture2D(bumpSampler,vBumpUV).xyz *2.0-1.0);
476
- normalW=perturbNormal(TBN,texture2D(bumpSampler,vBumpUV+uvOffset).xyz,vBumpInfos.y);
477
- vec3 bumpNormal=texture2D(bumpSampler,vBumpUV+uvOffset).xyz*2.0-1.0;
478
- detailNormal.xy*=vDetailInfos.z;
479
- detailNormal.xy*=vDetailInfos.z;
480
- normalW=perturbNormalBase(TBN,blendedNormal,vBumpInfos.y);
481
- #elif defined(DETAIL)
482
- detailNormal.xy*=vDetailInfos.z;
483
- `;
484
- // Sideeffect
485
- ShaderStore.IncludesShadersStore[name$1] = shader$1;
486
-
487
- // Do not edit.
488
- const name = "bumpVertex";
489
- const shader = `#if defined(BUMP) || defined(PARALLAX) || defined(CLEARCOAT_BUMP) || defined(ANISOTROPIC)
490
- #if defined(TANGENT) && defined(NORMAL)
491
- vec3 tbnNormal=normalize(normalUpdated);
492
- #endif
493
- `;
494
- // Sideeffect
495
- ShaderStore.IncludesShadersStore[name] = shader;
496
-
497
- export { MaterialFlags as M };
@@ -1,68 +0,0 @@
1
- /**
2
- * Class used to represent a viewport on screen
3
- */
4
- class Viewport {
5
- /**
6
- * Creates a Viewport object located at (x, y) and sized (width, height)
7
- * @param x defines viewport left coordinate
8
- * @param y defines viewport top coordinate
9
- * @param width defines the viewport width
10
- * @param height defines the viewport height
11
- */
12
- constructor(
13
- /** viewport left coordinate */
14
- x,
15
- /** viewport top coordinate */
16
- y,
17
- /**viewport width */
18
- width,
19
- /** viewport height */
20
- height) {
21
- this.x = x;
22
- this.y = y;
23
- this.width = width;
24
- this.height = height;
25
- }
26
- /**
27
- * Creates a new viewport using absolute sizing (from 0-> width, 0-> height instead of 0->1)
28
- * @param renderWidth defines the rendering width
29
- * @param renderHeight defines the rendering height
30
- * @returns a new Viewport
31
- */
32
- toGlobal(renderWidth, renderHeight) {
33
- return new Viewport(this.x * renderWidth, this.y * renderHeight, this.width * renderWidth, this.height * renderHeight);
34
- }
35
- /**
36
- * Stores absolute viewport value into a target viewport (from 0-> width, 0-> height instead of 0->1)
37
- * @param renderWidth defines the rendering width
38
- * @param renderHeight defines the rendering height
39
- * @param ref defines the target viewport
40
- * @returns the current viewport
41
- */
42
- toGlobalToRef(renderWidth, renderHeight, ref) {
43
- ref.x = this.x * renderWidth;
44
- ref.y = this.y * renderHeight;
45
- ref.width = this.width * renderWidth;
46
- ref.height = this.height * renderHeight;
47
- return this;
48
- }
49
- /**
50
- * Returns a new Viewport copied from the current one
51
- * @returns a new Viewport
52
- */
53
- clone() {
54
- return new Viewport(this.x, this.y, this.width, this.height);
55
- }
56
- }
57
-
58
- /**
59
- * Options used to control default behaviors regarding compatibility support
60
- */
61
- class CompatibilityOptions {
62
- }
63
- /**
64
- * Defines if the system should use OpenGL convention for UVs when creating geometry or loading .babylon files (false by default)
65
- */
66
- CompatibilityOptions.UseOpenGLOrientationForUV = false;
67
-
68
- export { CompatibilityOptions as C, Viewport as V };
@@ -1,121 +0,0 @@
1
- import { C as Color4, a as Color3 } from './math.color.esm.js';
2
-
3
- /**
4
- * Configuration for the preview. Optionally, you can provide a custom configuration. (from a workflow for example) Sensible
5
- * defaults will be specified for all properties otherwise.
6
- */
7
- class Configuration {
8
- constructor(options) {
9
- /**
10
- * Will return clear color based on custom configuration or a sensible default.
11
- * @returns A Color4 object for use as a clear color.
12
- */
13
- this.getSceneClearColor = () => {
14
- var _a, _b, _c, _d;
15
- // It looks like the browser combines RGB values with background elements regardless of the alpha value.
16
- // To counteract this we set RGB to black in the case of transparency.
17
- const alpha = ((_a = this.customOptions) === null || _a === void 0 ? void 0 : _a.transparentBackground) ||
18
- ((_b = this.customOptions) === null || _b === void 0 ? void 0 : _b.backgroundImage)
19
- ? 0
20
- : 1;
21
- if ((this.customOptions && ((_c = this.customOptions) === null || _c === void 0 ? void 0 : _c.transparentBackground)) ||
22
- ((_d = this.customOptions) === null || _d === void 0 ? void 0 : _d.backgroundImage)) {
23
- return new Color4(0, 0, 0, alpha).toLinearSpace();
24
- }
25
- if (this.customOptions && this.customOptions.backgroundColor) {
26
- const parsedColor = Color3.FromHexString(this.customOptions.backgroundColor);
27
- return new Color4(parsedColor.r, parsedColor.g, parsedColor.b, alpha).toLinearSpace();
28
- }
29
- return new Color4(0.98, 0.98, 0.98, alpha).toLinearSpace();
30
- };
31
- this.highlightColorFromConfig = () => {
32
- if (this.customOptions && this.customOptions.highlightColor) {
33
- return this.hexToColor4(this.customOptions.highlightColor);
34
- }
35
- return new Color4(0.98, 0.98, 0.98, 1).toLinearSpace();
36
- };
37
- this.hexToColor4 = (hex, alpha = 1) => {
38
- const parsedColor = Color3.FromHexString(hex);
39
- return new Color4(parsedColor.r, parsedColor.g, parsedColor.b, alpha).toLinearSpace();
40
- };
41
- this.customOptions = options;
42
- }
43
- createCanvas() {
44
- if (this.customOptions.createCanvas) {
45
- return this.customOptions.createCanvas();
46
- }
47
- return document.createElement('canvas');
48
- }
49
- get options() {
50
- return this.customOptions;
51
- }
52
- /**
53
- * Configuration related to the scene
54
- */
55
- get scene() {
56
- var _a, _b, _c, _d;
57
- return {
58
- clearColor: this.getSceneClearColor(),
59
- transparentBackground: ((_a = this.customOptions) === null || _a === void 0 ? void 0 : _a.transparentBackground) ||
60
- ((_b = this.customOptions) === null || _b === void 0 ? void 0 : _b.backgroundImage),
61
- environmentFile: (_d = (_c = this.customOptions) === null || _c === void 0 ? void 0 : _c.environmentFile) !== null && _d !== void 0 ? _d : 'assets/model-viewer/default.env',
62
- };
63
- }
64
- /**
65
- * Configuration related to the camera used to view and interact with the scene.
66
- */
67
- get camera() {
68
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
69
- return {
70
- autoOrientation: (_b = (_a = this.customOptions) === null || _a === void 0 ? void 0 : _a.disableAutomaticOrientation) !== null && _b !== void 0 ? _b : true,
71
- autoRotation: {
72
- enabled: (_d = (_c = this.customOptions) === null || _c === void 0 ? void 0 : _c.autoRotation) !== null && _d !== void 0 ? _d : false,
73
- idleTimeMs: (_f = (_e = this.customOptions) === null || _e === void 0 ? void 0 : _e.idleTimeBeforeRotation) !== null && _f !== void 0 ? _f : 5000,
74
- },
75
- limits: {
76
- min: {
77
- alpha: ((_g = this.customOptions) === null || _g === void 0 ? void 0 : _g.lowerAlphaLimitDeg)
78
- ? (((_h = this.customOptions) === null || _h === void 0 ? void 0 : _h.lowerAlphaLimitDeg) * Math.PI) / 180
79
- : undefined,
80
- beta: ((_j = this.customOptions) === null || _j === void 0 ? void 0 : _j.lowerBetaLimitDeg)
81
- ? (((_k = this.customOptions) === null || _k === void 0 ? void 0 : _k.lowerBetaLimitDeg) * Math.PI) / 180
82
- : undefined,
83
- radius: (_l = this.customOptions) === null || _l === void 0 ? void 0 : _l.minZoomOverride,
84
- },
85
- max: {
86
- alpha: ((_m = this.customOptions) === null || _m === void 0 ? void 0 : _m.upperAlphaLimitDeg)
87
- ? (((_o = this.customOptions) === null || _o === void 0 ? void 0 : _o.upperAlphaLimitDeg) * Math.PI) / 180
88
- : undefined,
89
- beta: ((_p = this.customOptions) === null || _p === void 0 ? void 0 : _p.upperBetaLimitDeg)
90
- ? (((_q = this.customOptions) === null || _q === void 0 ? void 0 : _q.upperBetaLimitDeg) * Math.PI) / 180
91
- : undefined,
92
- radius: (_r = this.customOptions) === null || _r === void 0 ? void 0 : _r.maxZoomOverride,
93
- },
94
- },
95
- };
96
- }
97
- /**
98
- * Configuration related to the highlighting system. Highlights are used to add
99
- * a visual cue to the user that something is moused over in the preview.
100
- */
101
- get highlights() {
102
- var _a, _b;
103
- return {
104
- enabled: (_b = (_a = this.customOptions) === null || _a === void 0 ? void 0 : _a.highlightOnMaterialHover) !== null && _b !== void 0 ? _b : false,
105
- color: this.highlightColorFromConfig(),
106
- };
107
- }
108
- get lighting() {
109
- var _a, _b, _c, _d, _e, _f;
110
- return {
111
- exposure: (_c = (_b = (_a = this.customOptions) === null || _a === void 0 ? void 0 : _a.lighting) === null || _b === void 0 ? void 0 : _b.exposure) !== null && _c !== void 0 ? _c : 0.9,
112
- contrast: (_f = (_e = (_d = this.customOptions) === null || _d === void 0 ? void 0 : _d.lighting) === null || _e === void 0 ? void 0 : _e.contrast) !== null && _f !== void 0 ? _f : 1.6,
113
- };
114
- }
115
- get emissiveGlowIntensity() {
116
- var _a, _b;
117
- return (_b = (_a = this.customOptions) === null || _a === void 0 ? void 0 : _a.emissiveGlowIntensity) !== null && _b !== void 0 ? _b : 0.5;
118
- }
119
- }
120
-
121
- export { Configuration };