User Tools

Site Tools


super_mario_64:geometry_layout_commands

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
super_mario_64:geometry_layout_commands [2018/10/21 19:10]
David [14: Billboard Model and Translate (and Load Display List or Start Geo Layout)] Added documentation to the geo layout 0x14 command.
super_mario_64:geometry_layout_commands [2019/11/03 14:23]
jesusyoshi54 Added GraphNode data from decomp, added additional info for unknown cmds
Line 2: Line 2:
  
 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 [[super_mario_64:​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. 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 [[super_mario_64:​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.
 +Once geo layouts are loaded, they are processed into a graph node system. Graph nodes are a linked list that setup the rendering properties of display lists inside.
  
 ===== Drawing Layers ===== ===== Drawing Layers =====
  
 ^ Layer ^ Description ^ ^ Layer ^ Description ^
-| 00 | Unused ​+| 00 | Opaque no AA 
-| 01 | Opaque (Blending disabled). |+| 01 | Opaque ​has AA (Blending disabled). |
 | 02 | Decals or triangles that draw on top of geometry near the same depth (Lessened depth-range). Blending disabled. **Only** renders when //very close or on other polygons// on real hardware. | | 02 | Decals or triangles that draw on top of geometry near the same depth (Lessened depth-range). Blending disabled. **Only** renders when //very close or on other polygons// on real hardware. |
-| 03 | Unused ​|+| 03 | Intersecting Polygons (computes AA along the edge of intersection,​ otherwise opaque) ​|
 | 04 | Transparent pixels, no blending (OpenGL'​s equivalent is Alphatest). Allows perfect layering with other transparencies around it. | | 04 | Transparent pixels, no blending (OpenGL'​s equivalent is Alphatest). Allows perfect layering with other transparencies around it. |
 | 05 | Blending (translucency) enabled. Layering must be handled with the order of drawn faces. | | 05 | Blending (translucency) enabled. Layering must be handled with the order of drawn faces. |
 | 06 | Blending (translucency) enabled. Layering must be handled with the order of drawn faces. Decal mode like layer 2. Lessened depth-range. | | 06 | Blending (translucency) enabled. Layering must be handled with the order of drawn faces. Decal mode like layer 2. Lessened depth-range. |
 +| 07 | Blending enabled. Layering must be handled with the order of drawn faces. Intersecting mode like layer 3. |
 +
 +===== Graph Nodes =====
 +==== Graph Node Header ====
 +
 +Every graph node has the same header. Depending on the geo layout cmd, the subsequent bytes will be different. Like geo layouts, graph nodes have no length byte.
 +
 +^ value ^ type ^ description ^
 +| *0x00* | s16 type; | structure type |
 +| *0x02* | s16 flags; | hi = drawing layer, lo = graph render flags |
 +| *0x04* | struct GraphNode | previous node |
 +| *0x08* | struct GraphNode | next node |
 +| *0x0C* | struct GraphNode | parent node |
 +| *0x10* | struct GraphNode | child nodes |
 +
 +==== GraphNode Render Flags ====
 +
 +^ value ^ description ^
 +| 0x0001 | Render Active |
 +| 0x0002 | Render Children First |
 +| 0x0004 | Render Billboard |
 +| 0x0008 | Render Z Buffer |
 +| 0x0010 | Render Invisible |
 +| 0x0020 | Render Has Animation |
 +
 +==== GraphNode Types ====
 +
 +Types of graph nodes. This value goes inside the first byte of the graph node header once the geo layout is loaded.
 +
 +^ value ^ description ^
 +| 0x01 | root |
 +| 0x02 | ortho projection |
 +| 0x03 | perspective |
 +| 0x04 | master list |
 +| 0x0A | start |
 +| 0x0B | level of detail |
 +| 0x0c | switch case |
 +| 0x14 | camera |
 +| 0x15 | translation rotation |
 +| 0x16 | translation |
 +| 0x17 | rotation |
 +| 0x18 | object |
 +| 0x19 | animated part |
 +| 0x1A | billboard |
 +| 0x1B | display list |
 +| 0x1C | scale |
 +| 0x28 | shadow |
 +| 0x29 | object parent |
 +| 0x2A | generated list |
 +| 0x2C | background |
 +| 0x2E | held object|
 +| 0x2F | culling radius |
  
 ===== Geometry Layout Commands ===== ===== Geometry Layout Commands =====
Line 122: Line 175:
 ==== 08: Set Screen Render Area ==== ==== 08: Set Screen Render Area ====
 Only used in geo layout of levels. Only used in geo layout of levels.
 +Sets graph node type 0x0001
  
 ''​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>​]''​ ''​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>​]''​
Line 131: Line 185:
 | <color purple>​H</​color>​ | Height of screen | | <color purple>​H</​color>​ | Height of screen |
  
 +<code c>
 +struct GraphNodeRoot
 +{
 +    /*0x00*/ struct GraphNode node;
 +    /*0x14*/ u8 areaIndex;
 +    /*0x15*/ s8 unk15; // ?
 +    /*0x16*/ s16 x;
 +    /*0x18*/ s16 y;
 +    /*0x1A*/ s16 width; // half width, 160
 +    /*0x1C*/ s16 height; // half height
 +    /*0x1E*/ s16 numViews; // number of entries in mystery array
 +    /*0x20*/ struct GraphNode **views;
 +};
 +</​code>​
 Length: C Length: C
  
 ---- ----
  
-==== 09: Set Background Frustum ​Matrix ==== +==== 09: Create Ortho Matrix ==== 
-Sets the frustum ​matrix for level backgrounds.+Sets ortho matrix for level backgrounds.
  
 It is unknown if this command is actually necessary or not. You can remove this command from a level'​s geometry layout and it won't affect the background, and changing the scale value has no visible effect either. It is unknown if this command is actually necessary or not. You can remove this command from a level'​s geometry layout and it won't affect the background, and changing the scale value has no visible effect either.
Line 147: Line 215:
  
 <code c> <code c>
-/*  +struct ​GraphNodeOrthoProjection
-  Note: This is a simplified version of the code to explain what the 0x09 command does.  +
-  It is not a 1 to 1 translation of the actual source code. +
- +
-  All addresses are from the US ROM. +
-*/ +
- +
-void proc_8027BA98(struct ​GraphNode_Geo09* geo09_node)+
 { {
-  if(geo09_node->​children != 0) +    ​/*0x00*/ struct GraphNode node
-  { +    /*0x14*/ f32 scale
-    struct GraphNode_Geo08* screenRenderArea = 0x8032DEF0;​ +}
- +</​code>​
-    ​// These variables come from the geo layout 0x08 command. +
-    short x_pos = (short)screenRenderArea->​_0x16;​ +
-    short y_pos = (short)screenRenderArea->​_0x18;​ +
-    short width = (short)screenRenderArea->​_0x1A;​ +
-    short height = (short)screenRenderArea->​_0x1C;​ +
- +
-    // Near scale is the parameter you set with the 0x09 command. +
-    float nearScale = (float)geo09_node->​_0x14;​ +
- +
-    // Reserve 0x40 bytes to store result matrix. +
-    Mtxm = proc_80278F2C(0x40);​ +
- +
-    // Calculate frustum matrix +
-    guFrustum( +
-      m, // Pointer to 4x4 matrix resulting from calculation +
-      ((x_pos - width) / 2.0f) nearScale, ​// Near plane'​s lower-left x coordinate +
-      ((x_pos + width) / 2.0f) * nearScale, // Near plane'​s upper-right x coordinate +
-      ((y_pos + height) / 2.0f) * nearScale, // Near plane'​s lower-left y coordinate +
-      ((y_pos - height) / 2.0f) * nearScale, // Near plane'​s upper-right y coordinate +
-      -2.0f, // Distance from viewpoint to near clipping plane +
-      2.0f, // Distance from viewpoint to far clipping plane +
-      1.0f // Scale for matrix elements +
-    ); +
- +
-    int** ptrToMasterDL = 0x8033B06C;​ +
- +
-    // Add Fast3D cmd 0xB4 (G_RDPHALF_1) to master display list +
-    ​*((*ptrToMasterDL) + 0) = 0xB4000000;​ +
-    *((*ptrToMasterDL) + 4) = 0x0000FFFF;​ +
- +
-    *ptrToMasterDL += 8; // Move by 8 bytes. +
- +
-    // Add matrix command to master display list to process the matrix '​m'​. +
-    // Parameters used: G_MTX_PUSH and G_MTX_LOAD +
-    *((*ptrToMasterDL) + 0) = 0x01030040+
-    ​*((*ptrToMasterDL) + 4) = m & 0x1FFFFFFF+
- +
-    *ptrToMasterDL += 8; // Move by 8 bytes. +
- +
-    proc_8027DEA8(geo09_node->​children);​ // Process children of this GeoNode +
-  } +
-}</​code>​+
  
 ---- ----
Line 207: Line 226:
 ==== 0A: Set Camera Frustum ==== ==== 0A: Set Camera Frustum ====
 Set camera frustum properties. Only used in geo layout of levels. Set camera frustum properties. Only used in geo layout of levels.
 +GraphNode type 0x03
  
 ''​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>​}''​ ''​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>​}''​
