Common Types: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
mNo edit summary |
||
Line 35: | Line 35: | ||
struct C33Matrix // todo: row or column? | struct C33Matrix // todo: row or column? | ||
{ | { | ||
C3Vector columns[3]; | {{Template:Type|C3Vector}} columns[3]; | ||
}; | }; | ||
=C44Matrix= | =C44Matrix= | ||
Line 41: | Line 41: | ||
struct C44Matrix // todo: row or column? | struct C44Matrix // todo: row or column? | ||
{ | { | ||
C4Vector columns[4]; | {{Template:Type|C4Vector}} columns[4]; | ||
}; | }; | ||
=C4Plane= | =C4Plane= | ||
Line 47: | Line 47: | ||
struct C4Plane // todo: verify | struct C4Plane // todo: verify | ||
{ | { | ||
C3Vector normal; | {{Template:Type|C3Vector}} normal; | ||
float distance; | float distance; | ||
}; | }; | ||
Line 70: | Line 70: | ||
struct CAaBox | struct CAaBox | ||
{ | { | ||
C3Vector min; | {{Template:Type|C3Vector}} min; | ||
C3Vector max; | {{Template:Type|C3Vector}} max; | ||
}; | }; | ||
=CAaSphere= | =CAaSphere= | ||
Line 77: | Line 77: | ||
struct CAaSphere | struct CAaSphere | ||
{ | { | ||
C3Vector position; | {{Template:Type|C3Vector}} position; | ||
float radius; | float radius; | ||
}; | }; | ||
Line 100: | Line 100: | ||
float to_float() const { return (sign ? -1.0f : 1.0f) * (integer + decimal / float (1 << decimal_bits)); } | float to_float() const { return (sign ? -1.0f : 1.0f) * (integer + decimal / float (1 << decimal_bits)); } | ||
}; | }; | ||
=fixed16= | |||
A fixed point number without integer part. | |||
using fixed16 = short; // divide by 0x7fff to get float value | |||
or semantically (0 is not a valid bit size in bitfields) equivalent to | |||
using fixed16 = {{Template:Type|fixed_point}}<uint16_t, 0, 16>; |
Revision as of 13:05, 21 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? };
CRange
A one dimensional range defined by the bounds.
struct Range { float min; float max; };
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)); } };
fixed16
A fixed point number without integer part.
using fixed16 = short; // divide by 0x7fff to get float value
or semantically (0 is not a valid bit size in bitfields) equivalent to
using fixed16 = fixed_pointⁱ<uint16_t, 0, 16>;