Open3D (C++ API)  0.17.0
SimpleBlackShader.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 <Eigen/Core>
11 #include <vector>
12 
14 
15 namespace open3d {
16 namespace visualization {
17 
18 namespace glsl {
19 
21 public:
22  ~SimpleBlackShader() override { Release(); }
23 
24 protected:
25  SimpleBlackShader(const std::string &name) : ShaderWrapper(name) {
26  Compile();
27  }
28 
29 protected:
30  bool Compile() final;
31  void Release() final;
32  bool BindGeometry(const geometry::Geometry &geometry,
33  const RenderOption &option,
34  const ViewControl &view) final;
35  bool RenderGeometry(const geometry::Geometry &geometry,
36  const RenderOption &option,
37  const ViewControl &view) final;
38  void UnbindGeometry() final;
39 
40 protected:
41  virtual bool PrepareRendering(const geometry::Geometry &geometry,
42  const RenderOption &option,
43  const ViewControl &view) = 0;
44  virtual bool PrepareBinding(const geometry::Geometry &geometry,
45  const RenderOption &option,
46  const ViewControl &view,
47  std::vector<Eigen::Vector3f> &points) = 0;
48 
49 protected:
52  GLuint MVP_;
53 };
54 
56 public:
58  : SimpleBlackShader("SimpleBlackShaderForPointCloudNormal") {}
59 
60 protected:
61  bool PrepareRendering(const geometry::Geometry &geometry,
62  const RenderOption &option,
63  const ViewControl &view) final;
64  bool PrepareBinding(const geometry::Geometry &geometry,
65  const RenderOption &option,
66  const ViewControl &view,
67  std::vector<Eigen::Vector3f> &points) final;
68 };
69 
71 public:
73  : SimpleBlackShader("SimpleBlackShaderForTriangleMeshWireFrame") {}
74 
75 protected:
76  bool PrepareRendering(const geometry::Geometry &geometry,
77  const RenderOption &option,
78  const ViewControl &view) final;
79  bool PrepareBinding(const geometry::Geometry &geometry,
80  const RenderOption &option,
81  const ViewControl &view,
82  std::vector<Eigen::Vector3f> &points) final;
83 };
84 
85 } // namespace glsl
86 
87 } // namespace visualization
88 } // namespace open3d
The base geometry class.
Definition: Geometry.h:18
Defines rendering options for visualizer.
Definition: RenderOption.h:20
View controller for visualizer.
Definition: ViewControl.h:23
Definition: ShaderWrapper.h:21
SimpleBlackShaderForPointCloudNormal()
Definition: SimpleBlackShader.h:57
SimpleBlackShaderForTriangleMeshWireFrame()
Definition: SimpleBlackShader.h:72
Definition: SimpleBlackShader.h:20
virtual bool PrepareRendering(const geometry::Geometry &geometry, const RenderOption &option, const ViewControl &view)=0
bool RenderGeometry(const geometry::Geometry &geometry, const RenderOption &option, const ViewControl &view) final
Definition: SimpleBlackShader.cpp:64
void Release() final
Definition: SimpleBlackShader.cpp:31
virtual bool PrepareBinding(const geometry::Geometry &geometry, const RenderOption &option, const ViewControl &view, std::vector< Eigen::Vector3f > &points)=0
bool Compile() final
Definition: SimpleBlackShader.cpp:20
SimpleBlackShader(const std::string &name)
Definition: SimpleBlackShader.h:25
~SimpleBlackShader() override
Definition: SimpleBlackShader.h:22
void UnbindGeometry() final
Definition: SimpleBlackShader.cpp:81
GLuint vertex_position_
Definition: SimpleBlackShader.h:50
GLuint vertex_position_buffer_
Definition: SimpleBlackShader.h:51
GLuint MVP_
Definition: SimpleBlackShader.h:52
bool BindGeometry(const geometry::Geometry &geometry, const RenderOption &option, const ViewControl &view) final
Definition: SimpleBlackShader.cpp:36
std::string name
Definition: FilePCD.cpp:39
int points
Definition: FilePCD.cpp:54
Definition: NonRigidOptimizer.cpp:22
Definition: PinholeCameraIntrinsic.cpp:16
Definition: Device.h:107