From d532e3e995847fd6e6068063690def97fe394336 Mon Sep 17 00:00:00 2001 From: Kevin Levron Date: Wed, 28 Apr 2021 23:13:53 +0200 Subject: [PATCH] add render fn interface --- src/core/Renderer.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/core/Renderer.ts b/src/core/Renderer.ts index 2a42816..055ca7d 100644 --- a/src/core/Renderer.ts +++ b/src/core/Renderer.ts @@ -48,12 +48,17 @@ interface EventCallbackMap { 'resize': ResizeCallbackType; } +interface RenderFunctionEventInterface { + renderer: RendererInterface + time: number +} + interface RendererSetupInterface { canvas: HTMLCanvasElement three: ThreeInterface renderer: WebGLRenderer size: SizeInterface - renderFn(): void + renderFn(e: RenderFunctionEventInterface): void raf: boolean // pointerPosition?: Vector2 @@ -247,7 +252,7 @@ export default defineComponent({ render(time: number) { this.beforeRenderCallbacks.forEach(e => e({ type: 'beforerender', renderer: this, time })) // this.onFrame?.(cbParams) - this.renderFn() + this.renderFn({ renderer: this, time }) this.afterRenderCallbacks.forEach(e => e({ type: 'afterrender', renderer: this, time })) }, renderLoop(time: number) {