forked from Orillusion/orillusion
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSample_AtmosphericSky.ts
35 lines (31 loc) · 1.29 KB
/
Sample_AtmosphericSky.ts
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
29
30
31
32
33
34
35
import { GUIHelp } from "@orillusion/debug/GUIHelp";
import { GUIUtil } from "@samples/utils/GUIUtil";
import { createExampleScene } from "@samples/utils/ExampleScene";
import { AtmosphericComponent, Engine3D, GPUCullMode, LitMaterial, MeshRenderer, Object3D, Object3DUtil, PlaneGeometry, Scene3D, UnLitMaterial, Vector3 } from "@orillusion/core";
// sample of AtmosphericSky
class Sample_AtmosphericSky {
async run() {
// init engine
await Engine3D.init({});
// init scene
let scene: Scene3D = createExampleScene().scene;
// start renderer
Engine3D.startRenderView(scene.view);
// add atmospheric sky
let component = scene.getComponent(AtmosphericComponent);
let texture = component['_atmosphericScatteringSky'];
let ulitMaterial = new UnLitMaterial();
ulitMaterial.baseMap = texture.texture2D;
ulitMaterial.cullMode = GPUCullMode.none;
let obj = new Object3D();
scene.addChild(obj);
let r = obj.addComponent(MeshRenderer);
r.material = ulitMaterial;
r.geometry = new PlaneGeometry(100, 50, 1, 1, Vector3.Z_AXIS);
scene.addChild(obj);
// gui
GUIHelp.init();
GUIUtil.renderAtomosphericSky(component);
}
}
new Sample_AtmosphericSky().run();