diff --git a/assets/models/xkt/v10/glb/archicad-demoprojekt.xkt b/assets/models/xkt/v10/glb/archicad-demoprojekt.xkt new file mode 100644 index 0000000000..d43b769712 Binary files /dev/null and b/assets/models/xkt/v10/glb/archicad-demoprojekt.xkt differ diff --git a/examples/BIMOffline_XKT_ArchiCADSamples_DemoProjekt.html b/examples/BIMOffline_XKT_ArchiCADSamples_DemoProjekt.html index 4919a4bbd4..5d7723e61b 100644 --- a/examples/BIMOffline_XKT_ArchiCADSamples_DemoProjekt.html +++ b/examples/BIMOffline_XKT_ArchiCADSamples_DemoProjekt.html @@ -218,7 +218,7 @@

Resources

const sceneModel = xktLoader.load({ id: "myModel", - src: "../assets/models/xkt/v10/glb/Archicad-Demoprojekt.glb.xkt", + src: "../assets/models/xkt/v10/glb/archicad-demoprojekt.xkt", excludeTypes: ["IfcSpace"], edges: true }); diff --git a/examples/index.html b/examples/index.html index 1ffaf73429..75e09f0381 100644 --- a/examples/index.html +++ b/examples/index.html @@ -278,6 +278,8 @@ ["BIMOffline_XKT_WaterLock", "Viewing a BIM model of a water lock"], ["BIMOffline_XKT_Federated_Clinic", "Viewing a federated BIM model"], + ["BIMOffline_XKT_ArchiCADSamples_DemoProjekt", "Viewing a BIM model exported from ArchiCAD"], + // "# IFC models converted using IFC2glTFConverter from Creoox", // // ["BIMOffline_XKT_IFC2glTFConverter_HolterTower", "Viewing an IFC4 BIM model"], diff --git a/src/plugins/XKTLoaderPlugin/parsers/ParserV10.js b/src/plugins/XKTLoaderPlugin/parsers/ParserV10.js index e32167c2ab..84e9136c9a 100644 --- a/src/plugins/XKTLoaderPlugin/parsers/ParserV10.js +++ b/src/plugins/XKTLoaderPlugin/parsers/ParserV10.js @@ -429,6 +429,12 @@ function load(viewer, options, inflatedData, sceneModel) { geometryArrays.geometryIndices = indices.subarray(eachGeometryIndicesPortion [geometryIndex], atLastGeometry ? indices.length : eachGeometryIndicesPortion [geometryIndex + 1]); geometryValid = (geometryArrays.geometryPositions.length > 0 && geometryArrays.geometryIndices.length > 0); break; + case 4: + geometryArrays.primitiveName = "line-strip"; + geometryArrays.geometryPositions = positions.subarray(eachGeometryPositionsPortion [geometryIndex], atLastGeometry ? positions.length : eachGeometryPositionsPortion [geometryIndex + 1]); + geometryArrays.geometryIndices = lineStripToLines(indices.subarray(eachGeometryIndicesPortion [geometryIndex], atLastGeometry ? indices.length : eachGeometryIndicesPortion [geometryIndex + 1])); + geometryValid = (geometryArrays.geometryPositions.length > 0 && geometryArrays.geometryIndices.length > 0); + break; default: continue; } @@ -578,6 +584,12 @@ function load(viewer, options, inflatedData, sceneModel) { geometryIndices = indices.subarray(eachGeometryIndicesPortion [geometryIndex], atLastGeometry ? indices.length : eachGeometryIndicesPortion [geometryIndex + 1]); geometryValid = (geometryPositions.length > 0 && geometryIndices.length > 0); break; + case 4: + primitiveName = "lines-strip"; + geometryPositions = positions.subarray(eachGeometryPositionsPortion [geometryIndex], atLastGeometry ? positions.length : eachGeometryPositionsPortion [geometryIndex + 1]); + geometryIndices = lineStripToLines(indices.subarray(eachGeometryIndicesPortion [geometryIndex], atLastGeometry ? indices.length : eachGeometryIndicesPortion [geometryIndex + 1])); + geometryValid = (geometryPositions.length > 0 && geometryIndices.length > 0); + break; default: continue; } @@ -619,6 +631,18 @@ function load(viewer, options, inflatedData, sceneModel) { } } +function lineStripToLines(lineStrip) { + if (lineStrip.length < 2) { + return lineStrip; + } + const lines = []; + for (let i = 0; i < lineStrip.length - 1; i++) { + lines.push(lineStrip[i]); + lines.push(lineStrip[i + 1]); + } + return lines; +} + /** @private */ const ParserV10 = { version: 10,