LibCarna Version 3.4.0
Loading...
Searching...
No Matches
FrameRenderer.hpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2010 - 2016 Leonid Kostrykin
3 *
4 * Chair of Medical Engineering (mediTEC)
5 * RWTH Aachen University
6 * Pauwelsstr. 20
7 * 52074 Aachen
8 * Germany
9 *
10 *
11 * Copyright (C) 2021 - 2025 Leonid Kostrykin
12 *
13 */
14
15#ifndef FRAMERENDERER_H_6014714286
16#define FRAMERENDERER_H_6014714286
17
18#include <LibCarna/LibCarna.hpp>
23#include <string>
24
30namespace LibCarna
31{
32
33namespace base
34{
35
36
37
38// ----------------------------------------------------------------------------------
39// FrameRenderer
40// ----------------------------------------------------------------------------------
41
72class LIBCARNA FrameRenderer : public RenderStageSequence
73{
74
76
77 struct Details;
78 const std::unique_ptr< Details > pimpl;
79
80public:
81
103 FrameRenderer( GLContext& glContext, unsigned int width, unsigned int height, bool fitSquare );
104
108 virtual ~FrameRenderer();
109
114
119 virtual void clearStages() override;
120
124 unsigned int width() const;
125
129 unsigned int height() const;
130
135 const Viewport& viewport() const;
136
141
157 void reshape( unsigned int width, unsigned int height, bool fitSquare );
158
163 void reshape( unsigned int width, unsigned int height );
164
170 void render( Camera& cam, Node& root ) const;
171
177 void render( Camera& cam ) const;
178
186 {
190 unsigned int unit;
191
200
209
217
226
232 RenderTextureParams( unsigned int unit );
233 };
234
245
250
251private:
252
253 void render( Camera& cam, Node& root, const Viewport& vp ) const;
254
255}; // FrameRenderer
256
257
258
259} // namespace LibCarna :: base
260
261} // namespace LibCarna
262
263#endif // FRAMERENDERER_H_6014714286
Defines LibCarna::base::Aggregation.
Contains forward-declarations.
Defines LibCarna::base::RenderStageSequence.
Represents an association.
Represents the point-of-view and defines the 3D to 2D projection.
Definition Camera.hpp:43
Defines logic for rendering frames from given scenes.
GLContext & glContext() const
Represents the OpenGL context that this renderer is associated with.
virtual ~FrameRenderer()
Deletes all stages contained by this renderer.
virtual void clearStages() override
Activates glContext and deletes all stages from the rendering stages sequence.
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.
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 renderTexture(const RenderTextureParams &params) const
Renders rectangle that covers the current viewport, according to params. Refer to RenderTextureParams...
void reshape(unsigned int width, unsigned int height, bool fitSquare)
Sets width, height and root viewport of future rendered frames.
const Viewport & viewport() const
Tells the root viewport that frames are currently rendered with. Value is changed through reshape.
const math::Statistics< double > & framesPerSecond() const
Tells the average of the reciprocal frame rendering time.
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...
void render(Camera &cam) const
Wraps and represents an OpenGL context.
Definition GLContext.hpp:66
Defines the inner node of a scene graph. Implements a spatial scene element that is allowed to have c...
Definition Node.hpp:48
Represents a rendering stages sequence.
Defines a rendering viewport. The viewport is a property of the current OpenGL context.
Definition Viewport.hpp:52
Defines LibCarna::base::math namespace and LIBCARNA_FOR_VECTOR3UI.
Eigen::Matrix< float, 4, 1 > Vector4f
Defines vector.
Definition math.hpp:199
Defines LibCarna::base::noncopyable and NON_COPYABLE.
#define NON_COPYABLE
Marks the class that it is placed in as non-copyable.
Specifies how renderTexture is to be performed.
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,...
bool useDefaultSampler
Holds whether a predefined sampler is to be bound to unit before drawing. This predefined sampler use...
RenderTextureParams(unsigned int unit)
Instantiates default configuration. This will simply reproduce the texture that is currently bound to...
std::string textureUniformName
Holds the name of the uniform variable defined by the shader that will be used, that will be linked w...
unsigned int unit
The texture unit that renderTexture will instruct the shader to use.
Holds mean and variance of an characteristic.
Definition math.hpp:654