Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5465 in orxonox.OLD for trunk/src/world_entities/terrain.cc


Ignore:
Timestamp:
Nov 2, 2005, 9:01:12 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: vegetation rendering in the terrain (trees are now rendered correctly)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/terrain.cc

    r5415 r5465  
    2121#include "factory.h"
    2222#include "spatial_separation.h"
     23
     24#include "resource_manager.h"
    2325
    2426using namespace std;
     
    7880  if( this->ssp)
    7981    delete ssp;
     82  if (this->vegetation)
     83  {
     84    ResourceManager::getInstance()->unload(this->vegetation);
     85  }
    8086}
    8187
     
    8793  this->objectList = 0;
    8894  this->ssp = NULL;
     95  this->vegetation = NULL;
    8996}
    9097
     
    94101  static_cast<WorldEntity*>(this)->loadParams(root);
    95102
     103  LoadParam<Terrain>(root, "vegetation", this, &Terrain::loadVegetation)
     104      .describe("the fileName of the vegetation, that should be loaded onto this terrain. (must be relative to the data-dir)") ;
     105
    96106  //LoadParam<Terrain>(root, "DebugTerrain",  );
    97107}
     108
     109void Terrain::loadVegetation(const char* vegetationFile)
     110{
     111  if (this->vegetation)
     112    ResourceManager::getInstance()->unload(this->vegetation, RP_LEVEL);
     113  if (vegetationFile != NULL)
     114  {
     115    PRINTF(4)("fetching %s\n", vegetationFile);
     116      this->vegetation = (Model*)ResourceManager::getInstance()->load(vegetationFile, OBJ, RP_CAMPAIGN);
     117  }
     118  else
     119    this->vegetation = NULL;
     120}
     121
     122
    98123
    99124void Terrain::draw ()
     
    114139  else if (this->model)
    115140    this->model->draw();
     141  if (this->vegetation)
     142    this->vegetation->draw();
    116143  glPopMatrix();
    117144
Note: See TracChangeset for help on using the changeset viewer.