User Tools


Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
sm64:geometry_layout_commands [2016/04/25 09:08]
queueram Add note about 13 seg = 0x0 and add reference to Kaze's docs
— (current)
Line 1: Line 1:
-======== Geometry Layout Commands ======== 
  
-The geometry layout commands define how geometric shapes are drawn. ​ Some geo layouts are contained after the Level data blocks and some are loaded with [[Level Commands#​17:​ Load ROM to Segment|Level Command 0x17]] The first byte of the geo layout command is the command type.  Unlike the level commands, there is no length byte specified in the command. ​ Most geo layout commands are constant length, however, some depend on the values set. 
- 
-===== Drawing Layers ===== 
- 
-^ Layer ^ Description ^ 
-| 00 | Unused | 
-| 01 | Entirely Solid | 
-| 02 | Unused | 
-| 03 | Unused | 
-| 04 | Transparent pixels, no semi transparency. Allows perfect layering with other transparencies around it. | 
-| 05 | Semi transparency enabled. Layering must be handled with the order of drawn faces. | 
-| 06 | Semi transparency enabled. Layering must be handled with the order of drawn faces. This layer is always drawn behind layer 05, usually for shadows. | 
- 
-===== Geometry Layout Commands ===== 
-==== 00: Branch and Store ==== 
-Branches to segmented address and stores 2 return addresses. This command is not used in the ROM. 
- 
-''​00 00 00 00 [<color darkred>​SS SS SS SS</​color>​]''​ 
- 
-| <color darkred>​S</​color>​ | Segmented address to branch to | 
- 
-<code c> 
-/* Geo Layout 0x00 Rough translation. */ 
-// 0x8038BD80 = Pointer to current Geo layout command 
-// 0x8038BCB8 = Pointer to array/table to where branch return pointers are stored. 
-// 0x8038BD7A = Branch depth value. 
-*(0x8038BCB8 + (0x8038BD7A * 4)) = *0x8038BD80 + 8; // Stores the pointer to the next geo command 
-*0x8038BD7A += 1; // Increment branch value 
- 
-*(0x8038BCB8 + (0x8038BD7A * 4)) = (*0x8038BD78 << 16) + *0x8038BD7E;​ // Store another address 
-*0x8038BD7A += 1; // Increment branch value 
-*0x8038BD7E = *0x8038BD7A;​ 
- 
-0x8038BD80 = SegmentedToVirtual(0x8038BD80 + 4); // Go to the segmented address. 
-</​code>​ 
- 
-Length: 8 
- 
----- 
- 
-==== 01: Terminate Geometry Layout ==== 
-The ending command to close. 
- 
-''​01 00 00 00''​ 
- 
-Length: 4 
- 
----- 
- 
-==== 02: Branch Geometry Layout ==== 
-Branches the current geo layout to another area within a RAM bank. 
- 
-''​02 [<color darkblue>​AA</​color>​] 00 00 [<color darkred>​SS SS SS SS</​color>​]''​ 
- 
-| <color darkblue>​A</​color>​ | 0 = Jump, 1 = Jump and store return address | 
-| <color darkred>​S</​color>​ | Segmented address to branch to | 
- 
-Length: 8 
- 
----- 
- 
-==== 03: Return From Branch ==== 
-Ends the current geometry layout branch and returns to the area following the 0x02 command. 
- 
-''​03 00 00 00''​ 
- 
-Length: 4 
- 
----- 
- 
-==== 04: Open Node ==== 
-If you don't understand nodes, this is basically like a sub-folder. 
- 
-''​04 00 00 00''​ 
- 
-Length: 4 
- 
----- 
- 
-==== 05: Close Node ==== 
-Used at the end of the data within the opened node. 
- 
-''​05 00 00 00''​ 
- 
-Length: 4 
- 
----- 
- 
-==== 06: Unused ==== 
- 
----- 
- 
-==== 07: Unused ==== 
- 
----- 
- 
-==== 08: Set Screen Render Area ==== 
-Only used in geo layout of levels. 
- 
-''​08 00 00 [<color darkgrey>​AA</​color>​] [<color darkred>​XX XX</​color>​] [<color darkgreen>​YY YY</​color>​] [<color darkblue>​WW WW</​color>​] [<color purple>​HH HH</​color>​]''​ 
- 
-| <color darkgrey>​A</​color>​ | Either 00 (mario face) or 0A (all other levels) | 
-| <color darkred>​X</​color>​ | X position | 
-| <color darkgreen>​Y</​color>​ | Y position | 
-| <color darkblue>​W</​color>​ | Width of screen | 
-| <color purple>​H</​color>​ | Height of screen | 
- 
-Length: C 
- 
----- 
- 
-==== 09: ?? ==== 
-Only used in geo layout of levels. 
- 
-''​09 00 00 [<color darkred>​AA</​color>​]''​ 
- 
-| <color darkred>​A</​color>​ | Always 0x64 | 
- 
-Length: 4 
- 
----- 
- 
-==== 0A: Set Camera Frustum ==== 
-Set camera frustum properties. Only used in geo layout of levels. 
- 
-''​0A [<color darkgray>​AA</​color>​] [<color darkred>​BB BB</​color>​] [<color darkgreen>​NN NN</​color>​] [<color darkblue>​FF FF</​color>​] {<color purple>​EE EE EE EE</​color>​}''​ 
- 
-| <color darkgray>​A</​color>​ | Use ASM code defined by <color purple>​E</​color>​ | 
-| <color darkred>​B</​color>​ | Camera FOV (0x2D = 45) | 
-| <color darkgreen>​N</​color>​ | Camera Near | 
-| <color darkblue>​F</​color>​ | Camera Far | 
-| <color purple>​E</​color>​ | optional ASM function if <color darkred>​A</​color>​ is non-zero (always ​ 8029AA3C) | 
- 
-Length: 8-C (variable) 
- 
----- 
- 
-==== 0B: Start Geo Layout ==== 
-Starts geometry layout with no parameters whatsoever. Seems to use a pre-set render area. 
- 
-''​0B 00 00 00''​ 
- 
-Length: 4 
- 
----- 
- 
-==== 0C: ?? ==== 
-Used mostly in levels 
- 
-''​0C [<color darkgray>​AA</​color>​] 00 00''​ 
- 
-| <color darkgray>​A</​color>​ | Either 00 or 01, passed to A2 of 8037B4AC | 
- 
-Length: 4 
- 
----- 
- 
-==== 0D: ?? ==== 
-Used in WF, CCM, TTM, SSL levels and some geo layouts. 
- 
-''​0D 00 00 00 [<color darkred>​AA AA</​color>​] [<color darkgreen>​BB BB</​color>​]''​ 
- 
-| <color darkred>​A</​color>​ | s16?, passed through A2 to 8037B530| 
-| <color darkgreen>​B</​color>​ | s16? passed through A3 to 8037B530| 
- 
-Length: 8 
- 
----- 
- 
-==== 0E: Switch Case ==== 
-Loads ASM in RAM that switches between the receding display lists within the node. 
- 
-''​0E 00 00 [<color darkgray>​NN</​color>​] [<color purple>​AA AA AA AA</​color>​]''​ 
- 
-| <color darkgray>​N</​color>​ | Number of cases/​display lists, starting at 01 | 
-| <color purple>​A</​color>​ | ASM Function | 
- 
-Length: 8 
- 
----- 
- 
-==== 0F: ?? ==== 
- 
-''​0F 00 [<color darkgray>​TT TT</​color>​] [<color darkred>​XX XX</​color>​] [<color darkgreen>​YY YY</​color>​] [<color darkblue>​ZZ ZZ</​color>​] [<color red>UU UU</​color>​] [<color green>VV VV</​color>​] [<color blue>WW WW</​color>​] [<color purple>​AA AA AA AA</​color>​]''​ 
- 
-| <color darkgray>​T</​color>​ | ?? | 
-| <color darkred>​X</​color>​ | ?? (s16) | 
-| <color darkgreen>​Y</​color>​ | ?? (s16) | 
-| <color darkblue>​Z</​color>​ | ?? (s16) | 
-| <color red>​U</​color>​ | ?? (s16) | 
-| <color green>​V</​color>​ | ?? (s16) | 
-| <color blue>​W</​color>​ | ?? (s16) | 
-| <color purple>​A</​color>​ | ASM function. Always 80287D30 (levels) or 00 (menus) | 
- 
-Length: 0x14 
- 
----- 
- 
-==== 10: Translate and Rotate ==== 
-Applies translation & rotation to the following node. 
- 
-''​10 [<color darkgrey>​AA</​color>​] [<color purple>​BB BB</​color>​] [<color darkred>​XX XX</​color>​] [<color darkgreen>​YY YY</​color>​] [<color darkblue>​ZZ ZZ</​color>​] [<color red>RX RX</​color>​] [<color green>RY RY</​color>​] [<color blue>RZ RZ</​color>​]''​ 
- 
-| <color darkgrey>​A</​color>​ | Branching flag | 
-| <color purple>​B</​color>​ | Used if <color darkgrey>​A</​color>​ != 0 | 
-| <color darkred>​X</​color>​ | X translation offset (s16) | 
-| <color darkgreen>​Y</​color>​ | Y translation offset (s16) | 
-| <color darkblue>​Z</​color>​ | Z translation offset (s16) | 
-| <color red>​RX</​color>​ | X rotation (s16) | 
-| <color green>​RY</​color>​ | Y rotation (s16) | 
-| <color blue>​RZ</​color>​ | Z rotation (s16) | 
- 
-Length: 0x10 
- 
----- 
-==== 13: Load Display List ==== 
-Loads display list with drawing layer and offsets the model on X/Y/Z axis. 
- 
-''​13 [<color darkgray>​LL</​color>​] [<color darkred>​XX XX</​color>​] [<color darkgreen>​YY YY</​color>​] [<color darkblue>​ZZ ZZ</​color>​] [<color purple>​AA AA AA AA</​color>​]''​ 
- 
-| <color darkgray>​L</​color>​ | Drawing layer | 
-| <color darkred>​X</​color>​ | Offset on X axis (s16) | 
-| <color darkgreen>​Y</​color>​ | Offset on Y axis (s16) | 
-| <color darkblue>​Z</​color>​ | Offset on Z axis (s16) | 
-| <color purple>​A</​color>​ | Segmented address with display list // If 0x00000000, an invisible rotation joint is created | 
- 
-Length: C 
- 
----- 
- 
-==== 14: Billboard Model ==== 
-Billboards the model without needing the use of 0x21 in the behavior script. 
- 
-''​14 00 00 00 00 00 00 00''​ 
- 
-Length: 8 
- 
----- 
- 
-==== 15: Load Display List ==== 
-Loads display list with drawing layer and no other properties. 
- 
-''​15 [<color darkgray>​LL</​color>​] 00 00 [<color purple>​AA AA AA AA</​color>​]''​ 
- 
-| <color darkgray>​L</​color>​ | Drawing layer | 
-| <color purple>​A</​color>​ | Segmented address with display list | 
- 
-Length: 8 
- 
----- 
- 
-==== 16: Start Geo Layout with Shadow ==== 
-Used at start of the geo layout, with shadow type, solidity, and size. 
- 
-''​16 00 00 [<color darkred>​AA</​color>​] 00 [<color darkgreen>​BB</​color>​] [<color darkblue>​CC CC</​color>​]''​ 
- 
-| <color darkred>​A</​color>​ | Shadow type | 
-| <color darkgreen>​B</​color>​ | Shadow solidity (00=invisible,​ FF=black) | 
-| <color darkblue>​C</​color>​ | Shadow scale | 
- 
-Length: 8 
- 
----- 
- 
-==== 17: Set Up Object Rendering? ==== 
-Sets up rendering for 3D Objects? Without it, 0x24 objects placed in level do not render. 
- 
-''​17 00 00 00''​ 
- 
-Length: 4 
- 
----- 
- 
-==== 18: Load Polygons ASM ==== 
-Used in some original objects to point to ASM in RAM, for misc. effects such as vertex rippling. 
- 
-''​18 00 00 00 [<color darkred>​AA AA AA AA</​color>​]''​ 
- 
-| <color darkred>​A</​color>​ | ASM RAM Address | 
- 
-Length: 8 
- 
----- 
- 
-==== 19: Set Background ==== 
-Set background image or color. 
- 
-''​19 00 [<color darkgrey>​TT TT</​color>​] [<color purple>​AA AA AA AA</​color>​]''​ 
- 
-| <color darkgrey>​T</​color>​ | If <color purple>​A</​color>​ == 0, RGBA color, else background ID | 
-| <color purple>​A</​color>​ | ASM function to set the background image, always 0x802763D4 | 
- 
-Length: 8 
- 
-Examples: 
-  [ 19 00 00 00 80 27 63 D4 ] # Bob-Omb'​s Battlefield 
-  [ 19 00 00 01 80 27 63 D4 ] # Lethal Lava Land 
-  [ 19 00 00 02 80 27 63 D4 ] # Wet Dry World 
-  [ 19 00 00 03 80 27 63 D4 ] # Rainbow Ride 
-  [ 19 00 00 04 80 27 63 D4 ] # Cool Cool Mountain 
-  [ 19 00 00 05 80 27 63 D4 ] # Shifting Sand Land 
-  [ 19 00 00 06 80 27 63 D4 ] # Big Boo's Haunt 
-  [ 19 00 00 07 80 27 63 D4 ] # Bowser 1 Course 
-  [ 19 00 00 08 80 27 63 D4 ] # Jolly Roger Bay 
-  [ 19 00 00 09 80 27 63 D4 ] # Bowser 3 Course 
-  [ 19 00 00 01 00 00 00 00 ] # Secret Slide, pure black background 
- 
----- 
-==== 1A: No Operation ==== 
- 
-Doesn'​t do anything, nop. This command is never used in any of the scripts. 
- 
-Length: 8 
- 
----- 
- 
-==== 1D: Scale Model ==== 
-Scales the receding data uniformly. 
- 
-''​1D [<color darkred>​A</​color>​][<​color darkgreen>​B</​color>​] 00 00 [<color darkblue>​SS SS SS SS</​color>​] {?? ?? ?? ??​}''​ 
- 
-| <color darkred>​A</​color>​ | If MSbit is set, load B and ?? | 
-| <color darkgreen>​B</​color>​ | If MSbit of <color darkred>​A</​color>​ is set, use for A2 to 8037B940 | 
-| <color darkblue>​S</​color>​ | Scale percentage (0x10000 = 100%) | 
-| ?? | optional word used if the MSbit of <color darkred>​A</​color>​ is set | 
- 
-Length: 8-C (variable) 
- 
----- 
- 
-==== 1E: No Operation ==== 
- 
-Doesn'​t do anything, nop. This command is never used in any of the scripts. 
- 
-Length: 8 
- 
----- 
- 
-==== 1F: No Operation ==== 
- 
-Doesn'​t do anything, nop. This command is never used in any of the scripts. 
- 
-Length: 0x10 
- 
----- 
- 
-==== 20: Start Geo Layout with Render Area ==== 
-Starts the geometry layout with no shadow and a render area. 
- 
-''​20 00 [<color darkred>​AA AA</​color>​]''​ 
- 
-| <color darkred>​A</​color>​ | Render distance? | 
- 
-Length: 4 
- 
-===== See Also ===== 
-[[Level Commands]] 
- 
-===== References ===== 
-  * http://​origami64.net/​showthread.php?​tid=9 
-  * http://​www.smwcentral.net/?​p=viewthread&​t=74776 
-  * https://​sites.google.com/​site/​kazemario64/​geo-layout-polygon-commands 
-  * http://​qubedstudios.rustedlogic.net/​Mario64_HackingDoc1.5.txt