@spiffcommerce/preview 3.6.2-rc.6 → 3.6.2-rc.7

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 (39) hide show
  1. package/dist/_tslib.esm.js +33 -0
  2. package/dist/animation.esm.js +1364 -0
  3. package/dist/assetCache.esm.js +6 -0
  4. package/dist/blurPostProcess.esm.js +327 -0
  5. package/dist/bumpVertex.esm.js +497 -0
  6. package/dist/compatibilityOptions.esm.js +68 -0
  7. package/dist/configuration.esm.js +121 -0
  8. package/dist/core.esm.js +8135 -0
  9. package/dist/dynamicTexture.esm.js +105 -0
  10. package/dist/easing.esm.js +130 -0
  11. package/dist/effectFallbacks.esm.js +378 -0
  12. package/dist/engine.esm.js +25504 -0
  13. package/dist/glbLoaderExtensions.esm.js +690 -0
  14. package/dist/glowLayer.esm.js +1621 -0
  15. package/dist/glowLayerManager.esm.js +50 -0
  16. package/dist/guid.esm.js +21 -0
  17. package/dist/hdrFilteringFunctions.esm.js +816 -0
  18. package/dist/helperFunctions.esm.js +5145 -0
  19. package/dist/index.esm.js +38 -79096
  20. package/dist/material.esm.js +115 -0
  21. package/dist/math.axis.esm.js +35 -0
  22. package/dist/math.color.esm.js +1661 -0
  23. package/dist/math.path.esm.js +15 -0
  24. package/dist/math.size.esm.js +137 -0
  25. package/dist/mesh.esm.js +11170 -0
  26. package/dist/modelContainer.esm.js +1895 -0
  27. package/dist/node.esm.js +795 -0
  28. package/dist/pbrBRDFFunctions.esm.js +122 -2
  29. package/dist/pbrMaterial.esm.js +8747 -0
  30. package/dist/productAnimations.esm.js +182 -0
  31. package/dist/productCamera.esm.js +14 -0
  32. package/dist/renderConstants.esm.js +116 -0
  33. package/dist/renderingPipeline.esm.js +18 -0
  34. package/dist/sceneLoaderFlags.esm.js +51 -0
  35. package/dist/types.esm.js +30 -0
  36. package/dist/variants.esm.js +16 -0
  37. package/dist/webRequest.esm.js +7777 -0
  38. package/package.json +6 -4
  39. package/dist/index.umd.js +0 -10010
@@ -0,0 +1,115 @@
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 };
@@ -0,0 +1,35 @@
1
+ import { V as Vector3 } from './webRequest.esm.js';
2
+
3
+ /** Defines supported spaces */
4
+ var Space;
5
+ (function (Space) {
6
+ /** Local (object) space */
7
+ Space[Space["LOCAL"] = 0] = "LOCAL";
8
+ /** World space */
9
+ Space[Space["WORLD"] = 1] = "WORLD";
10
+ /** Bone space */
11
+ Space[Space["BONE"] = 2] = "BONE";
12
+ })(Space || (Space = {}));
13
+ /** Defines the 3 main axes */
14
+ class Axis {
15
+ }
16
+ /** X axis */
17
+ Axis.X = new Vector3(1.0, 0.0, 0.0);
18
+ /** Y axis */
19
+ Axis.Y = new Vector3(0.0, 1.0, 0.0);
20
+ /** Z axis */
21
+ Axis.Z = new Vector3(0.0, 0.0, 1.0);
22
+ /**
23
+ * Defines cartesian components.
24
+ */
25
+ var Coordinate;
26
+ (function (Coordinate) {
27
+ /** X axis */
28
+ Coordinate[Coordinate["X"] = 0] = "X";
29
+ /** Y axis */
30
+ Coordinate[Coordinate["Y"] = 1] = "Y";
31
+ /** Z axis */
32
+ Coordinate[Coordinate["Z"] = 2] = "Z";
33
+ })(Coordinate || (Coordinate = {}));
34
+
35
+ export { Axis as A, Coordinate as C, Space as S };