@@ -9,6 +9,7 @@ import type { UseRendererOptions } from '../useRenderer'
9
9
import { useRenderer } from '../useRenderer'
10
10
import { extend } from '../../core/catalogue'
11
11
import { useLogger } from '../useLogger'
12
+ import type { TresScene } from '../../types'
12
13
13
14
export interface InternalState {
14
15
priority : Ref < number >
@@ -43,7 +44,7 @@ export interface PerformanceState {
43
44
}
44
45
45
46
export interface TresContext {
46
- scene : ShallowRef < Scene >
47
+ scene : ShallowRef < TresScene >
47
48
sizes : { height : Ref < number > ; width : Ref < number > ; aspectRatio : ComputedRef < number > }
48
49
extend : ( objects : any ) => void
49
50
camera : ComputedRef < Camera | undefined >
@@ -74,7 +75,7 @@ export function useTresContextProvider({
74
75
rendererOptions,
75
76
emit,
76
77
} : {
77
- scene : Scene
78
+ scene : TresScene
78
79
canvas : MaybeRef < HTMLCanvasElement >
79
80
windowSize : MaybeRefOrGetter < boolean >
80
81
disableRender : MaybeRefOrGetter < boolean >
@@ -109,7 +110,7 @@ export function useTresContextProvider({
109
110
width : computed ( ( ) => debouncedReactiveSize . value . width ) ,
110
111
aspectRatio,
111
112
}
112
- const localScene = shallowRef < Scene > ( scene )
113
+ const localScene = shallowRef < TresScene > ( scene )
113
114
const {
114
115
camera,
115
116
cameras,
@@ -189,8 +190,8 @@ export function useTresContextProvider({
189
190
190
191
provide ( 'useTres' , ctx )
191
192
192
- // Add context to scene.userData
193
- ctx . scene . value . userData . tres__context = ctx
193
+ // Add context to scene local state
194
+ ctx . scene . value . __tres . root = ctx
194
195
195
196
// Performance
196
197
const updateInterval = 100 // Update interval in milliseconds
0 commit comments