Super Mario 64 Source
A Super Mario 64 decompilation, brought to you by a bunch of clever folks.
Data Structures | Macros | Typedefs | Functions | Variables
graph_node.h File Reference
#include "types.h"
#include "game/memory.h"

Go to the source code of this file.

Data Structures

struct  FnGraphNode
 An extension of a graph node that includes a function pointer. More...
 
struct  GraphNodeRoot
 The very root of the geo tree. More...
 
struct  GraphNodeOrthoProjection
 A node that sets up an orthographic projection based on the global root node. More...
 
struct  GraphNodePerspective
 A node that sets up a perspective projection. More...
 
struct  DisplayListNode
 An entry in the master list. More...
 
struct  GraphNodeMasterList
 GraphNode that manages the 8 top-level display lists that will be drawn Each list has its own render mode, so for example water is drawn in a different master list than opaque objects. More...
 
struct  GraphNodeStart
 Simply used as a parent to group multiple children. More...
 
struct  GraphNodeLevelOfDetail
 GraphNode that only renders its children if the current transformation matrix has a z-translation (in camera space) greater than minDistance and less than maxDistance. More...
 
struct  GraphNodeSwitchCase
 GraphNode that renders exactly one of its children. More...
 
struct  GraphNodeCamera
 GraphNode that specifies the location and aim of the camera. More...
 
struct  GraphNodeTranslationRotation
 GraphNode that translates and rotates its children. More...
 
struct  GraphNodeTranslation
 GraphNode that translates itself and its children. More...
 
struct  GraphNodeRotation
 GraphNode that rotates itself and its children. More...
 
struct  GraphNodeAnimatedPart
 GraphNode part that transforms itself and its children based on animation data. More...
 
struct  GraphNodeBillboard
 A GraphNode that draws a display list rotated in a way to always face the camera. More...
 
struct  GraphNodeDisplayList
 A GraphNode that simply draws a display list without doing any transformation beforehand. More...
 
struct  GraphNodeScale
 GraphNode part that scales itself and its children. More...
 
struct  GraphNodeShadow
 GraphNode that draws a shadow under an object. More...
 
struct  GraphNodeObjectParent
 GraphNode that contains as its sharedChild a group node containing all object nodes. More...
 
struct  GraphNodeGenerated
 GraphNode that draws display lists not directly in memory but generated by a function. More...
 
struct  GraphNodeBackground
 GraphNode that draws a background image or a rectangle of a color. More...
 
struct  GraphNodeHeldObject
 Renders the object that Mario is holding. More...
 
struct  GraphNodeCullingRadius
 A node that allows an object to specify a different culling radius than the default one of 300. More...
 

Macros

#define GRAPH_RENDER_ACTIVE   (1 << 0)
 
#define GRAPH_RENDER_CHILDREN_FIRST   (1 << 1)
 
#define GRAPH_RENDER_BILLBOARD   (1 << 2)
 
#define GRAPH_RENDER_Z_BUFFER   (1 << 3)
 
#define GRAPH_RENDER_INVISIBLE   (1 << 4)
 
#define GRAPH_RENDER_HAS_ANIMATION   (1 << 5)
 
#define GRAPH_NODE_TYPE_FUNCTIONAL   0x100
 
#define GRAPH_NODE_TYPE_ROOT   0x001
 
#define GRAPH_NODE_TYPE_ORTHO_PROJECTION   0x002
 
#define GRAPH_NODE_TYPE_PERSPECTIVE   (0x003 | GRAPH_NODE_TYPE_FUNCTIONAL)
 
#define GRAPH_NODE_TYPE_MASTER_LIST   0x004
 
#define GRAPH_NODE_TYPE_START   0x00A
 
#define GRAPH_NODE_TYPE_LEVEL_OF_DETAIL   0x00B
 
#define GRAPH_NODE_TYPE_SWITCH_CASE   (0x00C | GRAPH_NODE_TYPE_FUNCTIONAL)
 
#define GRAPH_NODE_TYPE_CAMERA   (0x014 | GRAPH_NODE_TYPE_FUNCTIONAL)
 
#define GRAPH_NODE_TYPE_TRANSLATION_ROTATION   0x015
 
#define GRAPH_NODE_TYPE_TRANSLATION   0x016
 
