Skip to content

Commit

Permalink
chore: update sample_addremove
Browse files Browse the repository at this point in the history
add basic light
  • Loading branch information
lslzl3000 committed Aug 10, 2023
1 parent 1f66ee8 commit bc80466
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion samples/base/Sample_AddRemove.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,26 @@ class Sample_AddRemove {
// create new Scene
let scene = new Scene3D();
// add atmospheric sky
scene.addComponent(AtmosphericComponent).sunY = 0.6;
let sky = scene.addComponent(AtmosphericComponent)
sky.sunY = 0.6;

// init camera3D
let mainCamera = CameraUtil.createCamera3D(null, scene);
mainCamera.perspective(60, Engine3D.aspect, 1, 2000.0);
let hoverCameraController = mainCamera.object3D.addComponent(HoverCameraController);
hoverCameraController.setCamera(15, -30, 300);

// add a basic direct light
let lightObj = new Object3D();
lightObj.rotationX = 45;
lightObj.rotationY = 60;
lightObj.rotationZ = 150;
let dirLight = lightObj.addComponent(DirectLight);
dirLight.lightColor = KelvinUtil.color_temperature_to_rgb(5355);
dirLight.intensity = 10;
scene.addChild(lightObj);
sky.relativeTransform = dirLight.transform;

// create a view with target scene and camera
this.view = new View3D();
this.view.scene = scene;
Expand Down

0 comments on commit bc80466

Please sign in to comment.