SYNOPSIS

#include <agar/core.h>
#include <agar/sg.h>

DESCRIPTION

The
SG object is a general-purpose scene-graph, or a collection of nodes (i.e.,
SG_Node(3) objects) organized in a tree structure.
The
SG_Node object is used to describe both "group" nodes and "leaf" nodes.

Scene-graphs are usually rendered using the
SG_View(3) widget (or a subclass of it).

When loading the contents of a scene, ignore unknown/unimplemented
elements (otherwise, encountering an unknown node will make the load
operation fail).

SG_NO_DEFAULT_NODES

Don't create the default nodes (e.g.,
Camera0, Light0).

The
SG_Clear() routine reinitializes
sg to an empty scene.
If default nodes (e.g.,
Camera0) are used, they are preserved but their state is reinitialized.

NODE QUERIES

SG_Node *SG_SearchNodes (SG_Node *parent, const char *name)

void *SG_FindNode (SG *sg, const char *name)

intSG_Intersect (SG_Node *node, M_Geom3 g, M_GeomSet3 *S)

The
SG_SearchNodes() function scans all descendants of
parent for a node of the specified name.
The
SG_FindNode() function searches the entire scene graph
sg for a node of the specified name.
On success,
SG_SearchNodes() and
SG_FindNode() return a pointer to the matching node.

The
SG_Intersect() function performs an intersection test between the given node and an
arbitrary geometrical object
g (see
M_Geom3(3)). The function returns 1 if the objects intersect, 0 if they don't
intersect, or -1 if the test is not implemented.
If the
S argument is non-NULL, the intersections are computed and returned as one
or more geometrical objects, into
S. The structure pointed to by
S should have been previously initialized with
M_GEOM_SET_EMPTY(3).