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