@xeokit/xeokit-sdk 2.3.5 → 2.3.7

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.
@@ -96438,9 +96438,9 @@ class GLTFVBOSceneModelLoader {
96438
96438
  });
96439
96439
  }
96440
96440
 
96441
- parse(plugin, gltf, metaModelJSON, options, sceneModel, ok, error) {
96441
+ parse(plugin, gltf, metaModelJSON, options, sceneModel, ok, error) {
96442
96442
  options = options || {};
96443
- parseGLTF(plugin, "", gltf, metaModelJSON, options, sceneModel, function () {
96443
+ parseGLTF(plugin, "", gltf, metaModelJSON, options, sceneModel, function () {
96444
96444
  sceneModel.scene.fire("modelLoaded", sceneModel.id); // FIXME: Assumes listeners know order of these two events
96445
96445
  sceneModel.fire("loaded", true, false);
96446
96446
  if (ok) {
@@ -96484,14 +96484,14 @@ function getMetaModelCorrections(metaModelJSON) {
96484
96484
  };
96485
96485
  }
96486
96486
 
96487
- function loadGLTF(plugin, src, metaModelJSON, options, sceneModel, ok, error) {
96487
+ function loadGLTF(plugin, src, metaModelJSON, options, sceneModel, ok, error) {
96488
96488
  const spinner = plugin.viewer.scene.canvas.spinner;
96489
96489
  spinner.processes++;
96490
96490
  const isGLB = (src.split('.').pop() === "glb");
96491
96491
  if (isGLB) {
96492
96492
  plugin.dataSource.getGLB(src, (arrayBuffer) => { // OK
96493
96493
  options.basePath = getBasePath(src);
96494
- parseGLTF(plugin, src, arrayBuffer, metaModelJSON, options, sceneModel, ok);
96494
+ parseGLTF(plugin, src, arrayBuffer, metaModelJSON, options, sceneModel, ok);
96495
96495
  spinner.processes--;
96496
96496
  },
96497
96497
  (err) => {
@@ -96501,7 +96501,7 @@ function loadGLTF(plugin, src, metaModelJSON, options, sceneModel, ok, error) {
96501
96501
  } else {
96502
96502
  plugin.dataSource.getGLTF(src, (gltf) => { // OK
96503
96503
  options.basePath = getBasePath(src);
96504
- parseGLTF(plugin, src, gltf, metaModelJSON, options, sceneModel, ok);
96504
+ parseGLTF(plugin, src, gltf, metaModelJSON, options, sceneModel, ok);
96505
96505
  spinner.processes--;
96506
96506
  },
96507
96507
  (err) => {
@@ -96516,7 +96516,7 @@ function getBasePath(src) {
96516
96516
  return (i !== 0) ? src.substring(0, i + 1) : "";
96517
96517
  }
96518
96518
 
96519
- function parseGLTF(plugin, src, gltf, metaModelJSON, options, sceneModel, ok) {
96519
+ function parseGLTF(plugin, src, gltf, metaModelJSON, options, sceneModel, ok) {
96520
96520
  const spinner = plugin.viewer.scene.canvas.spinner;
96521
96521
  spinner.processes++;
96522
96522
  parse$3(gltf, GLTFLoader, {
@@ -96535,7 +96535,10 @@ function parseGLTF(plugin, src, gltf, metaModelJSON, options, sceneModel, ok) {
96535
96535
  //geometryCreated: {},
96536
96536
  numObjects: 0,
96537
96537
  nodes: [],
96538
- nextId: 0
96538
+ nextId: 0,
96539
+ log: (msg) => {
96540
+ plugin.log(msg);
96541
+ }
96539
96542
  };
96540
96543
  loadTextures(ctx);
96541
96544
  loadMaterials(ctx);
@@ -96434,9 +96434,9 @@ class GLTFVBOSceneModelLoader {
96434
96434
  });
96435
96435
  }
96436
96436
 
96437
- parse(plugin, gltf, metaModelJSON, options, sceneModel, ok, error) {
96437
+ parse(plugin, gltf, metaModelJSON, options, sceneModel, ok, error) {
96438
96438
  options = options || {};
96439
- parseGLTF(plugin, "", gltf, metaModelJSON, options, sceneModel, function () {
96439
+ parseGLTF(plugin, "", gltf, metaModelJSON, options, sceneModel, function () {
96440
96440
  sceneModel.scene.fire("modelLoaded", sceneModel.id); // FIXME: Assumes listeners know order of these two events
96441
96441
  sceneModel.fire("loaded", true, false);
96442
96442
  if (ok) {
@@ -96480,14 +96480,14 @@ function getMetaModelCorrections(metaModelJSON) {
96480
96480
  };
96481
96481
  }
96482
96482
 
96483
- function loadGLTF(plugin, src, metaModelJSON, options, sceneModel, ok, error) {
96483
+ function loadGLTF(plugin, src, metaModelJSON, options, sceneModel, ok, error) {
96484
96484
  const spinner = plugin.viewer.scene.canvas.spinner;
96485
96485
  spinner.processes++;
96486
96486
  const isGLB = (src.split('.').pop() === "glb");
96487
96487
  if (isGLB) {
96488
96488
  plugin.dataSource.getGLB(src, (arrayBuffer) => { // OK
96489
96489
  options.basePath = getBasePath(src);
96490
- parseGLTF(plugin, src, arrayBuffer, metaModelJSON, options, sceneModel, ok);
96490
+ parseGLTF(plugin, src, arrayBuffer, metaModelJSON, options, sceneModel, ok);
96491
96491
  spinner.processes--;
96492
96492
  },
96493
96493
  (err) => {
@@ -96497,7 +96497,7 @@ function loadGLTF(plugin, src, metaModelJSON, options, sceneModel, ok, error) {
96497
96497
  } else {
96498
96498
  plugin.dataSource.getGLTF(src, (gltf) => { // OK
96499
96499
  options.basePath = getBasePath(src);
96500
- parseGLTF(plugin, src, gltf, metaModelJSON, options, sceneModel, ok);
96500
+ parseGLTF(plugin, src, gltf, metaModelJSON, options, sceneModel, ok);
96501
96501
  spinner.processes--;
96502
96502
  },
96503
96503
  (err) => {
@@ -96512,7 +96512,7 @@ function getBasePath(src) {
96512
96512
  return (i !== 0) ? src.substring(0, i + 1) : "";
96513
96513
  }
96514
96514
 
96515
- function parseGLTF(plugin, src, gltf, metaModelJSON, options, sceneModel, ok) {
96515
+ function parseGLTF(plugin, src, gltf, metaModelJSON, options, sceneModel, ok) {
96516
96516
  const spinner = plugin.viewer.scene.canvas.spinner;
96517
96517
  spinner.processes++;
96518
96518
  parse$3(gltf, GLTFLoader, {
@@ -96531,7 +96531,10 @@ function parseGLTF(plugin, src, gltf, metaModelJSON, options, sceneModel, ok) {
96531
96531
  //geometryCreated: {},
96532
96532
  numObjects: 0,
96533
96533
  nodes: [],
96534
- nextId: 0
96534
+ nextId: 0,
96535
+ log: (msg) => {
96536
+ plugin.log(msg);
96537
+ }
96535
96538
  };
96536
96539
  loadTextures(ctx);
96537
96540
  loadMaterials(ctx);
@@ -21829,7 +21829,7 @@ sceneModel.fire("loaded",true,false);});if(ok){ok();}},function(msg){plugin.erro
21829
21829
  sceneModel.fire("loaded",true,false);if(ok){ok();}});}}]);return GLTFVBOSceneModelLoader;}();function getMetaModelCorrections(metaModelJSON){var eachRootStats={};var eachChildRoot={};var metaObjects=metaModelJSON.metaObjects||[];var metaObjectsMap={};for(var _i425=0,len=metaObjects.length;_i425<len;_i425++){var metaObject=metaObjects[_i425];metaObjectsMap[metaObject.id]=metaObject;}for(var _i426=0,_len96=metaObjects.length;_i426<_len96;_i426++){var _metaObject4=metaObjects[_i426];if(_metaObject4.parent!==undefined&&_metaObject4.parent!==null){var metaObjectParent=metaObjectsMap[_metaObject4.parent];if(_metaObject4.type===metaObjectParent.type){var rootMetaObject=metaObjectParent;while(rootMetaObject.parent&&metaObjectsMap[rootMetaObject.parent].type===rootMetaObject.type){rootMetaObject=metaObjectsMap[rootMetaObject.parent];}var rootStats=eachRootStats[rootMetaObject.id]||(eachRootStats[rootMetaObject.id]={numChildren:0,countChildren:0});rootStats.numChildren++;eachChildRoot[_metaObject4.id]=rootMetaObject;}}}return{metaObjectsMap:metaObjectsMap,eachRootStats:eachRootStats,eachChildRoot:eachChildRoot};}function loadGLTF(plugin,src,metaModelJSON,options,sceneModel,ok,error){var spinner=plugin.viewer.scene.canvas.spinner;spinner.processes++;var isGLB=src.split('.').pop()==="glb";if(isGLB){plugin.dataSource.getGLB(src,function(arrayBuffer){// OK
21830
21830
  options.basePath=getBasePath(src);parseGLTF(plugin,src,arrayBuffer,metaModelJSON,options,sceneModel,ok);spinner.processes--;},function(err){spinner.processes--;error(err);});}else{plugin.dataSource.getGLTF(src,function(gltf){// OK
21831
21831
  options.basePath=getBasePath(src);parseGLTF(plugin,src,gltf,metaModelJSON,options,sceneModel,ok);spinner.processes--;},function(err){spinner.processes--;error(err);});}}function getBasePath(src){var i=src.lastIndexOf("/");return i!==0?src.substring(0,i+1):"";}function parseGLTF(plugin,src,gltf,metaModelJSON,options,sceneModel,ok){var spinner=plugin.viewer.scene.canvas.spinner;spinner.processes++;parse$3(gltf,GLTFLoader,{baseUri:options.basePath}).then(function(gltfData){var ctx={src:src,metaModelCorrections:metaModelJSON?getMetaModelCorrections(metaModelJSON):null,loadBuffer:options.loadBuffer,basePath:options.basePath,handlenode:options.handlenode,gltfData:gltfData,scene:sceneModel.scene,plugin:plugin,sceneModel:sceneModel,//geometryCreated: {},
21832
- numObjects:0,nodes:[],nextId:0};loadTextures(ctx);loadMaterials(ctx);loadDefaultScene(ctx);sceneModel.finalize();spinner.processes--;ok();});}function loadTextures(ctx){var gltfData=ctx.gltfData;var textures=gltfData.textures;if(textures){for(var _i427=0,len=textures.length;_i427<len;_i427++){loadTexture(ctx,textures[_i427]);}}}function loadTexture(ctx,texture){if(!texture.source||!texture.source.image){return;}var textureId="texture-".concat(ctx.nextId++);var minFilter=NearestMipMapLinearFilter;switch(texture.sampler.minFilter){case 9728:minFilter=NearestFilter;break;case 9729:minFilter=LinearFilter;break;case 9984:minFilter=NearestMipMapNearestFilter;break;case 9985:minFilter=LinearMipMapNearestFilter;break;case 9986:minFilter=NearestMipMapLinearFilter;break;case 9987:minFilter=LinearMipMapLinearFilter;break;}var magFilter=LinearFilter;switch(texture.sampler.magFilter){case 9728:magFilter=NearestFilter;break;case 9729:magFilter=LinearFilter;break;}var wrapS=RepeatWrapping;switch(texture.sampler.wrapS){case 33071:wrapS=ClampToEdgeWrapping;break;case 33648:wrapS=MirroredRepeatWrapping;break;case 10497:wrapS=RepeatWrapping;break;}var wrapT=RepeatWrapping;switch(texture.sampler.wrapT){case 33071:wrapT=ClampToEdgeWrapping;break;case 33648:wrapT=MirroredRepeatWrapping;break;case 10497:wrapT=RepeatWrapping;break;}var wrapR=RepeatWrapping;switch(texture.sampler.wrapR){case 33071:wrapR=ClampToEdgeWrapping;break;case 33648:wrapR=MirroredRepeatWrapping;break;case 10497:wrapR=RepeatWrapping;break;}ctx.sceneModel.createTexture({id:textureId,image:texture.source.image,flipY:!!texture.flipY,minFilter:minFilter,magFilter:magFilter,wrapS:wrapS,wrapT:wrapT,wrapR:wrapR,encoding:sRGBEncoding});texture._textureId=textureId;}function loadMaterials(ctx){var gltfData=ctx.gltfData;var materials=gltfData.materials;if(materials){for(var _i428=0,len=materials.length;_i428<len;_i428++){var material=materials[_i428];material._textureSetId=loadTextureSet(ctx,material);material._attributes=loadMaterialAttributes(ctx,material);}}}function loadTextureSet(ctx,material){var textureSetCfg={};if(material.normalTexture){textureSetCfg.normalTextureId=material.normalTexture.texture._textureId;}if(material.occlusionTexture){textureSetCfg.occlusionTextureId=material.occlusionTexture.texture._textureId;}if(material.emissiveTexture){textureSetCfg.emissiveTextureId=material.emissiveTexture.texture._textureId;}// const alphaMode = material.alphaMode;
21832
+ numObjects:0,nodes:[],nextId:0,log:function log(msg){plugin.log(msg);}};loadTextures(ctx);loadMaterials(ctx);loadDefaultScene(ctx);sceneModel.finalize();spinner.processes--;ok();});}function loadTextures(ctx){var gltfData=ctx.gltfData;var textures=gltfData.textures;if(textures){for(var _i427=0,len=textures.length;_i427<len;_i427++){loadTexture(ctx,textures[_i427]);}}}function loadTexture(ctx,texture){if(!texture.source||!texture.source.image){return;}var textureId="texture-".concat(ctx.nextId++);var minFilter=NearestMipMapLinearFilter;switch(texture.sampler.minFilter){case 9728:minFilter=NearestFilter;break;case 9729:minFilter=LinearFilter;break;case 9984:minFilter=NearestMipMapNearestFilter;break;case 9985:minFilter=LinearMipMapNearestFilter;break;case 9986:minFilter=NearestMipMapLinearFilter;break;case 9987:minFilter=LinearMipMapLinearFilter;break;}var magFilter=LinearFilter;switch(texture.sampler.magFilter){case 9728:magFilter=NearestFilter;break;case 9729:magFilter=LinearFilter;break;}var wrapS=RepeatWrapping;switch(texture.sampler.wrapS){case 33071:wrapS=ClampToEdgeWrapping;break;case 33648:wrapS=MirroredRepeatWrapping;break;case 10497:wrapS=RepeatWrapping;break;}var wrapT=RepeatWrapping;switch(texture.sampler.wrapT){case 33071:wrapT=ClampToEdgeWrapping;break;case 33648:wrapT=MirroredRepeatWrapping;break;case 10497:wrapT=RepeatWrapping;break;}var wrapR=RepeatWrapping;switch(texture.sampler.wrapR){case 33071:wrapR=ClampToEdgeWrapping;break;case 33648:wrapR=MirroredRepeatWrapping;break;case 10497:wrapR=RepeatWrapping;break;}ctx.sceneModel.createTexture({id:textureId,image:texture.source.image,flipY:!!texture.flipY,minFilter:minFilter,magFilter:magFilter,wrapS:wrapS,wrapT:wrapT,wrapR:wrapR,encoding:sRGBEncoding});texture._textureId=textureId;}function loadMaterials(ctx){var gltfData=ctx.gltfData;var materials=gltfData.materials;if(materials){for(var _i428=0,len=materials.length;_i428<len;_i428++){var material=materials[_i428];material._textureSetId=loadTextureSet(ctx,material);material._attributes=loadMaterialAttributes(ctx,material);}}}function loadTextureSet(ctx,material){var textureSetCfg={};if(material.normalTexture){textureSetCfg.normalTextureId=material.normalTexture.texture._textureId;}if(material.occlusionTexture){textureSetCfg.occlusionTextureId=material.occlusionTexture.texture._textureId;}if(material.emissiveTexture){textureSetCfg.emissiveTextureId=material.emissiveTexture.texture._textureId;}// const alphaMode = material.alphaMode;
21833
21833
  // switch (alphaMode) {
21834
21834
  // case "NORMAL_OPAQUE":
21835
21835
  // materialCfg.alphaMode = "opaque";