Loading [MathJax]/extensions/TeX/AMSsymbols.js
Open3D (C++ API)  0.14.1
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
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) 2018-2021 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 
29 #include <utils/Entity.h>
30 
32 
34 namespace filament {
35 class Camera;
36 class Engine;
37 } // namespace filament
39 
40 namespace open3d {
41 namespace visualization {
42 namespace rendering {
43 
44 class FilamentCamera : public Camera {
45 public:
46  explicit FilamentCamera(filament::Engine& engine);
47  ~FilamentCamera();
48 
49  void SetProjection(double fov,
50  double aspect,
51  double near,
52  double far,
53  FovType fov_type) override;
54 
55  void SetProjection(Projection projection,
56  double left,
57  double right,
58  double bottom,
59  double top,
60  double near,
61  double far) override;
62 
63  void SetProjection(const Eigen::Matrix3d& intrinsics,
64  double near,
65  double far,
66  double width,
67  double height) override;
68 
69  void LookAt(const Eigen::Vector3f& center,
70  const Eigen::Vector3f& eye,
71  const Eigen::Vector3f& up) override;
72 
73  void SetModelMatrix(const Transform& view) override;
74  void SetModelMatrix(const Eigen::Vector3f& forward,
75  const Eigen::Vector3f& left,
76  const Eigen::Vector3f& up) override;
77 
78  double GetNear() const override;
79  double GetFar() const override;
81  double GetFieldOfView() const override;
83  FovType GetFieldOfViewType() const override;
84 
85  Eigen::Vector3f GetPosition() const override;
86  Eigen::Vector3f GetForwardVector() const override;
87  Eigen::Vector3f GetLeftVector() const override;
88  Eigen::Vector3f GetUpVector() const override;
89  Transform GetModelMatrix() const override;
90  Transform GetViewMatrix() const override;
91  ProjectionMatrix GetProjectionMatrix() const override;
92  Transform GetCullingProjectionMatrix() const override;
93  const ProjectionInfo& GetProjection() const override;
94 
95  Eigen::Vector3f Unproject(float x,
96  float y,
97  float z,
98  float view_width,
99  float view_height) const override;
100 
101  Eigen::Vector2f GetNDC(const Eigen::Vector3f& pt) const override;
102  double GetViewZ(float z_buffer) const override;
103 
104  void CopyFrom(const Camera* camera) override;
105 
106  filament::Camera* GetNativeCamera() const { return camera_; }
107 
108 private:
109  filament::Camera* camera_ = nullptr;
110  utils::Entity camera_entity_;
111  filament::Engine& engine_;
112  Camera::ProjectionInfo projection_;
113 };
114 
115 } // namespace rendering
116 } // namespace visualization
117 } // namespace open3d
int height
Definition: FilePCD.cpp:72
Eigen::Transform< float, 3, Eigen::Projective > ProjectionMatrix
Definition: Camera.h:45
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:106
Eigen::Transform< float, 3, Eigen::Affine > Transform
Definition: Camera.h:44
Definition: PinholeCameraIntrinsic.cpp:35
void Unproject(const core::Tensor &depth, utility::optional< std::reference_wrapper< const core::Tensor >> image_colors, core::Tensor &points, utility::optional< std::reference_wrapper< core::Tensor >> colors, const core::Tensor &intrinsics, const core::Tensor &extrinsics, float depth_scale, float depth_max, int64_t stride)
Definition: PointCloud.cpp:42
Definition: FilamentEngine.h:31
int width
Definition: FilePCD.cpp:71