Skip to content

Commit

Permalink
WebGLRenderer introduce schedule_render public method
Browse files Browse the repository at this point in the history
This might be useful, but also confusing. It's basically a 3rd (manual) possibility to render in mode `auto` if a user want's to mix manual and `auto` rendering. Needs to be further tested / used / optimized (which use cases, pitfalls etc.).
  • Loading branch information
Vatroslav Vrbanic committed Jun 19, 2022
1 parent da6086e commit b4169c5
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/components/WebGLRenderer.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,17 @@ This is a **svelthree** _WebGLRenderer_ Component.
start_renderer()
}
// TODO this has to be further tested / used / optimized (_which use cases, pitfalls etc._)
/**
* Schedules a render once on next AnimationFrame. Current scene doesn't have to be marked as `dirty`. \
* _For scheduling a render **manually** in an e.g. animation function_.
*/
export function schedule_render(): void {
if (enabled) {
if (rAF.id) cancelAnimationFrame(rAF.id)
rAF.id = requestAnimationFrame(render_standard)
}
}
/** Returns the **three.js instance** of the renderer. */
export function get_renderer(): WebGLRenderer {
return renderer
Expand Down

0 comments on commit b4169c5

Please sign in to comment.