#define GRAPH_NODE_TYPE_ROTATION   0x017
 
#define GRAPH_NODE_TYPE_OBJECT   0x018
 
#define GRAPH_NODE_TYPE_ANIMATED_PART   0x019
 
#define GRAPH_NODE_TYPE_BILLBOARD   0x01A
 
#define GRAPH_NODE_TYPE_DISPLAY_LIST   0x01B
 
#define GRAPH_NODE_TYPE_SCALE   0x01C
 
#define GRAPH_NODE_TYPE_SHADOW   0x028
 
#define GRAPH_NODE_TYPE_OBJECT_PARENT   0x029
 
#define GRAPH_NODE_TYPE_GENERATED_LIST   (0x02A | GRAPH_NODE_TYPE_FUNCTIONAL)
 
#define GRAPH_NODE_TYPE_BACKGROUND   (0x02C | GRAPH_NODE_TYPE_FUNCTIONAL)
 
#define GRAPH_NODE_TYPE_HELD_OBJ   (0x02E | GRAPH_NODE_TYPE_FUNCTIONAL)
 
#define GRAPH_NODE_TYPE_CULLING_RADIUS   0x02F
 
#define GFX_NUM_MASTER_LISTS   8
 
#define GEO_CONTEXT_CREATE   0
 
#define GEO_CONTEXT_RENDER   1
 
#define GEO_CONTEXT_AREA_UNLOAD   2
 
#define GEO_CONTEXT_AREA_LOAD   3
 
#define GEO_CONTEXT_AREA_INIT   4
 
#define GEO_CONTEXT_HELD_OBJ   5
 

Typedefs

typedef s32(* GraphNodeFunc) (s32 callContext, struct GraphNode *node, void *context)
 

Functions

void init_scene_graph_node_links (struct GraphNode *, s32)
 Initialize a geo node with a given type. More...
 
struct GraphNodeRootinit_graph_node_root (struct AllocOnlyPool *, struct GraphNodeRoot *, s16, s16 x, s16 y, s16 width, s16 height)
 Allocated and returns a newly created root node. More...
 
struct GraphNodeOrthoProjectioninit_graph_node_ortho_projection (struct AllocOnlyPool *, struct GraphNodeOrthoProjection *, f32)
 Allocates and returns a newly created otrhographic projection node. More...
 
struct GraphNodePerspectiveinit_graph_node_perspective (struct AllocOnlyPool *pool, struct GraphNodePerspective *sp1c, f32 sp20, s16 sp26, s16 sp2a, GraphNodeFunc sp2c, s32 sp30)
 Allocates and returns a newly created perspective node. More...
 
struct GraphNodeStartinit_graph_node_start (struct AllocOnlyPool *pool, struct GraphNodeStart *sp1c)
 Allocates and returns a newly created start node. More...
 
struct GraphNodeMasterListinit_graph_node_master_list (struct AllocOnlyPool *pool, struct GraphNodeMasterList *, s16 sp22)
 Allocates and returns a newly created master list node. More...
 
struct GraphNodeLevelOfDetailinit_graph_node_render_range (struct AllocOnlyPool *pool, struct GraphNodeLevelOfDetail *graphNode, s16 minDistance, s16 maxDistance)
 Allocates and returns a newly created render range node. More...
 
struct GraphNodeSwitchCaseinit_graph_node_switch_case (struct AllocOnlyPool *pool, struct GraphNodeSwitchCase *graphNode, s16 numCases, s16 sp26, GraphNodeFunc nodeFunc, s32 sp2c)
 Allocates and returns a newly created switch case node. More...
 
struct GraphNodeCamerainit_graph_node_camera (struct AllocOnlyPool *pool, struct GraphNodeCamera *sp1c, f32 *sp20, f32 *sp24, GraphNodeFunc sp28, s32 sp2c)
 Allocates and returns a newly created camera node. More...
 
struct GraphNodeTranslationRotationinit_graph_node_translation_rotation (struct AllocOnlyPool *pool, struct GraphNodeTranslationRotation *graphNode, s32 drawingLayer, void *displayList, Vec3s sp28, Vec3s sp2c)
 Allocates and returns a newly created translation rotation node. More...
 
