GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
SG_NODE(3) FreeBSD Library Functions Manual SG_NODE(3)

SG_NodeAgar-SG base node class

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

SG_Node is the base class for any element of a SG(3) scene. This includes geometrical elements (e.g., SG_Object(3)) as well as non-geometrical elements (e.g., SG_Light(3), SG_Camera(3)).

Nodes are organized in a tree structure, and the position of a SG_Node in relation to its parent is determined by a 4x4 transformation matrix (see M_Matrix(3)).

AG_Object(3) -> SG_Node.

void
(SG_NodeOps *ops);


void
(void *node, const char *name, const SG_NodeOps *ops, Uint flags);


void *
(void *pnode, const char *name, const SG_NodeOps *ops, Uint flags);


void
(void *pnode, void *node);


void
(void *pnode, void *node);


void
(SG *sg, SG_Node *node, SG_View *view);

The () function registers a new node class, described by the given SG_NodeOps structure.

The () function initializes the given SG_Node structure. It is usually invoked from node constructor functions. The name argument is a string identifier for the node. ops points to the SG_NodeOps structure which contains class information. The flags argument should be 0. The SG_NodeAdd() variant also allocates, initializes and attaches the node to a parent node.

The () and SG_NodeDetach() functions attach/detach a node to/from a given parent.

The () function is used to render a node to the display. It is normally only invoked from the draw operation of SG_View(3) (or another visualization widget derived from SG_View). SG_NodeDraw() assumes that the node's transformation matrix has already been applied to the current viewing matrix.

The following calls multiply a node's transformation matrix T with a translation, scaling or rotation matrix. Note that the T matrix may also be manipulated directly with the M_Matrix(3) interface.


void
(SG_Node *node);


void
(SG_Node *node, M_Real x, M_Real y, M_Real z);


void
(SG_Node *node, M_Vector3 v);


void
(SG_Node *node, M_Real x);


void
(SG_Node *node, M_Real y);


void
(SG_Node *node, M_Real z);


void
(SG_Node *node, M_Real s);


void
(SG_Node *node, M_Real theta, M_Vector3 axis);


void
(SG_Node *node, M_Real theta);


void
(SG_Node *node, M_Real theta);


void
(SG_Node *node, M_Real theta);


void
(SG_Node *node, M_Real degrees, M_Vector3 axis);


void
(SG_Node *node, M_Real degrees);


void
(SG_Node *node, M_Real degrees);


void
(SG_Node *node, M_Real degrees);


void
(void *node, M_Matrix44 *T);


void
(void *node, M_Matrix44 *T);


M_Vector3
(SG_Node *node);


M_Vector3
(SG_Node *node);


M_Real
(SG_Node *node);


(); sets the transformation matrix of the node to the identity matrix.

The
(); functions multiply T by a translation matrix.

The
(); function multiplies T by a uniform scaling matrix.


(); multiply T by a rotation matrix. Angles are given in radians, except for
(); variants which accept angular arguments in degrees.


(); generates a rotation of theta radians around axis.

Note that most of the preceding functions are trivial wrappers around M_Matrix(3) functions (applied to the transformation matrix T of the node).

The
(); function returns a transformation matrix mapping the node back to world coordinates (i.e., by computing the product of the transformation matrices of the node and its parents).
SG_GetNodeTransformInverse(); returns the inverse of this matrix.

The
(); function returns a vector representing the absolute world coordinates of a node.
SG_NodeDir(); returns a normalized vector representing the direction of a node with respect to the world Z axis (i.e., the Z axis of the origin node).
SG_NodeSize(); returns the absolute scaling factor of an object.

For the SG_Node object:

Uint flags
Option flags (see “FLAGS” section).
SG *sg
Back pointer to parent SG(3) object.
M_Matrix44 T
Transformation matrix (relative to parent node).

For the SG_Node object:

SG_NODE_SELECTED
Node is selected (e.g., for edition).

See sg/sg_dummy.c in the Agar source distribution for an example node class implementation.

M_Matrix(3), M_Real(3), M_Vector(3), SG(3), SG_Intro(3)

The SG_Node node class first appeared in Agar 1.6.0.

December 21, 2022 Agar 1.7

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.