Open3D (C++ API)
SimpleBlackShader.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 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 <Eigen/Core>
30 #include <vector>
31 
33 
34 namespace open3d {
35 namespace visualization {
36 
37 namespace glsl {
38 
40 public:
41  ~SimpleBlackShader() override { Release(); }
42 
43 protected:
44  SimpleBlackShader(const std::string &name) : ShaderWrapper(name) {
45  Compile();
46  }
47 
48 protected:
49  bool Compile() final;
50  void Release() final;
51  bool BindGeometry(const geometry::Geometry &geometry,
52  const RenderOption &option,
53  const ViewControl &view) final;
54  bool RenderGeometry(const geometry::Geometry &geometry,
55  const RenderOption &option,
56  const ViewControl &view) final;
57  void UnbindGeometry() final;
58 
59 protected:
60  virtual bool PrepareRendering(const geometry::Geometry &geometry,
61  const RenderOption &option,
62  const ViewControl &view) = 0;
63  virtual bool PrepareBinding(const geometry::Geometry &geometry,
64  const RenderOption &option,
65  const ViewControl &view,
66  std::vector<Eigen::Vector3f> &points) = 0;
67 
68 protected:
71  GLuint MVP_;
72 };
73 
75 public:
77  : SimpleBlackShader("SimpleBlackShaderForPointCloudNormal") {}
78 
79 protected:
80  bool PrepareRendering(const geometry::Geometry &geometry,
81  const RenderOption &option,
82  const ViewControl &view) final;
83  bool PrepareBinding(const geometry::Geometry &geometry,
84  const RenderOption &option,
85  const ViewControl &view,
86  std::vector<Eigen::Vector3f> &points) final;
87 };
88 
90 public:
92  : SimpleBlackShader("SimpleBlackShaderForTriangleMeshWireFrame") {}
93 
94 protected:
95  bool PrepareRendering(const geometry::Geometry &geometry,
96  const RenderOption &option,
97  const ViewControl &view) final;
98  bool PrepareBinding(const geometry::Geometry &geometry,
99  const RenderOption &option,
100  const ViewControl &view,
101  std::vector<Eigen::Vector3f> &points) final;
102 };
103 
104 } // namespace glsl
105 
106 } // namespace visualization
107 } // namespace open3d
bool RenderGeometry(const geometry::Geometry &geometry, const RenderOption &option, const ViewControl &view) final
Definition: SimpleBlackShader.cpp:83
The base geometry class.
Definition: Geometry.h:37
~SimpleBlackShader() override
Definition: SimpleBlackShader.h:41
GLuint vertex_position_buffer_
Definition: SimpleBlackShader.h:70
bool Compile() final
Definition: SimpleBlackShader.cpp:39
void Release() final
Definition: SimpleBlackShader.cpp:50
View controller for visualizer.
Definition: ViewControl.h:41
virtual bool PrepareBinding(const geometry::Geometry &geometry, const RenderOption &option, const ViewControl &view, std::vector< Eigen::Vector3f > &points)=0
GLuint MVP_
Definition: SimpleBlackShader.h:71
Definition: SimpleBlackShader.h:39
Defines rendering options for visualizer.
Definition: RenderOption.h:39
SimpleBlackShader(const std::string &name)
Definition: SimpleBlackShader.h:44
SimpleBlackShaderForTriangleMeshWireFrame()
Definition: SimpleBlackShader.h:91
SimpleBlackShaderForPointCloudNormal()
Definition: SimpleBlackShader.h:76
int points
Definition: FilePCD.cpp:71
Definition: Open3DViewer.h:29
std::string name
Definition: FilePCD.cpp:56
Definition: ShaderWrapper.h:40
void UnbindGeometry() final
Definition: SimpleBlackShader.cpp:100
virtual bool PrepareRendering(const geometry::Geometry &geometry, const RenderOption &option, const ViewControl &view)=0
bool BindGeometry(const geometry::Geometry &geometry, const RenderOption &option, const ViewControl &view) final
Definition: SimpleBlackShader.cpp:55
GLuint vertex_position_
Definition: SimpleBlackShader.h:69