gramods
Loading...
Searching...
No Matches
ViewBase.hh
1
2#ifndef GRAMODS_GRAPHICS_VIEWBASE
3#define GRAMODS_GRAPHICS_VIEWBASE
4
5#include <gmGraphics/config.hh>
6
7#include <gmGraphics/Node.hh>
8#include <gmGraphics/Camera.hh>
9#include <gmGraphics/Viewpoint.hh>
10
11#include <gmCore/OFactory.hh>
12
13#include <GL/glew.h>
14#include <GL/gl.h>
15
16BEGIN_NAMESPACE_GMGRAPHICS;
17
23 : public gmCore::Object {
24
25public:
26
30 struct ViewSettings {
31
32 ViewSettings() = delete;
33
34 ViewSettings(size_t frame_number)
35 : frame_number(frame_number) {}
36
38 ViewSettings(size_t frame_number, std::shared_ptr<Viewpoint> vp)
39 : frame_number(frame_number), viewpoints({vp}) {}
40
42 ViewSettings(size_t frame_number,
43 std::vector<std::shared_ptr<Viewpoint>> vps)
44 : frame_number(frame_number), viewpoints(vps) {}
45
49 void renderNodes(Camera camera);
50
55
57 Node::list nodes;
58
60 std::vector<std::shared_ptr<Viewpoint>> viewpoints;
61
63 GLenum pixel_format = GL_RGBA8;
64 };
65
72 virtual void renderFullPipeline(ViewSettings settings);
73
77 void addNode(std::shared_ptr<Node> node) {
78 nodes.push_back(node);
79 }
80
85 void setViewpoint(std::shared_ptr<Viewpoint> viewpoint) {
86 viewpoints = {viewpoint};
87 }
88
95 void addViewpoint(std::shared_ptr<Viewpoint> viewpoint) {
96 viewpoints.push_back(viewpoint);
97 }
98
104 void traverse(Visitor *visitor) override;
105
106 GM_OFI_DECLARE;
107
108protected:
113 void populateViewSettings(ViewSettings &settings);
114
115 Node::list nodes;
116 std::vector<std::shared_ptr<Viewpoint>> viewpoints;
117};
118
119END_NAMESPACE_GMGRAPHICS;
120
121#endif
Base type for objects in the Gramods package for standardized handling of construction,...
Definition Object.hh:42
The base of graphics Camera implementations.
Definition Camera.hh:19
The common base for nodes taking renderers for dispatching rendering jobs.
Definition ViewBase.hh:23
void setViewpoint(std::shared_ptr< Viewpoint > viewpoint)
Sets the viewpoint to use in the views rendered by this ViewBase.
Definition ViewBase.hh:85
void addViewpoint(std::shared_ptr< Viewpoint > viewpoint)
Adds a viewpoint to use in the views rendered by this ViewBase.
Definition ViewBase.hh:95
void addNode(std::shared_ptr< Node > node)
Adds a scenegraph to the view.
Definition ViewBase.hh:77
Package of settings affecting the rendering.
Definition ViewBase.hh:30
ViewSettings(size_t frame_number, std::vector< std::shared_ptr< Viewpoint > > vps)
Creates settings associated with the specified viewpoints.
Definition ViewBase.hh:42
size_t frame_number
The frame currently being rendered.
Definition ViewBase.hh:54
Node::list nodes
The renderers to render in the view.
Definition ViewBase.hh:57
std::vector< std::shared_ptr< Viewpoint > > viewpoints
The viewpoint currently being rendered.
Definition ViewBase.hh:60
ViewSettings(size_t frame_number, std::shared_ptr< Viewpoint > vp)
Creates settings associated with the specified viewpoint.
Definition ViewBase.hh:38