// v-- Create a trunk for a given tree
//--------------------------------------------------------
void sTree_createTrunk(TREE *tree){
//use these to work out a range and then the actual position
int arrayElement = rand()%MAP_WIDTH;
//setup the starting point
//========================================================
//workout the x axis
tree->branches[0].orig.x = actualHeightMap[arrayElement][arrayElement].x;//startRange + stopRange;
tree->branches[0].orig.y = actualHeightMap[arrayElement][arrayElement].y;
tree->branches[0].orig.z = actualHeightMap[arrayElement][arrayElement].z;//stopRange;//startRange + stopRange;//(startRange + stopRange);
/*
//work out the y axis, depending on the heightmap array.
printf("Y value in the hieghtmap: %f\n", (float)heightMapArray[(int)tree->branches[0].orig.z][(int)tree->branches[0].orig.x]);
tree->branches[0].orig.y = ((float)heightMapArray[(int)tree->branches[0].orig.z][(int)tree->branches[0].orig.x]);
printf("Y value: %f\n", tree->branches[0].orig.y);
*/
//========================================================
//setup the direction
tree->branches[0].dir.x = 0;
tree->branches[0].dir.y = 1;
tree->branches[0].dir.z = 0;
//setup maximum length and other length related variables
tree->branches[0].maxLength = 30;
tree->branches[0].maxLengthBool = 0;
tree->branches[0].length = 1;
}//sTree_createTrunk(tree)
//--------------------------------------------------------
// ^-- Create a trunk for a given tree