Skip to content

Commit 42321df

Browse files
authored
Update Babylon Native and CaptureSession to support XR (#180)
* Update Babylon Native and update CaptureSession accordingly
1 parent 5534bf6 commit 42321df

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

Modules/@babylonjs/react-native/NativeCapture.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,27 @@
1+
import { Camera } from '@babylonjs/core';
2+
13
export type CapturedFrame = {
24
width: number;
35
height: number;
4-
pitch: number;
5-
format: "BGRA8" | undefined;
6+
format: "RGBA8" | "BGRA8" | undefined;
67
yFlip: boolean;
78
data: ArrayBuffer;
89
};
910

1011
export type CaptureCallback = (capture: CapturedFrame) => void;
1112

1213
declare class NativeCapture {
13-
public constructor();
14+
public constructor(frameBuffer?: unknown | undefined);
1415
public addCallback(onCaptureCallback: CaptureCallback): void;
1516
public dispose(): void;
1617
};
1718

1819
export class CaptureSession {
1920
private readonly nativeCapture: NativeCapture;
2021

21-
public constructor(onCaptureCallback: CaptureCallback) {
22+
public constructor(camera: Camera | undefined, onCaptureCallback: CaptureCallback) {
2223
console.warn(`CaptureSession is experimental and likely to change significantly.`);
23-
this.nativeCapture = new NativeCapture();
24+
this.nativeCapture = new NativeCapture(camera?.outputRenderTarget?.getInternalTexture()?._framebuffer);
2425
this.nativeCapture.addCallback(onCaptureCallback);
2526
}
2627

0 commit comments

Comments
 (0)