Changeset 5976 in orxonox.OLD for branches/height_map
- Timestamp:
- Dec 7, 2005, 5:21:41 PM (19 years ago)
- Location:
- branches/height_map/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/height_map/src/defs/class_id.h
r5862 r5976 186 186 CL_PROMITIVE_MODEL = 0x00000808, 187 187 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, 191 192 CL_ENVIRONMENT = 0x00000810, 192 193 CL_SHADER = 0x00000811, -
branches/height_map/src/lib/graphics/importer/height_map.cc
r5970 r5976 34 34 HeightMap::HeightMap(const char* height_map_name = NULL) : Model() 35 35 { 36 this->setClassID(CL_HEIGHT_MAP, "HeightMap"); 36 37 heightMap = IMG_Load(height_map_name); 37 38 if(heightMap!=NULL) { … … 55 56 void HeightMap::load() 56 57 { 57 intheight = 0;58 long height = 0; 58 59 int offset = 0; 59 60 char * bmp = (char*) heightMap->pixels; … … 61 62 if(heightMap != NULL /* && heightMap->format->BitsPerPixel == 8 */) 62 63 { 63 for(int i = 0; i < heightMap->h; i += 2) 64 SDL_LockSurface(heightMap); 65 for(int i = 0; i < heightMap->h -1; i += 2) 64 66 { 65 for(int j = 0; j < heightMap->w ; j += 2)67 for(int j = 0; j < heightMap->w -1; j += 2) 66 68 { 67 69 … … 69 71 70 72 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); 76 78 } 77 79 } 80 SDL_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 78 87 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 ); 84 89 } 85 90 -
branches/height_map/src/lib/graphics/importer/model.cc
r5790 r5976 771 771 this->vertices->finalizeArray(); 772 772 this->vTexture->finalizeArray(); 773 printf("=================%s::%d\n", this->getClassName(), normals->getCount()); 773 774 if (normals->getCount() == 0) // vertices-Array must be built for this 774 775 this->buildVertexNormals(); -
branches/height_map/src/world_entities/terrain.cc
r5967 r5976 24 24 #include "resource_manager.h" 25 25 #include "model.h" 26 #include "material.h" 26 27 #include "height_map.h" 27 28 #include "glincl.h" … … 39 40 40 41 this->init(); 41 42 43 this->tmp_mat = new Material(); 42 44 // this->loadParams(root); 43 45 … … 204 206 Vector tmpRot = this->getAbsDir().getSpacialAxis(); 205 207 glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z ); 208 209 this->tmp_mat->select(); 210 206 211 this->model->draw(); 207 212 if (this->objectList) -
branches/height_map/src/world_entities/terrain.h
r5500 r5976 15 15 // FORWARD DECLARATION 16 16 class SpatialSeparation; 17 class Material; 17 18 18 19 //! A simple method to call a desired debug world. … … 43 44 private: 44 45 Model* vegetation; 46 Material* tmp_mat; 45 47 int objectList; 46 48 };
Note: See TracChangeset
for help on using the changeset viewer.