@configura/web-core 1.3.0-alpha.7 → 1.4.0-alpha.2

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.
@@ -57,7 +57,9 @@ export declare class PBROpacity {
57
57
  maskThreshold: number;
58
58
  readonly texture?: PBRTexture | undefined;
59
59
  readonly channels?: "a" | "r" | undefined;
60
- constructor(factor: number, mode: PBROpacityMode, maskThreshold: number, texture?: PBRTexture | undefined, channels?: "a" | "r" | undefined);
60
+ readonly useAlphaFromBase?: boolean | undefined;
61
+ constructor(factor: number, mode: PBROpacityMode, maskThreshold: number, texture?: PBRTexture | undefined, channels?: "a" | "r" | undefined, // Undocumented in CmSym-spec, r seem to mean rgb
62
+ useAlphaFromBase?: boolean | undefined);
61
63
  }
62
64
  export declare class PBRRefraction {
63
65
  readonly ior: number;
@@ -49,7 +49,7 @@ export class GMaterialPBR extends GMaterial3D {
49
49
  log.warn(`Unsupported ${txtType} texture channel: ${channel}`, "Fallback to a.");
50
50
  channel = "a"; // Alpha channel, safest fallback
51
51
  }
52
- this.opacity = new PBROpacity((_c = loadNumber(log, txtType, prop, "factor")) !== null && _c !== void 0 ? _c : 1, loadOpacityMode(log, txtType, prop), (_d = loadNumber(log, txtType, prop, "maskThreshold")) !== null && _d !== void 0 ? _d : 0.5, texture, channel);
52
+ this.opacity = new PBROpacity((_c = loadNumber(log, txtType, prop, "factor")) !== null && _c !== void 0 ? _c : 1, loadOpacityMode(log, txtType, prop), (_d = loadNumber(log, txtType, prop, "maskThreshold")) !== null && _d !== void 0 ? _d : 0.5, texture, channel, loadBool(log, txtType, prop, "useAlphaFromBase"));
53
53
  }
54
54
  txtType = "occlusion" /* pbrOcclusion */;
55
55
  prop = pbr.get(txtType);
@@ -137,13 +137,15 @@ export class PBROcclusion {
137
137
  }
138
138
  }
139
139
  export class PBROpacity {
140
- constructor(factor, mode, maskThreshold, texture, channels // Undocumented in CmSym-spec, r seem to means rgb
140
+ constructor(factor, mode, maskThreshold, texture, channels, // Undocumented in CmSym-spec, r seem to mean rgb
141
+ useAlphaFromBase // New in CmSym 4.5.0, see WEB-8500
141
142
  ) {
142
143
  this.factor = factor;
143
144
  this.mode = mode;
144
145
  this.maskThreshold = maskThreshold;
145
146
  this.texture = texture;
146
147
  this.channels = channels;
148
+ this.useAlphaFromBase = useAlphaFromBase;
147
149
  }
148
150
  }
149
151
  export class PBRRefraction {
@@ -256,6 +258,18 @@ function loadNumber(log, scope, dex, name) {
256
258
  }
257
259
  return obj;
258
260
  }
261
+ /**
262
+ * Loads and returns the boolean specified by the name parameter.
263
+ * Returns undefined if the object was not found or not of the correct type.
264
+ */
265
+ function loadBool(log, scope, dex, name) {
266
+ const obj = dex.get(name);
267
+ if (obj !== undefined && typeof obj !== "boolean") {
268
+ log.warn(`Bool property not valid (${scope}.${name}): ${obj}`);
269
+ return undefined;
270
+ }
271
+ return obj;
272
+ }
259
273
  /**
260
274
  * Loads and returns the angle (in radians) specified by the name parameter.
261
275
  * Returns undefined if the object was not found or not of the correct type.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@configura/web-core",
3
- "version": "1.3.0-alpha.7",
3
+ "version": "1.4.0-alpha.2",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -15,8 +15,8 @@
15
15
  "test": "echo \"Error: run tests from root\" && exit 1"
16
16
  },
17
17
  "dependencies": {
18
- "@configura/internal": "^1.3.0-alpha.7",
19
- "@configura/web-utilities": "^1.3.0-alpha.7"
18
+ "@configura/internal": "^1.4.0-alpha.2",
19
+ "@configura/web-utilities": "^1.4.0-alpha.2"
20
20
  },
21
21
  "devDependencies": {
22
22
  "@types/uuid": "^8.3.0",
@@ -27,5 +27,5 @@
27
27
  "publishConfig": {
28
28
  "access": "public"
29
29
  },
30
- "gitHead": "1c5c089a31e6662b6da365b7038254e70a1cc8ff"
30
+ "gitHead": "b0d5dbdefc93b2c87298b36d82f6dd32cc2c14e9"
31
31
  }