| Flutter Impeller |

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
10 #include "impeller/geometry/matrix.h"
11
12 namespace impeller {
13 namespace scene {
14
15 class 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_
impeller::Scalar
float Scalar
Definition: scalar.h:18
impeller::scene::Camera::GetTransform
Matrix GetTransform(ISize target_size) const
Definition: camera.cc:24
impeller::scene::Camera::MakePerspective
static Camera MakePerspective(Radians fov_y, Vector3 position)
Definition: camera.cc:10
matrix.h
impeller::TSize
Definition: size.h:19
impeller::scene::Camera::LookAt
Camera LookAt(Vector3 target, Vector3 up=Vector3(0, -1, 0)) const
Definition: camera.cc:17
impeller::Radians
Definition: scalar.h:38
impeller::Degrees
Definition: scalar.h:46
impeller
Definition: aiks_blend_unittests.cc:18
impeller::Matrix
A 4x4 matrix using column-major storage.
Definition: matrix.h:37
impeller::Vector3
Definition: vector.h:20
impeller::scene::Camera
Definition: camera.h:15