This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
|
kirby64_the_crystal_shards:geometry_blocks [2019/09/27 20:21] shygoo created |
kirby64_the_crystal_shards:geometry_blocks [2020/08/18 15:54] (current) jesusyoshi54 |
||
|---|---|---|---|
| Line 9: | Line 9: | ||
| - G_SETTIMG REFERENCES | - G_SETTIMG REFERENCES | ||
| - G_VTX REFERENCES | - G_VTX REFERENCES | ||
| - | - DISPLAY LIST GROUP DEFINITIONS | + | - ENTRY POINTS |
| - | - LAYOUT | + | - LAYOUTS |
| - TEXTURE SCROLL SETTINGS | - TEXTURE SCROLL SETTINGS | ||
| - | - UNKNOWN DATA | + | - TEXTURE SCROLL DATA BLOCKS |
| + | - ANIMATION REFERENCES | ||
| ---- | ---- | ||
| Line 20: | Line 21: | ||
| struct GeometryBlockHeader | struct GeometryBlockHeader | ||
| { | { | ||
| - | /*0x00*/ segptr layout; // segment-offset pointer to the LAYOUT section | + | /*0x00*/ segptr layout; // segment-offset pointer to the LAYOUT section |
| - | /*0x04*/ segptr texScroll; // segment-offset pointer to the TEXTURE SCROLL section | + | /*0x04*/ segptr texScroll; // segment-offset pointer to the TEXTURE SCROLL section |
| - | /*0x08*/ int layoutMode; // interpretation mode of the LAYOUT section | + | /*0x08*/ int layoutMode; // interpretation mode of the LAYOUT section |
| - | /*0x0C*/ segptr imgRefs; // segment-offset pointer to the G_SETTIMG REFERENCES 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 | + | /*0x10*/ segptr vtxRefs; // segment-offset pointer to the G_VTX REFERENCES section |
| - | /*0x14*/ int lenUnkData; // defines length of the UNKNOWN DATA section | + | /*0x14*/ int numAnimations; // defines length of the ANIMARION REFS section |
| - | /*0x18*/ segptr unkData; // segment-offset pointer to the UNKNOWN DATA section | + | /*0x18*/ segptr Animations; // segment-offset pointer to the ANIMATION REFS section |
| - | /*0x1C*/ int unk1C; // unknown | + | /*0x1C*/ int lenLayout; // length of the Layout section |
| }; | }; | ||
| </code> | </code> | ||
| Line 47: | Line 48: | ||
| ===== G_VTX REFERENCES ===== | ===== G_VTX REFERENCES ===== | ||
| This section is a zero-terminated array of segment-offset pointers to every G_VTX command in the DISPLAY LISTS section. | 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. | + | It is used by the game and can be left empty. |
| ---- | ---- | ||
| - | ===== DISPLAY LIST GROUP DEFINITIONS ===== | + | ===== ENTRY POINTS ===== |
| 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". | 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: | Each group is an array of the following structure: | ||
| <code C> | <code C> | ||
| - | struct GeoGroupMember | + | struct EntryPoint |
| { | { | ||
| - | /*0x00*/ int marker; // 0x00: start of group, 0x01: continue group, 0x04 end of group | + | /*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 | + | /*0x04*/ segptr[] displayList; /* segment-offset pointer to a display list in the DISPLAY LISTS section |
| (NULL when marker is 0x04) */ | (NULL when marker is 0x04) */ | ||
| + | }; | ||
| + | </code> | ||
| + | |||
| + | Sometimes this is replaced simply by an array of display lists. | ||
| + | |||
| + | <code C> | ||
| + | struct DisplayListArray | ||
| + | { | ||
| + | /*0x00*/ segptr[] displayList; /* segment-offset pointer to a display list in the DISPLAY LISTS section*/ | ||
| }; | }; | ||
| </code> | </code> | ||
| Line 67: | Line 77: | ||
| The interpretation of this section varies depending on the value of the layoutMode field in the HEADER section. | 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. | Modes 0x13, 0x14, 0x17, 0x18, 0x1B and 0x1C are used by the game. | ||
| + | The layoutMode is interpreted bitwise, with the above modes being the only ones | ||
| + | used by the game. | ||
| Layout structure for each mode: | Layout structure for each mode: | ||
| - | * 0x13: Unknown | + | * 0x13: No layout, instead the layout pointer references a display list. |
| - | * 0x14: A zero-terminated array of segment-offset pointers to display lists in the DISPLAY LISTS section. | + | * 0x14: No layout, instead a pointer to a DisplayListArray thats zero terminated. |
| - | * 0x17: An array of GeoTransformGfx structures. | + | * 0x17: An array of GeoTransformGroup structures. Pointer goes to single display list. |
| - | * 0x18: An array of GeoTransformGroup structures. | + | * 0x18: An array of GeoTransformGroup structures. Pointer goes to Entry Point. Length of segptr array is one. |
| - | * 0x1B: Unknown, only used for developer test level | + | * 0x1B: An array of GeoTransformGroup structures. Pointer goes to DisplayListArray. Length of segptr array is two. |
| - | * 0x1C: Unknown, only used for developer test level | + | * 0x1C: An array of GeoTransformGroup structures. Pointer goes to Entry Point. Length of segptr array is two. |
| - | + | ||
| - | <code C> | + | |
| - | 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 | + | |
| - | }; | + | |
| - | </code> | + | |
| <code C> | <code C> | ||
| struct GeoTransformGroup // Transform group of display lists | struct GeoTransformGroup // Transform group of display lists | ||
| { | { | ||
| - | int command; | + | u16 flag; |
| - | segptr displayListGroup; /* segment-offset pointer to a display list group definition in the | + | u16 command; |
| - | DISPLAY LIST GROUP DEFINITIONS section */ | + | union{ |
| + | segptr displayListGroup; // segment-offset pointer to an entry point | ||
| + | segptr EntryPoint; | ||
| + | segptr DisplayListPair; | ||
| + | }; | ||
| vec3f position; // x, y, z position | vec3f position; // x, y, z position | ||
| - | vec3f rotation; // x, y, z rotation | + | vec3f rotation; // x, y, z rotation radians |
| vec3f scale; // x, y, z scale | vec3f scale; // x, y, z scale | ||
| }; | }; | ||
| </code> | </code> | ||
| + | |||
| + | A command of 0 is used to start a layout, and a command of 12 is used to end it. If the msb of the Display List of Entry Point pointer is set, afterwards | ||
| + | another series of layouts will be used for environment effects. These environment effects dont have any pointers but are just placements of Loc, Rot, Scale. | ||
| ---- | ---- | ||
| ===== TEXTURE SCROLL SETTINGS ===== | ===== TEXTURE SCROLL SETTINGS ===== | ||
| - | This is an optional section that is enabled when (?). | + | This is an optional section that is enabled when a pointer exists in the Geo Block Header. |
| When enabled, the engine uses this section to add G_DL branches and dynamic G_SETTILESIZE commands to RSP segment 0x0E. | 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. | The display lists in the DISPLAY LISTS section may jump to these commands for texture scrolling effects. | ||
| - | This section contains four subsections (in order): | + | This section contains three subsections (in order): |
| - | - HEADER | + | - Main Header |
| - | - UNKNOWN STRUCTURES | + | - ScrollStruct |
| - | - LIST A | + | - Sub Headers |
| - | - LIST B | + | |
| - | ==== HEADER ==== | + | ==== MAIN HEADER ==== |
| - | <code C> | + | The texture scroll header is an array of segptrs terminated by an 0x99999999. Each segptr in this |
| - | struct TexScrollHeader | + | section points to a subheader. |
| - | { | + | |
| - | /*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; | + | |
| - | }; | + | |
| - | </code> | + | |
| - | ==== UNKNOWN STRUCTURES ==== | + | ==== SUB HEADER ==== |
| - | Contains structures referenced by LIST A and LIST B. Unknown definition. | + | |
| - | ==== LIST A ==== | + | Each subheader is an array of segptrs to texture scroll structs. Each sub header is terminated by an 0x99999999. |
| - | This section is an array of segment-offsets pointing to structures in the UNKNOWN STRUCTURES section. Terminated by 0x99999999. | + | |
| - | ==== LIST B ==== | + | ==== TEXTURE SCROLLS ==== |
| - | 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 uvScrollData structs each pointed to by an item in the | ||
| + | subheader arrays. Following this uvScrollData struct is an optional bank-index list to | ||
| + | textures which is also terminated by 0x9999. | ||
| + | |||
| + | <code c> | ||
| + | struct uvScrollData { | ||
| + | ushort field_0x0; | ||
| + | byte fmt1; | ||
| + | byte siz1; | ||
| + | uint * textures; | ||
| + | ushort stretch; | ||
| + | ushort sharedOffset; | ||
| + | ushort t0_w; | ||
| + | ushort t0_h; | ||
| + | int halve; | ||
| + | float t0_xShift; | ||
| + | float t0_yShift; | ||
| + | float xScale; | ||
| + | float yScale; | ||
| + | float field_0x24; | ||
| + | float field_0x28; | ||
| + | pointer palettes; | ||
| + | ushort flags; | ||
| + | byte fmt2; | ||
| + | byte siz2; | ||
| + | ushort w2; | ||
| + | ushort h2; | ||
| + | ushort t1_w; | ||
| + | ushort t1_h; | ||
| + | float t1_xShift; | ||
| + | float t1_yShift; | ||
| + | float field_0x44; | ||
| + | float field_0x48; | ||
| + | int field_0x4c; | ||
| + | struct color prim; | ||
| + | byte primLODFrac; | ||
| + | byte field_0x55; | ||
| + | byte field_0x56; | ||
| + | undefined field_0x57; | ||
| + | struct color env; | ||
| + | struct color blend; | ||
| + | struct color light1; | ||
| + | struct color light2; | ||
| + | int field_0x68; | ||
| + | int field_0x6c; | ||
| + | int field_0x70; | ||
| + | int field_0x74; | ||
| + | }; | ||
| + | </code> | ||
| ---- | ---- | ||
| - | ===== UNKNOWN DATA ===== | + | ===== ANIMATION REFS ===== |
| - | 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. | + | Animations references are an array of bank-index pairs. The length of the array is defined in the HEADER section's numAnimations field. |
| + | When needed, the data for the animation are dma'd by the games file system based on the bank index pair listed. | ||
| + | For info on animations see the animations page. | ||