FlukyEngine
Namespaces | Macros | Typedefs
scalar_multiplication.hpp File Reference

Experimental extensions More...

#include "../detail/setup.hpp"
#include "../vec2.hpp"
#include "../vec3.hpp"
#include "../vec4.hpp"
#include "../mat2x2.hpp"
#include <type_traits>
Include dependency graph for scalar_multiplication.hpp:

Go to the source code of this file.

Namespaces

 glm
 Core features
 

Macros

#define GLM_IMPLEMENT_SCAL_MULT(Vec)
 

Typedefs

template<typename T , typename Vec >
using glm::return_type_scalar_multiplication = typename std::enable_if< !std::is_same< T, float >::value &&std::is_arithmetic< T >::value, Vec >::type
 

Detailed Description

Experimental extensions

Author
Joshua Moerman

Include <glm/gtx/scalar_multiplication.hpp> to use the features of this extension.

Enables scalar multiplication for all types

Since GLSL is very strict about types, the following (often used) combinations do not work: double * vec4 int * vec4 vec4 / int So we'll fix that! Of course "float * vec4" should remain the same (hence the enable_if magic)

Macro Definition Documentation

◆ GLM_IMPLEMENT_SCAL_MULT

#define GLM_IMPLEMENT_SCAL_MULT (   Vec)
Value:
template<typename T> \
return_type_scalar_multiplication<T, Vec> \
operator*(T const& s, Vec rh){ \
return rh *= static_cast<float>(s); \
} \
\
template<typename T> \
return_type_scalar_multiplication<T, Vec> \
operator*(Vec lh, T const& s){ \
return lh *= static_cast<float>(s); \
} \
\
template<typename T> \
return_type_scalar_multiplication<T, Vec> \
operator/(Vec lh, T const& s){ \
return lh *= 1.0f / static_cast<float>(s); \
}