Debian Codegraph @

include/BALL/VIEW/RENDERING/RENDERERS/tilingRenderer.h

raw symbols SCIP
1 // -*- Mode: C++; tab-width: 2; -*-
2 // vi: set ts=2:
3 //
4
5 #ifndef BALL_VIEW_RENDERING_TILINGRENDERER_H
6 #define BALL_VIEW_RENDERING_TILINGRENDERER_H
7
8 #ifndef BALL_VIEW_RENDERING_RENDERERS_RENDERER_H
9 # include <BALL/VIEW/RENDERING/RENDERERS/renderer.h>
10 #endif
11
12 #ifndef BALL_VIEW_RENDERING_RENDERTARGET_H
13 # include <BALL/VIEW/RENDERING/renderTarget.h>
14 #endif
15
16 namespace BALL
17 {
18 namespace VIEW
19 {
20 /** Offscreen rendering with arbitrary resolution.
21 This class encapsulates a renderer object which it uses to render a
22 number of individual tiles to compose them into a full image. This can
23 be used to render very large images into files.
24
25 The idea behind this renderer is heavily based on the extremely useful
26 open-source TR library for tile rendering by Brian Paul
27 (http://www.mesa3d.org/brianp/TR.html).
28
29 \ingroup ViewRendering
30 */
31 class BALL_VIEW_EXPORT TilingRenderer
32 : public Renderer
33 {
34 public:
35
36 /** @name Constructors and Destructors
37 */
38 //@{
39
40 /** Detailed Constructor.
41 *
42 * @param real_renderer the renderer to encapsulate
43 * @param final_width the width of the generated image
44 * @param final_height the height of the generated image
45 * @param border an optional border around each tile
46 *
47 */
48 TilingRenderer(Renderer* real_renderer, Size final_width, Size final_height, Size border = 0);
49
50 /** Copy constructor.
51 */
52 TilingRenderer(const TilingRenderer& renderer);
53
54 /** Destructor
55 */
56 virtual ~TilingRenderer() {}
57
58 /// Set the light sources according to the stage
59 virtual void setLights(bool reset_all = false);
60
61 /** Update the camera position either from a given Camera, or from the default Stage.
62 */
63 virtual void updateCamera(const Camera* camera = 0);
64
65 /// Update the background color from the stage
66 virtual void updateBackgroundColor();
67
68 ///
69 virtual bool finish();
70
71 /** Compute the 3D position on the view plane corresponding
72 * to point (x,y) on the view port
73 */
74 virtual Vector3 mapViewportTo3D(Position x, Position y);
75
76 /** Compute the 2D position on the screen corresponding
77 * to the 3D point vec
78 */
79 virtual Vector2 map3DToViewport(const Vector3& vec);
80
81 //@}
82 /** @name Accessors
83 */
84 //@{
85
86 /** Render a Representation.
87 */
88 virtual bool renderOneRepresentation(const Representation& representation);
89
90 /** Buffer a Representation for later rendering.
91 */
92 virtual void bufferRepresentation(const Representation& rep);
93
94 /** Remove a representation from the buffer.
95 */
96 virtual void removeRepresentation(const Representation& rep);
97
98 /// Set the size of the display
99 virtual void setSize(float width, float height);
100
101 /** Render a ruler.
102 *
103 * If supported by the renderer implementation, this function will produce
104 * a simple ruler that is rendered together with the other representations.
105 * The main use of this function is in the edit mode, where it can help to
106 * straighten-up structures and to correctly estimate angles and distances.
107 */
108 virtual void renderRuler();
109
110 //@}
111 /** @name Predicates
112 */
113 //@{
114
115 ///
116 virtual void renderToBuffer(RenderTarget* target);
117
118 /// Wrapper for the renderering of special GeometricObjects
119 virtual void render_(const GeometricObject* object);
120
121 protected:
122 void computeTilingSetup_();
123
124 /// The renderer used for rendering the individual tiles
125 Renderer* real_renderer_;
126
127 /// The desired width of the final image
128 Size final_width_;
129
130 /// The desired height of the final image
131 Size final_height_;
132
133 /// The border oversampled for each tile
134 Size border_;
135
136 Size num_cols_;
137 Size num_rows_;
138 };
139 }
140 }
141 #endif // BALL_VIEW_RENDERING_TILINGRENDERER_H
142