File tree Expand file tree Collapse file tree 1 file changed +12
-10
lines changed
libs/soba/cameras/src/lib Expand file tree Collapse file tree 1 file changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -75,8 +75,19 @@ export class NgtsPerspectiveCamera {
75
75
constructor ( ) {
76
76
extend ( { PerspectiveCamera, Group } ) ;
77
77
78
+ effect ( ( onCleanup ) => {
79
+ const makeDefault = this . makeDefault ( ) ;
80
+ if ( ! makeDefault ) return ;
81
+
82
+ const camera = this . cameraRef ( ) . nativeElement ;
83
+ const oldCam = this . store . snapshot . camera ;
84
+ this . store . update ( { camera } ) ;
85
+ onCleanup ( ( ) => this . store . update ( ( ) => ( { camera : oldCam } ) ) ) ;
86
+ } ) ;
87
+
78
88
effect ( ( ) => {
79
- this . cameraRef ( ) . nativeElement . updateProjectionMatrix ( ) ;
89
+ const camera = this . cameraRef ( ) . nativeElement ;
90
+ camera . updateProjectionMatrix ( ) ;
80
91
} ) ;
81
92
82
93
effect ( ( ) => {
@@ -91,15 +102,6 @@ export class NgtsPerspectiveCamera {
91
102
camera . updateProjectionMatrix ( ) ;
92
103
} ) ;
93
104
94
- effect ( ( onCleanup ) => {
95
- const makeDefault = this . makeDefault ( ) ;
96
- if ( ! makeDefault ) return ;
97
-
98
- const oldCam = this . store . snapshot . camera ;
99
- this . store . update ( { camera : this . cameraRef ( ) . nativeElement } ) ;
100
- onCleanup ( ( ) => this . store . update ( ( ) => ( { camera : oldCam } ) ) ) ;
101
- } ) ;
102
-
103
105
let count = 0 ;
104
106
let oldEnvMap : THREE . Color | THREE . Texture | null = null ;
105
107
injectBeforeRender ( ( { gl, scene } ) => {
You can’t perform that action at this time.
0 commit comments