Robotran C Documentation
OglWorldRenderer.hh
Go to the documentation of this file.
1 
8 #ifndef _OGL_WORLD_RENDERER_HH_
9 #define _OGL_WORLD_RENDERER_HH_
10 
11 #include "MbsWorldRenderer.hh"
12 #include <glew.h>
13 
14 #include <string>
15 
17 
18 namespace OpenGLMbs{
19 
20 //forward declaration
21 class OglViewPointRenderer;
22 
27 {
28  public:
29 
31  OglWorldRenderer(MbsWorld3D *world_3d, int shader_flag);
32 
35  virtual void Init();
36 
40  virtual void Update(std::vector<MbsShape3D*> model_list);
41 
45 
46  virtual void AddViewPointRenderer(MbsViewPointRenderer* rdr);
47 
48 
49  // function prototype
50  virtual void AddDepthTexture(int new_depth_x_width, int new_depth_y_width);
51 
52  virtual void SetBackgroundColor(glm::vec3 const& col);
53 
55  int GetNbDepthTextures() const { return (int) depthTexture.size(); }
56 
58  GLuint GetDepthTexture(int i) const { return depthTexture[i]; }
59 
61  GLuint GetFrameBuffer(int i) const { return frameBuffer[i]; }
62 
64  int GetDepthXWidth(int i) const { return depth_x_width[i]; }
65 
67  int GetDepthYWidth(int i) const { return depth_y_width[i]; }
68 
70  std::vector<MbsViewPointRenderer*> vp_renderer_vec;
71 
72  protected:
73  std::string vertex_file;
74  std::string fragment_file;
75 
76  MbsWorld3D *world_3d;
77 
78  glm::vec3 background_color;
79 
80  bool is_init;
81 
83 
84 
85  private:
86  std::string main_vert_sh;
87  std::string main_frag_sh;
88 
89  // shadow mapping
90  std::vector<GLuint> frameBuffer;
91  std::vector<GLuint> depthTexture;
92 
93  std::vector<int> depth_x_width;
94  std::vector<int> depth_y_width;
95 
96  void SetShader();
97 
98 
99 
100 };
101 
102 } // close namespace
103 
104 #endif //_OGL_WORLD_RENDERER_HH_
OpenGLMbs::OglWorldRenderer::depth_x_width
std::vector< int > depth_x_width
X width of the shadow map depth textures (in pixels)
Definition: OglWorldRenderer.hh:93
OpenGLMbs::OglShapeRenderer
OglShapeRenderer class is an implementation of MbsShapeRenderer that render a MbsShape3D using Open G...
Definition: OglShapeRenderer.hh:76
OpenGLMbs::OglWorldRenderer::SetShader
void SetShader()
Definition: OglWorldRenderer.cc:147
OpenGLMbs::OglWorldRenderer::OglWorldRenderer
OglWorldRenderer(MbsWorld3D *world_3d, int shader_flag)
Constructor.
Definition: OglWorldRenderer.cc:31
OpenGLMbs
Definition: MpegFrameCaptureOptions.hh:6
OpenGLMbs::OglWorldRenderer
Implementation of MbsWorldRenderer class that render a MbsWorld3D using Open GL.
Definition: OglWorldRenderer.hh:26
OpenGLMbs::OglWorldRenderer::depth_y_width
std::vector< int > depth_y_width
X width of the shadow map depth textures (in pixels)
Definition: OglWorldRenderer.hh:94
MbsWorld3D.hh
MbsWorld3D class.
OglViewPointRenderer.hh
OglViewPointRenderer class.
OpenGLMbs::OglWorldRenderer::fragment_file
std::string fragment_file
Definition: OglWorldRenderer.hh:74
OpenGLMbs::OglWorldRenderer::vp_renderer_vec
std::vector< MbsViewPointRenderer * > vp_renderer_vec
Viewpoint renderer vector: contain all the view point renderers.
Definition: OglWorldRenderer.hh:70
OpenGLMbs::OglWorldRenderer::vertex_file
std::string vertex_file
Definition: OglWorldRenderer.hh:73
OpenGLMbs::OglWorldRenderer::AddDepthTexture
virtual void AddDepthTexture(int new_depth_x_width, int new_depth_y_width)
add a depth texture
Definition: OglWorldRenderer.cc:198
OpenGLMbs::MbsViewPointRenderer
abstract class for specifying code to render the 3D scene to an image from a specific viepoint.
Definition: MbsViewPointRenderer.hh:17
OpenGLMbs::OglWorldRenderer::Update
virtual void Update(std::vector< MbsShape3D * > model_list)
Execute the necessary code to render this world: Update the append filter and output the vtu file for...
Definition: OglWorldRenderer.cc:88
OpenGLMbs::OglWorldRenderer::main_vert_sh
std::string main_vert_sh
main vertex shader path
Definition: OglWorldRenderer.hh:86
OpenGLMbs::OglWorldRenderer::SetBackgroundColor
virtual void SetBackgroundColor(glm::vec3 const &col)
Set the backgroun of the Open GL view to the specified color.
Definition: OglWorldRenderer.cc:184
OpenGLMbs::OglWorldRenderer::Init
virtual void Init()
Execute the necessary code to initialize the renderer Here: initialize Open GL context.
Definition: OglWorldRenderer.cc:48
OpenGLMbs::OglWorldRenderer::world_3d
MbsWorld3D * world_3d
3D world
Definition: OglWorldRenderer.hh:76
MbsWorldRenderer.hh
MbsWorldRenderer class.
OglOffscreenVpRenderer.hh
OglOffscreenVpRenderer class.
OglWorldRenderer.hh
OglShapeRenderer class and utilities.
OpenGLMbs::MbsShapeRenderer
MbsShapeRenderer is an abstract class that defines the property need to render a MbsShape3D....
Definition: MbsShapeRenderer.hh:29
OpenGLMbs::MbsWorldRenderer
MbsWorldRenderer class defines the general properties of an object that renders a MbsWorld3D....
Definition: MbsWorldRenderer.hh:31
OpenGLMbs::OglWorldRenderer::shader_flag
int shader_flag
flag for shaders
Definition: OglWorldRenderer.hh:82
OpenGLMbs::OglViewPointRenderer
implementation of a MbsViewPointRenderer using OpenGL to render directly to the screen
Definition: OglViewPointRenderer.hh:24
OpenGLMbs::OglWorldRenderer::GetDepthXWidth
int GetDepthXWidth(int i) const
get the depth texture width along the X axis (in pixels)
Definition: OglWorldRenderer.hh:64
OpenGLMbs::OglWorldRenderer::GetDepthTexture
GLuint GetDepthTexture(int i) const
get a depth texture
Definition: OglWorldRenderer.hh:58
OpenGLMbs::OglWorldRenderer::GetFrameBuffer
GLuint GetFrameBuffer(int i) const
get a frame buffer
Definition: OglWorldRenderer.hh:61
OpenGLMbs::OglWorldRenderer::main_frag_sh
std::string main_frag_sh
main fragment shader path
Definition: OglWorldRenderer.hh:87
OpenGLMbs::OglWorldRenderer::is_init
bool is_init
Definition: OglWorldRenderer.hh:80
OpenGLMbs::OglWorldRenderer::background_color
glm::vec3 background_color
Definition: OglWorldRenderer.hh:78
OpenGLMbs::OglWorldRenderer::AddViewPointRenderer
virtual void AddViewPointRenderer(MbsViewPointRenderer *rdr)
Definition: OglWorldRenderer.cc:130
OpenGLMbs::OglWorldRenderer::GetDepthYWidth
int GetDepthYWidth(int i) const
get the depth texture width along the Y axis (in pixels)
Definition: OglWorldRenderer.hh:67
OpenGLMbs::OglWorldRenderer::GetNbDepthTextures
int GetNbDepthTextures() const
get the number of depth textures
Definition: OglWorldRenderer.hh:55
OpenGLMbs::OglWorldRenderer::getNewShapeRenderer
virtual MbsShapeRenderer * getNewShapeRenderer()
Create and return a new renderer for shape (similar to a factory production method)
Definition: OglWorldRenderer.cc:140
OpenGLMbs::OglWorldRenderer::depthTexture
std::vector< GLuint > depthTexture
depth textures
Definition: OglWorldRenderer.hh:91
OglShapeRenderer.hh
OpenGLMbs::OglWorldRenderer::frameBuffer
std::vector< GLuint > frameBuffer
frame buffer
Definition: OglWorldRenderer.hh:90