Line 215: Line 235:
 | <color darkblue>​F</​color>​ | Camera Far | | <color darkblue>​F</​color>​ | Camera Far |
 | <color purple>​E</​color>​ | optional ASM function if <color darkred>​A</​color>​ is non-zero (always ​ 8029AA3C) | | <color purple>​E</​color>​ | optional ASM function if <color darkred>​A</​color>​ is non-zero (always ​ 8029AA3C) |
 +
 +<code c>
 +struct GraphNodePerspective
 +{
 +    /*0x00*/ struct FnGraphNode fnNode;
 +    /*0x14*/ void *Function
 +    /*0x18*/ s32 unused;
 +    /*0x1C*/ f32 fov;   // horizontal field of view in degrees
 +    /*0x20*/ s16 near;  // near clipping plane
 +    /*0x22*/ s16 far;   // far clipping plane
 +};
 +</​code>​
  
 Length: 8-C (variable) Length: 8-C (variable)
Line 224: Line 256:
  
 ''​0B 00 00 00''​ ''​0B 00 00 00''​
 +
 +<code c>
 +struct GraphNodeStart
 +{
 +    /*0x00*/ struct GraphNode node;
 +};
 +</​code>​
  
 Length: 4 Length: 4
Line 232: Line 271:
  
 This command is used in level geometry layouts. Z-Buffering is disabled when rendering the skybox, and re-enabled when rendering level geometry. This command is used in level geometry layouts. Z-Buffering is disabled when rendering the skybox, and re-enabled when rendering level geometry.
 +GraphNode type 0x04
  
 ''​0C [<color darkgray>​AA</​color>​] 00 00''​ ''​0C [<color darkgray>​AA</​color>​] 00 00''​
