Visualization Library v1.0.3A lightweight C++ OpenGL middleware for 2D/3D graphics |
[Download] [Tutorials] [All Classes] [Grouped Classes] |
Implements the OpenGL Shading Language convenience functions for scalar and vector operations. More...
#include <cmath>
#include <limits>
#include <vlCore/Vector4.hpp>
#include <vlCore/Matrix4.hpp>
Go to the source code of this file.
Namespaces | |
namespace | vl |
Visualization Library namespace. | |
Functions | |
template<typename T > | |
T | vl::asinh (T x) |
template<typename T > | |
T | vl::acosh (T x) |
template<typename T > | |
T | vl::atanh (T x) |
template<typename T > | |
bool | vl::isnan (T value) |
template<typename T > | |
bool | vl::isinf (T value) |
template<typename T > | |
bool | vl::isinf_pos (T value) |
template<typename T > | |
bool | vl::isinf_neg (T value) |
template<typename T > | |
T | vl::modf (T a, T &intpart) |
template<typename T > | |
T | vl::radians (T degrees) |
template<typename T > | |
Vector2< T > | vl::radians (const Vector2< T > °rees) |
template<typename T > | |
Vector3< T > | vl::radians (const Vector3< T > °rees) |
template<typename T > | |
Vector4< T > | vl::radians (const Vector4< T > °rees) |
template<typename T > | |
T | vl::degrees (T radians) |
template<typename T > | |
Vector2< T > | vl::degrees (const Vector2< T > &radians) |
template<typename T > | |
Vector3< T > | vl::degrees (const Vector3< T > &radians) |
template<typename T > | |
Vector4< T > | vl::degrees (const Vector4< T > &radians) |
template<typename T > | |
T | vl::sin (T a) |
template<typename T > | |
Vector2< T > | vl::sin (const Vector2< T > &angle) |
template<typename T > | |
Vector3< T > | vl::sin (const Vector3< T > &angle) |
template<typename T > | |
Vector4< T > | vl::sin (const Vector4< T > &angle) |
template<typename T > | |
T | vl::cos (T a) |
template<typename T > | |
Vector2< T > | vl::cos (const Vector2< T > &angle) |
template<typename T > | |
Vector3< T > | vl::cos (const Vector3< T > &angle) |
template<typename T > | |
Vector4< T > | vl::cos (const Vector4< T > &angle) |
template<typename T > | |
T | vl::tan (T a) |
template<typename T > | |
Vector2< T > | vl::tan (const Vector2< T > &angle) |
template<typename T > | |
Vector3< T > | vl::tan (const Vector3< T > &angle) |
template<typename T > | |
Vector4< T > | vl::tan (const Vector4< T > &angle) |
template<typename T > | |
T | vl::atan (T a) |
template<typename T > | |
Vector2< T > | vl::atan (const Vector2< T > &a, const Vector2< T > &b) |
template<typename T > | |
Vector3< T > | vl::atan (const Vector3< T > &a, const Vector3< T > &b) |
template<typename T > | |
Vector4< T > | vl::atan (const Vector4< T > &a, const Vector4< T > &b) |
template<typename T > | |
T | vl::asin (T a) |
template<typename T > | |
Vector2< T > | vl::asin (const Vector2< T > &angle) |
template<typename T > | |
Vector3< T > | vl::asin (const Vector3< T > &angle) |
template<typename T > | |
Vector4< T > | vl::asin (const Vector4< T > &angle) |
template<typename T > | |
T | vl::acos (T a) |
template<typename T > | |
Vector2< T > | vl::acos (const Vector2< T > &angle) |
template<typename T > | |
Vector3< T > | vl::acos (const Vector3< T > &angle) |
template<typename T > | |
Vector4< T > | vl::acos (const Vector4< T > &angle) |
template<typename T > | |
T | vl::sinh (T a) |
template<typename T > | |
Vector2< T > | vl::sinh (const Vector2< T > &a) |
template<typename T > | |
Vector3< T > | vl::sinh (const Vector3< T > &a) |
template<typename T > | |
Vector4< T > | vl::sinh (const Vector4< T > &a) |
template<typename T > | |
T | vl::cosh (T a) |
template<typename T > | |
Vector2< T > | vl::cosh (const Vector2< T > &a) |
template<typename T > | |
Vector3< T > | vl::cosh (const Vector3< T > &a) |
template<typename T > | |
Vector4< T > | vl::cosh (const Vector4< T > &a) |
template<typename T > | |
T | vl::tanh (T a) |
template<typename T > | |
Vector2< T > | vl::tanh (const Vector2< T > &a) |
template<typename T > | |
Vector3< T > | vl::tanh (const Vector3< T > &a) |
template<typename T > | |
Vector4< T > | vl::tanh (const Vector4< T > &a) |
template<typename T > | |
Vector2< T > | vl::asinh (const Vector2< T > &a) |
template<typename T > | |
Vector3< T > | vl::asinh (const Vector3< T > &a) |
template<typename T > | |
Vector4< T > | vl::asinh (const Vector4< T > &a) |
template<typename T > | |
Vector2< T > | vl::acosh (const Vector2< T > &a) |
template<typename T > | |
Vector3< T > | vl::acosh (const Vector3< T > &a) |
template<typename T > | |
Vector4< T > | vl::acosh (const Vector4< T > &a) |
template<typename T > | |
Vector2< T > | vl::atanh (const Vector2< T > &a) |
template<typename T > | |
Vector3< T > | vl::atanh (const Vector3< T > &a) |
template<typename T > | |
Vector4< T > | vl::atanh (const Vector4< T > &a) |
template<typename T > | |
T | vl::pow (T a, T b) |
template<typename T > | |
Vector2< T > | vl::pow (const Vector2< T > &a, const Vector2< T > &b) |
template<typename T > | |
Vector3< T > | vl::pow (const Vector3< T > &a, const Vector3< T > &b) |
template<typename T > | |
Vector4< T > | vl::pow (const Vector4< T > &a, const Vector4< T > &b) |
template<typename T > | |
T | vl::exp (T a) |
template<typename T > | |
Vector2< T > | vl::exp (const Vector2< T > &a) |
template<typename T > | |
Vector3< T > | vl::exp (const Vector3< T > &a) |
template<typename T > | |
Vector4< T > | vl::exp (const Vector4< T > &a) |
template<typename T > | |
T | vl::log (T a) |
template<typename T > | |
Vector2< T > | vl::log (const Vector2< T > &a) |
template<typename T > | |
Vector3< T > | vl::log (const Vector3< T > &a) |
template<typename T > | |
Vector4< T > | vl::log (const Vector4< T > &a) |
template<typename T > | |
T | vl::exp2 (T a) |
template<typename T > | |
Vector2< T > | vl::exp2 (const Vector2< T > &a) |
template<typename T > | |
Vector3< T > | vl::exp2 (const Vector3< T > &a) |
template<typename T > | |
Vector4< T > | vl::exp2 (const Vector4< T > &a) |
template<typename T > | |
T | vl::log2 (T a) |
template<typename T > | |
Vector2< T > | vl::log2 (const Vector2< T > &a) |
template<typename T > | |
Vector3< T > | vl::log2 (const Vector3< T > &a) |
template<typename T > | |
Vector4< T > | vl::log2 (const Vector4< T > &a) |
template<typename T > | |
T | vl::log10 (T a) |
template<typename T > | |
Vector2< T > | vl::log10 (const Vector2< T > &a) |
template<typename T > | |
Vector3< T > | vl::log10 (const Vector3< T > &a) |
template<typename T > | |
Vector4< T > | vl::log10 (const Vector4< T > &a) |
template<typename T > | |
T | vl::sqrt (T a) |
template<typename T > | |
Vector2< T > | vl::sqrt (const Vector2< T > &a) |
template<typename T > | |
Vector3< T > | vl::sqrt (const Vector3< T > &a) |
template<typename T > | |
Vector4< T > | vl::sqrt (const Vector4< T > &a) |
template<typename T > | |
T | vl::inversesqrt (T a) |
template<typename T > | |
Vector2< T > | vl::inversesqrt (const Vector2< T > &a) |
template<typename T > | |
Vector3< T > | vl::inversesqrt (const Vector3< T > &a) |
template<typename T > | |
Vector4< T > | vl::inversesqrt (const Vector4< T > &a) |
template<typename T > | |
T | vl::abs (T a) |
template<typename T > | |
Vector2< T > | vl::abs (const Vector2< T > &a) |
template<typename T > | |
Vector3< T > | vl::abs (const Vector3< T > &a) |
template<typename T > | |
Vector4< T > | vl::abs (const Vector4< T > &a) |
template<typename T > | |
T | vl::sign (T a) |
template<typename T > | |
Vector2< T > | vl::sign (const Vector2< T > &a) |
template<typename T > | |
Vector3< T > | vl::sign (const Vector3< T > &a) |
template<typename T > | |
Vector4< T > | vl::sign (const Vector4< T > &a) |
template<typename T > | |
T | vl::floor (T a) |
template<typename T > | |
Vector2< T > | vl::floor (const Vector2< T > &a) |
template<typename T > | |
Vector3< T > | vl::floor (const Vector3< T > &a) |
template<typename T > | |
Vector4< T > | vl::floor (const Vector4< T > &a) |
template<typename T > | |
T | vl::fract (T a) |
template<typename T > | |
Vector2< T > | vl::fract (const Vector2< T > &a) |
template<typename T > | |
Vector3< T > | vl::fract (const Vector3< T > &a) |
template<typename T > | |
Vector4< T > | vl::fract (const Vector4< T > &a) |
template<typename T > | |
T | vl::trunc (T a) |
template<typename T > | |
Vector2< T > | vl::trunc (const Vector2< T > &a) |
template<typename T > | |
Vector3< T > | vl::trunc (const Vector3< T > &a) |
template<typename T > | |
Vector4< T > | vl::trunc (const Vector4< T > &a) |
template<typename T > | |
T | vl::round (T x) |
template<typename T > | |
Vector2< T > | vl::round (const Vector2< T > &a) |
template<typename T > | |
Vector3< T > | vl::round (const Vector3< T > &a) |
template<typename T > | |
Vector4< T > | vl::round (const Vector4< T > &a) |
float | vl::modf (float a, float &intpart) |
double | vl::modf (double a, double &intpart) |
template<typename T > | |
Vector2< T > | vl::modf (const Vector2< T > &a, Vector2< T > &intpart) |
template<typename T > | |
Vector3< T > | vl::modf (const Vector3< T > &a, Vector3< T > &intpart) |
template<typename T > | |
Vector4< T > | vl::modf (const Vector4< T > &a, Vector4< T > &intpart) |
float | vl::roundEven (float a, float epsilon) |
double | vl::roundEven (double a, double epsilon) |
template<typename T > | |
Vector2< T > | vl::roundEven (const Vector2< T > &a, T epsilon=0.00001) |
template<typename T > | |
Vector3< T > | vl::roundEven (const Vector3< T > &a, T epsilon=0.00001) |
template<typename T > | |
Vector4< T > | vl::roundEven (const Vector4< T > &a, T epsilon=0.00001) |
template<typename T > | |
T | vl::ceil (T a) |
template<typename T > | |
Vector2< T > | vl::ceil (const Vector2< T > &a) |
template<typename T > | |
Vector3< T > | vl::ceil (const Vector3< T > &a) |
template<typename T > | |
Vector4< T > | vl::ceil (const Vector4< T > &a) |
template<typename T > | |
T | vl::mod (T a, T b) |
template<typename T > | |
Vector2< T > | vl::mod (const Vector2< T > &a, T b) |
template<typename T > | |
Vector3< T > | vl::mod (const Vector3< T > &a, T b) |
template<typename T > | |
Vector4< T > | vl::mod (const Vector4< T > &a, T b) |
template<typename T > | |
Vector2< T > | vl::mod (const Vector2< T > &a, const Vector2< T > &b) |
template<typename T > | |
Vector3< T > | vl::mod (const Vector3< T > &a, const Vector3< T > &b) |
template<typename T > | |
Vector4< T > | vl::mod (const Vector4< T > &a, const Vector4< T > &b) |
template<typename T > | |
T | vl::mix (T a, T b, T t) |
template<typename T > | |
Vector2< T > | vl::mix (const Vector2< T > &a, const Vector2< T > &b, T t) |
template<typename T > | |
Vector3< T > | vl::mix (const Vector3< T > &a, const Vector3< T > &b, T t) |
template<typename T > | |
Vector4< T > | vl::mix (const Vector4< T > &a, const Vector4< T > &b, T t) |
template<typename T > | |
Vector2< T > | vl::mix (const Vector2< T > &a, const Vector2< T > &b, const Vector2< T > &t) |
template<typename T > | |
Vector3< T > | vl::mix (const Vector3< T > &a, const Vector3< T > &b, const Vector3< T > &t) |
template<typename T > | |
Vector4< T > | vl::mix (const Vector4< T > &a, const Vector4< T > &b, const Vector4< T > &t) |
template<typename T > | |
T | vl::step (T edge, T a) |
template<typename T > | |
Vector2< T > | vl::step (const Vector2< T > &edge, const Vector2< T > &a) |
template<typename T > | |
Vector3< T > | vl::step (const Vector3< T > &edge, const Vector3< T > &a) |
template<typename T > | |
Vector4< T > | vl::step (const Vector4< T > &edge, const Vector4< T > &a) |
template<typename T > | |
T | vl::smoothstep (T edge0, T edge1, T a) |
template<typename T > | |
Vector2< T > | vl::smoothstep (const Vector2< T > &edge0, const Vector2< T > &edge1, const Vector2< T > &a) |
template<typename T > | |
Vector3< T > | vl::smoothstep (const Vector3< T > &edge0, const Vector3< T > &edge1, const Vector3< T > &a) |
template<typename T > | |
Vector4< T > | vl::smoothstep (const Vector4< T > &edge0, const Vector4< T > &edge1, const Vector4< T > &a) |
template<typename T > | |
ivec2 | vl::isnan (const Vector2< T > &a) |
template<typename T > | |
ivec3 | vl::isnan (const Vector3< T > &a) |
template<typename T > | |
ivec4 | vl::isnan (const Vector4< T > &a) |
template<typename T > | |
ivec2 | vl::isinf (const Vector2< T > &a) |
template<typename T > | |
ivec3 | vl::isinf (const Vector3< T > &a) |
template<typename T > | |
ivec4 | vl::isinf (const Vector4< T > &a) |
template<typename T > | |
T | vl::length (T v) |
template<typename T > | |
T | vl::length (const Vector2< T > &v) |
template<typename T > | |
T | vl::length (const Vector3< T > &v) |
template<typename T > | |
T | vl::length (const Vector4< T > &v) |
template<typename T > | |
T | vl::distance (T p0, T p1) |
template<typename T > | |
T | vl::distance (const Vector2< T > &p0, const Vector2< T > &p1) |
template<typename T > | |
T | vl::distance (const Vector3< T > &p0, const Vector3< T > &p1) |
template<typename T > | |
T | vl::distance (const Vector4< T > &p0, const Vector4< T > &p1) |
float | vl::dot (float a, float b) |
double | vl::dot (double a, double b) |
real | vl::dot (int a, int b) |
real | vl::dot (unsigned int a, unsigned int b) |
template<typename T > | |
T | vl::normalize (T) |
template<typename T > | |
Vector2< T > | vl::normalize (const Vector2< T > &v) |
template<typename T > | |
Vector3< T > | vl::normalize (const Vector3< T > &v) |
template<typename T > | |
Vector4< T > | vl::normalize (const Vector4< T > &v) |
template<typename T > | |
T | vl::faceforward (T N, T I, T Nref) |
template<typename T > | |
Vector2< T > | vl::faceforward (const Vector2< T > &N, const Vector2< T > &I, const Vector2< T > &Nref) |
template<typename T > | |
Vector3< T > | vl::faceforward (const Vector3< T > &N, const Vector3< T > &I, const Vector3< T > &Nref) |
template<typename T > | |
Vector4< T > | vl::faceforward (const Vector4< T > &N, const Vector4< T > &I, const Vector4< T > &Nref) |
template<typename T > | |
T | vl::reflect (T I, T N) |
template<typename T > | |
Vector2< T > | vl::reflect (const Vector2< T > &I, const Vector2< T > &N) |
template<typename T > | |
Vector3< T > | vl::reflect (const Vector3< T > &I, const Vector3< T > &N) |
template<typename T > | |
Vector4< T > | vl::reflect (const Vector4< T > &I, const Vector4< T > &N) |
template<typename T > | |
T | vl::refract (T I, T N, T eta) |
template<typename T > | |
Vector2< T > | vl::refract (const Vector2< T > &I, const Vector2< T > &N, T eta) |
template<typename T > | |
Vector3< T > | vl::refract (const Vector3< T > &I, const Vector3< T > &N, T eta) |
template<typename T > | |
Vector4< T > | vl::refract (const Vector4< T > &I, const Vector4< T > &N, T eta) |
template<typename T > | |
Matrix2< T > | vl::matrixCompMult (const Matrix2< T > &a, const Matrix2< T > &b) |
template<typename T > | |
Matrix3< T > | vl::matrixCompMult (const Matrix3< T > &a, const Matrix3< T > &b) |
template<typename T > | |
Matrix4< T > | vl::matrixCompMult (const Matrix4< T > &a, const Matrix4< T > &b) |
template<typename T > | |
Matrix2< T > | vl::outerProduct (const Vector2< T > &a, const Vector2< T > &b) |
template<typename T > | |
Matrix3< T > | vl::outerProduct (const Vector3< T > &a, const Vector3< T > &b) |
template<typename T > | |
Matrix4< T > | vl::outerProduct (const Vector4< T > &a, const Vector4< T > &b) |
template<typename T > | |
Matrix2< T > | vl::transpose (const Matrix2< T > &a) |
template<typename T > | |
Matrix3< T > | vl::transpose (const Matrix3< T > &a) |
template<typename T > | |
Matrix4< T > | vl::transpose (const Matrix4< T > &a) |
template<typename T > | |
ivec4 | vl::lessThan (const Vector4< T > &a, const Vector4< T > &b) |
template<typename T > | |
ivec3 | vl::lessThan (const Vector3< T > &a, const Vector3< T > &b) |
template<typename T > | |
ivec2 | vl::lessThan (const Vector2< T > &a, const Vector2< T > &b) |
template<typename T > | |
ivec4 | vl::lessThanEqual (const Vector4< T > &a, const Vector4< T > &b) |
template<typename T > | |
ivec3 | vl::lessThanEqual (const Vector3< T > &a, const Vector3< T > &b) |
template<typename T > | |
ivec2 | vl::lessThanEqual (const Vector2< T > &a, const Vector2< T > &b) |
template<typename T > | |
ivec4 | vl::greaterThan (const Vector4< T > &a, const Vector4< T > &b) |
template<typename T > | |
ivec3 | vl::greaterThan (const Vector3< T > &a, const Vector3< T > &b) |
template<typename T > | |
ivec2 | vl::greaterThan (const Vector2< T > &a, const Vector2< T > &b) |
template<typename T > | |
ivec4 | vl::greaterThanEqual (const Vector4< T > &a, const Vector4< T > &b) |
template<typename T > | |
ivec3 | vl::greaterThanEqual (const Vector3< T > &a, const Vector3< T > &b) |
template<typename T > | |
ivec2 | vl::greaterThanEqual (const Vector2< T > &a, const Vector2< T > &b) |
template<typename T > | |
ivec4 | vl::equal (const Vector4< T > &a, const Vector4< T > &b) |
template<typename T > | |
ivec3 | vl::equal (const Vector3< T > &a, const Vector3< T > &b) |
template<typename T > | |
ivec2 | vl::equal (const Vector2< T > &a, const Vector2< T > &b) |
template<typename T > | |
ivec4 | vl::notEqual (const Vector4< T > &a, const Vector4< T > &b) |
template<typename T > | |
ivec3 | vl::notEqual (const Vector3< T > &a, const Vector3< T > &b) |
template<typename T > | |
ivec2 | vl::notEqual (const Vector2< T > &a, const Vector2< T > &b) |
bool | vl::any (const ivec2 &a) |
bool | vl::any (const ivec3 &a) |
bool | vl::any (const ivec4 &a) |
bool | vl::all (const ivec2 &a) |
bool | vl::all (const ivec3 &a) |
bool | vl::all (const ivec4 &a) |
Implements the OpenGL Shading Language convenience functions for scalar and vector operations.
This functions are particularly useful when you want to port C++ code to GLSL and vice versa, or when you want to quickly prototype in C++ an algorithm that will be ported later to GLSL.
Note that most of this functions take as arguments not only int
, unsigned
int
, float
and double
variables but also their vector counterparts like fvec4
, Vector4<T>
, ivec4
, uvec4
, fvec3
, fvec2
etc. For example you can do the following:
// clamp a float value float f = someValueFloat() f = vl::clamp(f, 0.0f, 1.0f); // clamp a vector value vl::fvec4 v = someValueVec4(); v = vl::clamp(v, vl::fvec4(1,2,3,4), vl::fvec4(5,6,7,8)); // the same goes for functions like mix(), min(), max(), sin(), cos(), floor() etc.
This module also implements other convenience functions like isnan(), isinf(), isinf_pos(), isinf_neg().
The functions are divided in the following categories:
Definition in file glsl_math.hpp.