Difference between revisions of "Template:NW4FCurve"
(Document delta field) |
(Also better document start and end frame) |
||
Line 13: | Line 13: | ||
| 0 || 4 || Single | | 0 || 4 || Single | ||
|- | |- | ||
− | | 1 || 2 || 16-bit fixed point value (10 bits integral and 5 bits fractional) | + | | 1 || 2 || 16-bit fixed point value (1 big sign, 10 bits integral and 5 bits fractional) |
|- | |- | ||
| 2 || 1 || Byte | | 2 || 1 || Byte | ||
Line 25: | Line 25: | ||
| 1 || Linear Single || 2 (linear interpolation) | | 1 || Linear Single || 2 (linear interpolation) | ||
|- | |- | ||
− | | 2 || Baked Single || 1 | + | | 2 || Baked Single || 1 (no interpolation) |
|- | |- | ||
− | | 4 || Step Integer || 1 | + | | 4 || Step Integer || 1 (no interpolation) |
|- | |- | ||
− | | 5 || Baked Integer || 1 | + | | 5 || Baked Integer || 1 (no interpolation) |
|- | |- | ||
− | | 6 || Step Boolean || 1 | + | | 6 || Step Boolean || 1 (no interpolation) |
|- | |- | ||
− | | 7 || Baked Boolean || 1 | + | | 7 || Baked Boolean || 1 (no interpolation) |
|} | |} | ||
|- | |- | ||
Line 40: | Line 40: | ||
| 0x04 || 4 || UInt32 || '''Target Offset''', an offset in bytes into the corresponding Animation Data structure to animate the field at that relative address. | | 0x04 || 4 || UInt32 || '''Target Offset''', an offset in bytes into the corresponding Animation Data structure to animate the field at that relative address. | ||
|- | |- | ||
− | | 0x08 || 4 || Single || '''Start [[#Frames|frame]]'''. | + | | 0x08 || 4 || Single || '''Start [[#Frames|frame]]''', the first frame at which a key is placed. |
|- | |- | ||
− | | 0x0C || 4 || Single || '''End [[#Frames|frame]]'''. | + | | 0x0C || 4 || Single || '''End [[#Frames|frame]]''', the last frame at which a key is placed. |
|- | |- | ||
| 0x10 || 4 || Int32 / Single || '''Data scale''', multiplier to the raw values to get the final result. | | 0x10 || 4 || Int32 / Single || '''Data scale''', multiplier to the raw values to get the final result. | ||
Line 50: | Line 50: | ||
| 0x14 || 4 || Single || '''Data offset''', added to the raw values (after multiplication with ''Data scale'') to get the final result. | | 0x14 || 4 || Single || '''Data offset''', added to the raw values (after multiplication with ''Data scale'') to get the final result. | ||
|- bgcolor="#DDFFDD" | |- bgcolor="#DDFFDD" | ||
− | | 0x18 || 4 || Single || '''Data delta''' | + | | 0x18 || 4 || Single || '''Data delta''', stores the difference between the lowest and highest key value. |
|- bgcolor="#DDFFDD" | |- bgcolor="#DDFFDD" | ||
| 0x1C || 4 || Int32 || '''[[#Frames|Frame array]]''' offset. | | 0x1C || 4 || Int32 || '''[[#Frames|Frame array]]''' offset. | ||
Line 76: | Line 76: | ||
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 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''. | ||
+ | |||
+ | It is unclear how to exactly interprete the values to form the curve out of it. | ||
The end of the array is aligned to 4 bytes. | The end of the array is aligned to 4 bytes. |
Revision as of 20:49, 21 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 0x24 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 Offset, an offset in bytes into the corresponding Animation Data structure to animate the field at that relative address. | ||||||||||||||||||||||||||||||||||||
0x08 | 4 | Single | Start frame, the first frame at which a key is placed. | ||||||||||||||||||||||||||||||||||||
0x0C | 4 | Single | End frame, the last frame at which a key is placed. | ||||||||||||||||||||||||||||||||||||
0x10 | 4 | Int32 / Single | Data scale, multiplier to the raw values to get the final result. | ||||||||||||||||||||||||||||||||||||
if BFRES version >= 3.4.0.0 | |||||||||||||||||||||||||||||||||||||||
0x14 | 4 | Single | Data offset, added to the raw values (after multiplication with Data scale) to get the final result. | ||||||||||||||||||||||||||||||||||||
0x18 | 4 | Single | Data delta, stores the difference between the lowest and highest key value. | ||||||||||||||||||||||||||||||||||||
0x1C | 4 | Int32 | Frame array offset. | ||||||||||||||||||||||||||||||||||||
0x20 | 4 | Int32 | Key array offset. | ||||||||||||||||||||||||||||||||||||
0x24 | 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.
It is unclear how to exactly interprete the values to form the curve out of it.
The end of the array is aligned to 4 bytes.