struct GraphNodeTranslationinit_graph_node_translation (struct AllocOnlyPool *pool, struct GraphNodeTranslation *graphNode, s32 drawingLayer, void *displayList, Vec3s sp28)
 Allocates and returns a newly created translation node. More...
 
struct GraphNodeRotationinit_graph_node_rotation (struct AllocOnlyPool *pool, struct GraphNodeRotation *graphNode, s32 drawingLayer, void *displayList, Vec3s sp28)
 Allocates and returns a newly created rotation node. More...
 
struct GraphNodeScaleinit_graph_node_scale (struct AllocOnlyPool *pool, struct GraphNodeScale *graphNode, s32 drawingLayer, void *displayList, f32 sp28)
 Allocates and returns a newly created scaling node. More...
 
struct GraphNodeObjectinit_graph_node_object (struct AllocOnlyPool *pool, struct GraphNodeObject *graphNode, struct GraphNode *sp20, Vec3f pos, Vec3s angle, Vec3f scale)
 Allocates and returns a newly created object node. More...
 
struct GraphNodeCullingRadiusinit_graph_node_culling_radius (struct AllocOnlyPool *pool, struct GraphNodeCullingRadius *sp1c, s16 sp22)
 Allocates and returns a newly created frustum culling radius node. More...
 
struct GraphNodeAnimatedPartinit_graph_node_animated_part (struct AllocOnlyPool *pool, struct GraphNodeAnimatedPart *graphNode, s32 drawingLayer, void *displayList, Vec3s relativePos)
 Allocates and returns a newly created animated part node. More...
 
struct GraphNodeBillboardinit_graph_node_billboard (struct AllocOnlyPool *pool, struct GraphNodeBillboard *graphNode, s32 drawingLayer, void *displayList, Vec3s sp28)
 Allocates and returns a newly created billboard node. More...
 
struct GraphNodeDisplayListinit_graph_node_display_list (struct AllocOnlyPool *pool, struct GraphNodeDisplayList *graphNode, s32 drawingLayer, void *displayList)
 Allocates and returns a newly created displaylist node. More...
 
struct GraphNodeShadowinit_graph_node_shadow (struct AllocOnlyPool *pool, struct GraphNodeShadow *sp1c, s16 sp22, u8 sp27, u8 sp2b)
 Allocates and returns a newly created shadow node. More...
 
struct GraphNodeObjectParentinit_graph_node_object_parent (struct AllocOnlyPool *pool, struct GraphNodeObjectParent *sp1c, struct GraphNode *sp20)
 Allocates and returns a newly created object parent node. More...
 
struct GraphNodeGeneratedinit_graph_node_generated (struct AllocOnlyPool *pool, struct GraphNodeGenerated *sp1c, GraphNodeFunc sp20, s32 sp24)
 Allocates and returns a newly created generated node. More...
 
struct GraphNodeBackgroundinit_graph_node_background (struct AllocOnlyPool *pool, struct GraphNodeBackground *sp1c, u16 sp22, GraphNodeFunc sp24, s32 sp28)
 Allocates and returns a newly created background node. More...
 
struct GraphNodeHeldObjectinit_graph_node_held_object (struct AllocOnlyPool *pool, struct GraphNodeHeldObject *sp1c, s32 sp20, Vec3s sp24, GraphNodeFunc sp28, s32 sp2c)
 Allocates and returns a newly created held object node. More...
 
struct GraphNodegeo_add_child (struct GraphNode *, struct GraphNode *)
 Adds 'childNode' to the end of the list children from 'parent'. More...
 
struct GraphNodegeo_remove_child (struct GraphNode *)
 Remove a node from the scene graph. More...
 
struct GraphNodegeo_make_first_child (struct GraphNode *a0)
 Reorders the given node so it's the first child of its parent. More...
 
void geo_call_global_function_nodes_helper (struct GraphNode *, s32)
 Helper function for geo_call_global_function_nodes that recursively traverses the scene graph and calls the functions of global nodes. More...
 
void geo_call_global_function_nodes (struct GraphNode *graphNode, s32 sp1c)
 Call the update functions of geo nodes that are stored in global variables. More...
 
void geo_reset_object_node (struct GraphNodeObject *sp20)
 When objects are cleared, this is called on all object nodes (loaded or unloaded). More...
 
