Open3D (C++ API)  0.18.0+5c982c7
ImageMaskShader.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 
10 #include "open3d/geometry/Image.h"
12 
13 namespace open3d {
14 namespace visualization {
15 
16 namespace glsl {
17 
19 public:
20  ~ImageMaskShader() override { Release(); }
21 
22 protected:
23  ImageMaskShader(const std::string &name) : ShaderWrapper(name) {
24  Compile();
25  }
26 
27 protected:
28  bool Compile() final;
29  void Release() final;
30  bool BindGeometry(const geometry::Geometry &geometry,
31  const RenderOption &option,
32  const ViewControl &view) final;
33  bool RenderGeometry(const geometry::Geometry &geometry,
34  const RenderOption &option,
35  const ViewControl &view) final;
36  void UnbindGeometry() final;
37 
38 protected:
39  virtual bool PrepareRendering(const geometry::Geometry &geometry,
40  const RenderOption &option,
41  const ViewControl &view) = 0;
42  virtual bool PrepareBinding(const geometry::Geometry &geometry,
43  const RenderOption &option,
44  const ViewControl &view,
45  geometry::Image &image) = 0;
46 
47 protected:
50  GLuint vertex_UV_;
54  GLuint mask_color_;
55  GLuint mask_alpha_;
56 
59 };
60 
62 public:
63  ImageMaskShaderForImage() : ImageMaskShader("ImageMaskShaderForImage") {}
64 
65 protected:
66  virtual bool PrepareRendering(const geometry::Geometry &geometry,
67  const RenderOption &option,
68  const ViewControl &view) final;
69  virtual bool PrepareBinding(const geometry::Geometry &geometry,
70  const RenderOption &option,
71  const ViewControl &view,
72  geometry::Image &render_image) final;
73 };
74 
75 } // namespace glsl
76 
77 } // namespace visualization
78 } // namespace open3d
std::shared_ptr< core::Tensor > image
Definition: FilamentRenderer.cpp:183
The base geometry class.
Definition: Geometry.h:18
The Image class stores image with customizable width, height, num of channels and bytes per channel.
Definition: Image.h:34
Defines rendering options for visualizer.
Definition: RenderOption.h:20
View controller for visualizer.
Definition: ViewControl.h:23
ImageMaskShaderForImage()
Definition: ImageMaskShader.h:63
Definition: ImageMaskShader.h:18
virtual bool PrepareBinding(const geometry::Geometry &geometry, const RenderOption &option, const ViewControl &view, geometry::Image &image)=0
GLuint image_texture_buffer_
Definition: ImageMaskShader.h:53
ImageMaskShader(const std::string &name)
Definition: ImageMaskShader.h:23
~ImageMaskShader() override
Definition: ImageMaskShader.h:20
void UnbindGeometry() final
Definition: ImageMaskShader.cpp:123
GLuint vertex_position_buffer_
Definition: ImageMaskShader.h:49
void Release() final
Definition: ImageMaskShader.cpp:34
gl_util::GLVector3f mask_color_data_
Definition: ImageMaskShader.h:57
GLuint vertex_UV_
Definition: ImageMaskShader.h:50
GLuint vertex_position_
Definition: ImageMaskShader.h:48
virtual bool PrepareRendering(const geometry::Geometry &geometry, const RenderOption &option, const ViewControl &view)=0
GLuint mask_alpha_
Definition: ImageMaskShader.h:55
GLuint vertex_UV_buffer_
Definition: ImageMaskShader.h:51
bool Compile() final
Definition: ImageMaskShader.cpp:21
GLuint image_texture_
Definition: ImageMaskShader.h:52
bool BindGeometry(const geometry::Geometry &geometry, const RenderOption &option, const ViewControl &view) final
Definition: ImageMaskShader.cpp:39
bool RenderGeometry(const geometry::Geometry &geometry, const RenderOption &option, const ViewControl &view) final
Definition: ImageMaskShader.cpp:96
GLuint mask_color_
Definition: ImageMaskShader.h:54
GLfloat mask_alpha_data_
Definition: ImageMaskShader.h:58
Definition: ShaderWrapper.h:21
std::string name
Definition: FilePCD.cpp:39
Eigen::Matrix< GLfloat, 3, 1, Eigen::ColMajor > GLVector3f
Definition: GLHelper.h:32
Definition: PinholeCameraIntrinsic.cpp:16