Skip to content

Commit

Permalink
WebGLRenderer rename schedule_render to schedule_render_auto
Browse files Browse the repository at this point in the history
This is needed because we want to introduce a new `WebGLRenderer` method `schedule_render` which will allow users to schedule a render on next AnimationFrame manually (once). Beside that, it feels more consistent, because we have `schedule_render_always` for mode `always` and and now also `schedule_render_auto` for mode `auto` (`schedule_render` was used in mode `auto` logic only).
  • Loading branch information
Vatroslav Vrbanic committed Jun 19, 2022
1 parent 832abf3 commit 30f5a51
Show file tree
Hide file tree
Showing 16 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/components/AmbientLight.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ AmbientLight cannot be used to cast shadows as it doesn't have a direction. Posi
if ($svelthreeStores[sti].rendererComponent?.mode === "auto") {
root_scene.userData.dirty = true
$svelthreeStores[sti].rendererComponent.schedule_render(root_scene)
$svelthreeStores[sti].rendererComponent.schedule_render_auto(root_scene)
}
if (afterUpdate_inject_after) afterUpdate_inject_after()
Expand Down
2 changes: 1 addition & 1 deletion src/components/CubeCamera.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@ Renders a CubeMap for usage with **non-PBR** materials which have an `.envMap` p
if ($svelthreeStores[sti].rendererComponent?.mode === "auto") {
root_scene.userData.dirty = true
$svelthreeStores[sti].rendererComponent.schedule_render(root_scene)
$svelthreeStores[sti].rendererComponent.schedule_render_auto(root_scene)
}
if (afterUpdate_inject_after) afterUpdate_inject_after()
Expand Down
2 changes: 1 addition & 1 deletion src/components/DirectionalLight.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ svelthree uses svelte-accmod, where accessors are always `true`, regardless of `
if ($svelthreeStores[sti].rendererComponent?.mode === "auto") {
root_scene.userData.dirty = true
$svelthreeStores[sti].rendererComponent.schedule_render(root_scene)
$svelthreeStores[sti].rendererComponent.schedule_render_auto(root_scene)
}
if (afterUpdate_inject_after) afterUpdate_inject_after()
Expand Down
2 changes: 1 addition & 1 deletion src/components/Empty.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ svelthree uses svelte-accmod, where accessors are always `true`, regardless of `
if ($svelthreeStores[sti].rendererComponent?.mode === "auto") {
root_scene.userData.dirty = true
$svelthreeStores[sti].rendererComponent.schedule_render(root_scene)
$svelthreeStores[sti].rendererComponent.schedule_render_auto(root_scene)
}
if (afterUpdate_inject_after) afterUpdate_inject_after()
Expand Down
2 changes: 1 addition & 1 deletion src/components/HemisphereLight.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ svelthree uses svelte-accmod, where accessors are always `true`, regardless of `
if ($svelthreeStores[sti].rendererComponent?.mode === "auto") {
root_scene.userData.dirty = true
$svelthreeStores[sti].rendererComponent.schedule_render(root_scene)
$svelthreeStores[sti].rendererComponent.schedule_render_auto(root_scene)
}
if (afterUpdate_inject_after) afterUpdate_inject_after()
Expand Down
2 changes: 1 addition & 1 deletion src/components/LoadedGLTF.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,7 @@ svelthree uses svelte-accmod, where accessors are always `true`, regardless of `
if ($svelthreeStores[sti].rendererComponent?.mode === "auto") {
root_scene.userData.dirty = true
$svelthreeStores[sti].rendererComponent.schedule_render(root_scene)
$svelthreeStores[sti].rendererComponent.schedule_render_auto(root_scene)
}
if (afterUpdate_inject_after) afterUpdate_inject_after()
Expand Down
2 changes: 1 addition & 1 deletion src/components/Mesh.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -940,7 +940,7 @@ svelthree uses svelte-accmod, where accessors are always `true`, regardless of `
if ($svelthreeStores[sti].rendererComponent?.mode === "auto") {
root_scene.userData.dirty = true
$svelthreeStores[sti].rendererComponent.schedule_render(root_scene)
$svelthreeStores[sti].rendererComponent.schedule_render_auto(root_scene)
}
if (afterUpdate_inject_after) afterUpdate_inject_after()
Expand Down
2 changes: 1 addition & 1 deletion src/components/OrbitControls.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ svelthree uses svelte-accmod, where accessors are always `true`, regardless of `
// schedule render
function on_orbitcontrols_change(e: any): void {
orbitcontrols.object.userData.root_scene.userData.dirty = true
$svelthreeStores[sti].rendererComponent.schedule_render(orbitcontrols.object.userData.root_scene)
$svelthreeStores[sti].rendererComponent.schedule_render_auto(orbitcontrols.object.userData.root_scene)
// schedule next render (loop) if function was not called by an event
if (e === null) rAF.id = requestAnimationFrame(() => on_orbitcontrols_change(null))
Expand Down
2 changes: 1 addition & 1 deletion src/components/OrthographicCamera.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,7 @@ If you use this approach you'll see a warning in the console if you define left,
if ($svelthreeStores[sti].rendererComponent?.mode === "auto") {
root_scene.userData.dirty = true
$svelthreeStores[sti].rendererComponent.schedule_render(root_scene)
$svelthreeStores[sti].rendererComponent.schedule_render_auto(root_scene)
}
if (afterUpdate_inject_after) afterUpdate_inject_after()
Expand Down
2 changes: 1 addition & 1 deletion src/components/PerspectiveCamera.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ svelthree uses svelte-accmod, where accessors are always `true`, regardless of `
if ($svelthreeStores[sti].rendererComponent?.mode === "auto") {
root_scene.userData.dirty = true
$svelthreeStores[sti].rendererComponent.schedule_render(root_scene)
$svelthreeStores[sti].rendererComponent.schedule_render_auto(root_scene)
}
if (afterUpdate_inject_after) afterUpdate_inject_after()
Expand Down
2 changes: 1 addition & 1 deletion src/components/PointLight.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ svelthree uses svelte-accmod, where accessors are always `true`, regardless of `
if ($svelthreeStores[sti].rendererComponent?.mode === "auto") {
root_scene.userData.dirty = true
$svelthreeStores[sti].rendererComponent.schedule_render(root_scene)
$svelthreeStores[sti].rendererComponent.schedule_render_auto(root_scene)
}
if (afterUpdate_inject_after) afterUpdate_inject_after()
Expand Down
2 changes: 1 addition & 1 deletion src/components/Points.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -950,7 +950,7 @@ svelthree uses svelte-accmod, where accessors are always `true`, regardless of `
if ($svelthreeStores[sti].rendererComponent?.mode === "auto") {
root_scene.userData.dirty = true
$svelthreeStores[sti].rendererComponent.schedule_render(root_scene)
$svelthreeStores[sti].rendererComponent.schedule_render_auto(root_scene)
}
if (afterUpdate_inject_after) afterUpdate_inject_after()
Expand Down
2 changes: 1 addition & 1 deletion src/components/RectAreaLight.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ svelthree uses svelte-accmod, where accessors are always `true`, regardless of `
if ($svelthreeStores[sti].rendererComponent?.mode === "auto") {
root_scene.userData.dirty = true
$svelthreeStores[sti].rendererComponent.schedule_render(root_scene)
$svelthreeStores[sti].rendererComponent.schedule_render_auto(root_scene)
}
if (afterUpdate_inject_after) afterUpdate_inject_after()
Expand Down
4 changes: 2 additions & 2 deletions src/components/Scene.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -986,11 +986,11 @@ svelthree uses svelte-accmod, where accessors are always `true`, regardless of `
if ($svelthreeStores[sti].rendererComponent?.mode === "auto") {
if (root_scene) {
root_scene.userData.dirty = true
$svelthreeStores[sti].rendererComponent.schedule_render(root_scene)
$svelthreeStores[sti].rendererComponent.schedule_render_auto(root_scene)
} else {
// we are the root scene
scene.userData.dirty = true
$svelthreeStores[sti].rendererComponent.schedule_render(scene)
$svelthreeStores[sti].rendererComponent.schedule_render_auto(scene)
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/SpotLight.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ svelthree uses svelte-accmod, where accessors are always `true`, regardless of `
if ($svelthreeStores[sti].rendererComponent?.mode === "auto") {
root_scene.userData.dirty = true
$svelthreeStores[sti].rendererComponent.schedule_render(root_scene)
$svelthreeStores[sti].rendererComponent.schedule_render_auto(root_scene)
}
if (afterUpdate_inject_after) afterUpdate_inject_after()
Expand Down
4 changes: 2 additions & 2 deletions src/components/WebGLRenderer.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ This is a **svelthree** _WebGLRenderer_ Component.
* Schedules a render if the current scene has been marked as `dirty`. \
* _Primarly called internally by components if `WebGLRenderer` component's `mode` is set to `"auto"`_.
*/
export function schedule_render(scene: Scene = null): void {
export function schedule_render_auto(scene: Scene = null): void {
if (enabled && render_scheduled.status === false) {
const scene_to_check: Scene = scene ? scene : current_scene
if (scene_to_check) {
Expand All @@ -730,7 +730,7 @@ This is a **svelthree** _WebGLRenderer_ Component.
}
} else {
console.error(
"SVELTHREE > WebGLRenderer > schedule_render : no scene to check 'dirty' status available!"
"SVELTHREE > WebGLRenderer > schedule_render_auto : no scene to check 'dirty' status available!"
)
}
}
Expand Down

0 comments on commit 30f5a51

Please sign in to comment.