-
-
Notifications
You must be signed in to change notification settings - Fork 401
Expand file tree
/
Copy pathproject-loader.ts
More file actions
28 lines (25 loc) · 703 Bytes
/
project-loader.ts
File metadata and controls
28 lines (25 loc) · 703 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/**
* @title Project Loader
* @category Advance
*/
import { AssetType, Logger, WebGLEngine } from "@galacean/engine";
import { ShaderLab } from "@galacean/engine-shaderlab";
Logger.enable();
WebGLEngine.create({
canvas: document.getElementById("canvas") as HTMLCanvasElement,
shaderLab
}).then((engine) => {
engine.canvas.resizeByClientSize();
engine.resourceManager
.load({
url: "https://mdn.alipayobjects.com/oasis_be/afts/file/A*aE8_QotPNL4AAAAAQNAAAAgAekp5AQ/project.json",
type: AssetType.Project
})
.then(() => {
console.log("Project loaded");
engine.run();
})
.catch((e) => {
console.error("Failed to load project", e);
});
});