Skip to content

Commit 53f515d

Browse files
committed
feat(soba/misc): injectDepthBuffer returns DepthTexture instead of Signal
Due to change to `injectFBO`, `injectDepthBuffer` no longer returns a `Signal` (because there is no need to) BREAKING CHANGE: `injectDepthBuffer` returns `DepthTexture | null` instead of `Signal<DepthTexture | null>`. Consumers should update accordingly
1 parent 12262c7 commit 53f515d

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

libs/soba/misc/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ A directive that allows you to render a part of your scene into an FBO using an
7878

7979
<ngt-mesh>
8080
<ngt-box-geometry *args="[3, 3, 3]" />
81-
<ngt-mesh-standard-material [map]="target().texture" />
81+
<ngt-mesh-standard-material [map]="target.texture" />
8282
</ngt-mesh>
8383
</ng-template>
8484
```

libs/soba/misc/src/lib/depth-buffer.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { computed, Injector } from '@angular/core';
2-
import { injectBeforeRender, injectStore, pick } from 'angular-three';
2+
import { injectBeforeRender, injectStore } from 'angular-three';
33
import { assertInjector } from 'ngxtension/assert-injector';
44
import * as THREE from 'three';
55
import { injectFBO } from './fbo';
@@ -13,9 +13,6 @@ export function injectDepthBuffer(
1313
const frames = computed(() => params().frames || Infinity);
1414

1515
const store = injectStore();
16-
// const width = store.select('size', 'width');
17-
// const height = store.select('size', 'height');
18-
// const dpr = store.select('viewport', 'dpr');
1916

2017
const w = computed(() => size() || store.size.width() * store.viewport.dpr());
2118
const h = computed(() => size() || store.size.height() * store.viewport.dpr());
@@ -32,13 +29,13 @@ export function injectDepthBuffer(
3229
let count = 0;
3330
injectBeforeRender(({ gl, scene, camera }) => {
3431
if (frames() === Infinity || count < frames()) {
35-
gl.setRenderTarget(depthFBO());
32+
gl.setRenderTarget(depthFBO);
3633
gl.render(scene, camera);
3734
gl.setRenderTarget(null);
3835
count++;
3936
}
4037
});
4138

42-
return pick(depthFBO, 'depthTexture');
39+
return depthFBO.depthTexture;
4340
});
4441
}

0 commit comments

Comments
 (0)