@shopware-ag/dive 1.10.0 → 1.11.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/build/dive.cjs CHANGED
@@ -1272,26 +1272,26 @@ var DIVEModel = class extends import_three8.Object3D {
1272
1272
  });
1273
1273
  }
1274
1274
  SetMaterial(material) {
1275
- console.error("HERE", this._mesh);
1276
1275
  if (!this._material) {
1277
1276
  this._material = new import_three8.MeshStandardMaterial();
1278
1277
  }
1279
- this._material.color = new import_three8.Color(material.color);
1280
- if (material.roughnessMap) {
1278
+ if (material.color !== void 0) this._material.color = new import_three8.Color(material.color);
1279
+ if (material.map !== void 0) this._material.map = material.map;
1280
+ if (material.roughness !== void 0) this._material.roughness = material.roughness;
1281
+ if (material.roughnessMap !== void 0) {
1281
1282
  this._material.roughnessMap = material.roughnessMap;
1282
- this._material.roughness = 1;
1283
- } else {
1284
- this._material.roughness = material.roughness;
1283
+ if (this._material.roughnessMap) {
1284
+ this._material.roughness = 1;
1285
+ }
1285
1286
  }
1286
- if (material.metalnessMap) {
1287
+ if (material.metalness !== void 0) this._material.metalness = material.metalness;
1288
+ if (material.metalnessMap !== void 0) {
1287
1289
  this._material.metalnessMap = material.metalnessMap;
1288
- this._material.metalness = 0;
1289
- } else {
1290
- this._material.metalness = material.metalness;
1291
- }
1292
- if (this._mesh) {
1293
- this._mesh.material = this._material;
1290
+ if (this._material.metalnessMap) {
1291
+ this._material.metalness = 1;
1292
+ }
1294
1293
  }
1294
+ if (this._mesh) this._mesh.material = this._material;
1295
1295
  }
1296
1296
  SetToWorldOrigin() {
1297
1297
  var _a;
@@ -1484,19 +1484,23 @@ var DIVEPrimitive = class extends import_three10.Object3D {
1484
1484
  }
1485
1485
  SetMaterial(material) {
1486
1486
  const primitiveMaterial = this._mesh.material;
1487
- primitiveMaterial.color = new import_three10.Color(material.color);
1488
- if (material.roughnessMap) {
1487
+ if (material.color !== void 0) primitiveMaterial.color = new import_three10.Color(material.color);
1488
+ if (material.map !== void 0) primitiveMaterial.map = material.map;
1489
+ if (material.roughness !== void 0) primitiveMaterial.roughness = material.roughness;
1490
+ if (material.roughnessMap !== void 0) {
1489
1491
  primitiveMaterial.roughnessMap = material.roughnessMap;
1490
- primitiveMaterial.roughness = 1;
1491
- } else {
1492
- primitiveMaterial.roughness = material.roughness;
1492
+ if (primitiveMaterial.roughnessMap) {
1493
+ primitiveMaterial.roughness = 1;
1494
+ }
1493
1495
  }
1494
- if (material.metalnessMap) {
1496
+ if (material.metalness !== void 0) primitiveMaterial.metalness = material.metalness;
1497
+ if (material.metalnessMap !== void 0) {
1495
1498
  primitiveMaterial.metalnessMap = material.metalnessMap;
1496
- primitiveMaterial.metalness = 0;
1497
- } else {
1498
- primitiveMaterial.metalness = material.metalness;
1499
+ if (primitiveMaterial.metalnessMap) {
1500
+ primitiveMaterial.metalness = 1;
1501
+ }
1499
1502
  }
1503
+ if (this._mesh) this._mesh.material = primitiveMaterial;
1500
1504
  }
1501
1505
  SetToWorldOrigin() {
1502
1506
  var _a;