Open3D (C++ API)
FilamentCamera.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - Open3D: www.open3d.org -
3 // ----------------------------------------------------------------------------
4 // The MIT License (MIT)
5 //
6 // Copyright (c) 2019 www.open3d.org
7 //
8 // Permission is hereby granted, free of charge, to any person obtaining a copy
9 // of this software and associated documentation files (the "Software"), to deal
10 // in the Software without restriction, including without limitation the rights
11 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 // copies of the Software, and to permit persons to whom the Software is
13 // furnished to do so, subject to the following conditions:
14 //
15 // The above copyright notice and this permission notice shall be included in
16 // all copies or substantial portions of the Software.
17 //
18 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24 // IN THE SOFTWARE.
25 // ----------------------------------------------------------------------------
26 
27 #pragma once
28 
30 
31 namespace filament {
32 class Camera;
33 class Engine;
34 } // namespace filament
35 
36 namespace open3d {
37 namespace visualization {
38 
39 class FilamentCamera : public Camera {
40 public:
41  explicit FilamentCamera(filament::Engine& engine);
42  ~FilamentCamera();
43 
44  void SetProjection(double fov,
45  double aspect,
46  double near,
47  double far,
48  FovType fov_type) override;
49 
50  void SetProjection(Projection projection,
51  double left,
52  double right,
53  double bottom,
54  double top,
55  double near,
56  double far) override;
57 
58  double GetNear() const override;
59  double GetFar() const override;
61  double GetFieldOfView() const override;
63  FovType GetFieldOfViewType() const override;
64 
65  void SetModelMatrix(const Transform& view) override;
66  void SetModelMatrix(const Eigen::Vector3f& forward,
67  const Eigen::Vector3f& left,
68  const Eigen::Vector3f& up) override;
69 
70  void LookAt(const Eigen::Vector3f& center,
71  const Eigen::Vector3f& eye,
72  const Eigen::Vector3f& up) override;
73 
74  Eigen::Vector3f GetPosition() const override;
75  Eigen::Vector3f GetForwardVector() const override;
76  Eigen::Vector3f GetLeftVector() const override;
77  Eigen::Vector3f GetUpVector() const override;
78  Transform GetModelMatrix() const override;
79  Transform GetViewMatrix() const override;
80  Transform GetProjectionMatrix() const override;
81 
82  filament::Camera* GetNativeCamera() const { return camera_; }
83 
84 private:
85  filament::Camera* camera_ = nullptr;
86  filament::Engine& engine_;
87  double fov_;
88  FovType fov_type_;
89 };
90 
91 } // namespace visualization
92 } // namespace open3d
Definition: FilamentCamera.h:39
filament::Camera * GetNativeCamera() const
Definition: FilamentCamera.h:82
Definition: Camera.h:34
Projection
Definition: Camera.h:37
GLMatrix4f LookAt(const Eigen::Vector3d &eye, const Eigen::Vector3d &lookat, const Eigen::Vector3d &up)
Definition: GLHelper.cpp:36
Definition: Open3DViewer.h:29
FovType
Definition: Camera.h:36
Definition: FilamentCamera.h:31
Eigen::Transform< float, 3, Eigen::Affine > Transform
Definition: Camera.h:38