Line 249: Line 289:
 ==== 0D: Set Render Range ==== ==== 0D: Set Render Range ====
 Used in WF, CCM, TTM, SSL levels and some geo layouts. This command will make the following node only render in a certain distance range away from the camera. Used in WF, CCM, TTM, SSL levels and some geo layouts. This command will make the following node only render in a certain distance range away from the camera.
 +GraphNode type 0x0B
  
 ''​0D 00 00 00 [<color darkred>​AA AA</​color>​] [<color darkgreen>​BB BB</​color>​]''​ ''​0D 00 00 00 [<color darkred>​AA AA</​color>​] [<color darkgreen>​BB BB</​color>​]''​
Line 270: Line 311:
   0049E3EC / 0E00099C [ 01 00 00 00 ]   0049E3EC / 0E00099C [ 01 00 00 00 ]
  
 +<code c> 
 +struct GraphNodeLevelOfDetail 
 +
 +    /*0x00*/ struct GraphNode node; 
 +    /*0x14*/ s16 minDistance;​ 
 +    /*0x16*/ s16 maxDistance;​ 
 +}; 
 +</​code>​
 Length: 8 Length: 8
  
Line 277: Line 325:
 ==== 0E: Switch Case ==== ==== 0E: Switch Case ====
 Loads ASM in RAM that switches between the receding display lists within the node. Loads ASM in RAM that switches between the receding display lists within the node.
 +GraphNode type 0x0C
  
 ''​0E 00 00 [<color darkgray>​NN</​color>​] [<color purple>​AA AA AA AA</​color>​]''​ ''​0E 00 00 [<color darkgray>​NN</​color>​] [<color purple>​AA AA AA AA</​color>​]''​
