@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.
- package/dist/index.esm.js +1576 -38
- package/dist/index.umd.js +1 -0
- package/package.json +4 -6
- package/dist/_tslib.esm.js +0 -33
- package/dist/animation.esm.js +0 -1364
- package/dist/assetCache.esm.js +0 -6
- package/dist/assetCache.esm2.js +0 -825
- package/dist/blurPostProcess.esm.js +0 -327
- package/dist/bumpVertex.esm.js +0 -497
- package/dist/compatibilityOptions.esm.js +0 -68
- package/dist/configuration.esm.js +0 -121
- package/dist/core.esm.js +0 -8135
- package/dist/dynamicTexture.esm.js +0 -105
- package/dist/dynamicTexture.esm2.js +0 -238
- package/dist/easing.esm.js +0 -130
- package/dist/effectFallbacks.esm.js +0 -378
- package/dist/engine.esm.js +0 -25504
- package/dist/glbLoaderExtensions.esm.js +0 -690
- package/dist/glowLayer.esm.js +0 -1621
- package/dist/glowLayerManager.esm.js +0 -50
- package/dist/guid.esm.js +0 -21
- package/dist/hdrFilteringFunctions.esm.js +0 -816
- package/dist/helperFunctions.esm.js +0 -5145
- package/dist/material.esm.js +0 -115
- package/dist/material.esm2.js +0 -5245
- package/dist/math.axis.esm.js +0 -35
- package/dist/math.color.esm.js +0 -1661
- package/dist/math.path.esm.js +0 -15
- package/dist/math.size.esm.js +0 -137
- package/dist/mesh.esm.js +0 -11170
- package/dist/modelContainer.esm.js +0 -1895
- package/dist/node.esm.js +0 -795
- package/dist/pbrBRDFFunctions.esm.js +0 -124
- package/dist/pbrMaterial.esm.js +8 -8739
- package/dist/productAnimations.esm.js +0 -182
- package/dist/productCamera.esm.js +0 -14
- package/dist/productCamera.esm2.js +0 -3870
- package/dist/renderConstants.esm.js +0 -116
- package/dist/renderingPipeline.esm.js +0 -18
- package/dist/renderingPipeline.esm2.js +1 -3594
- package/dist/sceneLoaderFlags.esm.js +0 -51
- package/dist/types.esm.js +0 -30
- package/dist/variants.esm.js +0 -16
- package/dist/variants.esm2.js +0 -3097
- package/dist/webRequest.esm.js +0 -7777
package/dist/material.esm.js
DELETED
|
@@ -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 };
|