void geo_obj_init (struct GraphNodeObject *sp18, void *sp1c, Vec3f sp20, Vec3s sp24)
 Initialize an object node using the given parameters. More...
 
void geo_obj_init_spawninfo (struct GraphNodeObject *sp18, struct SpawnInfo *sp1c)
 Initialize and object node using the given SpawnInfo struct. More...
 
void geo_obj_init_animation (struct GraphNodeObject *, void *)
 Initialize the animation of an object node. More...
 
void geo_obj_init_animation_accel (struct GraphNodeObject *sp30, void *sp34, u32 sp38)
 Initialize the animation of an object node. More...
 
s32 retrieve_animation_index (s32 a0, u16 **a1)
 Retrieves an index into animation data based on the attribute pointer An attribute is an x-, y- or z-component of the translation / rotation for a part Each attribute is a pair of s16's, where the first s16 represents the maximum frame and the second s16 the actual index. More...
 
s16 geo_update_animation_frame (struct GraphNodeObject_sub *a0, s32 *a1)
 Update the animation frame of an object. More...
 
void geo_retreive_animation_translation (struct GraphNodeObject *sp28, Vec3f sp2c)
 Unused function to retrieve an object's current animation translation Assumes that it has x, y and z data in animations, which isn't always the case since some animation types only have vertical or lateral translation. More...
 
struct GraphNodeRootgeo_find_root (struct GraphNode *graphNode)
 Unused function to find the root of the geo node tree, which should be a GraphNodeRoot. More...
 
s16read_vec3s_to_vec3f (Vec3f, s16 *src)
 Takes a pointer to three shorts (supplied by a geo layout script) and copies it to the destination float vector. More...
 
s16read_vec3s (Vec3s dst, s16 *src)
 Takes a pointer to three shorts (supplied by a geo layout script) and copies it to the destination vector. More...
 
s16read_vec3s_angle (Vec3s dst, s16 *src)
 Takes a pointer to three angles in degrees (supplied by a geo layout script) and converts it to a vector of three in-game angle units in [-32768, 32767] range. More...
 
void register_scene_graph_node (struct GraphNode *)
 Add the given graph node as a child to the current top of the gfx stack: 'gCurGraphNodeList'. More...
 

Variables

struct GraphNodeMasterListgCurGraphNodeMasterList
 
struct GraphNodePerspectivegCurGraphNodeCamFrustum
 
struct GraphNodeCameragCurGraphNodeCamera
 
struct GraphNodeHeldObjectgCurGraphNodeHeldObject
 
u16 gAreaUpdateCounter
 
struct GraphNodegCurRootGraphNode
 
struct GraphNodegCurGraphNodeList []
 
s16 gCurGraphNodeIndex
 
struct GraphNode gObjParentGraphNode
 
Vec3f gVec3fZero
 
Vec3s gVec3sZero
 
Vec3f gVec3fOne
 
Vec3s gVec3sOne
 

Macro Definition Documentation

◆ GEO_CONTEXT_AREA_INIT

#define GEO_CONTEXT_AREA_INIT   4

◆ GEO_CONTEXT_AREA_LOAD

#define GEO_CONTEXT_AREA_LOAD   3

◆ GEO_CONTEXT_AREA_UNLOAD

#define GEO_CONTEXT_AREA_UNLOAD   2

◆ GEO_CONTEXT_CREATE

#define GEO_CONTEXT_CREATE   0

◆ GEO_CONTEXT_HELD_OBJ

#define GEO_CONTEXT_HELD_OBJ   5

◆ GEO_CONTEXT_RENDER

#define GEO_CONTEXT_RENDER   1

◆ GFX_NUM_MASTER_LISTS

#define GFX_NUM_MASTER_LISTS   8

◆ GRAPH_NODE_TYPE_ANIMATED_PART

#define GRAPH_NODE_TYPE_ANIMATED_PART   0x019

◆ GRAPH_NODE_TYPE_BACKGROUND

#define GRAPH_NODE_TYPE_BACKGROUND   (0x02C | GRAPH_NODE_TYPE_FUNCTIONAL)

◆ GRAPH_NODE_TYPE_BILLBOARD

