Changeset 6103 in orxonox.OLD for branches/height_map/src
- Timestamp:
- Dec 14, 2005, 1:54:22 PM (19 years ago)
- Location:
- branches/height_map/src/world_entities
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/height_map/src/world_entities/terrain.cc
r6022 r6103 24 24 #include "resource_manager.h" 25 25 #include "model.h" 26 26 #include "material.h" 27 #include "height_map.h" 27 28 #include "glincl.h" 29 28 30 29 31 using namespace std; … … 36 38 Terrain::Terrain (const TiXmlElement* root) 37 39 { 40 38 41 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);*/ 43 114 } 44 115 … … 56 127 if (!strstr(fileName, ".obj") || !strstr(fileName, ".OBJ") ) 57 128 { 58 this->loadModel(fileName); 129 this->model = NULL; 130 //this->loadModel(fileName); 59 131 } 60 132 else … … 136 208 glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z ); 137 209 210 this->tmp_mat->select(); 211 212 this->model->draw(); 138 213 if (this->objectList) 139 214 glCallList(this->objectList); 140 else if (this-> getModel())141 this-> getModel()->draw();215 else if (this->model) 216 this->model->draw(); 142 217 if (this->vegetation) 143 218 this->vegetation->draw(); … … 145 220 146 221 /* THIS IS ONLY FOR DEBUGGING INFORMATION */ 147 if (this->ssp != NULL)148 this->ssp->drawQuadtree();222 // if (this->ssp != NULL) 223 // this->ssp->drawQuadtree(); 149 224 } 150 225 -
branches/height_map/src/world_entities/terrain.h
r5500 r6103 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.