Common Types: Difference between revisions

From wowdev
Jump to navigation Jump to search
(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,...")
 
mNo edit summary
Line 3: Line 3:
A reference into a [[DBC]] or [[DB2]] database file. E.g.
A reference into a [[DBC]] or [[DB2]] database file. E.g.


  foreign_key<uint16_t, &[[LiquidType.dbc|LiquidTypeRec::m_ID]]> liquid_type;
  {{Template:Type/foreign_key|type=uint16_t|table=LiquidType|column=m_spellID}} liquid_spell_id;
             ^ type of reference
             ^ type of reference
                         ^ table referenced
                         ^ table referenced

Revision as of 22:40, 8 February 2016

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_spellID> liquid_spell_id;
            ^ 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)); }
};