Skip to content

Commit

Permalink
fix(C3DTFeature): use correct interleaved buffer getter (#2326)
Browse files Browse the repository at this point in the history
  • Loading branch information
AnthonyGlt authored Jul 8, 2024
1 parent 0505297 commit 6e20fcb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/Core/3DTiles/C3DTFeature.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@ class C3DTFeature {
target.min.z = Infinity;

this.groups.forEach((group) => {
const positionIndexStart = group.start * 3;
const positionIndexCount = (group.start + group.count) * 3;
const positionIndexStart = group.start * this.object3d.geometry.attributes.position.itemSize;
const positionIndexCount = (group.start + group.count) * this.object3d.geometry.attributes.position.itemSize;

for (let index = positionIndexStart; index < positionIndexCount; index += 3) {
const x = this.object3d.geometry.attributes.position.array[index];
const y = this.object3d.geometry.attributes.position.array[index + 1];
const z = this.object3d.geometry.attributes.position.array[index + 2];
for (let index = positionIndexStart; index < positionIndexCount; index++) {
const x = this.object3d.geometry.attributes.position.getX(index);
const y = this.object3d.geometry.attributes.position.getY(index);
const z = this.object3d.geometry.attributes.position.getZ(index);

target.max.x = Math.max(x, target.max.x);
target.max.y = Math.max(y, target.max.y);
Expand Down
2 changes: 1 addition & 1 deletion src/Layer/C3DTilesLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ class C3DTilesLayer extends GeometryLayer {
// face is a Face3 object of THREE which is a
// triangular face. face.a is its first vertex
const vertex = closestIntersect.face.a;
const batchID = closestIntersect.object.geometry.attributes._BATCHID.array[vertex];
const batchID = closestIntersect.object.geometry.attributes._BATCHID.getX(vertex);

return this.tilesC3DTileFeatures.get(tileId).get(batchID);
}
Expand Down

0 comments on commit 6e20fcb

Please sign in to comment.