@galacean/engine 0.0.0-experimental-0.9-plus.8 → 0.0.0-experimental-ktx2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -7
- package/dist/browser.js +22704 -18380
- package/dist/browser.min.js +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +1 -1
- package/dist/module.js +1 -1
- package/dist/module.js.map +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -39,33 +39,33 @@ import { Engine, Scene, Entity } from "@galacean/engine";
|
|
|
39
39
|
## Usage
|
|
40
40
|
|
|
41
41
|
```typescript
|
|
42
|
-
// Create engine by passing in the HTMLCanvasElement id and adjust canvas size
|
|
43
|
-
const engine =
|
|
42
|
+
// Create engine by passing in the HTMLCanvasElement id and adjust canvas size
|
|
43
|
+
const engine = await WebGLEngine.create({ canvas: "canvas-id" });
|
|
44
44
|
engine.canvas.resizeByClientSize();
|
|
45
45
|
|
|
46
|
-
// Get scene and create root entity
|
|
46
|
+
// Get scene and create root entity
|
|
47
47
|
const scene = engine.sceneManager.activeScene;
|
|
48
48
|
const rootEntity = scene.createRootEntity("Root");
|
|
49
49
|
|
|
50
|
-
// Create light
|
|
50
|
+
// Create light
|
|
51
51
|
const lightEntity = rootEntity.createChild("Light");
|
|
52
52
|
const directLight = lightEntity.addComponent(DirectLight);
|
|
53
53
|
lightEntity.transform.setRotation(-45, -45, 0);
|
|
54
54
|
directLight.intensity = 0.4;
|
|
55
55
|
|
|
56
|
-
// Create camera
|
|
56
|
+
// Create camera
|
|
57
57
|
const cameraEntity = rootEntity.createChild("Camera");
|
|
58
58
|
cameraEntity.addComponent(Camera);
|
|
59
59
|
cameraEntity.transform.setPosition(0, 0, 12);
|
|
60
60
|
|
|
61
|
-
// Create sphere
|
|
61
|
+
// Create sphere
|
|
62
62
|
const meshEntity = rootEntity.createChild("Sphere");
|
|
63
63
|
const meshRenderer = meshEntity.addComponent(MeshRenderer);
|
|
64
64
|
const material = new BlinnPhongMaterial(engine);
|
|
65
65
|
meshRenderer.setMaterial(material);
|
|
66
66
|
meshRenderer.mesh = PrimitiveMesh.createSphere(engine, 1);
|
|
67
67
|
|
|
68
|
-
// Run engine
|
|
68
|
+
// Run engine
|
|
69
69
|
engine.run();
|
|
70
70
|
```
|
|
71
71
|
|