@shopware-ag/dive 1.10.0 → 1.12.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,25 +1272,42 @@ 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) {
1281
- this._material.roughnessMap = material.roughnessMap;
1282
- this._material.roughness = 1;
1283
- } else {
1278
+ if (material.vertexColors !== void 0) {
1279
+ this._material.vertexColors = material.vertexColors;
1280
+ }
1281
+ if (material.color !== void 0) {
1282
+ this._material.color = new import_three8.Color(material.color);
1283
+ }
1284
+ if (material.map !== void 0) {
1285
+ this._material.map = material.map;
1286
+ }
1287
+ if (material.normalMap !== void 0) {
1288
+ this._material.normalMap = material.normalMap;
1289
+ }
1290
+ if (material.roughness !== void 0) {
1284
1291
  this._material.roughness = material.roughness;
1285
1292
  }
1286
- if (material.metalnessMap) {
1287
- this._material.metalnessMap = material.metalnessMap;
1288
- this._material.metalness = 0;
1289
- } else {
1293
+ if (material.roughnessMap !== void 0) {
1294
+ this._material.roughnessMap = material.roughnessMap;
1295
+ if (this._material.roughnessMap) {
1296
+ this._material.roughness = 1;
1297
+ }
1298
+ }
1299
+ if (material.metalness !== void 0) {
1290
1300
  this._material.metalness = material.metalness;
1291
1301
  }
1302
+ if (material.metalnessMap !== void 0) {
1303
+ this._material.metalnessMap = material.metalnessMap;
1304
+ if (this._material.metalnessMap) {
1305
+ this._material.metalness = 1;
1306
+ }
1307
+ }
1292
1308
  if (this._mesh) {
1293
1309
  this._mesh.material = this._material;
1310
+ this._mesh.material.needsUpdate = true;
1294
1311
  }
1295
1312
  }
1296
1313
  SetToWorldOrigin() {
@@ -1484,19 +1501,23 @@ var DIVEPrimitive = class extends import_three10.Object3D {
1484
1501
  }
1485
1502
  SetMaterial(material) {
1486
1503
  const primitiveMaterial = this._mesh.material;
1487
- primitiveMaterial.color = new import_three10.Color(material.color);
1488
- if (material.roughnessMap) {
1504
+ if (material.color !== void 0) primitiveMaterial.color = new import_three10.Color(material.color);
1505
+ if (material.map !== void 0) primitiveMaterial.map = material.map;
1506
+ if (material.roughness !== void 0) primitiveMaterial.roughness = material.roughness;
1507
+ if (material.roughnessMap !== void 0) {
1489
1508
  primitiveMaterial.roughnessMap = material.roughnessMap;
1490
- primitiveMaterial.roughness = 1;
1491
- } else {
1492
- primitiveMaterial.roughness = material.roughness;
1509
+ if (primitiveMaterial.roughnessMap) {
1510
+ primitiveMaterial.roughness = 1;
1511
+ }
1493
1512
  }
1494
- if (material.metalnessMap) {
1513
+ if (material.metalness !== void 0) primitiveMaterial.metalness = material.metalness;
1514
+ if (material.metalnessMap !== void 0) {
1495
1515
  primitiveMaterial.metalnessMap = material.metalnessMap;
1496
- primitiveMaterial.metalness = 0;
1497
- } else {
1498
- primitiveMaterial.metalness = material.metalness;
1516
+ if (primitiveMaterial.metalnessMap) {
1517
+ primitiveMaterial.metalness = 1;
1518
+ }
1499
1519
  }
1520
+ if (this._mesh) this._mesh.material = primitiveMaterial;
1500
1521
  }
1501
1522
  SetToWorldOrigin() {
1502
1523
  var _a;