Line 282: Line 331:
 | <color darkgray>​N</​color>​ | Number of cases/​display lists, starting at 01 | | <color darkgray>​N</​color>​ | Number of cases/​display lists, starting at 01 |
 | <color purple>​A</​color>​ | ASM Function | | <color purple>​A</​color>​ | ASM Function |
 +
 +<code c>
 +struct GraphNodeSwitchCase
 +{
 +    /*0x00*/ struct FnGraphNode fnNode;
 +    /*0x14*/ void *Function
 +    /*0x18*/ s32 unused;
 +    /*0x1C*/ s16 numCases;
 +    /*0x1E*/ s16 selectedCase;​
 +};
 +</​code>​
  
 Length: 8 Length: 8
Line 287: Line 347:
 ---- ----
  
-==== 0F: ?? ====+==== 0F: Create Camera Graph Node ==== 
 +GraphNode type 0x14.
  
 ''​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>​]''​ ''​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 darkgray>​T</​color>​ | cam type 
-| <color darkred>​X</​color>​ | ?? (s16) | +| <color darkred>​X</​color>​ | x location ​(s16) | 
-| <color darkgreen>​Y</​color>​ | ?? (s16) | +| <color darkgreen>​Y</​color>​ | y location ​(s16) | 
-| <color darkblue>​Z</​color>​ | ?? (s16) | +| <color darkblue>​Z</​color>​ | z location ​(s16) | 
-| <color red>​U</​color>​ | ?? (s16) | +| <color red>​U</​color>​ | x focus (s16) | 
-| <color green>​V</​color>​ | ?? (s16) | +| <color green>​V</​color>​ | y focus (s16) | 
-| <color blue>​W</​color>​ | ?? (s16) |+| <color blue>​W</​color>​ | z focuz (s16) |
 | <color purple>​A</​color>​ | ASM function. Always 80287D30 (levels) or 00 (menus) | | <color purple>​A</​color>​ | ASM function. Always 80287D30 (levels) or 00 (menus) |
 +
 +<code c>
 +struct GraphNodeCamera
 +{
 +    /*0x00*/ struct FnGraphNode fnNode;
 +    /*0x18*/ union {
 +        s32 preset;
 +        struct LevelCamera *levelCamera;​
 +    } config;
 +    /*0x1C*/ Vec3f from;
 +    /*0x28*/ Vec3f to;
 +    /*0x34*/ void *matrixPtr; // pointer to look-at matrix of this camera as a Mat4
 +    /*0x38*/ s16 roll; // roll in look at matrix. Doesn'​t account for light direction unlike rollScreen.
 +    /*0x3A*/ s16 rollScreen; // rolls screen while keeping the light direction consistent
 +};
 +</​code>​
  
 Length: 0x14 Length: 0x14
Line 306: Line 383:
 ==== 10: Translate and Rotate ==== ==== 10: Translate and Rotate ====
 Applies translation & rotation to the following node. Applies translation & rotation to the following node.
 +GraphNode type 0x15
  
 ''​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>​]''​ ''​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>​]''​
Line 317: Line 395:
 | <color green>​RY</​color>​ | Y rotation (s16) | | <color green>​RY</​color>​ | Y rotation (s16) |
 | <color blue>​RZ</​color>​ | Z rotation (s16) | | <color blue>​RZ</​color>​ | Z rotation (s16) |
 +
 +<code c>
 +struct GraphNodeTranslationRotation
 +{
 +    /*0x00*/ struct GraphNode node;
 +    /*0x14*/ void *displayList;​
 +    /*0x18*/ Vec3s translation;​
 +    /*0x1E*/ Vec3s rotation;
 +};
 +</​code>​
  
 Length: 0x10 Length: 0x10
