inline DXVector3::DXVector3(const float _x, const float _y, const float _z)
{
	x = _x;
	y = _y;
	z = _z;
}

inline DXVector3::DXVector3(const float* const v)
{
	x = v[0];
	y = v[1];
	z = v[2];
}

inline DXVector3::DXVector3(const DXVector3 &v)
{
	x = v.x;
	y = v.y;
	z = v.z;
}

//casting
inline DXVector3::operator float* ()
{
	return (float*) &x;
}

inline DXVector3::operator const float* () const
{
	return (const float*) &x;
}

inline DXVector3::operator D3DXVECTOR3* ()
{
	return (D3DXVECTOR3*) &x;
}

inline DXVector3::operator const D3DXVECTOR3* () const
{
	return (const D3DXVECTOR3*) &x;
}

inline DXVector3::operator D3DXVECTOR3 () const
{
	return D3DXVECTOR3(x,y,z);
}

// assignment operators
inline DXVector3& DXVector3::operator += (const DXVector3& v)
{
	x += v.x;
    y += v.y;
	z += v.z;
	return *this;
}

inline DXVector3& DXVector3::operator -= (const DXVector3& v)
{
	x -= v.x;
    y -= v.y;
	z -= v.z;
	return *this;
}

inline DXVector3& DXVector3::operator *= (const float f)
{
	x *= f;
    y *= f;
	z *= f;
	return *this;
}

inline DXVector3& DXVector3::operator /= (const float f)
{
	x /= f;
    y /= f;
	z /= f;
	return *this;
}

// unary operators
inline DXVector3 DXVector3::operator + () const
{
	return *this;
}

inline DXVector3 DXVector3::operator - () const
{
	return DXVector3(-x, -y, -z);
}

// binary operators
inline DXVector3 DXVector3::operator + (const DXVector3& v) const
{
	return DXVector3(x + v.x, y + v.y, z + v.z);
}

inline DXVector3 DXVector3::operator - (const DXVector3& v) const
{
	return DXVector3(x - v.x, y - v.y, z - v.z);
}

inline DXVector3 DXVector3::operator * (float f) const
{
	return DXVector3(x * f, y * f, z * f);
}

inline DXVector3 DXVector3::operator / (float f) const
{
	return DXVector3(x / f, y / f, z / f);
}

inline DXVector3 operator * ( float f, const DXVector3& v)
{
	return DXVector3(f * v.x, f * v.y, f * v.z);
}

inline bool DXVector3::operator == ( const DXVector3& v) const
{
	 return x == v.x && y == v.y && z == v.z;
}

inline bool DXVector3::operator != ( const DXVector3& v) const
{
	 return x != v.x || y != v.y || z != v.z;
}

//calculations
inline float DXVector3::Dot(const DXVector3& vec) const 
{ 
	return D3DXVec3Dot((D3DXVECTOR3*)this, (D3DXVECTOR3*)&vec); 
}

inline float DXVector3::Length(void) const 
{ 
	return D3DXVec3Length((D3DXVECTOR3*)this); 

}
inline DXVector3 DXVector3::Cross(const DXVector3& v2) const 
{ 
	DXVector3 temp; 
	D3DXVec3Cross((D3DXVECTOR3*)&temp, (const D3DXVECTOR3*)this, (const D3DXVECTOR3 *)&v2); 
	return temp; 
}

//manipulations
inline void DXVector3::Normalize(void) 
{ 
	D3DXVec3Normalize((D3DXVECTOR3*)this, (D3DXVECTOR3*)this); 
}

inline void DXVector3::TransformCoord(const DXMatrix& mat) 
{ 
	D3DXVec3TransformCoord( (D3DXVECTOR3*)this, (D3DXVECTOR3*)this, (D3DXMATRIX*)&mat ); 
}

inline void DXVector3::TransformNormal(const DXMatrix& mat) 
{ 
	D3DXVec3TransformNormal( (D3DXVECTOR3*)this, (D3DXVECTOR3*)this, (D3DXMATRIX*)&mat ); 
}

//static calc
inline DXVector3 DXVector3::CrossVec(const DXVector3& v1, const DXVector3& v2) 
{ 
	DXVector3 temp; 
	D3DXVec3Cross((D3DXVECTOR3*)&temp, (const D3DXVECTOR3*)&v1, (const D3DXVECTOR3*)&v2); 
	return temp; 
}
inline DXVector3 DXVector3::NormalizeVec(const DXVector3& vec)
{ 
	DXVector3 res; 
	D3DXVec3Normalize((D3DXVECTOR3*)&res, (D3DXVECTOR3*)&vec); 
	return res;
}

inline DXVector3 DXVector3::Lerp(const DXVector3& a, const DXVector3& b, const float s)
{
	DXVector3 res; 
	D3DXVec3Lerp((D3DXVECTOR3*)&res, (D3DXVECTOR3*)&a, (D3DXVECTOR3*)&b, s); 
	return res;
}