00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00022
00023
#ifndef __M3DMATH_VECTOR4_H__
00024
#define __M3DMATH_VECTOR4_H__
00025
00026
#include "m3dmath_common.h"
00027
00028
struct vector4
00029 {
00030
union
00031
{
00032
struct {
float32 x, y, z, w; };
00033
struct {
float32 r, g, b, a; };
00034 };
00035
00036 vector4();
00037 vector4(
const vector4 &i_vVal );
00038 vector4(
const float32 i_fX,
const float32 i_fY,
const float32 i_fZ,
const float32 i_fW );
00039 vector4(
const struct vector3 &i_vVal );
00040 vector4(
const struct vector2 &i_vVal );
00041
00042
const vector4 &operator =(
const vector4 &i_vVal );
00043
const vector4 &operator =(
const struct vector3 &i_vVal );
00044
const vector4 &operator =(
const struct vector2 &i_vVal );
00045
const vector4 &operator =(
const float32 i_fVal );
00046
00047 operator float32*();
00048 operator const float32*() const;
00049
00050 vector4 operator +() const;
00051 vector4 operator -() const;
00052
00053 const vector4 &operator +=( const vector4 &i_vVal );
00054 const vector4 &operator -=( const vector4 &i_vVal );
00055 const vector4 &operator *=( const vector4 &i_vVal );
00056 const vector4 &operator *=( const struct matrix44 &i_matVal );
00057 const vector4 &operator *=( const
float32 i_fVal );
00058 const vector4 &operator /=( const
float32 i_fVal );
00059
00060 vector4 operator +( const vector4 &i_vVal ) const;
00061 vector4 operator -( const vector4 &i_vVal ) const;
00062 vector4 operator *( const vector4 &i_vVal ) const;
00063 vector4 operator *( const struct matrix44 &i_matVal ) const;
00064 vector4 operator *( const
float32 i_fVal ) const;
00065 vector4 operator /( const
float32 i_fVal ) const;
00066
00067
float32 length() const;
00068
float32 lengthsq() const;
00069
00070 vector4 &normalize();
00071 vector4 &homogenize();
00072
00073 vector4 &clamp( const
float32 i_fLower, const
float32 i_fUpper );
00074 vector4 &saturate();
00075 };
00076
00077
float32 fVector4Dot( const vector4 &i_vVecA, const vector4 &i_vVecB );
00078 vector4 &vVector4Lerp( vector4 &o_vVecOut, const vector4 &i_vVecA, const vector4 &i_vVecB, const
float32 i_fInterpolation );
00079
00080 #include "m3dmath_vector4.inl"
00081
00082 #endif