GPU-Accelerated Coverage  0.1.0
Compute coverage tours for known environment with articulated objects on GPU
BellmanFordXfbRenderer.h
1 /*
2  * Copyright (c) 2018, Stefan Osswald
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * * Redistributions of source code must retain the above copyright notice, this
9  * list of conditions and the following disclaimer.
10  *
11  * * Redistributions in binary form must reproduce the above copyright notice,
12  * this list of conditions and the following disclaimer in the documentation
13  * and/or other materials provided with the distribution.
14  *
15  * * Neither the name of the copyright holder nor the names of its
16  * contributors may be used to endorse or promote products derived from
17  * this software without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  */
30 
31 #ifndef INCLUDE_ARTICULATION_BELLMANFORDXFBRENDERER_H_
32 #define INCLUDE_ARTICULATION_BELLMANFORDXFBRENDERER_H_
33 
34 #include <gpu_coverage/AbstractRenderer.h>
35 #include <gpu_coverage/CostMapRenderer.h>
36 #include <gpu_coverage/Programs.h>
37 
38 namespace gpu_coverage {
39 
41 public:
42  BellmanFordXfbRenderer(const Scene * const scene, const CostMapRenderer * const costmapRenderer,
43  const bool renderToWindow, const bool visual);
44  virtual ~BellmanFordXfbRenderer();
45  virtual void display();
46  inline const GLuint& getTexture() const {
47  return textures[OUTPUT];
48  }
49  inline const GLuint& getVisualTexture() const {
50  return textures[VISUAL];
51  }
52  inline const int& getTextureWidth() const {
53  return width;
54  }
55  inline const int& getTextureHeight() const {
56  return height;
57  }
58 
59  inline void setRobotPosition(const glm::mat4x4& worldTransform) {
60  robotWorldTransform = worldTransform;
61  }
62 
63 protected:
64  const CostMapRenderer * const costmapRenderer;
65  const bool renderToWindow;
66  const bool renderVisual;
67 
68  ProgramBellmanFordXfbInit progBellmanFordXfbInit;
69  ProgramBellmanFordXfbStep progBellmanFordXfbStep;
70 
71  ProgramShowTexture * progShowTexture;
72  ProgramVisualizeIntTexture * progVisualizeIntTexture;
73 
74  const int width;
75  const int height;
76  const size_t maxIterations;
77 
78  GLuint framebuffer;
79 
80  GLuint vao;
81  GLuint vbo;
82 
83  GLuint tbo[2];
84  GLuint tfi[2];
85 
86  GLuint numPrimitivesQuery[3];
87  size_t numQueries;
88  GLuint textures[3];
89  enum TextureRole {
90  QUEUED,
91  OUTPUT,
92  VISUAL
93  };
94 
95  glm::mat4x4 robotWorldTransform;
96 };
97 
98 } /* namespace gpu_coverage */
99 
100 #endif /* INCLUDE_ARTICULATION_BELLMANFORDXFBRENDERER_H_ */
virtual void display()
Renders the scene.
Definition: BellmanFordXfbRenderer.h:40
Scene graph corresponding to Assimp&#39;s aiScene.
Definition: Scene.h:59
Definition: Programs.h:463
Definition: Programs.h:450
const Scene *const scene
Pointer to the scene to be rendered.
Definition: AbstractRenderer.h:101
const int & getTextureHeight() const
Height of the result texture.
Definition: BellmanFordXfbRenderer.h:55
Abstract superclass for all renderers.
Definition: AbstractRenderer.h:45
Definition: AbstractCamera.h:41
const GLuint & getTexture() const
Returns the OpenGL texture ID of the result texture.
Definition: BellmanFordXfbRenderer.h:46
Definition: Programs.h:378
const int & getTextureWidth() const
Width of the result texture.
Definition: BellmanFordXfbRenderer.h:52
Definition: CostMapRenderer.h:40