====== Geometry Layouts ====== These scripts load display lists within the [[banjo_kazooie:model_data|model file]], with certain aspects, properties, and checks applied. They are found at the end of a model file. ==== 0x01: SORT ==== Runs one or both child geometry layouts, sorting based on positions. If vectors are u and v, run first child first if (v-u).u >= 0. Used to depth sort translucent geometry. Usage: ^ Value/Syntax ^ Description ^ | [00 00 00 01] | Sort Command ID | | [aa aa aa aa] | Command Length* (0x28)| | [xx xx xx xx] | first child x (float) | | [yy yy yy yy] | first child y (float) | | [zz zz zz zz] | first child z (float) | | [xx xx xx xx] | second child x (float) | | [yy yy yy yy] | second child y (float) | | [zz zz zz zz] | second child z (float) | | [00 bb cc cc] | if bb&1, draw only nearer child; cc cc=first child offset | | [00 00 dd dd] | second child offset | ---- ==== 0x02: BONE ==== Loads a display list from the DL segment and attaches it to the current group of bones with ID. Usage: ^ Value/Syntax ^ Description ^ | [00 00 00 02] | Bone Command ID | | [00 00 aa aa] | Load DL - DL Segment Address/8 (Example: 0x1C = 0xE0)| | [bb cc dd dd] | bb=Command Length* (0x10), cc=Bone ID, dddd=?? | | [00 00 00 00] | If bb=10, these four bytes are written before the next command. (Padding) | ---- ==== 0x03: LOAD DL ==== Loads a display list from offset of F3DEX segment Usage: ^ Value/Syntax ^ Description ^ | [00 00 00 03] | Load DL Command ID | | [aa aa aa aa] | Command Length* (0x10)| | [bb bb cc cc] | bbbb=Offset in DL Segment/0x08, cccc=Tri Count | | [00 00 00 00] | If aa=10, these four bytes are written before the next command. (Padding)| ''Example: 00 00 00 03 00 00 00 00 00 2D 00 10'' Addr= 0x2D*0x08 offset from F3DEX Segment Start, 0x168 0x10= 16 triangles in DL ---- ==== 0x05: SKINNING ==== Draw triangles across bones. Usage: ^ Value/Syntax ^ Description ^ | [00 00 00 05] | Skinning Command ID | | [aa aa aa aa] | Command Length* (Varies)| | [bb bb cc cc] | bb bb=DL segment offset, sets up vertics on previous bone | | [dd dd ee ee] | cc cc, dd dd, ee ee, ...=zero-terminated list of DL offsets for current bone, using setup vertices | ---- ==== 0x06: BRANCH ==== (unused?) Jumps. Usage: ^ Value/Syntax ^ Description ^ | [00 00 00 06] | Branch Command ID | | [aa aa aa aa] | Command Length* (0x10)| | [bb bb bb bb] | GeoLayout Command Target Offset (This should accept negative values)| | [00 00 00 00] | Padding | ---- ==== 0x08: LOD ==== Runs a geometry layout if the distance from the camera is in a certain range. ^ Value/Syntax ^ Description ^ | [00 00 00 08] | LOD Command ID | | [aa aa aa aa] | Command Length* (0x20)*| | [bb bb bb bb] | max distance (float) | | [cc cc cc cc] | min distance (float) | | [xx xx xx xx] | test position x (float) | | [yy yy yy yy] | test position y (float) | | [zz zz zz zz] | test position z (float) | | [dd dd dd dd] | geometry layout offset | *Note that the command length actually includes the length of the child GL list to run, and the length can be 0 to denote the end of a list, but there could still be MANY child commands to run. ---- ==== 0x0A: REFERENCE POINT ==== Computes a point on the current model to be referenced later. Used for spawning sparkle particles and Clanker's teeth/bolt positions. Usage: ^ Value/Syntax ^ Description ^ | [00 00 00 0A] | Reference Point Command ID | | [aa aa aa aa] | Command Length* (0x18)| | [bb bb cc cc] | bb bb= reference point index, cc cc=bone index | | [xx xx xx xx] | bone offset x (float) | | [yy yy yy yy] | bone offset y (float) | | [zz zz zz zz] | bone offset z (float) | ---- ==== 0x0C: SELECTOR ==== Selects one or more child geometry layouts to run. Used for blinking and many other model part selections, like Mumbo's hut. Each model sets a list of selectors, where positive values are the index of a (single) child layout to run and negative values (after being negated) are bitfields indicating multiple children to run. Usage: ^ Value/Syntax ^ Description ^ | [00 00 00 0C] | Reference Point Command ID | | [aa aa aa aa] | Command Length* (Varies) | | [bb bb cc cc] | bb bb=child count, cc cc=selector index | | [dd dd dd dd] | dd dd dd dd, ee ee ee ee, ...=list of bb bb offsets to geometry layouts that might be selected | | [ee ee ee ee] | | | ... | | ---- ==== 0x0D: DRAW DISTANCE ==== Applies draw distance to descending geometry Usage: ^ Value/Syntax ^ Description ^ | [00 00 00 0D] | Command | | [aa aa aa aa] | Command Length* | | [XX XX YY YY ZZ ZZ] | Draw distance: Negative Coords| | [XX XX YY YY ZZ ZZ] | Draw distance: Positive Coords | | [bb bb cc cc] | bbbb= ?? Usually 0018, cccc= ????? | *Command Length: If value is nonzero, GeoLayout continues, else it is the last command. ---- ==== 0x0E: UNKNOWN ==== Usage: ^ Value/Syntax ^ Description ^ | [00 00 00 0E] | Command | | [aa aa aa aa] | Command Length | | [XX XX YY YY ZZ ZZ] | Coords | | [XX XX YY YY ZZ ZZ] | Coords | | [00 00 00 00] | padding | | ... | Child commands* | *Child commands: if Command Length is not zero, then read commands until size is reached ----