5,391
edits
m (I don't agree.) |
m (reveni revidi) |
||
Line 1: | Line 1: | ||
<font color=red>Answers are in red.</font> | <font color=red>Answers are in red.</font> | ||
<small>Mine are in small print.</small> | |||
Line 163: | Line 165: | ||
:Feel free to edit types out, but keep a copy in "discussion". <font color=red>??? Why ??? I only try to change the design. Plus wiki saves the original wiki code.</font> | :Feel free to edit types out, but keep a copy in "discussion". <font color=red>??? Why ??? I only try to change the design. Plus wiki saves the original wiki code.</font> | ||
::[[User:Geyser|geyser]] 01:30, 5 September 2007 (CEST) | ::[[User:Geyser|geyser]] 01:30, 5 September 2007 (CEST) | ||
---- | |||
---- | |||
---- | |||
<small> | |||
:From the bottom: | |||
:Please have a look at [[OBD:Data_types]]. It is very much like the "help page for the types" you suggest. | |||
:It needs some general remarks about [[wikipedia:Little_Endian|Little Endian]], as well as specific notes about the [[wikipedia:IEEE_float|IEEE floats]] etc. | |||
:That's also where you'd have remarks on the level and resource ID format (low-byte 01, name hash, etc). | |||
::(for example, note that the level ID in level0_Tools.dat is DD 01 00 00 instead of 01 00 00 00) | |||
:If you object to aggregate types (or rather, ''since'' you object to aggregate types), feel free to remove them. | |||
:(I meant trimming the complete list in [[OBD:Data_types]]; nothing to do with your update of file type pages) | |||
:However, please back up the full collection of types in [[OBD_talk:Data_types]], for convenient reference. | |||
::[[User:Geyser|geyser]] 00:59, 6 September 2007 (CEST) | |||
:About aggregate types: | |||
:Since you are going to explain basic types in detail on a "help page", why not explain aggregate types, too? | |||
:Vectors, matrices and quaternions are very common objects in 3D graphics, so they will make immediate sense. | |||
:The matrix/vector/quaternion form is explicitly shown in the '''Raw hex''' and '''Value''' columns: no confusion possible. | |||
::In the [[OBAN]] example, it's easy to see that vectors, matrices and quaternions are structured groups of floats. | |||
::If people don't know what a vector, a matrix or a quaternion is, they'll see the structure in the '''Value''' column. | |||
::They'll see that they're bunches of floating-point values, and if they want more details, there's the help page. | |||
::As for the '''Description''' column, it will still explain the ''actual'' role of the vector, matrix, plane or quaternion. | |||
::Just as you don't detail the format of every float bit-by-bit, you shouldn't have to break down vectors etc... | |||
:You don't have to agree, but IMO the '''Description''' column should describe the actual ''function'' of the data. | |||
:As for the ''nature'' of the data, it should be clear from the other three columns: '''Type''', '''Raw Hex''' and '''Value'''. | |||
::[[User:Geyser|geyser]] 00:59, 6 September 2007 (CEST) | |||
:About union integer types (funny integers and bitfields): | |||
:bool32 and bool16 are indeed misleading: bool1[16] and bool1[32] are better. Another solution is flags16 and flags32. | |||
:However, int31flags1 will look weird, so for the indices with a high bit I'd recommend int31bool1 or (better) int31int1. | |||
:That would be consistent with int9int9int9int5, int12int20 and int8int24 in [[OTLF]]. And flags16 and flags32. There. | |||
::As for the signed-unsigned ambiguity, most of Oni's integers are positive and small, so there is no difference. | |||
::Some of them are expicitly signed (e.g., whenever -1 is allowed), but the rest of the time it doesn't matter. | |||
:So the above union types should actually be uint31uint1, uint9uint9uint9uint5, uint12uint20 and uint8uint24... | |||
:But since there are very few signed integers in Oni, I'd just drop the "u" and disambiguate when necessary. | |||
:Another option is to have "int" for usual integers (unsigned) and enum8, enum16, enum32 for IDs (signed). | |||
::[[User:Geyser|geyser]] 00:59, 6 September 2007 (CEST) | |||
:About the "creepy [[OBAN]] table": | |||
:There's no arguing that "An overview table is not the same as a code snippet." | |||
:However, note that both are structures meant to define/describe the data format. | |||
:As an intermediate structure, you have the OUP "structdefs". So, not the same? | |||
:If you add comments to a C-style structure definition, you get an OBD table: | |||
typedef struct ObjectAnimationKeyframe { // element of the array in OBAN | |||
Quaternion rotation; // 0x00 // rotation of the object (applied after fixed matrix) | |||
Vector position; // 0x10 // absolute position of the object in the world | |||
short time; // 0x1C // keyframe time in frames (60 frames in a second) | |||
}; | |||
typedef struct OBAN { | |||
char[16] blank_space; // 0x00 // used for pointers at runtime | |||
Matrix transform_initial; // 0x10 // initial transform matrix (before animation) | |||
Matrix transform_fixed; // 0x40 // fixed transform matrix (e.g., scaling) | |||
short shpadoinkle1; // 0x70 // I wonder what this button does... | |||
short frames; // 0x72 // object animation length, in frames | |||
short shpadoinkle2; // 0x74 // I wonder what *this* button does, too... | |||
short n_keyframes; // 0x76 // number of keyframes in array | |||
ObjectAnimationKeyframe[n_keyframes] keyframes; // 0x78 // array of keyframes | |||
} | |||
:And since my point about vectors, matrix and quaternions was out of context: | |||
:I claim that variant #1 below is much more tidy and readable than variant #2. | |||
::;1. Using aggregate types | |||
{{Table}} | |||
{{OBD Table Header}} | |||
{{OBDtr|0x00|res_id|FF0000|01 '''86 00 00'''|134|00134-Blackvan_FB.OBAN}} | |||
{{OBDtr|0x04|lev_id|FFFF00|01 00 00 '''06'''|3 |level 3}} | |||
{{OBDtr|0x08|blank[16]|00FF00|00 00 00 00 |0 |blank filler}} | |||
|- ALIGN=CENTER VALIGN=TOP | |||
|0x18||matrix|| | |||
{|border=1 cellspacing=0 style="white-space:nowrap" | |||
|-BGCOLOR="#FFC8C8" | |||
|C2 F5 E8 3F||AB D7 AA B3||EC 89 13 35 | |||
|-BGCOLOR="#FFFFC8" | |||
|EC 89 13 35||ED 89 13 B4||C2 F5 E8 BF | |||
|-BGCOLOR="#C8FFC8" | |||
|B1 D7 AA 33||C2 F5 E8 3F||EB 89 13 B4 | |||
|-BGCOLOR="#C8FFFF" | |||
|6B 9A 94 44||97 FD 5B C2||5D 06 DA C2 | |||
|} | |||
| | |||
{|border=1 cellspacing=0 style="white-space:nowrap" | |||
|1.819999||-7.955471e-8||5.496247e-7 | |||
|- | |||
|5.496247e-7||-1.374061e-7||-1.819999 | |||
|- | |||
|7.955475e-8||1.819999||-1.374061e-7 | |||
|- | |||
|1188.825561||-54.997646||-109.012428 | |||
|} | |||
|ALIGN=LEFT|initial position transform matrix | |||
|- ALIGN=CENTER VALIGN=TOP | |||
|0x48||matrix|| | |||
{|border=1 cellspacing=0 style="white-space:nowrap" | |||
|-BGCOLOR="#FFC8FF" | |||
|C2 F5 E8 3F||00 00 00 00||00 00 00 00 | |||
|-BGCOLOR="#FFC800" | |||
|00 00 00 00||C2 F5 E8 3F||00 00 00 00 | |||
|-BGCOLOR="#C800C8" | |||
|00 00 00 00||00 00 00 00||C2 F5 E8 3F | |||
|-BGCOLOR="#C87C64" | |||
|00 00 00 00||00 00 00 00||00 00 00 00 | |||
|} | |||
| | |||
{|border=1 cellspacing=0 style="white-space:nowrap" | |||
|1.819999||0.0||0.0 | |||
|- | |||
|0.0||1.819999||0.0 | |||
|- | |||
|0.0||0.0||1.819999 | |||
|- | |||
|0.0||0.0||0.0 | |||
|} | |||
| ALIGN=LEFT | fixed transform matrix | |||
{{OBDtr|0x78|int16|B0C3D4|50 00|80 |unknown}} | |||
{{OBDtr|0x7A|int16|E7CEA5|F5 01|501 |animation length in frames}} | |||
{{OBDtr|0x7C|int16|FFDDDD|00 00|0 |unknown}} | |||
{{OBDtr|0x7E|int16|64AAAA|65 00|10 |101 keyframes in array}} | |||
{{OBDtrBK|First keyframe (black outline)}} | |||
|- ALIGN=CENTER VALIGN=TOP | |||
|0x00||quaternion|| | |||
{|border=1 cellspacing=0 style="white-space:nowrap" | |||
|-BGCOLOR="#EBEBEB" | |||
| F4 04 35 BF||6A 19 C4 B3||CE 3C 03 B4||F3 04 35 BF | |||
|} | |||
| | |||
{|border=1 cellspacing=0 style="white-space:nowrap" | |||
| -0.7071068|| -9.131584e-8|| -1.222244e-7|| -0.7071067 | |||
|} | |||
|ALIGN=LEFT|object rotation | |||
|- ALIGN=CENTER VALIGN=TOP | |||
|0x10||vector|| | |||
{|border=1 cellspacing=0 style="white-space:nowrap" | |||
|-BGCOLOR="#8C8CCC" | |||
|C2 F5 E8 3F||AB D7 AA B3||EC 89 13 35 | |||
|} | |||
| | |||
{|border=1 cellspacing=0 style="white-space:nowrap" | |||
|1188.825561||-54.997646||-109.012428 | |||
|} | |||
|ALIGN=LEFT|object position | |||
{{OBDtr|0x1C|int32|FF00C8|00 00 00 00 |0 |elapsed time in frames}} | |||
|} | |||
::;2. Without aggregate types | |||
{{Table}} | |||
{{OBD Table Header}} | |||
{{OBDtr|0x00|res_id|FF0000|01 '''86 00 00'''|134|00134-Blackvan_FB.OBAN}} | |||
{{OBDtr|0x04|lev_id|FFFF00|01 00 00 '''06'''|3 |level 3}} | |||
{{OBDtr|0x08|blank[16]|00FF00|00 00 00 00 |0 |blank filler}} | |||
{{OBDtr|0x18|float|FFC8C8|C2 F5 E8 3F|1.819999|m11 element of the initial position transform matrix}} | |||
{{OBDtr|0x1C|float|FFC8C8|AB D7 AA B3|-7.955471e-8|m21 element of the initial position transform matrix}} | |||
{{OBDtr|0x20|float|FFC8C8|EC 89 13 35|5.496247e-7|m31 element of the initial position transform matrix}} | |||
{{OBDtr|0x24|float|FFFFC8|EC 89 13 35|5.496247e-7|m12 element of the initial position transform matrix}} | |||
{{OBDtr|0x28|float|FFFFC8|ED 89 13 B4|-1.374061e-7|m22 element of the initial position transform matrix}} | |||
{{OBDtr|0x2C|float|FFFFC8|C2 F5 E8 BF|-1.819999|m32 element of the initial position transform matrix}} | |||
{{OBDtr|0x30|float|C8FFC8|B1 D7 AA 33|7.955475e-8|m13 element of the initial position transform matrix}} | |||
{{OBDtr|0x34|float|C8FFC8|C2 F5 E8 3F|1.819999|m23 element of the initial position transform matrix}} | |||
{{OBDtr|0x38|float|C8FFC8|EB 89 13 B4|-1.374061e-7|m33 element of the initial position transform matrix}} | |||
{{OBDtr|0x3C|float|C8FFFF|6B 9A 94 44|1188.825561|m14 element of the initial position transform matrix}} | |||
{{OBDtr|0x40|float|C8FFFF|97 FD 5B C2|-54.997646|m24 element of the initial position transform matrix}} | |||
{{OBDtr|0x44|float|C8FFFF|5D 06 DA C2|-109.012428|m34 element of the initial position transform matrix}} | |||
{{OBDtr|0x48|float|FFC8FF|C2 F5 E8 3F|1.819999|m11 element of the fixed position transform matrix}} | |||
{{OBDtr|0x4C|float|FFC8FF|00 00 00 00|0.0|m21 element of the fixed position transform matrix}} | |||
{{OBDtr|0x50|float|FFC8FF|00 00 00 00|0.0|m31 element of the fixed position transform matrix}} | |||
{{OBDtr|0x54|float|FFC800|00 00 00 00|0.0|m12 element of the fixed position transform matrix}} | |||
{{OBDtr|0x58|float|FFC800|C2 F5 E8 3F|1.819999|m22 element of the fixed position transform matrix}} | |||
{{OBDtr|0x5C|float|FFC800|00 00 00 00|0.0|m32 element of the fixed position transform matrix}} | |||
{{OBDtr|0x60|float|C800C8|00 00 00 00|0.0|m13 element of the fixed position transform matrix}} | |||
{{OBDtr|0x64|float|C800C8|00 00 00 00|0.0|m23 element of the fixed position transform matrix}} | |||
{{OBDtr|0x68|float|C800C8|C2 F5 E8 3F|1.819999|m33 element of the fixed position transform matrix}} | |||
{{OBDtr|0x6C|float|C87C64|00 00 00 00|0.0|m14 element of the fixed position transform matrix}} | |||
{{OBDtr|0x70|float|C87C64|00 00 00 00|0.0|m24 element of the fixed position transform matrix}} | |||
{{OBDtr|0x74|float|C87C64|00 00 00 00|0.0|m34 element of the fixed position transform matrix}} | |||
{{OBDtr|0x78|int16|B0C3D4|50 00|80 |unknown}} | |||
{{OBDtr|0x7A|int16|E7CEA5|F5 01|501 |animation length in frames}} | |||
{{OBDtr|0x7C|int16|FFDDDD|00 00|0 |unknown}} | |||
{{OBDtr|0x7E|int16|64AAAA|65 00|10 |101 keyframes in array}} | |||
{{OBDtrBK|First keyframe (black outline)}} | |||
{{OBDtr|0x00|float|EBEBEB| F4 04 35 BF| -0.7071068 | x-value of the rotation quaternion}} | |||
{{OBDtr|0x04|float|EBEBEB| 6A 19 C4 B3| -9.131584e-8 | y-value of the rotation quaternion}} | |||
{{OBDtr|0x08|float|EBEBEB| CE 3C 03 B4| -1.222244e-7 | z-value of the rotation quaternion}} | |||
{{OBDtr|0x0C|float|EBEBEB| F3 04 35 BF| -0.7071067 | w-value of the rotation quaternion}} | |||
{{OBDtr|0x10|float|8C8CCC| 6B 9A 94 44| 1188.825561 | x-position}} | |||
{{OBDtr|0x14|float|8C8CCC| 97 FD 5B C2| -54.997646 | y-position (height)}} | |||
{{OBDtr|0x18|float|8C8CCC| 5D 06 DA C2| -109.012428 | z-position}} | |||
{{OBDtr|0x1C|int32|FF00C8| 00 00 00 00| 0 | elapsed time in frames}} | |||
|} | |||
:There. | |||
:If you say loud and clear "variant #2 is nicer", I won't even try to argue. | |||
:We don't have to agree on that matter and I'm quite happy either way. | |||
::[[User:Geyser|geyser]] 00:59, 6 September 2007 (CEST) | |||
</small> | |||
<!-- please don't delete this | <!-- please don't delete this | ||
http://14mb.de/u/ccc/botright.gif | http://14mb.de/u/ccc/botright.gif | ||
--> | --> |