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