LibGame
v0.4.0
The LG Game Engine - Copyright (C) 2024 ETMSoftware
|
Functions | |
LG_QTNode | lg_qtnode (int id, const char *name, Rec2Df *bounds, void *data) |
void | lg_qtnode_add_child (LG_QTNode *node, LG_QTNode *child, int quadrant) |
LG_QTNode * | lg_qtnode_get_root (LG_QTNode *node) |
void | lg_add_scenenode_from_qtnode (LG_SceneNode *top_scene_node, LG_QTNode *qt_node) |
void | lg_traverse_landscape (LG_QTNode *node, int(*func)(LG_QTNode *)) |
void | lg_traverse_printout_landscape (LG_QTNode *node, zboolean extra_info) |
void | lg_qtnode_info (LG_QTNode *node) |
int | lg_qtnode_info2 (LG_QTNode *node) |
=== It's all about tiling, terrains, quadtrees, LOD stuff, bla bla ===
LG_QTNode = LG QuadTree Node
QuadTree quadrants: LG_NW (0), LG_NE (1), LG_SW (2), LG_SE (3)
Create a new landscape node (LG_QTNode)
If no bounding rectangle is provided (bounds == NULL), default one is {-1.0, -1.0, 2.0, 2.0}
No need to free anything when done (no dynamically allocated memory)
id | Node's id |
name | Node's name |
bounds | A pointer to a bounding rectangle (actually must be a square) , may be NULL |
data | A pointer to data (terrain tile, mesh, whatever ...) |
void lg_add_scenenode_from_qtnode | ( | LG_SceneNode * | top_scene_node, |
LG_QTNode * | qt_node | ||
) |
Parse a quad tree and create/add a scene node for each leaf (to the top scene node)
Scene node id = QT node id + QUADTREE_TO_SCENENODE_ID_SHIFT
top_scene_node | A pointer to a LG_SceneNode |
qt_node | A pointer to a LG_QTNode |
Go from top to bottom, starting at node (may be different from the top node)
Call (*func)(node) for each leaf
node | A pointer to a LG_QTNode |
func | A func pointer |
void lg_traverse_printout_landscape | ( | LG_QTNode * | node, |
zboolean | extra_info | ||
) |
Go from top to bottom
Print out quad tree structure (quite nicely) -> node->name (node->id)
node | A pointer to a LG_QTNode |
extra_info | If TRUE, print out extra info (node->id so far) |
void lg_qtnode_info | ( | LG_QTNode * | node | ) |
int lg_qtnode_info2 | ( | LG_QTNode * | node | ) |
Print out LG_QTNode info
Same as above func but returns (int)0, so suitable to use with lg_traverse_landscape()
node | A pointer to a LG_QTNode |