@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,115 +0,0 @@
1
- import { a as Color3 } from './math.color.esm.js';
2
- import { MaterialEffectMode } from './types.esm.js';
3
-
4
- const textureNameMap = {
5
- albedoTexture: 'albedoMap',
6
- bumpTexture: 'normalMap',
7
- ambientTexture: 'ambientMap',
8
- emissiveTexture: 'emissionMap',
9
- opacityTexture: 'alphaMap',
10
- metallicTexture: 'metallicMap',
11
- refractionTexture: 'refractionMap',
12
- };
13
- function calculateMaterialProperties(materialVariant, targetMaterial, assetsManager, removeWhenUndefined) {
14
- const supportedTextures = [
15
- 'albedoTexture',
16
- 'bumpTexture',
17
- 'ambientTexture',
18
- 'emissiveTexture',
19
- 'opacityTexture',
20
- 'metallicTexture',
21
- 'refractionTexture',
22
- ];
23
- supportedTextures.forEach((textureName) => {
24
- calculateAndApplyTextureProperties(textureName, materialVariant, targetMaterial, assetsManager, removeWhenUndefined);
25
- });
26
- calculateClearcoatProperties(materialVariant, targetMaterial);
27
- }
28
- function calculateAndApplyTextureProperties(textureName, materialVariant, targetMaterial, assetsManager, removeWhenUndefined) {
29
- const resourceKeyForTexture = textureNameMap[textureName];
30
- if (!resourceKeyForTexture) {
31
- throw new Error('Unexpected texture name encountered.');
32
- }
33
- const textureAsset = materialVariant[resourceKeyForTexture];
34
- const textureLink = textureAsset === null || textureAsset === void 0 ? void 0 : textureAsset.fileLink;
35
- if (textureLink) {
36
- assetsManager.addTextureTask(textureName, textureLink, false, false);
37
- }
38
- else if (removeWhenUndefined && targetMaterial[textureName]) {
39
- targetMaterial[textureName] && targetMaterial[textureName].dispose();
40
- targetMaterial[textureName] = null;
41
- applyTextureSpecificChangesOnRemoval(textureName, targetMaterial);
42
- }
43
- }
44
- /**
45
- * Certain textures require specific behavior to be undone on removal, such
46
- * as flags that would have enabled no longer desired behavior. We filter those out here.
47
- * @param textureName The texture name being handled.
48
- * @param targetMat The material this texture resides on.
49
- */
50
- function applyTextureSpecificChangesOnRemoval(textureName, targetMat) {
51
- if (textureName === 'opacityTexture') {
52
- targetMat.useAlphaFromAlbedoTexture = true;
53
- }
54
- if (textureName === 'metallicTexture') {
55
- targetMat.useRoughnessFromMetallicTextureAlpha = false;
56
- targetMat.useRoughnessFromMetallicTextureGreen = false;
57
- targetMat.useMetallnessFromMetallicTextureBlue = false;
58
- }
59
- if (textureName === 'refractionTexture') {
60
- targetMat.subSurface.isRefractionEnabled = false;
61
- targetMat.subSurface.refractionIntensity = 1;
62
- }
63
- if (textureName === 'emissiveTexture') {
64
- targetMat.emissiveIntensity = 0;
65
- targetMat.emissiveColor = new Color3(0, 0, 0);
66
- }
67
- }
68
- /**
69
- * Builds a callback to run after the texture has finished downloading and
70
- * is ready for application to the material it targets. This function should apply any remaining
71
- * properties to the material and then set the texture itself.
72
- */
73
- function applyDownloadedTexture(textureName, targetMat, materialResource, downloadedTexture) {
74
- if (textureName === 'opacityTexture') {
75
- targetMat.useAlphaFromAlbedoTexture = false;
76
- }
77
- if (textureName === 'metallicTexture') {
78
- targetMat.useRoughnessFromMetallicTextureAlpha = false;
79
- targetMat.useRoughnessFromMetallicTextureGreen = true;
80
- targetMat.useMetallnessFromMetallicTextureBlue = true;
81
- }
82
- if (textureName === 'refractionTexture') {
83
- targetMat.subSurface.isRefractionEnabled = true;
84
- targetMat.subSurface.refractionIntensity =
85
- materialResource.refractionIntensity || 1;
86
- }
87
- targetMat[textureName] = downloadedTexture;
88
- if (textureName === 'emissiveTexture') {
89
- // TODO: Do we want these to be configurable?
90
- targetMat.emissiveColor = new Color3(1, 1, 1);
91
- targetMat.emissiveIntensity = 1;
92
- }
93
- }
94
- /**
95
- * Applies a clearcoat parameter to a material if requested.
96
- * @param materialVariant The variant to read for clearcoat.
97
- * @param targetMaterial The target material to be applied to.
98
- */
99
- function calculateClearcoatProperties(materialVariant, targetMaterial) {
100
- if (!materialVariant.clearCoat) {
101
- return;
102
- }
103
- if (materialVariant.clearCoat === MaterialEffectMode.RemoveWhenSelected) {
104
- targetMaterial.clearCoat.isEnabled = false;
105
- targetMaterial.clearCoat.indexOfRefraction = 1.5; // Default value
106
- }
107
- else if (materialVariant.clearCoat === MaterialEffectMode.ApplyWhenSelected) {
108
- targetMaterial.clearCoat.isEnabled = true;
109
- targetMaterial.clearCoat.indexOfRefraction =
110
- materialVariant.clearCoatIOR ||
111
- targetMaterial.clearCoat.indexOfRefraction;
112
- }
113
- }
114
-
115
- export { applyDownloadedTexture, calculateMaterialProperties };