#pragma once #include "drape/glsl_types.hpp" #include "base/assert.hpp" #include #include namespace df { #define DECLARE_SETTER(name, field) \ template struct Check##name \ { \ private: \ static void Detect(...); \ template static decltype(std::declval().field) Detect(U const &); \ public: \ static constexpr bool Value = !std::is_same()))>::value; \ }; \ template \ std::enable_if_t::Value> \ name(ParamsType & params) const \ { \ params.field = field; \ } \ template \ std::enable_if_t::Value> \ name(ParamsType & params) const {} struct FrameValues { glsl::mat4 m_projection; glsl::mat4 m_pivotTransform; float m_zScale = 1.0f; template void SetTo(ParamsType & params) const { SetProjection(params); SetPivotTransform(params); SetZScale(params); } private: DECLARE_SETTER(SetProjection, m_projection) DECLARE_SETTER(SetPivotTransform, m_pivotTransform) DECLARE_SETTER(SetZScale, m_zScale) }; } // namespace df