LibCarna Version 3.4.0
Loading...
Searching...
No Matches
Viewport.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 VIEWPORT_H_6014714286
16#define VIEWPORT_H_6014714286
17
18#include <LibCarna/LibCarna.hpp>
20
26namespace LibCarna
27{
28
29namespace base
30{
31
32
33
34// ----------------------------------------------------------------------------------
35// Viewport
36// ----------------------------------------------------------------------------------
37
51class LIBCARNA Viewport
52{
53
55
56 struct Details;
57 const std::unique_ptr< Details > pimpl;
58
59public:
60
64 Viewport( unsigned int rootWidth, unsigned int rootHeight, bool fitSquare );
65
68 explicit Viewport( const Framebuffer& );
69
73 Viewport( const Viewport& parent, unsigned int left, unsigned int top, unsigned int width, unsigned int height );
74
79
84 void makeActive() const;
85
89 bool isActive() const;
90
96 void done() const;
97
98 void setWidth ( unsigned int );
99 void setHeight( unsigned int );
100
101 void setMarginLeft( unsigned int );
102 void setMarginTop ( unsigned int );
103
104 unsigned int width() const;
105 unsigned int height() const;
106
107 unsigned int parentWidth () const;
108 unsigned int parentHeight() const;
109
110 unsigned int marginLeft () const;
111 unsigned int marginTop () const;
112 unsigned int marginRight () const;
113 unsigned int marginBottom() const;
114
115}; // Viewport
116
117
118
119} // namespace LibCarna :: base
120
121} // namespace LibCarna
122
123#endif // VIEWPORT_H_6014714286
Contains forward-declarations.
Represents an association.
Maintains a framebuffer object that supports up to 8 color components simultaneously.
Defines a rendering viewport. The viewport is a property of the current OpenGL context.
Definition Viewport.hpp:52
unsigned int parentWidth() const
Tells parent viewport's width.
unsigned int marginRight() const
Tells viewport's right margin.
Viewport(const Viewport &parent, unsigned int left, unsigned int top, unsigned int width, unsigned int height)
Derives viewport from parent.
unsigned int parentHeight() const
Tells parent viewport's height.
void done() const
Restores the previous viewport.
bool isActive() const
Tells whether this viewport is currently active.
void setHeight(unsigned int)
Sets viewport height.
void setMarginLeft(unsigned int)
Sets viewport left margin.
void makeActive() const
Makes this viewport the active one of the current OpenGL context.
unsigned int marginTop() const
Tells viewport's top margin.
void setWidth(unsigned int)
Sets viewport width.
Viewport(unsigned int rootWidth, unsigned int rootHeight, bool fitSquare)
Creates root viewport.
unsigned int height() const
Tells viewport height.
unsigned int marginLeft() const
Tells viewport's left margin.
Viewport(const Framebuffer &)
~Viewport()
Restores the parent viewport if this viewport is still active.
unsigned int marginBottom() const
Tells viewport's bottom margin.
unsigned int width() const
Tells viewport width.
void setMarginTop(unsigned int)
Sets viewport top margin.
Defines LibCarna::base::noncopyable and NON_COPYABLE.
#define NON_COPYABLE
Marks the class that it is placed in as non-copyable.