MathFu
An open source project by FPL.
 All Classes Namespaces Files Functions Variables Typedefs Friends Groups Pages
GLSL Mappings

GLSL compatible data types. More...

Detailed Description

GLSL compatible data types.

To simplify the use of MathFu template classes and make it possible to write code that looks similar to GLSL in C++, MathFu provides a set of data types that are similar in style to GLSL Vector and Matrix data types.

Typedefs

typedef Vector< float, 2 > mathfu::vec2
 2-dimensional float Vector.
 
typedef Vector< float, 3 > mathfu::vec3
 3-dimensional float Vector.
 
typedef Vector< float, 4 > mathfu::vec4
 4-dimensional float Vector.
 
typedef Vector< int, 2 > mathfu::vec2i
 2-dimensional int Vector.
 
typedef Vector< int, 3 > mathfu::vec3i
 3-dimensional int Vector.
 
typedef Vector< int, 4 > mathfu::vec4i
 4-dimensional int Vector.
 
typedef Matrix< float, 2, 2 > mathfu::mat2
 2x2 float Matrix.
 
typedef Matrix< float, 3, 3 > mathfu::mat3
 3x3 float Matrix.
 
typedef Matrix< float, 4, 4 > mathfu::mat4
 3x3 float Matrix.
 
typedef VectorPacked< float, 2 > mathfu::vec2_packed
 2-dimensional float packed Vector (VectorPacked).
 
typedef VectorPacked< float, 3 > mathfu::vec3_packed
 3-dimensional float packed Vector (VectorPacked).
 
typedef VectorPacked< float, 4 > mathfu::vec4_packed
 4-dimensional float packed Vector (VectorPacked).
 
typedef VectorPacked< int, 2 > mathfu::vec2i_packed
 2-dimensional int packed Vector (VectorPacked).
 
typedef VectorPacked< int, 3 > mathfu::vec3i_packed
 3-dimensional int packed Vector (VectorPacked).
 
typedef VectorPacked< int, 4 > mathfu::vec4i_packed
 4-dimensional int packed Vector (VectorPacked).
 
typedef mathfu::Quaternion< float > mathfu::quat
 
typedef Rect< float > mathfu::rectf
 Rect composed of type float.
 
typedef Rect< double > mathfu::rectd
 Rect composed of type double.
 
typedef Rect< int > mathfu::recti
 Rect composed of type int.
 

Functions

template<class T >
Vector< T, 3 > mathfu::cross (const Vector< T, 3 > &v1, const Vector< T, 3 > &v2)
 Calculate the cross product of two 3-dimensional Vectors. More...
 
template<class TV >
TV::Scalar mathfu::dot (const TV &v1, const TV &v2)
 Calculate the dot product of two N-dimensional Vectors of any type. More...
 
template<class TV >
TV mathfu::normalize (const TV &v1)
 Normalize an N-dimensional Vector of an arbitrary type. More...
 

Typedef Documentation

Float-based quaternion. Note that this is not technically a GLES type, but is included for convenience.

Function Documentation

template<class T >
Vector<T, 3> mathfu::cross ( const Vector< T, 3 > &  v1,
const Vector< T, 3 > &  v2 
)
inline

Calculate the cross product of two 3-dimensional Vectors.

Parameters
v1Vector to multiply
v2Vector to multiply
Returns
3-dimensional vector that contains the result.
template<class TV >
TV::Scalar mathfu::dot ( const TV &  v1,
const TV &  v2 
)
inline

Calculate the dot product of two N-dimensional Vectors of any type.

Parameters
v1Vector to multiply
v2Vector to multiply
Returns
Scalar dot product result.
template<class TV >
TV mathfu::normalize ( const TV &  v1)
inline

Normalize an N-dimensional Vector of an arbitrary type.

Parameters
v1Vector to normalize.
Returns
Normalized vector.