#define GRAPH_NODE_TYPE_BILLBOARD   0x01A

◆ GRAPH_NODE_TYPE_CAMERA

#define GRAPH_NODE_TYPE_CAMERA   (0x014 | GRAPH_NODE_TYPE_FUNCTIONAL)

◆ GRAPH_NODE_TYPE_CULLING_RADIUS

#define GRAPH_NODE_TYPE_CULLING_RADIUS   0x02F

◆ GRAPH_NODE_TYPE_DISPLAY_LIST

#define GRAPH_NODE_TYPE_DISPLAY_LIST   0x01B

◆ GRAPH_NODE_TYPE_FUNCTIONAL

#define GRAPH_NODE_TYPE_FUNCTIONAL   0x100

◆ GRAPH_NODE_TYPE_GENERATED_LIST

#define GRAPH_NODE_TYPE_GENERATED_LIST   (0x02A | GRAPH_NODE_TYPE_FUNCTIONAL)

◆ GRAPH_NODE_TYPE_HELD_OBJ

#define GRAPH_NODE_TYPE_HELD_OBJ   (0x02E | GRAPH_NODE_TYPE_FUNCTIONAL)

◆ GRAPH_NODE_TYPE_LEVEL_OF_DETAIL

#define GRAPH_NODE_TYPE_LEVEL_OF_DETAIL   0x00B

◆ GRAPH_NODE_TYPE_MASTER_LIST

#define GRAPH_NODE_TYPE_MASTER_LIST   0x004

◆ GRAPH_NODE_TYPE_OBJECT

#define GRAPH_NODE_TYPE_OBJECT   0x018

◆ GRAPH_NODE_TYPE_OBJECT_PARENT

#define GRAPH_NODE_TYPE_OBJECT_PARENT   0x029

◆ GRAPH_NODE_TYPE_ORTHO_PROJECTION

#define GRAPH_NODE_TYPE_ORTHO_PROJECTION   0x002

◆ GRAPH_NODE_TYPE_PERSPECTIVE

#define GRAPH_NODE_TYPE_PERSPECTIVE   (0x003 | GRAPH_NODE_TYPE_FUNCTIONAL)

◆ GRAPH_NODE_TYPE_ROOT

#define GRAPH_NODE_TYPE_ROOT   0x001

◆ GRAPH_NODE_TYPE_ROTATION

#define GRAPH_NODE_TYPE_ROTATION   0x017

◆ GRAPH_NODE_TYPE_SCALE

#define GRAPH_NODE_TYPE_SCALE   0x01C

◆ GRAPH_NODE_TYPE_SHADOW

#define GRAPH_NODE_TYPE_SHADOW   0x028

◆ GRAPH_NODE_TYPE_START

#define GRAPH_NODE_TYPE_START   0x00A

◆ GRAPH_NODE_TYPE_SWITCH_CASE

#define GRAPH_NODE_TYPE_SWITCH_CASE   (0x00C | GRAPH_NODE_TYPE_FUNCTIONAL)

◆ GRAPH_NODE_TYPE_TRANSLATION

#define GRAPH_NODE_TYPE_TRANSLATION   0x016

◆ GRAPH_NODE_TYPE_TRANSLATION_ROTATION

#define GRAPH_NODE_TYPE_TRANSLATION_ROTATION   0x015

◆ GRAPH_RENDER_ACTIVE

#define GRAPH_RENDER_ACTIVE   (1 << 0)

◆ GRAPH_RENDER_BILLBOARD

#define GRAPH_RENDER_BILLBOARD   (1 << 2)

◆ GRAPH_RENDER_CHILDREN_FIRST

#define GRAPH_RENDER_CHILDREN_FIRST   (1 << 1)

◆ GRAPH_RENDER_HAS_ANIMATION

#define GRAPH_RENDER_HAS_ANIMATION   (1 << 5)

◆ GRAPH_RENDER_INVISIBLE

#define GRAPH_RENDER_INVISIBLE   (1 << 4)

◆ GRAPH_RENDER_Z_BUFFER

#define GRAPH_RENDER_Z_BUFFER   (1 << 3)

Typedef Documentation

◆ GraphNodeFunc

typedef s32(* GraphNodeFunc) (s32 callContext, struct GraphNode *node, void *context)

