@xeokit/xeokit-sdk 2.6.0 → 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.
- package/README.md +11 -8
- package/dist/xeokit-sdk.cjs.js +3 -3
- package/dist/xeokit-sdk.es.js +3 -3
- package/dist/xeokit-sdk.es5.js +3 -3
- package/dist/xeokit-sdk.min.cjs.js +2 -2
- package/dist/xeokit-sdk.min.es.js +2 -2
- package/dist/xeokit-sdk.min.es5.js +2 -2
- package/package.json +11 -3
- package/src/plugins/GLTFLoaderPlugin/GLTFSceneModelLoader.js +1 -1
- package/src/viewer/scene/model/SceneModel.js +1 -1
- package/src/viewer/scene/model/SceneModelTransform.js +1 -1
package/README.md
CHANGED
|
@@ -7,6 +7,17 @@
|
|
|
7
7
|
[xeokit](http://xeokit.io) is a JavaScript software development kit created by [xeolabs](http://xeolabs.com) for viewing
|
|
8
8
|
high-detail, full-precision 3D engineering and BIM models in the browser.
|
|
9
9
|
|
|
10
|
+
## Resources
|
|
11
|
+
|
|
12
|
+
* [xeokit.io](https://xeokit.io/)
|
|
13
|
+
* [Examples](http://xeokit.github.io/xeokit-sdk/examples/)
|
|
14
|
+
* [Guides](https://www.notion.so/xeokit/xeokit-Documentation-4598591fcedb4889bf8896750651f74e)
|
|
15
|
+
* [API Docs](https://xeokit.github.io/xeokit-sdk/docs/)
|
|
16
|
+
* [Features](https://xeokit.io/index.html?foo=1#features)
|
|
17
|
+
* [Changelog](https://github.com/xeokit/xeokit-sdk/blob/master/CHANGELOG.md)
|
|
18
|
+
* [FAQ](https://xeokit.io/index.html?foo=1#faq)
|
|
19
|
+
* [License](https://xeokit.io/index.html#pricing)
|
|
20
|
+
|
|
10
21
|
## Installing
|
|
11
22
|
|
|
12
23
|
````bash
|
|
@@ -89,15 +100,7 @@ which we can pre-convert offline from other formats.
|
|
|
89
100
|
</html>
|
|
90
101
|
````
|
|
91
102
|
|
|
92
|
-
## Resources
|
|
93
103
|
|
|
94
|
-
* [xeokit.io](https://xeokit.io/)
|
|
95
|
-
* [Examples](http://xeokit.github.io/xeokit-sdk/examples/)
|
|
96
|
-
* [Guides](https://www.notion.so/xeokit/xeokit-Documentation-4598591fcedb4889bf8896750651f74e)
|
|
97
|
-
* [API Docs](https://xeokit.github.io/xeokit-sdk/docs/)
|
|
98
|
-
* [Features](https://xeokit.io/index.html?foo=1#features)
|
|
99
|
-
* [FAQ](https://xeokit.io/index.html?foo=1#faq)
|
|
100
|
-
* [License](https://xeokit.io/index.html#pricing)
|
|
101
104
|
|
|
102
105
|
|
|
103
106
|
|
package/dist/xeokit-sdk.cjs.js
CHANGED
|
@@ -80391,7 +80391,7 @@ class SceneModelTransform {
|
|
|
80391
80391
|
_addChildTransform(childTransform) {
|
|
80392
80392
|
this._childTransforms.push(childTransform);
|
|
80393
80393
|
childTransform._parentTransform = this;
|
|
80394
|
-
childTransform.
|
|
80394
|
+
childTransform._transformDirty();
|
|
80395
80395
|
childTransform._setAABBDirty();
|
|
80396
80396
|
}
|
|
80397
80397
|
|
|
@@ -83367,7 +83367,7 @@ class SceneModel extends Component {
|
|
|
83367
83367
|
const transform = new SceneModelTransform({
|
|
83368
83368
|
id: cfg.id,
|
|
83369
83369
|
model: this,
|
|
83370
|
-
parentTransform,
|
|
83370
|
+
parent: parentTransform,
|
|
83371
83371
|
matrix: cfg.matrix,
|
|
83372
83372
|
position: cfg.position,
|
|
83373
83373
|
scale: cfg.scale,
|
|
@@ -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
|
package/dist/xeokit-sdk.es.js
CHANGED
|
@@ -80387,7 +80387,7 @@ class SceneModelTransform {
|
|
|
80387
80387
|
_addChildTransform(childTransform) {
|
|
80388
80388
|
this._childTransforms.push(childTransform);
|
|
80389
80389
|
childTransform._parentTransform = this;
|
|
80390
|
-
childTransform.
|
|
80390
|
+
childTransform._transformDirty();
|
|
80391
80391
|
childTransform._setAABBDirty();
|
|
80392
80392
|
}
|
|
80393
80393
|
|
|
@@ -83363,7 +83363,7 @@ class SceneModel extends Component {
|
|
|
83363
83363
|
const transform = new SceneModelTransform({
|
|
83364
83364
|
id: cfg.id,
|
|
83365
83365
|
model: this,
|
|
83366
|
-
parentTransform,
|
|
83366
|
+
parent: parentTransform,
|
|
83367
83367
|
matrix: cfg.matrix,
|
|
83368
83368
|
position: cfg.position,
|
|
83369
83369
|
scale: cfg.scale,
|
|
@@ -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
|
package/dist/xeokit-sdk.es5.js
CHANGED
|
@@ -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.
|
|
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.
|
|
@@ -18474,7 +18474,7 @@ if(!this._textureTranscoder){this.error("[createTexture] Can't create texture fr
|
|
|
18474
18474
|
* @param {Number[]} [cfg.rotation=[0,0,0]] Rotation of the transform as Euler angles given in degrees, for each of the X, Y and Z axis.
|
|
18475
18475
|
* @param {Number[]} [cfg.matrix=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]] Modelling transform matrix. Overrides the ````position````, ````scale```` and ````rotation```` parameters.
|
|
18476
18476
|
* @returns {SceneModelTransform} The new transform.
|
|
18477
|
-
*/},{key:"createTransform",value:function createTransform(cfg){if(cfg.id===undefined||cfg.id===null){this.error("[createTransform] SceneModel.createTransform() config missing: id");return;}if(this._transforms[cfg.id]){this.error("[createTransform] SceneModel already has a transform with this ID: ".concat(cfg.id));return;}var parentTransform;if(cfg.parentTransformId){parentTransform=this._transforms[cfg.parentTransformId];if(!parentTransform){this.error("[createTransform] SceneModel.createTransform() config missing: id");return;}}var transform=new SceneModelTransform({id:cfg.id,model:this,
|
|
18477
|
+
*/},{key:"createTransform",value:function createTransform(cfg){if(cfg.id===undefined||cfg.id===null){this.error("[createTransform] SceneModel.createTransform() config missing: id");return;}if(this._transforms[cfg.id]){this.error("[createTransform] SceneModel already has a transform with this ID: ".concat(cfg.id));return;}var parentTransform;if(cfg.parentTransformId){parentTransform=this._transforms[cfg.parentTransformId];if(!parentTransform){this.error("[createTransform] SceneModel.createTransform() config missing: id");return;}}var transform=new SceneModelTransform({id:cfg.id,model:this,parent:parentTransform,matrix:cfg.matrix,position:cfg.position,scale:cfg.scale,rotation:cfg.rotation,quaternion:cfg.quaternion});this._transforms[transform.id]=transform;return transform;}/**
|
|
18478
18478
|
* Creates a new {@link SceneModelMesh} within this SceneModel.
|
|
18479
18479
|
*
|
|
18480
18480
|
* * It prepares and saves data for a SceneModelMesh {@link SceneModel#meshes} creation. SceneModelMesh will be created only once the SceneModelEntity (which references this particular SceneModelMesh) will be created.
|
|
@@ -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
|