Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 11, 2006, 5:34:45 PM (18 years ago)
Author:
bensch
Message:

terrain updated, so it can load a new HeightMap from an XML file

File:
1 edited

Legend:

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

    r6341 r6495  
    2626#include "network_game_manager.h"
    2727
     28#include "height_map.h"
     29#include "material.h"
    2830
    2931#include "glincl.h"
     
    100102  this->ssp = NULL;
    101103  this->vegetation = NULL;
     104
     105  this->heightMap = NULL;
     106  this->heightMapMaterial = NULL;
    102107}
    103108
     
    105110void Terrain::loadParams(const TiXmlElement* root)
    106111{
    107   static_cast<WorldEntity*>(this)->loadParams(root);
     112  WorldEntity::loadParams(root);
    108113
    109114  LoadParam(root, "vegetation", this, Terrain, loadVegetation)
    110115      .describe("the fileName of the vegetation, that should be loaded onto this terrain. (must be relative to the data-dir)") ;
    111 }
     116
     117
     118  LoadParam(root, "height-map", this, Terrain, loadHeightMap)
     119      .describe("The HeightMap, splitted into two strings seperated by ','. 1: HeighMap, 2: ColorMap");
     120
     121
     122  LoadParam(root, "heigt-texture", this, Terrain, loadTexture)
     123      .describe("The name of the Texture for this heightMap");
     124}
     125
     126void Terrain::loadHeightMap(const char* heightMapFile, const char* colorMap)
     127{
     128  if (this->heightMap != NULL)
     129    delete this->heightMap;
     130  this->heightMap = NULL;
     131
     132
     133  this->heightMap = new HeightMap(heightMapFile, colorMap);
     134
     135}
     136
     137
     138void Terrain::loadTexture(const char* textureName)
     139{
     140  if (this->heightMapMaterial != NULL)
     141    delete this->heightMapMaterial;
     142}
     143
     144
    112145
    113146void Terrain::loadVegetation(const char* vegetationFile)
     
    124157    this->vegetation = NULL;
    125158}
     159
     160
    126161
    127162
Note: See TracChangeset for help on using the changeset viewer.