Skip to content
This repository has been archived by the owner on Aug 7, 2024. It is now read-only.

Commit

Permalink
feat: update xr doc (#1001)
Browse files Browse the repository at this point in the history
  • Loading branch information
cptbtptpbcptdtptp authored Mar 28, 2024
1 parent df205d7 commit 5186747
Show file tree
Hide file tree
Showing 4 changed files with 406 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/graphics-background-sky.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ label: Graphics/Background

```typescript
// 创建天空盒纹理
const textureCube = await engine.resourceManager.load<Texture2D>({
const textureCube = await engine.resourceManager.load<TextureCube>({
urls: [
"px - right 图片 url",
"nx - left 图片 url",
Expand All @@ -47,7 +47,7 @@ const textureCube = await engine.resourceManager.load<Texture2D>({
"pz - front 图片 url",
"nz - back 图片 url",
],
type: AssetType.Texture2D,
type: AssetType.TextureCube,
});
// 创建天空盒材质
const skyMaterial = new SkyBoxMaterial(engine);
Expand Down
53 changes: 53 additions & 0 deletions docs/xr-compatibility.zh-CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
order: 7
title: XR 兼容性
type: XR
label: XR
---

XR 系统支持多后端(可参照[XR 总览](${docs}xr-overall)),目前官方仅适配了 WebXR 标准,因此 XR 互动的兼容性也**受限于设备对 WebXR** 的兼容。

在使用 XR 能力前,可参考 [CanIUse](https://caniuse.com/?search=webxr) 对运行环境进行评估,下方是当下 WebXR 兼容性的概括。

## 设备支持

### PC

- 支持 WebXR 的 PC 端浏览器(本文使用 Mac Chrome)
- PC 端 Chrome 安装 [Immersive Web Emulator](https://chromewebstore.google.com/detail/immersive-web-emulator/cgffilbpcibhmcfbgggfhfolhkfbhmik) 或其他 WebXR 模拟插件

### 安卓

- 支持 WebXR 的终端与浏览器(本文使用安卓机与安卓机搭载的移动端 Chrome 应用)
- 安卓手机需额外安装 [Google Play Services for AR](https://play.google.com/store/apps/details?id=com.google.ar.core&hl=en_US&pli=1)

### IOS

- 苹果手机端 Safari 暂不支持 WebXR
- Apple Vision Pro 支持 WebXR

### 头显设备

视情况而定,可参考头显官网对兼容性的说明,大部分头显中的浏览器(内核为 Chromium 的浏览器)都支持 WebXR

## 运行时兼容性判断

在 runtime 中,您可以通过如下代码判断当前环境是否支持 `AR``VR`:

```typescript
// 判断是否支持 AR
xrManager.sessionManager.isSupportedMode(XRSessionMode.AR);
```

在添加功能前,您可以通过如下代码判断该功能的兼容性:

```typescript
// 判断是否支持图片追踪
xrManager.isSupportedFeature(XRImageTracking);
```

## 安卓开启试验功能

安卓支持某些试验功能,但是开关时默认关闭的,此时可以通过设置 flags 打开,**安卓打开 Chrome** -> **登陆 chrome://flags** -> **搜索 WebXR** -> **打开 WebXR Incubations**

<img src="https://mdn.alipayobjects.com/huamei_yo47yq/afts/img/A*YJCVTIAe0nEAAAAAAAAAAAAADhuCAQ/original" alt="image.png" style="zoom:50%;" />
1 change: 1 addition & 0 deletions docs/xr-overall.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ Galacean 对 XR 做了干净灵活的设计:

- [快速开发 XR 互动](${docs}xr-start):XR 工作流与调试
- [XR 管理器](${docs}xr-manager):管理[相机](${docs}xr-camera)[会话](${docs}xr-session)[交互](${docs}xr-input)[功能](${docs}xr-features)
- [XR 兼容性](${docs}xr-compatibility):介绍当前 WebXR 的兼容性
Loading

0 comments on commit 5186747

Please sign in to comment.