Flutter Engine
The Flutter Engine
camera.h
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef FLUTTER_IMPELLER_SCENE_CAMERA_H_
6#define FLUTTER_IMPELLER_SCENE_CAMERA_H_
7
8#include <optional>
9
11
12namespace impeller {
13namespace scene {
14
15class Camera {
16 public:
17 static Camera MakePerspective(Radians fov_y, Vector3 position);
18
19 Camera LookAt(Vector3 target, Vector3 up = Vector3(0, -1, 0)) const;
20
21 Matrix GetTransform(ISize target_size) const;
22
23 private:
24 Radians fov_y_ = Degrees(60);
25 Vector3 position_ = Vector3();
26 Vector3 target_ = Vector3(0, 0, -1);
27 Vector3 up_ = Vector3(0, -1, 0);
28 Scalar z_near_ = 0.1f;
29 Scalar z_far_ = 1000.0f;
30
31 mutable std::optional<Matrix> transform_;
32};
33
34} // namespace scene
35} // namespace impeller
36
37#endif // FLUTTER_IMPELLER_SCENE_CAMERA_H_
static Camera MakePerspective(Radians fov_y, Vector3 position)
Definition: camera.cc:10
Camera LookAt(Vector3 target, Vector3 up=Vector3(0, -1, 0)) const
Definition: camera.cc:17
Matrix GetTransform(ISize target_size) const
Definition: camera.cc:24
uint32_t * target
float Scalar
Definition: scalar.h:18
A 4x4 matrix using column-major storage.
Definition: matrix.h:37