# 将 Three.js 游戏作为原生应用运行

保留场景和游戏逻辑，添加 Bloom 入口，在游戏之前加载 Web 适配器。

bloom/main.ts

```
import { configure } from "@bloomengine/web/config";
configure({
  app: "racer",
  title: "Racer",
  root: new URL("../", import.meta.url).pathname,
});
import "@bloomengine/web";
import "../src/main.ts";
```

## 当前支持情况

桥接层将支持的材质和网格映射到 Bloom。自定义着色器、渲染目标及 EffectComposer 需要单独实现渲染路径。

## 常见问题

### 能保留基于 DOM 的 HUD 吗？

赛车移植保留了 DOM HUD。手机版简化了样式表并降低了更新频率。请在目标设备上测试。

[将一个 Three.js 游戏打包为原生应用](https://bloomengine.dev/zh-Hans/alternatives/threejs-native-app)

## 资料来源

*   [@bloomengine/three](https://github.com/Bloom-Engine/three)
*   [@bloomengine/web](https://github.com/Bloom-Engine/web)
*   [Bloom Racer](https://bloomengine.dev/zh-Hans/blog/one-racing-game-six-ways)
