@xeokit/xeokit-sdk 2.4.0-alpha-64 → 2.4.0-alpha-65

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.
@@ -24756,7 +24756,7 @@ var isBase64=!!dataUriRegexResult[2];var data=dataUriRegexResult[3];data=window.
24756
24756
  DEPRECATED
24757
24757
 
24758
24758
  */var pako$9=window.pako||p;if(!pako$9.inflate){// See https://github.com/nodeca/pako/issues/97
24759
- pako$9=pako$9["default"];}var decompressColor$9=function(){var color2=new Float32Array(3);return function(color){color2[0]=color[0]/255.0;color2[1]=color[1]/255.0;color2[2]=color[2]/255.0;return color2;};}();function extract$9(elements){return{positions:elements[0],normals:elements[1],indices:elements[2],edgeIndices:elements[3],meshPositions:elements[4],meshIndices:elements[5],meshEdgesIndices:elements[6],meshColors:elements[7],entityIDs:elements[8],entityMeshes:elements[9],entityIsObjects:elements[10],positionsDecodeMatrix:elements[11]};}function inflate$9(deflatedData){return{positions:new Uint16Array(pako$9.inflate(deflatedData.positions).buffer),normals:new Int8Array(pako$9.inflate(deflatedData.normals).buffer),indices:new Uint32Array(pako$9.inflate(deflatedData.indices).buffer),edgeIndices:new Uint32Array(pako$9.inflate(deflatedData.edgeIndices).buffer),meshPositions:new Uint32Array(pako$9.inflate(deflatedData.meshPositions).buffer),meshIndices:new Uint32Array(pako$9.inflate(deflatedData.meshIndices).buffer),meshEdgesIndices:new Uint32Array(pako$9.inflate(deflatedData.meshEdgesIndices).buffer),meshColors:new Uint8Array(pako$9.inflate(deflatedData.meshColors).buffer),entityIDs:pako$9.inflate(deflatedData.entityIDs,{to:'string'}),entityMeshes:new Uint32Array(pako$9.inflate(deflatedData.entityMeshes).buffer),entityIsObjects:new Uint8Array(pako$9.inflate(deflatedData.entityIsObjects).buffer),positionsDecodeMatrix:new Float32Array(pako$9.inflate(deflatedData.positionsDecodeMatrix).buffer)};}function load$9(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx){sceneModel.positionsCompression="precompressed";sceneModel.normalsCompression="precompressed";var positions=inflatedData.positions;var normals=inflatedData.normals;var indices=inflatedData.indices;var edgeIndices=inflatedData.edgeIndices;var meshPositions=inflatedData.meshPositions;var meshIndices=inflatedData.meshIndices;var meshEdgesIndices=inflatedData.meshEdgesIndices;var meshColors=inflatedData.meshColors;var entityIDs=JSON.parse(inflatedData.entityIDs);var entityMeshes=inflatedData.entityMeshes;var entityIsObjects=inflatedData.entityIsObjects;var numMeshes=meshPositions.length;var numEntities=entityMeshes.length;for(var _i532=0;_i532<numEntities;_i532++){var xktEntityId=entityIDs[_i532];var entityId=options.globalizeObjectIds?math.globalizeObjectId(sceneModel.id,xktEntityId):xktEntityId;var metaObject=viewer.metaScene.metaObjects[entityId];var entityDefaults={};var meshDefaults={};if(metaObject){if(options.excludeTypesMap&&metaObject.type&&options.excludeTypesMap[metaObject.type]){continue;}if(options.includeTypesMap&&metaObject.type&&!options.includeTypesMap[metaObject.type]){continue;}var props=options.objectDefaults?options.objectDefaults[metaObject.type]||options.objectDefaults["DEFAULT"]:null;if(props){if(props.visible===false){entityDefaults.visible=false;}if(props.pickable===false){entityDefaults.pickable=false;}if(props.colorize){meshDefaults.color=props.colorize;}if(props.opacity!==undefined&&props.opacity!==null){meshDefaults.opacity=props.opacity;}}}else{if(options.excludeUnclassifiedObjects){continue;}}var lastEntity=_i532===numEntities-1;var meshIds=[];for(var j=entityMeshes[_i532],jlen=lastEntity?entityMeshes.length:entityMeshes[_i532+1];j<jlen;j++){var lastMesh=j===numMeshes-1;var meshId=entityId+".mesh."+j;var _color6=decompressColor$9(meshColors.subarray(j*4,j*4+3));var _opacity=meshColors[j*4+3]/255.0;sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,primitive:"triangles",positionsCompressed:positions.subarray(meshPositions[j],lastMesh?positions.length:meshPositions[j+1]),normalsCompressed:normals.subarray(meshPositions[j],lastMesh?positions.length:meshPositions[j+1]),indices:indices.subarray(meshIndices[j],lastMesh?indices.length:meshIndices[j+1]),edgeIndices:edgeIndices.subarray(meshEdgesIndices[j],lastMesh?edgeIndices.length:meshEdgesIndices[j+1]),positionsDecodeMatrix:inflatedData.positionsDecodeMatrix,color:_color6,opacity:_opacity}));meshIds.push(meshId);}sceneModel.createEntity(utils.apply(entityDefaults,{id:entityId,isObject:entityIsObjects[_i532]===1,meshIds:meshIds}));}}/** @private */var ParserV1={version:1,parse:function parse(viewer,options,elements,sceneModel,metaModel,manifestCtx){var deflatedData=extract$9(elements);var inflatedData=inflate$9(deflatedData);load$9(viewer,options,inflatedData,sceneModel);}};/*
24759
+ pako$9=pako$9["default"];}var decompressColor$9=function(){var color2=new Float32Array(3);return function(color){color2[0]=color[0]/255.0;color2[1]=color[1]/255.0;color2[2]=color[2]/255.0;return color2;};}();function extract$9(elements){return{positions:elements[0],normals:elements[1],indices:elements[2],edgeIndices:elements[3],meshPositions:elements[4],meshIndices:elements[5],meshEdgesIndices:elements[6],meshColors:elements[7],entityIDs:elements[8],entityMeshes:elements[9],entityIsObjects:elements[10],positionsDecodeMatrix:elements[11]};}function inflate$9(deflatedData){return{positions:new Uint16Array(pako$9.inflate(deflatedData.positions).buffer),normals:new Int8Array(pako$9.inflate(deflatedData.normals).buffer),indices:new Uint32Array(pako$9.inflate(deflatedData.indices).buffer),edgeIndices:new Uint32Array(pako$9.inflate(deflatedData.edgeIndices).buffer),meshPositions:new Uint32Array(pako$9.inflate(deflatedData.meshPositions).buffer),meshIndices:new Uint32Array(pako$9.inflate(deflatedData.meshIndices).buffer),meshEdgesIndices:new Uint32Array(pako$9.inflate(deflatedData.meshEdgesIndices).buffer),meshColors:new Uint8Array(pako$9.inflate(deflatedData.meshColors).buffer),entityIDs:pako$9.inflate(deflatedData.entityIDs,{to:'string'}),entityMeshes:new Uint32Array(pako$9.inflate(deflatedData.entityMeshes).buffer),entityIsObjects:new Uint8Array(pako$9.inflate(deflatedData.entityIsObjects).buffer),positionsDecodeMatrix:new Float32Array(pako$9.inflate(deflatedData.positionsDecodeMatrix).buffer)};}function load$9(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx){manifestCtx.getNextId();sceneModel.positionsCompression="precompressed";sceneModel.normalsCompression="precompressed";var positions=inflatedData.positions;var normals=inflatedData.normals;var indices=inflatedData.indices;var edgeIndices=inflatedData.edgeIndices;var meshPositions=inflatedData.meshPositions;var meshIndices=inflatedData.meshIndices;var meshEdgesIndices=inflatedData.meshEdgesIndices;var meshColors=inflatedData.meshColors;var entityIDs=JSON.parse(inflatedData.entityIDs);var entityMeshes=inflatedData.entityMeshes;var entityIsObjects=inflatedData.entityIsObjects;var numMeshes=meshPositions.length;var numEntities=entityMeshes.length;for(var _i532=0;_i532<numEntities;_i532++){var xktEntityId=entityIDs[_i532];var entityId=options.globalizeObjectIds?math.globalizeObjectId(sceneModel.id,xktEntityId):xktEntityId;var metaObject=viewer.metaScene.metaObjects[entityId];var entityDefaults={};var meshDefaults={};if(metaObject){if(options.excludeTypesMap&&metaObject.type&&options.excludeTypesMap[metaObject.type]){continue;}if(options.includeTypesMap&&metaObject.type&&!options.includeTypesMap[metaObject.type]){continue;}var props=options.objectDefaults?options.objectDefaults[metaObject.type]||options.objectDefaults["DEFAULT"]:null;if(props){if(props.visible===false){entityDefaults.visible=false;}if(props.pickable===false){entityDefaults.pickable=false;}if(props.colorize){meshDefaults.color=props.colorize;}if(props.opacity!==undefined&&props.opacity!==null){meshDefaults.opacity=props.opacity;}}}else{if(options.excludeUnclassifiedObjects){continue;}}var lastEntity=_i532===numEntities-1;var meshIds=[];for(var j=entityMeshes[_i532],jlen=lastEntity?entityMeshes.length:entityMeshes[_i532+1];j<jlen;j++){var lastMesh=j===numMeshes-1;var meshId=entityId+".mesh."+j;var _color6=decompressColor$9(meshColors.subarray(j*4,j*4+3));var _opacity=meshColors[j*4+3]/255.0;sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,primitive:"triangles",positionsCompressed:positions.subarray(meshPositions[j],lastMesh?positions.length:meshPositions[j+1]),normalsCompressed:normals.subarray(meshPositions[j],lastMesh?positions.length:meshPositions[j+1]),indices:indices.subarray(meshIndices[j],lastMesh?indices.length:meshIndices[j+1]),edgeIndices:edgeIndices.subarray(meshEdgesIndices[j],lastMesh?edgeIndices.length:meshEdgesIndices[j+1]),positionsDecodeMatrix:inflatedData.positionsDecodeMatrix,color:_color6,opacity:_opacity}));meshIds.push(meshId);}sceneModel.createEntity(utils.apply(entityDefaults,{id:entityId,isObject:entityIsObjects[_i532]===1,meshIds:meshIds}));}}/** @private */var ParserV1={version:1,parse:function parse(viewer,options,elements,sceneModel,metaModel,manifestCtx){var deflatedData=extract$9(elements);var inflatedData=inflate$9(deflatedData);load$9(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx);}};/*
24760
24760
 
24761
24761
  Parser for .XKT Format V2
24762
24762
 
@@ -24765,21 +24765,21 @@ DEPRECATED
24765
24765
  .XKT specifications: https://github.com/xeokit/xeokit-sdk/wiki/XKT-Format
24766
24766
 
24767
24767
  */var pako$8=window.pako||p;if(!pako$8.inflate){// See https://github.com/nodeca/pako/issues/97
24768
- pako$8=pako$8["default"];}function extract$8(elements){return{positions:elements[0],normals:elements[1],indices:elements[2],edgeIndices:elements[3],meshPositions:elements[4],meshIndices:elements[5],meshEdgesIndices:elements[6],meshColors:elements[7],entityIDs:elements[8],entityMeshes:elements[9],entityIsObjects:elements[10],positionsDecodeMatrix:elements[11],entityMeshIds:elements[12],entityMatrices:elements[13],entityUsesInstancing:elements[14]};}function inflate$8(deflatedData){return{positions:new Uint16Array(pako$8.inflate(deflatedData.positions).buffer),normals:new Int8Array(pako$8.inflate(deflatedData.normals).buffer),indices:new Uint32Array(pako$8.inflate(deflatedData.indices).buffer),edgeIndices:new Uint32Array(pako$8.inflate(deflatedData.edgeIndices).buffer),meshPositions:new Uint32Array(pako$8.inflate(deflatedData.meshPositions).buffer),meshIndices:new Uint32Array(pako$8.inflate(deflatedData.meshIndices).buffer),meshEdgesIndices:new Uint32Array(pako$8.inflate(deflatedData.meshEdgesIndices).buffer),meshColors:new Uint8Array(pako$8.inflate(deflatedData.meshColors).buffer),entityIDs:pako$8.inflate(deflatedData.entityIDs,{to:'string'}),entityMeshes:new Uint32Array(pako$8.inflate(deflatedData.entityMeshes).buffer),entityIsObjects:new Uint8Array(pako$8.inflate(deflatedData.entityIsObjects).buffer),positionsDecodeMatrix:new Float32Array(pako$8.inflate(deflatedData.positionsDecodeMatrix).buffer),entityMeshIds:new Uint32Array(pako$8.inflate(deflatedData.entityMeshIds).buffer),entityMatrices:new Float32Array(pako$8.inflate(deflatedData.entityMatrices).buffer),entityUsesInstancing:new Uint8Array(pako$8.inflate(deflatedData.entityUsesInstancing).buffer)};}var decompressColor$8=function(){var color2=new Float32Array(3);return function(color){color2[0]=color[0]/255.0;color2[1]=color[1]/255.0;color2[2]=color[2]/255.0;return color2;};}();function load$8(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx){sceneModel.positionsCompression="precompressed";sceneModel.normalsCompression="precompressed";var positions=inflatedData.positions;var normals=inflatedData.normals;var indices=inflatedData.indices;var edgeIndices=inflatedData.edgeIndices;var meshPositions=inflatedData.meshPositions;var meshIndices=inflatedData.meshIndices;var meshEdgesIndices=inflatedData.meshEdgesIndices;var meshColors=inflatedData.meshColors;var entityIDs=JSON.parse(inflatedData.entityIDs);var entityMeshes=inflatedData.entityMeshes;var entityIsObjects=inflatedData.entityIsObjects;var entityMeshIds=inflatedData.entityMeshIds;var entityMatrices=inflatedData.entityMatrices;var entityUsesInstancing=inflatedData.entityUsesInstancing;var numMeshes=meshPositions.length;var numEntities=entityMeshes.length;var alreadyCreatedGeometries={};for(var _i533=0;_i533<numEntities;_i533++){var xktEntityId=entityIDs[_i533];var entityId=options.globalizeObjectIds?math.globalizeObjectId(sceneModel.id,xktEntityId):xktEntityId;var metaObject=viewer.metaScene.metaObjects[entityId];var entityDefaults={};var meshDefaults={};var entityMatrix=entityMatrices.subarray(_i533*16,_i533*16+16);if(metaObject){if(options.excludeTypesMap&&metaObject.type&&options.excludeTypesMap[metaObject.type]){continue;}if(options.includeTypesMap&&metaObject.type&&!options.includeTypesMap[metaObject.type]){continue;}var props=options.objectDefaults?options.objectDefaults[metaObject.type]||options.objectDefaults["DEFAULT"]:null;if(props){if(props.visible===false){entityDefaults.visible=false;}if(props.pickable===false){entityDefaults.pickable=false;}if(props.colorize){meshDefaults.color=props.colorize;}if(props.opacity!==undefined&&props.opacity!==null){meshDefaults.opacity=props.opacity;}}}else{if(options.excludeUnclassifiedObjects){continue;}}var lastEntity=_i533===numEntities-1;var meshIds=[];for(var j=entityMeshes[_i533],jlen=lastEntity?entityMeshIds.length:entityMeshes[_i533+1];j<jlen;j++){var jj=entityMeshIds[j];var lastMesh=jj===numMeshes-1;var meshId=manifestCtx.nextMeshId++;var _color7=decompressColor$8(meshColors.subarray(jj*4,jj*4+3));var _opacity2=meshColors[jj*4+3]/255.0;var tmpPositions=positions.subarray(meshPositions[jj],lastMesh?positions.length:meshPositions[jj+1]);var tmpNormals=normals.subarray(meshPositions[jj],lastMesh?positions.length:meshPositions[jj+1]);var tmpIndices=indices.subarray(meshIndices[jj],lastMesh?indices.length:meshIndices[jj+1]);var tmpEdgeIndices=edgeIndices.subarray(meshEdgesIndices[jj],lastMesh?edgeIndices.length:meshEdgesIndices[jj+1]);if(entityUsesInstancing[_i533]===1){var geometryId="geometry."+jj;if(!(geometryId in alreadyCreatedGeometries)){sceneModel.createGeometry({id:geometryId,positionsCompressed:tmpPositions,normalsCompressed:tmpNormals,indices:tmpIndices,edgeIndices:tmpEdgeIndices,primitive:"triangles",positionsDecodeMatrix:inflatedData.positionsDecodeMatrix});alreadyCreatedGeometries[geometryId]=true;}sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,color:_color7,opacity:_opacity2,matrix:entityMatrix,geometryId:geometryId}));meshIds.push(meshId);}else{sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,primitive:"triangles",positionsCompressed:tmpPositions,normalsCompressed:tmpNormals,indices:tmpIndices,edgeIndices:tmpEdgeIndices,positionsDecodeMatrix:inflatedData.positionsDecodeMatrix,color:_color7,opacity:_opacity2}));meshIds.push(meshId);}}if(meshIds.length){sceneModel.createEntity(utils.apply(entityDefaults,{id:entityId,isObject:entityIsObjects[_i533]===1,meshIds:meshIds}));}}}/** @private */var ParserV2={version:2,parse:function parse(viewer,options,elements,sceneModel,metaModel,manifestCtx){var deflatedData=extract$8(elements);var inflatedData=inflate$8(deflatedData);load$8(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx);}};/*
24768
+ pako$8=pako$8["default"];}function extract$8(elements){return{positions:elements[0],normals:elements[1],indices:elements[2],edgeIndices:elements[3],meshPositions:elements[4],meshIndices:elements[5],meshEdgesIndices:elements[6],meshColors:elements[7],entityIDs:elements[8],entityMeshes:elements[9],entityIsObjects:elements[10],positionsDecodeMatrix:elements[11],entityMeshIds:elements[12],entityMatrices:elements[13],entityUsesInstancing:elements[14]};}function inflate$8(deflatedData){return{positions:new Uint16Array(pako$8.inflate(deflatedData.positions).buffer),normals:new Int8Array(pako$8.inflate(deflatedData.normals).buffer),indices:new Uint32Array(pako$8.inflate(deflatedData.indices).buffer),edgeIndices:new Uint32Array(pako$8.inflate(deflatedData.edgeIndices).buffer),meshPositions:new Uint32Array(pako$8.inflate(deflatedData.meshPositions).buffer),meshIndices:new Uint32Array(pako$8.inflate(deflatedData.meshIndices).buffer),meshEdgesIndices:new Uint32Array(pako$8.inflate(deflatedData.meshEdgesIndices).buffer),meshColors:new Uint8Array(pako$8.inflate(deflatedData.meshColors).buffer),entityIDs:pako$8.inflate(deflatedData.entityIDs,{to:'string'}),entityMeshes:new Uint32Array(pako$8.inflate(deflatedData.entityMeshes).buffer),entityIsObjects:new Uint8Array(pako$8.inflate(deflatedData.entityIsObjects).buffer),positionsDecodeMatrix:new Float32Array(pako$8.inflate(deflatedData.positionsDecodeMatrix).buffer),entityMeshIds:new Uint32Array(pako$8.inflate(deflatedData.entityMeshIds).buffer),entityMatrices:new Float32Array(pako$8.inflate(deflatedData.entityMatrices).buffer),entityUsesInstancing:new Uint8Array(pako$8.inflate(deflatedData.entityUsesInstancing).buffer)};}var decompressColor$8=function(){var color2=new Float32Array(3);return function(color){color2[0]=color[0]/255.0;color2[1]=color[1]/255.0;color2[2]=color[2]/255.0;return color2;};}();function load$8(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx){var modelPartId=manifestCtx.getNextId();sceneModel.positionsCompression="precompressed";sceneModel.normalsCompression="precompressed";var positions=inflatedData.positions;var normals=inflatedData.normals;var indices=inflatedData.indices;var edgeIndices=inflatedData.edgeIndices;var meshPositions=inflatedData.meshPositions;var meshIndices=inflatedData.meshIndices;var meshEdgesIndices=inflatedData.meshEdgesIndices;var meshColors=inflatedData.meshColors;var entityIDs=JSON.parse(inflatedData.entityIDs);var entityMeshes=inflatedData.entityMeshes;var entityIsObjects=inflatedData.entityIsObjects;var entityMeshIds=inflatedData.entityMeshIds;var entityMatrices=inflatedData.entityMatrices;var entityUsesInstancing=inflatedData.entityUsesInstancing;var numMeshes=meshPositions.length;var numEntities=entityMeshes.length;var alreadyCreatedGeometries={};for(var _i533=0;_i533<numEntities;_i533++){var xktEntityId=entityIDs[_i533];var entityId=options.globalizeObjectIds?math.globalizeObjectId(sceneModel.id,xktEntityId):xktEntityId;var metaObject=viewer.metaScene.metaObjects[entityId];var entityDefaults={};var meshDefaults={};var entityMatrix=entityMatrices.subarray(_i533*16,_i533*16+16);if(metaObject){if(options.excludeTypesMap&&metaObject.type&&options.excludeTypesMap[metaObject.type]){continue;}if(options.includeTypesMap&&metaObject.type&&!options.includeTypesMap[metaObject.type]){continue;}var props=options.objectDefaults?options.objectDefaults[metaObject.type]||options.objectDefaults["DEFAULT"]:null;if(props){if(props.visible===false){entityDefaults.visible=false;}if(props.pickable===false){entityDefaults.pickable=false;}if(props.colorize){meshDefaults.color=props.colorize;}if(props.opacity!==undefined&&props.opacity!==null){meshDefaults.opacity=props.opacity;}}}else{if(options.excludeUnclassifiedObjects){continue;}}var lastEntity=_i533===numEntities-1;var meshIds=[];for(var j=entityMeshes[_i533],jlen=lastEntity?entityMeshIds.length:entityMeshes[_i533+1];j<jlen;j++){var jj=entityMeshIds[j];var lastMesh=jj===numMeshes-1;var meshId=manifestCtx.getNextId();var _color7=decompressColor$8(meshColors.subarray(jj*4,jj*4+3));var _opacity2=meshColors[jj*4+3]/255.0;var tmpPositions=positions.subarray(meshPositions[jj],lastMesh?positions.length:meshPositions[jj+1]);var tmpNormals=normals.subarray(meshPositions[jj],lastMesh?positions.length:meshPositions[jj+1]);var tmpIndices=indices.subarray(meshIndices[jj],lastMesh?indices.length:meshIndices[jj+1]);var tmpEdgeIndices=edgeIndices.subarray(meshEdgesIndices[jj],lastMesh?edgeIndices.length:meshEdgesIndices[jj+1]);if(entityUsesInstancing[_i533]===1){var geometryId="".concat(modelPartId,".geometry.").concat(meshId,".").concat(jj);if(!(geometryId in alreadyCreatedGeometries)){sceneModel.createGeometry({id:geometryId,positionsCompressed:tmpPositions,normalsCompressed:tmpNormals,indices:tmpIndices,edgeIndices:tmpEdgeIndices,primitive:"triangles",positionsDecodeMatrix:inflatedData.positionsDecodeMatrix});alreadyCreatedGeometries[geometryId]=true;}sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,color:_color7,opacity:_opacity2,matrix:entityMatrix,geometryId:geometryId}));meshIds.push(meshId);}else{sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,primitive:"triangles",positionsCompressed:tmpPositions,normalsCompressed:tmpNormals,indices:tmpIndices,edgeIndices:tmpEdgeIndices,positionsDecodeMatrix:inflatedData.positionsDecodeMatrix,color:_color7,opacity:_opacity2}));meshIds.push(meshId);}}if(meshIds.length){sceneModel.createEntity(utils.apply(entityDefaults,{id:entityId,isObject:entityIsObjects[_i533]===1,meshIds:meshIds}));}}}/** @private */var ParserV2={version:2,parse:function parse(viewer,options,elements,sceneModel,metaModel,manifestCtx){var deflatedData=extract$8(elements);var inflatedData=inflate$8(deflatedData);load$8(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx);}};/*
24769
24769
 
24770
24770
  Parser for .XKT Format V3
24771
24771
 
24772
24772
  .XKT specifications: https://github.com/xeokit/xeokit-sdk/wiki/XKT-Format
24773
24773
 
24774
24774
  */var pako$7=window.pako||p;if(!pako$7.inflate){// See https://github.com/nodeca/pako/issues/97
24775
- pako$7=pako$7["default"];}function extract$7(elements){return{positions:elements[0],normals:elements[1],indices:elements[2],edgeIndices:elements[3],meshPositions:elements[4],meshIndices:elements[5],meshEdgesIndices:elements[6],meshColors:elements[7],entityIDs:elements[8],entityMeshes:elements[9],entityIsObjects:elements[10],instancedPositionsDecodeMatrix:elements[11],batchedPositionsDecodeMatrix:elements[12],entityMeshIds:elements[13],entityMatrices:elements[14],entityUsesInstancing:elements[15]};}function inflate$7(deflatedData){return{positions:new Uint16Array(pako$7.inflate(deflatedData.positions).buffer),normals:new Int8Array(pako$7.inflate(deflatedData.normals).buffer),indices:new Uint32Array(pako$7.inflate(deflatedData.indices).buffer),edgeIndices:new Uint32Array(pako$7.inflate(deflatedData.edgeIndices).buffer),meshPositions:new Uint32Array(pako$7.inflate(deflatedData.meshPositions).buffer),meshIndices:new Uint32Array(pako$7.inflate(deflatedData.meshIndices).buffer),meshEdgesIndices:new Uint32Array(pako$7.inflate(deflatedData.meshEdgesIndices).buffer),meshColors:new Uint8Array(pako$7.inflate(deflatedData.meshColors).buffer),entityIDs:pako$7.inflate(deflatedData.entityIDs,{to:'string'}),entityMeshes:new Uint32Array(pako$7.inflate(deflatedData.entityMeshes).buffer),entityIsObjects:new Uint8Array(pako$7.inflate(deflatedData.entityIsObjects).buffer),instancedPositionsDecodeMatrix:new Float32Array(pako$7.inflate(deflatedData.instancedPositionsDecodeMatrix).buffer),batchedPositionsDecodeMatrix:new Float32Array(pako$7.inflate(deflatedData.batchedPositionsDecodeMatrix).buffer),entityMeshIds:new Uint32Array(pako$7.inflate(deflatedData.entityMeshIds).buffer),entityMatrices:new Float32Array(pako$7.inflate(deflatedData.entityMatrices).buffer),entityUsesInstancing:new Uint8Array(pako$7.inflate(deflatedData.entityUsesInstancing).buffer)};}var decompressColor$7=function(){var color2=new Float32Array(3);return function(color){color2[0]=color[0]/255.0;color2[1]=color[1]/255.0;color2[2]=color[2]/255.0;return color2;};}();function load$7(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx){sceneModel.positionsCompression="precompressed";sceneModel.normalsCompression="precompressed";var positions=inflatedData.positions;var normals=inflatedData.normals;var indices=inflatedData.indices;var edgeIndices=inflatedData.edgeIndices;var meshPositions=inflatedData.meshPositions;var meshIndices=inflatedData.meshIndices;var meshEdgesIndices=inflatedData.meshEdgesIndices;var meshColors=inflatedData.meshColors;var entityIDs=JSON.parse(inflatedData.entityIDs);var entityMeshes=inflatedData.entityMeshes;var entityIsObjects=inflatedData.entityIsObjects;var entityMeshIds=inflatedData.entityMeshIds;var entityMatrices=inflatedData.entityMatrices;var entityUsesInstancing=inflatedData.entityUsesInstancing;var numMeshes=meshPositions.length;var numEntities=entityMeshes.length;var _alreadyCreatedGeometries={};for(var _i534=0;_i534<numEntities;_i534++){var xktEntityId=entityIDs[_i534];var entityId=options.globalizeObjectIds?math.globalizeObjectId(sceneModel.id,xktEntityId):xktEntityId;var metaObject=viewer.metaScene.metaObjects[entityId];var entityDefaults={};var meshDefaults={};var entityMatrix=entityMatrices.subarray(_i534*16,_i534*16+16);if(metaObject){if(options.excludeTypesMap&&metaObject.type&&options.excludeTypesMap[metaObject.type]){continue;}if(options.includeTypesMap&&metaObject.type&&!options.includeTypesMap[metaObject.type]){continue;}var props=options.objectDefaults?options.objectDefaults[metaObject.type]||options.objectDefaults["DEFAULT"]:null;if(props){if(props.visible===false){entityDefaults.visible=false;}if(props.pickable===false){entityDefaults.pickable=false;}if(props.colorize){meshDefaults.color=props.colorize;}if(props.opacity!==undefined&&props.opacity!==null){meshDefaults.opacity=props.opacity;}}}else{if(options.excludeUnclassifiedObjects){continue;}}var lastEntity=_i534===numEntities-1;var meshIds=[];for(var j=entityMeshes[_i534],jlen=lastEntity?entityMeshIds.length:entityMeshes[_i534+1];j<jlen;j++){var jj=entityMeshIds[j];var lastMesh=jj===numMeshes-1;var meshId=entityId+".mesh."+jj;var _color8=decompressColor$7(meshColors.subarray(jj*4,jj*4+3));var _opacity3=meshColors[jj*4+3]/255.0;var tmpPositions=positions.subarray(meshPositions[jj],lastMesh?positions.length:meshPositions[jj+1]);var tmpNormals=normals.subarray(meshPositions[jj],lastMesh?positions.length:meshPositions[jj+1]);var tmpIndices=indices.subarray(meshIndices[jj],lastMesh?indices.length:meshIndices[jj+1]);var tmpEdgeIndices=edgeIndices.subarray(meshEdgesIndices[jj],lastMesh?edgeIndices.length:meshEdgesIndices[jj+1]);if(entityUsesInstancing[_i534]===1){var geometryId="geometry."+jj;if(!(geometryId in _alreadyCreatedGeometries)){sceneModel.createGeometry({id:geometryId,positionsCompressed:tmpPositions,normalsCompressed:tmpNormals,indices:tmpIndices,edgeIndices:tmpEdgeIndices,primitive:"triangles",positionsDecodeMatrix:inflatedData.instancedPositionsDecodeMatrix});_alreadyCreatedGeometries[geometryId]=true;}sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,color:_color8,opacity:_opacity3,matrix:entityMatrix,geometryId:geometryId}));meshIds.push(meshId);}else{sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,primitive:"triangles",positionsCompressed:tmpPositions,normalsCompressed:tmpNormals,indices:tmpIndices,edgeIndices:tmpEdgeIndices,positionsDecodeMatrix:inflatedData.batchedPositionsDecodeMatrix,color:_color8,opacity:_opacity3}));meshIds.push(meshId);}}if(meshIds.length){sceneModel.createEntity(utils.apply(entityDefaults,{id:entityId,isObject:entityIsObjects[_i534]===1,meshIds:meshIds}));}}}/** @private */var ParserV3={version:3,parse:function parse(viewer,options,elements,sceneModel,metaModel,manifestCtx){var deflatedData=extract$7(elements);var inflatedData=inflate$7(deflatedData);load$7(viewer,options,inflatedData,sceneModel);}};/*
24775
+ pako$7=pako$7["default"];}function extract$7(elements){return{positions:elements[0],normals:elements[1],indices:elements[2],edgeIndices:elements[3],meshPositions:elements[4],meshIndices:elements[5],meshEdgesIndices:elements[6],meshColors:elements[7],entityIDs:elements[8],entityMeshes:elements[9],entityIsObjects:elements[10],instancedPositionsDecodeMatrix:elements[11],batchedPositionsDecodeMatrix:elements[12],entityMeshIds:elements[13],entityMatrices:elements[14],entityUsesInstancing:elements[15]};}function inflate$7(deflatedData){return{positions:new Uint16Array(pako$7.inflate(deflatedData.positions).buffer),normals:new Int8Array(pako$7.inflate(deflatedData.normals).buffer),indices:new Uint32Array(pako$7.inflate(deflatedData.indices).buffer),edgeIndices:new Uint32Array(pako$7.inflate(deflatedData.edgeIndices).buffer),meshPositions:new Uint32Array(pako$7.inflate(deflatedData.meshPositions).buffer),meshIndices:new Uint32Array(pako$7.inflate(deflatedData.meshIndices).buffer),meshEdgesIndices:new Uint32Array(pako$7.inflate(deflatedData.meshEdgesIndices).buffer),meshColors:new Uint8Array(pako$7.inflate(deflatedData.meshColors).buffer),entityIDs:pako$7.inflate(deflatedData.entityIDs,{to:'string'}),entityMeshes:new Uint32Array(pako$7.inflate(deflatedData.entityMeshes).buffer),entityIsObjects:new Uint8Array(pako$7.inflate(deflatedData.entityIsObjects).buffer),instancedPositionsDecodeMatrix:new Float32Array(pako$7.inflate(deflatedData.instancedPositionsDecodeMatrix).buffer),batchedPositionsDecodeMatrix:new Float32Array(pako$7.inflate(deflatedData.batchedPositionsDecodeMatrix).buffer),entityMeshIds:new Uint32Array(pako$7.inflate(deflatedData.entityMeshIds).buffer),entityMatrices:new Float32Array(pako$7.inflate(deflatedData.entityMatrices).buffer),entityUsesInstancing:new Uint8Array(pako$7.inflate(deflatedData.entityUsesInstancing).buffer)};}var decompressColor$7=function(){var color2=new Float32Array(3);return function(color){color2[0]=color[0]/255.0;color2[1]=color[1]/255.0;color2[2]=color[2]/255.0;return color2;};}();function load$7(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx){var modelPartId=manifestCtx.getNextId();sceneModel.positionsCompression="precompressed";sceneModel.normalsCompression="precompressed";var positions=inflatedData.positions;var normals=inflatedData.normals;var indices=inflatedData.indices;var edgeIndices=inflatedData.edgeIndices;var meshPositions=inflatedData.meshPositions;var meshIndices=inflatedData.meshIndices;var meshEdgesIndices=inflatedData.meshEdgesIndices;var meshColors=inflatedData.meshColors;var entityIDs=JSON.parse(inflatedData.entityIDs);var entityMeshes=inflatedData.entityMeshes;var entityIsObjects=inflatedData.entityIsObjects;var entityMeshIds=inflatedData.entityMeshIds;var entityMatrices=inflatedData.entityMatrices;var entityUsesInstancing=inflatedData.entityUsesInstancing;var numMeshes=meshPositions.length;var numEntities=entityMeshes.length;var _alreadyCreatedGeometries={};for(var _i534=0;_i534<numEntities;_i534++){var xktEntityId=entityIDs[_i534];var entityId=options.globalizeObjectIds?math.globalizeObjectId(sceneModel.id,xktEntityId):xktEntityId;var metaObject=viewer.metaScene.metaObjects[entityId];var entityDefaults={};var meshDefaults={};var entityMatrix=entityMatrices.subarray(_i534*16,_i534*16+16);if(metaObject){if(options.excludeTypesMap&&metaObject.type&&options.excludeTypesMap[metaObject.type]){continue;}if(options.includeTypesMap&&metaObject.type&&!options.includeTypesMap[metaObject.type]){continue;}var props=options.objectDefaults?options.objectDefaults[metaObject.type]||options.objectDefaults["DEFAULT"]:null;if(props){if(props.visible===false){entityDefaults.visible=false;}if(props.pickable===false){entityDefaults.pickable=false;}if(props.colorize){meshDefaults.color=props.colorize;}if(props.opacity!==undefined&&props.opacity!==null){meshDefaults.opacity=props.opacity;}}}else{if(options.excludeUnclassifiedObjects){continue;}}var lastEntity=_i534===numEntities-1;var meshIds=[];for(var j=entityMeshes[_i534],jlen=lastEntity?entityMeshIds.length:entityMeshes[_i534+1];j<jlen;j++){var jj=entityMeshIds[j];var lastMesh=jj===numMeshes-1;var meshId="".concat(modelPartId,".").concat(entityId,".mesh.").concat(jj);var _color8=decompressColor$7(meshColors.subarray(jj*4,jj*4+3));var _opacity3=meshColors[jj*4+3]/255.0;var tmpPositions=positions.subarray(meshPositions[jj],lastMesh?positions.length:meshPositions[jj+1]);var tmpNormals=normals.subarray(meshPositions[jj],lastMesh?positions.length:meshPositions[jj+1]);var tmpIndices=indices.subarray(meshIndices[jj],lastMesh?indices.length:meshIndices[jj+1]);var tmpEdgeIndices=edgeIndices.subarray(meshEdgesIndices[jj],lastMesh?edgeIndices.length:meshEdgesIndices[jj+1]);if(entityUsesInstancing[_i534]===1){var geometryId="".concat(modelPartId,".geometry.").concat(meshId,".").concat(jj);if(!(geometryId in _alreadyCreatedGeometries)){sceneModel.createGeometry({id:geometryId,positionsCompressed:tmpPositions,normalsCompressed:tmpNormals,indices:tmpIndices,edgeIndices:tmpEdgeIndices,primitive:"triangles",positionsDecodeMatrix:inflatedData.instancedPositionsDecodeMatrix});_alreadyCreatedGeometries[geometryId]=true;}sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,color:_color8,opacity:_opacity3,matrix:entityMatrix,geometryId:geometryId}));meshIds.push(meshId);}else{sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,primitive:"triangles",positionsCompressed:tmpPositions,normalsCompressed:tmpNormals,indices:tmpIndices,edgeIndices:tmpEdgeIndices,positionsDecodeMatrix:inflatedData.batchedPositionsDecodeMatrix,color:_color8,opacity:_opacity3}));meshIds.push(meshId);}}if(meshIds.length){sceneModel.createEntity(utils.apply(entityDefaults,{id:entityId,isObject:entityIsObjects[_i534]===1,meshIds:meshIds}));}}}/** @private */var ParserV3={version:3,parse:function parse(viewer,options,elements,sceneModel,metaModel,manifestCtx){var deflatedData=extract$7(elements);var inflatedData=inflate$7(deflatedData);load$7(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx);}};/*
24776
24776
 
24777
24777
  Parser for .XKT Format V4
24778
24778
 
24779
24779
  .XKT specifications: https://github.com/xeokit/xeokit-sdk/wiki/XKT-Format
24780
24780
 
24781
24781
  */var pako$6=window.pako||p;if(!pako$6.inflate){// See https://github.com/nodeca/pako/issues/97
24782
- pako$6=pako$6["default"];}function extract$6(elements){return{positions:elements[0],normals:elements[1],indices:elements[2],edgeIndices:elements[3],decodeMatrices:elements[4],matrices:elements[5],eachPrimitivePositionsAndNormalsPortion:elements[6],eachPrimitiveIndicesPortion:elements[7],eachPrimitiveEdgeIndicesPortion:elements[8],eachPrimitiveDecodeMatricesPortion:elements[9],eachPrimitiveColor:elements[10],primitiveInstances:elements[11],eachEntityId:elements[12],eachEntityPrimitiveInstancesPortion:elements[13],eachEntityMatricesPortion:elements[14],eachEntityMatrix:elements[15]};}function inflate$6(deflatedData){return{positions:new Uint16Array(pako$6.inflate(deflatedData.positions).buffer),normals:new Int8Array(pako$6.inflate(deflatedData.normals).buffer),indices:new Uint32Array(pako$6.inflate(deflatedData.indices).buffer),edgeIndices:new Uint32Array(pako$6.inflate(deflatedData.edgeIndices).buffer),decodeMatrices:new Float32Array(pako$6.inflate(deflatedData.decodeMatrices).buffer),matrices:new Float32Array(pako$6.inflate(deflatedData.matrices).buffer),eachPrimitivePositionsAndNormalsPortion:new Uint32Array(pako$6.inflate(deflatedData.eachPrimitivePositionsAndNormalsPortion).buffer),eachPrimitiveIndicesPortion:new Uint32Array(pako$6.inflate(deflatedData.eachPrimitiveIndicesPortion).buffer),eachPrimitiveEdgeIndicesPortion:new Uint32Array(pako$6.inflate(deflatedData.eachPrimitiveEdgeIndicesPortion).buffer),eachPrimitiveDecodeMatricesPortion:new Uint32Array(pako$6.inflate(deflatedData.eachPrimitiveDecodeMatricesPortion).buffer),eachPrimitiveColor:new Uint8Array(pako$6.inflate(deflatedData.eachPrimitiveColor).buffer),primitiveInstances:new Uint32Array(pako$6.inflate(deflatedData.primitiveInstances).buffer),eachEntityId:pako$6.inflate(deflatedData.eachEntityId,{to:'string'}),eachEntityPrimitiveInstancesPortion:new Uint32Array(pako$6.inflate(deflatedData.eachEntityPrimitiveInstancesPortion).buffer),eachEntityMatricesPortion:new Uint32Array(pako$6.inflate(deflatedData.eachEntityMatricesPortion).buffer)};}var decompressColor$6=function(){var color2=new Float32Array(3);return function(color){color2[0]=color[0]/255.0;color2[1]=color[1]/255.0;color2[2]=color[2]/255.0;return color2;};}();function load$6(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx){sceneModel.positionsCompression="precompressed";sceneModel.normalsCompression="precompressed";var positions=inflatedData.positions;var normals=inflatedData.normals;var indices=inflatedData.indices;var edgeIndices=inflatedData.edgeIndices;var decodeMatrices=inflatedData.decodeMatrices;var matrices=inflatedData.matrices;var eachPrimitivePositionsAndNormalsPortion=inflatedData.eachPrimitivePositionsAndNormalsPortion;var eachPrimitiveIndicesPortion=inflatedData.eachPrimitiveIndicesPortion;var eachPrimitiveEdgeIndicesPortion=inflatedData.eachPrimitiveEdgeIndicesPortion;var eachPrimitiveDecodeMatricesPortion=inflatedData.eachPrimitiveDecodeMatricesPortion;var eachPrimitiveColor=inflatedData.eachPrimitiveColor;var primitiveInstances=inflatedData.primitiveInstances;var eachEntityId=JSON.parse(inflatedData.eachEntityId);var eachEntityPrimitiveInstancesPortion=inflatedData.eachEntityPrimitiveInstancesPortion;var eachEntityMatricesPortion=inflatedData.eachEntityMatricesPortion;var numPrimitives=eachPrimitivePositionsAndNormalsPortion.length;var numPrimitiveInstances=primitiveInstances.length;var primitiveInstanceCounts=new Uint8Array(numPrimitives);// For each mesh, how many times it is instanced
24782
+ pako$6=pako$6["default"];}function extract$6(elements){return{positions:elements[0],normals:elements[1],indices:elements[2],edgeIndices:elements[3],decodeMatrices:elements[4],matrices:elements[5],eachPrimitivePositionsAndNormalsPortion:elements[6],eachPrimitiveIndicesPortion:elements[7],eachPrimitiveEdgeIndicesPortion:elements[8],eachPrimitiveDecodeMatricesPortion:elements[9],eachPrimitiveColor:elements[10],primitiveInstances:elements[11],eachEntityId:elements[12],eachEntityPrimitiveInstancesPortion:elements[13],eachEntityMatricesPortion:elements[14],eachEntityMatrix:elements[15]};}function inflate$6(deflatedData){return{positions:new Uint16Array(pako$6.inflate(deflatedData.positions).buffer),normals:new Int8Array(pako$6.inflate(deflatedData.normals).buffer),indices:new Uint32Array(pako$6.inflate(deflatedData.indices).buffer),edgeIndices:new Uint32Array(pako$6.inflate(deflatedData.edgeIndices).buffer),decodeMatrices:new Float32Array(pako$6.inflate(deflatedData.decodeMatrices).buffer),matrices:new Float32Array(pako$6.inflate(deflatedData.matrices).buffer),eachPrimitivePositionsAndNormalsPortion:new Uint32Array(pako$6.inflate(deflatedData.eachPrimitivePositionsAndNormalsPortion).buffer),eachPrimitiveIndicesPortion:new Uint32Array(pako$6.inflate(deflatedData.eachPrimitiveIndicesPortion).buffer),eachPrimitiveEdgeIndicesPortion:new Uint32Array(pako$6.inflate(deflatedData.eachPrimitiveEdgeIndicesPortion).buffer),eachPrimitiveDecodeMatricesPortion:new Uint32Array(pako$6.inflate(deflatedData.eachPrimitiveDecodeMatricesPortion).buffer),eachPrimitiveColor:new Uint8Array(pako$6.inflate(deflatedData.eachPrimitiveColor).buffer),primitiveInstances:new Uint32Array(pako$6.inflate(deflatedData.primitiveInstances).buffer),eachEntityId:pako$6.inflate(deflatedData.eachEntityId,{to:'string'}),eachEntityPrimitiveInstancesPortion:new Uint32Array(pako$6.inflate(deflatedData.eachEntityPrimitiveInstancesPortion).buffer),eachEntityMatricesPortion:new Uint32Array(pako$6.inflate(deflatedData.eachEntityMatricesPortion).buffer)};}var decompressColor$6=function(){var color2=new Float32Array(3);return function(color){color2[0]=color[0]/255.0;color2[1]=color[1]/255.0;color2[2]=color[2]/255.0;return color2;};}();function load$6(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx){var modelPartId=manifestCtx.getNextId();sceneModel.positionsCompression="precompressed";sceneModel.normalsCompression="precompressed";var positions=inflatedData.positions;var normals=inflatedData.normals;var indices=inflatedData.indices;var edgeIndices=inflatedData.edgeIndices;var decodeMatrices=inflatedData.decodeMatrices;var matrices=inflatedData.matrices;var eachPrimitivePositionsAndNormalsPortion=inflatedData.eachPrimitivePositionsAndNormalsPortion;var eachPrimitiveIndicesPortion=inflatedData.eachPrimitiveIndicesPortion;var eachPrimitiveEdgeIndicesPortion=inflatedData.eachPrimitiveEdgeIndicesPortion;var eachPrimitiveDecodeMatricesPortion=inflatedData.eachPrimitiveDecodeMatricesPortion;var eachPrimitiveColor=inflatedData.eachPrimitiveColor;var primitiveInstances=inflatedData.primitiveInstances;var eachEntityId=JSON.parse(inflatedData.eachEntityId);var eachEntityPrimitiveInstancesPortion=inflatedData.eachEntityPrimitiveInstancesPortion;var eachEntityMatricesPortion=inflatedData.eachEntityMatricesPortion;var numPrimitives=eachPrimitivePositionsAndNormalsPortion.length;var numPrimitiveInstances=primitiveInstances.length;var primitiveInstanceCounts=new Uint8Array(numPrimitives);// For each mesh, how many times it is instanced
24783
24783
  var orderedPrimitiveIndexes=new Uint32Array(numPrimitives);// For each mesh, its index sorted into runs that share the same decode matrix
24784
24784
  var numEntities=eachEntityId.length;// Get lookup that orders primitives into runs that share the same decode matrices;
24785
24785
  // this is used to create meshes in batches that use the same decode matrix
@@ -24792,47 +24792,47 @@ var batchedPrimitiveEntityIndexes={};for(var entityIndex=0;entityIndex<numEntiti
24792
24792
  // matrix has changed since the last invocation of that method, hence why we need to order batched meshes
24793
24793
  // in runs like this.
24794
24794
  for(var _primitiveIndex3=0;_primitiveIndex3<numPrimitives;_primitiveIndex3++){var orderedPrimitiveIndex=orderedPrimitiveIndexes[_primitiveIndex3];var atLastPrimitive=orderedPrimitiveIndex===numPrimitives-1;var _primitiveInstanceCount=primitiveInstanceCounts[orderedPrimitiveIndex];var _isInstancedPrimitive=_primitiveInstanceCount>1;var _color9=decompressColor$6(eachPrimitiveColor.subarray(orderedPrimitiveIndex*4,orderedPrimitiveIndex*4+3));var _opacity4=eachPrimitiveColor[orderedPrimitiveIndex*4+3]/255.0;var primitivePositions=positions.subarray(eachPrimitivePositionsAndNormalsPortion[orderedPrimitiveIndex],atLastPrimitive?positions.length:eachPrimitivePositionsAndNormalsPortion[orderedPrimitiveIndex+1]);var primitiveNormals=normals.subarray(eachPrimitivePositionsAndNormalsPortion[orderedPrimitiveIndex],atLastPrimitive?normals.length:eachPrimitivePositionsAndNormalsPortion[orderedPrimitiveIndex+1]);var primitiveIndices=indices.subarray(eachPrimitiveIndicesPortion[orderedPrimitiveIndex],atLastPrimitive?indices.length:eachPrimitiveIndicesPortion[orderedPrimitiveIndex+1]);var primitiveEdgeIndices=edgeIndices.subarray(eachPrimitiveEdgeIndicesPortion[orderedPrimitiveIndex],atLastPrimitive?edgeIndices.length:eachPrimitiveEdgeIndicesPortion[orderedPrimitiveIndex+1]);var primitiveDecodeMatrix=decodeMatrices.subarray(eachPrimitiveDecodeMatricesPortion[orderedPrimitiveIndex],eachPrimitiveDecodeMatricesPortion[orderedPrimitiveIndex]+16);if(_isInstancedPrimitive){// Primitive instanced by more than one entity, and has positions in Model-space
24795
- var geometryId="geometry"+orderedPrimitiveIndex;// These IDs are local to the SceneModel
24795
+ var geometryId="".concat(modelPartId,"-geometry.").concat(orderedPrimitiveIndex);// These IDs are local to the SceneModel
24796
24796
  sceneModel.createGeometry({id:geometryId,primitive:"triangles",positionsCompressed:primitivePositions,normalsCompressed:primitiveNormals,indices:primitiveIndices,edgeIndices:primitiveEdgeIndices,positionsDecodeMatrix:primitiveDecodeMatrix});}else{// Primitive is used only by one entity, and has positions pre-transformed into World-space
24797
- var meshId=orderedPrimitiveIndex;// These IDs are local to the SceneModel
24798
- var _entityIndex2=batchedPrimitiveEntityIndexes[orderedPrimitiveIndex];eachEntityId[_entityIndex2];var meshDefaults={};// TODO: get from lookup from entity IDs
24797
+ var meshId="".concat(modelPartId,"-").concat(orderedPrimitiveIndex);var _entityIndex2=batchedPrimitiveEntityIndexes[orderedPrimitiveIndex];eachEntityId[_entityIndex2];var meshDefaults={};// TODO: get from lookup from entity IDs
24799
24798
  sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,primitive:"triangles",positionsCompressed:primitivePositions,normalsCompressed:primitiveNormals,indices:primitiveIndices,edgeIndices:primitiveEdgeIndices,positionsDecodeMatrix:primitiveDecodeMatrix,color:_color9,opacity:_opacity4}));}}var countInstances=0;for(var _entityIndex3=0;_entityIndex3<numEntities;_entityIndex3++){var _lastEntityIndex=numEntities-1;var _atLastEntity=_entityIndex3===_lastEntityIndex;var entityId=eachEntityId[_entityIndex3];var _firstEntityPrimitiveInstanceIndex=eachEntityPrimitiveInstancesPortion[_entityIndex3];var _lastEntityPrimitiveInstanceIndex=_atLastEntity?eachEntityPrimitiveInstancesPortion[_lastEntityIndex]:eachEntityPrimitiveInstancesPortion[_entityIndex3+1];var meshIds=[];for(var _primitiveInstancesIndex=_firstEntityPrimitiveInstanceIndex;_primitiveInstancesIndex<_lastEntityPrimitiveInstanceIndex;_primitiveInstancesIndex++){var _primitiveIndex4=primitiveInstances[_primitiveInstancesIndex];var _primitiveInstanceCount2=primitiveInstanceCounts[_primitiveIndex4];var _isInstancedPrimitive2=_primitiveInstanceCount2>1;if(_isInstancedPrimitive2){var _meshDefaults={};// TODO: get from lookup from entity IDs
24800
- var _meshId="instance."+countInstances++;var _geometryId="geometry"+_primitiveIndex4;var matricesIndex=eachEntityMatricesPortion[_entityIndex3]*16;var _matrix4=matrices.subarray(matricesIndex,matricesIndex+16);sceneModel.createMesh(utils.apply(_meshDefaults,{id:_meshId,geometryId:_geometryId,matrix:_matrix4}));meshIds.push(_meshId);}else{meshIds.push(_primitiveIndex4);}}if(meshIds.length>0){var entityDefaults={};// TODO: get from lookup from entity IDs
24799
+ var _meshId="".concat(modelPartId,"-instance.").concat(countInstances++);var _geometryId="".concat(modelPartId,"-geometry.").concat(_primitiveIndex4);// These IDs are local to the SceneModel
24800
+ var matricesIndex=eachEntityMatricesPortion[_entityIndex3]*16;var _matrix4=matrices.subarray(matricesIndex,matricesIndex+16);sceneModel.createMesh(utils.apply(_meshDefaults,{id:_meshId,geometryId:_geometryId,matrix:_matrix4}));meshIds.push(_meshId);}else{meshIds.push(_primitiveIndex4);}}if(meshIds.length>0){var entityDefaults={};// TODO: get from lookup from entity IDs
24801
24801
  sceneModel.createEntity(utils.apply(entityDefaults,{id:entityId,isObject:true,///////////////// TODO: If metaobject exists
24802
- meshIds:meshIds}));}}}/** @private */var ParserV4={version:4,parse:function parse(viewer,options,elements,sceneModel,metaModel,manifestCtx){var deflatedData=extract$6(elements);var inflatedData=inflate$6(deflatedData);load$6(viewer,options,inflatedData,sceneModel);}};/*
24802
+ meshIds:meshIds}));}}}/** @private */var ParserV4={version:4,parse:function parse(viewer,options,elements,sceneModel,metaModel,manifestCtx){var deflatedData=extract$6(elements);var inflatedData=inflate$6(deflatedData);load$6(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx);}};/*
24803
24803
 
24804
24804
  Parser for .XKT Format V5
24805
24805
 
24806
24806
  .XKT specifications: https://github.com/xeokit/xeokit-sdk/wiki/XKT-Format
24807
24807
 
24808
24808
  */var pako$5=window.pako||p;if(!pako$5.inflate){// See https://github.com/nodeca/pako/issues/97
24809
- pako$5=pako$5["default"];}function extract$5(elements){return{positions:elements[0],normals:elements[1],indices:elements[2],edgeIndices:elements[3],matrices:elements[4],eachPrimitivePositionsAndNormalsPortion:elements[5],eachPrimitiveIndicesPortion:elements[6],eachPrimitiveEdgeIndicesPortion:elements[7],eachPrimitiveColor:elements[8],primitiveInstances:elements[9],eachEntityId:elements[10],eachEntityPrimitiveInstancesPortion:elements[11],eachEntityMatricesPortion:elements[12]};}function inflate$5(deflatedData){return{positions:new Float32Array(pako$5.inflate(deflatedData.positions).buffer),normals:new Int8Array(pako$5.inflate(deflatedData.normals).buffer),indices:new Uint32Array(pako$5.inflate(deflatedData.indices).buffer),edgeIndices:new Uint32Array(pako$5.inflate(deflatedData.edgeIndices).buffer),matrices:new Float32Array(pako$5.inflate(deflatedData.matrices).buffer),eachPrimitivePositionsAndNormalsPortion:new Uint32Array(pako$5.inflate(deflatedData.eachPrimitivePositionsAndNormalsPortion).buffer),eachPrimitiveIndicesPortion:new Uint32Array(pako$5.inflate(deflatedData.eachPrimitiveIndicesPortion).buffer),eachPrimitiveEdgeIndicesPortion:new Uint32Array(pako$5.inflate(deflatedData.eachPrimitiveEdgeIndicesPortion).buffer),eachPrimitiveColor:new Uint8Array(pako$5.inflate(deflatedData.eachPrimitiveColor).buffer),primitiveInstances:new Uint32Array(pako$5.inflate(deflatedData.primitiveInstances).buffer),eachEntityId:pako$5.inflate(deflatedData.eachEntityId,{to:'string'}),eachEntityPrimitiveInstancesPortion:new Uint32Array(pako$5.inflate(deflatedData.eachEntityPrimitiveInstancesPortion).buffer),eachEntityMatricesPortion:new Uint32Array(pako$5.inflate(deflatedData.eachEntityMatricesPortion).buffer)};}var decompressColor$5=function(){var color2=new Float32Array(3);return function(color){color2[0]=color[0]/255.0;color2[1]=color[1]/255.0;color2[2]=color[2]/255.0;return color2;};}();function load$5(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx){sceneModel.positionsCompression="disabled";// Positions in XKT V4 are floats, which we never quantize, for precision with big models
24809
+ pako$5=pako$5["default"];}function extract$5(elements){return{positions:elements[0],normals:elements[1],indices:elements[2],edgeIndices:elements[3],matrices:elements[4],eachPrimitivePositionsAndNormalsPortion:elements[5],eachPrimitiveIndicesPortion:elements[6],eachPrimitiveEdgeIndicesPortion:elements[7],eachPrimitiveColor:elements[8],primitiveInstances:elements[9],eachEntityId:elements[10],eachEntityPrimitiveInstancesPortion:elements[11],eachEntityMatricesPortion:elements[12]};}function inflate$5(deflatedData){return{positions:new Float32Array(pako$5.inflate(deflatedData.positions).buffer),normals:new Int8Array(pako$5.inflate(deflatedData.normals).buffer),indices:new Uint32Array(pako$5.inflate(deflatedData.indices).buffer),edgeIndices:new Uint32Array(pako$5.inflate(deflatedData.edgeIndices).buffer),matrices:new Float32Array(pako$5.inflate(deflatedData.matrices).buffer),eachPrimitivePositionsAndNormalsPortion:new Uint32Array(pako$5.inflate(deflatedData.eachPrimitivePositionsAndNormalsPortion).buffer),eachPrimitiveIndicesPortion:new Uint32Array(pako$5.inflate(deflatedData.eachPrimitiveIndicesPortion).buffer),eachPrimitiveEdgeIndicesPortion:new Uint32Array(pako$5.inflate(deflatedData.eachPrimitiveEdgeIndicesPortion).buffer),eachPrimitiveColor:new Uint8Array(pako$5.inflate(deflatedData.eachPrimitiveColor).buffer),primitiveInstances:new Uint32Array(pako$5.inflate(deflatedData.primitiveInstances).buffer),eachEntityId:pako$5.inflate(deflatedData.eachEntityId,{to:'string'}),eachEntityPrimitiveInstancesPortion:new Uint32Array(pako$5.inflate(deflatedData.eachEntityPrimitiveInstancesPortion).buffer),eachEntityMatricesPortion:new Uint32Array(pako$5.inflate(deflatedData.eachEntityMatricesPortion).buffer)};}var decompressColor$5=function(){var color2=new Float32Array(3);return function(color){color2[0]=color[0]/255.0;color2[1]=color[1]/255.0;color2[2]=color[2]/255.0;return color2;};}();function load$5(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx){var modelPartId=manifestCtx.getNextId();sceneModel.positionsCompression="disabled";// Positions in XKT V4 are floats, which we never quantize, for precision with big models
24810
24810
  sceneModel.normalsCompression="precompressed";// Normals are oct-encoded though
24811
24811
  var positions=inflatedData.positions;var normals=inflatedData.normals;var indices=inflatedData.indices;var edgeIndices=inflatedData.edgeIndices;var matrices=inflatedData.matrices;var eachPrimitivePositionsAndNormalsPortion=inflatedData.eachPrimitivePositionsAndNormalsPortion;var eachPrimitiveIndicesPortion=inflatedData.eachPrimitiveIndicesPortion;var eachPrimitiveEdgeIndicesPortion=inflatedData.eachPrimitiveEdgeIndicesPortion;var eachPrimitiveColor=inflatedData.eachPrimitiveColor;var primitiveInstances=inflatedData.primitiveInstances;var eachEntityId=JSON.parse(inflatedData.eachEntityId);var eachEntityPrimitiveInstancesPortion=inflatedData.eachEntityPrimitiveInstancesPortion;var eachEntityMatricesPortion=inflatedData.eachEntityMatricesPortion;var numPrimitives=eachPrimitivePositionsAndNormalsPortion.length;var numPrimitiveInstances=primitiveInstances.length;var primitiveInstanceCounts=new Uint8Array(numPrimitives);// For each mesh, how many times it is instanced
24812
24812
  var numEntities=eachEntityId.length;// Count instances of each primitive
24813
24813
  for(var primitiveInstanceIndex=0;primitiveInstanceIndex<numPrimitiveInstances;primitiveInstanceIndex++){var primitiveIndex=primitiveInstances[primitiveInstanceIndex];primitiveInstanceCounts[primitiveIndex]++;}// Map batched primitives to the entities that will use them
24814
24814
  var batchedPrimitiveEntityIndexes={};for(var entityIndex=0;entityIndex<numEntities;entityIndex++){var lastEntityIndex=numEntities-1;var atLastEntity=entityIndex===lastEntityIndex;var firstEntityPrimitiveInstanceIndex=eachEntityPrimitiveInstancesPortion[entityIndex];var lastEntityPrimitiveInstanceIndex=atLastEntity?eachEntityPrimitiveInstancesPortion[lastEntityIndex]:eachEntityPrimitiveInstancesPortion[entityIndex+1];for(var primitiveInstancesIndex=firstEntityPrimitiveInstanceIndex;primitiveInstancesIndex<lastEntityPrimitiveInstanceIndex;primitiveInstancesIndex++){var _primitiveIndex5=primitiveInstances[primitiveInstancesIndex];var primitiveInstanceCount=primitiveInstanceCounts[_primitiveIndex5];var isInstancedPrimitive=primitiveInstanceCount>1;if(!isInstancedPrimitive){batchedPrimitiveEntityIndexes[_primitiveIndex5]=entityIndex;}}}// Create geometries for instanced primitives and meshes for batched primitives.
24815
24815
  for(var _primitiveIndex6=0;_primitiveIndex6<numPrimitives;_primitiveIndex6++){var atLastPrimitive=_primitiveIndex6===numPrimitives-1;var _primitiveInstanceCount3=primitiveInstanceCounts[_primitiveIndex6];var _isInstancedPrimitive3=_primitiveInstanceCount3>1;var _color10=decompressColor$5(eachPrimitiveColor.subarray(_primitiveIndex6*4,_primitiveIndex6*4+3));var _opacity5=eachPrimitiveColor[_primitiveIndex6*4+3]/255.0;var primitivePositions=positions.subarray(eachPrimitivePositionsAndNormalsPortion[_primitiveIndex6],atLastPrimitive?positions.length:eachPrimitivePositionsAndNormalsPortion[_primitiveIndex6+1]);var primitiveNormals=normals.subarray(eachPrimitivePositionsAndNormalsPortion[_primitiveIndex6],atLastPrimitive?normals.length:eachPrimitivePositionsAndNormalsPortion[_primitiveIndex6+1]);var primitiveIndices=indices.subarray(eachPrimitiveIndicesPortion[_primitiveIndex6],atLastPrimitive?indices.length:eachPrimitiveIndicesPortion[_primitiveIndex6+1]);var primitiveEdgeIndices=edgeIndices.subarray(eachPrimitiveEdgeIndicesPortion[_primitiveIndex6],atLastPrimitive?edgeIndices.length:eachPrimitiveEdgeIndicesPortion[_primitiveIndex6+1]);if(_isInstancedPrimitive3){// Primitive instanced by more than one entity, and has positions in Model-space
24816
- var geometryId="geometry"+_primitiveIndex6;// These IDs are local to the SceneModel
24816
+ var geometryId="".concat(modelPartId,"-geometry.").concat(_primitiveIndex6);// These IDs are local to the SceneModel
24817
24817
  sceneModel.createGeometry({id:geometryId,primitive:"triangles",positionsCompressed:primitivePositions,normalsCompressed:primitiveNormals,indices:primitiveIndices,edgeIndices:primitiveEdgeIndices});}else{// Primitive is used only by one entity, and has positions pre-transformed into World-space
24818
24818
  var meshId=_primitiveIndex6;// These IDs are local to the SceneModel
24819
24819
  var _entityIndex4=batchedPrimitiveEntityIndexes[_primitiveIndex6];eachEntityId[_entityIndex4];var meshDefaults={};// TODO: get from lookup from entity IDs
24820
24820
  sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,primitive:"triangles",positionsCompressed:primitivePositions,normalsCompressed:primitiveNormals,indices:primitiveIndices,edgeIndices:primitiveEdgeIndices,color:_color10,opacity:_opacity5}));}}var countInstances=0;for(var _entityIndex5=0;_entityIndex5<numEntities;_entityIndex5++){var _lastEntityIndex2=numEntities-1;var _atLastEntity2=_entityIndex5===_lastEntityIndex2;var entityId=eachEntityId[_entityIndex5];var _firstEntityPrimitiveInstanceIndex2=eachEntityPrimitiveInstancesPortion[_entityIndex5];var _lastEntityPrimitiveInstanceIndex2=_atLastEntity2?eachEntityPrimitiveInstancesPortion[_lastEntityIndex2]:eachEntityPrimitiveInstancesPortion[_entityIndex5+1];var meshIds=[];for(var _primitiveInstancesIndex2=_firstEntityPrimitiveInstanceIndex2;_primitiveInstancesIndex2<_lastEntityPrimitiveInstanceIndex2;_primitiveInstancesIndex2++){var _primitiveIndex7=primitiveInstances[_primitiveInstancesIndex2];var _primitiveInstanceCount4=primitiveInstanceCounts[_primitiveIndex7];var _isInstancedPrimitive4=_primitiveInstanceCount4>1;if(_isInstancedPrimitive4){var _meshDefaults2={};// TODO: get from lookup from entity IDs
24821
24821
  var _meshId2="instance."+countInstances++;var _geometryId2="geometry"+_primitiveIndex7;var matricesIndex=eachEntityMatricesPortion[_entityIndex5]*16;var _matrix5=matrices.subarray(matricesIndex,matricesIndex+16);sceneModel.createMesh(utils.apply(_meshDefaults2,{id:_meshId2,geometryId:_geometryId2,matrix:_matrix5}));meshIds.push(_meshId2);}else{meshIds.push(_primitiveIndex7);}}if(meshIds.length>0){var entityDefaults={};// TODO: get from lookup from entity IDs
24822
24822
  sceneModel.createEntity(utils.apply(entityDefaults,{id:entityId,isObject:true,///////////////// TODO: If metaobject exists
24823
- meshIds:meshIds}));}}}/** @private */var ParserV5={version:5,parse:function parse(viewer,options,elements,sceneModel,metaModel,manifestCtx){var deflatedData=extract$5(elements);var inflatedData=inflate$5(deflatedData);load$5(viewer,options,inflatedData,sceneModel);}};/*
24823
+ meshIds:meshIds}));}}}/** @private */var ParserV5={version:5,parse:function parse(viewer,options,elements,sceneModel,metaModel,manifestCtx){var deflatedData=extract$5(elements);var inflatedData=inflate$5(deflatedData);load$5(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx);}};/*
24824
24824
 
24825
24825
  Parser for .XKT Format V6
24826
24826
 
24827
24827
  */var pako$4=window.pako||p;if(!pako$4.inflate){// See https://github.com/nodeca/pako/issues/97
24828
- pako$4=pako$4["default"];}function extract$4(elements){return{positions:elements[0],normals:elements[1],indices:elements[2],edgeIndices:elements[3],matrices:elements[4],reusedPrimitivesDecodeMatrix:elements[5],eachPrimitivePositionsAndNormalsPortion:elements[6],eachPrimitiveIndicesPortion:elements[7],eachPrimitiveEdgeIndicesPortion:elements[8],eachPrimitiveColorAndOpacity:elements[9],primitiveInstances:elements[10],eachEntityId:elements[11],eachEntityPrimitiveInstancesPortion:elements[12],eachEntityMatricesPortion:elements[13],eachTileAABB:elements[14],eachTileEntitiesPortion:elements[15]};}function inflate$4(deflatedData){function inflate(array,options){return array.length===0?[]:pako$4.inflate(array,options).buffer;}return{positions:new Uint16Array(inflate(deflatedData.positions)),normals:new Int8Array(inflate(deflatedData.normals)),indices:new Uint32Array(inflate(deflatedData.indices)),edgeIndices:new Uint32Array(inflate(deflatedData.edgeIndices)),matrices:new Float32Array(inflate(deflatedData.matrices)),reusedPrimitivesDecodeMatrix:new Float32Array(inflate(deflatedData.reusedPrimitivesDecodeMatrix)),eachPrimitivePositionsAndNormalsPortion:new Uint32Array(inflate(deflatedData.eachPrimitivePositionsAndNormalsPortion)),eachPrimitiveIndicesPortion:new Uint32Array(inflate(deflatedData.eachPrimitiveIndicesPortion)),eachPrimitiveEdgeIndicesPortion:new Uint32Array(inflate(deflatedData.eachPrimitiveEdgeIndicesPortion)),eachPrimitiveColorAndOpacity:new Uint8Array(inflate(deflatedData.eachPrimitiveColorAndOpacity)),primitiveInstances:new Uint32Array(inflate(deflatedData.primitiveInstances)),eachEntityId:pako$4.inflate(deflatedData.eachEntityId,{to:'string'}),eachEntityPrimitiveInstancesPortion:new Uint32Array(inflate(deflatedData.eachEntityPrimitiveInstancesPortion)),eachEntityMatricesPortion:new Uint32Array(inflate(deflatedData.eachEntityMatricesPortion)),eachTileAABB:new Float64Array(inflate(deflatedData.eachTileAABB)),eachTileEntitiesPortion:new Uint32Array(inflate(deflatedData.eachTileEntitiesPortion))};}var decompressColor$4=function(){var floatColor=new Float32Array(3);return function(intColor){floatColor[0]=intColor[0]/255.0;floatColor[1]=intColor[1]/255.0;floatColor[2]=intColor[2]/255.0;return floatColor;};}();function load$4(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx){var positions=inflatedData.positions;var normals=inflatedData.normals;var indices=inflatedData.indices;var edgeIndices=inflatedData.edgeIndices;var matrices=inflatedData.matrices;var reusedPrimitivesDecodeMatrix=inflatedData.reusedPrimitivesDecodeMatrix;var eachPrimitivePositionsAndNormalsPortion=inflatedData.eachPrimitivePositionsAndNormalsPortion;var eachPrimitiveIndicesPortion=inflatedData.eachPrimitiveIndicesPortion;var eachPrimitiveEdgeIndicesPortion=inflatedData.eachPrimitiveEdgeIndicesPortion;var eachPrimitiveColorAndOpacity=inflatedData.eachPrimitiveColorAndOpacity;var primitiveInstances=inflatedData.primitiveInstances;var eachEntityId=JSON.parse(inflatedData.eachEntityId);var eachEntityPrimitiveInstancesPortion=inflatedData.eachEntityPrimitiveInstancesPortion;var eachEntityMatricesPortion=inflatedData.eachEntityMatricesPortion;var eachTileAABB=inflatedData.eachTileAABB;var eachTileEntitiesPortion=inflatedData.eachTileEntitiesPortion;var numPrimitives=eachPrimitivePositionsAndNormalsPortion.length;var numPrimitiveInstances=primitiveInstances.length;var numEntities=eachEntityId.length;var numTiles=eachTileEntitiesPortion.length;// Count instances of each primitive
24828
+ pako$4=pako$4["default"];}function extract$4(elements){return{positions:elements[0],normals:elements[1],indices:elements[2],edgeIndices:elements[3],matrices:elements[4],reusedPrimitivesDecodeMatrix:elements[5],eachPrimitivePositionsAndNormalsPortion:elements[6],eachPrimitiveIndicesPortion:elements[7],eachPrimitiveEdgeIndicesPortion:elements[8],eachPrimitiveColorAndOpacity:elements[9],primitiveInstances:elements[10],eachEntityId:elements[11],eachEntityPrimitiveInstancesPortion:elements[12],eachEntityMatricesPortion:elements[13],eachTileAABB:elements[14],eachTileEntitiesPortion:elements[15]};}function inflate$4(deflatedData){function inflate(array,options){return array.length===0?[]:pako$4.inflate(array,options).buffer;}return{positions:new Uint16Array(inflate(deflatedData.positions)),normals:new Int8Array(inflate(deflatedData.normals)),indices:new Uint32Array(inflate(deflatedData.indices)),edgeIndices:new Uint32Array(inflate(deflatedData.edgeIndices)),matrices:new Float32Array(inflate(deflatedData.matrices)),reusedPrimitivesDecodeMatrix:new Float32Array(inflate(deflatedData.reusedPrimitivesDecodeMatrix)),eachPrimitivePositionsAndNormalsPortion:new Uint32Array(inflate(deflatedData.eachPrimitivePositionsAndNormalsPortion)),eachPrimitiveIndicesPortion:new Uint32Array(inflate(deflatedData.eachPrimitiveIndicesPortion)),eachPrimitiveEdgeIndicesPortion:new Uint32Array(inflate(deflatedData.eachPrimitiveEdgeIndicesPortion)),eachPrimitiveColorAndOpacity:new Uint8Array(inflate(deflatedData.eachPrimitiveColorAndOpacity)),primitiveInstances:new Uint32Array(inflate(deflatedData.primitiveInstances)),eachEntityId:pako$4.inflate(deflatedData.eachEntityId,{to:'string'}),eachEntityPrimitiveInstancesPortion:new Uint32Array(inflate(deflatedData.eachEntityPrimitiveInstancesPortion)),eachEntityMatricesPortion:new Uint32Array(inflate(deflatedData.eachEntityMatricesPortion)),eachTileAABB:new Float64Array(inflate(deflatedData.eachTileAABB)),eachTileEntitiesPortion:new Uint32Array(inflate(deflatedData.eachTileEntitiesPortion))};}var decompressColor$4=function(){var floatColor=new Float32Array(3);return function(intColor){floatColor[0]=intColor[0]/255.0;floatColor[1]=intColor[1]/255.0;floatColor[2]=intColor[2]/255.0;return floatColor;};}();function load$4(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx){var modelPartId=manifestCtx.getNextId();var positions=inflatedData.positions;var normals=inflatedData.normals;var indices=inflatedData.indices;var edgeIndices=inflatedData.edgeIndices;var matrices=inflatedData.matrices;var reusedPrimitivesDecodeMatrix=inflatedData.reusedPrimitivesDecodeMatrix;var eachPrimitivePositionsAndNormalsPortion=inflatedData.eachPrimitivePositionsAndNormalsPortion;var eachPrimitiveIndicesPortion=inflatedData.eachPrimitiveIndicesPortion;var eachPrimitiveEdgeIndicesPortion=inflatedData.eachPrimitiveEdgeIndicesPortion;var eachPrimitiveColorAndOpacity=inflatedData.eachPrimitiveColorAndOpacity;var primitiveInstances=inflatedData.primitiveInstances;var eachEntityId=JSON.parse(inflatedData.eachEntityId);var eachEntityPrimitiveInstancesPortion=inflatedData.eachEntityPrimitiveInstancesPortion;var eachEntityMatricesPortion=inflatedData.eachEntityMatricesPortion;var eachTileAABB=inflatedData.eachTileAABB;var eachTileEntitiesPortion=inflatedData.eachTileEntitiesPortion;var numPrimitives=eachPrimitivePositionsAndNormalsPortion.length;var numPrimitiveInstances=primitiveInstances.length;var numEntities=eachEntityId.length;var numTiles=eachTileEntitiesPortion.length;// Count instances of each primitive
24829
24829
  var primitiveReuseCounts=new Uint32Array(numPrimitives);for(var primitiveInstanceIndex=0;primitiveInstanceIndex<numPrimitiveInstances;primitiveInstanceIndex++){var primitiveIndex=primitiveInstances[primitiveInstanceIndex];if(primitiveReuseCounts[primitiveIndex]!==undefined){primitiveReuseCounts[primitiveIndex]++;}else{primitiveReuseCounts[primitiveIndex]=1;}}// Iterate over tiles
24830
24830
  var tileCenter=math.vec3();var rtcAABB=math.AABB3();for(var tileIndex=0;tileIndex<numTiles;tileIndex++){var lastTileIndex=numTiles-1;var atLastTile=tileIndex===lastTileIndex;var firstTileEntityIndex=eachTileEntitiesPortion[tileIndex];var lastTileEntityIndex=atLastTile?numEntities:eachTileEntitiesPortion[tileIndex+1];var tileAABBIndex=tileIndex*6;var tileAABB=eachTileAABB.subarray(tileAABBIndex,tileAABBIndex+6);math.getAABB3Center(tileAABB,tileCenter);rtcAABB[0]=tileAABB[0]-tileCenter[0];rtcAABB[1]=tileAABB[1]-tileCenter[1];rtcAABB[2]=tileAABB[2]-tileCenter[2];rtcAABB[3]=tileAABB[3]-tileCenter[0];rtcAABB[4]=tileAABB[4]-tileCenter[1];rtcAABB[5]=tileAABB[5]-tileCenter[2];var tileDecodeMatrix=geometryCompressionUtils.createPositionsDecodeMatrix(rtcAABB);var geometryCreated={};// Iterate over each tile's entities
24831
24831
  for(var tileEntityIndex=firstTileEntityIndex;tileEntityIndex<lastTileEntityIndex;tileEntityIndex++){var xktEntityId=eachEntityId[tileEntityIndex];var entityId=options.globalizeObjectIds?math.globalizeObjectId(sceneModel.id,xktEntityId):xktEntityId;var entityMatrixIndex=eachEntityMatricesPortion[tileEntityIndex];var entityMatrix=matrices.slice(entityMatrixIndex,entityMatrixIndex+16);var _lastTileEntityIndex=numEntities-1;var atLastTileEntity=tileEntityIndex===_lastTileEntityIndex;var firstPrimitiveInstanceIndex=eachEntityPrimitiveInstancesPortion[tileEntityIndex];var lastPrimitiveInstanceIndex=atLastTileEntity?primitiveInstances.length:eachEntityPrimitiveInstancesPortion[tileEntityIndex+1];var meshIds=[];var metaObject=viewer.metaScene.metaObjects[entityId];var entityDefaults={};var meshDefaults={};if(metaObject){// Mask loading of object types
24832
24832
  if(options.excludeTypesMap&&metaObject.type&&options.excludeTypesMap[metaObject.type]){continue;}if(options.includeTypesMap&&metaObject.type&&!options.includeTypesMap[metaObject.type]){continue;}// Get initial property values for object types
24833
24833
  var props=options.objectDefaults?options.objectDefaults[metaObject.type]||options.objectDefaults["DEFAULT"]:null;if(props){if(props.visible===false){entityDefaults.visible=false;}if(props.pickable===false){entityDefaults.pickable=false;}if(props.colorize){meshDefaults.color=props.colorize;}if(props.opacity!==undefined&&props.opacity!==null){meshDefaults.opacity=props.opacity;}}}else{if(options.excludeUnclassifiedObjects){continue;}}// Iterate each entity's primitive instances
24834
- for(var primitiveInstancesIndex=firstPrimitiveInstanceIndex;primitiveInstancesIndex<lastPrimitiveInstanceIndex;primitiveInstancesIndex++){var _primitiveIndex8=primitiveInstances[primitiveInstancesIndex];var primitiveReuseCount=primitiveReuseCounts[_primitiveIndex8];var isReusedPrimitive=primitiveReuseCount>1;var atLastPrimitive=_primitiveIndex8===numPrimitives-1;var primitivePositions=positions.subarray(eachPrimitivePositionsAndNormalsPortion[_primitiveIndex8],atLastPrimitive?positions.length:eachPrimitivePositionsAndNormalsPortion[_primitiveIndex8+1]);var primitiveNormals=normals.subarray(eachPrimitivePositionsAndNormalsPortion[_primitiveIndex8],atLastPrimitive?normals.length:eachPrimitivePositionsAndNormalsPortion[_primitiveIndex8+1]);var primitiveIndices=indices.subarray(eachPrimitiveIndicesPortion[_primitiveIndex8],atLastPrimitive?indices.length:eachPrimitiveIndicesPortion[_primitiveIndex8+1]);var primitiveEdgeIndices=edgeIndices.subarray(eachPrimitiveEdgeIndicesPortion[_primitiveIndex8],atLastPrimitive?edgeIndices.length:eachPrimitiveEdgeIndicesPortion[_primitiveIndex8+1]);var _color11=decompressColor$4(eachPrimitiveColorAndOpacity.subarray(_primitiveIndex8*4,_primitiveIndex8*4+3));var _opacity6=eachPrimitiveColorAndOpacity[_primitiveIndex8*4+3]/255.0;var meshId=manifestCtx.nextMeshId++;if(isReusedPrimitive){// Create mesh for multi-use primitive - create (or reuse) geometry, create mesh using that geometry
24835
- var geometryId="geometry."+tileIndex+"."+_primitiveIndex8;// These IDs are local to the SceneModel
24834
+ for(var primitiveInstancesIndex=firstPrimitiveInstanceIndex;primitiveInstancesIndex<lastPrimitiveInstanceIndex;primitiveInstancesIndex++){var _primitiveIndex8=primitiveInstances[primitiveInstancesIndex];var primitiveReuseCount=primitiveReuseCounts[_primitiveIndex8];var isReusedPrimitive=primitiveReuseCount>1;var atLastPrimitive=_primitiveIndex8===numPrimitives-1;var primitivePositions=positions.subarray(eachPrimitivePositionsAndNormalsPortion[_primitiveIndex8],atLastPrimitive?positions.length:eachPrimitivePositionsAndNormalsPortion[_primitiveIndex8+1]);var primitiveNormals=normals.subarray(eachPrimitivePositionsAndNormalsPortion[_primitiveIndex8],atLastPrimitive?normals.length:eachPrimitivePositionsAndNormalsPortion[_primitiveIndex8+1]);var primitiveIndices=indices.subarray(eachPrimitiveIndicesPortion[_primitiveIndex8],atLastPrimitive?indices.length:eachPrimitiveIndicesPortion[_primitiveIndex8+1]);var primitiveEdgeIndices=edgeIndices.subarray(eachPrimitiveEdgeIndicesPortion[_primitiveIndex8],atLastPrimitive?edgeIndices.length:eachPrimitiveEdgeIndicesPortion[_primitiveIndex8+1]);var _color11=decompressColor$4(eachPrimitiveColorAndOpacity.subarray(_primitiveIndex8*4,_primitiveIndex8*4+3));var _opacity6=eachPrimitiveColorAndOpacity[_primitiveIndex8*4+3]/255.0;var meshId=manifestCtx.getNextId();if(isReusedPrimitive){// Create mesh for multi-use primitive - create (or reuse) geometry, create mesh using that geometry
24835
+ var geometryId="".concat(modelPartId,"-geometry.").concat(tileIndex,".").concat(_primitiveIndex8);// These IDs are local to the SceneModel
24836
24836
  if(!geometryCreated[geometryId]){sceneModel.createGeometry({id:geometryId,primitive:"triangles",positionsCompressed:primitivePositions,// normalsCompressed: primitiveNormals,
24837
24837
  indices:primitiveIndices,edgeIndices:primitiveEdgeIndices,positionsDecodeMatrix:reusedPrimitivesDecodeMatrix});geometryCreated[geometryId]=true;}sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,geometryId:geometryId,origin:tileCenter,matrix:entityMatrix,color:_color11,opacity:_opacity6}));meshIds.push(meshId);}else{sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,origin:tileCenter,primitive:"triangles",positionsCompressed:primitivePositions,normalsCompressed:primitiveNormals,indices:primitiveIndices,edgeIndices:primitiveEdgeIndices,positionsDecodeMatrix:tileDecodeMatrix,color:_color11,opacity:_opacity6}));meshIds.push(meshId);}}if(meshIds.length>0){sceneModel.createEntity(utils.apply(entityDefaults,{id:entityId,isObject:true,meshIds:meshIds}));}}}}/** @private */var ParserV6={version:6,parse:function parse(viewer,options,elements,sceneModel,metaModel,manifestCtx){var deflatedData=extract$4(elements);var inflatedData=inflate$4(deflatedData);load$4(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx);}};/*
24838
24838
 
@@ -24845,14 +24845,14 @@ indices:elements[3],edgeIndices:elements[4],// Transform matrices
24845
24845
  matrices:elements[5],reusedGeometriesDecodeMatrix:elements[6],// Geometries
24846
24846
  eachGeometryPrimitiveType:elements[7],eachGeometryPositionsPortion:elements[8],eachGeometryNormalsPortion:elements[9],eachGeometryColorsPortion:elements[10],eachGeometryIndicesPortion:elements[11],eachGeometryEdgeIndicesPortion:elements[12],// Meshes are grouped in runs that are shared by the same entities
24847
24847
  eachMeshGeometriesPortion:elements[13],eachMeshMatricesPortion:elements[14],eachMeshMaterial:elements[15],// Entity elements in the following arrays are grouped in runs that are shared by the same tiles
24848
- eachEntityId:elements[16],eachEntityMeshesPortion:elements[17],eachTileAABB:elements[18],eachTileEntitiesPortion:elements[19]};}function inflate$3(deflatedData){function inflate(array,options){return array.length===0?[]:pako$3.inflate(array,options).buffer;}return{positions:new Uint16Array(inflate(deflatedData.positions)),normals:new Int8Array(inflate(deflatedData.normals)),colors:new Uint8Array(inflate(deflatedData.colors)),indices:new Uint32Array(inflate(deflatedData.indices)),edgeIndices:new Uint32Array(inflate(deflatedData.edgeIndices)),matrices:new Float32Array(inflate(deflatedData.matrices)),reusedGeometriesDecodeMatrix:new Float32Array(inflate(deflatedData.reusedGeometriesDecodeMatrix)),eachGeometryPrimitiveType:new Uint8Array(inflate(deflatedData.eachGeometryPrimitiveType)),eachGeometryPositionsPortion:new Uint32Array(inflate(deflatedData.eachGeometryPositionsPortion)),eachGeometryNormalsPortion:new Uint32Array(inflate(deflatedData.eachGeometryNormalsPortion)),eachGeometryColorsPortion:new Uint32Array(inflate(deflatedData.eachGeometryColorsPortion)),eachGeometryIndicesPortion:new Uint32Array(inflate(deflatedData.eachGeometryIndicesPortion)),eachGeometryEdgeIndicesPortion:new Uint32Array(inflate(deflatedData.eachGeometryEdgeIndicesPortion)),eachMeshGeometriesPortion:new Uint32Array(inflate(deflatedData.eachMeshGeometriesPortion)),eachMeshMatricesPortion:new Uint32Array(inflate(deflatedData.eachMeshMatricesPortion)),eachMeshMaterial:new Uint8Array(inflate(deflatedData.eachMeshMaterial)),eachEntityId:pako$3.inflate(deflatedData.eachEntityId,{to:'string'}),eachEntityMeshesPortion:new Uint32Array(inflate(deflatedData.eachEntityMeshesPortion)),eachTileAABB:new Float64Array(inflate(deflatedData.eachTileAABB)),eachTileEntitiesPortion:new Uint32Array(inflate(deflatedData.eachTileEntitiesPortion))};}var decompressColor$3=function(){var floatColor=new Float32Array(3);return function(intColor){floatColor[0]=intColor[0]/255.0;floatColor[1]=intColor[1]/255.0;floatColor[2]=intColor[2]/255.0;return floatColor;};}();function convertColorsRGBToRGBA$1(colorsRGB){var colorsRGBA=[];for(var _i535=0,len=colorsRGB.length;_i535<len;_i535+=3){colorsRGBA.push(colorsRGB[_i535]);colorsRGBA.push(colorsRGB[_i535+1]);colorsRGBA.push(colorsRGB[_i535+2]);colorsRGBA.push(1.0);}return colorsRGBA;}function load$3(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx){var positions=inflatedData.positions;var normals=inflatedData.normals;var colors=inflatedData.colors;var indices=inflatedData.indices;var edgeIndices=inflatedData.edgeIndices;var matrices=inflatedData.matrices;var reusedGeometriesDecodeMatrix=inflatedData.reusedGeometriesDecodeMatrix;var eachGeometryPrimitiveType=inflatedData.eachGeometryPrimitiveType;var eachGeometryPositionsPortion=inflatedData.eachGeometryPositionsPortion;var eachGeometryNormalsPortion=inflatedData.eachGeometryNormalsPortion;var eachGeometryColorsPortion=inflatedData.eachGeometryColorsPortion;var eachGeometryIndicesPortion=inflatedData.eachGeometryIndicesPortion;var eachGeometryEdgeIndicesPortion=inflatedData.eachGeometryEdgeIndicesPortion;var eachMeshGeometriesPortion=inflatedData.eachMeshGeometriesPortion;var eachMeshMatricesPortion=inflatedData.eachMeshMatricesPortion;var eachMeshMaterial=inflatedData.eachMeshMaterial;var eachEntityId=JSON.parse(inflatedData.eachEntityId);var eachEntityMeshesPortion=inflatedData.eachEntityMeshesPortion;var eachTileAABB=inflatedData.eachTileAABB;var eachTileEntitiesPortion=inflatedData.eachTileEntitiesPortion;var numGeometries=eachGeometryPositionsPortion.length;var numMeshes=eachMeshGeometriesPortion.length;var numEntities=eachEntityId.length;var numTiles=eachTileEntitiesPortion.length;// Count instances of each geometry
24848
+ eachEntityId:elements[16],eachEntityMeshesPortion:elements[17],eachTileAABB:elements[18],eachTileEntitiesPortion:elements[19]};}function inflate$3(deflatedData){function inflate(array,options){return array.length===0?[]:pako$3.inflate(array,options).buffer;}return{positions:new Uint16Array(inflate(deflatedData.positions)),normals:new Int8Array(inflate(deflatedData.normals)),colors:new Uint8Array(inflate(deflatedData.colors)),indices:new Uint32Array(inflate(deflatedData.indices)),edgeIndices:new Uint32Array(inflate(deflatedData.edgeIndices)),matrices:new Float32Array(inflate(deflatedData.matrices)),reusedGeometriesDecodeMatrix:new Float32Array(inflate(deflatedData.reusedGeometriesDecodeMatrix)),eachGeometryPrimitiveType:new Uint8Array(inflate(deflatedData.eachGeometryPrimitiveType)),eachGeometryPositionsPortion:new Uint32Array(inflate(deflatedData.eachGeometryPositionsPortion)),eachGeometryNormalsPortion:new Uint32Array(inflate(deflatedData.eachGeometryNormalsPortion)),eachGeometryColorsPortion:new Uint32Array(inflate(deflatedData.eachGeometryColorsPortion)),eachGeometryIndicesPortion:new Uint32Array(inflate(deflatedData.eachGeometryIndicesPortion)),eachGeometryEdgeIndicesPortion:new Uint32Array(inflate(deflatedData.eachGeometryEdgeIndicesPortion)),eachMeshGeometriesPortion:new Uint32Array(inflate(deflatedData.eachMeshGeometriesPortion)),eachMeshMatricesPortion:new Uint32Array(inflate(deflatedData.eachMeshMatricesPortion)),eachMeshMaterial:new Uint8Array(inflate(deflatedData.eachMeshMaterial)),eachEntityId:pako$3.inflate(deflatedData.eachEntityId,{to:'string'}),eachEntityMeshesPortion:new Uint32Array(inflate(deflatedData.eachEntityMeshesPortion)),eachTileAABB:new Float64Array(inflate(deflatedData.eachTileAABB)),eachTileEntitiesPortion:new Uint32Array(inflate(deflatedData.eachTileEntitiesPortion))};}var decompressColor$3=function(){var floatColor=new Float32Array(3);return function(intColor){floatColor[0]=intColor[0]/255.0;floatColor[1]=intColor[1]/255.0;floatColor[2]=intColor[2]/255.0;return floatColor;};}();function convertColorsRGBToRGBA$1(colorsRGB){var colorsRGBA=[];for(var _i535=0,len=colorsRGB.length;_i535<len;_i535+=3){colorsRGBA.push(colorsRGB[_i535]);colorsRGBA.push(colorsRGB[_i535+1]);colorsRGBA.push(colorsRGB[_i535+2]);colorsRGBA.push(1.0);}return colorsRGBA;}function load$3(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx){var modelPartId=manifestCtx.getNextId();var positions=inflatedData.positions;var normals=inflatedData.normals;var colors=inflatedData.colors;var indices=inflatedData.indices;var edgeIndices=inflatedData.edgeIndices;var matrices=inflatedData.matrices;var reusedGeometriesDecodeMatrix=inflatedData.reusedGeometriesDecodeMatrix;var eachGeometryPrimitiveType=inflatedData.eachGeometryPrimitiveType;var eachGeometryPositionsPortion=inflatedData.eachGeometryPositionsPortion;var eachGeometryNormalsPortion=inflatedData.eachGeometryNormalsPortion;var eachGeometryColorsPortion=inflatedData.eachGeometryColorsPortion;var eachGeometryIndicesPortion=inflatedData.eachGeometryIndicesPortion;var eachGeometryEdgeIndicesPortion=inflatedData.eachGeometryEdgeIndicesPortion;var eachMeshGeometriesPortion=inflatedData.eachMeshGeometriesPortion;var eachMeshMatricesPortion=inflatedData.eachMeshMatricesPortion;var eachMeshMaterial=inflatedData.eachMeshMaterial;var eachEntityId=JSON.parse(inflatedData.eachEntityId);var eachEntityMeshesPortion=inflatedData.eachEntityMeshesPortion;var eachTileAABB=inflatedData.eachTileAABB;var eachTileEntitiesPortion=inflatedData.eachTileEntitiesPortion;var numGeometries=eachGeometryPositionsPortion.length;var numMeshes=eachMeshGeometriesPortion.length;var numEntities=eachEntityId.length;var numTiles=eachTileEntitiesPortion.length;// Count instances of each geometry
24849
24849
  var geometryReuseCounts=new Uint32Array(numGeometries);for(var meshIndex=0;meshIndex<numMeshes;meshIndex++){var geometryIndex=eachMeshGeometriesPortion[meshIndex];if(geometryReuseCounts[geometryIndex]!==undefined){geometryReuseCounts[geometryIndex]++;}else{geometryReuseCounts[geometryIndex]=1;}}// Iterate over tiles
24850
24850
  var tileCenter=math.vec3();var rtcAABB=math.AABB3();for(var tileIndex=0;tileIndex<numTiles;tileIndex++){var lastTileIndex=numTiles-1;var atLastTile=tileIndex===lastTileIndex;var firstTileEntityIndex=eachTileEntitiesPortion[tileIndex];var lastTileEntityIndex=atLastTile?numEntities:eachTileEntitiesPortion[tileIndex+1];var tileAABBIndex=tileIndex*6;var tileAABB=eachTileAABB.subarray(tileAABBIndex,tileAABBIndex+6);math.getAABB3Center(tileAABB,tileCenter);rtcAABB[0]=tileAABB[0]-tileCenter[0];rtcAABB[1]=tileAABB[1]-tileCenter[1];rtcAABB[2]=tileAABB[2]-tileCenter[2];rtcAABB[3]=tileAABB[3]-tileCenter[0];rtcAABB[4]=tileAABB[4]-tileCenter[1];rtcAABB[5]=tileAABB[5]-tileCenter[2];var tileDecodeMatrix=geometryCompressionUtils.createPositionsDecodeMatrix(rtcAABB);var geometryCreated={};// Iterate over each tile's entities
24851
24851
  for(var tileEntityIndex=firstTileEntityIndex;tileEntityIndex<lastTileEntityIndex;tileEntityIndex++){var xktEntityId=eachEntityId[tileEntityIndex];var entityId=options.globalizeObjectIds?math.globalizeObjectId(sceneModel.id,xktEntityId):xktEntityId;var _lastTileEntityIndex2=numEntities-1;var atLastTileEntity=tileEntityIndex===_lastTileEntityIndex2;var firstMeshIndex=eachEntityMeshesPortion[tileEntityIndex];var lastMeshIndex=atLastTileEntity?eachMeshGeometriesPortion.length:eachEntityMeshesPortion[tileEntityIndex+1];var meshIds=[];var metaObject=viewer.metaScene.metaObjects[entityId];var entityDefaults={};var meshDefaults={};if(metaObject){// Mask loading of object types
24852
24852
  if(options.excludeTypesMap&&metaObject.type&&options.excludeTypesMap[metaObject.type]){continue;}if(options.includeTypesMap&&metaObject.type&&!options.includeTypesMap[metaObject.type]){continue;}// Get initial property values for object types
24853
24853
  var props=options.objectDefaults?options.objectDefaults[metaObject.type]||options.objectDefaults["DEFAULT"]:null;if(props){if(props.visible===false){entityDefaults.visible=false;}if(props.pickable===false){entityDefaults.pickable=false;}if(props.colorize){meshDefaults.color=props.colorize;}if(props.opacity!==undefined&&props.opacity!==null){meshDefaults.opacity=props.opacity;}if(props.metallic!==undefined&&props.metallic!==null){meshDefaults.metallic=props.metallic;}if(props.roughness!==undefined&&props.roughness!==null){meshDefaults.roughness=props.roughness;}}}else{if(options.excludeUnclassifiedObjects){continue;}}// Iterate each entity's meshes
24854
- for(var _meshIndex2=firstMeshIndex;_meshIndex2<lastMeshIndex;_meshIndex2++){var _geometryIndex=eachMeshGeometriesPortion[_meshIndex2];var geometryReuseCount=geometryReuseCounts[_geometryIndex];var isReusedGeometry=geometryReuseCount>1;var atLastGeometry=_geometryIndex===numGeometries-1;var meshColor=decompressColor$3(eachMeshMaterial.subarray(_meshIndex2*6,_meshIndex2*6+3));var meshOpacity=eachMeshMaterial[_meshIndex2*6+3]/255.0;var meshMetallic=eachMeshMaterial[_meshIndex2*6+4]/255.0;var meshRoughness=eachMeshMaterial[_meshIndex2*6+5]/255.0;var meshId=manifestCtx.nextMeshId++;if(isReusedGeometry){// Create mesh for multi-use geometry - create (or reuse) geometry, create mesh using that geometry
24855
- var meshMatrixIndex=eachMeshMatricesPortion[_meshIndex2];var meshMatrix=matrices.slice(meshMatrixIndex,meshMatrixIndex+16);var geometryId="geometry."+tileIndex+"."+_geometryIndex;// These IDs are local to the SceneModel
24854
+ for(var _meshIndex2=firstMeshIndex;_meshIndex2<lastMeshIndex;_meshIndex2++){var _geometryIndex=eachMeshGeometriesPortion[_meshIndex2];var geometryReuseCount=geometryReuseCounts[_geometryIndex];var isReusedGeometry=geometryReuseCount>1;var atLastGeometry=_geometryIndex===numGeometries-1;var meshColor=decompressColor$3(eachMeshMaterial.subarray(_meshIndex2*6,_meshIndex2*6+3));var meshOpacity=eachMeshMaterial[_meshIndex2*6+3]/255.0;var meshMetallic=eachMeshMaterial[_meshIndex2*6+4]/255.0;var meshRoughness=eachMeshMaterial[_meshIndex2*6+5]/255.0;var meshId=manifestCtx.getNextId();if(isReusedGeometry){// Create mesh for multi-use geometry - create (or reuse) geometry, create mesh using that geometry
24855
+ var meshMatrixIndex=eachMeshMatricesPortion[_meshIndex2];var meshMatrix=matrices.slice(meshMatrixIndex,meshMatrixIndex+16);var geometryId="".concat(modelPartId,"-geometry.").concat(tileIndex,".").concat(_geometryIndex);// These IDs are local to the SceneModel
24856
24856
  if(!geometryCreated[geometryId]){var primitiveType=eachGeometryPrimitiveType[_geometryIndex];var primitiveName=void 0;var geometryPositions=void 0;var geometryNormals=void 0;var geometryColors=void 0;var geometryIndices=void 0;var geometryEdgeIndices=void 0;switch(primitiveType){case 0:primitiveName="solid";geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]);geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex+1]);break;case 1:primitiveName="surface";geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]);geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex+1]);break;case 2:primitiveName="points";geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryColors=convertColorsRGBToRGBA$1(colors.subarray(eachGeometryColorsPortion[_geometryIndex],atLastGeometry?colors.length:eachGeometryColorsPortion[_geometryIndex+1]));break;case 3:primitiveName="lines";geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]);break;default:continue;}sceneModel.createGeometry({id:geometryId,primitive:primitiveName,positionsCompressed:geometryPositions,normalsCompressed:geometryNormals,colors:geometryColors,indices:geometryIndices,edgeIndices:geometryEdgeIndices,positionsDecodeMatrix:reusedGeometriesDecodeMatrix});geometryCreated[geometryId]=true;}sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,geometryId:geometryId,origin:tileCenter,matrix:meshMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity}));meshIds.push(meshId);}else{var _primitiveType=eachGeometryPrimitiveType[_geometryIndex];var _primitiveName=void 0;var _geometryPositions=void 0;var _geometryNormals=void 0;var _geometryColors=void 0;var _geometryIndices=void 0;var _geometryEdgeIndices=void 0;switch(_primitiveType){case 0:_primitiveName="solid";_geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);_geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex+1]);_geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]);_geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex+1]);break;case 1:_primitiveName="surface";_geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);_geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex+1]);_geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]);_geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex+1]);break;case 2:_primitiveName="points";_geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);_geometryColors=convertColorsRGBToRGBA$1(colors.subarray(eachGeometryColorsPortion[_geometryIndex],atLastGeometry?colors.length:eachGeometryColorsPortion[_geometryIndex+1]));break;case 3:_primitiveName="lines";_geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);_geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]);break;default:continue;}sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,origin:tileCenter,primitive:_primitiveName,positionsCompressed:_geometryPositions,normalsCompressed:_geometryNormals,colors:_geometryColors,indices:_geometryIndices,edgeIndices:_geometryEdgeIndices,positionsDecodeMatrix:tileDecodeMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity}));meshIds.push(meshId);}}if(meshIds.length>0){sceneModel.createEntity(utils.apply(entityDefaults,{id:entityId,isObject:true,meshIds:meshIds}));}}}}/** @private */var ParserV7={version:7,parse:function parse(viewer,options,elements,sceneModel,metaModel,manifestCtx){var deflatedData=extract$3(elements);var inflatedData=inflate$3(deflatedData);load$3(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx);}};/*
24857
24857
 
24858
24858
  Parser for .XKT Format V8
@@ -24863,14 +24863,14 @@ types:elements[0],eachMetaObjectId:elements[1],eachMetaObjectType:elements[2],ea
24863
24863
  matrices:elements[10],reusedGeometriesDecodeMatrix:elements[11],// Geometries
24864
24864
  eachGeometryPrimitiveType:elements[12],eachGeometryPositionsPortion:elements[13],eachGeometryNormalsPortion:elements[14],eachGeometryColorsPortion:elements[15],eachGeometryIndicesPortion:elements[16],eachGeometryEdgeIndicesPortion:elements[17],// Meshes are grouped in runs that are shared by the same entities
24865
24865
  eachMeshGeometriesPortion:elements[18],eachMeshMatricesPortion:elements[19],eachMeshMaterial:elements[20],// Entity elements in the following arrays are grouped in runs that are shared by the same tiles
24866
- eachEntityMetaObject:elements[21],eachEntityMeshesPortion:elements[22],eachTileAABB:elements[23],eachTileEntitiesPortion:elements[24]};}function inflate$2(deflatedData){function inflate(array,options){return array.length===0?[]:pako$2.inflate(array,options).buffer;}return{types:pako$2.inflate(deflatedData.types,{to:'string'}),eachMetaObjectId:pako$2.inflate(deflatedData.eachMetaObjectId,{to:'string'}),eachMetaObjectType:new Uint32Array(inflate(deflatedData.eachMetaObjectType)),eachMetaObjectName:pako$2.inflate(deflatedData.eachMetaObjectName,{to:'string'}),eachMetaObjectParent:new Uint32Array(inflate(deflatedData.eachMetaObjectParent)),positions:new Uint16Array(inflate(deflatedData.positions)),normals:new Int8Array(inflate(deflatedData.normals)),colors:new Uint8Array(inflate(deflatedData.colors)),indices:new Uint32Array(inflate(deflatedData.indices)),edgeIndices:new Uint32Array(inflate(deflatedData.edgeIndices)),matrices:new Float32Array(inflate(deflatedData.matrices)),reusedGeometriesDecodeMatrix:new Float32Array(inflate(deflatedData.reusedGeometriesDecodeMatrix)),eachGeometryPrimitiveType:new Uint8Array(inflate(deflatedData.eachGeometryPrimitiveType)),eachGeometryPositionsPortion:new Uint32Array(inflate(deflatedData.eachGeometryPositionsPortion)),eachGeometryNormalsPortion:new Uint32Array(inflate(deflatedData.eachGeometryNormalsPortion)),eachGeometryColorsPortion:new Uint32Array(inflate(deflatedData.eachGeometryColorsPortion)),eachGeometryIndicesPortion:new Uint32Array(inflate(deflatedData.eachGeometryIndicesPortion)),eachGeometryEdgeIndicesPortion:new Uint32Array(inflate(deflatedData.eachGeometryEdgeIndicesPortion)),eachMeshGeometriesPortion:new Uint32Array(inflate(deflatedData.eachMeshGeometriesPortion)),eachMeshMatricesPortion:new Uint32Array(inflate(deflatedData.eachMeshMatricesPortion)),eachMeshMaterial:new Uint8Array(inflate(deflatedData.eachMeshMaterial)),eachEntityMetaObject:new Uint32Array(inflate(deflatedData.eachEntityMetaObject)),eachEntityMeshesPortion:new Uint32Array(inflate(deflatedData.eachEntityMeshesPortion)),eachTileAABB:new Float64Array(inflate(deflatedData.eachTileAABB)),eachTileEntitiesPortion:new Uint32Array(inflate(deflatedData.eachTileEntitiesPortion))};}var decompressColor$2=function(){var floatColor=new Float32Array(3);return function(intColor){floatColor[0]=intColor[0]/255.0;floatColor[1]=intColor[1]/255.0;floatColor[2]=intColor[2]/255.0;return floatColor;};}();function convertColorsRGBToRGBA(colorsRGB){var colorsRGBA=[];for(var _i536=0,len=colorsRGB.length;_i536<len;_i536+=3){colorsRGBA.push(colorsRGB[_i536]);colorsRGBA.push(colorsRGB[_i536+1]);colorsRGBA.push(colorsRGB[_i536+2]);colorsRGBA.push(1.0);}return colorsRGBA;}function load$2(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx){var types=JSON.parse(inflatedData.types);var eachMetaObjectId=JSON.parse(inflatedData.eachMetaObjectId);var eachMetaObjectType=inflatedData.eachMetaObjectType;var eachMetaObjectName=JSON.parse(inflatedData.eachMetaObjectName);var eachMetaObjectParent=inflatedData.eachMetaObjectParent;var positions=inflatedData.positions;var normals=inflatedData.normals;var colors=inflatedData.colors;var indices=inflatedData.indices;var edgeIndices=inflatedData.edgeIndices;var matrices=inflatedData.matrices;var reusedGeometriesDecodeMatrix=inflatedData.reusedGeometriesDecodeMatrix;var eachGeometryPrimitiveType=inflatedData.eachGeometryPrimitiveType;var eachGeometryPositionsPortion=inflatedData.eachGeometryPositionsPortion;var eachGeometryNormalsPortion=inflatedData.eachGeometryNormalsPortion;var eachGeometryColorsPortion=inflatedData.eachGeometryColorsPortion;var eachGeometryIndicesPortion=inflatedData.eachGeometryIndicesPortion;var eachGeometryEdgeIndicesPortion=inflatedData.eachGeometryEdgeIndicesPortion;var eachMeshGeometriesPortion=inflatedData.eachMeshGeometriesPortion;var eachMeshMatricesPortion=inflatedData.eachMeshMatricesPortion;var eachMeshMaterial=inflatedData.eachMeshMaterial;var eachEntityMetaObject=inflatedData.eachEntityMetaObject;var eachEntityMeshesPortion=inflatedData.eachEntityMeshesPortion;var eachTileAABB=inflatedData.eachTileAABB;var eachTileEntitiesPortion=inflatedData.eachTileEntitiesPortion;var numMetaObjects=eachMetaObjectId.length;var numGeometries=eachGeometryPositionsPortion.length;var numMeshes=eachMeshGeometriesPortion.length;var numEntities=eachEntityMetaObject.length;var numTiles=eachTileEntitiesPortion.length;if(metaModel){var metaModelData={metaObjects:[]};for(var metaObjectIndex=0;metaObjectIndex<numMetaObjects;metaObjectIndex++){var metaObjectId=eachMetaObjectId[metaObjectIndex];var typeIndex=eachMetaObjectType[metaObjectIndex];var metaObjectType=types[typeIndex]||"default";var metaObjectName=eachMetaObjectName[metaObjectIndex];var metaObjectParentIndex=eachMetaObjectParent[metaObjectIndex];var metaObjectParentId=metaObjectParentIndex!==metaObjectIndex?eachMetaObjectId[metaObjectParentIndex]:null;metaModelData.metaObjects.push({id:metaObjectId,type:metaObjectType,name:metaObjectName,parent:metaObjectParentId});}metaModel.loadData(metaModelData,{includeTypes:options.includeTypes,excludeTypes:options.excludeTypes,globalizeObjectIds:options.globalizeObjectIds});}// Count instances of each geometry
24866
+ eachEntityMetaObject:elements[21],eachEntityMeshesPortion:elements[22],eachTileAABB:elements[23],eachTileEntitiesPortion:elements[24]};}function inflate$2(deflatedData){function inflate(array,options){return array.length===0?[]:pako$2.inflate(array,options).buffer;}return{types:pako$2.inflate(deflatedData.types,{to:'string'}),eachMetaObjectId:pako$2.inflate(deflatedData.eachMetaObjectId,{to:'string'}),eachMetaObjectType:new Uint32Array(inflate(deflatedData.eachMetaObjectType)),eachMetaObjectName:pako$2.inflate(deflatedData.eachMetaObjectName,{to:'string'}),eachMetaObjectParent:new Uint32Array(inflate(deflatedData.eachMetaObjectParent)),positions:new Uint16Array(inflate(deflatedData.positions)),normals:new Int8Array(inflate(deflatedData.normals)),colors:new Uint8Array(inflate(deflatedData.colors)),indices:new Uint32Array(inflate(deflatedData.indices)),edgeIndices:new Uint32Array(inflate(deflatedData.edgeIndices)),matrices:new Float32Array(inflate(deflatedData.matrices)),reusedGeometriesDecodeMatrix:new Float32Array(inflate(deflatedData.reusedGeometriesDecodeMatrix)),eachGeometryPrimitiveType:new Uint8Array(inflate(deflatedData.eachGeometryPrimitiveType)),eachGeometryPositionsPortion:new Uint32Array(inflate(deflatedData.eachGeometryPositionsPortion)),eachGeometryNormalsPortion:new Uint32Array(inflate(deflatedData.eachGeometryNormalsPortion)),eachGeometryColorsPortion:new Uint32Array(inflate(deflatedData.eachGeometryColorsPortion)),eachGeometryIndicesPortion:new Uint32Array(inflate(deflatedData.eachGeometryIndicesPortion)),eachGeometryEdgeIndicesPortion:new Uint32Array(inflate(deflatedData.eachGeometryEdgeIndicesPortion)),eachMeshGeometriesPortion:new Uint32Array(inflate(deflatedData.eachMeshGeometriesPortion)),eachMeshMatricesPortion:new Uint32Array(inflate(deflatedData.eachMeshMatricesPortion)),eachMeshMaterial:new Uint8Array(inflate(deflatedData.eachMeshMaterial)),eachEntityMetaObject:new Uint32Array(inflate(deflatedData.eachEntityMetaObject)),eachEntityMeshesPortion:new Uint32Array(inflate(deflatedData.eachEntityMeshesPortion)),eachTileAABB:new Float64Array(inflate(deflatedData.eachTileAABB)),eachTileEntitiesPortion:new Uint32Array(inflate(deflatedData.eachTileEntitiesPortion))};}var decompressColor$2=function(){var floatColor=new Float32Array(3);return function(intColor){floatColor[0]=intColor[0]/255.0;floatColor[1]=intColor[1]/255.0;floatColor[2]=intColor[2]/255.0;return floatColor;};}();function convertColorsRGBToRGBA(colorsRGB){var colorsRGBA=[];for(var _i536=0,len=colorsRGB.length;_i536<len;_i536+=3){colorsRGBA.push(colorsRGB[_i536]);colorsRGBA.push(colorsRGB[_i536+1]);colorsRGBA.push(colorsRGB[_i536+2]);colorsRGBA.push(1.0);}return colorsRGBA;}function load$2(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx){var modelPartId=manifestCtx.getNextId();var types=JSON.parse(inflatedData.types);var eachMetaObjectId=JSON.parse(inflatedData.eachMetaObjectId);var eachMetaObjectType=inflatedData.eachMetaObjectType;var eachMetaObjectName=JSON.parse(inflatedData.eachMetaObjectName);var eachMetaObjectParent=inflatedData.eachMetaObjectParent;var positions=inflatedData.positions;var normals=inflatedData.normals;var colors=inflatedData.colors;var indices=inflatedData.indices;var edgeIndices=inflatedData.edgeIndices;var matrices=inflatedData.matrices;var reusedGeometriesDecodeMatrix=inflatedData.reusedGeometriesDecodeMatrix;var eachGeometryPrimitiveType=inflatedData.eachGeometryPrimitiveType;var eachGeometryPositionsPortion=inflatedData.eachGeometryPositionsPortion;var eachGeometryNormalsPortion=inflatedData.eachGeometryNormalsPortion;var eachGeometryColorsPortion=inflatedData.eachGeometryColorsPortion;var eachGeometryIndicesPortion=inflatedData.eachGeometryIndicesPortion;var eachGeometryEdgeIndicesPortion=inflatedData.eachGeometryEdgeIndicesPortion;var eachMeshGeometriesPortion=inflatedData.eachMeshGeometriesPortion;var eachMeshMatricesPortion=inflatedData.eachMeshMatricesPortion;var eachMeshMaterial=inflatedData.eachMeshMaterial;var eachEntityMetaObject=inflatedData.eachEntityMetaObject;var eachEntityMeshesPortion=inflatedData.eachEntityMeshesPortion;var eachTileAABB=inflatedData.eachTileAABB;var eachTileEntitiesPortion=inflatedData.eachTileEntitiesPortion;var numMetaObjects=eachMetaObjectId.length;var numGeometries=eachGeometryPositionsPortion.length;var numMeshes=eachMeshGeometriesPortion.length;var numEntities=eachEntityMetaObject.length;var numTiles=eachTileEntitiesPortion.length;if(metaModel){var metaModelData={metaObjects:[]};for(var metaObjectIndex=0;metaObjectIndex<numMetaObjects;metaObjectIndex++){var metaObjectId=eachMetaObjectId[metaObjectIndex];var typeIndex=eachMetaObjectType[metaObjectIndex];var metaObjectType=types[typeIndex]||"default";var metaObjectName=eachMetaObjectName[metaObjectIndex];var metaObjectParentIndex=eachMetaObjectParent[metaObjectIndex];var metaObjectParentId=metaObjectParentIndex!==metaObjectIndex?eachMetaObjectId[metaObjectParentIndex]:null;metaModelData.metaObjects.push({id:metaObjectId,type:metaObjectType,name:metaObjectName,parent:metaObjectParentId});}metaModel.loadData(metaModelData,{includeTypes:options.includeTypes,excludeTypes:options.excludeTypes,globalizeObjectIds:options.globalizeObjectIds});}// Count instances of each geometry
24867
24867
  var geometryReuseCounts=new Uint32Array(numGeometries);for(var meshIndex=0;meshIndex<numMeshes;meshIndex++){var geometryIndex=eachMeshGeometriesPortion[meshIndex];if(geometryReuseCounts[geometryIndex]!==undefined){geometryReuseCounts[geometryIndex]++;}else{geometryReuseCounts[geometryIndex]=1;}}// Iterate over tiles
24868
24868
  var tileCenter=math.vec3();var rtcAABB=math.AABB3();var geometryArraysCache={};for(var tileIndex=0;tileIndex<numTiles;tileIndex++){var lastTileIndex=numTiles-1;var atLastTile=tileIndex===lastTileIndex;var firstTileEntityIndex=eachTileEntitiesPortion[tileIndex];var lastTileEntityIndex=atLastTile?numEntities:eachTileEntitiesPortion[tileIndex+1];var tileAABBIndex=tileIndex*6;var tileAABB=eachTileAABB.subarray(tileAABBIndex,tileAABBIndex+6);math.getAABB3Center(tileAABB,tileCenter);rtcAABB[0]=tileAABB[0]-tileCenter[0];rtcAABB[1]=tileAABB[1]-tileCenter[1];rtcAABB[2]=tileAABB[2]-tileCenter[2];rtcAABB[3]=tileAABB[3]-tileCenter[0];rtcAABB[4]=tileAABB[4]-tileCenter[1];rtcAABB[5]=tileAABB[5]-tileCenter[2];var tileDecodeMatrix=geometryCompressionUtils.createPositionsDecodeMatrix(rtcAABB);var geometryCreatedInTile={};// Iterate over each tile's entities
24869
24869
  for(var tileEntityIndex=firstTileEntityIndex;tileEntityIndex<lastTileEntityIndex;tileEntityIndex++){var xktMetaObjectIndex=eachEntityMetaObject[tileEntityIndex];var xktMetaObjectId=eachMetaObjectId[xktMetaObjectIndex];var xktEntityId=xktMetaObjectId;var entityId=options.globalizeObjectIds?math.globalizeObjectId(sceneModel.id,xktEntityId):xktEntityId;var _lastTileEntityIndex3=numEntities-1;var atLastTileEntity=tileEntityIndex===_lastTileEntityIndex3;var firstMeshIndex=eachEntityMeshesPortion[tileEntityIndex];var lastMeshIndex=atLastTileEntity?eachMeshGeometriesPortion.length:eachEntityMeshesPortion[tileEntityIndex+1];var meshIds=[];var metaObject=viewer.metaScene.metaObjects[entityId];var entityDefaults={};var meshDefaults={};if(metaObject){// Mask loading of object types
24870
24870
  if(options.excludeTypesMap&&metaObject.type&&options.excludeTypesMap[metaObject.type]){continue;}if(options.includeTypesMap&&metaObject.type&&!options.includeTypesMap[metaObject.type]){continue;}// Get initial property values for object types
24871
24871
  var props=options.objectDefaults?options.objectDefaults[metaObject.type]||options.objectDefaults["DEFAULT"]:null;if(props){if(props.visible===false){entityDefaults.visible=false;}if(props.pickable===false){entityDefaults.pickable=false;}if(props.colorize){meshDefaults.color=props.colorize;}if(props.opacity!==undefined&&props.opacity!==null){meshDefaults.opacity=props.opacity;}if(props.metallic!==undefined&&props.metallic!==null){meshDefaults.metallic=props.metallic;}if(props.roughness!==undefined&&props.roughness!==null){meshDefaults.roughness=props.roughness;}}}else{if(options.excludeUnclassifiedObjects){continue;}}// Iterate each entity's meshes
24872
- for(var _meshIndex3=firstMeshIndex;_meshIndex3<lastMeshIndex;_meshIndex3++){var _geometryIndex2=eachMeshGeometriesPortion[_meshIndex3];var geometryReuseCount=geometryReuseCounts[_geometryIndex2];var isReusedGeometry=geometryReuseCount>1;var atLastGeometry=_geometryIndex2===numGeometries-1;var meshColor=decompressColor$2(eachMeshMaterial.subarray(_meshIndex3*6,_meshIndex3*6+3));var meshOpacity=eachMeshMaterial[_meshIndex3*6+3]/255.0;var meshMetallic=eachMeshMaterial[_meshIndex3*6+4]/255.0;var meshRoughness=eachMeshMaterial[_meshIndex3*6+5]/255.0;var meshId=manifestCtx.nextMeshId++;if(isReusedGeometry){// Create mesh for multi-use geometry - create (or reuse) geometry, create mesh using that geometry
24873
- var meshMatrixIndex=eachMeshMatricesPortion[_meshIndex3];var meshMatrix=matrices.slice(meshMatrixIndex,meshMatrixIndex+16);var geometryId="geometry."+tileIndex+"."+_geometryIndex2;// These IDs are local to the SceneModel
24872
+ for(var _meshIndex3=firstMeshIndex;_meshIndex3<lastMeshIndex;_meshIndex3++){var _geometryIndex2=eachMeshGeometriesPortion[_meshIndex3];var geometryReuseCount=geometryReuseCounts[_geometryIndex2];var isReusedGeometry=geometryReuseCount>1;var atLastGeometry=_geometryIndex2===numGeometries-1;var meshColor=decompressColor$2(eachMeshMaterial.subarray(_meshIndex3*6,_meshIndex3*6+3));var meshOpacity=eachMeshMaterial[_meshIndex3*6+3]/255.0;var meshMetallic=eachMeshMaterial[_meshIndex3*6+4]/255.0;var meshRoughness=eachMeshMaterial[_meshIndex3*6+5]/255.0;var meshId=manifestCtx.getNextId();if(isReusedGeometry){// Create mesh for multi-use geometry - create (or reuse) geometry, create mesh using that geometry
24873
+ var meshMatrixIndex=eachMeshMatricesPortion[_meshIndex3];var meshMatrix=matrices.slice(meshMatrixIndex,meshMatrixIndex+16);var geometryId="".concat(modelPartId,"-geometry.").concat(tileIndex,".").concat(_geometryIndex2);// These IDs are local to the SceneModel
24874
24874
  var geometryArrays=geometryArraysCache[geometryId];if(!geometryArrays){geometryArrays={batchThisMesh:!options.reuseGeometries};var primitiveType=eachGeometryPrimitiveType[_geometryIndex2];var geometryValid=false;switch(primitiveType){case 0:geometryArrays.primitiveName="solid";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex2],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex2+1]);geometryArrays.geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex2],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex2+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex2],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex2+1]);geometryArrays.geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex2],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex2+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 1:geometryArrays.primitiveName="surface";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex2],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex2+1]);geometryArrays.geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex2],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex2+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex2],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex2+1]);geometryArrays.geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex2],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex2+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 2:geometryArrays.primitiveName="points";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex2],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex2+1]);geometryArrays.geometryColors=convertColorsRGBToRGBA(colors.subarray(eachGeometryColorsPortion[_geometryIndex2],atLastGeometry?colors.length:eachGeometryColorsPortion[_geometryIndex2+1]));geometryValid=geometryArrays.geometryPositions.length>0;break;case 3:geometryArrays.primitiveName="lines";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex2],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex2+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex2],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex2+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;default:continue;}if(!geometryValid){geometryArrays=null;}if(geometryArrays){if(geometryArrays.geometryPositions.length>1000);if(geometryArrays.batchThisMesh){geometryArrays.decompressedPositions=new Float32Array(geometryArrays.geometryPositions.length);var geometryPositions=geometryArrays.geometryPositions;var decompressedPositions=geometryArrays.decompressedPositions;for(var _i537=0,len=geometryPositions.length;_i537<len;_i537+=3){decompressedPositions[_i537+0]=geometryPositions[_i537+0]*reusedGeometriesDecodeMatrix[0]+reusedGeometriesDecodeMatrix[12];decompressedPositions[_i537+1]=geometryPositions[_i537+1]*reusedGeometriesDecodeMatrix[5]+reusedGeometriesDecodeMatrix[13];decompressedPositions[_i537+2]=geometryPositions[_i537+2]*reusedGeometriesDecodeMatrix[10]+reusedGeometriesDecodeMatrix[14];}geometryArrays.geometryPositions=null;geometryArraysCache[geometryId]=geometryArrays;}}}if(geometryArrays){if(geometryArrays.batchThisMesh){var _decompressedPositions=geometryArrays.decompressedPositions;var _positions4=new Uint16Array(_decompressedPositions.length);for(var _i538=0,_len123=_decompressedPositions.length;_i538<_len123;_i538+=3){tempVec4a$2[0]=_decompressedPositions[_i538+0];tempVec4a$2[1]=_decompressedPositions[_i538+1];tempVec4a$2[2]=_decompressedPositions[_i538+2];tempVec4a$2[3]=1;math.transformVec4(meshMatrix,tempVec4a$2,tempVec4b$2);geometryCompressionUtils.compressPosition(tempVec4b$2,rtcAABB,tempVec4a$2);_positions4[_i538+0]=tempVec4a$2[0];_positions4[_i538+1]=tempVec4a$2[1];_positions4[_i538+2]=tempVec4a$2[2];}sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,origin:tileCenter,primitive:geometryArrays.primitiveName,positionsCompressed:_positions4,normalsCompressed:geometryArrays.geometryNormals,colorsCompressed:geometryArrays.geometryColors,indices:geometryArrays.geometryIndices,edgeIndices:geometryArrays.geometryEdgeIndices,positionsDecodeMatrix:tileDecodeMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity}));meshIds.push(meshId);}else{if(!geometryCreatedInTile[geometryId]){sceneModel.createGeometry({id:geometryId,primitive:geometryArrays.primitiveName,positionsCompressed:geometryArrays.geometryPositions,normalsCompressed:geometryArrays.geometryNormals,colorsCompressed:geometryArrays.geometryColors,indices:geometryArrays.geometryIndices,edgeIndices:geometryArrays.geometryEdgeIndices,positionsDecodeMatrix:reusedGeometriesDecodeMatrix});geometryCreatedInTile[geometryId]=true;}sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,geometryId:geometryId,origin:tileCenter,matrix:meshMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity}));meshIds.push(meshId);}}}else{var _primitiveType2=eachGeometryPrimitiveType[_geometryIndex2];var primitiveName=void 0;var _geometryPositions2=void 0;var geometryNormals=void 0;var geometryColors=void 0;var geometryIndices=void 0;var geometryEdgeIndices=void 0;var _geometryValid=false;switch(_primitiveType2){case 0:primitiveName="solid";_geometryPositions2=positions.subarray(eachGeometryPositionsPortion[_geometryIndex2],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex2+1]);geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex2],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex2+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex2],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex2+1]);geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex2],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex2+1]);_geometryValid=_geometryPositions2.length>0&&geometryIndices.length>0;break;case 1:primitiveName="surface";_geometryPositions2=positions.subarray(eachGeometryPositionsPortion[_geometryIndex2],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex2+1]);geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex2],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex2+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex2],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex2+1]);geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex2],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex2+1]);_geometryValid=_geometryPositions2.length>0&&geometryIndices.length>0;break;case 2:primitiveName="points";_geometryPositions2=positions.subarray(eachGeometryPositionsPortion[_geometryIndex2],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex2+1]);geometryColors=convertColorsRGBToRGBA(colors.subarray(eachGeometryColorsPortion[_geometryIndex2],atLastGeometry?colors.length:eachGeometryColorsPortion[_geometryIndex2+1]));_geometryValid=_geometryPositions2.length>0;break;case 3:primitiveName="lines";_geometryPositions2=positions.subarray(eachGeometryPositionsPortion[_geometryIndex2],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex2+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex2],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex2+1]);_geometryValid=_geometryPositions2.length>0&&geometryIndices.length>0;break;default:continue;}if(_geometryValid){sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,origin:tileCenter,primitive:primitiveName,positionsCompressed:_geometryPositions2,normalsCompressed:geometryNormals,colorsCompressed:geometryColors,indices:geometryIndices,edgeIndices:geometryEdgeIndices,positionsDecodeMatrix:tileDecodeMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity}));meshIds.push(meshId);}}}if(meshIds.length>0){sceneModel.createEntity(utils.apply(entityDefaults,{id:entityId,isObject:true,meshIds:meshIds}));}}}}/** @private */var ParserV8={version:8,parse:function parse(viewer,options,elements,sceneModel,metaModel,manifestCtx){var deflatedData=extract$2(elements);var inflatedData=inflate$2(deflatedData);load$2(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx);}};/*
24875
24875
 
24876
24876
  Parser for .XKT Format V9
@@ -24881,36 +24881,36 @@ metadata:elements[0],positions:elements[1],normals:elements[2],colors:elements[3
24881
24881
  matrices:elements[6],reusedGeometriesDecodeMatrix:elements[7],// Geometries
24882
24882
  eachGeometryPrimitiveType:elements[8],eachGeometryPositionsPortion:elements[9],eachGeometryNormalsPortion:elements[10],eachGeometryColorsPortion:elements[11],eachGeometryIndicesPortion:elements[12],eachGeometryEdgeIndicesPortion:elements[13],// Meshes are grouped in runs that are shared by the same entities
24883
24883
  eachMeshGeometriesPortion:elements[14],eachMeshMatricesPortion:elements[15],eachMeshMaterial:elements[16],// Entity elements in the following arrays are grouped in runs that are shared by the same tiles
24884
- eachEntityId:elements[17],eachEntityMeshesPortion:elements[18],eachTileAABB:elements[19],eachTileEntitiesPortion:elements[20]};}function inflate$1(deflatedData){function inflate(array,options){return array.length===0?[]:pako$1.inflate(array,options).buffer;}return{metadata:JSON.parse(pako$1.inflate(deflatedData.metadata,{to:'string'})),positions:new Uint16Array(inflate(deflatedData.positions)),normals:new Int8Array(inflate(deflatedData.normals)),colors:new Uint8Array(inflate(deflatedData.colors)),indices:new Uint32Array(inflate(deflatedData.indices)),edgeIndices:new Uint32Array(inflate(deflatedData.edgeIndices)),matrices:new Float32Array(inflate(deflatedData.matrices)),reusedGeometriesDecodeMatrix:new Float32Array(inflate(deflatedData.reusedGeometriesDecodeMatrix)),eachGeometryPrimitiveType:new Uint8Array(inflate(deflatedData.eachGeometryPrimitiveType)),eachGeometryPositionsPortion:new Uint32Array(inflate(deflatedData.eachGeometryPositionsPortion)),eachGeometryNormalsPortion:new Uint32Array(inflate(deflatedData.eachGeometryNormalsPortion)),eachGeometryColorsPortion:new Uint32Array(inflate(deflatedData.eachGeometryColorsPortion)),eachGeometryIndicesPortion:new Uint32Array(inflate(deflatedData.eachGeometryIndicesPortion)),eachGeometryEdgeIndicesPortion:new Uint32Array(inflate(deflatedData.eachGeometryEdgeIndicesPortion)),eachMeshGeometriesPortion:new Uint32Array(inflate(deflatedData.eachMeshGeometriesPortion)),eachMeshMatricesPortion:new Uint32Array(inflate(deflatedData.eachMeshMatricesPortion)),eachMeshMaterial:new Uint8Array(inflate(deflatedData.eachMeshMaterial)),eachEntityId:JSON.parse(pako$1.inflate(deflatedData.eachEntityId,{to:'string'})),eachEntityMeshesPortion:new Uint32Array(inflate(deflatedData.eachEntityMeshesPortion)),eachTileAABB:new Float64Array(inflate(deflatedData.eachTileAABB)),eachTileEntitiesPortion:new Uint32Array(inflate(deflatedData.eachTileEntitiesPortion))};}var decompressColor$1=function(){var floatColor=new Float32Array(3);return function(intColor){floatColor[0]=intColor[0]/255.0;floatColor[1]=intColor[1]/255.0;floatColor[2]=intColor[2]/255.0;return floatColor;};}();function load$1(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx){var metadata=inflatedData.metadata;var positions=inflatedData.positions;var normals=inflatedData.normals;var colors=inflatedData.colors;var indices=inflatedData.indices;var edgeIndices=inflatedData.edgeIndices;var matrices=inflatedData.matrices;var reusedGeometriesDecodeMatrix=inflatedData.reusedGeometriesDecodeMatrix;var eachGeometryPrimitiveType=inflatedData.eachGeometryPrimitiveType;var eachGeometryPositionsPortion=inflatedData.eachGeometryPositionsPortion;var eachGeometryNormalsPortion=inflatedData.eachGeometryNormalsPortion;var eachGeometryColorsPortion=inflatedData.eachGeometryColorsPortion;var eachGeometryIndicesPortion=inflatedData.eachGeometryIndicesPortion;var eachGeometryEdgeIndicesPortion=inflatedData.eachGeometryEdgeIndicesPortion;var eachMeshGeometriesPortion=inflatedData.eachMeshGeometriesPortion;var eachMeshMatricesPortion=inflatedData.eachMeshMatricesPortion;var eachMeshMaterial=inflatedData.eachMeshMaterial;var eachEntityId=inflatedData.eachEntityId;var eachEntityMeshesPortion=inflatedData.eachEntityMeshesPortion;var eachTileAABB=inflatedData.eachTileAABB;var eachTileEntitiesPortion=inflatedData.eachTileEntitiesPortion;var numGeometries=eachGeometryPositionsPortion.length;var numMeshes=eachMeshGeometriesPortion.length;var numEntities=eachEntityMeshesPortion.length;var numTiles=eachTileEntitiesPortion.length;if(metaModel){metaModel.loadData(metadata);// Can be empty
24884
+ eachEntityId:elements[17],eachEntityMeshesPortion:elements[18],eachTileAABB:elements[19],eachTileEntitiesPortion:elements[20]};}function inflate$1(deflatedData){function inflate(array,options){return array.length===0?[]:pako$1.inflate(array,options).buffer;}return{metadata:JSON.parse(pako$1.inflate(deflatedData.metadata,{to:'string'})),positions:new Uint16Array(inflate(deflatedData.positions)),normals:new Int8Array(inflate(deflatedData.normals)),colors:new Uint8Array(inflate(deflatedData.colors)),indices:new Uint32Array(inflate(deflatedData.indices)),edgeIndices:new Uint32Array(inflate(deflatedData.edgeIndices)),matrices:new Float32Array(inflate(deflatedData.matrices)),reusedGeometriesDecodeMatrix:new Float32Array(inflate(deflatedData.reusedGeometriesDecodeMatrix)),eachGeometryPrimitiveType:new Uint8Array(inflate(deflatedData.eachGeometryPrimitiveType)),eachGeometryPositionsPortion:new Uint32Array(inflate(deflatedData.eachGeometryPositionsPortion)),eachGeometryNormalsPortion:new Uint32Array(inflate(deflatedData.eachGeometryNormalsPortion)),eachGeometryColorsPortion:new Uint32Array(inflate(deflatedData.eachGeometryColorsPortion)),eachGeometryIndicesPortion:new Uint32Array(inflate(deflatedData.eachGeometryIndicesPortion)),eachGeometryEdgeIndicesPortion:new Uint32Array(inflate(deflatedData.eachGeometryEdgeIndicesPortion)),eachMeshGeometriesPortion:new Uint32Array(inflate(deflatedData.eachMeshGeometriesPortion)),eachMeshMatricesPortion:new Uint32Array(inflate(deflatedData.eachMeshMatricesPortion)),eachMeshMaterial:new Uint8Array(inflate(deflatedData.eachMeshMaterial)),eachEntityId:JSON.parse(pako$1.inflate(deflatedData.eachEntityId,{to:'string'})),eachEntityMeshesPortion:new Uint32Array(inflate(deflatedData.eachEntityMeshesPortion)),eachTileAABB:new Float64Array(inflate(deflatedData.eachTileAABB)),eachTileEntitiesPortion:new Uint32Array(inflate(deflatedData.eachTileEntitiesPortion))};}var decompressColor$1=function(){var floatColor=new Float32Array(3);return function(intColor){floatColor[0]=intColor[0]/255.0;floatColor[1]=intColor[1]/255.0;floatColor[2]=intColor[2]/255.0;return floatColor;};}();function load$1(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx){var modelPartId=manifestCtx.getNextId();var metadata=inflatedData.metadata;var positions=inflatedData.positions;var normals=inflatedData.normals;var colors=inflatedData.colors;var indices=inflatedData.indices;var edgeIndices=inflatedData.edgeIndices;var matrices=inflatedData.matrices;var reusedGeometriesDecodeMatrix=inflatedData.reusedGeometriesDecodeMatrix;var eachGeometryPrimitiveType=inflatedData.eachGeometryPrimitiveType;var eachGeometryPositionsPortion=inflatedData.eachGeometryPositionsPortion;var eachGeometryNormalsPortion=inflatedData.eachGeometryNormalsPortion;var eachGeometryColorsPortion=inflatedData.eachGeometryColorsPortion;var eachGeometryIndicesPortion=inflatedData.eachGeometryIndicesPortion;var eachGeometryEdgeIndicesPortion=inflatedData.eachGeometryEdgeIndicesPortion;var eachMeshGeometriesPortion=inflatedData.eachMeshGeometriesPortion;var eachMeshMatricesPortion=inflatedData.eachMeshMatricesPortion;var eachMeshMaterial=inflatedData.eachMeshMaterial;var eachEntityId=inflatedData.eachEntityId;var eachEntityMeshesPortion=inflatedData.eachEntityMeshesPortion;var eachTileAABB=inflatedData.eachTileAABB;var eachTileEntitiesPortion=inflatedData.eachTileEntitiesPortion;var numGeometries=eachGeometryPositionsPortion.length;var numMeshes=eachMeshGeometriesPortion.length;var numEntities=eachEntityMeshesPortion.length;var numTiles=eachTileEntitiesPortion.length;if(metaModel){metaModel.loadData(metadata);// Can be empty
24885
24885
  }// Count instances of each geometry
24886
24886
  var geometryReuseCounts=new Uint32Array(numGeometries);for(var meshIndex=0;meshIndex<numMeshes;meshIndex++){var geometryIndex=eachMeshGeometriesPortion[meshIndex];if(geometryReuseCounts[geometryIndex]!==undefined){geometryReuseCounts[geometryIndex]++;}else{geometryReuseCounts[geometryIndex]=1;}}// Iterate over tiles
24887
24887
  var tileCenter=math.vec3();var rtcAABB=math.AABB3();var geometryArraysCache={};for(var tileIndex=0;tileIndex<numTiles;tileIndex++){var lastTileIndex=numTiles-1;var atLastTile=tileIndex===lastTileIndex;var firstTileEntityIndex=eachTileEntitiesPortion[tileIndex];var lastTileEntityIndex=atLastTile?numEntities-1:eachTileEntitiesPortion[tileIndex+1]-1;var tileAABBIndex=tileIndex*6;var tileAABB=eachTileAABB.subarray(tileAABBIndex,tileAABBIndex+6);math.getAABB3Center(tileAABB,tileCenter);rtcAABB[0]=tileAABB[0]-tileCenter[0];rtcAABB[1]=tileAABB[1]-tileCenter[1];rtcAABB[2]=tileAABB[2]-tileCenter[2];rtcAABB[3]=tileAABB[3]-tileCenter[0];rtcAABB[4]=tileAABB[4]-tileCenter[1];rtcAABB[5]=tileAABB[5]-tileCenter[2];var tileDecodeMatrix=geometryCompressionUtils.createPositionsDecodeMatrix(rtcAABB);var geometryCreatedInTile={};// Iterate over each tile's entities
24888
24888
  for(var tileEntityIndex=firstTileEntityIndex;tileEntityIndex<=lastTileEntityIndex;tileEntityIndex++){var xktEntityId=eachEntityId[tileEntityIndex];var entityId=options.globalizeObjectIds?math.globalizeObjectId(sceneModel.id,xktEntityId):xktEntityId;var finalTileEntityIndex=numEntities-1;var atLastTileEntity=tileEntityIndex===finalTileEntityIndex;var firstMeshIndex=eachEntityMeshesPortion[tileEntityIndex];var lastMeshIndex=atLastTileEntity?eachMeshGeometriesPortion.length-1:eachEntityMeshesPortion[tileEntityIndex+1]-1;var meshIds=[];var metaObject=viewer.metaScene.metaObjects[entityId];var entityDefaults={};var meshDefaults={};if(metaObject){// Mask loading of object types
24889
24889
  if(options.excludeTypesMap&&metaObject.type&&options.excludeTypesMap[metaObject.type]){continue;}if(options.includeTypesMap&&metaObject.type&&!options.includeTypesMap[metaObject.type]){continue;}// Get initial property values for object types
24890
24890
  var props=options.objectDefaults?options.objectDefaults[metaObject.type]||options.objectDefaults["DEFAULT"]:null;if(props){if(props.visible===false){entityDefaults.visible=false;}if(props.pickable===false){entityDefaults.pickable=false;}if(props.colorize){meshDefaults.color=props.colorize;}if(props.opacity!==undefined&&props.opacity!==null){meshDefaults.opacity=props.opacity;}if(props.metallic!==undefined&&props.metallic!==null){meshDefaults.metallic=props.metallic;}if(props.roughness!==undefined&&props.roughness!==null){meshDefaults.roughness=props.roughness;}}}else{if(options.excludeUnclassifiedObjects){continue;}}// Iterate each entity's meshes
24891
- for(var _meshIndex4=firstMeshIndex;_meshIndex4<=lastMeshIndex;_meshIndex4++){var _geometryIndex3=eachMeshGeometriesPortion[_meshIndex4];var geometryReuseCount=geometryReuseCounts[_geometryIndex3];var isReusedGeometry=geometryReuseCount>1;var atLastGeometry=_geometryIndex3===numGeometries-1;var meshColor=decompressColor$1(eachMeshMaterial.subarray(_meshIndex4*6,_meshIndex4*6+3));var meshOpacity=eachMeshMaterial[_meshIndex4*6+3]/255.0;var meshMetallic=eachMeshMaterial[_meshIndex4*6+4]/255.0;var meshRoughness=eachMeshMaterial[_meshIndex4*6+5]/255.0;var meshId=manifestCtx.nextMeshId++;if(isReusedGeometry){// Create mesh for multi-use geometry - create (or reuse) geometry, create mesh using that geometry
24892
- var meshMatrixIndex=eachMeshMatricesPortion[_meshIndex4];var meshMatrix=matrices.slice(meshMatrixIndex,meshMatrixIndex+16);var geometryId="geometry."+tileIndex+"."+_geometryIndex3;// These IDs are local to the SceneModel
24891
+ for(var _meshIndex4=firstMeshIndex;_meshIndex4<=lastMeshIndex;_meshIndex4++){var _geometryIndex3=eachMeshGeometriesPortion[_meshIndex4];var geometryReuseCount=geometryReuseCounts[_geometryIndex3];var isReusedGeometry=geometryReuseCount>1;var atLastGeometry=_geometryIndex3===numGeometries-1;var meshColor=decompressColor$1(eachMeshMaterial.subarray(_meshIndex4*6,_meshIndex4*6+3));var meshOpacity=eachMeshMaterial[_meshIndex4*6+3]/255.0;var meshMetallic=eachMeshMaterial[_meshIndex4*6+4]/255.0;var meshRoughness=eachMeshMaterial[_meshIndex4*6+5]/255.0;var meshId=manifestCtx.getNextId();if(isReusedGeometry){// Create mesh for multi-use geometry - create (or reuse) geometry, create mesh using that geometry
24892
+ var meshMatrixIndex=eachMeshMatricesPortion[_meshIndex4];var meshMatrix=matrices.slice(meshMatrixIndex,meshMatrixIndex+16);var geometryId="".concat(modelPartId,"-geometry.").concat(tileIndex,".").concat(_geometryIndex3);// These IDs are local to the SceneModel
24893
24893
  var geometryArrays=geometryArraysCache[geometryId];if(!geometryArrays){geometryArrays={batchThisMesh:!options.reuseGeometries};var primitiveType=eachGeometryPrimitiveType[_geometryIndex3];var geometryValid=false;switch(primitiveType){case 0:geometryArrays.primitiveName="solid";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex3],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex3+1]);geometryArrays.geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex3],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex3+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex3],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex3+1]);geometryArrays.geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex3],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex3+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 1:geometryArrays.primitiveName="surface";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex3],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex3+1]);geometryArrays.geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex3],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex3+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex3],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex3+1]);geometryArrays.geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex3],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex3+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 2:geometryArrays.primitiveName="points";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex3],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex3+1]);geometryArrays.geometryColors=colors.subarray(eachGeometryColorsPortion[_geometryIndex3],atLastGeometry?colors.length:eachGeometryColorsPortion[_geometryIndex3+1]);geometryValid=geometryArrays.geometryPositions.length>0;break;case 3:geometryArrays.primitiveName="lines";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex3],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex3+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex3],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex3+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;default:continue;}if(!geometryValid){geometryArrays=null;}if(geometryArrays){if(geometryArrays.geometryPositions.length>1000);if(geometryArrays.batchThisMesh){geometryArrays.decompressedPositions=new Float32Array(geometryArrays.geometryPositions.length);geometryArrays.transformedAndRecompressedPositions=new Uint16Array(geometryArrays.geometryPositions.length);var geometryPositions=geometryArrays.geometryPositions;var decompressedPositions=geometryArrays.decompressedPositions;for(var _i539=0,len=geometryPositions.length;_i539<len;_i539+=3){decompressedPositions[_i539+0]=geometryPositions[_i539+0]*reusedGeometriesDecodeMatrix[0]+reusedGeometriesDecodeMatrix[12];decompressedPositions[_i539+1]=geometryPositions[_i539+1]*reusedGeometriesDecodeMatrix[5]+reusedGeometriesDecodeMatrix[13];decompressedPositions[_i539+2]=geometryPositions[_i539+2]*reusedGeometriesDecodeMatrix[10]+reusedGeometriesDecodeMatrix[14];}geometryArrays.geometryPositions=null;geometryArraysCache[geometryId]=geometryArrays;}}}if(geometryArrays){if(geometryArrays.batchThisMesh){var _decompressedPositions2=geometryArrays.decompressedPositions;var transformedAndRecompressedPositions=geometryArrays.transformedAndRecompressedPositions;for(var _i540=0,_len124=_decompressedPositions2.length;_i540<_len124;_i540+=3){tempVec4a$1[0]=_decompressedPositions2[_i540+0];tempVec4a$1[1]=_decompressedPositions2[_i540+1];tempVec4a$1[2]=_decompressedPositions2[_i540+2];tempVec4a$1[3]=1;math.transformVec4(meshMatrix,tempVec4a$1,tempVec4b$1);geometryCompressionUtils.compressPosition(tempVec4b$1,rtcAABB,tempVec4a$1);transformedAndRecompressedPositions[_i540+0]=tempVec4a$1[0];transformedAndRecompressedPositions[_i540+1]=tempVec4a$1[1];transformedAndRecompressedPositions[_i540+2]=tempVec4a$1[2];}sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,origin:tileCenter,primitive:geometryArrays.primitiveName,positionsCompressed:transformedAndRecompressedPositions,normalsCompressed:geometryArrays.geometryNormals,colorsCompressed:geometryArrays.geometryColors,indices:geometryArrays.geometryIndices,edgeIndices:geometryArrays.geometryEdgeIndices,positionsDecodeMatrix:tileDecodeMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity}));meshIds.push(meshId);}else{if(!geometryCreatedInTile[geometryId]){sceneModel.createGeometry({id:geometryId,primitive:geometryArrays.primitiveName,positionsCompressed:geometryArrays.geometryPositions,normalsCompressed:geometryArrays.geometryNormals,colorsCompressed:geometryArrays.geometryColors,indices:geometryArrays.geometryIndices,edgeIndices:geometryArrays.geometryEdgeIndices,positionsDecodeMatrix:reusedGeometriesDecodeMatrix});geometryCreatedInTile[geometryId]=true;}sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,geometryId:geometryId,origin:tileCenter,matrix:meshMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity}));meshIds.push(meshId);}}}else{var _primitiveType3=eachGeometryPrimitiveType[_geometryIndex3];var primitiveName=void 0;var _geometryPositions3=void 0;var geometryNormals=void 0;var geometryColors=void 0;var geometryIndices=void 0;var geometryEdgeIndices=void 0;var _geometryValid2=false;switch(_primitiveType3){case 0:primitiveName="solid";_geometryPositions3=positions.subarray(eachGeometryPositionsPortion[_geometryIndex3],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex3+1]);geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex3],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex3+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex3],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex3+1]);geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex3],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex3+1]);_geometryValid2=_geometryPositions3.length>0&&geometryIndices.length>0;break;case 1:primitiveName="surface";_geometryPositions3=positions.subarray(eachGeometryPositionsPortion[_geometryIndex3],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex3+1]);geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex3],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex3+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex3],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex3+1]);geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex3],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex3+1]);_geometryValid2=_geometryPositions3.length>0&&geometryIndices.length>0;break;case 2:primitiveName="points";_geometryPositions3=positions.subarray(eachGeometryPositionsPortion[_geometryIndex3],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex3+1]);geometryColors=colors.subarray(eachGeometryColorsPortion[_geometryIndex3],atLastGeometry?colors.length:eachGeometryColorsPortion[_geometryIndex3+1]);_geometryValid2=_geometryPositions3.length>0;break;case 3:primitiveName="lines";_geometryPositions3=positions.subarray(eachGeometryPositionsPortion[_geometryIndex3],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex3+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex3],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex3+1]);_geometryValid2=_geometryPositions3.length>0&&geometryIndices.length>0;break;default:continue;}if(_geometryValid2){sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,origin:tileCenter,primitive:primitiveName,positionsCompressed:_geometryPositions3,normalsCompressed:geometryNormals,colorsCompressed:geometryColors,indices:geometryIndices,edgeIndices:geometryEdgeIndices,positionsDecodeMatrix:tileDecodeMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity}));meshIds.push(meshId);}}}if(meshIds.length>0){sceneModel.createEntity(utils.apply(entityDefaults,{id:entityId,isObject:true,meshIds:meshIds}));}}}}/** @private */var ParserV9={version:9,parse:function parse(viewer,options,elements,sceneModel,metaModel,manifestCtx){var deflatedData=extract$1(elements);var inflatedData=inflate$1(deflatedData);load$1(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx);}};/*
24894
24894
  Parser for .XKT Format V10
24895
24895
  */var pako=window.pako||p;if(!pako.inflate){// See https://github.com/nodeca/pako/issues/97
24896
24896
  pako=pako["default"];}var tempVec4a=math.vec4();var tempVec4b=math.vec4();var NUM_TEXTURE_ATTRIBUTES=9;function extract(elements){var i=0;return{metadata:elements[i++],textureData:elements[i++],eachTextureDataPortion:elements[i++],eachTextureAttributes:elements[i++],positions:elements[i++],normals:elements[i++],colors:elements[i++],uvs:elements[i++],indices:elements[i++],edgeIndices:elements[i++],eachTextureSetTextures:elements[i++],matrices:elements[i++],reusedGeometriesDecodeMatrix:elements[i++],eachGeometryPrimitiveType:elements[i++],eachGeometryPositionsPortion:elements[i++],eachGeometryNormalsPortion:elements[i++],eachGeometryColorsPortion:elements[i++],eachGeometryUVsPortion:elements[i++],eachGeometryIndicesPortion:elements[i++],eachGeometryEdgeIndicesPortion:elements[i++],eachMeshGeometriesPortion:elements[i++],eachMeshMatricesPortion:elements[i++],eachMeshTextureSet:elements[i++],eachMeshMaterialAttributes:elements[i++],eachEntityId:elements[i++],eachEntityMeshesPortion:elements[i++],eachTileAABB:elements[i++],eachTileEntitiesPortion:elements[i++]};}function inflate(deflatedData){function inflate(array,options){return array.length===0?[]:pako.inflate(array,options).buffer;}return{metadata:JSON.parse(pako.inflate(deflatedData.metadata,{to:'string'})),textureData:new Uint8Array(inflate(deflatedData.textureData)),// <<----------------------------- ??? ZIPPing to blame?
24897
24897
  eachTextureDataPortion:new Uint32Array(inflate(deflatedData.eachTextureDataPortion)),eachTextureAttributes:new Uint16Array(inflate(deflatedData.eachTextureAttributes)),positions:new Uint16Array(inflate(deflatedData.positions)),normals:new Int8Array(inflate(deflatedData.normals)),colors:new Uint8Array(inflate(deflatedData.colors)),uvs:new Float32Array(inflate(deflatedData.uvs)),indices:new Uint32Array(inflate(deflatedData.indices)),edgeIndices:new Uint32Array(inflate(deflatedData.edgeIndices)),eachTextureSetTextures:new Int32Array(inflate(deflatedData.eachTextureSetTextures)),matrices:new Float32Array(inflate(deflatedData.matrices)),reusedGeometriesDecodeMatrix:new Float32Array(inflate(deflatedData.reusedGeometriesDecodeMatrix)),eachGeometryPrimitiveType:new Uint8Array(inflate(deflatedData.eachGeometryPrimitiveType)),eachGeometryPositionsPortion:new Uint32Array(inflate(deflatedData.eachGeometryPositionsPortion)),eachGeometryNormalsPortion:new Uint32Array(inflate(deflatedData.eachGeometryNormalsPortion)),eachGeometryColorsPortion:new Uint32Array(inflate(deflatedData.eachGeometryColorsPortion)),eachGeometryUVsPortion:new Uint32Array(inflate(deflatedData.eachGeometryUVsPortion)),eachGeometryIndicesPortion:new Uint32Array(inflate(deflatedData.eachGeometryIndicesPortion)),eachGeometryEdgeIndicesPortion:new Uint32Array(inflate(deflatedData.eachGeometryEdgeIndicesPortion)),eachMeshGeometriesPortion:new Uint32Array(inflate(deflatedData.eachMeshGeometriesPortion)),eachMeshMatricesPortion:new Uint32Array(inflate(deflatedData.eachMeshMatricesPortion)),eachMeshTextureSet:new Int32Array(inflate(deflatedData.eachMeshTextureSet)),// Can be -1
24898
- eachMeshMaterialAttributes:new Uint8Array(inflate(deflatedData.eachMeshMaterialAttributes)),eachEntityId:JSON.parse(pako.inflate(deflatedData.eachEntityId,{to:'string'})),eachEntityMeshesPortion:new Uint32Array(inflate(deflatedData.eachEntityMeshesPortion)),eachTileAABB:new Float64Array(inflate(deflatedData.eachTileAABB)),eachTileEntitiesPortion:new Uint32Array(inflate(deflatedData.eachTileEntitiesPortion))};}var decompressColor=function(){var floatColor=new Float32Array(3);return function(intColor){floatColor[0]=intColor[0]/255.0;floatColor[1]=intColor[1]/255.0;floatColor[2]=intColor[2]/255.0;return floatColor;};}();(function(){var canvas=document.createElement('canvas');var context=canvas.getContext('2d');return function(imagedata){canvas.width=imagedata.width;canvas.height=imagedata.height;context.putImageData(imagedata,0,0);return canvas.toDataURL();};})();function load(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx){var metadata=inflatedData.metadata;var textureData=inflatedData.textureData;var eachTextureDataPortion=inflatedData.eachTextureDataPortion;var eachTextureAttributes=inflatedData.eachTextureAttributes;var positions=inflatedData.positions;var normals=inflatedData.normals;var colors=inflatedData.colors;var uvs=inflatedData.uvs;var indices=inflatedData.indices;var edgeIndices=inflatedData.edgeIndices;var eachTextureSetTextures=inflatedData.eachTextureSetTextures;var matrices=inflatedData.matrices;var reusedGeometriesDecodeMatrix=inflatedData.reusedGeometriesDecodeMatrix;var eachGeometryPrimitiveType=inflatedData.eachGeometryPrimitiveType;var eachGeometryPositionsPortion=inflatedData.eachGeometryPositionsPortion;var eachGeometryNormalsPortion=inflatedData.eachGeometryNormalsPortion;var eachGeometryColorsPortion=inflatedData.eachGeometryColorsPortion;var eachGeometryUVsPortion=inflatedData.eachGeometryUVsPortion;var eachGeometryIndicesPortion=inflatedData.eachGeometryIndicesPortion;var eachGeometryEdgeIndicesPortion=inflatedData.eachGeometryEdgeIndicesPortion;var eachMeshGeometriesPortion=inflatedData.eachMeshGeometriesPortion;var eachMeshMatricesPortion=inflatedData.eachMeshMatricesPortion;var eachMeshTextureSet=inflatedData.eachMeshTextureSet;var eachMeshMaterialAttributes=inflatedData.eachMeshMaterialAttributes;var eachEntityId=inflatedData.eachEntityId;var eachEntityMeshesPortion=inflatedData.eachEntityMeshesPortion;var eachTileAABB=inflatedData.eachTileAABB;var eachTileEntitiesPortion=inflatedData.eachTileEntitiesPortion;var numTextures=eachTextureDataPortion.length;var numTextureSets=eachTextureSetTextures.length/5;var numGeometries=eachGeometryPositionsPortion.length;var numMeshes=eachMeshGeometriesPortion.length;var numEntities=eachEntityMeshesPortion.length;var numTiles=eachTileEntitiesPortion.length;if(metaModel){metaModel.loadData(metadata);// Can be empty
24898
+ eachMeshMaterialAttributes:new Uint8Array(inflate(deflatedData.eachMeshMaterialAttributes)),eachEntityId:JSON.parse(pako.inflate(deflatedData.eachEntityId,{to:'string'})),eachEntityMeshesPortion:new Uint32Array(inflate(deflatedData.eachEntityMeshesPortion)),eachTileAABB:new Float64Array(inflate(deflatedData.eachTileAABB)),eachTileEntitiesPortion:new Uint32Array(inflate(deflatedData.eachTileEntitiesPortion))};}var decompressColor=function(){var floatColor=new Float32Array(3);return function(intColor){floatColor[0]=intColor[0]/255.0;floatColor[1]=intColor[1]/255.0;floatColor[2]=intColor[2]/255.0;return floatColor;};}();(function(){var canvas=document.createElement('canvas');var context=canvas.getContext('2d');return function(imagedata){canvas.width=imagedata.width;canvas.height=imagedata.height;context.putImageData(imagedata,0,0);return canvas.toDataURL();};})();function load(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx){var modelPartId=manifestCtx.getNextId();var metadata=inflatedData.metadata;var textureData=inflatedData.textureData;var eachTextureDataPortion=inflatedData.eachTextureDataPortion;var eachTextureAttributes=inflatedData.eachTextureAttributes;var positions=inflatedData.positions;var normals=inflatedData.normals;var colors=inflatedData.colors;var uvs=inflatedData.uvs;var indices=inflatedData.indices;var edgeIndices=inflatedData.edgeIndices;var eachTextureSetTextures=inflatedData.eachTextureSetTextures;var matrices=inflatedData.matrices;var reusedGeometriesDecodeMatrix=inflatedData.reusedGeometriesDecodeMatrix;var eachGeometryPrimitiveType=inflatedData.eachGeometryPrimitiveType;var eachGeometryPositionsPortion=inflatedData.eachGeometryPositionsPortion;var eachGeometryNormalsPortion=inflatedData.eachGeometryNormalsPortion;var eachGeometryColorsPortion=inflatedData.eachGeometryColorsPortion;var eachGeometryUVsPortion=inflatedData.eachGeometryUVsPortion;var eachGeometryIndicesPortion=inflatedData.eachGeometryIndicesPortion;var eachGeometryEdgeIndicesPortion=inflatedData.eachGeometryEdgeIndicesPortion;var eachMeshGeometriesPortion=inflatedData.eachMeshGeometriesPortion;var eachMeshMatricesPortion=inflatedData.eachMeshMatricesPortion;var eachMeshTextureSet=inflatedData.eachMeshTextureSet;var eachMeshMaterialAttributes=inflatedData.eachMeshMaterialAttributes;var eachEntityId=inflatedData.eachEntityId;var eachEntityMeshesPortion=inflatedData.eachEntityMeshesPortion;var eachTileAABB=inflatedData.eachTileAABB;var eachTileEntitiesPortion=inflatedData.eachTileEntitiesPortion;var numTextures=eachTextureDataPortion.length;var numTextureSets=eachTextureSetTextures.length/5;var numGeometries=eachGeometryPositionsPortion.length;var numMeshes=eachMeshGeometriesPortion.length;var numEntities=eachEntityMeshesPortion.length;var numTiles=eachTileEntitiesPortion.length;if(metaModel){metaModel.loadData(metadata);// Can be empty
24899
24899
  }// Create textures
24900
24900
  for(var textureIndex=0;textureIndex<numTextures;textureIndex++){var atLastTexture=textureIndex===numTextures-1;var textureDataPortionStart=eachTextureDataPortion[textureIndex];var textureDataPortionEnd=atLastTexture?textureData.length:eachTextureDataPortion[textureIndex+1];var textureDataPortionSize=textureDataPortionEnd-textureDataPortionStart;var textureDataPortionExists=textureDataPortionSize>0;var textureAttrBaseIdx=textureIndex*NUM_TEXTURE_ATTRIBUTES;var compressed=eachTextureAttributes[textureAttrBaseIdx+0]===1;var mediaType=eachTextureAttributes[textureAttrBaseIdx+1];eachTextureAttributes[textureAttrBaseIdx+2];eachTextureAttributes[textureAttrBaseIdx+3];var minFilter=eachTextureAttributes[textureAttrBaseIdx+4];var magFilter=eachTextureAttributes[textureAttrBaseIdx+5];// LinearFilter | NearestFilter
24901
24901
  var wrapS=eachTextureAttributes[textureAttrBaseIdx+6];// ClampToEdgeWrapping | MirroredRepeatWrapping | RepeatWrapping
24902
24902
  var wrapT=eachTextureAttributes[textureAttrBaseIdx+7];// ClampToEdgeWrapping | MirroredRepeatWrapping | RepeatWrapping
24903
24903
  var wrapR=eachTextureAttributes[textureAttrBaseIdx+8];// ClampToEdgeWrapping | MirroredRepeatWrapping | RepeatWrapping
24904
- if(textureDataPortionExists){var imageDataSubarray=new Uint8Array(textureData.subarray(textureDataPortionStart,textureDataPortionEnd));var arrayBuffer=imageDataSubarray.buffer;var textureId="texture-".concat(textureIndex);if(compressed){sceneModel.createTexture({id:textureId,buffers:[arrayBuffer],minFilter:minFilter,magFilter:magFilter,wrapS:wrapS,wrapT:wrapT,wrapR:wrapR});}else{var mimeType=mediaType===JPEGMediaType?"image/jpeg":mediaType===PNGMediaType?"image/png":"image/gif";var blob=new Blob([arrayBuffer],{type:mimeType});var urlCreator=window.URL||window.webkitURL;var imageUrl=urlCreator.createObjectURL(blob);var img=document.createElement('img');img.src=imageUrl;sceneModel.createTexture({id:textureId,image:img,//mediaType,
24904
+ if(textureDataPortionExists){var imageDataSubarray=new Uint8Array(textureData.subarray(textureDataPortionStart,textureDataPortionEnd));var arrayBuffer=imageDataSubarray.buffer;var textureId="".concat(modelPartId,"-texture-").concat(textureIndex);if(compressed){sceneModel.createTexture({id:textureId,buffers:[arrayBuffer],minFilter:minFilter,magFilter:magFilter,wrapS:wrapS,wrapT:wrapT,wrapR:wrapR});}else{var mimeType=mediaType===JPEGMediaType?"image/jpeg":mediaType===PNGMediaType?"image/png":"image/gif";var blob=new Blob([arrayBuffer],{type:mimeType});var urlCreator=window.URL||window.webkitURL;var imageUrl=urlCreator.createObjectURL(blob);var img=document.createElement('img');img.src=imageUrl;sceneModel.createTexture({id:textureId,image:img,//mediaType,
24905
24905
  minFilter:minFilter,magFilter:magFilter,wrapS:wrapS,wrapT:wrapT,wrapR:wrapR});}}}// Create texture sets
24906
- for(var textureSetIndex=0;textureSetIndex<numTextureSets;textureSetIndex++){var eachTextureSetTexturesIndex=textureSetIndex*5;var textureSetId="textureSet-".concat(textureSetIndex);var colorTextureIndex=eachTextureSetTextures[eachTextureSetTexturesIndex+0];var metallicRoughnessTextureIndex=eachTextureSetTextures[eachTextureSetTexturesIndex+1];var normalsTextureIndex=eachTextureSetTextures[eachTextureSetTexturesIndex+2];var emissiveTextureIndex=eachTextureSetTextures[eachTextureSetTexturesIndex+3];var occlusionTextureIndex=eachTextureSetTextures[eachTextureSetTexturesIndex+4];sceneModel.createTextureSet({id:textureSetId,colorTextureId:colorTextureIndex>=0?"texture-".concat(colorTextureIndex):null,normalsTextureId:normalsTextureIndex>=0?"texture-".concat(normalsTextureIndex):null,metallicRoughnessTextureId:metallicRoughnessTextureIndex>=0?"texture-".concat(metallicRoughnessTextureIndex):null,emissiveTextureId:emissiveTextureIndex>=0?"texture-".concat(emissiveTextureIndex):null,occlusionTextureId:occlusionTextureIndex>=0?"texture-".concat(occlusionTextureIndex):null});}// Count instances of each geometry
24906
+ for(var textureSetIndex=0;textureSetIndex<numTextureSets;textureSetIndex++){var eachTextureSetTexturesIndex=textureSetIndex*5;var textureSetId="".concat(modelPartId,"-textureSet-").concat(textureSetIndex);var colorTextureIndex=eachTextureSetTextures[eachTextureSetTexturesIndex+0];var metallicRoughnessTextureIndex=eachTextureSetTextures[eachTextureSetTexturesIndex+1];var normalsTextureIndex=eachTextureSetTextures[eachTextureSetTexturesIndex+2];var emissiveTextureIndex=eachTextureSetTextures[eachTextureSetTexturesIndex+3];var occlusionTextureIndex=eachTextureSetTextures[eachTextureSetTexturesIndex+4];sceneModel.createTextureSet({id:textureSetId,colorTextureId:colorTextureIndex>=0?"".concat(modelPartId,"-texture-").concat(colorTextureIndex):null,normalsTextureId:normalsTextureIndex>=0?"".concat(modelPartId,"-texture-").concat(normalsTextureIndex):null,metallicRoughnessTextureId:metallicRoughnessTextureIndex>=0?"".concat(modelPartId,"-texture-").concat(metallicRoughnessTextureIndex):null,emissiveTextureId:emissiveTextureIndex>=0?"".concat(modelPartId,"-texture-").concat(emissiveTextureIndex):null,occlusionTextureId:occlusionTextureIndex>=0?"".concat(modelPartId,"-texture-").concat(occlusionTextureIndex):null});}// Count instances of each geometry
24907
24907
  var geometryReuseCounts=new Uint32Array(numGeometries);for(var meshIndex=0;meshIndex<numMeshes;meshIndex++){var geometryIndex=eachMeshGeometriesPortion[meshIndex];if(geometryReuseCounts[geometryIndex]!==undefined){geometryReuseCounts[geometryIndex]++;}else{geometryReuseCounts[geometryIndex]=1;}}// Iterate over tiles
24908
24908
  var tileCenter=math.vec3();var rtcAABB=math.AABB3();var geometryArraysCache={};for(var tileIndex=0;tileIndex<numTiles;tileIndex++){var lastTileIndex=numTiles-1;var atLastTile=tileIndex===lastTileIndex;var firstTileEntityIndex=eachTileEntitiesPortion[tileIndex];var lastTileEntityIndex=atLastTile?numEntities-1:eachTileEntitiesPortion[tileIndex+1]-1;var tileAABBIndex=tileIndex*6;var tileAABB=eachTileAABB.subarray(tileAABBIndex,tileAABBIndex+6);math.getAABB3Center(tileAABB,tileCenter);rtcAABB[0]=tileAABB[0]-tileCenter[0];rtcAABB[1]=tileAABB[1]-tileCenter[1];rtcAABB[2]=tileAABB[2]-tileCenter[2];rtcAABB[3]=tileAABB[3]-tileCenter[0];rtcAABB[4]=tileAABB[4]-tileCenter[1];rtcAABB[5]=tileAABB[5]-tileCenter[2];var tileDecodeMatrix=geometryCompressionUtils.createPositionsDecodeMatrix(rtcAABB);var geometryCreatedInTile={};// Iterate over each tile's entities
24909
24909
  for(var tileEntityIndex=firstTileEntityIndex;tileEntityIndex<=lastTileEntityIndex;tileEntityIndex++){var xktEntityId=eachEntityId[tileEntityIndex];var entityId=options.globalizeObjectIds?math.globalizeObjectId(sceneModel.id,xktEntityId):xktEntityId;var finalTileEntityIndex=numEntities-1;var atLastTileEntity=tileEntityIndex===finalTileEntityIndex;var firstMeshIndex=eachEntityMeshesPortion[tileEntityIndex];var lastMeshIndex=atLastTileEntity?eachMeshGeometriesPortion.length-1:eachEntityMeshesPortion[tileEntityIndex+1]-1;var meshIds=[];var metaObject=viewer.metaScene.metaObjects[entityId];var entityDefaults={};var meshDefaults={};if(metaObject){// Mask loading of object types
24910
24910
  if(options.excludeTypesMap&&metaObject.type&&options.excludeTypesMap[metaObject.type]){continue;}if(options.includeTypesMap&&metaObject.type&&!options.includeTypesMap[metaObject.type]){continue;}// Get initial property values for object types
24911
24911
  var props=options.objectDefaults?options.objectDefaults[metaObject.type]||options.objectDefaults["DEFAULT"]:null;if(props){if(props.visible===false){entityDefaults.visible=false;}if(props.pickable===false){entityDefaults.pickable=false;}if(props.colorize){meshDefaults.color=props.colorize;}if(props.opacity!==undefined&&props.opacity!==null){meshDefaults.opacity=props.opacity;}if(props.metallic!==undefined&&props.metallic!==null){meshDefaults.metallic=props.metallic;}if(props.roughness!==undefined&&props.roughness!==null){meshDefaults.roughness=props.roughness;}}}else{if(options.excludeUnclassifiedObjects){continue;}}// Iterate each entity's meshes
24912
- for(var _meshIndex5=firstMeshIndex;_meshIndex5<=lastMeshIndex;_meshIndex5++){var _geometryIndex4=eachMeshGeometriesPortion[_meshIndex5];var geometryReuseCount=geometryReuseCounts[_geometryIndex4];var isReusedGeometry=geometryReuseCount>1;var atLastGeometry=_geometryIndex4===numGeometries-1;var _textureSetIndex=eachMeshTextureSet[_meshIndex5];var _textureSetId=_textureSetIndex>=0?"textureSet-".concat(_textureSetIndex):null;var meshColor=decompressColor(eachMeshMaterialAttributes.subarray(_meshIndex5*6,_meshIndex5*6+3));var meshOpacity=eachMeshMaterialAttributes[_meshIndex5*6+3]/255.0;var meshMetallic=eachMeshMaterialAttributes[_meshIndex5*6+4]/255.0;var meshRoughness=eachMeshMaterialAttributes[_meshIndex5*6+5]/255.0;var meshId=manifestCtx.nextMeshId++;if(isReusedGeometry){// Create mesh for multi-use geometry - create (or reuse) geometry, create mesh using that geometry
24913
- var meshMatrixIndex=eachMeshMatricesPortion[_meshIndex5];var meshMatrix=matrices.slice(meshMatrixIndex,meshMatrixIndex+16);var geometryId="geometry."+tileIndex+"."+_geometryIndex4;// These IDs are local to the SceneModel
24912
+ for(var _meshIndex5=firstMeshIndex;_meshIndex5<=lastMeshIndex;_meshIndex5++){var _geometryIndex4=eachMeshGeometriesPortion[_meshIndex5];var geometryReuseCount=geometryReuseCounts[_geometryIndex4];var isReusedGeometry=geometryReuseCount>1;var atLastGeometry=_geometryIndex4===numGeometries-1;var _textureSetIndex=eachMeshTextureSet[_meshIndex5];var _textureSetId=_textureSetIndex>=0?"".concat(modelPartId,"-textureSet-").concat(_textureSetIndex):null;var meshColor=decompressColor(eachMeshMaterialAttributes.subarray(_meshIndex5*6,_meshIndex5*6+3));var meshOpacity=eachMeshMaterialAttributes[_meshIndex5*6+3]/255.0;var meshMetallic=eachMeshMaterialAttributes[_meshIndex5*6+4]/255.0;var meshRoughness=eachMeshMaterialAttributes[_meshIndex5*6+5]/255.0;var meshId=manifestCtx.getNextId();if(isReusedGeometry){// Create mesh for multi-use geometry - create (or reuse) geometry, create mesh using that geometry
24913
+ var meshMatrixIndex=eachMeshMatricesPortion[_meshIndex5];var meshMatrix=matrices.slice(meshMatrixIndex,meshMatrixIndex+16);var geometryId="".concat(modelPartId,"-geometry.").concat(tileIndex,".").concat(_geometryIndex4);// These IDs are local to the SceneModel
24914
24914
  var geometryArrays=geometryArraysCache[geometryId];if(!geometryArrays){geometryArrays={batchThisMesh:!options.reuseGeometries};var primitiveType=eachGeometryPrimitiveType[_geometryIndex4];var geometryValid=false;switch(primitiveType){case 0:geometryArrays.primitiveName="solid";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex4],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex4+1]);geometryArrays.geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex4],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex4+1]);geometryArrays.geometryUVs=uvs.subarray(eachGeometryUVsPortion[_geometryIndex4],atLastGeometry?uvs.length:eachGeometryUVsPortion[_geometryIndex4+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex4],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex4+1]);geometryArrays.geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex4],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex4+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 1:geometryArrays.primitiveName="surface";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex4],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex4+1]);geometryArrays.geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex4],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex4+1]);geometryArrays.geometryUVs=uvs.subarray(eachGeometryUVsPortion[_geometryIndex4],atLastGeometry?uvs.length:eachGeometryUVsPortion[_geometryIndex4+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex4],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex4+1]);geometryArrays.geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex4],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex4+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 2:geometryArrays.primitiveName="points";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex4],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex4+1]);geometryArrays.geometryColors=colors.subarray(eachGeometryColorsPortion[_geometryIndex4],atLastGeometry?colors.length:eachGeometryColorsPortion[_geometryIndex4+1]);geometryValid=geometryArrays.geometryPositions.length>0;break;case 3:geometryArrays.primitiveName="lines";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex4],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex4+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex4],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex4+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 4:geometryArrays.primitiveName="lines";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex4],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex4+1]);geometryArrays.geometryIndices=lineStripToLines(geometryArrays.geometryPositions,indices.subarray(eachGeometryIndicesPortion[_geometryIndex4],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex4+1]));geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;default:continue;}if(!geometryValid){geometryArrays=null;}if(geometryArrays){if(geometryArrays.geometryPositions.length>1000);if(geometryArrays.batchThisMesh){geometryArrays.decompressedPositions=new Float32Array(geometryArrays.geometryPositions.length);geometryArrays.transformedAndRecompressedPositions=new Uint16Array(geometryArrays.geometryPositions.length);var geometryPositions=geometryArrays.geometryPositions;var decompressedPositions=geometryArrays.decompressedPositions;for(var _i541=0,len=geometryPositions.length;_i541<len;_i541+=3){decompressedPositions[_i541+0]=geometryPositions[_i541+0]*reusedGeometriesDecodeMatrix[0]+reusedGeometriesDecodeMatrix[12];decompressedPositions[_i541+1]=geometryPositions[_i541+1]*reusedGeometriesDecodeMatrix[5]+reusedGeometriesDecodeMatrix[13];decompressedPositions[_i541+2]=geometryPositions[_i541+2]*reusedGeometriesDecodeMatrix[10]+reusedGeometriesDecodeMatrix[14];}geometryArrays.geometryPositions=null;geometryArraysCache[geometryId]=geometryArrays;}}}if(geometryArrays){if(geometryArrays.batchThisMesh){var _decompressedPositions3=geometryArrays.decompressedPositions;var transformedAndRecompressedPositions=geometryArrays.transformedAndRecompressedPositions;for(var _i542=0,_len125=_decompressedPositions3.length;_i542<_len125;_i542+=3){tempVec4a[0]=_decompressedPositions3[_i542+0];tempVec4a[1]=_decompressedPositions3[_i542+1];tempVec4a[2]=_decompressedPositions3[_i542+2];tempVec4a[3]=1;math.transformVec4(meshMatrix,tempVec4a,tempVec4b);geometryCompressionUtils.compressPosition(tempVec4b,rtcAABB,tempVec4a);transformedAndRecompressedPositions[_i542+0]=tempVec4a[0];transformedAndRecompressedPositions[_i542+1]=tempVec4a[1];transformedAndRecompressedPositions[_i542+2]=tempVec4a[2];}sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,textureSetId:_textureSetId,origin:tileCenter,primitive:geometryArrays.primitiveName,positionsCompressed:transformedAndRecompressedPositions,normalsCompressed:geometryArrays.geometryNormals,uv:geometryArrays.geometryUVs,colorsCompressed:geometryArrays.geometryColors,indices:geometryArrays.geometryIndices,edgeIndices:geometryArrays.geometryEdgeIndices,positionsDecodeMatrix:tileDecodeMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity}));meshIds.push(meshId);}else{if(!geometryCreatedInTile[geometryId]){sceneModel.createGeometry({id:geometryId,primitive:geometryArrays.primitiveName,positionsCompressed:geometryArrays.geometryPositions,normalsCompressed:geometryArrays.geometryNormals,uv:geometryArrays.geometryUVs,colorsCompressed:geometryArrays.geometryColors,indices:geometryArrays.geometryIndices,edgeIndices:geometryArrays.geometryEdgeIndices,positionsDecodeMatrix:reusedGeometriesDecodeMatrix});geometryCreatedInTile[geometryId]=true;}sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,geometryId:geometryId,textureSetId:_textureSetId,matrix:meshMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity,origin:tileCenter}));meshIds.push(meshId);}}}else{// Do not reuse geometry
24915
24915
  var _primitiveType4=eachGeometryPrimitiveType[_geometryIndex4];var primitiveName=void 0;var _geometryPositions4=void 0;var geometryNormals=void 0;var geometryUVs=void 0;var geometryColors=void 0;var geometryIndices=void 0;var geometryEdgeIndices=void 0;var _geometryValid3=false;switch(_primitiveType4){case 0:primitiveName="solid";_geometryPositions4=positions.subarray(eachGeometryPositionsPortion[_geometryIndex4],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex4+1]);geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex4],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex4+1]);geometryUVs=uvs.subarray(eachGeometryUVsPortion[_geometryIndex4],atLastGeometry?uvs.length:eachGeometryUVsPortion[_geometryIndex4+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex4],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex4+1]);geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex4],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex4+1]);_geometryValid3=_geometryPositions4.length>0&&geometryIndices.length>0;break;case 1:primitiveName="surface";_geometryPositions4=positions.subarray(eachGeometryPositionsPortion[_geometryIndex4],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex4+1]);geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex4],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex4+1]);geometryUVs=uvs.subarray(eachGeometryUVsPortion[_geometryIndex4],atLastGeometry?uvs.length:eachGeometryUVsPortion[_geometryIndex4+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex4],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex4+1]);geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex4],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex4+1]);_geometryValid3=_geometryPositions4.length>0&&geometryIndices.length>0;break;case 2:primitiveName="points";_geometryPositions4=positions.subarray(eachGeometryPositionsPortion[_geometryIndex4],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex4+1]);geometryColors=colors.subarray(eachGeometryColorsPortion[_geometryIndex4],atLastGeometry?colors.length:eachGeometryColorsPortion[_geometryIndex4+1]);_geometryValid3=_geometryPositions4.length>0;break;case 3:primitiveName="lines";_geometryPositions4=positions.subarray(eachGeometryPositionsPortion[_geometryIndex4],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex4+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex4],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex4+1]);_geometryValid3=_geometryPositions4.length>0&&geometryIndices.length>0;break;case 4:primitiveName="lines";_geometryPositions4=positions.subarray(eachGeometryPositionsPortion[_geometryIndex4],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex4+1]);geometryIndices=lineStripToLines(_geometryPositions4,indices.subarray(eachGeometryIndicesPortion[_geometryIndex4],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex4+1]));_geometryValid3=_geometryPositions4.length>0&&geometryIndices.length>0;break;default:continue;}if(_geometryValid3){sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,textureSetId:_textureSetId,origin:tileCenter,primitive:primitiveName,positionsCompressed:_geometryPositions4,normalsCompressed:geometryNormals,uv:geometryUVs&&geometryUVs.length>0?geometryUVs:null,colorsCompressed:geometryColors,indices:geometryIndices,edgeIndices:geometryEdgeIndices,positionsDecodeMatrix:tileDecodeMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity}));meshIds.push(meshId);}}}if(meshIds.length>0){sceneModel.createEntity(utils.apply(entityDefaults,{id:entityId,isObject:true,meshIds:meshIds}));}}}}function lineStripToLines(positions,indices){var linesIndices=[];if(indices.length>1){for(var _i543=0,len=indices.length-1;_i543<len;_i543++){linesIndices.push(indices[_i543]);linesIndices.push(indices[_i543+1]);}}else if(positions.length>1){for(var _i544=0,_len126=positions.length/3-1;_i544<_len126;_i544++){linesIndices.push(_i544);linesIndices.push(_i544+1);}}return linesIndices;}/** @private */var ParserV10={version:10,parse:function parse(viewer,options,elements,sceneModel,metaModel,manifestCtx){var deflatedData=extract(elements);var inflatedData=inflate(deflatedData);load(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx);}};var parsers={};parsers[ParserV1.version]=ParserV1;parsers[ParserV2.version]=ParserV2;parsers[ParserV3.version]=ParserV3;parsers[ParserV4.version]=ParserV4;parsers[ParserV5.version]=ParserV5;parsers[ParserV6.version]=ParserV6;parsers[ParserV7.version]=ParserV7;parsers[ParserV8.version]=ParserV8;parsers[ParserV9.version]=ParserV9;parsers[ParserV10.version]=ParserV10;/**
24916
24916
  * {@link Viewer} plugin that loads models from xeokit's optimized *````.XKT````* format.
@@ -25600,7 +25600,7 @@ var _primitiveType4=eachGeometryPrimitiveType[_geometryIndex4];var primitiveName
25600
25600
  var metaModel=new MetaModel({metaScene:this.viewer.metaScene,id:modelId});this.viewer.scene.canvas.spinner.processes++;var finish=function finish(){// this._createDefaultMetaModelIfNeeded(sceneModel, params, options);
25601
25601
  sceneModel.finalize();metaModel.finalize();_this151.viewer.scene.canvas.spinner.processes--;sceneModel.once("destroyed",function(){_this151.viewer.metaScene.destroyMetaModel(metaModel.id);});sceneModel.scene.once("tick",function(){if(sceneModel.destroyed){return;}sceneModel.scene.fire("modelLoaded",sceneModel.id);// FIXME: Assumes listeners know order of these two events
25602
25602
  sceneModel.fire("loaded",true,false);// Don't forget the event, for late subscribers
25603
- });};var error=function error(errMsg){_this151.viewer.scene.canvas.spinner.processes--;_this151.error(errMsg);sceneModel.fire("error",errMsg);};var manifestCtx={nextMeshId:0};if(params.metaModelSrc||params.metaModelData){if(params.metaModelSrc){var metaModelSrc=params.metaModelSrc;this._dataSource.getMetaModel(metaModelSrc,function(metaModelData){if(sceneModel.destroyed){return;}metaModel.loadData(metaModelData,{includeTypes:includeTypes,excludeTypes:excludeTypes,globalizeObjectIds:options.globalizeObjectIds});if(params.src){_this151._loadModel(params.src,params,options,sceneModel,null,manifestCtx,finish,error);}else{_this151._parseModel(params.xkt,params,options,sceneModel,null,manifestCtx);finish();}},function(errMsg){error("load(): Failed to load model metadata for model '".concat(modelId," from '").concat(metaModelSrc,"' - ").concat(errMsg));});}else if(params.metaModelData){metaModel.loadData(params.metaModelData,{includeTypes:includeTypes,excludeTypes:excludeTypes,globalizeObjectIds:options.globalizeObjectIds});if(params.src){this._loadModel(params.src,params,options,sceneModel,null,manifestCtx,finish,error);}else{this._parseModel(params.xkt,params,options,sceneModel,null,manifestCtx);finish();}}}else{if(params.src){this._loadModel(params.src,params,options,sceneModel,metaModel,manifestCtx,finish,error);}else if(params.xkt){this._parseModel(params.xkt,params,options,sceneModel,metaModel,manifestCtx);finish();}else if(params.manifestSrc){var baseDir=getBaseDirectory(params.manifestSrc);var loadJSONs=function loadJSONs(metaDataFiles,done,error){var i=0;var loadNext=function loadNext(){if(i>=metaDataFiles.length){done();}else{_this151._dataSource.getMetaModel("".concat(baseDir).concat(metaDataFiles[i]),function(metaModelData){metaModel.loadData(metaModelData,{includeTypes:includeTypes,excludeTypes:excludeTypes,globalizeObjectIds:options.globalizeObjectIds});i++;loadNext();},error);}};loadNext();};var loadXKTs=function loadXKTs(xktFiles,done,error){var i=0;var loadNext=function loadNext(){if(i>=xktFiles.length){done();}else{_this151._dataSource.getXKT("".concat(baseDir).concat(xktFiles[i]),function(arrayBuffer){_this151._parseModel(arrayBuffer,params,options,sceneModel,metaModel,manifestCtx);i++;loadNext();},error);}};loadNext();};this._dataSource.getManifest(params.manifestSrc,function(manifestData){if(sceneModel.destroyed){return;}var xktFiles=manifestData.xktFiles;if(!xktFiles||xktFiles.length===0){error("load(): Failed to load model manifest - manifest not valid");return;}var metaModelFiles=manifestData.metaModelFiles;if(metaModelFiles){loadJSONs(metaModelFiles,function(){loadXKTs(xktFiles,finish,error);},error);}else{loadXKTs(xktFiles,finish,error);}},error);}}return sceneModel;}},{key:"_loadModel",value:function _loadModel(src,params,options,sceneModel,metaModel,manifestCtx,done,error){var _this152=this;this._dataSource.getXKT(params.src,function(arrayBuffer){_this152._parseModel(arrayBuffer,params,options,sceneModel,metaModel,manifestCtx);done();},error);}},{key:"_parseModel",value:function _parseModel(arrayBuffer,params,options,sceneModel,metaModel,manifestCtx){if(sceneModel.destroyed){return;}var dataView=new DataView(arrayBuffer);var dataArray=new Uint8Array(arrayBuffer);var xktVersion=dataView.getUint32(0,true);var parser=parsers[xktVersion];if(!parser){this.error("Unsupported .XKT file version: "+xktVersion+" - this XKTLoaderPlugin supports versions "+Object.keys(parsers));return;}this.log("Loading .xkt V"+xktVersion);var numElements=dataView.getUint32(4,true);var elements=[];var byteOffset=(numElements+2)*4;for(var _i547=0;_i547<numElements;_i547++){var elementSize=dataView.getUint32((_i547+2)*4,true);elements.push(dataArray.subarray(byteOffset,byteOffset+elementSize));byteOffset+=elementSize;}parser.parse(this.viewer,options,elements,sceneModel,metaModel,manifestCtx);}// _createDefaultMetaModelIfNeeded(sceneModel, params, options) {
25603
+ });};var error=function error(errMsg){_this151.viewer.scene.canvas.spinner.processes--;_this151.error(errMsg);sceneModel.fire("error",errMsg);};var nextId=0;var manifestCtx={getNextId:function getNextId(){return"".concat(modelId,".").concat(nextId++);}};if(params.metaModelSrc||params.metaModelData){if(params.metaModelSrc){var metaModelSrc=params.metaModelSrc;this._dataSource.getMetaModel(metaModelSrc,function(metaModelData){if(sceneModel.destroyed){return;}metaModel.loadData(metaModelData,{includeTypes:includeTypes,excludeTypes:excludeTypes,globalizeObjectIds:options.globalizeObjectIds});if(params.src){_this151._loadModel(params.src,params,options,sceneModel,null,manifestCtx,finish,error);}else{_this151._parseModel(params.xkt,params,options,sceneModel,null,manifestCtx);finish();}},function(errMsg){error("load(): Failed to load model metadata for model '".concat(modelId," from '").concat(metaModelSrc,"' - ").concat(errMsg));});}else if(params.metaModelData){metaModel.loadData(params.metaModelData,{includeTypes:includeTypes,excludeTypes:excludeTypes,globalizeObjectIds:options.globalizeObjectIds});if(params.src){this._loadModel(params.src,params,options,sceneModel,null,manifestCtx,finish,error);}else{this._parseModel(params.xkt,params,options,sceneModel,null,manifestCtx);finish();}}}else{if(params.src){this._loadModel(params.src,params,options,sceneModel,metaModel,manifestCtx,finish,error);}else if(params.xkt){this._parseModel(params.xkt,params,options,sceneModel,metaModel,manifestCtx);finish();}else if(params.manifestSrc){var baseDir=getBaseDirectory(params.manifestSrc);var loadJSONs=function loadJSONs(metaDataFiles,done,error){var i=0;var loadNext=function loadNext(){if(i>=metaDataFiles.length){done();}else{_this151._dataSource.getMetaModel("".concat(baseDir).concat(metaDataFiles[i]),function(metaModelData){metaModel.loadData(metaModelData,{includeTypes:includeTypes,excludeTypes:excludeTypes,globalizeObjectIds:options.globalizeObjectIds});i++;loadNext();},error);}};loadNext();};var loadXKTs=function loadXKTs(xktFiles,done,error){var i=0;var loadNext=function loadNext(){if(i>=xktFiles.length){done();}else{_this151._dataSource.getXKT("".concat(baseDir).concat(xktFiles[i]),function(arrayBuffer){_this151._parseModel(arrayBuffer,params,options,sceneModel,metaModel,manifestCtx);i++;loadNext();},error);}};loadNext();};this._dataSource.getManifest(params.manifestSrc,function(manifestData){if(sceneModel.destroyed){return;}var xktFiles=manifestData.xktFiles;if(!xktFiles||xktFiles.length===0){error("load(): Failed to load model manifest - manifest not valid");return;}var metaModelFiles=manifestData.metaModelFiles;if(metaModelFiles){loadJSONs(metaModelFiles,function(){loadXKTs(xktFiles,finish,error);},error);}else{loadXKTs(xktFiles,finish,error);}},error);}}return sceneModel;}},{key:"_loadModel",value:function _loadModel(src,params,options,sceneModel,metaModel,manifestCtx,done,error){var _this152=this;this._dataSource.getXKT(params.src,function(arrayBuffer){_this152._parseModel(arrayBuffer,params,options,sceneModel,metaModel,manifestCtx);done();},error);}},{key:"_parseModel",value:function _parseModel(arrayBuffer,params,options,sceneModel,metaModel,manifestCtx){if(sceneModel.destroyed){return;}var dataView=new DataView(arrayBuffer);var dataArray=new Uint8Array(arrayBuffer);var xktVersion=dataView.getUint32(0,true);var parser=parsers[xktVersion];if(!parser){this.error("Unsupported .XKT file version: "+xktVersion+" - this XKTLoaderPlugin supports versions "+Object.keys(parsers));return;}this.log("Loading .xkt V"+xktVersion);var numElements=dataView.getUint32(4,true);var elements=[];var byteOffset=(numElements+2)*4;for(var _i547=0;_i547<numElements;_i547++){var elementSize=dataView.getUint32((_i547+2)*4,true);elements.push(dataArray.subarray(byteOffset,byteOffset+elementSize));byteOffset+=elementSize;}parser.parse(this.viewer,options,elements,sceneModel,metaModel,manifestCtx);}// _createDefaultMetaModelIfNeeded(sceneModel, params, options) {
25604
25604
  //
25605
25605
  // const metaModelId = sceneModel.id;
25606
25606
  //