Skip to content

Commit

Permalink
fix(BatchedMesh): move render hooks to constructor for dts (#311)
Browse files Browse the repository at this point in the history
  • Loading branch information
CodyJasonBennett authored Oct 24, 2023
1 parent a51d1f3 commit e7b3328
Showing 1 changed file with 14 additions and 16 deletions.
30 changes: 14 additions & 16 deletions src/objects/BatchedMesh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,20 @@ class BatchedMesh extends Mesh<BufferGeometry, Material> {

this._initMatricesTexture()
this._initShader()

this.onBeforeRender = function () {
if (this.material.defines) {
this.material.defines.BATCHING = true
}

// @TODO: Implement frustum culling for each geometry
}

this.onAfterRender = function () {
if (this.material.defines) {
this.material.defines.BATCHING = false
}
}
}

_initMatricesTexture() {
Expand Down Expand Up @@ -380,22 +394,6 @@ class BatchedMesh extends Mesh<BufferGeometry, Material> {

return this
}

// @ts-ignore
onBeforeRender() {
if (this.material.defines) {
this.material.defines.BATCHING = true
}

// @TODO: Implement frustum culling for each geometry
}

// @ts-ignore
onAfterRender() {
if (this.material.defines) {
this.material.defines.BATCHING = false
}
}
}

export { BatchedMesh }

0 comments on commit e7b3328

Please sign in to comment.