WebXR Depth Sensing Module: Difference between revisions

From WebXR Wiki
Jump to navigation Jump to search
(Add short summary)
(Add WebIDL)
 
Line 8: Line 8:


The Depth Sensing Module extends the capabilities of the [[WebXR Device API]] by enabling apps to obtain depth information computed by supported XR devices in order to provide more immersive experiences. The example use cases include (but are not limited to) simulating physical interactions of virtual objects with the real world, occlusion, and non-visual applications that can make use of increased awareness of users' environment.
The Depth Sensing Module extends the capabilities of the [[WebXR Device API]] by enabling apps to obtain depth information computed by supported XR devices in order to provide more immersive experiences. The example use cases include (but are not limited to) simulating physical interactions of virtual objects with the real world, occlusion, and non-visual applications that can make use of increased awareness of users' environment.
==WebIDL==
<syntaxhighlight lang="idl">
enum XRDepthUsage {
  "cpu-optimized",
  "gpu-optimized",
};
enum XRDepthDataFormat {
  "luminance-alpha",
  "float32"
};
dictionary XRDepthStateInit {
  required sequence<XRDepthUsage> usagePreference;
  required sequence<XRDepthDataFormat> dataFormatPreference;
};
partial dictionary XRSessionInit {
  XRDepthStateInit depthSensing;
};
partial interface XRSession {
  readonly attribute XRDepthUsage depthUsage;
  readonly attribute XRDepthDataFormat depthDataFormat;
};
[SecureContext, Exposed=Window]
interface XRDepthInformation {
  readonly attribute unsigned long width;
  readonly attribute unsigned long height;
  [SameObject] readonly attribute XRRigidTransform normDepthBufferFromNormView;
  readonly attribute float rawValueToMeters;
};
[Exposed=Window]
interface XRCPUDepthInformation : XRDepthInformation {
  [SameObject] readonly attribute ArrayBuffer data;
  float getDepthInMeters(float x, float y);
};
partial interface XRFrame {
  XRCPUDepthInformation? getDepthInformation(XRView view);
};
[Exposed=Window]
interface XRWebGLDepthInformation : XRDepthInformation {
  [SameObject] readonly attribute WebGLTexture texture;
};
partial interface XRWebGLBinding {
  XRWebGLDepthInformation? getDepthInformation(XRView view);
};
</syntaxhighlight>


== External Links ==
== External Links ==

Latest revision as of 00:26, 1 March 2023

WebXR Depth Sensing Module
StatusWD
Last Updated19 April 2022
Editor(s)Piotr Bialecki
CG or WG?WG

The Depth Sensing Module extends the capabilities of the WebXR Device API by enabling apps to obtain depth information computed by supported XR devices in order to provide more immersive experiences. The example use cases include (but are not limited to) simulating physical interactions of virtual objects with the real world, occlusion, and non-visual applications that can make use of increased awareness of users' environment.

WebIDL[edit]

enum XRDepthUsage {
  "cpu-optimized",
  "gpu-optimized",
};

enum XRDepthDataFormat {
  "luminance-alpha",
  "float32"
};

dictionary XRDepthStateInit {
  required sequence<XRDepthUsage> usagePreference;
  required sequence<XRDepthDataFormat> dataFormatPreference;
};

partial dictionary XRSessionInit {
  XRDepthStateInit depthSensing;
};

partial interface XRSession {
  readonly attribute XRDepthUsage depthUsage;
  readonly attribute XRDepthDataFormat depthDataFormat;
};

[SecureContext, Exposed=Window]
interface XRDepthInformation {
  readonly attribute unsigned long width;
  readonly attribute unsigned long height;

  [SameObject] readonly attribute XRRigidTransform normDepthBufferFromNormView;
  readonly attribute float rawValueToMeters;
};

[Exposed=Window]
interface XRCPUDepthInformation : XRDepthInformation {
  [SameObject] readonly attribute ArrayBuffer data;

  float getDepthInMeters(float x, float y);
};

partial interface XRFrame {
  XRCPUDepthInformation? getDepthInformation(XRView view);
};

[Exposed=Window]
interface XRWebGLDepthInformation : XRDepthInformation {
  [SameObject] readonly attribute WebGLTexture texture;
};

partial interface XRWebGLBinding {
  XRWebGLDepthInformation? getDepthInformation(XRView view);
};

External Links[edit]