Function Documentation

◆ geo_add_child()

struct GraphNode* geo_add_child ( struct GraphNode ,
struct GraphNode  
)

Adds 'childNode' to the end of the list children from 'parent'.

◆ geo_call_global_function_nodes()

void geo_call_global_function_nodes ( struct GraphNode graphNode,
s32  callContext 
)

Call the update functions of geo nodes that are stored in global variables.

These variables include gCurGraphNodeMasterList, gCurGraphNodeCamFrustum, gCurGraphNodeCamera and gCurGraphNodeObject. callContext is one of the GEO_CONTEXT_ defines. The graphNode argument should be of type GraphNodeRoot.

◆ geo_call_global_function_nodes_helper()

void geo_call_global_function_nodes_helper ( struct GraphNode ,
s32   
)

Helper function for geo_call_global_function_nodes that recursively traverses the scene graph and calls the functions of global nodes.

◆ geo_find_root()

struct GraphNodeRoot* geo_find_root ( struct GraphNode graphNode)

Unused function to find the root of the geo node tree, which should be a GraphNodeRoot.

If it is not for some reason, null is returned.

◆ geo_make_first_child()

struct GraphNode* geo_make_first_child ( struct GraphNode newFirstChild)

Reorders the given node so it's the first child of its parent.

This is called on the Mario object when he is spawned. That's why Mario's object is always drawn before any other objects. (Note that the geo order is independent from processing group order, where Mario is not first.)

◆ geo_obj_init()

void geo_obj_init ( struct GraphNodeObject sp18,
void sp1c,
Vec3f  sp20,
Vec3s  sp24 
)

Initialize an object node using the given parameters.

◆ geo_obj_init_animation()

void geo_obj_init_animation ( struct GraphNodeObject ,
void  
)

Initialize the animation of an object node.

◆ geo_obj_init_animation_accel()

void geo_obj_init_animation_accel ( struct GraphNodeObject sp30,
void sp34,
u32  sp38 
)

Initialize the animation of an object node.

◆ geo_obj_init_spawninfo()

void geo_obj_init_spawninfo ( struct GraphNodeObject sp18,
struct SpawnInfo sp1c 
)

Initialize and object node using the given SpawnInfo struct.

◆ geo_remove_child()

struct GraphNode* geo_remove_child ( struct GraphNode graphNode)

Remove a node from the scene graph.

It changes the links with its siblings and with its parent, it doesn't deallocate the memory since geo nodes are allocated in a pointer-bumping pool that gets thrown out when changing areas.

◆ geo_reset_object_node()

void geo_reset_object_node ( struct GraphNodeObject sp20)

When objects are cleared, this is called on all object nodes (loaded or unloaded).

◆ geo_retreive_animation_translation()

void geo_retreive_animation_translation ( struct GraphNodeObject obj,
Vec3f  position 
)

Unused function to retrieve an object's current animation translation Assumes that it has x, y and z data in animations, which isn't always the case since some animation types only have vertical or lateral translation.

This might have been used for positioning the shadow under an object, which currently happens in-line in geo_process_shadow where it also accounts for animations without lateral translation.

◆ geo_update_animation_frame()

s16 geo_update_animation_frame ( struct GraphNodeObject_sub obj,
s32 accelAssist 
)

Update the animation frame of an object.

The animation flags determine whether it plays forwards or backwards, and whether it stops or loops at the end etc.

◆ init_graph_node_animated_part()

struct GraphNodeAnimatedPart* init_graph_node_animated_part ( struct AllocOnlyPool pool,
struct GraphNodeAnimatedPart graphNode,
s32  drawingLayer,
void displayList,
Vec3s  relativePos 
)

Allocates and returns a newly created animated part node.

◆ init_graph_node_background()

struct GraphNodeBackground* init_graph_node_background ( struct AllocOnlyPool pool,
struct GraphNodeBackground sp1c,
u16  sp22,
GraphNodeFunc  sp24,
s32  sp28 
)

Allocates and returns a newly created background node.

◆ init_graph_node_billboard()

struct GraphNodeBillboard* init_graph_node_billboard ( struct AllocOnlyPool pool,
struct GraphNodeBillboard graphNode,
s32  drawingLayer,
void displayList,
Vec3s  sp28 
)

