1 /*
2  Copyright (C) 2010-2014 Kristian Duske
3 
4  This file is part of TrenchBroom.
5 
6  TrenchBroom is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  TrenchBroom is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with TrenchBroom. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef TrenchBroom_RenderContext
21 #define TrenchBroom_RenderContext
22 
23 #include "Renderer/Transformation.h"
24 #include "Renderer/RenderBatch.h"
25 
26 namespace TrenchBroom {
27     namespace View {
28         class MapViewConfig;
29     }
30 
31     namespace Renderer {
32         class Camera;
33         class FontManager;
34         class Renderable;
35         class ShaderManager;
36 
37         class RenderContext {
38         public:
39             typedef enum {
40                 RenderMode_3D,
41                 RenderMode_2D
42             } RenderMode;
43         private:
44             typedef enum {
45                 ShowSelectionGuide_Show,
46                 ShowSelectionGuide_Hide,
47                 ShowSelectionGuide_ForceShow,
48                 ShowSelectionGuide_ForceHide
49             } ShowSelectionGuide;
50 
51             // general context for any rendering view
52             RenderMode m_renderMode;
53             const Camera& m_camera;
54             Transformation m_transformation;
55             FontManager& m_fontManager;
56             ShaderManager& m_shaderManager;
57 
58             // settings for any map rendering view
59             bool m_showTextures;
60             bool m_showFaces;
61             bool m_showEdges;
62             bool m_shadeFaces;
63 
64             bool m_showPointEntities;
65             bool m_showPointEntityModels;
66             bool m_showEntityClassnames;
67             bool m_showEntityBounds;
68 
69             bool m_showFog;
70 
71             bool m_showGrid;
72             size_t m_gridSize;
73 
74             bool m_hideSelection;
75             bool m_tintSelection;
76 
77             ShowSelectionGuide m_showSelectionGuide;
78         public:
79             RenderContext(RenderMode renderMode, const Camera& camera, FontManager& fontManager, ShaderManager& shaderManager);
80 
81             bool render2D() const;
82             bool render3D() const;
83 
84             const Camera& camera() const;
85             Transformation& transformation();
86             FontManager& fontManager();
87             ShaderManager& shaderManager();
88 
89             bool showTextures() const;
90             void setShowTextures(bool showTextures);
91 
92             bool showFaces() const;
93             void setShowFaces(bool showFaces);
94 
95             bool showEdges() const;
96             void setShowEdges(bool showEdges);
97 
98             bool shadeFaces() const;
99             void setShadeFaces(bool shadeFaces);
100 
101             bool showPointEntities() const;
102             void setShowPointEntities(bool showPointEntities);
103 
104             bool showPointEntityModels() const;
105             void setShowPointEntityModels(bool showPointEntityModels);
106 
107             bool showEntityClassnames() const;
108             void setShowEntityClassnames(bool showEntityClassnames);
109 
110             bool showEntityBounds() const;
111             void setShowEntityBounds(bool showEntityBounds);
112 
113             bool showFog() const;
114             void setShowFog(bool showFog);
115 
116             bool showGrid() const;
117             void setShowGrid(bool showGrid);
118 
119             size_t gridSize() const;
120             void setGridSize(size_t gridSize);
121 
122             bool hideSelection() const;
123             void setHideSelection();
124 
125             bool tintSelection() const;
126             void clearTintSelection();
127 
128             bool showSelectionGuide() const;
129             void setShowSelectionGuide();
130             void setHideSelectionGuide();
131             void setForceShowSelectionGuide();
132             void setForceHideSelectionGuide();
133         private:
134             void setShowSelectionGuide(ShowSelectionGuide showSelectionGuide);
135         };
136     }
137 }
138 
139 #endif /* defined(TrenchBroom_RenderContext) */
140