Skip to content

Commit efb60cd

Browse files
committed
feat(soba/cameras): update injectFBO usage
since `injectFBO` no longer returns Signal (because it doesn't need to), cameraContent usage needs to be updated BREAKING CHANGE: `NgtsCameraContent` `let-texture` template variable is a `Texture` instead of `Signal<Texture>`
1 parent 53f515d commit efb60cd

File tree

4 files changed

+9
-17
lines changed

4 files changed

+9
-17
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { Directive, Signal } from '@angular/core';
1+
import { Directive } from '@angular/core';
22
import * as THREE from 'three';
33

44
@Directive({ selector: 'ng-template[cameraContent]' })
55
export class NgtsCameraContent {
6-
static ngTemplateContextGuard(_: NgtsCameraContent, ctx: unknown): ctx is { $implicit: Signal<THREE.Texture> } {
6+
static ngTemplateContextGuard(_: NgtsCameraContent, ctx: unknown): ctx is { $implicit: THREE.Texture } {
77
return true;
88
}
99
}

libs/soba/cameras/src/lib/cube-camera.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ const defaultOptions: NgtsCubeCameraOptions = {
9898
<ngt-group #group>
9999
<ng-container
100100
[ngTemplateOutlet]="cameraContent() ?? null"
101-
[ngTemplateOutletContext]="{ $implicit: texture }"
101+
[ngTemplateOutletContext]="{ $implicit: texture() }"
102102
/>
103103
</ngt-group>
104104
</ngt-group>

libs/soba/cameras/src/lib/orthographic-camera.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,7 @@ const defaultOptions: NgtsOrthographicCameraOptions = {
5353
</ngt-orthographic-camera>
5454
5555
<ngt-group #group>
56-
<ng-container
57-
[ngTemplateOutlet]="cameraContent() ?? null"
58-
[ngTemplateOutletContext]="{ $implicit: texture }"
59-
/>
56+
<ng-container [ngTemplateOutlet]="cameraContent() ?? null" [ngTemplateOutletContext]="{ $implicit: fbo }" />
6057
</ngt-group>
6158
`,
6259
imports: [NgTemplateOutlet],
@@ -98,8 +95,7 @@ export class NgtsOrthographicCamera {
9895
private makeDefault = pick(this.options, 'makeDefault');
9996
private resolution = pick(this.options, 'resolution');
10097

101-
private fbo = injectFBO(() => ({ width: this.resolution() }));
102-
protected texture = pick(this.fbo, 'texture');
98+
protected fbo = injectFBO(() => ({ width: this.resolution() }));
10399

104100
constructor() {
105101
extend({ OrthographicCamera, Group });
@@ -132,7 +128,7 @@ export class NgtsOrthographicCamera {
132128
this.options(),
133129
this.groupRef().nativeElement,
134130
this.cameraRef().nativeElement,
135-
this.fbo(),
131+
this.fbo,
136132
];
137133
if (this.cameraContent() && group && camera && fbo && (frames === Infinity || count < frames)) {
138134
group.visible = false;

libs/soba/cameras/src/lib/perspective-camera.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,7 @@ const defaultOptions: NgtsPerspectiveCameraOptions = {
4545
</ngt-perspective-camera>
4646
4747
<ngt-group #group>
48-
<ng-container
49-
[ngTemplateOutlet]="cameraContent() ?? null"
50-
[ngTemplateOutletContext]="{ $implicit: texture }"
51-
/>
48+
<ng-container [ngTemplateOutlet]="cameraContent() ?? null" [ngTemplateOutletContext]="{ $implicit: fbo }" />
5249
</ngt-group>
5350
`,
5451
imports: [NgTemplateOutlet],
@@ -70,8 +67,7 @@ export class NgtsPerspectiveCamera {
7067
private manual = pick(this.options, 'manual');
7168
private makeDefault = pick(this.options, 'makeDefault');
7269
private resolution = pick(this.options, 'resolution');
73-
private fbo = injectFBO(() => ({ width: this.resolution() }));
74-
protected texture = pick(this.fbo, 'texture');
70+
protected fbo = injectFBO(() => ({ width: this.resolution() }));
7571

7672
constructor() {
7773
extend({ PerspectiveCamera, Group });
@@ -108,7 +104,7 @@ export class NgtsPerspectiveCamera {
108104
this.options(),
109105
this.groupRef().nativeElement,
110106
this.cameraRef().nativeElement,
111-
this.fbo(),
107+
this.fbo,
112108
];
113109
if (this.cameraContent() && group && camera && fbo && (frames === Infinity || count < frames)) {
114110
group.visible = false;

0 commit comments

Comments
 (0)