103 -> std::enable_if_t<std::is_integral_v<T>, std::make_signed_t<T>> |
104 -> std::enable_if_t<std::is_integral_v<T>, std::make_signed_t<T>> |
104 { |
105 { |
105 return static_cast<std::make_signed_t<T>>(x); |
106 return static_cast<std::make_signed_t<T>>(x); |
106 } |
107 } |
107 |
108 |
|
109 |
|
110 /** |
|
111 * @brief casts double and long double - and only those types - to float |
|
112 * @param[in] x double or long double to cast |
|
113 * @returns float |
|
114 */ |
|
115 template<typename T> |
|
116 auto doubleToFloat(T x) |
|
117 -> std::enable_if_t< |
|
118 std::is_same_v<std::decay_t<T>, double> || |
|
119 std::is_same_v<std::decay_t<T>, long double |
|
120 >, float> |
|
121 { |
|
122 return static_cast<float>(x); |
|
123 } |
|
124 |
|
125 /** |
|
126 * @brief Casts float - and only float - to double |
|
127 * @param[in] x float to cast |
|
128 * @returns double |
|
129 */ |
|
130 template<typename T> |
|
131 auto floatToDouble(T x) |
|
132 -> std::enable_if_t<std::is_same_v<std::decay_t<T>, float>, double> |
|
133 { |
|
134 return static_cast<double>(x); |
|
135 } |
108 Q_DECLARE_METATYPE(glm::vec3) |
136 Q_DECLARE_METATYPE(glm::vec3) |
109 Q_DECLARE_METATYPE(glm::mat4) |
137 Q_DECLARE_METATYPE(glm::mat4) |