Skip to content

Commit 7166ff4

Browse files
“Florianmeta-codesync[bot]
authored andcommitted
feat(rendering): add option to enable stencil buffer (#15)
Summary: This adds the option to enable drawing to the stencil buffer on the default renderer in IWSDK. This is purely optional and makes it possible to do the magic window effect commonly used in mixed reality applications. Pull Request resolved: #15 Reviewed By: felixtrz Differential Revision: D87954435 Pulled By: zjm-meta fbshipit-source-id: afe8a8e9674eddba8020fdf04b42bb3c10ad0c61
1 parent 3eea7a8 commit 7166ff4

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

packages/core/src/init/world-initializer.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ export type WorldOptions = {
9393
far?: number;
9494
/** Generate a default gradient environment and background. @defaultValue true */
9595
defaultLighting?: boolean;
96+
/** Enable stencil buffer. @defaultValue false */
97+
stencil?: boolean;
9698
};
9799

98100
/** Opt‑in feature systems. */
@@ -222,6 +224,7 @@ function extractConfiguration(options: WorldOptions) {
222224
cameraNear: options.render?.near ?? 0.1,
223225
cameraFar: options.render?.far ?? 200,
224226
defaultLighting: options.render?.defaultLighting ?? true,
227+
stencil: options.render?.stencil ?? false,
225228
xr: {
226229
sessionMode: options.xr?.sessionMode ?? SessionMode.ImmersiveVR,
227230
referenceSpace:
@@ -260,6 +263,7 @@ function setupRendering(sceneContainer: HTMLDivElement, config: any) {
260263
alpha: config.xr.sessionMode === SessionMode.ImmersiveAR,
261264
// @ts-ignore
262265
multiviewStereo: true,
266+
stencil: config.stencil,
263267
});
264268
renderer.setPixelRatio(window.devicePixelRatio);
265269
renderer.setSize(window.innerWidth, window.innerHeight);

0 commit comments

Comments
 (0)