Carna  Version 3.3.2
FrameRenderer.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2010 - 2015 Leonid Kostrykin
3  *
4  * Chair of Medical Engineering (mediTEC)
5  * RWTH Aachen University
6  * Pauwelsstr. 20
7  * 52074 Aachen
8  * Germany
9  *
10  */
11 
12 #ifndef FRAMERENDERER_H_6014714286
13 #define FRAMERENDERER_H_6014714286
14 
15 #include <Carna/Carna.h>
17 #include <Carna/base/Aggregation.h>
18 #include <Carna/base/noncopyable.h>
19 #include <Carna/base/math.h>
20 #include <string>
21 
26 namespace Carna
27 {
28 
29 namespace base
30 {
31 
32 
33 
34 // ----------------------------------------------------------------------------------
35 // FrameRenderer
36 // ----------------------------------------------------------------------------------
37 
69 class CARNA_LIB FrameRenderer : public RenderStageSequence
70 {
71 
73 
74  struct Details;
75  const std::unique_ptr< Details > pimpl;
76 
77 public:
78 
100  FrameRenderer( GLContext& glContext, unsigned int width, unsigned int height, bool fitSquare );
101 
105  virtual ~FrameRenderer();
106 
110  GLContext& glContext() const;
111 
116  virtual void clearStages() override;
117 
121  unsigned int width() const;
122 
126  unsigned int height() const;
127 
132  const Viewport& viewport() const;
133 
137  void setBackgroundColor( const math::Vector4f& );
138 
154  void reshape( unsigned int width, unsigned int height, bool fitSquare );
155 
160  void reshape( unsigned int width, unsigned int height );
161 
167  void render( Camera& cam, Node& root ) const;
168 
174  void render( Camera& cam ) const;
175 
183  {
187  unsigned int unit;
188 
197 
206 
213  std::string textureUniformName;
214 
222  float alphaFactor;
223 
229  RenderTextureParams( unsigned int unit );
230  };
231 
241  void renderTexture( const RenderTextureParams& params ) const;
242 
246  const math::Statistics< double >& framesPerSecond() const;
247 
248 private:
249 
250  void render( Camera& cam, Node& root, const Viewport& vp ) const;
251 
252 }; // FrameRenderer
253 
254 
255 
256 } // namespace Carna :: base
257 
258 } // namespace Carna
259 
260 #endif // FRAMERENDERER_H_6014714286
Defines Carna::base::math namespace and CARNA_FOR_VECTOR3UI.
Holds mean and variance of an characteristic.
Definition: math.h:655
std::string textureUniformName
Holds the name of the uniform variable defined by the shader that will be used, that will be linked w...
Eigen::Matrix< float, 4, 1 > Vector4f
Defines vector.
Definition: math.h:195
Defines logic for rendering frames from given scenes.
Definition: FrameRenderer.h:69
Defines the inner node of a scene graph. Implements a spatial scene element that is allowed to have c...
Definition: Node.h:44
Defines Carna::base::Aggregation.
Defines a rendering viewport. The viewport is a property of the current OpenGL context.
Definition: Viewport.h:48
Defines Carna::base::RenderStageSequence.
bool useDefaultSampler
Holds whether a predefined sampler is to be bound to unit before drawing. This predefined sampler use...
Represents the point-of-view and defines the 3D to 2D projection.
Definition: Camera.h:39
Specifies how renderTexture is to be performed.
Wraps and represents an OpenGL context.
Definition: GLContext.h:62
unsigned int unit
The texture unit that renderTexture will instruct the shader to use.
#define NON_COPYABLE
Features class it is placed in as non-copyable.
Definition: noncopyable.h:109
float alphaFactor
If useDefaultShader is true, the alpha values sampled from the texture bound to the specified texture...
bool useDefaultShader
The currently set shader will be used for drawing if this is false. If the value is true...
Represents a rendering stages sequence.