Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6495 in orxonox.OLD for height_map_merge/src


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

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

Location:
height_map_merge/src/world_entities
Files:
2 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
  • height_map_merge/src/world_entities/terrain.h

    r6341 r6495  
    1515// FORWARD DECLARATION
    1616class SpatialSeparation;
     17class HeightMap;
     18class Material;
    1719
    1820//! A simple method to call a desired debug world.
     
    4042  void loadVegetation(const char* vegetationFile);
    4143
     44  void loadHeightMap(const char* heightMapFile, const char* colorMap = NULL);
     45  void loadTexture(const char* textureName);
     46
    4247  void buildDebugTerrain(DebugTerrain debugTerrain);
    4348  virtual void draw() const;
     
    5055   int                 objectList;
    5156
     57   HeightMap*          heightMap;
     58   Material*           heightMapMaterial;
    5259};
    5360
Note: See TracChangeset for help on using the changeset viewer.