Skip to content

Commit

Permalink
urban zoom in/out
Browse files Browse the repository at this point in the history
  • Loading branch information
ydcjeff committed Dec 19, 2023
1 parent 53eb46f commit 8388008
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ const engine = new Engine(canvas);
(async () => {
// await engine.setScene(AxisScene);
// await engine.setScene(RotatingScene);
await engine.setScene(CameraRotatingScene);
// await engine.setScene(CameraRotatingScene);
// await engine.setScene(ScaleScene);
// await engine.setScene(TranslationScene);
// await engine.setScene(UrbanScene);
await engine.setScene(SolarScene);
// await engine.setScene(SolarScene);
// await engine.setScene(TestScene);
// await engine.setScene(CubeScene);
// await engine.setScene(DirectLightScene);
Expand Down
10 changes: 10 additions & 0 deletions src/scenes/urban-scene.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,16 @@ export class UrbanScene extends Scene {
return;
}

if (e.ctrlKey) {
if (e.key === '=') {
e.preventDefault();
this.mainCamera.fov -= 0.01;
} else if (e.key === '-') {
e.preventDefault();
this.mainCamera.fov += 0.01;
}
}

if (e.key === 'w') camera.setPosition(Vector3.add(camera.position, Vector3.forward.multiply(speed)));

if (e.key === 'a') camera.setPosition(Vector3.add(camera.position, Vector3.left.multiply(speed)));
Expand Down

0 comments on commit 8388008

Please sign in to comment.