Chapter 3 Binary Format

3-14. TexList

2. Tex Area

TexHeader u32 tex_tag
u32 this_tex_index
u32 tex_header_size
u32 tex_size
u32 tex_name_index
u32 tex_type
u32 tex_wrap_s
u32 tex_wrap_t
u32 tex_anim
u32 tex_data_area_size
u32 tex_anim_frame_late
u32 nintendo_extension_block_size
u32 user_extension_block_size
TexDataArea
NintendoExtensionBlock
UserExtensionBlock

Figure: Tex Area Memory Map

u32 tex_tag Tag indicating Tex area. Set the following flag.
TAG_TEX	0x000b0100
u32 this_tex_index Index number of this Tex area.
u32 tex_header_size Number of bytes of this TexHeader area.
u32 tex_size Number of bytes of this Tex area.
u32 tex_name_index Index number in NameList that describes Tex name.
u32 tex_type Specifies the texture type. Currently, the following formats are defined:

TEX_FORM_I	0x00000000
TEX_FORM_IA	0x00000001
TEX_FORM_CI	0x00000002
TEX_FORM_YUV	0x00000003
TEX_FORM_RGB	0x00000004
TEX_FORM_RGBA	0x00000005
TEX_DEPTH_4	0x00000000
TEX_DEPTH_8	0x00000100
TEX_DEPTH_16	0x00000200
TEX_DEPTH_32	0x00000400

The above flags use TEX_FORM_* and TEX_DEPTH_* in pairs of one of each.

For example, in the case of an 8bit color index texture, a flag will be set as follows:


TEX_FORM_CI | TEX_FORM_8

However, when converting to Nintendo 64 data, only the following combinations can be used.

In the case of TEX_FORM_I, only TEX_DEPTH_4 or TEX_DEPTH_8 can be used.

In the case of TEX_FORM_IA, only TEX_DEPTH_4,TEX_DEPTH_8, or TEX_DEPTH_16 can be used.

In the case of TEX_FORM_CI, only TEX_DEPTH_4, or TEX_DEPTH_8 can be used.

In the case of TEX_FORM_YUV, only TEX_DEPTH_16 can be used.

In the case of TEX_FORM_RGB or TEX_FORM_RGBA, only TEX_DEPTH_16 or TEX_DEPTH_32 can be used.

u32 tex_wrap_s Specifies S direction wrapping of texture. Set one of the following flags.


TEX_WRAP_S	0x00000000
TEX_CLAMP_S	0x00000001
TEX_MIRROR_S	0x00000002

Only one of these flags can be set at a time.

u32 tex_wrap_t Specifies T direction wrapping of texture. Set one of the following flags.


TEX_WRAP_T	0x00000000
TEX_CLAMP_T	0x00000100
TEX_MIRROR_T	0x00000200

Only one of these flags can be set at a time.

u32 tex_anim Sets texture animation. The following flags are currently defined.


TEX_ANIM_OFF			0x00000000
TEX_ANIM_FLIPBOOK		0x00000001
TEX_ANIM_FLIPBOOK_KEY		0x00000002
TEX_ANIM_SCROLL_OFFSET		0x00000010
TEX_ANIM_SCROLL_OFFSET_KEY	0x00000020
TEX_ANIM_SCROLL_SCALE		0x00000100
TEX_ANIM_SCROLL_SCALE_KEY	0x00000200

TEX_ANIM_OFF turns texture animation off.

TEX_ANIM_FLIPBOOK performs animation by switching textures like a texture animation.

TEX_ANIM_FLIPBOOK_KEY performs animation by switching textures using key frame switching timing.

TEX_ANIM_SCROLL_OFFSET scrolls the offset coordinates when part of a large texture image is extracted and the texture is used.

TEX_ANIM_SCROLL_OFFSET_KEY scrolls the offset coordinates using key frame animation when part of a large texture image is extracted and the texture is used.

TEX_ANIM_SCROLL_SCALE performs animation for the extracted portion size when part of a large texture image is extracted and the texture is used.
TEX_ANIM_SCROLL_SCALE_KEY performs animation for the extracted portion size by specifying the size of the portion that is extracted every key frame when part of a large texture image is extracted and the texture is used.

It is possible to specify each type of texture animation at the same time. However, it is not possiblt to specify full frame animation and key frame animation at the same time when using the same type of animation, such as TEX_ANIM_FLIPBOOK and TEX_ANIM_FLIPBOOK_KEY.

When using a number of texture animation types, be sure to set only one texture animation flag to be used by bitOR. All others will not be processed.

Set the TEX_ANIM_OFF flag only when no texture animation is to be performed.

u32 tex_data_area_size Size of TexDataArea.
u32 tex_anim_frame_late Describes the frame rate of texture animation.
u32 nintendo_extension_block_size Nintendo extension block size
u32 user_extension_block_size User extension block size
TexDataArea Specifies how the image is extracted from the TexImgList that stores the actual texture image. Index numbers in TexImgList are also described in this area. Note that the manner of setting this flag differs depending on the specified texture animation type.
NintendoExtensionBlock Nintendo extension block
UserExtensionBlock User extension block