Open3D (C++ API)  0.18.0+252c867
FilamentRenderToBuffer.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - Open3D: www.open3d.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2023 www.open3d.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
11 
13 namespace filament {
14 class Engine;
15 class Renderer;
16 class Scene;
17 class SwapChain;
18 } // namespace filament
20 
21 namespace open3d {
22 namespace visualization {
23 namespace rendering {
24 
25 class FilamentRenderer;
26 class FilamentScene;
27 class FilamentView;
28 
30 public:
31  // Use Renderer::CreateBufferRenderer to instantiate
32  // FilamentRenderToBuffer, unless you are NOT using
33  // open3d::visualization::gui or another FilamentRenderer instance.
34  explicit FilamentRenderToBuffer(filament::Engine& engine);
35  ~FilamentRenderToBuffer() override;
36 
37  void Configure(const View* view,
38  Scene* scene,
39  int width,
40  int height,
41  int n_channels,
42  bool depth_image,
43  BufferReadyCallback cb) override;
45  View& GetView() override;
46 
47  void Render() override;
48 
49  // Renders the minimum necessary to get Filament to tick its rendering
50  // thread.
51  void RenderTick();
52 
53 private:
54  friend class FilamentRenderer;
55 
56  filament::Engine& engine_;
57  filament::Renderer* renderer_ = nullptr;
58  filament::SwapChain* swapchain_ = nullptr;
59  FilamentView* view_ = nullptr;
60  FilamentScene* scene_ = nullptr;
61 
62  std::size_t width_ = 0;
63  std::size_t height_ = 0;
64  std::size_t n_channels_ = 0;
65  std::uint8_t* buffer_ = nullptr;
66  std::size_t buffer_size_ = 0;
67  bool depth_image_ = false;
68 
69  BufferReadyCallback callback_;
70  bool frame_done_ = true;
71  bool pending_ = false;
72 
73  static void ReadPixelsCallback(void* buffer, size_t size, void* user);
74  void CopySettings(const View* view);
75 };
76 
77 } // namespace rendering
78 } // namespace visualization
79 } // namespace open3d
Definition: FilamentRenderToBuffer.h:29
void SetDimensions(std::uint32_t width, std::uint32_t height) override
Definition: FilamentRenderToBuffer.cpp:111
~FilamentRenderToBuffer() override
Definition: FilamentRenderToBuffer.cpp:50
void Configure(const View *view, Scene *scene, int width, int height, int n_channels, bool depth_image, BufferReadyCallback cb) override
Definition: FilamentRenderToBuffer.cpp:64
void Render() override
Definition: FilamentRenderToBuffer.cpp:172
FilamentRenderToBuffer(filament::Engine &engine)
Definition: FilamentRenderToBuffer.cpp:45
void RenderTick()
Definition: FilamentRenderToBuffer.cpp:203
View & GetView() override
Definition: FilamentRenderToBuffer.cpp:150
std::function< void(const Buffer &)> BufferReadyCallback
Definition: RenderToBuffer.h:31
int width
Definition: FilePCD.cpp:52
int size
Definition: FilePCD.cpp:40
int height
Definition: FilePCD.cpp:53
Definition: FilamentEngine.h:12
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:548
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 image_handle timestamp_usec white_balance image_handle k4a_device_configuration_t config device_handle char size_t serial_number_size bool int32_t int32_t int32_t int32_t k4a_color_control_mode_t default_mode value const const k4a_calibration_t calibration char const const k4a_calibration_t calibration const k4a_calibration_t const k4a_float2_t const const const k4a_float3_t int valid const k4a_calibration_t const k4a_float2_t const const const k4a_float2_t int valid transformation_handle const depth_image
Definition: K4aPlugin.cpp:822
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 image_handle timestamp_usec white_balance image_handle k4a_device_configuration_t config device_handle char size_t serial_number_size bool int32_t int32_t int32_t int32_t k4a_color_control_mode_t default_mode value const const k4a_calibration_t calibration char size_t
Definition: K4aPlugin.cpp:719
void ReadPixelsCallback(void *buffer, size_t buffer_size, void *user)
Definition: FilamentScene.cpp:1800
Definition: PinholeCameraIntrinsic.cpp:16