37 return m_x * _v.m_x + m_y * _v.m_y + m_z * _v.m_z;
112 m_x=_v1.m_y*_v2.m_z-_v1.m_z*_v2.m_y;
113 m_y=_v1.m_z*_v2.m_x-_v1.m_x*_v2.m_z;
114 m_z=_v1.m_x*_v2.m_y-_v1.m_y*_v2.m_x;
249 return acosf(v1.
dot(v2));
void operator-=(const Vec4 &_v) noexcept
-= operator this-=v
Real inner(const Vec4 &_v) const noexcept
calculate the inner product of this vector and vector passed in
Vec4 & normalize() noexcept
Normalize the vector using .
simple Vector class for OpenGL graphics, contains overloaded operators for most math functions...
GLfloat GLfloat GLfloat v2
Vec4 & operator-() noexcept
negate the vector components
GLint GLint GLint GLint GLint GLint y
Real angleBetween(const Vec4 &_v) const noexcept
calculate the angle between current vector and _v
simple Vec3 encapsulates a 3 float object like glsl vec3 but not maths use the Vec3 class for maths a...
void operator*=(Real _v) noexcept
multiply this vector components by a scalar
implementation files for RibExport class
PRECISION Real
create a variable called Real which is the main data type we use (GLfloat for most cases) ...
encapsulates a 4d Homogenous Point / Vector object
#define FCompare(a, b)
FCompare macro used for floating point comparision functions.
Vec4 outer(const Vec4 &_v) const noexcept
compute the outer product of this vector and vector
a simple 2 tuple container for compatibility with glsl
Vec4 operator/(Real _v) const noexcept
divide vector components by a scalar
void set(Real _x, Real _y, Real _z, Real _w=1.0) noexcept
sets the vector component from 3 values
a simple 3 tuple container for compatibility with glsl
bool operator!=(const Vec4 &_v) const noexcept
not equal check
Real length() const noexcept
returns the length of the vector
Real dot(const Vec4 &_b) const noexcept
return this dotted with _b
GLint GLint GLint GLint GLint x
void operator/=(Real _v) noexcept
divide this vector components by a scalar
#define NGL_ASSERT(X)
re-define the standard assert to work for ngl first check to see if assert is defined and undef it th...
bool operator==(const Vec4 &_v) const noexcept
check for equality uses FCompare (from Util.h) as float values
Vec4 operator+(const Vec4 &_v) const noexcept
operator add vector+vector
Matrix Class to do simple matrix operations included operator overloaded functions for maths and matr...
Vec4 operator*(Real _i) const noexcept
this * i for each element
Real m_w
w component 0 for vector 1 for point
Vec4 & operator=(const Vec4 &_v) noexcept
assignment operator set the current vector to rhs
re impliment asserts so we don't exit on failure
Real & operator[](int _i) noexcept
[] index operator to access the index component of the vector
void null() noexcept
clears the vector to 0,0,0,1
void cross(const Vec4 &_v1, const Vec4 &_v2) noexcept
set the vector as the cross product from 2 other vectors
void operator+=(const Vec4 &_v) noexcept
+= operator add vector v to current vector
Real lengthSquared() const noexcept
calculate the length squared of the vector