Hack64 Wiki
Other Titles
Hack64 Wiki
Other Titles
This is an old revision of the document!
Kirby 64's “Geometry blocks” are containers holding display lists, vertices, transformation data, and texture scroll settings for a group of meshes. The high level structure of a geometry block is as follows (in order):
This section contains the header. Structure definition below.
struct GeometryBlockHeader { /*0x00*/ segptr layout; // segment-offset pointer to the LAYOUT section /*0x04*/ segptr texScroll; // segment-offset pointer to the TEXTURE SCROLL section /*0x08*/ int layoutMode; // interpretation mode of the LAYOUT section /*0x0C*/ segptr imgRefs; // segment-offset pointer to the G_SETTIMG REFERENCES section /*0x10*/ segptr vtxRefs; // segment-offset pointer to the G_VTX REFERENCES section /*0x14*/ int lenUnkData; // defines length of the UNKNOWN DATA section /*0x18*/ segptr unkData; // segment-offset pointer to the UNKNOWN DATA section /*0x1C*/ int unk1C; // unknown };
This section simply contains an array of RSP vertices to be used by the geometry block's display lists.
This section contains F3DEX2 display list commands. Instead of containing addresses, the address field of each G_SETTIMG command contains a bank-index pair referencing an image in ROM or RAM.
This section is a zero-terminated array of segment-offset pointers to every G_SETTIMG command in the DISPLAY LISTS section. After a geometry block is loaded into memory, the engine uses this section to convert the G_SETTIMG commands' bank-index pairs to virtual addresses in place, loading images as necessary.
This section is a zero-terminated array of segment-offset pointers to every G_VTX command in the DISPLAY LISTS section. It does not seem to be used by the game.
This is an optional section that is enabled when using layout mode 0x18 (and possibly others). When enabled, it contains of a list of display list “groups”.
Each group is an array of the following structure:
struct GeoGroupMember { /*0x00*/ int marker; // 0x00: start of group, 0x01: continue group, 0x04 end of group /*0x04*/ segptr displayList; /* segment-offset pointer to a display list in the DISPLAY LISTS section (NULL when marker is 0x04) */ };
The interpretation of this section varies depending on the value of the layoutMode field in the HEADER section. Modes 0x13, 0x14, 0x17, 0x18, 0x1B and 0x1C are used by the game.
Layout structure for each mode:
struct GeoTransformGfx // Transform single display list { int command; segptr displayList; // segment-offset pointer to display list in the DISPLAY LISTS section vec3f position; // x, y, z position vec3f rotation; // x, y, z rotation vec3f scale; // x, y, z scale };
struct GeoTransformGroup // Transform group of display lists { int command; segptr displayListGroup; /* segment-offset pointer to a display list group definition in the DISPLAY LIST GROUP DEFINITIONS section */ vec3f position; // x, y, z position vec3f rotation; // x, y, z rotation vec3f scale; // x, y, z scale };
This is an optional section that is enabled when (?). When enabled, the engine uses this section to add G_DL branches and dynamic G_SETTILESIZE commands to RSP segment 0x0E. The display lists in the DISPLAY LISTS section may jump to these commands for texture scrolling effects.
This section contains four subsections (in order):
struct TexScrollHeader { /*0x04*/ u32 unk00; /*0x08*/ segptr listA; // segment-offset pointer to the LIST A section /*0x0C*/ segptr listB; // segment-offset pointer to the LIST B section /*0x10*/ u32 unk10; };
Contains structures referenced by LIST A and LIST B. Unknown definition.
This section is an array of segment-offsets pointing to structures in the UNKNOWN STRUCTURES section. Terminated by 0x99999999.
This section is an array of segment-offsets pointing to structures in the UNKNOWN STRUCTURES section. Terminated by 0x99999999.
Unknown data. It looks like an array of bank-index pairs. The length of the array is defined in the HEADER section's lenUnkData field.