1 #ifndef VFRENDERING_VIEW_HXX
2 #define VFRENDERING_VIEW_HXX
9 #include <VFRendering/Options.hxx>
10 #include <VFRendering/FPSCounter.hxx>
11 #include <VFRendering/Utilities.hxx>
12 #include <VFRendering/Geometry.hxx>
14 namespace VFRendering {
17 enum class CameraMovementModes {
27 VERTICAL_FIELD_OF_VIEW,
29 COLORMAP_IMPLEMENTATION,
30 IS_VISIBLE_IMPLEMENTATION,
41 void mouseMove(
const glm::vec2& position_before,
const glm::vec2& position_after, CameraMovementModes mode);
42 void mouseScroll(
const float& wheel_delta);
43 void setFramebufferSize(
float width,
float height);
44 float getFramerate()
const;
45 glm::vec2 getFramebufferSize()
const;
47 void updateOptions(
const Options& options);
50 void options(
const Options& options);
55 void renderers(
const std::vector<std::pair<std::shared_ptr<RendererBase>, std::array<float, 4>>>& renderers,
bool update_renderer_options=
true);
58 void setCamera(glm::vec3 camera_position, glm::vec3 center_position, glm::vec3 up_vector);
59 void optionsHaveChanged(
const std::vector<int>& changed_options);
62 bool m_is_initialized =
false;
63 std::vector<std::pair<std::shared_ptr<RendererBase>, std::array<float, 4>>> m_renderers;
65 glm::vec2 m_framebuffer_size;
66 bool m_is_centered =
false;
73 updateOptions(Options::withOption<index>(value));
77 typename Options::Type<index>::type View::getOption()
const {
78 return m_options.get<index>();
84 struct Options::Option<
View::Option::SYSTEM_CENTER> {
85 glm::vec3 default_value = {0, 0, 0};
90 struct Options::Option<
View::Option::VERTICAL_FIELD_OF_VIEW> {
91 float default_value = 45.0;
96 struct Options::Option<
View::Option::BACKGROUND_COLOR> {
97 glm::vec3 default_value = {0, 0, 0};
102 struct Options::Option<
View::Option::COLORMAP_IMPLEMENTATION> {
103 std::string default_value = Utilities::getColormapImplementation(VFRendering::Utilities::Colormap::DEFAULT);
108 struct Options::Option<
View::Option::IS_VISIBLE_IMPLEMENTATION> {
109 std::string default_value =
"bool is_visible(vec3 position, vec3 direction) { return true; }";
114 struct Options::Option<
View::Option::CAMERA_POSITION> {
115 glm::vec3 default_value = {14.5, 14.5, 30};
120 struct Options::Option<
View::Option::CENTER_POSITION> {
121 glm::vec3 default_value = {14.5, 14.5, 0};
126 struct Options::Option<
View::Option::UP_VECTOR> {
127 glm::vec3 default_value = {0, 1, 0};
132 struct Options::Option<
View::Option::CLEAR> {
133 bool default_value =
true;