Allocates and returns a newly created billboard node.

◆ init_graph_node_camera()

struct GraphNodeCamera* init_graph_node_camera ( struct AllocOnlyPool pool,
struct GraphNodeCamera sp1c,
f32 sp20,
f32 sp24,
GraphNodeFunc  sp28,
s32  sp2c 
)

Allocates and returns a newly created camera node.

◆ init_graph_node_culling_radius()

struct GraphNodeCullingRadius* init_graph_node_culling_radius ( struct AllocOnlyPool pool,
struct GraphNodeCullingRadius sp1c,
s16  sp22 
)

Allocates and returns a newly created frustum culling radius node.

◆ init_graph_node_display_list()

struct GraphNodeDisplayList* init_graph_node_display_list ( struct AllocOnlyPool pool,
struct GraphNodeDisplayList graphNode,
s32  drawingLayer,
void displayList 
)

Allocates and returns a newly created displaylist node.

◆ init_graph_node_generated()

struct GraphNodeGenerated* init_graph_node_generated ( struct AllocOnlyPool pool,
struct GraphNodeGenerated sp1c,
GraphNodeFunc  sp20,
s32  sp24 
)

Allocates and returns a newly created generated node.

◆ init_graph_node_held_object()

struct GraphNodeHeldObject* init_graph_node_held_object ( struct AllocOnlyPool pool,
struct GraphNodeHeldObject sp1c,
s32  sp20,
Vec3s  sp24,
GraphNodeFunc  sp28,
s32  sp2c 
)

Allocates and returns a newly created held object node.

◆ init_graph_node_master_list()

struct GraphNodeMasterList* init_graph_node_master_list ( struct AllocOnlyPool pool,
struct GraphNodeMasterList ,
s16  sp22 
)

Allocates and returns a newly created master list node.

◆ init_graph_node_object()

struct GraphNodeObject* init_graph_node_object ( struct AllocOnlyPool pool,
struct GraphNodeObject graphNode,
struct GraphNode sp20,
Vec3f  pos,
Vec3s  angle,
Vec3f  scale 
)

Allocates and returns a newly created object node.

◆ init_graph_node_object_parent()

struct GraphNodeObjectParent* init_graph_node_object_parent ( struct AllocOnlyPool pool,
struct GraphNodeObjectParent sp1c,
struct GraphNode sp20 
)

Allocates and returns a newly created object parent node.

◆ init_graph_node_ortho_projection()

struct GraphNodeOrthoProjection* init_graph_node_ortho_projection ( struct AllocOnlyPool ,
struct GraphNodeOrthoProjection ,
f32   
)

Allocates and returns a newly created otrhographic projection node.

◆ init_graph_node_perspective()

struct GraphNodePerspective* init_graph_node_perspective ( struct AllocOnlyPool pool,
struct GraphNodePerspective sp1c,
f32  sp20,
s16  sp26,
s16  sp2a,
GraphNodeFunc  sp2c,
s32  sp30 
)

Allocates and returns a newly created perspective node.

◆ init_graph_node_render_range()

struct GraphNodeLevelOfDetail* init_graph_node_render_range ( struct AllocOnlyPool pool,
struct GraphNodeLevelOfDetail graphNode,
s16  minDistance,
s16  maxDistance 
)

Allocates and returns a newly created render range node.

◆ init_graph_node_root()

struct GraphNodeRoot* init_graph_node_root ( struct AllocOnlyPool ,
struct GraphNodeRoot ,
s16  ,
s16  x,
s16  y,
s16  width,
s16  height 
)

Allocated and returns a newly created root node.

◆ init_graph_node_rotation()

struct GraphNodeRotation* init_graph_node_rotation ( struct AllocOnlyPool pool,
struct GraphNodeRotation graphNode,
s32  drawingLayer,
void displayList,
Vec3s  sp28 
)

Allocates and returns a newly created rotation node.

◆ init_graph_node_scale()

struct GraphNodeScale* init_graph_node_scale ( struct AllocOnlyPool pool,
struct GraphNodeScale graphNode,
s32  drawingLayer,
void displayList,
f32  sp28 
)

Allocates and returns a newly created scaling node.

◆ init_graph_node_shadow()

