@shopware-ag/dive 1.8.0 → 1.9.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 +316 -28
- package/build/dive.cjs.map +1 -1
- package/build/dive.d.cts +25 -4
- package/build/dive.d.ts +25 -4
- package/build/dive.js +308 -20
- package/build/dive.js.map +1 -1
- package/package.json +1 -1
- package/src/com/index.ts +0 -1
- package/src/com/types.ts +26 -3
- package/src/mediacreator/__test__/MediaCreator.test.ts +1 -1
- package/src/primitive/Primitive.ts +210 -0
- package/src/primitive/__test__/Primitive.test.ts +434 -0
- package/src/scene/__test__/Scene.test.ts +2 -2
- package/src/scene/root/Root.ts +44 -3
- package/src/scene/root/__test__/Root.test.ts +71 -27
- package/src/scene/root/lightroot/__test__/LightRoot.test.ts +2 -3
- package/src/scene/root/primitiveroot/PrimitiveRoot.ts +88 -0
- package/src/scene/root/primitiveroot/__test__/PrimitiveRoot.test.ts +181 -0
package/build/dive.cjs
CHANGED
|
@@ -671,10 +671,10 @@ var DIVERenderer = class extends import_three.WebGLRenderer {
|
|
|
671
671
|
};
|
|
672
672
|
|
|
673
673
|
// src/scene/Scene.ts
|
|
674
|
-
var
|
|
674
|
+
var import_three15 = require("three");
|
|
675
675
|
|
|
676
676
|
// src/scene/root/Root.ts
|
|
677
|
-
var
|
|
677
|
+
var import_three14 = require("three");
|
|
678
678
|
|
|
679
679
|
// src/scene/root/lightroot/LightRoot.ts
|
|
680
680
|
var import_three7 = require("three");
|
|
@@ -1410,12 +1410,265 @@ var DIVEModelRoot = class extends import_three9.Object3D {
|
|
|
1410
1410
|
}
|
|
1411
1411
|
};
|
|
1412
1412
|
|
|
1413
|
-
// src/
|
|
1413
|
+
// src/scene/root/primitiveroot/PrimitiveRoot.ts
|
|
1414
|
+
var import_three11 = require("three");
|
|
1415
|
+
|
|
1416
|
+
// src/primitive/Primitive.ts
|
|
1414
1417
|
var import_three10 = require("three");
|
|
1415
1418
|
init_VisibilityLayerMask();
|
|
1416
|
-
var
|
|
1419
|
+
var DIVEPrimitive = class extends import_three10.Object3D {
|
|
1420
|
+
constructor() {
|
|
1421
|
+
super();
|
|
1422
|
+
this.isSelectable = true;
|
|
1423
|
+
this.isMoveable = true;
|
|
1424
|
+
this.gizmo = null;
|
|
1425
|
+
this.layers.mask = PRODUCT_LAYER_MASK;
|
|
1426
|
+
this._mesh = new import_three10.Mesh();
|
|
1427
|
+
this._mesh.layers.mask = PRODUCT_LAYER_MASK;
|
|
1428
|
+
this._mesh.castShadow = true;
|
|
1429
|
+
this._mesh.receiveShadow = true;
|
|
1430
|
+
this.add(this._mesh);
|
|
1431
|
+
this._boundingBox = new import_three10.Box3();
|
|
1432
|
+
}
|
|
1433
|
+
SetGeometry(geometry) {
|
|
1434
|
+
this.clear();
|
|
1435
|
+
this._mesh.geometry = this.assembleGeometry(geometry);
|
|
1436
|
+
this._boundingBox.setFromObject(this._mesh);
|
|
1437
|
+
}
|
|
1438
|
+
SetPosition(position) {
|
|
1439
|
+
this.position.set(position.x, position.y, position.z);
|
|
1440
|
+
}
|
|
1441
|
+
SetRotation(rotation) {
|
|
1442
|
+
this.rotation.setFromVector3(new import_three10.Vector3(rotation.x, rotation.y, rotation.z));
|
|
1443
|
+
}
|
|
1444
|
+
SetScale(scale) {
|
|
1445
|
+
this.scale.set(scale.x, scale.y, scale.z);
|
|
1446
|
+
}
|
|
1447
|
+
SetVisibility(visible) {
|
|
1448
|
+
this.traverse((child) => {
|
|
1449
|
+
child.visible = visible;
|
|
1450
|
+
});
|
|
1451
|
+
}
|
|
1452
|
+
SetMaterial(material) {
|
|
1453
|
+
const primitiveMaterial = this._mesh.material;
|
|
1454
|
+
primitiveMaterial.color = new import_three10.Color(material.color);
|
|
1455
|
+
if (material.roughnessMap) {
|
|
1456
|
+
primitiveMaterial.roughnessMap = material.roughnessMap;
|
|
1457
|
+
primitiveMaterial.roughness = 1;
|
|
1458
|
+
} else {
|
|
1459
|
+
primitiveMaterial.roughness = material.roughness;
|
|
1460
|
+
}
|
|
1461
|
+
if (material.metalnessMap) {
|
|
1462
|
+
primitiveMaterial.metalnessMap = material.metalnessMap;
|
|
1463
|
+
primitiveMaterial.metalness = 0;
|
|
1464
|
+
} else {
|
|
1465
|
+
primitiveMaterial.metalness = material.metalness;
|
|
1466
|
+
}
|
|
1467
|
+
}
|
|
1468
|
+
SetToWorldOrigin() {
|
|
1469
|
+
var _a;
|
|
1470
|
+
this.position.set(0, 0, 0);
|
|
1471
|
+
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction("UPDATE_OBJECT", { id: this.userData.id, position: this.position, rotation: this.rotation, scale: this.scale });
|
|
1472
|
+
}
|
|
1473
|
+
PlaceOnFloor() {
|
|
1474
|
+
var _a;
|
|
1475
|
+
this.position.y = -this._boundingBox.min.y * this.scale.y;
|
|
1476
|
+
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction("UPDATE_OBJECT", { id: this.userData.id, position: this.position, rotation: this.rotation, scale: this.scale });
|
|
1477
|
+
}
|
|
1478
|
+
DropIt() {
|
|
1479
|
+
var _a;
|
|
1480
|
+
if (!this.parent) {
|
|
1481
|
+
console.warn("DIVEModel: DropIt() called on a model that is not in the scene.", this);
|
|
1482
|
+
return;
|
|
1483
|
+
}
|
|
1484
|
+
const bottomY = this._boundingBox.min.y * this.scale.y;
|
|
1485
|
+
const bbBottomCenter = this.localToWorld(this._boundingBox.getCenter(new import_three10.Vector3()).multiply(this.scale));
|
|
1486
|
+
bbBottomCenter.y = bottomY + this.position.y;
|
|
1487
|
+
const raycaster = new import_three10.Raycaster(bbBottomCenter, new import_three10.Vector3(0, -1, 0));
|
|
1488
|
+
raycaster.layers.mask = PRODUCT_LAYER_MASK;
|
|
1489
|
+
const intersections = raycaster.intersectObjects(findSceneRecursive(this).Root.children, true);
|
|
1490
|
+
if (intersections.length > 0) {
|
|
1491
|
+
const mesh = intersections[0].object;
|
|
1492
|
+
mesh.geometry.computeBoundingBox();
|
|
1493
|
+
const meshBB = mesh.geometry.boundingBox;
|
|
1494
|
+
const worldPos = mesh.localToWorld(meshBB.max.clone());
|
|
1495
|
+
const oldPos = this.position.clone();
|
|
1496
|
+
const newPos = this.position.clone().setY(worldPos.y).sub(new import_three10.Vector3(0, bottomY, 0));
|
|
1497
|
+
this.position.copy(newPos);
|
|
1498
|
+
if (this.position.y === oldPos.y) return;
|
|
1499
|
+
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction("UPDATE_OBJECT", { id: this.userData.id, position: this.position, rotation: this.rotation, scale: this.scale });
|
|
1500
|
+
}
|
|
1501
|
+
}
|
|
1502
|
+
onMove() {
|
|
1503
|
+
var _a;
|
|
1504
|
+
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction("UPDATE_OBJECT", { id: this.userData.id, position: this.position, rotation: this.rotation, scale: this.scale });
|
|
1505
|
+
}
|
|
1506
|
+
onSelect() {
|
|
1507
|
+
var _a;
|
|
1508
|
+
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction("SELECT_OBJECT", { id: this.userData.id });
|
|
1509
|
+
}
|
|
1510
|
+
onDeselect() {
|
|
1511
|
+
var _a;
|
|
1512
|
+
(_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction("DESELECT_OBJECT", { id: this.userData.id });
|
|
1513
|
+
}
|
|
1514
|
+
assembleGeometry(geometry) {
|
|
1515
|
+
switch (geometry.name) {
|
|
1516
|
+
case "cylinder":
|
|
1517
|
+
return this.createCylinderGeometry(geometry);
|
|
1518
|
+
case "sphere":
|
|
1519
|
+
return this.createSphereGeometry(geometry);
|
|
1520
|
+
case "pyramid":
|
|
1521
|
+
return this.createPyramidGeometry(geometry);
|
|
1522
|
+
case "box":
|
|
1523
|
+
return this.createBoxGeometry(geometry);
|
|
1524
|
+
case "cone":
|
|
1525
|
+
return this.createConeGeometry(geometry);
|
|
1526
|
+
case "wall":
|
|
1527
|
+
return this.createWallGeometry(geometry);
|
|
1528
|
+
case "plane":
|
|
1529
|
+
return this.createPlaneGeometry(geometry);
|
|
1530
|
+
default:
|
|
1531
|
+
return new import_three10.BufferGeometry();
|
|
1532
|
+
}
|
|
1533
|
+
}
|
|
1534
|
+
createCylinderGeometry(geometry) {
|
|
1535
|
+
return new import_three10.CylinderGeometry(geometry.width * 2, geometry.width * 2, geometry.height, 64);
|
|
1536
|
+
}
|
|
1537
|
+
createSphereGeometry(geometry) {
|
|
1538
|
+
return new import_three10.SphereGeometry(geometry.width * 2, 64);
|
|
1539
|
+
}
|
|
1540
|
+
createPyramidGeometry(geometry) {
|
|
1541
|
+
const geo = new import_three10.BufferGeometry();
|
|
1542
|
+
const { width, height, depth } = geometry;
|
|
1543
|
+
geo.setAttribute("position", new import_three10.Float32BufferAttribute([
|
|
1544
|
+
width / 2,
|
|
1545
|
+
0,
|
|
1546
|
+
depth / 2,
|
|
1547
|
+
// right back
|
|
1548
|
+
width / 2,
|
|
1549
|
+
0,
|
|
1550
|
+
-depth / 2,
|
|
1551
|
+
// right front
|
|
1552
|
+
-width / 2,
|
|
1553
|
+
0,
|
|
1554
|
+
-depth / 2,
|
|
1555
|
+
// left front
|
|
1556
|
+
-width / 2,
|
|
1557
|
+
0,
|
|
1558
|
+
depth / 2,
|
|
1559
|
+
// left back
|
|
1560
|
+
0,
|
|
1561
|
+
height,
|
|
1562
|
+
0
|
|
1563
|
+
// top
|
|
1564
|
+
], 3));
|
|
1565
|
+
geo.setIndex(new import_three10.Uint32BufferAttribute([
|
|
1566
|
+
1,
|
|
1567
|
+
0,
|
|
1568
|
+
4,
|
|
1569
|
+
2,
|
|
1570
|
+
1,
|
|
1571
|
+
4,
|
|
1572
|
+
3,
|
|
1573
|
+
2,
|
|
1574
|
+
4,
|
|
1575
|
+
3,
|
|
1576
|
+
0,
|
|
1577
|
+
4,
|
|
1578
|
+
0,
|
|
1579
|
+
1,
|
|
1580
|
+
2,
|
|
1581
|
+
0,
|
|
1582
|
+
2,
|
|
1583
|
+
3
|
|
1584
|
+
], 1));
|
|
1585
|
+
return geo;
|
|
1586
|
+
}
|
|
1587
|
+
createBoxGeometry(geometry) {
|
|
1588
|
+
return new import_three10.BoxGeometry(geometry.width, geometry.height, geometry.depth);
|
|
1589
|
+
}
|
|
1590
|
+
createConeGeometry(geometry) {
|
|
1591
|
+
return new import_three10.CylinderGeometry(0, geometry.width * 2, geometry.height, 64);
|
|
1592
|
+
}
|
|
1593
|
+
createWallGeometry(geometry) {
|
|
1594
|
+
return new import_three10.BoxGeometry(geometry.width, geometry.height, geometry.depth, 16);
|
|
1595
|
+
}
|
|
1596
|
+
createPlaneGeometry(geometry) {
|
|
1597
|
+
return new import_three10.BoxGeometry(geometry.width, geometry.height, geometry.depth);
|
|
1598
|
+
}
|
|
1599
|
+
};
|
|
1600
|
+
|
|
1601
|
+
// src/scene/root/primitiveroot/PrimitiveRoot.ts
|
|
1602
|
+
var DIVEPrimitiveRoot = class extends import_three11.Object3D {
|
|
1603
|
+
constructor() {
|
|
1604
|
+
super();
|
|
1605
|
+
this.name = "PrimitiveRoot";
|
|
1606
|
+
}
|
|
1607
|
+
GetPrimitive(object) {
|
|
1608
|
+
if (object.id === void 0) {
|
|
1609
|
+
console.warn("PrimitiveRoot.GetPrimitive: object.id is undefined");
|
|
1610
|
+
return void 0;
|
|
1611
|
+
}
|
|
1612
|
+
return this.children.find((object3D) => object3D.userData.id === object.id);
|
|
1613
|
+
}
|
|
1614
|
+
UpdatePrimitive(object) {
|
|
1615
|
+
if (object.id === void 0) {
|
|
1616
|
+
console.warn("PrimitiveRoot.UpdatePrimitive: object.id is undefined");
|
|
1617
|
+
return;
|
|
1618
|
+
}
|
|
1619
|
+
let sceneObject = this.children.find((object3D) => object3D.userData.id === object.id);
|
|
1620
|
+
if (!sceneObject && object.geometry !== void 0) {
|
|
1621
|
+
const primitive = new DIVEPrimitive();
|
|
1622
|
+
primitive.SetGeometry(object.geometry);
|
|
1623
|
+
sceneObject = primitive;
|
|
1624
|
+
sceneObject.userData.id = object.id;
|
|
1625
|
+
this.add(sceneObject);
|
|
1626
|
+
}
|
|
1627
|
+
if (object.position !== void 0) sceneObject.SetPosition(object.position);
|
|
1628
|
+
if (object.rotation !== void 0) sceneObject.SetRotation(object.rotation);
|
|
1629
|
+
if (object.scale !== void 0) sceneObject.SetScale(object.scale);
|
|
1630
|
+
if (object.visible !== void 0) sceneObject.SetVisibility(object.visible);
|
|
1631
|
+
if (object.material !== void 0) sceneObject.SetMaterial(object.material);
|
|
1632
|
+
}
|
|
1633
|
+
DeletePrimitive(object) {
|
|
1634
|
+
if (object.id === void 0) {
|
|
1635
|
+
console.warn(`PrimitiveRoot.DeletePrimitive: object.id is undefined`);
|
|
1636
|
+
return;
|
|
1637
|
+
}
|
|
1638
|
+
const sceneObject = this.children.find((object3D) => object3D.userData.id === object.id);
|
|
1639
|
+
if (!sceneObject) {
|
|
1640
|
+
console.warn(`PrimitiveRoot.DeletePrimitive: Primitive with id ${object.id} not found`);
|
|
1641
|
+
return;
|
|
1642
|
+
}
|
|
1643
|
+
const findScene = (object2) => {
|
|
1644
|
+
if (object2.parent !== null) {
|
|
1645
|
+
return findScene(object2.parent);
|
|
1646
|
+
}
|
|
1647
|
+
;
|
|
1648
|
+
return object2;
|
|
1649
|
+
};
|
|
1650
|
+
const scene = findScene(sceneObject);
|
|
1651
|
+
scene.children.find((object2) => {
|
|
1652
|
+
if ("isTransformControls" in object2) {
|
|
1653
|
+
object2.detach();
|
|
1654
|
+
}
|
|
1655
|
+
});
|
|
1656
|
+
this.remove(sceneObject);
|
|
1657
|
+
}
|
|
1658
|
+
PlaceOnFloor(object) {
|
|
1659
|
+
if (object.id === void 0) console.warn("PrimitiveRoot.PlaceOnFloor: object.id is undefined");
|
|
1660
|
+
const sceneObject = this.children.find((object3D) => object3D.userData.id === object.id);
|
|
1661
|
+
if (!sceneObject) return;
|
|
1662
|
+
sceneObject.PlaceOnFloor();
|
|
1663
|
+
}
|
|
1664
|
+
};
|
|
1665
|
+
|
|
1666
|
+
// src/primitive/floor/Floor.ts
|
|
1667
|
+
var import_three12 = require("three");
|
|
1668
|
+
init_VisibilityLayerMask();
|
|
1669
|
+
var DIVEFloor = class extends import_three12.Mesh {
|
|
1417
1670
|
constructor() {
|
|
1418
|
-
super(new
|
|
1671
|
+
super(new import_three12.PlaneGeometry(1e4, 1e4), new import_three12.MeshStandardMaterial({ color: new import_three12.Color(150 / 255, 150 / 255, 150 / 255) }));
|
|
1419
1672
|
this.isFloor = true;
|
|
1420
1673
|
this.name = "Floor";
|
|
1421
1674
|
this.layers.mask = PRODUCT_LAYER_MASK;
|
|
@@ -1426,7 +1679,7 @@ var DIVEFloor = class extends import_three10.Mesh {
|
|
|
1426
1679
|
this.visible = visible;
|
|
1427
1680
|
}
|
|
1428
1681
|
SetColor(color) {
|
|
1429
|
-
this.material.color = new
|
|
1682
|
+
this.material.color = new import_three12.Color(color);
|
|
1430
1683
|
}
|
|
1431
1684
|
};
|
|
1432
1685
|
|
|
@@ -1436,12 +1689,12 @@ var GRID_SIDE_LINE_COLOR = "#dddddd";
|
|
|
1436
1689
|
|
|
1437
1690
|
// src/grid/Grid.ts
|
|
1438
1691
|
init_VisibilityLayerMask();
|
|
1439
|
-
var
|
|
1440
|
-
var DIVEGrid = class extends
|
|
1692
|
+
var import_three13 = require("three");
|
|
1693
|
+
var DIVEGrid = class extends import_three13.Object3D {
|
|
1441
1694
|
constructor() {
|
|
1442
1695
|
super();
|
|
1443
1696
|
this.name = "Grid";
|
|
1444
|
-
const grid = new
|
|
1697
|
+
const grid = new import_three13.GridHelper(100, 100, GRID_CENTER_LINE_COLOR, GRID_SIDE_LINE_COLOR);
|
|
1445
1698
|
grid.material.depthTest = false;
|
|
1446
1699
|
grid.layers.mask = HELPER_LAYER_MASK;
|
|
1447
1700
|
this.add(grid);
|
|
@@ -1452,7 +1705,7 @@ var DIVEGrid = class extends import_three11.Object3D {
|
|
|
1452
1705
|
};
|
|
1453
1706
|
|
|
1454
1707
|
// src/scene/root/Root.ts
|
|
1455
|
-
var DIVERoot = class extends
|
|
1708
|
+
var DIVERoot = class extends import_three14.Object3D {
|
|
1456
1709
|
get Floor() {
|
|
1457
1710
|
return this.floor;
|
|
1458
1711
|
}
|
|
@@ -1466,18 +1719,25 @@ var DIVERoot = class extends import_three12.Object3D {
|
|
|
1466
1719
|
this.add(this.lightRoot);
|
|
1467
1720
|
this.modelRoot = new DIVEModelRoot();
|
|
1468
1721
|
this.add(this.modelRoot);
|
|
1722
|
+
this.primitiveRoot = new DIVEPrimitiveRoot();
|
|
1723
|
+
this.add(this.primitiveRoot);
|
|
1469
1724
|
this.floor = new DIVEFloor();
|
|
1470
1725
|
this.add(this.floor);
|
|
1471
1726
|
this.grid = new DIVEGrid();
|
|
1472
1727
|
this.add(this.grid);
|
|
1473
1728
|
}
|
|
1474
1729
|
ComputeSceneBB() {
|
|
1475
|
-
const bb = new
|
|
1730
|
+
const bb = new import_three14.Box3();
|
|
1476
1731
|
this.modelRoot.traverse((object) => {
|
|
1477
1732
|
if ("isObject3D" in object) {
|
|
1478
1733
|
bb.expandByObject(object);
|
|
1479
1734
|
}
|
|
1480
1735
|
});
|
|
1736
|
+
this.primitiveRoot.traverse((object) => {
|
|
1737
|
+
if ("isObject3D" in object) {
|
|
1738
|
+
bb.expandByObject(object);
|
|
1739
|
+
}
|
|
1740
|
+
});
|
|
1481
1741
|
return bb;
|
|
1482
1742
|
}
|
|
1483
1743
|
GetSceneObject(object) {
|
|
@@ -1491,6 +1751,9 @@ var DIVERoot = class extends import_three12.Object3D {
|
|
|
1491
1751
|
case "model": {
|
|
1492
1752
|
return this.modelRoot.GetModel(object);
|
|
1493
1753
|
}
|
|
1754
|
+
case "primitive": {
|
|
1755
|
+
return this.primitiveRoot.GetPrimitive(object);
|
|
1756
|
+
}
|
|
1494
1757
|
}
|
|
1495
1758
|
}
|
|
1496
1759
|
AddSceneObject(object) {
|
|
@@ -1506,6 +1769,10 @@ var DIVERoot = class extends import_three12.Object3D {
|
|
|
1506
1769
|
this.modelRoot.UpdateModel(object);
|
|
1507
1770
|
break;
|
|
1508
1771
|
}
|
|
1772
|
+
case "primitive": {
|
|
1773
|
+
this.primitiveRoot.UpdatePrimitive(object);
|
|
1774
|
+
break;
|
|
1775
|
+
}
|
|
1509
1776
|
}
|
|
1510
1777
|
}
|
|
1511
1778
|
UpdateSceneObject(object) {
|
|
@@ -1521,6 +1788,10 @@ var DIVERoot = class extends import_three12.Object3D {
|
|
|
1521
1788
|
this.modelRoot.UpdateModel(object);
|
|
1522
1789
|
break;
|
|
1523
1790
|
}
|
|
1791
|
+
case "primitive": {
|
|
1792
|
+
this.primitiveRoot.UpdatePrimitive(object);
|
|
1793
|
+
break;
|
|
1794
|
+
}
|
|
1524
1795
|
}
|
|
1525
1796
|
}
|
|
1526
1797
|
DeleteSceneObject(object) {
|
|
@@ -1536,26 +1807,43 @@ var DIVERoot = class extends import_three12.Object3D {
|
|
|
1536
1807
|
this.modelRoot.DeleteModel(object);
|
|
1537
1808
|
break;
|
|
1538
1809
|
}
|
|
1810
|
+
case "primitive": {
|
|
1811
|
+
this.primitiveRoot.DeletePrimitive(object);
|
|
1812
|
+
break;
|
|
1813
|
+
}
|
|
1539
1814
|
}
|
|
1540
1815
|
}
|
|
1541
1816
|
PlaceOnFloor(object) {
|
|
1542
|
-
|
|
1817
|
+
switch (object.entityType) {
|
|
1818
|
+
case "pov":
|
|
1819
|
+
case "light": {
|
|
1820
|
+
break;
|
|
1821
|
+
}
|
|
1822
|
+
case "model": {
|
|
1823
|
+
this.modelRoot.PlaceOnFloor(object);
|
|
1824
|
+
break;
|
|
1825
|
+
}
|
|
1826
|
+
case "primitive": {
|
|
1827
|
+
this.primitiveRoot.PlaceOnFloor(object);
|
|
1828
|
+
break;
|
|
1829
|
+
}
|
|
1830
|
+
}
|
|
1543
1831
|
}
|
|
1544
1832
|
};
|
|
1545
1833
|
|
|
1546
1834
|
// src/scene/Scene.ts
|
|
1547
|
-
var DIVEScene = class extends
|
|
1835
|
+
var DIVEScene = class extends import_three15.Scene {
|
|
1548
1836
|
get Root() {
|
|
1549
1837
|
return this.root;
|
|
1550
1838
|
}
|
|
1551
1839
|
constructor() {
|
|
1552
1840
|
super();
|
|
1553
|
-
this.background = new
|
|
1841
|
+
this.background = new import_three15.Color(16777215);
|
|
1554
1842
|
this.root = new DIVERoot();
|
|
1555
1843
|
this.add(this.root);
|
|
1556
1844
|
}
|
|
1557
1845
|
SetBackground(color) {
|
|
1558
|
-
this.background = new
|
|
1846
|
+
this.background = new import_three15.Color(color);
|
|
1559
1847
|
}
|
|
1560
1848
|
ComputeSceneBB() {
|
|
1561
1849
|
return this.Root.ComputeSceneBB();
|
|
@@ -1582,7 +1870,7 @@ init_PerspectiveCamera();
|
|
|
1582
1870
|
|
|
1583
1871
|
// src/controls/OrbitControls.ts
|
|
1584
1872
|
var import_OrbitControls = require("three/examples/jsm/controls/OrbitControls");
|
|
1585
|
-
var
|
|
1873
|
+
var import_three16 = require("three");
|
|
1586
1874
|
var import_tween = require("@tweenjs/tween.js");
|
|
1587
1875
|
var DIVEOrbitControlsDefaultSettings = {
|
|
1588
1876
|
enableDamping: true,
|
|
@@ -1624,8 +1912,8 @@ var _DIVEOrbitControls = class _DIVEOrbitControls extends import_OrbitControls.O
|
|
|
1624
1912
|
this.dispose();
|
|
1625
1913
|
}
|
|
1626
1914
|
ComputeEncompassingView(bb) {
|
|
1627
|
-
const center = bb.getCenter(new
|
|
1628
|
-
const size = bb.getSize(new
|
|
1915
|
+
const center = bb.getCenter(new import_three16.Vector3());
|
|
1916
|
+
const size = bb.getSize(new import_three16.Vector3());
|
|
1629
1917
|
const distance = Math.max(size.x, size.y, size.z) * 1.25;
|
|
1630
1918
|
const direction = this.object.position.clone().normalize();
|
|
1631
1919
|
return {
|
|
@@ -1636,7 +1924,7 @@ var _DIVEOrbitControls = class _DIVEOrbitControls extends import_OrbitControls.O
|
|
|
1636
1924
|
ZoomIn(by) {
|
|
1637
1925
|
const zoomBy = by || _DIVEOrbitControls.DEFAULT_ZOOM_FACTOR;
|
|
1638
1926
|
const { minDistance, maxDistance } = this;
|
|
1639
|
-
this.minDistance = this.maxDistance =
|
|
1927
|
+
this.minDistance = this.maxDistance = import_three16.MathUtils.clamp(this.getDistance() - zoomBy, minDistance + zoomBy, maxDistance - zoomBy);
|
|
1640
1928
|
this.update();
|
|
1641
1929
|
this.minDistance = minDistance;
|
|
1642
1930
|
this.maxDistance = maxDistance;
|
|
@@ -1644,7 +1932,7 @@ var _DIVEOrbitControls = class _DIVEOrbitControls extends import_OrbitControls.O
|
|
|
1644
1932
|
ZoomOut(by) {
|
|
1645
1933
|
const zoomBy = by || _DIVEOrbitControls.DEFAULT_ZOOM_FACTOR;
|
|
1646
1934
|
const { minDistance, maxDistance } = this;
|
|
1647
|
-
this.minDistance = this.maxDistance =
|
|
1935
|
+
this.minDistance = this.maxDistance = import_three16.MathUtils.clamp(this.getDistance() + zoomBy, minDistance + zoomBy, maxDistance - zoomBy);
|
|
1648
1936
|
this.update();
|
|
1649
1937
|
this.minDistance = minDistance;
|
|
1650
1938
|
this.maxDistance = maxDistance;
|
|
@@ -1792,7 +2080,7 @@ var DIVEAnimationSystem = class {
|
|
|
1792
2080
|
};
|
|
1793
2081
|
|
|
1794
2082
|
// src/axiscamera/AxisCamera.ts
|
|
1795
|
-
var
|
|
2083
|
+
var import_three17 = require("three");
|
|
1796
2084
|
var import_three_spritetext = __toESM(require("three-spritetext"), 1);
|
|
1797
2085
|
init_VisibilityLayerMask();
|
|
1798
2086
|
|
|
@@ -1805,18 +2093,18 @@ var AxesColorGreen = AxesColorGreenLetter;
|
|
|
1805
2093
|
var AxesColorBlue = AxesColorBlueLetter;
|
|
1806
2094
|
|
|
1807
2095
|
// src/axiscamera/AxisCamera.ts
|
|
1808
|
-
var DIVEAxisCamera = class extends
|
|
2096
|
+
var DIVEAxisCamera = class extends import_three17.OrthographicCamera {
|
|
1809
2097
|
constructor(renderer, scene, controls) {
|
|
1810
2098
|
super(-1, 1, 1, -1, 0.1, 100);
|
|
1811
2099
|
this.layers.mask = COORDINATE_LAYER_MASK;
|
|
1812
|
-
this.axesHelper = new
|
|
2100
|
+
this.axesHelper = new import_three17.AxesHelper(0.5);
|
|
1813
2101
|
this.axesHelper.layers.mask = COORDINATE_LAYER_MASK;
|
|
1814
2102
|
this.axesHelper.material.depthTest = false;
|
|
1815
2103
|
this.axesHelper.position.set(0, 0, -1);
|
|
1816
2104
|
this.axesHelper.setColors(
|
|
1817
|
-
new
|
|
1818
|
-
new
|
|
1819
|
-
new
|
|
2105
|
+
new import_three17.Color(AxesColorRed),
|
|
2106
|
+
new import_three17.Color(AxesColorGreen),
|
|
2107
|
+
new import_three17.Color(AxesColorBlue)
|
|
1820
2108
|
);
|
|
1821
2109
|
const x = new import_three_spritetext.default("X", 0.2, AxesColorRedLetter);
|
|
1822
2110
|
const y = new import_three_spritetext.default("Y", 0.2, AxesColorGreenLetter);
|
|
@@ -1834,7 +2122,7 @@ var DIVEAxisCamera = class extends import_three15.OrthographicCamera {
|
|
|
1834
2122
|
this._renderer = renderer;
|
|
1835
2123
|
this._scene = scene;
|
|
1836
2124
|
this._scene.add(this);
|
|
1837
|
-
const restoreViewport = new
|
|
2125
|
+
const restoreViewport = new import_three17.Vector4();
|
|
1838
2126
|
this._renderCallbackId = renderer.AddPostRenderCallback(() => {
|
|
1839
2127
|
const restoreBackground = scene.background;
|
|
1840
2128
|
scene.background = null;
|
|
@@ -1853,7 +2141,7 @@ var DIVEAxisCamera = class extends import_three15.OrthographicCamera {
|
|
|
1853
2141
|
this._scene.remove(this);
|
|
1854
2142
|
}
|
|
1855
2143
|
SetFromCameraMatrix(matrix) {
|
|
1856
|
-
this.axesHelper.rotation.setFromRotationMatrix(new
|
|
2144
|
+
this.axesHelper.rotation.setFromRotationMatrix(new import_three17.Matrix4().extractRotation(matrix).invert());
|
|
1857
2145
|
}
|
|
1858
2146
|
};
|
|
1859
2147
|
|