@inweb/viewer-three 27.1.2 → 27.1.3
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/dist/extensions/components/RoomEnvironmentComponent.js +1 -0
- package/dist/extensions/components/RoomEnvironmentComponent.js.map +1 -1
- package/dist/extensions/components/RoomEnvironmentComponent.min.js +1 -1
- package/dist/extensions/loaders/GLTFCloudLoader.js.map +1 -1
- package/dist/extensions/loaders/GLTFFileLoader.js.map +1 -1
- package/dist/extensions/loaders/IFCXLoader.js.map +1 -1
- package/dist/viewer-three.js +1286 -673
- package/dist/viewer-three.js.map +1 -1
- package/dist/viewer-three.min.js +3 -3
- package/dist/viewer-three.module.js +45 -10
- package/dist/viewer-three.module.js.map +1 -1
- package/package.json +9 -9
- package/src/Viewer/loaders/DynamicGltfLoader/DynamicGltfLoader.js +63 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inweb/viewer-three",
|
|
3
|
-
"version": "27.1.
|
|
3
|
+
"version": "27.1.3",
|
|
4
4
|
"description": "JavaScript library for rendering CAD and BIM files in a browser using Three.js",
|
|
5
5
|
"homepage": "https://cloud.opendesign.com/docs/index.html",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -35,20 +35,20 @@
|
|
|
35
35
|
"docs": "typedoc"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@inweb/client": "~27.1.
|
|
39
|
-
"@inweb/eventemitter2": "~27.1.
|
|
40
|
-
"@inweb/markup": "~27.1.
|
|
41
|
-
"@inweb/viewer-core": "~27.1.
|
|
38
|
+
"@inweb/client": "~27.1.3",
|
|
39
|
+
"@inweb/eventemitter2": "~27.1.3",
|
|
40
|
+
"@inweb/markup": "~27.1.3",
|
|
41
|
+
"@inweb/viewer-core": "~27.1.3"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@streamparser/json": "^0.0.22",
|
|
45
|
-
"@types/three": "^0.
|
|
45
|
+
"@types/three": "^0.182.0",
|
|
46
46
|
"potree-core": "^2.0.11",
|
|
47
|
-
"three": "^0.
|
|
47
|
+
"three": "^0.182.0"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"@streamparser/json": "^0.0.22",
|
|
51
|
-
"@types/three": "^0.
|
|
52
|
-
"three": "^0.
|
|
51
|
+
"@types/three": "^0.182.0",
|
|
52
|
+
"three": "^0.182.0"
|
|
53
53
|
}
|
|
54
54
|
}
|
|
@@ -1004,19 +1004,19 @@ export class DynamicGltfLoader {
|
|
|
1004
1004
|
const transformedBox = node.geometryExtents.clone();
|
|
1005
1005
|
const structureRoot = node.structure ? this.structureRoots.get(node.structure.id) : null;
|
|
1006
1006
|
|
|
1007
|
+
// Calculate relative transformation from node.group to structureRoot
|
|
1008
|
+
// This matches the logic used in merge methods
|
|
1007
1009
|
if (node.group) {
|
|
1008
|
-
const
|
|
1009
|
-
let
|
|
1010
|
+
const relativeMatrix = new Matrix4();
|
|
1011
|
+
let currentObject = node.group;
|
|
1010
1012
|
|
|
1011
|
-
while (
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
}
|
|
1015
|
-
currentGroup = currentGroup.parent;
|
|
1013
|
+
while (currentObject && currentObject !== structureRoot) {
|
|
1014
|
+
relativeMatrix.premultiply(currentObject.matrix);
|
|
1015
|
+
currentObject = currentObject.parent;
|
|
1016
1016
|
}
|
|
1017
1017
|
|
|
1018
|
-
|
|
1019
|
-
transformedBox.applyMatrix4(
|
|
1018
|
+
if (!relativeMatrix.equals(new Matrix4())) {
|
|
1019
|
+
transformedBox.applyMatrix4(relativeMatrix);
|
|
1020
1020
|
}
|
|
1021
1021
|
}
|
|
1022
1022
|
|
|
@@ -1548,6 +1548,18 @@ export class DynamicGltfLoader {
|
|
|
1548
1548
|
for (const mesh of group.objects) {
|
|
1549
1549
|
const geometry = mesh.geometry.clone();
|
|
1550
1550
|
|
|
1551
|
+
const relativeMatrix = new Matrix4();
|
|
1552
|
+
let currentObject = mesh;
|
|
1553
|
+
|
|
1554
|
+
while (currentObject && currentObject !== rootGroup) {
|
|
1555
|
+
relativeMatrix.premultiply(currentObject.matrix);
|
|
1556
|
+
currentObject = currentObject.parent;
|
|
1557
|
+
}
|
|
1558
|
+
|
|
1559
|
+
if (!relativeMatrix.equals(new Matrix4())) {
|
|
1560
|
+
geometry.applyMatrix4(relativeMatrix);
|
|
1561
|
+
}
|
|
1562
|
+
|
|
1551
1563
|
const handle = mesh.userData.handle;
|
|
1552
1564
|
if (!this.objectIdToIndex.has(handle)) {
|
|
1553
1565
|
this.objectIdToIndex.set(handle, this.maxObjectId++);
|
|
@@ -1673,7 +1685,20 @@ export class DynamicGltfLoader {
|
|
|
1673
1685
|
let isEdge = false;
|
|
1674
1686
|
group.objects.forEach((line) => {
|
|
1675
1687
|
isEdge = line.userData.isEdge;
|
|
1676
|
-
const geometry = line.geometry;
|
|
1688
|
+
const geometry = line.geometry.clone();
|
|
1689
|
+
|
|
1690
|
+
const relativeMatrix = new Matrix4();
|
|
1691
|
+
let currentObject = line;
|
|
1692
|
+
|
|
1693
|
+
while (currentObject && currentObject !== rootGroup) {
|
|
1694
|
+
relativeMatrix.premultiply(currentObject.matrix);
|
|
1695
|
+
currentObject = currentObject.parent;
|
|
1696
|
+
}
|
|
1697
|
+
|
|
1698
|
+
if (!relativeMatrix.equals(new Matrix4())) {
|
|
1699
|
+
geometry.applyMatrix4(relativeMatrix);
|
|
1700
|
+
}
|
|
1701
|
+
|
|
1677
1702
|
const positionAttr = geometry.attributes.position;
|
|
1678
1703
|
const vertexCount = positionAttr.count;
|
|
1679
1704
|
|
|
@@ -1701,6 +1726,7 @@ export class DynamicGltfLoader {
|
|
|
1701
1726
|
}
|
|
1702
1727
|
|
|
1703
1728
|
vertexOffset += vertexCount;
|
|
1729
|
+
geometry.dispose();
|
|
1704
1730
|
});
|
|
1705
1731
|
|
|
1706
1732
|
const geometry = new BufferGeometry();
|
|
@@ -1787,6 +1813,20 @@ export class DynamicGltfLoader {
|
|
|
1787
1813
|
isEdge = line.userData.isEdge;
|
|
1788
1814
|
const geometry = line.geometry.clone();
|
|
1789
1815
|
|
|
1816
|
+
// Calculate transformation matrix relative to rootGroup
|
|
1817
|
+
const relativeMatrix = new Matrix4();
|
|
1818
|
+
let currentObject = line;
|
|
1819
|
+
|
|
1820
|
+
while (currentObject && currentObject !== rootGroup) {
|
|
1821
|
+
relativeMatrix.premultiply(currentObject.matrix);
|
|
1822
|
+
currentObject = currentObject.parent;
|
|
1823
|
+
}
|
|
1824
|
+
|
|
1825
|
+
// Apply the relative transformation
|
|
1826
|
+
if (!relativeMatrix.equals(new Matrix4())) {
|
|
1827
|
+
geometry.applyMatrix4(relativeMatrix);
|
|
1828
|
+
}
|
|
1829
|
+
|
|
1790
1830
|
const handle = line.userData.handle;
|
|
1791
1831
|
if (!this.objectIdToIndex.has(handle)) {
|
|
1792
1832
|
this.objectIdToIndex.set(handle, this.maxObjectId++);
|
|
@@ -1892,6 +1932,19 @@ export class DynamicGltfLoader {
|
|
|
1892
1932
|
|
|
1893
1933
|
for (const points of group.objects) {
|
|
1894
1934
|
const geometry = points.geometry.clone();
|
|
1935
|
+
|
|
1936
|
+
const relativeMatrix = new Matrix4();
|
|
1937
|
+
let currentObject = points;
|
|
1938
|
+
|
|
1939
|
+
while (currentObject && currentObject !== rootGroup) {
|
|
1940
|
+
relativeMatrix.premultiply(currentObject.matrix);
|
|
1941
|
+
currentObject = currentObject.parent;
|
|
1942
|
+
}
|
|
1943
|
+
|
|
1944
|
+
if (!relativeMatrix.equals(new Matrix4())) {
|
|
1945
|
+
geometry.applyMatrix4(relativeMatrix);
|
|
1946
|
+
}
|
|
1947
|
+
|
|
1895
1948
|
geometries.push(geometry);
|
|
1896
1949
|
optimizedObjects.push(points);
|
|
1897
1950
|
handles.add(points.userData.handle);
|