Orillusion是一个完全基于标准开发的纯 Web3D 渲染引擎。它旨在实现桌面级渲染效果,并支持在浏览器中对复杂场景进行 3D 渲染。
WebGPU
测试版,不建议用于任何商业应用。
我们建议使用前端构建工具来开发Web3D应用程序,例如Vite或Webpack。
npm install @orillusion/core --save
import { Engine3D, Camera3D } from '@orillusion/core'
import * as Orillusion from '@orillusion/core'
In order to use the engine more conveniently, we support to use native
<script>tag to import
Orillusion. Three different ways to import using the official
CDNlink:
Orillusiondirectly from a CDN via a script tag:
<script src="https://unpkg.com/@orillusion/core/dist/orillusion.umd.js"></script>
<script>
const { Engine3D, Camera3D } = Orillusion
</script>
The above link loads the global build of
Orillusion, where all top-level APIs are exposed as properties on the global
Orillusionobject.
ESmodule, we just need to import the
ESbuild version of
orillusion.es.js
<script type="module">
import { Engine3D, Camera3D } from "https://unpkg.com/@orillusion/core/dist/orillusion.es.js"
</script>
<!-- Define the name or address of ES Module -->
<script type="importmap">
{
"imports": { "@orillusion/core": "https://unpkg.com/@orillusion/core/dist/orillusion.es.js" }
}
</script>
<!-- Customerized names could be imported -->
<script type="module">
import { Engine3D, Camera3D } from "@orillusion/core"
</script>
At the beginning, we need to use
Engine3D.init()and then the instance
Engine3Dwill be created for further use
import { Engine3D } from '@orillusion/core'
Engine3D.init().then(()=>{
// Next
})
As
Engine3D.init()is asynchronous, we recommend using
async/awaitin the code
import { Engine3D } from '@orillusion/core'
async function demo(){
await Engine3D.init();
// Next
}
demo()
In default,
Engine3D.init()will create a
canvasthe same size with the window. Also, we could create a
canvasmanually using tag
<canvas>with a
id
<canvas id="canvas" width="800" height="500" />
Next, we need to get the
<canvas>via
idand then init engine by passing the
<canvas>to
canvasConfig
import { Engine3D } from '@orillusion/core';
let canvas = document.getElementById('canvas')
await Engine3D.init({
canvasConfig: { canvas }
})
Please read the Docs to Learn More.
Chrome Desktop: 113+
Edge Desktop: 113+
Please make sure to read the Contributing Guide before developing or making a pull request.
Orillusion engine is released under the MIT license.