Line 323: Line 411:
 ==== 11: Translate Node (and Load Display List or Start Geo Layout) ==== ==== 11: Translate Node (and Load Display List or Start Geo Layout) ====
 Applies translation to the child nodes, and a display list if one is specified. You can start a geometry layout with this command to set the offset for the entire model. You cannot start a geometry layout and load a display list at the same time, as it will cause the game to freeze (white-screen). Applies translation to the child nodes, and a display list if one is specified. You can start a geometry layout with this command to set the offset for the entire model. You cannot start a geometry layout and load a display list at the same time, as it will cause the game to freeze (white-screen).
 +GraphNode type 0x16
  
  
Line 334: Line 422:
 | <color darkblue>​Z</​color>​ | Z translation offset (s16) | | <color darkblue>​Z</​color>​ | Z translation offset (s16) |
 | <color purple>​A</​color>​ | Segmented address with display list if <color orange>​B</​color>​ is set. \\ Also creates a joint of some kind? (Does not work with animations?​) | | <color purple>​A</​color>​ | Segmented address with display list if <color orange>​B</​color>​ is set. \\ Also creates a joint of some kind? (Does not work with animations?​) |
 +
 +<code c>
 +struct GraphNodeTranslation
 +{
 +    /*0x00*/ struct GraphNode node;
 +    /*0x14*/ void *displayList;​
 +    /*0x18*/ Vec3s translation;​
 +    u8 pad1E[2];
 +};
 +</​code>​
  
 Length: 8-C (variable) Length: 8-C (variable)
Line 378: Line 476:
 ==== 12: Rotate Node (and Load Display List or Start Geo Layout) ==== ==== 12: Rotate Node (and Load Display List or Start Geo Layout) ====
 Applies rotation to the child nodes, and a display list if one is specified. You can start a geometry layout with this command to set the rotation for the entire model. You cannot start a geometry layout and load a display list at the same time, as it will cause the game to freeze (white-screen). Applies rotation to the child nodes, and a display list if one is specified. You can start a geometry layout with this command to set the rotation for the entire model. You cannot start a geometry layout and load a display list at the same time, as it will cause the game to freeze (white-screen).
 +GraphNode type 0x17
  
 ''​12 [<color orange>​B</​color>​][<​color lightgrey>​L</​color>​] [<color darkred>​RX RX</​color>​] [<color darkgreen>​RY RY</​color>​] [<color darkblue>​RZ RZ</​color>​] {<color purple>​AA AA AA AA</​color>​}''​ ''​12 [<color orange>​B</​color>​][<​color lightgrey>​L</​color>​] [<color darkred>​RX RX</​color>​] [<color darkgreen>​RY RY</​color>​] [<color darkblue>​RZ RZ</​color>​] {<color purple>​AA AA AA AA</​color>​}''​
Line 387: Line 486:
 | <color darkblue>​RZ</​color>​ | Z rotation (s16) | | <color darkblue>​RZ</​color>​ | Z rotation (s16) |
 | <color purple>​A</​color>​ | Segmented address with display list if <color orange>​B</​color>​ is set.\\ Also creates a joint of some kind? (Does not work with animations?​) | | <color purple>​A</​color>​ | Segmented address with display list if <color orange>​B</​color>​ is set.\\ Also creates a joint of some kind? (Does not work with animations?​) |
 +
 +<​code>​
 +struct GraphNodeRotation
 +{
 +    /*0x00*/ struct GraphNode node;
 +    /*0x14*/ void *displayList;​
 +    /*0x18*/ Vec3s rotation;
 +    u8 pad1E[2];
 +};
 +</​code>​
  
 Length: 8-C (variable) Length: 8-C (variable)
Line 397: Line 506:
 ==== 13: Load Display List With Offset ==== ==== 13: Load Display List With Offset ====
 Loads display list with drawing layer and offsets the model and the node's children on X/Y/Z axis. Loads display list with drawing layer and offsets the model and the node's children on X/Y/Z axis.
 +GraphNode type 0x19
  
 ''​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>​]''​ ''​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>​]''​
