Common Types: Difference between revisions
mNo edit summary |
m (→langstringref) |
||
(12 intermediate revisions by 4 users not shown) | |||
Line 7: | Line 7: | ||
^ table referenced | ^ table referenced | ||
^ variable referenced | ^ variable referenced | ||
=stringref= | |||
A reference into the string block of a [[DBC]] or [[DB2]] database file. See [[DBC#String_Block]]. | |||
using stringref = uint32_t; | |||
==langstringref== | |||
A field for localized strings, consisting of an array of stringrefs followed by a field of flags. The amount of language entries depends on the version, with Cataclysm dropping all but the client's language. See [[Localization]] for details. | |||
struct langstringref | |||
{ | |||
//! \todo verify that pre-wotlk locales hadn't changed | |||
#if {{Template:Sandbox/VersionRange|max_expansionlevel=4|max_exclusive=1}} | |||
stringref enUS; // also enGB | |||
stringref koKR; | |||
stringref frFR; | |||
stringref deDE; | |||
stringref enCN; // also zhCN | |||
stringref enTW; // also zhTW | |||
stringref esES; | |||
stringref esMX; | |||
#if {{Template:Sandbox/VersionRange|min_expansionlevel=3}} | |||
stringref ruRU; | |||
stringref unknown_9; | |||
stringref ptPT; // also ptBR | |||
stringref itIT; | |||
stringref unknown_12; | |||
stringref unknown_13; | |||
stringref unknown_14; | |||
stringref unknown_15; | |||
#endif | |||
uint32_t flags; | |||
#else | |||
stringref client_locale; | |||
#endif | |||
}; | |||
=C2Vector= | =C2Vector= | ||
A two component float vector. | A two component float vector. | ||
Line 35: | Line 68: | ||
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 74: | ||
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 80: | ||
struct C4Plane // todo: verify | struct C4Plane // todo: verify | ||
{ | { | ||
C3Vector normal; | {{Template:Type|C3Vector}} normal; | ||
float distance; | float distance; | ||
}; | }; | ||
Those 4 floats are ''a, b, c, d'' variables from [https://en.wikipedia.org/wiki/Plane_(geometry)#Point-normal_form_and_general_form_of_the_equation_of_a_plane General form of the equation of a plane] | |||
=C4Quaternion= | =C4Quaternion= | ||
A quaternion. | A quaternion. | ||
struct | struct C4Quaternion | ||
{ | { | ||
float x; | float x; | ||
float y; | float y; | ||
float z; | float z; | ||
float w; // | float w; // Unlike Quaternions elsewhere, the scalar part ('w') is the last element in the struct instead of the first | ||
}; | |||
=CRange= | |||
A one dimensional range defined by the bounds. | |||
struct Range | |||
{ | |||
float min; | |||
float max; | |||
}; | }; | ||
=CAaBox= | =CAaBox= | ||
Line 63: | Line 107: | ||
struct CAaBox | struct CAaBox | ||
{ | { | ||
C3Vector min; | {{Template:Type|C3Vector}} min; | ||
C3Vector max; | {{Template:Type|C3Vector}} max; | ||
}; | }; | ||
=CAaSphere= | =CAaSphere= | ||
Line 70: | Line 114: | ||
struct CAaSphere | struct CAaSphere | ||
{ | { | ||
C3Vector position; | {{Template:Type|C3Vector}} position; | ||
float radius; | float radius; | ||
}; | }; | ||
Line 83: | Line 127: | ||
unsigned char b; | unsigned char b; | ||
unsigned char a; | unsigned char a; | ||
}; | |||
=CImVector= | |||
A color given in values of blue, green, red and alpha | |||
struct CImVector | |||
{ | |||
unsigned char b; | |||
unsigned char g; | |||
unsigned char r; | |||
unsigned char a; | |||
}; | |||
=C3sVector= | |||
A three component vector of shorts. | |||
struct C3sVector | |||
{ | |||
int16_t x; | |||
int16_t y; | |||
int16_t z; | |||
}; | }; | ||
=fixed_point= | =fixed_point= | ||
Line 93: | Line 155: | ||
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, 15>; |
Revision as of 20:37, 6 August 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
stringref
A reference into the string block of a DBC or DB2 database file. See DBC#String_Block.
using stringref = uint32_t;
langstringref
A field for localized strings, consisting of an array of stringrefs followed by a field of flags. The amount of language entries depends on the version, with Cataclysm dropping all but the client's language. See Localization for details.
struct langstringref { //! \todo verify that pre-wotlk locales hadn't changed #if < stringref enUS; // also enGB stringref koKR; stringref frFR; stringref deDE; stringref enCN; // also zhCN stringref enTW; // also zhTW stringref esES; stringref esMX; #if ≥ stringref ruRU; stringref unknown_9; stringref ptPT; // also ptBR stringref itIT; stringref unknown_12; stringref unknown_13; stringref unknown_14; stringref unknown_15; #endif uint32_t flags; #else stringref client_locale; #endif };
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; };
Those 4 floats are a, b, c, d variables from General form of the equation of a plane
C4Quaternion
A quaternion.
struct C4Quaternion { float x; float y; float z; float w; // Unlike Quaternions elsewhere, the scalar part ('w') is the last element in the struct instead of the 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; };
CImVector
A color given in values of blue, green, red and alpha
struct CImVector { unsigned char b; unsigned char g; unsigned char r; unsigned char a; };
C3sVector
A three component vector of shorts.
struct C3sVector { int16_t x; int16_t y; int16_t z; };
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, 15>;