43 Vec4f() { _v[0]=0.0f; _v[1]=0.0f; _v[2]=0.0f; _v[3]=0.0f;}
45 Vec4f(value_type
x, value_type
y, value_type
z, value_type
w)
61 inline bool operator == (
const Vec4f& v)
const {
return _v[0]==v.
_v[0] && _v[1]==v.
_v[1] && _v[2]==v.
_v[2] && _v[3]==v.
_v[3]; }
63 inline bool operator != (
const Vec4f& v)
const {
return _v[0]!=v.
_v[0] || _v[1]!=v.
_v[1] || _v[2]!=v.
_v[2] || _v[3]!=v.
_v[3]; }
67 if (_v[0]<v.
_v[0])
return true;
68 else if (_v[0]>v.
_v[0])
return false;
69 else if (_v[1]<v.
_v[1])
return true;
70 else if (_v[1]>v.
_v[1])
return false;
71 else if (_v[2]<v.
_v[2])
return true;
72 else if (_v[2]>v.
_v[2])
return false;
73 else return (_v[3]<v.
_v[3]);
76 inline value_type*
ptr() {
return _v; }
77 inline const value_type*
ptr()
const {
return _v; }
79 inline void set( value_type
x, value_type
y, value_type
z, value_type
w)
81 _v[0]=
x; _v[1]=
y; _v[2]=
z; _v[3]=
w;
84 inline value_type&
operator [] (
unsigned int i) {
return _v[i]; }
85 inline value_type
operator [] (
unsigned int i)
const {
return _v[i]; }
87 inline value_type&
x() {
return _v[0]; }
88 inline value_type&
y() {
return _v[1]; }
89 inline value_type&
z() {
return _v[2]; }
90 inline value_type&
w() {
return _v[3]; }
92 inline value_type
x()
const {
return _v[0]; }
93 inline value_type
y()
const {
return _v[1]; }
94 inline value_type
z()
const {
return _v[2]; }
95 inline value_type
w()
const {
return _v[3]; }
97 inline value_type&
r() {
return _v[0]; }
98 inline value_type&
g() {
return _v[1]; }
99 inline value_type&
b() {
return _v[2]; }
100 inline value_type&
a() {
return _v[3]; }
102 inline value_type
r()
const {
return _v[0]; }
103 inline value_type
g()
const {
return _v[1]; }
104 inline value_type
b()
const {
return _v[2]; }
105 inline value_type
a()
const {
return _v[3]; }
109 return (
unsigned int)
clampTo((_v[0]*255.0f),0.0f,255.0f)<<24 |
110 (
unsigned int)
clampTo((_v[1]*255.0f),0.0f,255.0f)<<16 |
111 (
unsigned int)
clampTo((_v[2]*255.0f),0.0f,255.0f)<<8 |
112 (
unsigned int)
clampTo((_v[3]*255.0f),0.0f,255.0f);
117 return (
unsigned int)
clampTo((_v[3]*255.0f),0.0f,255.0f)<<24 |
118 (
unsigned int)
clampTo((_v[2]*255.0f),0.0f,255.0f)<<16 |
119 (
unsigned int)
clampTo((_v[1]*255.0f),0.0f,255.0f)<<8 |
120 (
unsigned int)
clampTo((_v[0]*255.0f),0.0f,255.0f);
131 return _v[0]*rhs.
_v[0]+
140 return Vec4f(_v[0]*rhs, _v[1]*rhs, _v[2]*rhs, _v[3]*rhs);
156 return Vec4f(_v[0]/rhs, _v[1]/rhs, _v[2]/rhs, _v[3]/rhs);
172 return Vec4f(_v[0]+rhs.
_v[0], _v[1]+rhs.
_v[1],
173 _v[2]+rhs.
_v[2], _v[3]+rhs.
_v[3]);
191 return Vec4f(_v[0]-rhs.
_v[0], _v[1]-rhs.
_v[1],
192 _v[2]-rhs.
_v[2], _v[3]-rhs.
_v[3] );
208 return Vec4f (-_v[0], -_v[1], -_v[2], -_v[3]);
214 return sqrtf( _v[0]*_v[0] + _v[1]*_v[1] + _v[2]*_v[2] + _v[3]*_v[3]);
220 return _v[0]*_v[0] + _v[1]*_v[1] + _v[2]*_v[2] + _v[3]*_v[3];
231 value_type inv = 1.0f/norm;
245 return lhs[0]*rhs[0]+lhs[1]*rhs[1]+lhs[2]*rhs[2]+rhs[3];
251 return lhs[0]*rhs[0]+lhs[1]*rhs[1]+lhs[2]*rhs[2]+lhs[3];
257 return Vec4f(lhs[0]*rhs[0], lhs[1]*rhs[1], lhs[2]*rhs[2], lhs[3]*rhs[3]);
263 return Vec4f(lhs[0]/rhs[0], lhs[1]/rhs[1], lhs[2]/rhs[2], lhs[3]/rhs[3]);
Vec4f & operator/=(value_type rhs)
bool operator<(const Vec4f &v) const
bool operator!=(const Vec4f &v) const
unsigned int asRGBA() const
const Vec4f operator-() const
value_type operator*(const Vec4f &rhs) const
value_type length() const
Vec2d componentDivide(const Vec2d &lhs, const Vec2d &rhs)
Vec4f operator+(const Vec4f &rhs) const
value_type length2() const
Vec4f operator/(value_type rhs) const
Vec4f(const Vec3f &v3, value_type w)
const value_type * ptr() const
T clampTo(T v, T minimum, T maximum)
Vec4f & operator-=(const Vec4f &rhs)
Vec4f(value_type x, value_type y, value_type z, value_type w)
Vec4f & operator+=(const Vec4f &rhs)
unsigned int asABGR() const
Vec4f & operator*=(value_type rhs)
Vec3f operator*(const Vec3f &v, const Matrixd &m)
value_type & operator[](unsigned int i)
void set(value_type x, value_type y, value_type z, value_type w)
bool operator==(const Vec4f &v) const
Vec2d componentMultiply(const Vec2d &lhs, const Vec2d &rhs)