| 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 #pragma once
6
7 #include <optional>
8
9 #include "impeller/geometry/matrix.h"
10
11 namespace impeller {
12 namespace scene {
13
14 class Camera {
15 public:
16 static Camera MakePerspective(Radians fov_y, Vector3 position);
17
18 Camera LookAt(Vector3 target, Vector3 up = Vector3(0, -1, 0)) const;
19
20 Matrix GetTransform(ISize target_size) const;
21
22 private:
23 Radians fov_y_ = Degrees(60);
24 Vector3 position_ = Vector3();
25 Vector3 target_ = Vector3(0, 0, -1);
26 Vector3 up_ = Vector3(0, -1, 0);
27 Scalar z_near_ = 0.1f;
28 Scalar z_far_ = 1000.0f;
29
30 mutable std::optional<Matrix> transform_;
31 };
32
33 } // namespace scene
34 } // namespace impeller
impeller::Scalar
float Scalar
Definition: scalar.h:15
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< int64_t >
impeller::scene::Camera::LookAt
Camera LookAt(Vector3 target, Vector3 up=Vector3(0, -1, 0)) const
Definition: camera.cc:17
impeller::Radians
Definition: scalar.h:35
impeller::Degrees
Definition: scalar.h:43
impeller
Definition: aiks_context.cc:10
impeller::Matrix
A 4x4 matrix using column-major storage.
Definition: matrix.h:36
impeller::Vector3
Definition: vector.h:17
impeller::scene::Camera
Definition: camera.h:14