struct GraphNodeShadow* init_graph_node_shadow ( struct AllocOnlyPool pool,
struct GraphNodeShadow sp1c,
s16  sp22,
u8  sp27,
u8  sp2b 
)

Allocates and returns a newly created shadow node.

◆ init_graph_node_start()

struct GraphNodeStart* init_graph_node_start ( struct AllocOnlyPool pool,
struct GraphNodeStart sp1c 
)

Allocates and returns a newly created start node.

◆ init_graph_node_switch_case()

struct GraphNodeSwitchCase* init_graph_node_switch_case ( struct AllocOnlyPool pool,
struct GraphNodeSwitchCase graphNode,
s16  numCases,
s16  sp26,
GraphNodeFunc  nodeFunc,
s32  sp2c 
)

Allocates and returns a newly created switch case node.

◆ init_graph_node_translation()

struct GraphNodeTranslation* init_graph_node_translation ( struct AllocOnlyPool pool,
struct GraphNodeTranslation graphNode,
s32  drawingLayer,
void displayList,
Vec3s  sp28 
)

Allocates and returns a newly created translation node.

◆ init_graph_node_translation_rotation()

struct GraphNodeTranslationRotation* init_graph_node_translation_rotation ( struct AllocOnlyPool pool,
struct GraphNodeTranslationRotation graphNode,
s32  drawingLayer,
void displayList,
Vec3s  sp28,
Vec3s  sp2c 
)

Allocates and returns a newly created translation rotation node.

◆ init_scene_graph_node_links()

void init_scene_graph_node_links ( struct GraphNode graphNode,
s32  type 
)

Initialize a geo node with a given type.

Sets all links such that there are no siblings, parent or children for this node.

◆ read_vec3s()

s16* read_vec3s ( Vec3s  dst,
s16 src 
)

Takes a pointer to three shorts (supplied by a geo layout script) and copies it to the destination vector.

It's essentially a memcpy but consistent with the other two 'geo-script vector to internal vector' functions.

◆ read_vec3s_angle()

s16* read_vec3s_angle ( Vec3s  dst,
s16 src 
)

Takes a pointer to three angles in degrees (supplied by a geo layout script) and converts it to a vector of three in-game angle units in [-32768, 32767] range.

◆ read_vec3s_to_vec3f()

s16* read_vec3s_to_vec3f ( Vec3f  ,
s16 src 
)

Takes a pointer to three shorts (supplied by a geo layout script) and copies it to the destination float vector.

◆ register_scene_graph_node()

void register_scene_graph_node ( struct GraphNode graphNode)

Add the given graph node as a child to the current top of the gfx stack: 'gCurGraphNodeList'.

This is called from geo_layout commands to add nodes to the scene graph.

◆ retrieve_animation_index()

s32 retrieve_animation_index ( s32  frame,
u16 **  attributes 
)

Retrieves an index into animation data based on the attribute pointer An attribute is an x-, y- or z-component of the translation / rotation for a part Each attribute is a pair of s16's, where the first s16 represents the maximum frame and the second s16 the actual index.

This index can be used to index in the array with actual animation values.

Variable Documentation

◆ gAreaUpdateCounter

u16 gAreaUpdateCounter

◆ gCurGraphNodeCamera

struct GraphNodeCamera* gCurGraphNodeCamera

◆ gCurGraphNodeCamFrustum

struct GraphNodePerspective* gCurGraphNodeCamFrustum

◆ gCurGraphNodeHeldObject

struct GraphNodeHeldObject* gCurGraphNodeHeldObject

◆ gCurGraphNodeIndex

s16 gCurGraphNodeIndex

◆ gCurGraphNodeList

struct GraphNode* gCurGraphNodeList[]

◆ gCurGraphNodeMasterList

struct GraphNodeMasterList* gCurGraphNodeMasterList

◆ gCurRootGraphNode

struct GraphNode* gCurRootGraphNode

◆ gObjParentGraphNode

struct GraphNode gObjParentGraphNode

◆ gVec3fOne

Vec3f gVec3fOne

◆ gVec3fZero

Vec3f gVec3fZero

◆ gVec3sOne

Vec3s gVec3sOne

◆ gVec3sZero

Vec3s gVec3sZero