57 return m_x * _v.m_x + m_y * _v.m_y + m_z * _v.m_z;
189 m_x=_v1.m_y*_v2.m_z-_v1.m_z*_v2.m_y;
190 m_y=_v1.m_z*_v2.m_x-_v1.m_x*_v2.m_z;
191 m_z=_v1.m_x*_v2.m_y-_v1.m_y*_v2.m_x;
218 return ((
m_x * _v.m_x) +(
m_y * _v.m_y) + (
m_z * _v.m_z));
226 m_x * _v.m_x,
m_x * _v.m_y,
m_x * _v.m_z,
227 m_y * _v.m_x,
m_y * _v.m_y,
m_y * _v.m_z,
262 float d=this->
dot(_n);
264 return Vec3(
m_x-2.0
f*d*_n.m_x,
m_y-2.0f*d*_n.m_y,
m_z-2.0f*d*_n.m_z);
270 m_x>_max ? m_x = _max :
m_x;
273 m_y>_max ? m_y = _max :
m_y;
276 m_z>_max ? m_z = _max :
m_z;
283 m_x>_max ? m_x = _max :
m_x;
286 m_y>_max ? m_y = _max :
m_y;
289 m_z>_max ? m_z = _max :
m_z;
void null() noexcept
clears the Vec3 to 0,0,0
Mat3 basic 3x3 matrix for certain glsl ops.
simple Vector class for OpenGL graphics, contains overloaded operators for most math functions...
Vec3 reflect(const Vec3 &_n) const noexcept
return the vector reflected with this and N
Vec3()
default ctor use default and set to (0.0f,0.0f,0.0f) as attributes are initialised ...
Real inner(const Vec3 &_v) const noexcept
calculate the inner product of this vector and vector passed in
Vec3 operator/(Real _v) const noexcept
divide Vec3 components by a scalar
simple Vec3 encapsulates a 3 float object like glsl vec3 but not maths use the Vec3 class for maths a...
implementation files for RibExport class
PRECISION Real
create a variable called Real which is the main data type we use (GLfloat for most cases) ...
void operator+=(const Vec3 &_v) noexcept
+= operator add Vec3 v to current Vec3
encapsulates a 4d Homogenous Point / Vector object
Real lengthSquared() const noexcept
returns the length squared of the vector (no sqrt so quicker)
#define FCompare(a, b)
FCompare macro used for floating point comparision functions.
void operator-=(const Vec3 &_v) noexcept
-= operator this-=v
Vec3 operator+(const Vec3 &_v) const noexcept
operator add Vec3+Vec3
void set(Real _x, Real _y, Real _z) noexcept
sets the Vec3 component from 3 values
a simple 3 tuple container for compatibility with glsl
bool operator!=(const Vec3 &_v) const noexcept
not equal check
Real dot(const Vec3 &_b) const noexcept
return this dotted with _b
void clamp(float _min, float _max) noexcept
clamp the vector values between _min and _max
Real length() const noexcept
returns the length of the vector
void operator/=(Real _v) noexcept
divide this Vec3 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...
Real & operator[](size_t &_i) noexcept
[] index operator to access the index component of the Vec3
Vec3 operator*(Real _i) const noexcept
this * i for each element
void operator*=(Real _v) noexcept
multiply this Vec3 components by a scalar
bool operator==(const Vec3 &_v) const noexcept
check for equality uses FCompare (from Util.h) as float values
void normalize() noexcept
Normalize the vector using .
re impliment asserts so we don't exit on failure
Vec3 operator-() const noexcept
negate the Vec3 components
Vec3 & operator=(const Vec3 &_v)=default
assignment operator set the current Vec3 to rhs
void cross(const Vec3 &_v1, const Vec3 &_v2) noexcept
set the Vec3 as the cross product from 2 other Vec3
Mat3 outer(const Vec3 &_v) const noexcept
compute the outer product of this vector and vector (requested by PJ)