Line 405: Line 515:
 | <color darkblue>​Z</​color>​ | Offset on Z 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 | | <color purple>​A</​color>​ | Segmented address with display list \\ If 0x00000000, an invisible rotation joint is created |
 +
 +<code c>
 +struct GraphNodeAnimatedPart
 +{
 +    /*0x00*/ struct GraphNode node;
 +    /*0x14*/ void *displayList;​
 +    /*0x18*/ Vec3s translation;​
 +};
 +</​code>​
 +
 + * GraphNode part that transforms itself and its children based on animation data. This animation data is not stored in the node itself but in global variables that are set when object nodes are processed if the object has animation. Used for Mario, enemies and anything else with animation data. The display list can be null, in which case it won't draw anything itself.
  
 Length: C Length: C
Line 412: Line 533:
 ==== 14: Billboard Model and Translate (and Load Display List or Start Geo Layout) ==== ==== 14: Billboard Model and Translate (and Load Display List or Start Geo Layout) ====
 Almost identical with the geometry layout 0x11 command, except that it will billboard the node and it's children without needing the use of 0x21 in the behavior script. You can start a geometry layout with this command to billboard and set the offset for the entire model. You cannot start a geometry layout and load a display list at the same time, as it will cause the game to freeze (white-screen). Almost identical with the geometry layout 0x11 command, except that it will billboard the node and it's children without needing the use of 0x21 in the behavior script. You can start a geometry layout with this command to billboard and set the offset for the entire model. You cannot start a geometry layout and load a display list at the same time, as it will cause the game to freeze (white-screen).
 +GraphNode type 0x1A
  
 ''​14 [<color orange>​B</​color>​][<​color lightgrey>​L</​color>​] [<color darkred>​XX XX</​color>​] [<color darkgreen>​YY YY</​color>​] [<color darkblue>​ZZ ZZ</​color>​] {<color purple>​AA AA AA AA</​color>​}''​ ''​14 [<color orange>​B</​color>​][<​color lightgrey>​L</​color>​] [<color darkred>​XX XX</​color>​] [<color darkgreen>​YY YY</​color>​] [<color darkblue>​ZZ ZZ</​color>​] {<color purple>​AA AA AA AA</​color>​}''​
Line 421: Line 543:
 | <color darkblue>​Z</​color>​ | Z translation offset (s16) | | <color darkblue>​Z</​color>​ | Z translation offset (s16) |
 | <color purple>​A</​color>​ | Segmented address with display list if <color orange>​B</​color>​ is set. \\ Also creates a joint of some kind? (Does not work with animations?​) | | <color purple>​A</​color>​ | Segmented address with display list if <color orange>​B</​color>​ is set. \\ Also creates a joint of some kind? (Does not work with animations?​) |
 +
 +<code c>
 +struct GraphNodeBillboard
 +{
 +    /*0x00*/ struct GraphNode node;
 +    /*0x14*/ void *displayList;​
 +    /*0x18*/ Vec3s translation;​
 +};
 +</​code>​
  
 Length: 8-C (variable) Length: 8-C (variable)
Line 428: Line 559:
 ==== 15: Load Display List ==== ==== 15: Load Display List ====
 Loads display list with drawing layer and no other properties. Loads display list with drawing layer and no other properties.
 +GraphNode type 0x1B
  
 ''​15 [<color darkgray>​LL</​color>​] 00 00 [<color purple>​AA AA AA AA</​color>​]''​ ''​15 [<color darkgray>​LL</​color>​] 00 00 [<color purple>​AA AA AA AA</​color>​]''​
Line 434: Line 566:
 | <color purple>​A</​color>​ | Segmented address with display list | | <color purple>​A</​color>​ | Segmented address with display list |
  
 +<code c>
 +struct GraphNodeDisplayList
 +{
 +    /*0x00*/ struct GraphNode node;
 +    /*0x14*/ void *displayList;​
 +};
 +</​code>​
 Length: 8 Length: 8
  
