mirror of
https://github.com/troisjs/trois.git
synced 2024-11-24 04:12:02 +08:00
add render fn interface
This commit is contained in:
parent
99bcb73c10
commit
d532e3e995
@ -48,12 +48,17 @@ interface EventCallbackMap {
|
|||||||
'resize': ResizeCallbackType;
|
'resize': ResizeCallbackType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface RenderFunctionEventInterface {
|
||||||
|
renderer: RendererInterface
|
||||||
|
time: number
|
||||||
|
}
|
||||||
|
|
||||||
interface RendererSetupInterface {
|
interface RendererSetupInterface {
|
||||||
canvas: HTMLCanvasElement
|
canvas: HTMLCanvasElement
|
||||||
three: ThreeInterface
|
three: ThreeInterface
|
||||||
renderer: WebGLRenderer
|
renderer: WebGLRenderer
|
||||||
size: SizeInterface
|
size: SizeInterface
|
||||||
renderFn(): void
|
renderFn(e: RenderFunctionEventInterface): void
|
||||||
raf: boolean
|
raf: boolean
|
||||||
|
|
||||||
// pointerPosition?: Vector2
|
// pointerPosition?: Vector2
|
||||||
@ -247,7 +252,7 @@ export default defineComponent({
|
|||||||
render(time: number) {
|
render(time: number) {
|
||||||
this.beforeRenderCallbacks.forEach(e => e({ type: 'beforerender', renderer: this, time }))
|
this.beforeRenderCallbacks.forEach(e => e({ type: 'beforerender', renderer: this, time }))
|
||||||
// this.onFrame?.(cbParams)
|
// this.onFrame?.(cbParams)
|
||||||
this.renderFn()
|
this.renderFn({ renderer: this, time })
|
||||||
this.afterRenderCallbacks.forEach(e => e({ type: 'afterrender', renderer: this, time }))
|
this.afterRenderCallbacks.forEach(e => e({ type: 'afterrender', renderer: this, time }))
|
||||||
},
|
},
|
||||||
renderLoop(time: number) {
|
renderLoop(time: number) {
|
||||||
|
Loading…
Reference in New Issue
Block a user