@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.cjs +40 -56
- package/build/dive.cjs.map +1 -1
- package/build/dive.d.cts +1 -1
- package/build/dive.d.ts +1 -1
- package/build/dive.js +41 -57
- package/build/dive.js.map +1 -1
- package/package.json +1 -1
- package/src/dive.ts +2 -1
- package/src/primitive/Primitive.ts +46 -31
- package/src/primitive/__test__/Primitive.test.ts +30 -14
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,
|
|
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.
|
|
1483
|
-
|
|
1484
|
-
|
|
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)
|
|
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 =
|
|
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
|
-
|
|
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
|
-
|
|
1586
|
+
const geo = new SphereGeometry2(geometry.width / 2, 256, 256);
|
|
1587
|
+
return geo;
|
|
1571
1588
|
}
|
|
1572
1589
|
createPyramidGeometry(geometry) {
|
|
1573
|
-
const geo = new
|
|
1574
|
-
|
|
1575
|
-
geo.
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|