Difference between revisions of "Template:NW4FCurve"
(→Curve: Key array is aligned by 4 bytes aswell) |
(Elements per key, I actually described it at the bottom already but I got rid of the redundance now.) |
||
Line 7: | Line 7: | ||
|- | |- | ||
| 0x00 || 2 || UInt16 || '''Flags'''. Sets of bits packed as '''xxxxxxxx xCCCKKFF'''. | | 0x00 || 2 || UInt16 || '''Flags'''. Sets of bits packed as '''xxxxxxxx xCCCKKFF'''. | ||
− | * '''FF''' determines the data type of frames in the ''Frame array'', and '''KK''' determines the data type of keys in the ''Key array''. They both map to the same flags. | + | * '''FF''' determines the data type of frames in the ''Frame array'', and '''KK''' determines the data type of keys in the ''Key array''. They both map to the same relative flags. |
{| class="wikitable" | {| class="wikitable" | ||
− | ! Value !! | + | ! Value !! Size !! Type |
|- | |- | ||
− | | 0 || | + | | 0 || 4 || Single |
|- | |- | ||
− | | 1 || | + | | 1 || 2 || Int16 |
|- | |- | ||
− | | 2 || | + | | 2 || 1 || Byte |
|} | |} | ||
− | * '''CCC''' determines what kind of curve data is stored. | + | * '''CCC''' determines what kind of curve data is stored, resulting in a different number of elements stored per Key. The exact meaning on how to interprete these values is unknown, they are apparently used to set the interpolation method from one key to the next. |
{| class="wikitable" | {| class="wikitable" | ||
− | ! Value !! Description !! | + | ! Value !! Description !! Elements per Key |
|- | |- | ||
− | | 0 || Cubic Single || 4 | + | | 0 || Cubic Single || 4 |
|- | |- | ||
− | | 1 || Linear Single || 2 | + | | 1 || Linear Single || 2 |
|- | |- | ||
− | | 2 || Baked Single || 1 | + | | 2 || Baked Single || 1 |
|- | |- | ||
− | | 4 || Step Integer || 1 | + | | 4 || Step Integer || 1 |
|- | |- | ||
− | | 5 || Baked Integer || | + | | 5 || Baked Integer || 1 |
|- | |- | ||
− | | 6 || Step Boolean || | + | | 6 || Step Boolean || 1 |
|- | |- | ||
− | | 7 || Baked Boolean || | + | | 7 || Baked Boolean || 1 |
|} | |} | ||
|- | |- | ||
Line 73: | Line 73: | ||
=== Keys === | === Keys === | ||
− | The Curve header points to a Key array which stores the values to apply on transformations or parameters which form the animation. Thus, the array has as many elements as specified in ''Key count'' | + | The Curve header points to a Key array which stores the values to apply on transformations or parameters which form the animation. Thus, the array has as many elements as specified in ''Key count'', multiplied by the number of elements stored per key (depended upon the CCC Curve Type bits in the Curve ''Flags'' as described above). The type of each element is given by the KK Key Type bits in the Curve ''Flags''. |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | The type of | ||
The end of the array is aligned to 4 bytes. | The end of the array is aligned to 4 bytes. |
Revision as of 14:04, 6 June 2017
Curve
Curves store how animations are performed over time and store the required keys and values for this. They appear in multiple animation subfiles, and their header is of 0x20 bytes size (for BFRES versions earlier than 3.4.0.0, they are of 0x1C bytes size).
Offset | Size | Type | Description | ||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0x00 | 2 | UInt16 | Flags. Sets of bits packed as xxxxxxxx xCCCKKFF.
| ||||||||||||||||||||||||||||||||||||
0x02 | 2 | UInt16 | Key count. | ||||||||||||||||||||||||||||||||||||
0x04 | 4 | UInt32 | Target type. Controls what exactly is manipulated by the curve. Differs in each subfile. | ||||||||||||||||||||||||||||||||||||
0x08 | 4 | Single | Start frame. | ||||||||||||||||||||||||||||||||||||
0x0C | 4 | Single | End frame. | ||||||||||||||||||||||||||||||||||||
0x10 | 4 | Int32 / Single | Data scale. | ||||||||||||||||||||||||||||||||||||
if BFRES version >= 3.4.0.0 | |||||||||||||||||||||||||||||||||||||||
0x14 | 4 | Single | Data delta. | ||||||||||||||||||||||||||||||||||||
0x18 | 4 | Int32 | Frame array offset. | ||||||||||||||||||||||||||||||||||||
0x1C | 4 | Int32 | Key array offset. | ||||||||||||||||||||||||||||||||||||
0x20 | End of Curve | ||||||||||||||||||||||||||||||||||||||
else | |||||||||||||||||||||||||||||||||||||||
0x14 | 4 | Int32 | Frame array offset. | ||||||||||||||||||||||||||||||||||||
0x18 | 4 | Int32 | Key array offset. | ||||||||||||||||||||||||||||||||||||
0x1C | End of Curve |
Frames
The Curve header points to a Frame array which stores values controlling at which frame a Key from the Key array is placed. Thus, the array has as many elements as specified in Key count. The data type of the frames is given in the Curve's Flags.
The end of the array is aligned to 4 bytes.
Keys
The Curve header points to a Key array which stores the values to apply on transformations or parameters which form the animation. Thus, the array has as many elements as specified in Key count, multiplied by the number of elements stored per key (depended upon the CCC Curve Type bits in the Curve Flags as described above). The type of each element is given by the KK Key Type bits in the Curve Flags.
The end of the array is aligned to 4 bytes.