TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
G3D::Vector4int8 Class Reference

#include <Vector4int8.h>

Public Member Functions

 Vector4int8 ()
 
 Vector4int8 (const Vector4 &source)
 
 Vector4int8 (const Vector3 &source, int8 w)
 
 Vector4int8 (int8 x, int8 y, int8 z, int8 w)
 
 Vector4int8 (class BinaryInput &b)
 
void serialize (class BinaryOutput &b) const
 
void deserialize (class BinaryInput &b)
 
 operator int8 * ()
 
 operator const int8 * () const
 
int8operator[] (int i)
 
const int8operator[] (int i) const
 
Vector4int8operator= (const Vector4int8 &other)
 
bool operator== (const Vector4int8 &other) const
 
bool operator!= (const Vector4int8 &other) const
 
unsigned int hashCode () const
 

Public Attributes

int8 x
 
int8 y
 
int8 z
 
int8 w
 

Private Member Functions

bool operator< (const Vector4int8 &) const
 
bool operator> (const Vector4int8 &) const
 
bool operator<= (const Vector4int8 &) const
 
bool operator>= (const Vector4int8 &) const
 
uint32asInt32 ()
 
const uint32asInt32 () const
 

Detailed Description

Homogeneous vector stored efficiently in four signed int8s.

Constructor & Destructor Documentation

G3D::Vector4int8::Vector4int8 ( )
inline
51 : x(0), y(0), z(0), w(0) {}
int8 x
Definition: Vector4int8.h:66
int8 y
Definition: Vector4int8.h:66
int8 w
Definition: Vector4int8.h:66
int8 z
Definition: Vector4int8.h:66
G3D::Vector4int8::Vector4int8 ( const Vector4 source)
explicit

Multiplies the source by 127 and clamps to (-128, 127) when converting

25  {
26  x = iClamp(iRound(source.x), -128, 127);
27  y = iClamp(iRound(source.y), -128, 127);
28  z = iClamp(iRound(source.z), -128, 127);
29  w = iClamp(iRound(source.w), -128, 127);
30 }
int8 x
Definition: Vector4int8.h:66
int iRound(double fValue)
Definition: g3dmath.h:226
int8 y
Definition: Vector4int8.h:66
int iClamp(int val, int low, int hi)
Definition: g3dmath.h:545
int8 w
Definition: Vector4int8.h:66
int8 z
Definition: Vector4int8.h:66

+ Here is the call graph for this function:

G3D::Vector4int8::Vector4int8 ( const Vector3 source,
int8  w 
)
explicit

Multiplies the source by 127 and clamps to (-128, 127) when converting

32  : w(w) {
33  x = iClamp(iRound(source.x), -128, 127);
34  y = iClamp(iRound(source.y), -128, 127);
35  z = iClamp(iRound(source.z), -128, 127);
36 }
int8 x
Definition: Vector4int8.h:66
int iRound(double fValue)
Definition: g3dmath.h:226
int8 y
Definition: Vector4int8.h:66
int iClamp(int val, int low, int hi)
Definition: g3dmath.h:545
int8 w
Definition: Vector4int8.h:66
int8 z
Definition: Vector4int8.h:66

+ Here is the call graph for this function:

G3D::Vector4int8::Vector4int8 ( int8  x,
int8  y,
int8  z,
int8  w 
)
inline
59 : x(x), y(y), z(z), w(w) {}
int8 x
Definition: Vector4int8.h:66
int8 y
Definition: Vector4int8.h:66
int8 w
Definition: Vector4int8.h:66
int8 z
Definition: Vector4int8.h:66
G3D::Vector4int8::Vector4int8 ( class BinaryInput b)
explicit
38  {
39  deserialize(b);
40 }
void deserialize(class BinaryInput &b)
Definition: Vector4int8.cpp:50

+ Here is the call graph for this function:

Member Function Documentation

uint32& G3D::Vector4int8::asInt32 ( )
inlineprivate

For fast operations, treat this packed data structure as an int32

41  {
42  return *reinterpret_cast<uint32*>(this);
43  }
uint32_t uint32
Definition: Define.h:150

+ Here is the caller graph for this function:

const uint32& G3D::Vector4int8::asInt32 ( ) const
inlineprivate
45  {
46  return *reinterpret_cast<const uint32*>(this);
47  }
uint32_t uint32
Definition: Define.h:150
void G3D::Vector4int8::deserialize ( class BinaryInput b)
50  {
51  x = b.readInt8();
52  y = b.readInt8();
53  z = b.readInt8();
54  w = b.readInt8();
55 }
int8 x
Definition: Vector4int8.h:66
int8 y
Definition: Vector4int8.h:66
int8 w
Definition: Vector4int8.h:66
int8 z
Definition: Vector4int8.h:66

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

unsigned int G3D::Vector4int8::hashCode ( ) const
inline
105  {
106  return asInt32();
107  }
uint32 & asInt32()
Definition: Vector4int8.h:41

+ Here is the call graph for this function:

G3D::Vector4int8::operator const int8 * ( ) const
inline
72  {
73  return reinterpret_cast<const int8*>(this);
74  }
int8_t int8
Definition: Define.h:148
G3D::Vector4int8::operator int8 * ( )
inline
68  {
69  return reinterpret_cast<int8*>(this);
70  }
int8_t int8
Definition: Define.h:148
bool G3D::Vector4int8::operator!= ( const Vector4int8 other) const
inline
101  {
102  return ! (*this == other);
103  }
bool G3D::Vector4int8::operator< ( const Vector4int8 ) const
private
bool G3D::Vector4int8::operator<= ( const Vector4int8 ) const
private
Vector4int8& G3D::Vector4int8::operator= ( const Vector4int8 other)
inline
92  {
93  asInt32() = other.asInt32();
94  return *this;
95  }
uint32 & asInt32()
Definition: Vector4int8.h:41

+ Here is the call graph for this function:

bool G3D::Vector4int8::operator== ( const Vector4int8 other) const
inline
97  {
98  return asInt32() == other.asInt32();
99  }
uint32 & asInt32()
Definition: Vector4int8.h:41

+ Here is the call graph for this function:

bool G3D::Vector4int8::operator> ( const Vector4int8 ) const
private
bool G3D::Vector4int8::operator>= ( const Vector4int8 ) const
private
int8& G3D::Vector4int8::operator[] ( int  i)
inline
81  {
82  debugAssert(i >= 0 && i <= 4);
83  return ((int8*)this)[i];
84  }
int8_t int8
Definition: Define.h:148
#define debugAssert(exp)
Definition: debugAssert.h:160
const int8& G3D::Vector4int8::operator[] ( int  i) const
inline
86  {
87  debugAssert(i >= 0 && i <= 4);
88  return ((const int8*)this)[i];
89  }
int8_t int8
Definition: Define.h:148
#define debugAssert(exp)
Definition: debugAssert.h:160
void G3D::Vector4int8::serialize ( class BinaryOutput b) const
42  {
43  // Intentionally write individual bytes to avoid endian issues
44  b.writeInt8(x);
45  b.writeInt8(y);
46  b.writeInt8(z);
47  b.writeInt8(w);
48 }
int8 x
Definition: Vector4int8.h:66
int8 y
Definition: Vector4int8.h:66
int8 w
Definition: Vector4int8.h:66
int8 z
Definition: Vector4int8.h:66

+ Here is the call graph for this function:

Member Data Documentation

int8 G3D::Vector4int8::w
int8 G3D::Vector4int8::x
int8 G3D::Vector4int8::y
int8 G3D::Vector4int8::z

The documentation for this class was generated from the following files: