libVFRendering  0.14.0

A vector field rendering library
RendererBase.hxx
1 #ifndef VFRENDERING_RENDERER_BASE_HXX
2 #define VFRENDERING_RENDERER_BASE_HXX
3 
4 #include <vector>
5 
6 #include <glm/glm.hpp>
7 
8 #include <VFRendering/View.hxx>
9 #include <VFRendering/Options.hxx>
10 
11 namespace VFRendering {
12 class RendererBase {
13 public:
14 
15  RendererBase(const View& view);
16 
17  virtual ~RendererBase() {};
18  virtual void update(bool keep_geometry) = 0;
19  virtual void draw(float aspect_ratio) = 0;
20  virtual void updateOptions(const Options& options);
21  template<int index>
22  void setOption(const typename Options::Type<index>::type& value);
23  const Options& options() const;
24  template<int index>
25  typename Options::Type<index>::type getOption() const;
26  virtual void optionsHaveChanged(const std::vector<int>& changed_options);
27  virtual void updateIfNecessary();
28 
29 protected:
30  virtual void options(const Options& options);
31  const View& m_view;
32 private:
33  Options m_options;
34 };
35 
36 template<int index>
37 void RendererBase::setOption(const typename Options::Type<index>::type& value) {
38  updateOptions(Options::withOption<index>(value));
39 }
40 
41 template<int index>
42 typename Options::Type<index>::type RendererBase::getOption() const {
43  return m_options.get<index>();;
44 }
45 
46 }
47 
48 #endif
VFRendering::RendererBase
Definition: RendererBase.hxx:12
VFRendering::Utilities::Options
Definition: Options.hxx:12
VFRendering::Utilities::Options::Type
Definition: Options.hxx:20
VFRendering::View
Definition: View.hxx:23