Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions packages/dev/core/src/Meshes/geometry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1204,7 +1204,7 @@ export class Geometry implements IGetSetVerticesData {

if (this.isVerticesDataPresent(VertexBuffer.MatricesIndicesKind)) {
serializationObject.matricesIndices = this._toNumberArray(this.getVerticesData(VertexBuffer.MatricesIndicesKind));
serializationObject.matricesIndices._isExpanded = true;
serializationObject.matricesIndicesExpanded = true;
if (this.isVertexBufferUpdatable(VertexBuffer.MatricesIndicesKind)) {
serializationObject.matricesIndices._updatable = true;
}
Expand Down Expand Up @@ -1446,7 +1446,7 @@ export class Geometry implements IGetSetVerticesData {
}

if (parsedGeometry.matricesIndices) {
if (!parsedGeometry.matricesIndices._isExpanded) {
if (!parsedGeometry.matricesIndices._isExpanded && !parsedGeometry.matricesIndicesExpanded) {
const floatIndices = [];

for (let i = 0; i < parsedGeometry.matricesIndices.length; i++) {
Expand All @@ -1461,12 +1461,13 @@ export class Geometry implements IGetSetVerticesData {
mesh.setVerticesData(VertexBuffer.MatricesIndicesKind, floatIndices, parsedGeometry.matricesIndices._updatable);
} else {
delete parsedGeometry.matricesIndices._isExpanded;
delete parsedGeometry.matricesIndicesExpanded;
mesh.setVerticesData(VertexBuffer.MatricesIndicesKind, parsedGeometry.matricesIndices, parsedGeometry.matricesIndices._updatable);
}
}

if (parsedGeometry.matricesIndicesExtra) {
if (!parsedGeometry.matricesIndicesExtra._isExpanded) {
if (!parsedGeometry.matricesIndicesExtra._isExpanded && !parsedGeometry.matricesIndicesExtraExpanded) {
const floatIndices = [];

for (let i = 0; i < parsedGeometry.matricesIndicesExtra.length; i++) {
Expand All @@ -1481,6 +1482,7 @@ export class Geometry implements IGetSetVerticesData {
mesh.setVerticesData(VertexBuffer.MatricesIndicesExtraKind, floatIndices, parsedGeometry.matricesIndicesExtra._updatable);
} else {
delete parsedGeometry.matricesIndices._isExpanded;
delete parsedGeometry.matricesIndicesExtraExpanded;
mesh.setVerticesData(VertexBuffer.MatricesIndicesExtraKind, parsedGeometry.matricesIndicesExtra, parsedGeometry.matricesIndicesExtra._updatable);
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/dev/core/src/Meshes/mesh.vertexData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1399,7 +1399,7 @@ export class VertexData implements IVertexDataLike {

if (this.matricesIndices) {
serializationObject.matricesIndices = Array.from(this.matricesIndices);
serializationObject.matricesIndices._isExpanded = true;
serializationObject.matricesIndicesExpanded = true;
}

if (this.matricesWeights) {
Expand All @@ -1408,7 +1408,7 @@ export class VertexData implements IVertexDataLike {

if (this.matricesIndicesExtra) {
serializationObject.matricesIndicesExtra = Array.from(this.matricesIndicesExtra);
serializationObject.matricesIndicesExtra._isExpanded = true;
serializationObject.matricesIndicesExtraExpanded = true;
}

if (this.matricesWeightsExtra) {
Expand Down