Ant Graphics Engine
移动优先的高性能 Web 图形引擎
这是一个网络优先和移动优先的高性能实时交互引擎。采用 组件系统设计 ,追求易用性和轻量化。开发者可以独立使用和编写Typescript脚本,使用纯代码开发项目。
// Create engine by passing in the HTMLCanvasElement id and adjust canvas size.
const engine = new WebGLEngine("canvas-id");
engine.canvas.resizeByClientSize();
// Get scene and create root entity.
const scene = engine.sceneManager.activeScene;
const rootEntity = scene.createRootEntity("Root");
// Create light.
const lightEntity = rootEntity.createChild("Light");
const directLight = lightEntity.addComponent(DirectLight);
lightEntity.transform.setRotation(-45, -45, 0);
directLight.intensity = 0.4;
// Create camera.
const cameraEntity = rootEntity.createChild("Camera");
cameraEntity.addComponent(Camera);
cameraEntity.transform.setPosition(0, 0, 12);
// Create sphere.
const meshEntity = rootEntity.createChild("Sphere");
const meshRenderer = meshEntity.addComponent(MeshRenderer);
const material = new BlinnPhongMaterial(engine);
meshRenderer.setMaterial(material);
meshRenderer.mesh = PrimitiveMesh.createSphere(engine, 1);
// Run engine.
engine.run();
该引擎在 npm 上发布,具有完整的类型支持。要安装,请使用:
npm install oasis-engine
这将允许您完全使用以下方式导入引擎:
import * as OASIS from "oasis-engine";
或个别类使用:
import { Engine, Scene, Entity } from "oasis-engine";
欢迎大家加入我们!无论您是发现错误、有很好的功能请求,还是希望拥有路线图中的任务,都可以随时与我们联系。
如果您还没有Node.js v15.0.0+和 NPM,请安装它们。然后,在您克隆存储库的文件夹中,使用 npm 安装构建依赖项:
npm run bootstrap
然后,使用 npm 构建源代码:
npm run b:all
该引擎是在MIT许可下发布的。请参阅许可证文件。