@shopware-ag/dive 1.11.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 +62 -61
- package/build/dive.cjs.map +1 -1
- package/build/dive.d.cts +3 -1
- package/build/dive.d.ts +3 -1
- package/build/dive.js +63 -62
- package/build/dive.js.map +1 -1
- package/package.json +1 -1
- package/src/com/types.ts +2 -0
- package/src/dive.ts +2 -1
- package/src/model/Model.ts +27 -5
- package/src/model/__test__/Model.test.ts +2 -0
- package/src/primitive/Primitive.ts +46 -31
- package/src/primitive/__test__/Primitive.test.ts +30 -14
package/build/dive.cjs
CHANGED
|
@@ -1275,23 +1275,40 @@ var DIVEModel = class extends import_three8.Object3D {
|
|
|
1275
1275
|
if (!this._material) {
|
|
1276
1276
|
this._material = new import_three8.MeshStandardMaterial();
|
|
1277
1277
|
}
|
|
1278
|
-
if (material.
|
|
1279
|
-
|
|
1280
|
-
|
|
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) {
|
|
1291
|
+
this._material.roughness = material.roughness;
|
|
1292
|
+
}
|
|
1281
1293
|
if (material.roughnessMap !== void 0) {
|
|
1282
1294
|
this._material.roughnessMap = material.roughnessMap;
|
|
1283
1295
|
if (this._material.roughnessMap) {
|
|
1284
1296
|
this._material.roughness = 1;
|
|
1285
1297
|
}
|
|
1286
1298
|
}
|
|
1287
|
-
if (material.metalness !== void 0)
|
|
1299
|
+
if (material.metalness !== void 0) {
|
|
1300
|
+
this._material.metalness = material.metalness;
|
|
1301
|
+
}
|
|
1288
1302
|
if (material.metalnessMap !== void 0) {
|
|
1289
1303
|
this._material.metalnessMap = material.metalnessMap;
|
|
1290
1304
|
if (this._material.metalnessMap) {
|
|
1291
1305
|
this._material.metalness = 1;
|
|
1292
1306
|
}
|
|
1293
1307
|
}
|
|
1294
|
-
if (this._mesh)
|
|
1308
|
+
if (this._mesh) {
|
|
1309
|
+
this._mesh.material = this._material;
|
|
1310
|
+
this._mesh.material.needsUpdate = true;
|
|
1311
|
+
}
|
|
1295
1312
|
}
|
|
1296
1313
|
SetToWorldOrigin() {
|
|
1297
1314
|
var _a;
|
|
@@ -1460,11 +1477,11 @@ var DIVEPrimitive = class extends import_three10.Object3D {
|
|
|
1460
1477
|
this._mesh.layers.mask = PRODUCT_LAYER_MASK;
|
|
1461
1478
|
this._mesh.castShadow = true;
|
|
1462
1479
|
this._mesh.receiveShadow = true;
|
|
1480
|
+
this._mesh.material = new import_three10.MeshStandardMaterial();
|
|
1463
1481
|
this.add(this._mesh);
|
|
1464
1482
|
this._boundingBox = new import_three10.Box3();
|
|
1465
1483
|
}
|
|
1466
1484
|
SetGeometry(geometry) {
|
|
1467
|
-
this.clear();
|
|
1468
1485
|
this._mesh.geometry = this.assembleGeometry(geometry);
|
|
1469
1486
|
this._boundingBox.setFromObject(this._mesh);
|
|
1470
1487
|
}
|
|
@@ -1484,20 +1501,34 @@ var DIVEPrimitive = class extends import_three10.Object3D {
|
|
|
1484
1501
|
}
|
|
1485
1502
|
SetMaterial(material) {
|
|
1486
1503
|
const primitiveMaterial = this._mesh.material;
|
|
1487
|
-
if (material.
|
|
1488
|
-
|
|
1489
|
-
|
|
1504
|
+
if (material.vertexColors !== void 0) {
|
|
1505
|
+
primitiveMaterial.vertexColors = material.vertexColors;
|
|
1506
|
+
}
|
|
1507
|
+
if (material.color !== void 0) {
|
|
1508
|
+
primitiveMaterial.color = new import_three10.Color(material.color);
|
|
1509
|
+
}
|
|
1510
|
+
if (material.map !== void 0) {
|
|
1511
|
+
primitiveMaterial.map = material.map;
|
|
1512
|
+
}
|
|
1513
|
+
if (material.normalMap !== void 0) {
|
|
1514
|
+
primitiveMaterial.normalMap = material.normalMap;
|
|
1515
|
+
}
|
|
1516
|
+
if (material.roughness !== void 0) {
|
|
1517
|
+
primitiveMaterial.roughness = material.roughness;
|
|
1518
|
+
}
|
|
1490
1519
|
if (material.roughnessMap !== void 0) {
|
|
1491
1520
|
primitiveMaterial.roughnessMap = material.roughnessMap;
|
|
1492
1521
|
if (primitiveMaterial.roughnessMap) {
|
|
1493
1522
|
primitiveMaterial.roughness = 1;
|
|
1494
1523
|
}
|
|
1495
1524
|
}
|
|
1496
|
-
if (material.metalness !== void 0)
|
|
1525
|
+
if (material.metalness !== void 0) {
|
|
1526
|
+
primitiveMaterial.metalness = material.metalness;
|
|
1527
|
+
}
|
|
1497
1528
|
if (material.metalnessMap !== void 0) {
|
|
1498
1529
|
primitiveMaterial.metalnessMap = material.metalnessMap;
|
|
1499
1530
|
if (primitiveMaterial.metalnessMap) {
|
|
1500
|
-
primitiveMaterial.metalness =
|
|
1531
|
+
primitiveMaterial.metalness = 0;
|
|
1501
1532
|
}
|
|
1502
1533
|
}
|
|
1503
1534
|
if (this._mesh) this._mesh.material = primitiveMaterial;
|
|
@@ -1569,69 +1600,39 @@ var DIVEPrimitive = class extends import_three10.Object3D {
|
|
|
1569
1600
|
}
|
|
1570
1601
|
}
|
|
1571
1602
|
createCylinderGeometry(geometry) {
|
|
1572
|
-
|
|
1603
|
+
const geo = new import_three10.CylinderGeometry(geometry.width / 2, geometry.width / 2, geometry.height, 64);
|
|
1604
|
+
geo.translate(0, geometry.height / 2, 0);
|
|
1605
|
+
return geo;
|
|
1573
1606
|
}
|
|
1574
1607
|
createSphereGeometry(geometry) {
|
|
1575
|
-
|
|
1608
|
+
const geo = new import_three10.SphereGeometry(geometry.width / 2, 256, 256);
|
|
1609
|
+
return geo;
|
|
1576
1610
|
}
|
|
1577
1611
|
createPyramidGeometry(geometry) {
|
|
1578
|
-
const geo = new import_three10.
|
|
1579
|
-
|
|
1580
|
-
geo.
|
|
1581
|
-
width / 2,
|
|
1582
|
-
0,
|
|
1583
|
-
depth / 2,
|
|
1584
|
-
// right back
|
|
1585
|
-
width / 2,
|
|
1586
|
-
0,
|
|
1587
|
-
-depth / 2,
|
|
1588
|
-
// right front
|
|
1589
|
-
-width / 2,
|
|
1590
|
-
0,
|
|
1591
|
-
-depth / 2,
|
|
1592
|
-
// left front
|
|
1593
|
-
-width / 2,
|
|
1594
|
-
0,
|
|
1595
|
-
depth / 2,
|
|
1596
|
-
// left back
|
|
1597
|
-
0,
|
|
1598
|
-
height,
|
|
1599
|
-
0
|
|
1600
|
-
// top
|
|
1601
|
-
], 3));
|
|
1602
|
-
geo.setIndex(new import_three10.Uint32BufferAttribute([
|
|
1603
|
-
1,
|
|
1604
|
-
0,
|
|
1605
|
-
4,
|
|
1606
|
-
2,
|
|
1607
|
-
1,
|
|
1608
|
-
4,
|
|
1609
|
-
3,
|
|
1610
|
-
2,
|
|
1611
|
-
4,
|
|
1612
|
-
3,
|
|
1613
|
-
0,
|
|
1614
|
-
4,
|
|
1615
|
-
0,
|
|
1616
|
-
1,
|
|
1617
|
-
2,
|
|
1618
|
-
0,
|
|
1619
|
-
2,
|
|
1620
|
-
3
|
|
1621
|
-
], 1));
|
|
1612
|
+
const geo = new import_three10.ConeGeometry(geometry.width / 2, geometry.height, 4, 1, true);
|
|
1613
|
+
geo.rotateY(Math.PI / 4);
|
|
1614
|
+
geo.translate(0, geometry.height / 2, 0);
|
|
1622
1615
|
return geo;
|
|
1623
1616
|
}
|
|
1624
1617
|
createBoxGeometry(geometry) {
|
|
1625
|
-
|
|
1618
|
+
const geo = new import_three10.BoxGeometry(geometry.width, geometry.height, geometry.depth);
|
|
1619
|
+
geo.translate(0, geometry.height / 2, 0);
|
|
1620
|
+
return geo;
|
|
1626
1621
|
}
|
|
1627
1622
|
createConeGeometry(geometry) {
|
|
1628
|
-
|
|
1623
|
+
const geo = new import_three10.ConeGeometry(geometry.width / 2, geometry.height, 256);
|
|
1624
|
+
geo.translate(0, geometry.height / 2, 0);
|
|
1625
|
+
return geo;
|
|
1629
1626
|
}
|
|
1630
1627
|
createWallGeometry(geometry) {
|
|
1631
|
-
|
|
1628
|
+
const geo = new import_three10.BoxGeometry(geometry.width, geometry.height, geometry.depth || 0.05, 16);
|
|
1629
|
+
geo.translate(0, geometry.height / 2, 0);
|
|
1630
|
+
return geo;
|
|
1632
1631
|
}
|
|
1633
1632
|
createPlaneGeometry(geometry) {
|
|
1634
|
-
|
|
1633
|
+
const geo = new import_three10.BoxGeometry(geometry.width, geometry.height, geometry.depth);
|
|
1634
|
+
geo.translate(0, geometry.height / 2, 0);
|
|
1635
|
+
return geo;
|
|
1635
1636
|
}
|
|
1636
1637
|
};
|
|
1637
1638
|
|