Changeset 8715 in orxonox.OLD for branches/terrain/src
- Timestamp:
- Jun 22, 2006, 1:51:50 PM (19 years ago)
- Location:
- branches/terrain/src/lib
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/terrain/src/lib/collision_detection/cd_engine.cc
r8490 r8715 24 24 #include "model.h" 25 25 #include "world_entity.h" 26 #include "terrain .h"26 #include "terrain_entity.h" 27 27 // #include "player.h" 28 28 … … 104 104 std::list<WorldEntity*>::iterator entityIterator; 105 105 const std::list<BaseObject*>* bspList = ClassList::getList(CL_BSP_ENTITY); 106 if( bspList == NULL) 107 return; 106 if( bspList != NULL) { 108 107 109 // for all bsp managers check all entities 110 for( bspIterator = bspList->begin(); bspIterator != bspList->end(); bspIterator++) { 111 for(entityIterator = list1.begin(); entityIterator != list1.end(); entityIterator++) 112 { 113 // PRINTF(0)("Checking: %s a %s\n", (*entityIterator)->getName(), (*entityIterator)->getClassName()); 114 (dynamic_cast<BspEntity*>(*bspIterator)->getBspManager())->checkCollision(*entityIterator); 108 // for all bsp managers check all entities 109 for( bspIterator = bspList->begin(); bspIterator != bspList->end(); bspIterator++) { 110 for(entityIterator = list1.begin(); entityIterator != list1.end(); entityIterator++) 111 { 112 // PRINTF(0)("Checking: %s a %s\n", (*entityIterator)->getName(), (*entityIterator)->getClassName()); 113 (dynamic_cast<BspEntity*>(*bspIterator)->getBspManager())->checkCollision(*entityIterator); 114 } 115 } 116 } 117 const std::list<BaseObject*>* tl = ClassList::getList( CL_TERRAIN ); 118 std::list<BaseObject*>::const_iterator ti; 119 if ( tl == NULL ) 120 return; 121 for ( ti = tl->begin(); ti != tl->end(); ++ti ) { 122 TerrainEntity* terrain = dynamic_cast<TerrainEntity*>( *ti ); 123 for( entityIterator = list1.begin(); entityIterator != list1.end(); entityIterator++ ) 124 { 125 const Vector& pos = (*entityIterator)->getAbsCoor(); 126 127 float height = terrain->getHeight( pos.x, pos.z ); 128 printf( "pos.y-height: %f\n", pos.y-height ); 129 if ( height > pos.y ) { 130 (*entityIterator)->setAbsCoor( pos.x, height, pos.z ); 131 } 115 132 } 116 133 } 117 134 } 118 135 -
branches/terrain/src/lib/graphics/effects/volfog_effect.cc
r8523 r8715 30 30 //#include <GL/glext.h> //OpenGL Extensions 31 31 //#include <GL/glxext.h> // GLX Extensions 32 32 #ifndef __APPLE__ 33 33 #ifndef GL_EXT_fog_coord 34 34 #define GL_EXT_fog_coord 1 … … 45 45 PFNGLFOGCOORDDVEXTPROC glFogCoorddvEXT = 0; 46 46 PFNGLFOGCOORDPOINTEREXTPROC glFogCoordPointerEXT = 0; 47 47 #endif 48 48 49 49 using namespace std; -
branches/terrain/src/lib/graphics/graphics_engine.cc
r8697 r8715 298 298 } 299 299 300 glEnable(GL_CULL_FACE); 301 glCullFace(GL_FRONT); 300 302 301 } 303 302 -
branches/terrain/src/lib/graphics/importer/Makefile.am
r8697 r8715 38 38 md3/md3_data.cc \ 39 39 md3/md3_tag.cc \ 40 \ 40 \ 41 41 terrain/terrain.cc \ 42 42 terrain/terrain_quad.cc \ -
branches/terrain/src/lib/graphics/importer/md2/md2Model.cc
r8490 r8715 17 17 #include "md2Model.h" 18 18 #include "material.h" 19 19 #include "config.h" 20 #ifdef HAVE_SDL_SDL_H 21 #include <SDL/SDL.h> 22 #include <SDL/SDL_endian.h> 23 #else 24 #include <SDL.h> 25 #include <SDL_endian.h> 26 #endif 20 27 #include "debug.h" 21 28 #include "util/loading/resource_manager.h" … … 66 73 }; 67 74 68 75 #ifdef SDL_LIL_ENDIAN 76 #define BULK_CONV( _ptr, _num ) do { \ 77 int _cnt = _num;\ 78 int* _iptr = (int*)_ptr;\ 79 for( int _l = 0; _l<_cnt; ++_l )\ 80 _iptr[_l] = SDL_SwapLE32( _iptr[_l] );\ 81 } while( 0 ) 82 #define BULK_CONV16( _ptr, _num ) do { \ 83 short _cnt = _num;\ 84 short* _iptr = (short*)_ptr;\ 85 for( int _l = 0; _l<_cnt; ++_l )\ 86 _iptr[_l] = SDL_SwapLE16( _iptr[_l] );\ 87 } while( 0 ) 88 #else 89 #define BULK_CONV( _ptr, _num ) 90 #define BULK_CONV16( _ptr, _num ) 91 #endif 69 92 70 93 /******************************************************************************** … … 442 465 this->header = new MD2Header; 443 466 fread(this->header, 1, sizeof(MD2Header), pFile); 467 BULK_CONV( this->header, sizeof(MD2Header)/4 ); 444 468 /* check for the header version: make sure its a md2 file :) */ 445 if( unlikely( this->header->version != MD2_VERSION) && unlikely(this->header->ident != MD2_IDENT))469 if( unlikely( this->header->version != MD2_VERSION) && unlikely( this->header->ident != MD2_IDENT)) 446 470 { 447 471 PRINTF(1)("Couldn't load file %s: invalid file format: stop loading\n", fileName.c_str()); … … 449 473 } 450 474 451 this->fileName = fileName;475 this->fileName = fileName; 452 476 /* got the data: map it to locals */ 453 477 this->numFrames = this->header->numFrames; … … 468 492 fseek(pFile, this->header->offsetFrames, SEEK_SET); 469 493 fread(buffer, this->header->frameSize, this->numFrames, pFile); 494 //BULK_CONV( buffer, this->header->frameSize*this->numFrames*sizeof(char)/4 ); 470 495 /* read opengl commands */ 471 496 fseek(pFile, this->header->offsetGlCommands, SEEK_SET); 497 472 498 fread(this->pGLCommands, sizeof(int), this->numGLCommands, pFile); 499 BULK_CONV( this->pGLCommands, this->numGLCommands ); 473 500 /* triangle list */ 474 501 fseek(pFile, this->header->offsetTriangles, SEEK_SET); 475 fread(this->pTriangles, sizeof(sTriangle), this->numTriangles, pFile); 502 fread(this->pTriangles, sizeof(sTriangle), this->numTriangles, pFile); 503 BULK_CONV16( this->pTriangles, this->numTriangles*sizeof(sTriangle)/2 ); 504 476 505 /* read in texture coordinates */ 477 506 fseek(pFile, this->header->offsetTexCoords, SEEK_SET); 478 507 fread(this->pTexCoor, sizeof(sTexCoor), this->numTexCoor, pFile); 479 508 BULK_CONV16( this->pTexCoor, this->numTexCoor*sizeof(sTexCoor)/2 ); 480 509 481 510 for(int i = 0; i < this->numFrames; ++i) 482 511 { 483 512 frame = (sFrame*)(buffer + this->header->frameSize * i); 513 //Convert the translate and scale Vec3D if needed. 514 BULK_CONV( frame, 6 ); 515 BULK_CONV( frame->pVertices, 3 ); 484 516 pVertex = this->pVertices + this->numVertices * i; 485 517 pNormals = this->pLightNormals + this->numVertices * i;
Note: See TracChangeset
for help on using the changeset viewer.