Skip to content

Commit 9a323a8

Browse files
committed
Rebuild
1 parent 167efe1 commit 9a323a8

File tree

9 files changed

+39897
-37567
lines changed

9 files changed

+39897
-37567
lines changed

dist/convert2xkt.cjs.js

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16135,6 +16135,7 @@ function parseGLTFIntoXKTModel({
1613516135
includeTextures: (includeTextures !== false),
1613616136
geometryCreated: {},
1613716137
nextId: 0,
16138+
geometriesCreated : {},
1613816139
stats
1613916140
};
1614016141

@@ -16423,7 +16424,7 @@ function parseScene(ctx, scene) {
1642316424
}
1642416425
}
1642516426

16426-
function countMeshUsage(ctx, node, level=0) {
16427+
function countMeshUsage(ctx, node, level = 0) {
1642716428
if (!node) {
1642816429
return;
1642916430
}
@@ -16439,12 +16440,12 @@ function countMeshUsage(ctx, node, level=0) {
1643916440
ctx.error("Node not found: " + i);
1644016441
continue;
1644116442
}
16442-
countMeshUsage(ctx, childNode, level+1);
16443+
countMeshUsage(ctx, childNode, level + 1);
1644316444
}
1644416445
}
1644516446
}
1644616447

16447-
function testIfNodesHaveNames(node, level=0) {
16448+
function testIfNodesHaveNames(node, level = 0) {
1644816449
if (!node) {
1644916450
return;
1645016451
}
@@ -16455,7 +16456,7 @@ function testIfNodesHaveNames(node, level=0) {
1645516456
const children = node.children;
1645616457
for (let i = 0, len = children.length; i < len; i++) {
1645716458
const childNode = children[i];
16458-
if (testIfNodesHaveNames(childNode, level+1)) {
16459+
if (testIfNodesHaveNames(childNode, level + 1)) {
1645916460
return true;
1646016461
}
1646116462
}
@@ -16609,6 +16610,17 @@ function parseNodeMatrix(node, matrix) {
1660916610
return matrix;
1661016611
}
1661116612

16613+
function createPrimitiveHash(primitive) {
16614+
const hash = [];
16615+
const attributes = primitive.attributes;
16616+
if (attributes) {
16617+
for (let key in attributes) {
16618+
hash.push(attributes[key].id);
16619+
}
16620+
}
16621+
return hash.join(".");
16622+
}
16623+
1661216624
/**
1661316625
* Parses primitives referenced by the mesh belonging to the given node, creating XKTMeshes in the XKTModel.
1661416626
*
@@ -16630,10 +16642,10 @@ function parseNodeMesh(node, ctx, matrix, meshIds) {
1663016642
for (let i = 0; i < numPrimitives; i++) {
1663116643
try {
1663216644
const primitive = mesh.primitives[i];
16633-
if (!primitive._xktGeometryId) {
16634-
const xktGeometryId = "geometry-" + ctx.nextId++;
16645+
const geometryId = createPrimitiveHash(primitive);
16646+
if (!ctx.geometriesCreated[geometryId]) {
1663516647
const geometryCfg = {
16636-
geometryId: xktGeometryId
16648+
geometryId
1663716649
};
1663816650
switch (primitive.mode) {
1663916651
case 0: // POINTS
@@ -16688,13 +16700,13 @@ function parseNodeMesh(node, ctx, matrix, meshIds) {
1668816700
}
1668916701
}
1669016702
ctx.xktModel.createGeometry(geometryCfg);
16691-
primitive._xktGeometryId = xktGeometryId;
16703+
ctx.geometriesCreated[geometryId] = true;
1669216704
ctx.stats.numGeometries++;
1669316705
}
1669416706
const xktMeshId = ctx.nextId++;
1669516707
const meshCfg = {
1669616708
meshId: xktMeshId,
16697-
geometryId: primitive._xktGeometryId,
16709+
geometryId,
1669816710
matrix: matrix ? matrix.slice() : math.identityMat4()
1669916711
};
1670016712
const material = primitive.material;

dist/xeokit-convert.cjs.js

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10461,6 +10461,7 @@ function parseGLTFIntoXKTModel(_ref) {
1046110461
includeTextures: includeTextures !== false,
1046210462
geometryCreated: {},
1046310463
nextId: 0,
10464+
geometriesCreated: {},
1046410465
stats: stats
1046510466
};
1046610467
ctx.log("Using parser: parseGLTFIntoXKTModel");
@@ -10914,6 +10915,16 @@ function parseNodeMatrix(node, matrix) {
1091410915
}
1091510916
return matrix;
1091610917
}
10918+
function createPrimitiveHash(primitive) {
10919+
var hash = [];
10920+
var attributes = primitive.attributes;
10921+
if (attributes) {
10922+
for (var key in attributes) {
10923+
hash.push(attributes[key].id);
10924+
}
10925+
}
10926+
return hash.join(".");
10927+
}
1091710928

1091810929
/**
1091910930
* Parses primitives referenced by the mesh belonging to the given node, creating XKTMeshes in the XKTModel.
@@ -10936,10 +10947,10 @@ function parseNodeMesh(node, ctx, matrix, meshIds) {
1093610947
for (var i = 0; i < numPrimitives; i++) {
1093710948
try {
1093810949
var primitive = mesh.primitives[i];
10939-
if (!primitive._xktGeometryId) {
10940-
var xktGeometryId = "geometry-" + ctx.nextId++;
10950+
var geometryId = createPrimitiveHash(primitive);
10951+
if (!ctx.geometriesCreated[geometryId]) {
1094110952
var geometryCfg = {
10942-
geometryId: xktGeometryId
10953+
geometryId: geometryId
1094310954
};
1094410955
switch (primitive.mode) {
1094510956
case 0:
@@ -11001,13 +11012,13 @@ function parseNodeMesh(node, ctx, matrix, meshIds) {
1100111012
}
1100211013
}
1100311014
ctx.xktModel.createGeometry(geometryCfg);
11004-
primitive._xktGeometryId = xktGeometryId;
11015+
ctx.geometriesCreated[geometryId] = true;
1100511016
ctx.stats.numGeometries++;
1100611017
}
1100711018
var xktMeshId = ctx.nextId++;
1100811019
var meshCfg = {
1100911020
meshId: xktMeshId,
11010-
geometryId: primitive._xktGeometryId,
11021+
geometryId: geometryId,
1101111022
matrix: matrix ? matrix.slice() : _lib_math_js__WEBPACK_IMPORTED_MODULE_1__.math.identityMat4()
1101211023
};
1101311024
var material = primitive.material;

dist/xeokit-convert.cjs.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/xeokit-convert.es.js

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23492,6 +23492,7 @@ function parseGLTFIntoXKTModel({
2349223492
includeTextures: (includeTextures !== false),
2349323493
geometryCreated: {},
2349423494
nextId: 0,
23495+
geometriesCreated : {},
2349523496
stats
2349623497
};
2349723498

@@ -23780,7 +23781,7 @@ function parseScene$1(ctx, scene) {
2378023781
}
2378123782
}
2378223783

23783-
function countMeshUsage(ctx, node, level=0) {
23784+
function countMeshUsage(ctx, node, level = 0) {
2378423785
if (!node) {
2378523786
return;
2378623787
}
@@ -23796,12 +23797,12 @@ function countMeshUsage(ctx, node, level=0) {
2379623797
ctx.error("Node not found: " + i);
2379723798
continue;
2379823799
}
23799-
countMeshUsage(ctx, childNode, level+1);
23800+
countMeshUsage(ctx, childNode, level + 1);
2380023801
}
2380123802
}
2380223803
}
2380323804

23804-
function testIfNodesHaveNames(node, level=0) {
23805+
function testIfNodesHaveNames(node, level = 0) {
2380523806
if (!node) {
2380623807
return;
2380723808
}
@@ -23812,7 +23813,7 @@ function testIfNodesHaveNames(node, level=0) {
2381223813
const children = node.children;
2381323814
for (let i = 0, len = children.length; i < len; i++) {
2381423815
const childNode = children[i];
23815-
if (testIfNodesHaveNames(childNode, level+1)) {
23816+
if (testIfNodesHaveNames(childNode, level + 1)) {
2381623817
return true;
2381723818
}
2381823819
}
@@ -23966,6 +23967,17 @@ function parseNodeMatrix(node, matrix) {
2396623967
return matrix;
2396723968
}
2396823969

23970+
function createPrimitiveHash(primitive) {
23971+
const hash = [];
23972+
const attributes = primitive.attributes;
23973+
if (attributes) {
23974+
for (let key in attributes) {
23975+
hash.push(attributes[key].id);
23976+
}
23977+
}
23978+
return hash.join(".");
23979+
}
23980+
2396923981
/**
2397023982
* Parses primitives referenced by the mesh belonging to the given node, creating XKTMeshes in the XKTModel.
2397123983
*
@@ -23987,10 +23999,10 @@ function parseNodeMesh(node, ctx, matrix, meshIds) {
2398723999
for (let i = 0; i < numPrimitives; i++) {
2398824000
try {
2398924001
const primitive = mesh.primitives[i];
23990-
if (!primitive._xktGeometryId) {
23991-
const xktGeometryId = "geometry-" + ctx.nextId++;
24002+
const geometryId = createPrimitiveHash(primitive);
24003+
if (!ctx.geometriesCreated[geometryId]) {
2399224004
const geometryCfg = {
23993-
geometryId: xktGeometryId
24005+
geometryId
2399424006
};
2399524007
switch (primitive.mode) {
2399624008
case 0: // POINTS
@@ -24045,13 +24057,13 @@ function parseNodeMesh(node, ctx, matrix, meshIds) {
2404524057
}
2404624058
}
2404724059
ctx.xktModel.createGeometry(geometryCfg);
24048-
primitive._xktGeometryId = xktGeometryId;
24060+
ctx.geometriesCreated[geometryId] = true;
2404924061
ctx.stats.numGeometries++;
2405024062
}
2405124063
const xktMeshId = ctx.nextId++;
2405224064
const meshCfg = {
2405324065
meshId: xktMeshId,
24054-
geometryId: primitive._xktGeometryId,
24066+
geometryId,
2405524067
matrix: matrix ? matrix.slice() : math.identityMat4()
2405624068
};
2405724069
const material = primitive.material;

0 commit comments

Comments
 (0)