Skip to content

Commit

Permalink
Applied the fix from previous commit to point geometry.
Browse files Browse the repository at this point in the history
  • Loading branch information
petrbroz committed Jun 28, 2023
1 parent 1527c64 commit 1a888b1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/gltf/writer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ export class Writer {
// Output vertex buffer
const vertices = geometry.getVertices();
const positionBounds = this.computeBoundsVec3(vertices);
const positionBufferView = this.createBufferView(Buffer.from(vertices.buffer));
const positionBufferView = this.createBufferView(Buffer.from(vertices.buffer, vertices.byteOffset, vertices.byteLength));
const positionBufferViewID = this.addBufferView(positionBufferView);
const positionAccessor = this.createAccessor(positionBufferViewID, 5126, positionBufferView.byteLength / 4 / 3, 'VEC3', positionBounds.min, positionBounds.max);
const positionAccessorID = this.addAccessor(positionAccessor);
Expand All @@ -519,7 +519,7 @@ export class Writer {
let colorAccessorID: number | undefined = undefined;
const colors = geometry.getColors();
if (colors) {
const colorBufferView = this.createBufferView(Buffer.from(colors.buffer));
const colorBufferView = this.createBufferView(Buffer.from(colors.buffer, colors.byteOffset, colors.byteLength));
const colorBufferViewID = this.addBufferView(colorBufferView);
const colorAccessor = this.createAccessor(colorBufferViewID, 5126, colorBufferView.byteLength / 4 / 3, 'VEC3');
colorAccessorID = this.addAccessor(colorAccessor);
Expand Down

0 comments on commit 1a888b1

Please sign in to comment.