@xeokit/xeokit-sdk 2.6.1 → 2.6.2

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.
@@ -80391,7 +80391,7 @@ class SceneModelTransform {
80391
80391
  _addChildTransform(childTransform) {
80392
80392
  this._childTransforms.push(childTransform);
80393
80393
  childTransform._parentTransform = this;
80394
- childTransform._setWorldMatrixDirty();
80394
+ childTransform._transformDirty();
80395
80395
  childTransform._setAABBDirty();
80396
80396
  }
80397
80397
 
@@ -115909,7 +115909,7 @@ function loadNode(ctx, node, depth, matrix) {
115909
115909
  meshCfg.opacity = 1.0;
115910
115910
  }
115911
115911
 
115912
- const backfaces = ((ctx.backfaces !== false) || (material.doubleSided !== false));
115912
+ const backfaces = ((ctx.backfaces !== false) || (material && material.doubleSided !== false));
115913
115913
 
115914
115914
  switch (primitive.mode) {
115915
115915
  case 0: // POINTS
@@ -80387,7 +80387,7 @@ class SceneModelTransform {
80387
80387
  _addChildTransform(childTransform) {
80388
80388
  this._childTransforms.push(childTransform);
80389
80389
  childTransform._parentTransform = this;
80390
- childTransform._setWorldMatrixDirty();
80390
+ childTransform._transformDirty();
80391
80391
  childTransform._setAABBDirty();
80392
80392
  }
80393
80393
 
@@ -115905,7 +115905,7 @@ function loadNode(ctx, node, depth, matrix) {
115905
115905
  meshCfg.opacity = 1.0;
115906
115906
  }
115907
115907
 
115908
- const backfaces = ((ctx.backfaces !== false) || (material.doubleSided !== false));
115908
+ const backfaces = ((ctx.backfaces !== false) || (material && material.doubleSided !== false));
115909
115909
 
115910
115910
  switch (primitive.mode) {
115911
115911
  case 0: // POINTS
@@ -16791,7 +16791,7 @@ var edgeIndex=void 0;if((edgeIndex=edgeSearch(ii0,ii1))>=0){if(alreadyOutputEdge
16791
16791
  * Unique ID of this SceneModelTransform.
16792
16792
  *
16793
16793
  * The SceneModelTransform is registered against this ID in {@link SceneModel#transforms}.
16794
- */this.id=cfg.id;this._parentTransform=cfg.parent;this._childTransforms=[];this._meshes=[];this._scale=new Float32Array([1,1,1]);this._quaternion=math.identityQuaternion(new Float32Array(4));this._rotation=new Float32Array(3);this._position=new Float32Array(3);this._localMatrix=math.identityMat4(new Float32Array(16));this._worldMatrix=math.identityMat4(new Float32Array(16));this._localMatrixDirty=true;this._worldMatrixDirty=true;if(cfg.matrix){this.matrix=cfg.matrix;}else{this.scale=cfg.scale;this.position=cfg.position;if(cfg.quaternion);else{this.rotation=cfg.rotation;}}if(cfg.parent){cfg.parent._addChildTransform(this);}}_createClass(SceneModelTransform,[{key:"_addChildTransform",value:function _addChildTransform(childTransform){this._childTransforms.push(childTransform);childTransform._parentTransform=this;childTransform._setWorldMatrixDirty();childTransform._setAABBDirty();}},{key:"_addMesh",value:function _addMesh(mesh){this._meshes.push(mesh);mesh.transform=this;// childTransform._setWorldMatrixDirty();
16794
+ */this.id=cfg.id;this._parentTransform=cfg.parent;this._childTransforms=[];this._meshes=[];this._scale=new Float32Array([1,1,1]);this._quaternion=math.identityQuaternion(new Float32Array(4));this._rotation=new Float32Array(3);this._position=new Float32Array(3);this._localMatrix=math.identityMat4(new Float32Array(16));this._worldMatrix=math.identityMat4(new Float32Array(16));this._localMatrixDirty=true;this._worldMatrixDirty=true;if(cfg.matrix){this.matrix=cfg.matrix;}else{this.scale=cfg.scale;this.position=cfg.position;if(cfg.quaternion);else{this.rotation=cfg.rotation;}}if(cfg.parent){cfg.parent._addChildTransform(this);}}_createClass(SceneModelTransform,[{key:"_addChildTransform",value:function _addChildTransform(childTransform){this._childTransforms.push(childTransform);childTransform._parentTransform=this;childTransform._transformDirty();childTransform._setAABBDirty();}},{key:"_addMesh",value:function _addMesh(mesh){this._meshes.push(mesh);mesh.transform=this;// childTransform._setWorldMatrixDirty();
16795
16795
  // childTransform._setAABBDirty();
16796
16796
  }/**
16797
16797
  * The optional parent SceneModelTransform.
@@ -24476,7 +24476,7 @@ numObjects:0,nodes:[],nextId:0,log:function log(msg){plugin.log(msg);}};loadText
24476
24476
  // materialCfg.alphaCutoff = alphaCutoff;
24477
24477
  // }
24478
24478
  var metallicPBR=material.pbrMetallicRoughness;if(material.pbrMetallicRoughness){var pbrMetallicRoughness=material.pbrMetallicRoughness;var baseColorTexture=pbrMetallicRoughness.baseColorTexture||pbrMetallicRoughness.colorTexture;if(baseColorTexture){if(baseColorTexture.texture){textureSetCfg.colorTextureId=baseColorTexture.texture._textureId;}else{textureSetCfg.colorTextureId=ctx.gltfData.textures[baseColorTexture.index]._textureId;}}if(metallicPBR.metallicRoughnessTexture){textureSetCfg.metallicRoughnessTextureId=metallicPBR.metallicRoughnessTexture.texture._textureId;}}var extensions=material.extensions;if(extensions){var specularPBR=extensions["KHR_materials_pbrSpecularGlossiness"];if(specularPBR){specularPBR.specularTexture;var specularColorTexture=specularPBR.specularColorTexture;if(specularColorTexture!==null&&specularColorTexture!==undefined){textureSetCfg.colorTextureId=ctx.gltfData.textures[specularColorTexture.index]._textureId;}}}if(textureSetCfg.normalTextureId!==undefined||textureSetCfg.occlusionTextureId!==undefined||textureSetCfg.emissiveTextureId!==undefined||textureSetCfg.colorTextureId!==undefined||textureSetCfg.metallicRoughnessTextureId!==undefined){textureSetCfg.id="textureSet-".concat(ctx.nextId++,";");ctx.sceneModel.createTextureSet(textureSetCfg);return textureSetCfg.id;}return null;}function loadMaterialAttributes(ctx,material){// Substitute RGBA for material, to use fast flat shading instead
24479
- var extensions=material.extensions;var materialAttributes={color:new Float32Array([1,1,1,1]),opacity:1,metallic:0,roughness:1,doubleSided:true};if(extensions){var specularPBR=extensions["KHR_materials_pbrSpecularGlossiness"];if(specularPBR){var diffuseFactor=specularPBR.diffuseFactor;if(diffuseFactor!==null&&diffuseFactor!==undefined){materialAttributes.color.set(diffuseFactor);}}var common=extensions["KHR_materials_common"];if(common){var technique=common.technique;var values=common.values||{};var blinn=technique==="BLINN";var phong=technique==="PHONG";var lambert=technique==="LAMBERT";var diffuse=values.diffuse;if(diffuse&&(blinn||phong||lambert)){if(!utils.isString(diffuse)){materialAttributes.color.set(diffuse);}}var transparency=values.transparency;if(transparency!==null&&transparency!==undefined){materialAttributes.opacity=transparency;}var transparent=values.transparent;if(transparent!==null&&transparent!==undefined){materialAttributes.opacity=transparent;}}}var metallicPBR=material.pbrMetallicRoughness;if(metallicPBR){var baseColorFactor=metallicPBR.baseColorFactor;if(baseColorFactor){materialAttributes.color[0]=baseColorFactor[0];materialAttributes.color[1]=baseColorFactor[1];materialAttributes.color[2]=baseColorFactor[2];materialAttributes.opacity=baseColorFactor[3];}var metallicFactor=metallicPBR.metallicFactor;if(metallicFactor!==null&&metallicFactor!==undefined){materialAttributes.metallic=metallicFactor;}var roughnessFactor=metallicPBR.roughnessFactor;if(roughnessFactor!==null&&roughnessFactor!==undefined){materialAttributes.roughness=roughnessFactor;}}materialAttributes.doubleSided=material.doubleSided!==false;return materialAttributes;}function loadDefaultScene(ctx){var gltfData=ctx.gltfData;var scene=gltfData.scene||gltfData.scenes[0];if(!scene){error(ctx,"glTF has no default scene");return;}loadScene(ctx,scene);}function loadScene(ctx,scene){var nodes=scene.nodes;if(!nodes){return;}for(var _i512=0,len=nodes.length;_i512<len;_i512++){var _node6=nodes[_i512];countMeshUsage(ctx,_node6);}for(var _i513=0,_len109=nodes.length;_i513<_len109;_i513++){var _node7=nodes[_i513];loadNode(ctx,_node7,0,null);}}function countMeshUsage(ctx,node){var mesh=node.mesh;if(mesh){mesh.instances=mesh.instances?mesh.instances+1:1;}if(node.children){var children=node.children;for(var _i514=0,len=children.length;_i514<len;_i514++){var childNode=children[_i514];if(!childNode){error(ctx,"Node not found: "+_i514);continue;}countMeshUsage(ctx,childNode);}}}var deferredMeshIds=[];function loadNode(ctx,node,depth,matrix){ctx.gltfData;var localMatrix;if(node.matrix){localMatrix=node.matrix;if(matrix){matrix=math.mulMat4(matrix,localMatrix,math.mat4());}else{matrix=localMatrix;}}if(node.translation){localMatrix=math.translationMat4v(node.translation);if(matrix){matrix=math.mulMat4(matrix,localMatrix,math.mat4());}else{matrix=localMatrix;}}if(node.rotation){localMatrix=math.quaternionToMat4(node.rotation);if(matrix){matrix=math.mulMat4(matrix,localMatrix,math.mat4());}else{matrix=localMatrix;}}if(node.scale){localMatrix=math.scalingMat4v(node.scale);if(matrix){matrix=math.mulMat4(matrix,localMatrix,math.mat4());}else{matrix=localMatrix;}}var sceneModel=ctx.sceneModel;if(node.mesh){var _mesh6=node.mesh;if(ctx.handlenode){var actions={};if(!ctx.handlenode(ctx.sceneModel.id,node,actions)){return;}if(actions.createEntity);}var worldMatrix=matrix?matrix.slice():math.identityMat4();var numPrimitives=_mesh6.primitives.length;if(numPrimitives>0){for(var _i515=0;_i515<numPrimitives;_i515++){var _primitive4=_mesh6.primitives[_i515];if(_primitive4.mode<4){continue;}var meshCfg={id:sceneModel.id+"."+ctx.numObjects++};var material=_primitive4.material;if(material){meshCfg.textureSetId=material._textureSetId;meshCfg.color=material._attributes.color;meshCfg.opacity=material._attributes.opacity;meshCfg.metallic=material._attributes.metallic;meshCfg.roughness=material._attributes.roughness;}else{meshCfg.color=new Float32Array([1.0,1.0,1.0]);meshCfg.opacity=1.0;}var backfaces=ctx.backfaces!==false||material.doubleSided!==false;switch(_primitive4.mode){case 0:// POINTS
24479
+ var extensions=material.extensions;var materialAttributes={color:new Float32Array([1,1,1,1]),opacity:1,metallic:0,roughness:1,doubleSided:true};if(extensions){var specularPBR=extensions["KHR_materials_pbrSpecularGlossiness"];if(specularPBR){var diffuseFactor=specularPBR.diffuseFactor;if(diffuseFactor!==null&&diffuseFactor!==undefined){materialAttributes.color.set(diffuseFactor);}}var common=extensions["KHR_materials_common"];if(common){var technique=common.technique;var values=common.values||{};var blinn=technique==="BLINN";var phong=technique==="PHONG";var lambert=technique==="LAMBERT";var diffuse=values.diffuse;if(diffuse&&(blinn||phong||lambert)){if(!utils.isString(diffuse)){materialAttributes.color.set(diffuse);}}var transparency=values.transparency;if(transparency!==null&&transparency!==undefined){materialAttributes.opacity=transparency;}var transparent=values.transparent;if(transparent!==null&&transparent!==undefined){materialAttributes.opacity=transparent;}}}var metallicPBR=material.pbrMetallicRoughness;if(metallicPBR){var baseColorFactor=metallicPBR.baseColorFactor;if(baseColorFactor){materialAttributes.color[0]=baseColorFactor[0];materialAttributes.color[1]=baseColorFactor[1];materialAttributes.color[2]=baseColorFactor[2];materialAttributes.opacity=baseColorFactor[3];}var metallicFactor=metallicPBR.metallicFactor;if(metallicFactor!==null&&metallicFactor!==undefined){materialAttributes.metallic=metallicFactor;}var roughnessFactor=metallicPBR.roughnessFactor;if(roughnessFactor!==null&&roughnessFactor!==undefined){materialAttributes.roughness=roughnessFactor;}}materialAttributes.doubleSided=material.doubleSided!==false;return materialAttributes;}function loadDefaultScene(ctx){var gltfData=ctx.gltfData;var scene=gltfData.scene||gltfData.scenes[0];if(!scene){error(ctx,"glTF has no default scene");return;}loadScene(ctx,scene);}function loadScene(ctx,scene){var nodes=scene.nodes;if(!nodes){return;}for(var _i512=0,len=nodes.length;_i512<len;_i512++){var _node6=nodes[_i512];countMeshUsage(ctx,_node6);}for(var _i513=0,_len109=nodes.length;_i513<_len109;_i513++){var _node7=nodes[_i513];loadNode(ctx,_node7,0,null);}}function countMeshUsage(ctx,node){var mesh=node.mesh;if(mesh){mesh.instances=mesh.instances?mesh.instances+1:1;}if(node.children){var children=node.children;for(var _i514=0,len=children.length;_i514<len;_i514++){var childNode=children[_i514];if(!childNode){error(ctx,"Node not found: "+_i514);continue;}countMeshUsage(ctx,childNode);}}}var deferredMeshIds=[];function loadNode(ctx,node,depth,matrix){ctx.gltfData;var localMatrix;if(node.matrix){localMatrix=node.matrix;if(matrix){matrix=math.mulMat4(matrix,localMatrix,math.mat4());}else{matrix=localMatrix;}}if(node.translation){localMatrix=math.translationMat4v(node.translation);if(matrix){matrix=math.mulMat4(matrix,localMatrix,math.mat4());}else{matrix=localMatrix;}}if(node.rotation){localMatrix=math.quaternionToMat4(node.rotation);if(matrix){matrix=math.mulMat4(matrix,localMatrix,math.mat4());}else{matrix=localMatrix;}}if(node.scale){localMatrix=math.scalingMat4v(node.scale);if(matrix){matrix=math.mulMat4(matrix,localMatrix,math.mat4());}else{matrix=localMatrix;}}var sceneModel=ctx.sceneModel;if(node.mesh){var _mesh6=node.mesh;if(ctx.handlenode){var actions={};if(!ctx.handlenode(ctx.sceneModel.id,node,actions)){return;}if(actions.createEntity);}var worldMatrix=matrix?matrix.slice():math.identityMat4();var numPrimitives=_mesh6.primitives.length;if(numPrimitives>0){for(var _i515=0;_i515<numPrimitives;_i515++){var _primitive4=_mesh6.primitives[_i515];if(_primitive4.mode<4){continue;}var meshCfg={id:sceneModel.id+"."+ctx.numObjects++};var material=_primitive4.material;if(material){meshCfg.textureSetId=material._textureSetId;meshCfg.color=material._attributes.color;meshCfg.opacity=material._attributes.opacity;meshCfg.metallic=material._attributes.metallic;meshCfg.roughness=material._attributes.roughness;}else{meshCfg.color=new Float32Array([1.0,1.0,1.0]);meshCfg.opacity=1.0;}var backfaces=ctx.backfaces!==false||material&&material.doubleSided!==false;switch(_primitive4.mode){case 0:// POINTS
24480
24480
  meshCfg.primitive="points";break;case 1:// LINES
24481
24481
  meshCfg.primitive="lines";break;case 2:// LINE_LOOP
24482
24482
  meshCfg.primitive="lines";break;case 3:// LINE_STRIP