Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6103 in orxonox.OLD for branches/height_map/src/world_entities


Ignore:
Timestamp:
Dec 14, 2005, 1:54:22 PM (19 years ago)
Author:
bensch
Message:

heightmap: copied old terrain inside

Location:
branches/height_map/src/world_entities
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/height_map/src/world_entities/terrain.cc

    r6022 r6103  
    2424#include "resource_manager.h"
    2525#include "model.h"
    26 
     26#include "material.h"
     27#include "height_map.h"
    2728#include "glincl.h"
     29
    2830
    2931using namespace std;
     
    3638Terrain::Terrain (const TiXmlElement* root)
    3739{
     40
    3841  this->init();
    39   this->loadParams(root);
    40 
    41 //  if (this->model != NULL)
    42     //this->ssp = new SpatialSeparation((Model*)this->model, 10.0f);
     42
     43  this->tmp_mat = new Material(); 
     44  // this->loadParams(root);
     45
     46 char* heightmapName = ResourceManager::getFullName("pictures/heightmapHello.bmp");
     47 HeightMap * hm = new HeightMap(heightmapName);
     48
     49 hm->load();
     50 this->model=hm;
     51
     52 /*     this->model =  new HeightMap();
     53   this->model->setName("HardCore");
     54  this->model->addVertex (-0.5, -0.5, 0.5);
     55  this->model->addVertex (0.5, -0.5, 0.5);
     56  this->model->addVertex (-0.5, 0.5, 0.5);
     57  this->model->addVertex (0.5, 0.5, 0.5);
     58  this->model->addVertex (-0.5, 0.5, -0.5);
     59  this->model->addVertex (0.5, 0.5, -0.5);
     60  this->model->addVertex (-0.5, -0.5, -0.5);
     61  this->model->addVertex (0.5, -0.5, -0.5);
     62
     63  this->model->addVertexTexture (0.0, 0.0);
     64  this->model->addVertexTexture (1.0, 0.0);
     65  this->model->addVertexTexture (0.0, 1.0);
     66  this->model->addVertexTexture (1.0, 1.0);
     67  this->model->addVertexTexture (0.0, 2.0);
     68  this->model->addVertexTexture (1.0, 2.0);
     69  this->model->addVertexTexture (0.0, 3.0);
     70  this->model->addVertexTexture (1.0, 3.0);
     71  this->model->addVertexTexture (0.0, 4.0);
     72  this->model->addVertexTexture (1.0, 4.0);
     73  this->model->addVertexTexture (2.0, 0.0);
     74  this->model->addVertexTexture (2.0, 1.0);
     75  this->model->addVertexTexture (-1.0, 0.0);
     76  this->model->addVertexTexture (-1.0, 1.0);
     77
     78  this->model->addVertexNormal (0.0, 0.0, 1.0);
     79  this->model->addVertexNormal (0.0, 0.0, 1.0);
     80  this->model->addVertexNormal (0.0, 0.0, 1.0);
     81  this->model->addVertexNormal (0.0, 0.0, 1.0);
     82  this->model->addVertexNormal (0.0, 1.0, 0.0);
     83  this->model->addVertexNormal (0.0, 1.0, 0.0);
     84  this->model->addVertexNormal (0.0, 1.0, 0.0);
     85  this->model->addVertexNormal (0.0, 1.0, 0.0);
     86  this->model->addVertexNormal (0.0, 0.0, -1.0);
     87  this->model->addVertexNormal (0.0, 0.0, -1.0);
     88  this->model->addVertexNormal (0.0, 0.0, -1.0);
     89  this->model->addVertexNormal (0.0, 0.0, -1.0);
     90  this->model->addVertexNormal (0.0, -1.0, 0.0);
     91  this->model->addVertexNormal (0.0, -1.0, 0.0);
     92  this->model->addVertexNormal (0.0, -1.0, 0.0);
     93  this->model->addVertexNormal (0.0, -1.0, 0.0);
     94  this->model->addVertexNormal (1.0, 0.0, 0.0);
     95  this->model->addVertexNormal (1.0, 0.0, 0.0);
     96  this->model->addVertexNormal (1.0, 0.0, 0.0);
     97  this->model->addVertexNormal (1.0, 0.0, 0.0);
     98  this->model->addVertexNormal (-1.0, 0.0, 0.0);
     99  this->model->addVertexNormal (-1.0, 0.0, 0.0);
     100  this->model->addVertexNormal (-1.0, 0.0, 0.0);
     101  this->model->addVertexNormal (-1.0, 0.0, 0.0);
     102
     103  this->model->addFace (4, VERTEX_TEXCOORD_NORMAL, 0,0,0, 1,1,1, 3,3,2, 2,2,3);
     104  this->model->addFace (4, VERTEX_TEXCOORD_NORMAL, 2,2,4, 3,3,5, 5,5,6, 4,4,7);
     105  this->model->addFace (4, VERTEX_TEXCOORD_NORMAL, 4,4,8, 5,5,9, 7,7,10, 6,6,11);
     106  this->model->addFace (4, VERTEX_TEXCOORD_NORMAL, 6,6,12, 7,7,13, 1,9,14, 0,8,15);
     107  this->model->addFace (4, VERTEX_TEXCOORD_NORMAL, 1,1,16, 7,10,17, 5,11,18, 3,3,19);
     108  this->model->addFace (4, VERTEX_TEXCOORD_NORMAL, 6,12,20, 0,0,21, 2,2,22, 4,13,23);
     109
     110      this->model->finalize(); */
     111   
     112 /*if (this->model != NULL)
     113    this->ssp = new SpatialSeparation((AbstractModel*)this->model, 10.0f);*/
    43114}
    44115
     
    56127  if (!strstr(fileName, ".obj") || !strstr(fileName, ".OBJ") )
    57128    {
    58       this->loadModel(fileName);
     129      this->model = NULL;
     130        //this->loadModel(fileName);
    59131    }
    60132  else
     
    136208  glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );
    137209
     210   this->tmp_mat->select();
     211
     212  this->model->draw();
    138213  if (this->objectList)
    139214    glCallList(this->objectList);
    140   else if (this->getModel())
    141     this->getModel()->draw();
     215  else if (this->model)
     216    this->model->draw();
    142217  if (this->vegetation)
    143218    this->vegetation->draw();
     
    145220
    146221  /* THIS IS ONLY FOR DEBUGGING INFORMATION */
    147   if (this->ssp != NULL)
    148     this->ssp->drawQuadtree();
     222 // if (this->ssp != NULL)
     223 //   this->ssp->drawQuadtree();
    149224}
    150225
  • branches/height_map/src/world_entities/terrain.h

    r5500 r6103  
    1515// FORWARD DECLARATION
    1616class SpatialSeparation;
     17class Material;
    1718
    1819//! A simple method to call a desired debug world.
     
    4344 private:
    4445   Model*              vegetation;
     46   Material*           tmp_mat;
    4547   int                 objectList;
    4648};
Note: See TracChangeset for help on using the changeset viewer.