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