Common Types

From wowdev
Revision as of 16:11, 6 February 2016 by Schlumpf (talk | contribs) (Created page with "This page lists types commonly used in WoW, but not specific to a file format. =foreign_key= A reference into a DBC or DB2 database file. E.g. foreign_key<uint16_t,...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

This page lists types commonly used in WoW, but not specific to a file format.

foreign_key

A reference into a DBC or DB2 database file. E.g.

foreign_key<uint16_t, &LiquidTypeRec::m_ID> liquid_type;
            ^ type of reference
                       ^ table referenced
                                      ^ variable referenced

C2Vector

A two component float vector.

struct C2Vector
{
  float x;
  float y;
};

C3Vector

A three component float vector.

struct C3Vector
{
  float x;
  float y;
  float z;
};

C4Vector

A four component float vector.

struct C4Vector
{
  float x;
  float y;
  float z;
  float w;
};

C33Matrix

A three by three matrix.

struct C33Matrix // todo: row or column?
{
  C3Vector columns[3];
};

C44Matrix

A four by four matrix.

struct C44Matrix // todo: row or column?
{
  C4Vector columns[4];
};

C4Plane

A 3D plane defined by four floats.

struct C4Plane // todo: verify
{
  C3Vector normal;
  float distance;
};

C4Quaternion

A quaternion.

struct C4Quaternioin
{
  float x;
  float y;
  float z;
  float w; // todo: w first?
};

CAaBox

An axis aligned box described by the minimum and maximum point.

struct CAaBox
{
  C3Vector min;
  C3Vector max;
};

CAaSphere

An axis aligned sphere described by position and radius.

struct CAaSphere
{
  C3Vector position;
  float radius;
};

CArgb

A color given in values of red, green, blue and alpha. Either

using CArgb = uint32_t;

or

struct CArgb // todo: verify, add CRgba, ..?
{
  unsigned char r;
  unsigned char g;
  unsigned char b;
  unsigned char a;
};

fixed_point

A fixed point real number, opposed to a floating point.

template<typename Base, size_t integer_bits, size_t decimal_bits> struct fixed_point
{
  Base decimal : decimal_bits;
  Base integer : integer_bits;
  Base sign : 1;
  float to_float() const { return (sign ? -1.0f : 1.0f) * (integer + decimal / float (1 << decimal_bits)); }
};