Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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
6
7namespace impeller {
8namespace scene {
9
11 Camera camera;
12 camera.fov_y_ = fov_y;
13 camera.position_ = position;
14 return camera;
15}
16
18 Camera camera = *this;
19 camera.target_ = target;
20 camera.up_ = up;
21 return camera;
22}
23
24Matrix 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
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
A 4x4 matrix using column-major storage.
Definition matrix.h:37
static constexpr Matrix MakePerspective(Radians fov_y, Scalar aspect_ratio, Scalar z_near, Scalar z_far)
Definition matrix.h:504
static constexpr Matrix MakeLookAt(Vector3 position, Vector3 target, Vector3 up)
Definition matrix.h:530