| Flutter Impeller |

camera.cc
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 #include "impeller/scene/camera.h"
6
7 namespace impeller {
8 namespace scene {
9
10 Camera Camera::MakePerspective(Radians fov_y, Vector3 position) {
11 Camera camera;
12 camera.fov_y_ = fov_y;
13 camera.position_ = position;
14 return camera;
15 }
16
17 Camera Camera::LookAt(Vector3 target, Vector3 up) const {
18 Camera camera = *this;
19 camera.target_ = target;
20 camera.up_ = up;
21 return camera;
22 }
23
24 Matrix Camera::GetTransform(ISize target_size) const {
25 if (transform_.has_value()) {
26 return transform_.value();
27 }
28
29 transform_ = Matrix::MakePerspective(fov_y_, target_size, z_near_, z_far_) *
30 Matrix::MakeLookAt(position_, target_, up_);
31
32 return transform_.value();
33 }
34
35 } // namespace scene
36 } // namespace impeller
impeller::scene::Camera::GetTransform
Matrix GetTransform(ISize target_size) const
Definition: camera.cc:24
impeller::Matrix::MakeLookAt
static constexpr Matrix MakeLookAt(Vector3 position, Vector3 target, Vector3 up)
Definition: matrix.h:497
impeller::Matrix::MakePerspective
static constexpr Matrix MakePerspective(Radians fov_y, Scalar aspect_ratio, Scalar z_near, Scalar z_far)
Definition: matrix.h:471
impeller::scene::Camera::MakePerspective
static Camera MakePerspective(Radians fov_y, Vector3 position)
Definition: camera.cc:10
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:38
camera.h
impeller
Definition: aiks_blur_unittests.cc:20
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