mirror of
https://github.com/id-Software/DOOM-3-BFG.git
synced 2025-03-14 22:50:45 +00:00
Removed idVec4i
This commit is contained in:
parent
0ea058612c
commit
fd6eee32e3
1 changed files with 0 additions and 254 deletions
|
@ -280,258 +280,4 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
//===============================================================
|
||||
//
|
||||
// idVec4i - 4D vector
|
||||
//
|
||||
//===============================================================
|
||||
|
||||
class idVec4i
|
||||
{
|
||||
public:
|
||||
uint8 x;
|
||||
uint8 y;
|
||||
uint8 z;
|
||||
uint8 w;
|
||||
|
||||
idVec4i( void );
|
||||
explicit idVec4i( const uint8 x )
|
||||
{
|
||||
Set( x, x, x, x );
|
||||
}
|
||||
explicit idVec4i( const uint8 x, const uint8 y, const uint8 z, const uint8 w );
|
||||
|
||||
void Set( const uint8 x, const uint8 y, const uint8 z, const uint8 w );
|
||||
void Zero( void );
|
||||
|
||||
int operator[]( const int index ) const;
|
||||
uint8& operator[]( const int index );
|
||||
idVec4i operator-() const;
|
||||
uint8 operator*( const idVec4i& a ) const;
|
||||
idVec4i operator*( const uint8 a ) const;
|
||||
idVec4i operator/( const uint8 a ) const;
|
||||
idVec4i operator+( const idVec4i& a ) const;
|
||||
idVec4i operator-( const idVec4i& a ) const;
|
||||
idVec4i& operator+=( const idVec4i& a );
|
||||
idVec4i& operator-=( const idVec4i& a );
|
||||
idVec4i& operator/=( const idVec4i& a );
|
||||
idVec4i& operator/=( const uint8 a );
|
||||
idVec4i& operator*=( const uint8 a );
|
||||
|
||||
friend idVec4i operator*( const uint8 a, const idVec4i b );
|
||||
|
||||
idVec4i Multiply( const idVec4i& a ) const;
|
||||
bool Compare( const idVec4i& a ) const; // exact compare, no epsilon
|
||||
|
||||
bool operator==( const idVec4i& a ) const; // exact compare, no epsilon
|
||||
bool operator!=( const idVec4i& a ) const; // exact compare, no epsilon
|
||||
|
||||
float Length( void ) const;
|
||||
float LengthSqr( void ) const;
|
||||
float Normalize( void ); // returns length
|
||||
float NormalizeFast( void ); // returns length
|
||||
|
||||
int GetDimension( void ) const;
|
||||
|
||||
const uint8* ToIntPtr( void ) const;
|
||||
uint8* ToIntPtr( void );
|
||||
const char* ToString( int precision = 2 ) const;
|
||||
|
||||
void Lerp( const idVec4i& v1, const idVec4i& v2, const float l );
|
||||
};
|
||||
|
||||
|
||||
ID_INLINE idVec4i::idVec4i( void ) { }
|
||||
|
||||
ID_INLINE idVec4i::idVec4i( const uint8 x, const uint8 y, const uint8 z, const uint8 w )
|
||||
{
|
||||
this->x = x;
|
||||
this->y = y;
|
||||
this->z = z;
|
||||
this->w = w;
|
||||
}
|
||||
|
||||
ID_INLINE void idVec4i::Set( const uint8 x, const uint8 y, const uint8 z, const uint8 w )
|
||||
{
|
||||
this->x = x;
|
||||
this->y = y;
|
||||
this->z = z;
|
||||
this->w = w;
|
||||
}
|
||||
|
||||
ID_INLINE void idVec4i::Zero( void )
|
||||
{
|
||||
x = y = z = w = 0.0f;
|
||||
}
|
||||
|
||||
ID_INLINE int idVec4i::operator[]( int index ) const
|
||||
{
|
||||
return ( &x )[index];
|
||||
}
|
||||
|
||||
ID_INLINE uint8& idVec4i::operator[]( int index )
|
||||
{
|
||||
return ( &x )[index];
|
||||
}
|
||||
|
||||
ID_INLINE idVec4i idVec4i::operator-() const
|
||||
{
|
||||
return idVec4i( -x, -y, -z, -w );
|
||||
}
|
||||
|
||||
ID_INLINE idVec4i idVec4i::operator-( const idVec4i& a ) const
|
||||
{
|
||||
return idVec4i( x - a.x, y - a.y, z - a.z, w - a.w );
|
||||
}
|
||||
|
||||
ID_INLINE uint8 idVec4i::operator*( const idVec4i& a ) const
|
||||
{
|
||||
return x * a.x + y * a.y + z * a.z + w * a.w;
|
||||
}
|
||||
|
||||
ID_INLINE idVec4i idVec4i::operator*( const uint8 a ) const
|
||||
{
|
||||
return idVec4i( x * a, y * a, z * a, w * a );
|
||||
}
|
||||
|
||||
ID_INLINE idVec4i idVec4i::operator/( const uint8 a ) const
|
||||
{
|
||||
float inva = 1.0f / a;
|
||||
return idVec4i( x * inva, y * inva, z * inva, w * inva );
|
||||
}
|
||||
|
||||
ID_INLINE idVec4i operator*( const int a, const idVec4i b )
|
||||
{
|
||||
return idVec4i( b.x * a, b.y * a, b.z * a, b.w * a );
|
||||
}
|
||||
|
||||
ID_INLINE idVec4i idVec4i::operator+( const idVec4i& a ) const
|
||||
{
|
||||
return idVec4i( x + a.x, y + a.y, z + a.z, w + a.w );
|
||||
}
|
||||
|
||||
ID_INLINE idVec4i& idVec4i::operator+=( const idVec4i& a )
|
||||
{
|
||||
x += a.x;
|
||||
y += a.y;
|
||||
z += a.z;
|
||||
w += a.w;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
ID_INLINE idVec4i& idVec4i::operator/=( const idVec4i& a )
|
||||
{
|
||||
x /= a.x;
|
||||
y /= a.y;
|
||||
z /= a.z;
|
||||
w /= a.w;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
ID_INLINE idVec4i& idVec4i::operator/=( const uint8 a )
|
||||
{
|
||||
float inva = 1.0f / a;
|
||||
x *= inva;
|
||||
y *= inva;
|
||||
z *= inva;
|
||||
w *= inva;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
ID_INLINE idVec4i& idVec4i::operator-=( const idVec4i& a )
|
||||
{
|
||||
x -= a.x;
|
||||
y -= a.y;
|
||||
z -= a.z;
|
||||
w -= a.w;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
ID_INLINE idVec4i& idVec4i::operator*=( const uint8 a )
|
||||
{
|
||||
x *= a;
|
||||
y *= a;
|
||||
z *= a;
|
||||
w *= a;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
ID_INLINE idVec4i idVec4i::Multiply( const idVec4i& a ) const
|
||||
{
|
||||
return idVec4i( x * a.x, y * a.y, z * a.z, w * a.w );
|
||||
}
|
||||
|
||||
ID_INLINE bool idVec4i::Compare( const idVec4i& a ) const
|
||||
{
|
||||
return ( ( x == a.x ) && ( y == a.y ) && ( z == a.z ) && w == a.w );
|
||||
}
|
||||
|
||||
ID_INLINE bool idVec4i::operator==( const idVec4i& a ) const
|
||||
{
|
||||
return Compare( a );
|
||||
}
|
||||
|
||||
ID_INLINE bool idVec4i::operator!=( const idVec4i& a ) const
|
||||
{
|
||||
return !Compare( a );
|
||||
}
|
||||
|
||||
ID_INLINE float idVec4i::Length( void ) const
|
||||
{
|
||||
return ( float ) idMath::Sqrt( x * x + y * y + z * z + w * w );
|
||||
}
|
||||
|
||||
ID_INLINE float idVec4i::LengthSqr( void ) const
|
||||
{
|
||||
return ( x * x + y * y + z * z + w * w );
|
||||
}
|
||||
|
||||
ID_INLINE float idVec4i::Normalize( void )
|
||||
{
|
||||
float sqrLength, invLength;
|
||||
|
||||
sqrLength = x * x + y * y + z * z + w * w;
|
||||
invLength = idMath::InvSqrt( sqrLength );
|
||||
x *= invLength;
|
||||
y *= invLength;
|
||||
z *= invLength;
|
||||
w *= invLength;
|
||||
return invLength * sqrLength;
|
||||
}
|
||||
|
||||
ID_INLINE float idVec4i::NormalizeFast( void )
|
||||
{
|
||||
float sqrLength, invLength;
|
||||
|
||||
sqrLength = x * x + y * y + z * z + w * w;
|
||||
invLength = idMath::RSqrt( sqrLength );
|
||||
x *= invLength;
|
||||
y *= invLength;
|
||||
z *= invLength;
|
||||
w *= invLength;
|
||||
return invLength * sqrLength;
|
||||
}
|
||||
|
||||
ID_INLINE int idVec4i::GetDimension( void ) const
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
ID_INLINE const uint8* idVec4i::ToIntPtr( void ) const
|
||||
{
|
||||
return &x;
|
||||
}
|
||||
|
||||
ID_INLINE uint8* idVec4i::ToIntPtr( void )
|
||||
{
|
||||
return &x;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue