Trees:


The trees in our game are recursively generated using a simple algorithm. The algorithm goes as follows. Given a depth level to start from, the function checks the depth level for equality to zero; if true, a leaf is drawn. Otherwise, the function scales down all subsequent drawn objects and draws a branch. Then transformations are applied to each of the branch's children (leaf or other branches) to get them into position on top of the recently drawn branch, and the function calls itself again with its depth level - 1. From a big picture point of view, the branches are drawn and placed over and over, and only when the recursion has ended, are the leaves drawn.

back to main

Website by Seth Marinello 2007