Skip to content

Commit

Permalink
three 159 fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jerzakm committed Feb 11, 2024
1 parent 96f261c commit 41898f2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/tidy-phones-crash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@threejs-kit/instanced-sprite-mesh": patch
---

compatibility fix for three>159
9 changes: 9 additions & 0 deletions packages/instanced-sprite-mesh/src/InstancedSpriteMesh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
Vector2,
Vector4,
WebGLRenderer,
REVISION,
} from "three";
import { InstancedUniformsMesh } from "three-instanced-uniforms-mesh";
import {
Expand Down Expand Up @@ -85,6 +86,14 @@ export class InstancedSpriteMesh<

this._spriteMaterial.uniforms.animationDataSize.value =
this.compute.progressDataTexture.image.width;

// TODO revisit later. Temp fix for 159 breaking change
if (REVISION >= 159) {
this.instanceMatrix.clearUpdateRanges();
this.instanceMatrix.addUpdateRange(0, count * 16);
} else {
this.instanceMatrix.updateRange.count = count * 16;
}
}

private updateSpritesheet(spritesheet: SpritesheetFormat) {
Expand Down

0 comments on commit 41898f2

Please sign in to comment.