Debian Codegraph @

avogadro/rendering/solidpipeline.h

raw
1 /******************************************************************************
2 This source file is part of the Avogadro project.
3 This source code is released under the 3-Clause BSD License, (see "LICENSE").
4 ******************************************************************************/
5
6 #ifndef AVOGADRO_RENDERING_SOLIDPIPELINE_H
7 #define AVOGADRO_RENDERING_SOLIDPIPELINE_H
8
9 #include "camera.h"
10
11 namespace Avogadro {
12 namespace Rendering {
13
14 class SolidPipeline
15 {
16 public:
17 SolidPipeline();
18 ~SolidPipeline();
19
20 /**
21 * @brief Probably don't want to support copy/assignment.
22 */
23 SolidPipeline(const SolidPipeline&) = delete;
24 SolidPipeline& operator=(const SolidPipeline&) = delete;
25
26 /**
27 * @brief Initialize OpenGL objects.
28 */
29 void initialize();
30
31 /**
32 * @brief Begin solid geometry rendering.
33 */
34 void begin();
35
36 void adjustOffset(const Camera& camera);
37 /**
38 * @brief End solid geometry rendering and apply screen-space shaders.
39 */
40 void end();
41
42 /**
43 * @brief Resize buffers for width x height viewport.
44 */
45 void resize(int width, int height);
46
47 /**
48 * @brief Set pixel ratio (1.0 on standard displays, 2.0 on Retina, etc.).
49 */
50 void setPixelRatio(float ratio);
51
52 /**
53 * @brief Get or set whether Ambient Occlusion is enabled.
54 */
55 bool getAoEnabled() { return m_aoEnabled; }
56 void setAoEnabled(bool enabled) { m_aoEnabled = enabled; }
57
58 /**
59 * @brief Get or set whether Depth-of-feild is enabled.
60 */
61 bool getDofEnabled() { return m_dofEnabled; }
62 void setDofEnabled(bool enabled) { m_dofEnabled = enabled; }
63
64 /**
65 * @brief Get or set whether Fog is enabled.
66 */
67 bool getFogEnabled() { return m_fogEnabled; }
68 void setFogEnabled(bool enabled) { m_fogEnabled = enabled; }
69
70 /**
71 * @brief Set Background Color to it's current value.
72 */
73 Vector4ub backgroundColor() const { return m_backgroundColor; }
74 void setBackgroundColor(const Vector4ub& c) { m_backgroundColor = c; }
75
76 /**
77 * @brief Get or set shadow strength for Ambient Occlusion.
78 */
79 float getAoStrength() { return m_aoStrength; }
80 void setAoStrength(float strength) { m_aoStrength = strength; }
81
82 /**
83 * @brief Get or set fog strength.
84 */
85 float getFogStrength() { return m_fogStrength; }
86 void setFogStrength(float strength) { m_fogStrength = strength; }
87
88 /**
89 * @brief Get or set fog position
90 */
91 float getFogPosition() { return m_fogPosition; }
92 void setFogPosition(float position) { m_fogPosition = position; }
93
94 /**
95 * @brief Get or set whether Edge Detection is enabled.
96 */
97 bool getEdEnabled() { return m_edEnabled; }
98 void setEdEnabled(bool enabled)
99 {
100 m_edEnabled = enabled;
101 m_edStrength = (m_edEnabled) ? 1.0 : 0.0;
102 }
103
104 /**
105 * @brief Get or set dof strength.
106 */
107 float getDofStrength() { return m_dofStrength; }
108 void setDofStrength(float strength) { m_dofStrength = strength; }
109
110 /**
111 * @brief Set positon of dof
112 */
113 float getDofPosition() { return m_dofPosition; }
114 void setDofPosition(float position) { m_dofPosition = position; }
115
116 /**
117 * @brief Get or set the strength of the edge effect
118 */
119 bool getEdStrength() { return m_edStrength; }
120 void setEdStrength(float strength) { m_edStrength = strength; }
121
122 private:
123 float m_pixelRatio;
124 bool m_aoEnabled;
125 float m_dofStrength;
126 float m_dofPosition;
127 bool m_dofEnabled;
128 float m_fogPosition;
129 Vector4ub m_backgroundColor;
130 Eigen::Affine3f modelView;
131 bool m_fogEnabled;
132 float m_aoStrength;
133 float m_fogStrength;
134 bool m_edEnabled;
135 float m_edStrength;
136 int m_width;
137 int m_height;
138
139 class Private;
140 Private* d;
141 };
142
143 } // End namespace Rendering
144 } // End namespace Avogadro
145
146 #endif