@shopware-ag/dive 1.12.0 → 1.12.1

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.d.cts CHANGED
@@ -786,4 +786,4 @@ declare class DIVE {
786
786
  private removeResizeObserver;
787
787
  }
788
788
 
789
- export { type Actions, type COMEntity, type COMLight, type COMModel, type COMPov, DIVE, DIVECommunication, DIVEDefaultSettings, DIVEMath, type DIVESettings, DIVE as default };
789
+ export { type Actions, type COMEntity, type COMLight, type COMModel, type COMPov, type COMPrimitive, DIVE, DIVECommunication, DIVEDefaultSettings, DIVEMath, type DIVESettings, DIVE as default };
package/build/dive.d.ts CHANGED
@@ -786,4 +786,4 @@ declare class DIVE {
786
786
  private removeResizeObserver;
787
787
  }
788
788
 
789
- export { type Actions, type COMEntity, type COMLight, type COMModel, type COMPov, DIVE, DIVECommunication, DIVEDefaultSettings, DIVEMath, type DIVESettings, DIVE as default };
789
+ export { type Actions, type COMEntity, type COMLight, type COMModel, type COMPov, type COMPrimitive, DIVE, DIVECommunication, DIVEDefaultSettings, DIVEMath, type DIVESettings, DIVE as default };
package/build/dive.js CHANGED
@@ -1442,7 +1442,7 @@ var DIVEModelRoot = class extends Object3D7 {
1442
1442
  import { Object3D as Object3D9 } from "three";
1443
1443
 
1444
1444
  // src/primitive/Primitive.ts
1445
- import { Box3 as Box32, BoxGeometry, BufferGeometry, Color as Color6, CylinderGeometry, Float32BufferAttribute, Mesh as Mesh3, Object3D as Object3D8, Raycaster as Raycaster3, SphereGeometry as SphereGeometry2, Uint32BufferAttribute, Vector3 as Vector33 } from "three";
1445
+ import { Box3 as Box32, BoxGeometry, BufferGeometry, Color as Color6, ConeGeometry, CylinderGeometry, Mesh as Mesh3, MeshStandardMaterial as MeshStandardMaterial2, Object3D as Object3D8, Raycaster as Raycaster3, SphereGeometry as SphereGeometry2, Vector3 as Vector33 } from "three";
1446
1446
  init_VisibilityLayerMask();
1447
1447
  var DIVEPrimitive = class extends Object3D8 {
1448
1448
  constructor() {
@@ -1455,11 +1455,11 @@ var DIVEPrimitive = class extends Object3D8 {
1455
1455
  this._mesh.layers.mask = PRODUCT_LAYER_MASK;
1456
1456
  this._mesh.castShadow = true;
1457
1457
  this._mesh.receiveShadow = true;
1458
+ this._mesh.material = new MeshStandardMaterial2();
1458
1459
  this.add(this._mesh);
1459
1460
  this._boundingBox = new Box32();
1460
1461
  }
1461
1462
  SetGeometry(geometry) {
1462
- this.clear();
1463
1463
  this._mesh.geometry = this.assembleGeometry(geometry);
1464
1464
  this._boundingBox.setFromObject(this._mesh);
1465
1465
  }
@@ -1479,20 +1479,34 @@ var DIVEPrimitive = class extends Object3D8 {
1479
1479
  }
1480
1480
  SetMaterial(material) {
1481
1481
  const primitiveMaterial = this._mesh.material;
1482
- if (material.color !== void 0) primitiveMaterial.color = new Color6(material.color);
1483
- if (material.map !== void 0) primitiveMaterial.map = material.map;
1484
- if (material.roughness !== void 0) primitiveMaterial.roughness = material.roughness;
1482
+ if (material.vertexColors !== void 0) {
1483
+ primitiveMaterial.vertexColors = material.vertexColors;
1484
+ }
1485
+ if (material.color !== void 0) {
1486
+ primitiveMaterial.color = new Color6(material.color);
1487
+ }
1488
+ if (material.map !== void 0) {
1489
+ primitiveMaterial.map = material.map;
1490
+ }
1491
+ if (material.normalMap !== void 0) {
1492
+ primitiveMaterial.normalMap = material.normalMap;
1493
+ }
1494
+ if (material.roughness !== void 0) {
1495
+ primitiveMaterial.roughness = material.roughness;
1496
+ }
1485
1497
  if (material.roughnessMap !== void 0) {
1486
1498
  primitiveMaterial.roughnessMap = material.roughnessMap;
1487
1499
  if (primitiveMaterial.roughnessMap) {
1488
1500
  primitiveMaterial.roughness = 1;
1489
1501
  }
1490
1502
  }
1491
- if (material.metalness !== void 0) primitiveMaterial.metalness = material.metalness;
1503
+ if (material.metalness !== void 0) {
1504
+ primitiveMaterial.metalness = material.metalness;
1505
+ }
1492
1506
  if (material.metalnessMap !== void 0) {
1493
1507
  primitiveMaterial.metalnessMap = material.metalnessMap;
1494
1508
  if (primitiveMaterial.metalnessMap) {
1495
- primitiveMaterial.metalness = 1;
1509
+ primitiveMaterial.metalness = 0;
1496
1510
  }
1497
1511
  }
1498
1512
  if (this._mesh) this._mesh.material = primitiveMaterial;
@@ -1564,69 +1578,39 @@ var DIVEPrimitive = class extends Object3D8 {
1564
1578
  }
1565
1579
  }
1566
1580
  createCylinderGeometry(geometry) {
1567
- return new CylinderGeometry(geometry.width * 2, geometry.width * 2, geometry.height, 64);
1581
+ const geo = new CylinderGeometry(geometry.width / 2, geometry.width / 2, geometry.height, 64);
1582
+ geo.translate(0, geometry.height / 2, 0);
1583
+ return geo;
1568
1584
  }
1569
1585
  createSphereGeometry(geometry) {
1570
- return new SphereGeometry2(geometry.width * 2, 64);
1586
+ const geo = new SphereGeometry2(geometry.width / 2, 256, 256);
1587
+ return geo;
1571
1588
  }
1572
1589
  createPyramidGeometry(geometry) {
1573
- const geo = new BufferGeometry();
1574
- const { width, height, depth } = geometry;
1575
- geo.setAttribute("position", new Float32BufferAttribute([
1576
- width / 2,
1577
- 0,
1578
- depth / 2,
1579
- // right back
1580
- width / 2,
1581
- 0,
1582
- -depth / 2,
1583
- // right front
1584
- -width / 2,
1585
- 0,
1586
- -depth / 2,
1587
- // left front
1588
- -width / 2,
1589
- 0,
1590
- depth / 2,
1591
- // left back
1592
- 0,
1593
- height,
1594
- 0
1595
- // top
1596
- ], 3));
1597
- geo.setIndex(new Uint32BufferAttribute([
1598
- 1,
1599
- 0,
1600
- 4,
1601
- 2,
1602
- 1,
1603
- 4,
1604
- 3,
1605
- 2,
1606
- 4,
1607
- 3,
1608
- 0,
1609
- 4,
1610
- 0,
1611
- 1,
1612
- 2,
1613
- 0,
1614
- 2,
1615
- 3
1616
- ], 1));
1590
+ const geo = new ConeGeometry(geometry.width / 2, geometry.height, 4, 1, true);
1591
+ geo.rotateY(Math.PI / 4);
1592
+ geo.translate(0, geometry.height / 2, 0);
1617
1593
  return geo;
1618
1594
  }
1619
1595
  createBoxGeometry(geometry) {
1620
- return new BoxGeometry(geometry.width, geometry.height, geometry.depth);
1596
+ const geo = new BoxGeometry(geometry.width, geometry.height, geometry.depth);
1597
+ geo.translate(0, geometry.height / 2, 0);
1598
+ return geo;
1621
1599
  }
1622
1600
  createConeGeometry(geometry) {
1623
- return new CylinderGeometry(0, geometry.width * 2, geometry.height, 64);
1601
+ const geo = new ConeGeometry(geometry.width / 2, geometry.height, 256);
1602
+ geo.translate(0, geometry.height / 2, 0);
1603
+ return geo;
1624
1604
  }
1625
1605
  createWallGeometry(geometry) {
1626
- return new BoxGeometry(geometry.width, geometry.height, geometry.depth, 16);
1606
+ const geo = new BoxGeometry(geometry.width, geometry.height, geometry.depth || 0.05, 16);
1607
+ geo.translate(0, geometry.height / 2, 0);
1608
+ return geo;
1627
1609
  }
1628
1610
  createPlaneGeometry(geometry) {
1629
- return new BoxGeometry(geometry.width, geometry.height, geometry.depth);
1611
+ const geo = new BoxGeometry(geometry.width, geometry.height, geometry.depth);
1612
+ geo.translate(0, geometry.height / 2, 0);
1613
+ return geo;
1630
1614
  }
1631
1615
  };
1632
1616