i6engine  1.0
GraphicsFacade.h
Go to the documentation of this file.
1 /*
2  * i6engine
3  * Copyright (2016) Daniel Bonrath, Michael Baer, All rights reserved.
4  *
5  * This file is part of i6engine; i6engine is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19 
25 #ifndef __I6ENGINE_API_GRAPHICSFACADE_H__
26 #define __I6ENGINE_API_GRAPHICSFACADE_H__
27 
28 #include <mutex>
29 
31 
33 
34 #include "boost/function.hpp"
35 
36 namespace i6e {
37 namespace api {
38 
40  public:
42 
43  ~GraphicsFacade();
44 
48  void closeViewports();
49 
53  void setAmbientLight(double r, double g, double b);
54 
58  void setSkyBox(const std::string & material, double distance = 5000.0, bool renderFirst = true);
59  void setSkyDome(const std::string & material, int32_t curvature = 10, double tiles = 8.0, double distance = 4000.0, bool renderFirst = true);
60  void setSkyPlane(const std::string & material, double distance, int32_t direction, int32_t size = 1000, double tiles = 10.0, bool renderFirst = true, double curvature = 0.0, int32_t xSegments = 1, int32_t ySegments = 1);
61 
62  void removeSkyBox();
63  void removeSkyDome();
64  void removeSkyPlane();
65 
69  void setResolution(const graphics::Resolution & resolution);
70 
74  void setFullscreen(bool fullscreen);
75 
79  void setShadowTechnique(graphics::ShadowTechnique st);
80 
84  void registerNotifyCallback(const boost::function<void(int64_t)> & f);
85 
89  void notifyNewID(int64_t id);
90 
94  void resetSubSystem();
95 
99  void setPossibleResolutions(const std::vector<graphics::Resolution> & resolutions) {
100  _resolutions = resolutions;
101  }
102 
106  std::vector<graphics::Resolution> getPossibleResolutions() const {
107  return _resolutions;
108  }
109 
114  return _currentResolution;
115  }
116 
120  void setSelectables(const std::vector<std::pair<int64_t, Vec3>> selectables) {
121  std::lock_guard<std::mutex> lg(_selectablesLock);
122  _selectables = selectables;
123  }
124 
128  std::vector<std::pair<int64_t, Vec3>> getSelectables() const {
129  std::lock_guard<std::mutex> lg(_selectablesLock);
130  return _selectables;
131  }
132 
139  void setLinearFog(const Vec3 & colour, double start, double end) const;
140 
146  void setExponentialFog(const Vec3 & colour, double density) const;
147 
153  void setExponentialFog2(const Vec3 & colour, double density) const;
154 
160  void takeScreenshot(const std::string & prefix, const std::string & suffix) const;
161 
171  void showFPS(double x, double y, const std::string & imageStyle, const std::string & printStyle, const std::string & imageset, const std::string & image) const;
172 
176  void hideFPS() const;
177 
181  void getHighestCoordinate(const Vec3 & startPos, const std::function<void(Vec3)> & callback) const;
182 
183  private:
184  boost::function<void(int64_t)> _notify;
185 
186  bool _notifyInit;
187 
188  std::vector<graphics::Resolution> _resolutions;
189 
190  graphics::Resolution _currentResolution;
191 
192  mutable std::mutex _selectablesLock;
193  std::vector<std::pair<int64_t, Vec3>> _selectables;
194 
198  GraphicsFacade(const GraphicsFacade &) = delete;
199 
203  const GraphicsFacade & operator=(const GraphicsFacade &) = delete;
204  };
205 
206 } /* namespace api */
207 } /* namespace i6e */
208 
209 #endif /* __I6ENGINE_API_GRAPHICSFACADE_H__ */
210 
void setPossibleResolutions(const std::vector< graphics::Resolution > &resolutions)
sets possible resolutions, called by graphics subsystem
#define ISIXE_MODULES_API
graphics::Resolution getCurrentResolution() const
returns current resolution
Implements 3-dimensional vectors.
Definition: i6eVector.h:48
std::vector< graphics::Resolution > getPossibleResolutions() const
returns all resolutions the graphics subsystem can show
void setSelectables(const std::vector< std::pair< int64_t, Vec3 >> selectables)
sets the selectables, only used by graphics
std::vector< std::pair< int64_t, Vec3 > > getSelectables() const
returns the selectables