Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: deprecate disable render #772

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
feat: add deprecation warnings to disableRender
  • Loading branch information
alvarosabu committed Jul 12, 2024
commit 5ed57c477647598c778b5634d7fa1b5b4d381b2c
9 changes: 6 additions & 3 deletions src/components/TresCanvas.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ export interface TresCanvasProps
camera?: TresCamera
preset?: RendererPresetsType
windowSize?: boolean
/**
* @deprecated since version 4.2. Use `take-over render loop` approach instead. To be fully removed on v5. See https://docs.tresjs.org/api/composables.html#take-over-the-render-loop
*/
disableRender?: boolean
}

Expand All @@ -65,6 +68,9 @@ const props = withDefaults(defineProps<TresCanvasProps>(), {
stencil: undefined,
antialias: undefined,
windowSize: undefined,
/**
* @deprecated since version 4.2. Use `take-over render loop` approach instead. To be fully removed on v5. See https://docs.tresjs.org/api/composables.html#take-over-the-render-loop
*/
disableRender: undefined,
useLegacyLights: undefined,
preserveDrawingBuffer: undefined,
Expand Down Expand Up @@ -144,8 +150,6 @@ const dispose = (context: TresContext, force = false) => {
mountCustomRenderer(context)
}

const disableRender = computed(() => props.disableRender)

const context = shallowRef<TresContext | null>(null)

defineExpose({ context, dispose: () => dispose(context.value as TresContext, true) })
Expand All @@ -157,7 +161,6 @@ onMounted(() => {
scene: scene.value as TresScene,
canvas: existingCanvas,
windowSize: props.windowSize ?? false,
disableRender: disableRender.value ?? false,
rendererOptions: props,
emit,
})
Expand Down
1 change: 0 additions & 1 deletion src/composables/useRenderer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ export function useRenderer(
options: UseRendererOptions
emit: EmitEventFn
contextParts: Pick<TresContext, 'sizes' | 'camera' | 'render'> & { invalidate: () => void, advance: () => void }
disableRender: MaybeRefOrGetter<boolean>
},
) {
const webGLRendererConstructorParameters = computed<WebGLRendererParameters>(() => ({
Expand Down
3 changes: 0 additions & 3 deletions src/composables/useTresContextProvider/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,12 @@ export function useTresContextProvider({
scene,
canvas,
windowSize,
disableRender,
rendererOptions,
emit,
}: {
scene: TresScene
canvas: MaybeRef<HTMLCanvasElement>
windowSize: MaybeRefOrGetter<boolean>
disableRender: MaybeRefOrGetter<boolean>
rendererOptions: UseRendererOptions
emit: EmitEventFn

Expand Down Expand Up @@ -150,7 +148,6 @@ export function useTresContextProvider({
emit,
// TODO: replace contextParts with full ctx at https://github.com/Tresjs/tres/issues/516
contextParts: { sizes, camera, render, invalidate, advance },
disableRender,
},
)

Expand Down