Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5976 in orxonox.OLD


Ignore:
Timestamp:
Dec 7, 2005, 5:21:41 PM (18 years ago)
Author:
bottac
Message:
 
Location:
branches/height_map/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/height_map/src/defs/class_id.h

    r5862 r5976  
    186186  CL_PROMITIVE_MODEL            =    0x00000808,
    187187  CL_MD2Model                   =    0x00000809,
    188   CL_LIGHT                      =    0x0000080a,
    189   CL_PARTICLE_EMITTER           =    0x0000080b,
    190   CL_PARTICLE_SYSTEM            =    0x0000080c,
     188  CL_HEIGHT_MAP                 =    0x0000080a,
     189  CL_LIGHT                      =    0x0000080b,
     190  CL_PARTICLE_EMITTER           =    0x0000080c,
     191  CL_PARTICLE_SYSTEM            =    0x0000080d,
    191192  CL_ENVIRONMENT                =    0x00000810,
    192193  CL_SHADER                     =    0x00000811,
  • branches/height_map/src/lib/graphics/importer/height_map.cc

    r5970 r5976  
    3434HeightMap::HeightMap(const char* height_map_name = NULL) : Model()
    3535{
     36   this->setClassID(CL_HEIGHT_MAP, "HeightMap");
    3637        heightMap =  IMG_Load(height_map_name);
    3738            if(heightMap!=NULL) {
     
    5556void HeightMap::load()
    5657{
    57  int height = 0;
     58 long height = 0;
    5859 int offset = 0;
    5960 char *  bmp = (char*) heightMap->pixels;
     
    6162  if(heightMap != NULL /* && heightMap->format->BitsPerPixel == 8 */)
    6263        {
    63                 for(int i = 0; i < heightMap->h; i += 2)
     64SDL_LockSurface(heightMap);
     65                for(int i = 0; i < heightMap->h -1; i += 2)
    6466                        {
    65                         for(int j = 0; j < heightMap->w;  j += 2)
     67                        for(int j = 0; j < heightMap->w -1;  j += 2)
    6668                        {
    6769
     
    6971
    7072                               
    71                                 SDL_LockSurface(heightMap);
    72                                         height = bmp[j + i*heightMap->w];
    73                                         //height = heightMap->format->palette->colors[offset];
    74                                 SDL_UnlockSurface(heightMap);   
    75                                 this->addVertex(heightMap->h - i , ((long)( height)  / 10) - 15 ,heightMap->w - j);
     73                               
     74                                        offset = bmp[j + i*heightMap->w];
     75                                        height = heightMap->format->palette->colors[offset].r + heightMap->format->palette->colors[offset].g + heightMap->format->palette->colors[offset].b ;
     76                                       
     77                                this->addVertex(heightMap->h - i , ((long)( height) / 30) - 60 ,heightMap->w - j);
    7678                        }       
    7779                        }
     80SDL_UnlockSurface(heightMap);
     81                for(int i = 0; i < (heightMap->h * heightMap->w)/4   -1  ; i ++)
     82                        {
     83                                 this->addFace (3, VERTEX_ONLY, i,i+1 ,i + (heightMap->w / 2) );
     84                               
     85                                  this->addFace (3, VERTEX_ONLY,i + (heightMap->w / 2)  ,i + (heightMap->w / 2) +1, i+1 );
     86                               
    7887
    79                 for(int i = 0; i < (heightMap->h * heightMap->w) / 4 - heightMap->w /2 -1  ; i ++)
    80                         {
    81                                   this->addFace (3, VERTEX_ONLY, i,i+1 ,i + (heightMap->w / 2) );
    82                                
    83                                   this->addFace (3, VERTEX_ONLY, i+1,i + (heightMap->w / 2)  ,i + (heightMap->w / 2) +1 );
     88                                //this->addFace (4 ,VERTEX_ONLY,i,i + (heightMap->w / 2)  ,i + (heightMap->w / 2) +1, i+1 );
    8489                        }
    8590               
  • branches/height_map/src/lib/graphics/importer/model.cc

    r5790 r5976  
    771771  this->vertices->finalizeArray();
    772772  this->vTexture->finalizeArray();
     773printf("=================%s::%d\n", this->getClassName(), normals->getCount());
    773774  if (normals->getCount() == 0) // vertices-Array must be built for this
    774775    this->buildVertexNormals();
  • branches/height_map/src/world_entities/terrain.cc

    r5967 r5976  
    2424#include "resource_manager.h"
    2525#include "model.h"
     26#include "material.h"
    2627#include "height_map.h"
    2728#include "glincl.h"
     
    3940
    4041  this->init();
    41  
     42
     43  this->tmp_mat = new Material(); 
    4244  // this->loadParams(root);
    4345
     
    204206  Vector tmpRot = this->getAbsDir().getSpacialAxis();
    205207  glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );
     208
     209   this->tmp_mat->select();
     210
    206211  this->model->draw();
    207212  if (this->objectList)
  • branches/height_map/src/world_entities/terrain.h

    r5500 r5976  
    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.