GPU-Accelerated Coverage  0.1.0
Compute coverage tours for known environment with articulated objects on GPU
PanoRenderer.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_PANORENDERER_H_
32 #define INCLUDE_ARTICULATION_PANORENDERER_H_
33 
34 #include <gpu_coverage/Programs.h>
35 #include <gpu_coverage/AbstractRenderer.h>
36 #include <gpu_coverage/Config.h>
37 #include <list>
38 
39 namespace gpu_coverage {
40 
41 class CameraPanorama;
42 
44 public:
45  PanoRenderer(const Scene * const scene, const bool renderToWindow, AbstractRenderer * const bellmanFordRenderer);
46  virtual ~PanoRenderer();
47  virtual void display();
48  inline const GLuint& getTexture() const {
49  return textures[PANO];
50  }
51  inline const GLuint& getCostmapIndexTexture() const {
52  return textures[COSTMAP_INDEX];
53  }
54  inline const int& getTextureWidth() const {
55  return panoWidth;
56  }
57  inline const int& getTextureHeight() const {
58  return panoHeight;
59  }
60  inline void setCamera(CameraPanorama * const camera) {
61  this->camera = camera;
62  }
63 
64 protected:
65  const bool renderToWindow;
66  const bool renderSemantic;
67  CameraPanorama * camera;
68  ProgramPano *progPano;
69  ProgramPanoSemantic *progPanoSemantic;
70  ProgramCostmapIndex *progCostmapIndex;
71  const int cubemapWidth, cubemapHeight;
72  int panoWidth, panoHeight;
73  GLuint framebuffer;
74  Config::PanoOutputValue panoOutputFormat;
75  bool renderToCubemap;
76 
77  AbstractProgramMapProjection *progMapProjection;
78  ProgramShowTexture progShowTexture;
79  GLuint mapProjectionVao;
80  GLuint mapProjectionVbo;
81  GLsizei mapProjectionCount;
82 
83  const bool debug;
84  GLuint depthCubeMap, colorCubeMap;
85 
86  GLuint vao;
87  GLuint vbo;
88  GLuint textures[2];
89 
90  enum TextureRole {
91  PANO,
92  COSTMAP_INDEX
93  };
94 
95  typedef std::list<Node *> TargetNodes;
96  TargetNodes targetNodes;
97  Node * projectionPlaneNode;
98  Node * floorNode;
99  AbstractRenderer * bellmanFordRenderer;
100 
101  bool link(const GLuint program, const char * const name) const;
102 
103 };
104 
105 } /* namespace gpu_coverage */
106 
107 #endif /* INCLUDE_ARTICULATION_PANORENDERER_H_ */
Definition: PanoRenderer.h:43
PanoOutputValue
Possible values for the panoOutputFormat parameter.
Definition: Config.h:54
Definition: Programs.h:477
Scene graph corresponding to Assimp&#39;s aiScene.
Definition: Scene.h:59
Scene graph node, corresponding to Assimp&#39;s aiNode.
Definition: Node.h:52
Definition: Programs.h:183
Definition: Programs.h:159
const Scene *const scene
Pointer to the scene to be rendered.
Definition: AbstractRenderer.h:101
virtual void display()
Renders the scene.
Abstract superclass for all renderers.
Definition: AbstractRenderer.h:45
Definition: AbstractCamera.h:41
const std::string name
Name of the renderer, see getName().
Definition: AbstractRenderer.h:102
const int & getTextureWidth() const
Width of the result texture.
Definition: PanoRenderer.h:54
Definition: Programs.h:378
const int & getTextureHeight() const
Height of the result texture.
Definition: PanoRenderer.h:57
Abstract superclass for all shader programs projecting panoramas to texture images.
Definition: Programs.h:223
Omnidirectional panorama camera.
Definition: CameraPanorama.h:44
const GLuint & getTexture() const
Returns the OpenGL texture ID of the result texture.
Definition: PanoRenderer.h:48