Commits

Anonymous committed 86ba2e6

Fixed a bunch of small issues with canopy trees.

Comments (0)

Files changed (4)

Terrain/CTerrain.cpp

 {
 
   if (_front_texture && _valid) {
-    glColor3fv (&_color.red);
+    //glColor3fv (&_color.red);
     glBindTexture (GL_TEXTURE_2D, _front_texture);
     _vbo.Render ();
   }

Terrain/CTree.cpp

 
 //Given the value of 0.0 (root) to 1.0f (top), return the center of the trunk 
 //at that height.
-GLvector CTree::TrunkPosition (float delta, float* radius)
+GLvector CTree::TrunkPosition (float delta, float* radius_in)
 {
 
   GLvector    trunk;
   float       bend;
   float       delta_curve;
+  float       radius;
 
   if (_funnel_trunk) {
     delta_curve = 1.0f - delta;
     delta_curve = 1.0f - delta_curve;
   } else 
     delta_curve = delta;
-  if (radius) {
-    *radius = _current_base_radius * (1.0f - delta_curve);
-    *radius = max (*radius, MIN_RADIUS);
-  }
+  if (_canopy) //canopy trees are thick all the way up, do not taper to a point
+    radius = _current_base_radius * (1.0f - delta_curve * 0.5);
+  else
+    radius = _current_base_radius * (1.0f - delta_curve);
+
+  radius = max (radius, MIN_RADIUS);
   bend = delta * delta;
   switch (_trunk_style) {
   case TREE_TRUNK_BENT:
     break;
   }
   trunk.z = delta * _current_height;
+  if (radius_in)
+    *radius_in = radius;
   return trunk;
   
 }
   //Work out the circumference of the BASE of the tree
   circumference = _current_base_radius * _current_base_radius * (float)PI;
   //The texture will repeat ONCE horizontally around the tree.  Set the vertical to repeat in the same distance.
-  _texture_tile = (float)((int)circumference + 0.5f); 
+  _texture_tile = 1;//(float)((int)circumference + 0.5f); 
   radial_steps = 3;
   if (lod == LOD_HIGH)
     radial_steps = 7;
   _leaf_style = (TreeLeafStyle)(WorldNoisei (_seed_current++) % TREE_LEAF_STYLES);
   _evergreen = _temperature + (WorldNoisef (_seed_current++) * 0.25f) < 0.5f;
   _has_vines = _moisture > 0.6f && _temperature > 0.5f;
-  _has_vines = true;///////////////////////////////////////////////////////////////////////////////////////////;
   //Narrow trees can gorw on top of hills. (Big ones will stick out over cliffs, so we place them low.)
   if (_default_base_radius <= 1.0f) 
     _grows_high = true;
   //1 in 8 non-tropical trees has white bark
   if (!_has_vines && !(WorldNoisei (_seed_current++) % 8))
     _bark_color2 = glRgba (1.0f);
-  //These two foliage styles don't look right on evergreens.
+  //These foliage styles don't look right on evergreens.
   if (_evergreen && _foliage_style == TREE_FOLIAGE_BOWL)
     _foliage_style = TREE_FOLIAGE_UMBRELLA;
   if (_evergreen && _foliage_style == TREE_FOLIAGE_SHIELD)
   if (_canopy) {
     _foliage_style = TREE_FOLIAGE_UMBRELLA;
     _default_height = max (_default_height, 16.0f);
-    _default_base_radius = 3.0f;
+    _default_base_radius = 1.5f;
     _foliage_size = 2.0f;
     _trunk_style = TREE_TRUNK_NORMAL;
   }
 x Terrains eat less CPU cycles per frame
 * Grass rotate
 * Fix avatar rendering
-* Fix opaque trees on mike's PC
+? Fix opaque trees on mike's PC
+* shadows
 
 http://www.bramstein.com/projects/gui/
 
 
 #define REGION_SIZE             64
 #define REGION_HALF             (REGION_SIZE / 2)
-#define WORLD_GRID              64
+#define WORLD_GRID              128
 #define WORLD_GRID_EDGE         (WORLD_GRID + 1)
 #define WORLD_GRID_CENTER       (WORLD_GRID / 2)
 #define WORLD_SIZE_METERS       (REGION_SIZE * WORLD_GRID)