Open3D (C++ API)
FilamentGeometryBuffersBuilder.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 
29 // NOTE: This header must precede the Filament headers otherwise a conflict
30 // occurs between Filament and standard headers
32 
33 #include <filament/Box.h>
34 #include <filament/RenderableManager.h>
35 #include <memory>
36 #include <tuple>
37 
38 namespace open3d {
39 
40 namespace geometry {
41 class Geometry3D;
42 class LineSet;
43 class PointCloud;
44 class TriangleMesh;
45 } // namespace geometry
46 
47 namespace visualization {
48 
50 public:
51  using Buffers = std::tuple<VertexBufferHandle, IndexBufferHandle>;
53 
54  static std::unique_ptr<GeometryBuffersBuilder> GetBuilder(
55  const geometry::Geometry3D& geometry);
56  virtual ~GeometryBuffersBuilder() = default;
57 
58  virtual filament::RenderableManager::PrimitiveType GetPrimitiveType()
59  const = 0;
60 
61  virtual Buffers ConstructBuffers() = 0;
62  virtual filament::Box ComputeAABB() = 0;
63 
64 protected:
65  static void DeallocateBuffer(void* buffer, size_t size, void* user_ptr);
66 };
67 
69 public:
70  explicit TriangleMeshBuffersBuilder(const geometry::TriangleMesh& geometry);
71 
72  filament::RenderableManager::PrimitiveType GetPrimitiveType()
73  const override;
74 
75  Buffers ConstructBuffers() override;
76  filament::Box ComputeAABB() override;
77 
78 private:
79  const geometry::TriangleMesh& geometry_;
80 };
81 
83 public:
84  explicit PointCloudBuffersBuilder(const geometry::PointCloud& geometry);
85 
86  filament::RenderableManager::PrimitiveType GetPrimitiveType()
87  const override;
88 
89  Buffers ConstructBuffers() override;
90  filament::Box ComputeAABB() override;
91 
92 private:
93  const geometry::PointCloud& geometry_;
94 };
95 
97 public:
98  explicit LineSetBuffersBuilder(const geometry::LineSet& geometry);
99 
100  filament::RenderableManager::PrimitiveType GetPrimitiveType()
101  const override;
102 
103  Buffers ConstructBuffers() override;
104  filament::Box ComputeAABB() override;
105 
106 private:
107  const geometry::LineSet& geometry_;
108 };
109 
110 } // namespace visualization
111 } // namespace open3d
const char const char value recording_handle imu_sample recording_handle uint8_t size_t data_size k4a_record_configuration_t config target_format k4a_capture_t capture_handle k4a_imu_sample_t imu_sample playback_handle k4a_logging_message_cb_t void min_level device_handle k4a_imu_sample_t timeout_in_ms capture_handle capture_handle capture_handle image_handle temperature_c k4a_image_t image_handle uint8_t image_handle image_handle image_handle image_handle uint32_t
Definition: K4aPlugin.cpp:553
Definition: FilamentGeometryBuffersBuilder.h:82
A point cloud consists of point coordinates, and optionally point colors and point normals...
Definition: PointCloud.h:54
int size
Definition: FilePCD.cpp:57
The base geometry class for 3D geometries.
Definition: Geometry3D.h:46
Definition: FilamentGeometryBuffersBuilder.h:68
Definition: FilamentGeometryBuffersBuilder.h:96
Definition: FilamentGeometryBuffersBuilder.h:49
Definition: Open3DViewer.h:29
std::uint32_t IndexType
Definition: FilamentGeometryBuffersBuilder.h:52
Triangle mesh contains vertices and triangles represented by the indices to the vertices.
Definition: TriangleMesh.h:54
LineSet define a sets of lines in 3D. A typical application is to display the point cloud corresponde...
Definition: LineSet.h:48
std::tuple< VertexBufferHandle, IndexBufferHandle > Buffers
Definition: FilamentGeometryBuffersBuilder.h:51