Skip to content

Commit 5ddfc13

Browse files
committed
Rebuild
1 parent 2cc9bd1 commit 5ddfc13

File tree

78 files changed

+98819
-236873
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+98819
-236873
lines changed

dist/convert2xkt.cjs.js

Lines changed: 53 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const XKT_INFO = {
1919
* @property xktVersion
2020
* @type {number}
2121
*/
22-
xktVersion: 11
22+
xktVersion: 12
2323
};
2424

2525
// Some temporary vars to help avoid garbage collection
@@ -4395,6 +4395,7 @@ class XKTGeometry {
43954395
* @param {*} cfg Configuration for the XKTGeometry.
43964396
* @param {Number} cfg.geometryId Unique ID of the geometry in {@link XKTModel#geometries}.
43974397
* @param {String} cfg.primitiveType Type of this geometry - "triangles", "points" or "lines" so far.
4398+
* @param {String} cfg.axisLabel Text label of this geometry - "A", "B1"
43984399
* @param {Number} cfg.geometryIndex Index of this XKTGeometry in {@link XKTModel#geometriesList}.
43994400
* @param {Float64Array} cfg.positions Non-quantized 3D vertex positions.
44004401
* @param {Float32Array} cfg.normals Non-compressed vertex normals.
@@ -4419,6 +4420,13 @@ class XKTGeometry {
44194420
*/
44204421
this.primitiveType = cfg.primitiveType;
44214422

4423+
/**
4424+
* The text label - "A", "B1".
4425+
*
4426+
* @type {String}
4427+
*/
4428+
this.axisLabel = cfg.axisLabel;
4429+
44224430
/**
44234431
* Index of this XKTGeometry in {@link XKTModel#geometriesList}.
44244432
*
@@ -9217,13 +9225,14 @@ class XKTModel {
92179225

92189226
const triangles = params.primitiveType === "triangles";
92199227
const points = params.primitiveType === "points";
9228+
const axis_label = params.primitiveType === "axis-label";
92209229
const lines = params.primitiveType === "lines";
92219230
const line_strip = params.primitiveType === "line-strip";
92229231
const line_loop = params.primitiveType === "line-loop";
92239232
params.primitiveType === "triangle-strip";
92249233
params.primitiveType === "triangle-fan";
92259234

9226-
if (!triangles && !points && !lines && !line_strip && !line_loop) {
9235+
if (!triangles && !points && !lines && !line_strip && !line_loop && !axis_label) {
92279236
throw "[XKTModel.createGeometry] Unsupported value for params.primitiveType: "
92289237
+ params.primitiveType
92299238
+ "' - supported values are 'triangles', 'points', 'lines', 'line-strip', 'triangle-strip' and 'triangle-fan";
@@ -9261,12 +9270,14 @@ class XKTModel {
92619270

92629271
const geometryId = params.geometryId;
92639272
const primitiveType = params.primitiveType;
9273+
const axisLabel = params.axisLabel;
92649274
const positions = new Float64Array(params.positions); // May modify in #finalize
92659275

92669276
const xktGeometryCfg = {
92679277
geometryId: geometryId,
92689278
geometryIndex: this.geometriesList.length,
92699279
primitiveType: primitiveType,
9280+
axisLabel,
92709281
positions: positions,
92719282
uvs: params.uvs || params.uv
92729283
};
@@ -16648,11 +16659,17 @@ function parseNodeMesh(node, ctx, matrix, meshIds) {
1664816659
const geometryId = createPrimitiveHash(primitive);
1664916660
if (!ctx.geometriesCreated[geometryId]) {
1665016661
const geometryCfg = {
16651-
geometryId
16662+
geometryId,
16663+
axisLabel: "",
1665216664
};
1665316665
switch (primitive.mode) {
1665416666
case 0: // POINTS
16655-
geometryCfg.primitiveType = "points";
16667+
if(primitive.extras?.IfcAxisLabel){
16668+
geometryCfg.primitiveType = "axis-label";
16669+
geometryCfg.axisLabel = primitive.extras.IfcAxisLabel;
16670+
}
16671+
else
16672+
geometryCfg.primitiveType = "points";
1665616673
break;
1665716674
case 1: // LINES
1665816675
geometryCfg.primitiveType = "lines";
@@ -26297,6 +26314,7 @@ function writeXKTModelToArrayBufferUncompressed(xktModel, metaModelJSON, stats)
2629726314
data.matrices,
2629826315
data.reusedGeometriesDecodeMatrix,
2629926316
data.eachGeometryPrimitiveType,
26317+
object2Array(data.eachGeometryAxisLabel),
2630026318
data.eachGeometryPositionsPortion,
2630126319
data.eachGeometryNormalsPortion,
2630226320
data.eachGeometryColorsPortion,
@@ -26316,7 +26334,7 @@ function writeXKTModelToArrayBufferUncompressed(xktModel, metaModelJSON, stats)
2631626334
const arraysCnt = arrays.length;
2631726335
const dataView = new DataView(new ArrayBuffer((1 + 2 * arraysCnt) * 4));
2631826336

26319-
dataView.setUint32(0, XKT_VERSION, true);
26337+
dataView.setUint32(0, 0 << 31 | XKT_VERSION, true);
2632026338

2632126339
let byteOffset = dataView.byteLength;
2632226340
const offsets = [ ];
@@ -26460,6 +26478,7 @@ function getModelData(xktModel, metaModelDataStr, stats) {
2646026478
matrices: new Float32Array(lenMatrices), // Modeling matrices for entities that share geometries. Each entity either shares all it's geometries, or owns all its geometries exclusively. Exclusively-owned geometries are pre-transformed into World-space, and so their entities don't have modeling matrices in this array.
2646126479
reusedGeometriesDecodeMatrix: new Float32Array(xktModel.reusedGeometriesDecodeMatrix), // A single, global vertex position de-quantization matrix for all reused geometries. Reused geometries are quantized to their collective Local-space AABB, and this matrix is derived from that AABB.
2646226480
eachGeometryPrimitiveType: new Uint8Array(numGeometries), // Primitive type for each geometry (0=solid triangles, 1=surface triangles, 2=lines, 3=points, 4=line-strip)
26481+
eachGeometryAxisLabel: [], //for each primitive, an axis label
2646326482
eachGeometryPositionsPortion: new Uint32Array(numGeometries), // For each geometry, an index to its first element in data.positions. Every primitive type has positions.
2646426483
eachGeometryNormalsPortion: new Uint32Array(numGeometries), // For each geometry, an index to its first element in data.normals. If the next geometry has the same index, then this geometry has no normals.
2646526484
eachGeometryColorsPortion: new Uint32Array(numGeometries), // For each geometry, an index to its first element in data.colors. If the next geometry has the same index, then this geometry has no colors.
@@ -26558,10 +26577,14 @@ function getModelData(xktModel, metaModelDataStr, stats) {
2655826577
case "triangle-fan":
2655926578
primitiveType = 6;
2656026579
break;
26580+
case "axis-label":
26581+
primitiveType = 7;
26582+
break;
2656126583
default:
2656226584
primitiveType = 1;
2656326585
}
2656426586
data.eachGeometryPrimitiveType [geometryIndex] = primitiveType;
26587+
data.eachGeometryAxisLabel [geometryIndex] = geometry.axisLabel;
2656526588
data.eachGeometryPositionsPortion [geometryIndex] = countPositions;
2656626589
data.eachGeometryNormalsPortion [geometryIndex] = countNormals;
2656726590
data.eachGeometryColorsPortion [geometryIndex] = countColors;
@@ -26726,6 +26749,10 @@ function deflateData(data, metaModelJSON, options) {
2672626749
matrices: deflate(data.matrices.buffer),
2672726750
reusedGeometriesDecodeMatrix: deflate(data.reusedGeometriesDecodeMatrix.buffer),
2672826751
eachGeometryPrimitiveType: deflate(data.eachGeometryPrimitiveType.buffer),
26752+
eachGeometryAxisLabel: deflate(JSON.stringify(data.eachGeometryAxisLabel)
26753+
.replace(/[\u007F-\uFFFF]/g, function (chr) { // Produce only ASCII-chars, so that the data can be inflated later
26754+
return "\\u" + ("0000" + chr.charCodeAt(0).toString(16)).substr(-4)
26755+
})),
2672926756
eachGeometryPositionsPortion: deflate(data.eachGeometryPositionsPortion.buffer),
2673026757
eachGeometryNormalsPortion: deflate(data.eachGeometryNormalsPortion.buffer),
2673126758
eachGeometryColorsPortion: deflate(data.eachGeometryColorsPortion.buffer),
@@ -26769,6 +26796,7 @@ function createArrayBuffer(deflatedData) {
2676926796
deflatedData.matrices,
2677026797
deflatedData.reusedGeometriesDecodeMatrix,
2677126798
deflatedData.eachGeometryPrimitiveType,
26799+
deflatedData.eachGeometryAxisLabel,
2677226800
deflatedData.eachGeometryPositionsPortion,
2677326801
deflatedData.eachGeometryNormalsPortion,
2677426802
deflatedData.eachGeometryColorsPortion,
@@ -26787,21 +26815,24 @@ function createArrayBuffer(deflatedData) {
2678726815
}
2678826816

2678926817
function toArrayBuffer$1(elements) {
26790-
const indexData = new Uint32Array(elements.length + 2);
26791-
indexData[0] = 10; // XKT_VERSION for legacy v10 mode
26792-
indexData [1] = elements.length; // Stored Data 1.1: number of stored elements
26793-
let dataLen = 0; // Stored Data 1.2: length of stored elements
26794-
for (let i = 0, len = elements.length; i < len; i++) {
26795-
const element = elements[i];
26796-
const elementsize = element.length;
26797-
indexData[i + 2] = elementsize;
26798-
dataLen += elementsize;
26799-
}
26800-
const indexBuf = new Uint8Array(indexData.buffer);
26801-
const dataArray = new Uint8Array(indexBuf.length + dataLen);
26802-
dataArray.set(indexBuf);
26803-
let offset = indexBuf.length;
26804-
for (let i = 0, len = elements.length; i < len; i++) { // Stored Data 2: the elements themselves
26818+
const headerSize = (2 + elements.length) * 4;
26819+
26820+
const dataView = new DataView(new ArrayBuffer(headerSize));
26821+
dataView.setUint32(0, 1 << 31 | XKT_VERSION, true);
26822+
dataView.setUint32(4, elements.length, true);
26823+
26824+
let dataLen = 0;
26825+
for(let i=0;i<elements.length;i++){
26826+
const elementSize = elements[i].length;
26827+
dataView.setUint32((i+2)*4, elementSize, true);
26828+
dataLen += elementSize;
26829+
}
26830+
26831+
const dataArray = new Uint8Array(headerSize + dataLen);
26832+
dataArray.set(new Uint8Array(dataView.buffer));
26833+
26834+
let offset = headerSize;
26835+
for(let i=0; i < elements.length;i++) {
2680526836
const element = elements[i];
2680626837
dataArray.set(element, offset);
2680726838
offset += element.length;
@@ -26905,7 +26936,7 @@ function convert2xkt({
2690526936
rotateX = false,
2690626937
includeTextures = true,
2690726938
includeNormals = true,
26908-
zip = true,
26939+
zip = false,
2690926940
log = function (msg) {
2691026941
}
2691126942
}) {
@@ -27203,7 +27234,7 @@ function convert2xkt({
2720327234
stats.minTileSize = minTileSize || 200;
2720427235
stats.sourceSize = (sourceFileSizeBytes / 1000).toFixed(2);
2720527236
stats.xktSize = (targetFileSizeBytes / 1000).toFixed(2);
27206-
stats.xktVersion = zip ? 10 : XKT_INFO.xktVersion;
27237+
stats.xktVersion = XKT_INFO.xktVersion;
2720727238
stats.compressionRatio = (sourceFileSizeBytes / targetFileSizeBytes).toFixed(2);
2720827239
stats.conversionTime = ((new Date() - startTime) / 1000.0).toFixed(2);
2720927240
stats.aabb = xktModel.aabb;

0 commit comments

Comments
 (0)