From e7b3328198a764edcaf896cc7815ca3d3ba74708 Mon Sep 17 00:00:00 2001 From: Cody Bennett Date: Mon, 23 Oct 2023 19:32:14 -0500 Subject: [PATCH] fix(BatchedMesh): move render hooks to constructor for dts (#311) --- src/objects/BatchedMesh.ts | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/src/objects/BatchedMesh.ts b/src/objects/BatchedMesh.ts index 9c1d6b3b..454c8f68 100644 --- a/src/objects/BatchedMesh.ts +++ b/src/objects/BatchedMesh.ts @@ -123,6 +123,20 @@ class BatchedMesh extends Mesh { 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() { @@ -380,22 +394,6 @@ class BatchedMesh extends Mesh { 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 }