Line 440: Line 579:
 ==== 16: Start Geo Layout with Shadow ==== ==== 16: Start Geo Layout with Shadow ====
 Used at start of the geo layout, with shadow type, solidity, and size. Used at start of the geo layout, with shadow type, solidity, and size.
 +GraphNode type 0x28
  
 ''​16 00 00 [<color darkred>​AA</​color>​] 00 [<color darkgreen>​BB</​color>​] [<color darkblue>​CC CC</​color>​]''​ ''​16 00 00 [<color darkred>​AA</​color>​] 00 [<color darkgreen>​BB</​color>​] [<color darkblue>​CC CC</​color>​]''​
Line 446: Line 586:
 | <color darkgreen>​B</​color>​ | Shadow solidity (00=invisible,​ FF=black) | | <color darkgreen>​B</​color>​ | Shadow solidity (00=invisible,​ FF=black) |
 | <color darkblue>​C</​color>​ | Shadow scale | | <color darkblue>​C</​color>​ | Shadow scale |
 +
 +<code c>
 +struct GraphNodeShadow
 +{
 +    /*0x00*/ struct GraphNode node;
 +    /*0x14*/ s16 shadowScale;​ // diameter (when a circle) or side (when a square) of shadow
 +    /*0x16*/ u8 shadowSolidity;​ // opacity of shadow, 255 = opaque
 +    /*0x17*/ u8 shadowType; // see ShadowType enum in shadow.h
 +};
 +enum ShadowType
 +{
 +    SHADOW_CIRCLE_9_VERTS = 0,
 +    SHADOW_CIRCLE_4_VERTS = 1,
 +    SHADOW_CIRCLE_4_VERTS_FLAT_UNUSED = 2,
 +    SHADOW_SQUARE_PERMANENT = 10,
 +    SHADOW_SQUARE_SCALABLE = 11,
 +    SHADOW_SQUARE_TOGGLABLE = 12,
 +    /**
 +     * This defines an offset after which rectangular shadows with custom
 +     * widths and heights can be defined.
 +     */
 +    SHADOW_RECTANGLE_HARDCODED_OFFSET = 50,
 +    SHADOW_CIRCLE_PLAYER = 99
 +};
 +</​code>​
  
 Length: 8 Length: 8
Line 451: Line 616:
 ---- ----
  
-==== 17: Set Up Object ​Rendering? ​==== +==== 17: Create ​Object ​List ==== 
-Sets up rendering for 3D ObjectsWithout it, 0x24 objects placed in level do not render.+Sets up rendering for 3D ObjectsWithout it, 0x24 objects placed in level do not render. 
 +GraphNode type 0x29
  
 ''​17 00 00 00''​ ''​17 00 00 00''​
Line 462: Line 628:
 ==== 18: Load Polygons ASM ==== ==== 18: Load Polygons ASM ====
 Used in some original objects to point to ASM in RAM, for misc. effects such as vertex rippling. ​ Used in some original objects to point to ASM in RAM, for misc. effects such as vertex rippling. ​
 +GraphNode type 0x2A
  
 The 3rd and 4th bytes are parameters passed into the asm function. Argument register a1 is a pointer to the node data, and the parameters are stored as a word at offset 0x18. The 3rd and 4th bytes are parameters passed into the asm function. Argument register a1 is a pointer to the node data, and the parameters are stored as a word at offset 0x18.
Line 469: Line 636:
 | <color purple>​X</​color>​ | Parameter(s) passed into asm function. **a1->​0x18** | | <color purple>​X</​color>​ | Parameter(s) passed into asm function. **a1->​0x18** |
 | <color darkred>​A</​color>​ | ASM RAM Address | | <color darkred>​A</​color>​ | ASM RAM Address |
 +
 +<code c>
 +struct GraphNodeGenerated
 +{
 +    /*0x00*/ struct FnGraphNode fnNode;
 +    /*0x18*/ u32 parameter; // extra context for the function
 +};
 +</​code>​
  
 Length: 8 Length: 8
