Carna Version 3.3.3
Loading...
Searching...
No Matches
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>
19#include <Carna/base/math.h>
20#include <string>
21
26namespace Carna
27{
28
29namespace base
30{
31
32
33
34// ----------------------------------------------------------------------------------
35// FrameRenderer
36// ----------------------------------------------------------------------------------
37
69class CARNA_LIB FrameRenderer : public RenderStageSequence
70{
71
73
74 struct Details;
75 const std::unique_ptr< Details > pimpl;
76
77public:
78
100 FrameRenderer( GLContext& glContext, unsigned int width, unsigned int height, bool fitSquare );
101
105 virtual ~FrameRenderer();
106
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
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
214
223
229 RenderTextureParams( unsigned int unit );
230 };
231
242
247
248private:
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::Aggregation.
Defines Carna::base::RenderStageSequence.
Represents an association.
Definition Association.h:45
Represents the point-of-view and defines the 3D to 2D projection.
Definition Camera.h:40
Defines logic for rendering frames from given scenes.
virtual void clearStages() override
Activates glContext and deletes all stages from the rendering stages sequence.
void renderTexture(const RenderTextureParams &params) const
Renders rectangle that covers the current viewport, according to params. Refer to RenderTextureParams...
const math::Statistics< double > & framesPerSecond() const
Tells the average of the reciprocal frame rendering time.
unsigned int height() const
Tells the current frame height. Value is changed through reshape.
unsigned int width() const
Tells the current frame width. Value is changed through reshape.
void setBackgroundColor(const math::Vector4f &)
Sets frame background color. Default value is Color::BLACK_NO_ALPHA.
void render(Camera &cam, Node &root) const
Renders scene root from cam point of view to the currently bound framebuffer by issuing the rendering...
virtual ~FrameRenderer()
Deletes all stages contained by this renderer.
const Viewport & viewport() const
Tells the root viewport that frames are currently rendered with. Value is changed through reshape.
FrameRenderer(GLContext &glContext, unsigned int width, unsigned int height, bool fitSquare)
Instantiates with empty rendering stages sequence.
void reshape(unsigned int width, unsigned int height)
void reshape(unsigned int width, unsigned int height, bool fitSquare)
Sets width, height and root viewport of future rendered frames.
void render(Camera &cam) const
GLContext & glContext() const
Represents the OpenGL context that this renderer is associated with.
Wraps and represents an OpenGL context.
Definition GLContext.h:63
Defines the inner node of a scene graph. Implements a spatial scene element that is allowed to have c...
Definition Node.h:45
Represents a rendering stages sequence.
Defines a rendering viewport. The viewport is a property of the current OpenGL context.
Definition Viewport.h:49
Defines Carna::base::math namespace and CARNA_FOR_VECTOR3UI.
Eigen::Matrix< float, 4, 1 > Vector4f
Defines vector.
Definition math.h:195
#define NON_COPYABLE
Features class it is placed in as non-copyable.
Specifies how renderTexture is to be performed.
unsigned int unit
The texture unit that renderTexture will instruct the shader to use.
bool useDefaultShader
The currently set shader will be used for drawing if this is false. If the value is true,...
std::string textureUniformName
Holds the name of the uniform variable defined by the shader that will be used, that will be linked w...
float alphaFactor
If useDefaultShader is true, the alpha values sampled from the texture bound to the specified texture...
RenderTextureParams(unsigned int unit)
Instantiates default configuration. This will simply reproduce the texture that is currently bound to...
bool useDefaultSampler
Holds whether a predefined sampler is to be bound to unit before drawing. This predefined sampler use...
Holds mean and variance of an characteristic.
Definition math.h:656