Open3D (C++ API)  0.11.0
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 
32 namespace filament {
33 class Camera;
34 class Engine;
35 } // namespace filament
37 
38 namespace open3d {
39 namespace visualization {
40 namespace rendering {
41 
42 class FilamentCamera : public Camera {
43 public:
44  explicit FilamentCamera(filament::Engine& engine);
45  ~FilamentCamera();
46 
47  void SetProjection(double fov,
48  double aspect,
49  double near,
50  double far,
51  FovType fov_type) override;
52 
53  void SetProjection(Projection projection,
54  double left,
55  double right,
56  double bottom,
57  double top,
58  double near,
59  double far) override;
60 
61  double GetNear() const override;
62  double GetFar() const override;
64  double GetFieldOfView() const override;
66  FovType GetFieldOfViewType() const override;
67 
68  void SetModelMatrix(const Transform& view) override;
69  void SetModelMatrix(const Eigen::Vector3f& forward,
70  const Eigen::Vector3f& left,
71  const Eigen::Vector3f& up) override;
72 
73  void LookAt(const Eigen::Vector3f& center,
74  const Eigen::Vector3f& eye,
75  const Eigen::Vector3f& up) override;
76 
77  Eigen::Vector3f GetPosition() const override;
78  Eigen::Vector3f GetForwardVector() const override;
79  Eigen::Vector3f GetLeftVector() const override;
80  Eigen::Vector3f GetUpVector() const override;
81  Transform GetModelMatrix() const override;
82  Transform GetViewMatrix() const override;
83  Transform GetProjectionMatrix() const override;
84 
85  filament::Camera* GetNativeCamera() const { return camera_; }
86 
87 private:
88  filament::Camera* camera_ = nullptr;
89  filament::Engine& engine_;
90  double fov_;
91  FovType fov_type_;
92 };
93 
94 } // namespace rendering
95 } // namespace visualization
96 } // namespace open3d
GLMatrix4f LookAt(const Eigen::Vector3d &eye, const Eigen::Vector3d &lookat, const Eigen::Vector3d &up)
Definition: GLHelper.cpp:36
filament::Camera * GetNativeCamera() const
Definition: FilamentCamera.h:85
Eigen::Transform< float, 3, Eigen::Affine > Transform
Definition: Camera.h:39
Definition: PinholeCameraIntrinsic.cpp:35
Definition: FilamentEngine.h:31