Line 476: Line 651:
 ==== 19: Set Background ==== ==== 19: Set Background ====
 Set background image or color. Set background image or color.
 +GraphNode type 0x2C
  
 ''​19 00 [<color darkgrey>​TT TT</​color>​] [<color purple>​AA AA AA AA</​color>​]''​ ''​19 00 [<color darkgrey>​TT TT</​color>​] [<color purple>​AA AA AA AA</​color>​]''​
Line 481: Line 657:
 | <color darkgrey>​T</​color>​ | If <color purple>​A</​color>​ == 0, RGBA color, else background ID | | <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 | | <color purple>​A</​color>​ | ASM function to set the background image, always 0x802763D4 |
 +
 +<code c>
 +struct GraphNodeBackground
 +{
 +    /*0x00*/ struct FnGraphNode fnNode;
 +    /*0x18*/ s32 unused;
 +    /*0x1C*/ s32 background; // background ID, or rgba5551 color if fnNode.func is null
 +};
 +</​code>​
  
 Length: 8 Length: 8
Line 508: Line 693:
 ==== 1D: Scale Model ==== ==== 1D: Scale Model ====
 Scales the receding data uniformly. Scales the receding data uniformly.
 +GraphNode type 0x1c
  
-''​1D [<color darkred>​A</​color>​][<​color darkgreen>​B</​color>​] 00 00 [<color darkblue>​SS SS SS SS</​color>​] {?? ?? ?? ??}''​+''​1D [<color darkred>​A</​color>​][<​color darkgreen>​B</​color>​] 00 00 [<color darkblue>​SS SS SS SS</​color>​] {DD DD DD DD}''​
  
 | <color darkred>​A</​color>​ | If MSbit is set, load B and ?? | | <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 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%) | | <color darkblue>​S</​color>​ | Scale percentage (0x10000 = 100%) |
-?? | optional word used if the MSbit of <color darkred>​A</​color>​ is set |+DD | optional word used if the MSbit of <color darkred>​A</​color>​ is set | 
 + 
 +<code c> 
 +struct GraphNodeScale 
 +
 +    /*0x00*/ struct GraphNode node; 
 +    /*0x14*/ void *displayList;​ 
 +    /*0x18*/ f32 scale; 
 +}; 
 +</​code>​
  
 Length: 8-C (variable) Length: 8-C (variable)
Line 538: Line 733:
 ==== 20: Start Geo Layout with Render Area ==== ==== 20: Start Geo Layout with Render Area ====
 Starts the geometry layout with no shadow and a render area. Starts the geometry layout with no shadow and a render area.
 +GraphNode type 0x2F. If not set, a default of 300 is used.
  
 ''​20 00 [<color darkred>​AA AA</​color>​]''​ ''​20 00 [<color darkred>​AA AA</​color>​]''​
Line 543: Line 739:
 | <color darkred>​A</​color>​ | Render distance? | | <color darkred>​A</​color>​ | Render distance? |
  
 +<code c>
 +struct GraphNodeCullingRadius
 +{
 +    /*0x00*/ struct GraphNode node;
 +    /*0x14*/ s16 cullingRadius;​ // specifies the '​sphere radius'​ for purposes of frustrum culling
 +    u8 pad1E[2];
 +};
 +</​code>​
 Length: 4 Length: 4
  
Line 549: Line 753:
  
 ===== References ===== ===== References =====
 +  * https://​github.com/​n64decomp/​sm64/​blob/​master/​
   * http://​origami64.net/​showthread.php?​tid=9   * http://​origami64.net/​showthread.php?​tid=9
   * http://​www.smwcentral.net/?​p=viewthread&​t=74776   * http://​www.smwcentral.net/?​p=viewthread&​t=74776
   * https://​sites.google.com/​site/​kazemario64/​geo-layout-polygon-commands   * https://​sites.google.com/​site/​kazemario64/​geo-layout-polygon-commands
   * http://​qubedstudios.rustedlogic.net/​Mario64_HackingDoc1.5.txt   * http://​qubedstudios.rustedlogic.net/​Mario64_HackingDoc1.5.txt
super_mario_64/geometry_layout_commands.txt · Last modified: 2019/11/03 14:23 by jesusyoshi54