@xeokit/xeokit-sdk 2.3.0-beta-3 → 2.3.0-beta-4
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/dist/xeokit-sdk.cjs.js +53 -39
- package/dist/xeokit-sdk.es.js +53 -39
- package/dist/xeokit-sdk.min.cjs.js +1 -1
- package/dist/xeokit-sdk.min.es.js +1 -1
- package/package.json +1 -1
package/dist/xeokit-sdk.cjs.js
CHANGED
|
@@ -98887,10 +98887,8 @@ const ParserV9 = {
|
|
|
98887
98887
|
};
|
|
98888
98888
|
|
|
98889
98889
|
/*
|
|
98890
|
-
|
|
98891
98890
|
Parser for .XKT Format V10
|
|
98892
|
-
|
|
98893
|
-
*/
|
|
98891
|
+
*/
|
|
98894
98892
|
|
|
98895
98893
|
let pako = window.pako || p;
|
|
98896
98894
|
if (!pako.inflate) { // See https://github.com/nodeca/pako/issues/97
|
|
@@ -98906,30 +98904,31 @@ function extract(elements) {
|
|
|
98906
98904
|
metadata: elements[0],
|
|
98907
98905
|
textureData: elements[1],
|
|
98908
98906
|
eachTextureDataPortion: elements[2],
|
|
98909
|
-
|
|
98910
|
-
|
|
98911
|
-
|
|
98912
|
-
|
|
98913
|
-
|
|
98914
|
-
|
|
98915
|
-
|
|
98916
|
-
|
|
98917
|
-
|
|
98918
|
-
|
|
98919
|
-
|
|
98920
|
-
|
|
98921
|
-
|
|
98922
|
-
|
|
98923
|
-
|
|
98924
|
-
|
|
98925
|
-
|
|
98926
|
-
|
|
98927
|
-
|
|
98928
|
-
|
|
98929
|
-
|
|
98930
|
-
|
|
98931
|
-
|
|
98932
|
-
|
|
98907
|
+
eachTextureDimensions: elements[3],
|
|
98908
|
+
positions: elements[4],
|
|
98909
|
+
normals: elements[5],
|
|
98910
|
+
colors: elements[6],
|
|
98911
|
+
uvs: elements[7],
|
|
98912
|
+
indices: elements[8],
|
|
98913
|
+
edgeIndices: elements[9],
|
|
98914
|
+
eachTextureSetTextures: elements[10],
|
|
98915
|
+
matrices: elements[11],
|
|
98916
|
+
reusedGeometriesDecodeMatrix: elements[12],
|
|
98917
|
+
eachGeometryPrimitiveType: elements[13],
|
|
98918
|
+
eachGeometryPositionsPortion: elements[14],
|
|
98919
|
+
eachGeometryNormalsPortion: elements[15],
|
|
98920
|
+
eachGeometryColorsPortion: elements[16],
|
|
98921
|
+
eachGeometryUVsPortion: elements[17],
|
|
98922
|
+
eachGeometryIndicesPortion: elements[18],
|
|
98923
|
+
eachGeometryEdgeIndicesPortion: elements[19],
|
|
98924
|
+
eachMeshGeometriesPortion: elements[20],
|
|
98925
|
+
eachMeshMatricesPortion: elements[21],
|
|
98926
|
+
eachMeshTextureSet: elements[22],
|
|
98927
|
+
eachMeshMaterialAttributes: elements[23],
|
|
98928
|
+
eachEntityId: elements[24],
|
|
98929
|
+
eachEntityMeshesPortion: elements[25],
|
|
98930
|
+
eachTileAABB: elements[26],
|
|
98931
|
+
eachTileEntitiesPortion: elements[27]
|
|
98933
98932
|
};
|
|
98934
98933
|
}
|
|
98935
98934
|
|
|
@@ -98941,8 +98940,9 @@ function inflate(deflatedData) {
|
|
|
98941
98940
|
|
|
98942
98941
|
return {
|
|
98943
98942
|
metadata: JSON.parse(pako.inflate(deflatedData.metadata, {to: 'string'})),
|
|
98944
|
-
textureData: new
|
|
98943
|
+
textureData: new Uint8ClampedArray(inflate(deflatedData.textureData)),
|
|
98945
98944
|
eachTextureDataPortion: new Uint32Array(inflate(deflatedData.eachTextureDataPortion)),
|
|
98945
|
+
eachTextureDimensions: new Uint16Array(inflate(deflatedData.eachTextureDimensions)),
|
|
98946
98946
|
positions: new Uint16Array(inflate(deflatedData.positions)),
|
|
98947
98947
|
normals: new Int8Array(inflate(deflatedData.normals)),
|
|
98948
98948
|
colors: new Uint8Array(inflate(deflatedData.colors)),
|
|
@@ -98980,11 +98980,23 @@ const decompressColor = (function () {
|
|
|
98980
98980
|
};
|
|
98981
98981
|
})();
|
|
98982
98982
|
|
|
98983
|
+
const imagDataToImage = (function () {
|
|
98984
|
+
const canvas = document.createElement('canvas');
|
|
98985
|
+
const context = canvas.getContext('2d');
|
|
98986
|
+
return function (imagedata) {
|
|
98987
|
+
canvas.width = imagedata.width;
|
|
98988
|
+
canvas.height = imagedata.height;
|
|
98989
|
+
context.putImageData(imagedata, 0, 0);
|
|
98990
|
+
return canvas.toDataURL();
|
|
98991
|
+
};
|
|
98992
|
+
})();
|
|
98993
|
+
|
|
98983
98994
|
function load(viewer, options, inflatedData, performanceModel) {
|
|
98984
98995
|
|
|
98985
98996
|
const metadata = inflatedData.metadata;
|
|
98986
98997
|
const textureData = inflatedData.textureData;
|
|
98987
98998
|
const eachTextureDataPortion = inflatedData.eachTextureDataPortion;
|
|
98999
|
+
const eachTextureDimensions = inflatedData.eachTextureDimensions;
|
|
98988
99000
|
const positions = inflatedData.positions;
|
|
98989
99001
|
const normals = inflatedData.normals;
|
|
98990
99002
|
const colors = inflatedData.colors;
|
|
@@ -99041,16 +99053,23 @@ function load(viewer, options, inflatedData, performanceModel) {
|
|
|
99041
99053
|
for (let textureIndex = 0; textureIndex < numTextures; textureIndex++) {
|
|
99042
99054
|
const atLastTexture = (textureIndex === (numTextures - 1));
|
|
99043
99055
|
const textureDataPortionStart = eachTextureDataPortion[textureIndex];
|
|
99044
|
-
const textureDataPortionEnd = atLastTexture ? textureData.length : (eachTextureDataPortion[textureIndex + 1]
|
|
99056
|
+
const textureDataPortionEnd = atLastTexture ? textureData.length : (eachTextureDataPortion[textureIndex + 1]);
|
|
99045
99057
|
const textureDataPortionSize = textureDataPortionEnd - textureDataPortionStart;
|
|
99046
99058
|
const textureDataPortionExists = (textureDataPortionSize > 0);
|
|
99047
99059
|
if (textureDataPortionExists) {
|
|
99048
|
-
const
|
|
99049
|
-
const
|
|
99060
|
+
const imageDataSubarray = textureData.subarray(textureDataPortionStart, textureDataPortionEnd);
|
|
99061
|
+
const width = eachTextureDimensions[textureIndex * 2 + 0];
|
|
99062
|
+
const height = eachTextureDimensions[textureIndex * 2 + 1];
|
|
99063
|
+
const imageData = new ImageData(imageDataSubarray, width, height);
|
|
99064
|
+
|
|
99065
|
+
//////////////////////////////////////////////////////////////
|
|
99066
|
+
// TODO: This is super inefficient - replace with Basis:
|
|
99067
|
+
//////////////////////////////////////////////////////////////
|
|
99068
|
+
|
|
99069
|
+
const image = imagDataToImage(imageData);
|
|
99050
99070
|
performanceModel.createTexture({
|
|
99051
99071
|
id: `texture-${textureIndex}`,
|
|
99052
|
-
src:
|
|
99053
|
-
// flipY: true
|
|
99072
|
+
src: image
|
|
99054
99073
|
});
|
|
99055
99074
|
}
|
|
99056
99075
|
}
|
|
@@ -99197,15 +99216,10 @@ function load(viewer, options, inflatedData, performanceModel) {
|
|
|
99197
99216
|
const textureSetId = (textureSetIndex >= 0) ? `textureSet-${textureSetIndex}` : null;
|
|
99198
99217
|
|
|
99199
99218
|
const meshColor = decompressColor(eachMeshMaterialAttributes.subarray((meshIndex * 6), (meshIndex * 6) + 3));
|
|
99200
|
-
|
|
99219
|
+
const meshOpacity = eachMeshMaterialAttributes[(meshIndex * 6) + 3] / 255.0;
|
|
99201
99220
|
const meshMetallic = eachMeshMaterialAttributes[(meshIndex * 6) + 4] / 255.0;
|
|
99202
99221
|
const meshRoughness = eachMeshMaterialAttributes[(meshIndex * 6) + 5] / 255.0;
|
|
99203
99222
|
|
|
99204
|
-
// const meshColor = [.3, .3, .3];
|
|
99205
|
-
const meshOpacity = 1;
|
|
99206
|
-
// const meshMetallic = 0;
|
|
99207
|
-
// const meshRoughness = 1;
|
|
99208
|
-
|
|
99209
99223
|
const meshId = nextMeshId++;
|
|
99210
99224
|
|
|
99211
99225
|
if (isReusedGeometry) {
|
package/dist/xeokit-sdk.es.js
CHANGED
|
@@ -98883,10 +98883,8 @@ const ParserV9 = {
|
|
|
98883
98883
|
};
|
|
98884
98884
|
|
|
98885
98885
|
/*
|
|
98886
|
-
|
|
98887
98886
|
Parser for .XKT Format V10
|
|
98888
|
-
|
|
98889
|
-
*/
|
|
98887
|
+
*/
|
|
98890
98888
|
|
|
98891
98889
|
let pako = window.pako || p;
|
|
98892
98890
|
if (!pako.inflate) { // See https://github.com/nodeca/pako/issues/97
|
|
@@ -98902,30 +98900,31 @@ function extract(elements) {
|
|
|
98902
98900
|
metadata: elements[0],
|
|
98903
98901
|
textureData: elements[1],
|
|
98904
98902
|
eachTextureDataPortion: elements[2],
|
|
98905
|
-
|
|
98906
|
-
|
|
98907
|
-
|
|
98908
|
-
|
|
98909
|
-
|
|
98910
|
-
|
|
98911
|
-
|
|
98912
|
-
|
|
98913
|
-
|
|
98914
|
-
|
|
98915
|
-
|
|
98916
|
-
|
|
98917
|
-
|
|
98918
|
-
|
|
98919
|
-
|
|
98920
|
-
|
|
98921
|
-
|
|
98922
|
-
|
|
98923
|
-
|
|
98924
|
-
|
|
98925
|
-
|
|
98926
|
-
|
|
98927
|
-
|
|
98928
|
-
|
|
98903
|
+
eachTextureDimensions: elements[3],
|
|
98904
|
+
positions: elements[4],
|
|
98905
|
+
normals: elements[5],
|
|
98906
|
+
colors: elements[6],
|
|
98907
|
+
uvs: elements[7],
|
|
98908
|
+
indices: elements[8],
|
|
98909
|
+
edgeIndices: elements[9],
|
|
98910
|
+
eachTextureSetTextures: elements[10],
|
|
98911
|
+
matrices: elements[11],
|
|
98912
|
+
reusedGeometriesDecodeMatrix: elements[12],
|
|
98913
|
+
eachGeometryPrimitiveType: elements[13],
|
|
98914
|
+
eachGeometryPositionsPortion: elements[14],
|
|
98915
|
+
eachGeometryNormalsPortion: elements[15],
|
|
98916
|
+
eachGeometryColorsPortion: elements[16],
|
|
98917
|
+
eachGeometryUVsPortion: elements[17],
|
|
98918
|
+
eachGeometryIndicesPortion: elements[18],
|
|
98919
|
+
eachGeometryEdgeIndicesPortion: elements[19],
|
|
98920
|
+
eachMeshGeometriesPortion: elements[20],
|
|
98921
|
+
eachMeshMatricesPortion: elements[21],
|
|
98922
|
+
eachMeshTextureSet: elements[22],
|
|
98923
|
+
eachMeshMaterialAttributes: elements[23],
|
|
98924
|
+
eachEntityId: elements[24],
|
|
98925
|
+
eachEntityMeshesPortion: elements[25],
|
|
98926
|
+
eachTileAABB: elements[26],
|
|
98927
|
+
eachTileEntitiesPortion: elements[27]
|
|
98929
98928
|
};
|
|
98930
98929
|
}
|
|
98931
98930
|
|
|
@@ -98937,8 +98936,9 @@ function inflate(deflatedData) {
|
|
|
98937
98936
|
|
|
98938
98937
|
return {
|
|
98939
98938
|
metadata: JSON.parse(pako.inflate(deflatedData.metadata, {to: 'string'})),
|
|
98940
|
-
textureData: new
|
|
98939
|
+
textureData: new Uint8ClampedArray(inflate(deflatedData.textureData)),
|
|
98941
98940
|
eachTextureDataPortion: new Uint32Array(inflate(deflatedData.eachTextureDataPortion)),
|
|
98941
|
+
eachTextureDimensions: new Uint16Array(inflate(deflatedData.eachTextureDimensions)),
|
|
98942
98942
|
positions: new Uint16Array(inflate(deflatedData.positions)),
|
|
98943
98943
|
normals: new Int8Array(inflate(deflatedData.normals)),
|
|
98944
98944
|
colors: new Uint8Array(inflate(deflatedData.colors)),
|
|
@@ -98976,11 +98976,23 @@ const decompressColor = (function () {
|
|
|
98976
98976
|
};
|
|
98977
98977
|
})();
|
|
98978
98978
|
|
|
98979
|
+
const imagDataToImage = (function () {
|
|
98980
|
+
const canvas = document.createElement('canvas');
|
|
98981
|
+
const context = canvas.getContext('2d');
|
|
98982
|
+
return function (imagedata) {
|
|
98983
|
+
canvas.width = imagedata.width;
|
|
98984
|
+
canvas.height = imagedata.height;
|
|
98985
|
+
context.putImageData(imagedata, 0, 0);
|
|
98986
|
+
return canvas.toDataURL();
|
|
98987
|
+
};
|
|
98988
|
+
})();
|
|
98989
|
+
|
|
98979
98990
|
function load(viewer, options, inflatedData, performanceModel) {
|
|
98980
98991
|
|
|
98981
98992
|
const metadata = inflatedData.metadata;
|
|
98982
98993
|
const textureData = inflatedData.textureData;
|
|
98983
98994
|
const eachTextureDataPortion = inflatedData.eachTextureDataPortion;
|
|
98995
|
+
const eachTextureDimensions = inflatedData.eachTextureDimensions;
|
|
98984
98996
|
const positions = inflatedData.positions;
|
|
98985
98997
|
const normals = inflatedData.normals;
|
|
98986
98998
|
const colors = inflatedData.colors;
|
|
@@ -99037,16 +99049,23 @@ function load(viewer, options, inflatedData, performanceModel) {
|
|
|
99037
99049
|
for (let textureIndex = 0; textureIndex < numTextures; textureIndex++) {
|
|
99038
99050
|
const atLastTexture = (textureIndex === (numTextures - 1));
|
|
99039
99051
|
const textureDataPortionStart = eachTextureDataPortion[textureIndex];
|
|
99040
|
-
const textureDataPortionEnd = atLastTexture ? textureData.length : (eachTextureDataPortion[textureIndex + 1]
|
|
99052
|
+
const textureDataPortionEnd = atLastTexture ? textureData.length : (eachTextureDataPortion[textureIndex + 1]);
|
|
99041
99053
|
const textureDataPortionSize = textureDataPortionEnd - textureDataPortionStart;
|
|
99042
99054
|
const textureDataPortionExists = (textureDataPortionSize > 0);
|
|
99043
99055
|
if (textureDataPortionExists) {
|
|
99044
|
-
const
|
|
99045
|
-
const
|
|
99056
|
+
const imageDataSubarray = textureData.subarray(textureDataPortionStart, textureDataPortionEnd);
|
|
99057
|
+
const width = eachTextureDimensions[textureIndex * 2 + 0];
|
|
99058
|
+
const height = eachTextureDimensions[textureIndex * 2 + 1];
|
|
99059
|
+
const imageData = new ImageData(imageDataSubarray, width, height);
|
|
99060
|
+
|
|
99061
|
+
//////////////////////////////////////////////////////////////
|
|
99062
|
+
// TODO: This is super inefficient - replace with Basis:
|
|
99063
|
+
//////////////////////////////////////////////////////////////
|
|
99064
|
+
|
|
99065
|
+
const image = imagDataToImage(imageData);
|
|
99046
99066
|
performanceModel.createTexture({
|
|
99047
99067
|
id: `texture-${textureIndex}`,
|
|
99048
|
-
src:
|
|
99049
|
-
// flipY: true
|
|
99068
|
+
src: image
|
|
99050
99069
|
});
|
|
99051
99070
|
}
|
|
99052
99071
|
}
|
|
@@ -99193,15 +99212,10 @@ function load(viewer, options, inflatedData, performanceModel) {
|
|
|
99193
99212
|
const textureSetId = (textureSetIndex >= 0) ? `textureSet-${textureSetIndex}` : null;
|
|
99194
99213
|
|
|
99195
99214
|
const meshColor = decompressColor(eachMeshMaterialAttributes.subarray((meshIndex * 6), (meshIndex * 6) + 3));
|
|
99196
|
-
|
|
99215
|
+
const meshOpacity = eachMeshMaterialAttributes[(meshIndex * 6) + 3] / 255.0;
|
|
99197
99216
|
const meshMetallic = eachMeshMaterialAttributes[(meshIndex * 6) + 4] / 255.0;
|
|
99198
99217
|
const meshRoughness = eachMeshMaterialAttributes[(meshIndex * 6) + 5] / 255.0;
|
|
99199
99218
|
|
|
99200
|
-
// const meshColor = [.3, .3, .3];
|
|
99201
|
-
const meshOpacity = 1;
|
|
99202
|
-
// const meshMetallic = 0;
|
|
99203
|
-
// const meshRoughness = 1;
|
|
99204
|
-
|
|
99205
99219
|
const meshId = nextMeshId++;
|
|
99206
99220
|
|
|
99207
99221
|
if (isReusedGeometry) {
|