Changeset 8775 in orxonox.OLD
- Timestamp:
- Jun 25, 2006, 11:30:59 AM (18 years ago)
- Location:
- branches/terrain/src
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/terrain/src/lib/graphics/importer/terrain/buffer_broker.h
r8697 r8775 19 19 #include "glincl.h" 20 20 #include "debug.h" 21 21 #include "types.h" 22 22 /** 23 23 * @brief Manages the streaming of the vertex buffer objects for the terrain page. … … 55 55 } 56 56 head = tail = NULL; 57 } 58 ~BufferBroker() 59 { 60 pBufferPair bp = head; 61 while ( bp ) { 62 pBufferPair tmp = bp->next; 63 release( bp->vertexName, bp->indexName ); 64 bp = tmp; 65 } 66 glDeleteBuffersARB( capacity, freeVertexBuffers ); 67 glDeleteBuffersARB( capacity, freeIndexBuffers ); 68 SAVE_DELETE_ARRAY( freeIndexBuffers ); 69 SAVE_DELETE_ARRAY( freeVertexBuffers ); 57 70 } 58 71 inline int getIBSize() { return ibSize; } -
branches/terrain/src/lib/graphics/importer/terrain/frustum.h
r8697 r8775 18 18 #include "glincl.h" 19 19 #include <stdio.h> 20 21 22 #define MAX_CLIP_DISTANCE 400.0f 20 23 #define m( _row,_col ) _m[_col*4+_row-5] 21 24 … … 95 98 m( 3, 3 ) + m( 4, 3 ), 96 99 m( 3, 4 ) + m( 4, 4 ) ); 100 97 101 planes[FAR].setCoefficients( 98 102 -m( 3, 1 ) + m( 4, 1 ), … … 100 104 -m( 3, 3 ) + m( 4, 3 ), 101 105 -m( 3, 4 ) + m( 4, 4 ) ); 106 102 107 planes[BOTTOM].setCoefficients( 103 108 m( 2, 1 ) + m( 4, 1 ), … … 105 110 m( 2, 3 ) + m( 4, 3 ), 106 111 m( 2, 4 ) + m( 4, 4 ) ); 112 107 113 planes[TOP].setCoefficients( 108 114 -m( 2, 1 ) + m( 4, 1 ), … … 110 116 -m( 2, 3 ) + m( 4, 3 ), 111 117 -m( 2, 4 ) + m( 4, 4 ) ); 118 112 119 planes[LEFT].setCoefficients( 113 120 m( 1, 1 ) + m( 4, 1 ), … … 115 122 m( 1, 3 ) + m( 4, 3 ), 116 123 m( 1, 4 ) + m( 4, 4 ) ); 124 117 125 planes[RIGHT].setCoefficients( 118 126 -m( 1, 1 ) + m( 4, 1 ), … … 120 128 -m( 1, 3 ) + m( 4, 3 ), 121 129 -m( 1, 4 ) + m( 4, 4 ) ); 130 131 if ( planes[NEAR].d +planes[FAR].d > MAX_CLIP_DISTANCE ) { 132 planes[FAR].d = -planes[NEAR].d+MAX_CLIP_DISTANCE; 133 } 122 134 } 123 135 -
branches/terrain/src/lib/graphics/importer/terrain/terrain.cc
r8770 r8775 176 176 pTerrainPage page = NULL; 177 177 frustum->extractPlanes(); 178 178 glPushAttrib( GL_ALL_ATTRIB_BITS ); 179 glPushClientAttrib( GL_CLIENT_VERTEX_ARRAY_BIT ); 179 180 /* 180 181 * Enable texture and vertex arrays for the first and the second texture … … 256 257 indices, GL_DYNAMIC_DRAW_ARB ); 257 258 } 258 glPushAttrib( GL_COLOR_BUFFER_BIT );259 259 glEnable( GL_BLEND ); 260 260 glDepthFunc( GL_LEQUAL ); … … 323 323 glActiveTextureARB( GL_TEXTURE1_ARB ); 324 324 glDisable( GL_TEXTURE_2D ); 325 glDisableClientState( GL_VERTEX_ARRAY );326 glDisableClientState( GL_TEXTURE_COORD_ARRAY );327 glDisableClientState( GL_VERTEX_ARRAY );328 glDisableClientState( GL_TEXTURE_COORD_ARRAY );329 325 glActiveTextureARB( GL_TEXTURE0_ARB ); 330 glClientActiveTextureARB( GL_TEXTURE0_ARB );331 glDisableClientState( GL_VERTEX_ARRAY );332 glDisableClientState( GL_TEXTURE_COORD_ARRAY );333 326 glEnable( GL_LIGHTING ); 334 327 glMatrixMode( GL_TEXTURE ); 335 328 glLoadIdentity(); 336 329 glPopAttrib(); 330 glPopClientAttrib(); 337 331 } 338 332 -
branches/terrain/src/lib/graphics/importer/terrain/terrain.h
r8770 r8775 97 97 } 98 98 99 ~Terrain( ) 100 { 101 //The pages are deleted through the SAVE_DELETE( root ) call. 102 SAVE_DELETE_ARRAY( pages ); 103 SAVE_DELETE_ARRAY( vertices ); 104 SAVE_DELETE_ARRAY( indices ); 105 SAVE_DELETE( lightmap ); 106 SAVE_DELETE( root ); 107 #ifdef USE_VBO 108 SAVE_DELETE( broker ); 109 #endif 110 } 99 111 /** 100 112 * Draws the terrain. … … 119 131 * coordinates. 120 132 */ 121 inline void incActivated() { activatedCount++; }122 inline void incDeactivated() { deactivatedCount++; }123 133 inline float getAltitude( int _x, int _z ) const; 124 134 … … 150 160 151 161 inline void setScale( const Triple& _scale ) 152 { 153 scale = _scale; 154 } 162 { scale = _scale; } 155 163 #ifdef USE_VBO 156 164 inline pBufferBroker getBufferBroker() { return broker; } -
branches/terrain/src/lib/graphics/importer/terrain/terrain_page.cc
r8770 r8775 26 26 }\ 27 27 while ( 0 ) 28 29 TerrainPage::~TerrainPage( ) 30 { 31 SAVE_DELETE_ARRAY( indices ); 32 SAVE_DELETE_ARRAY( vertices ); 33 SAVE_DELETE_ARRAY( indexHash ); 34 SAVE_DELETE_ARRAY( errors ); 35 } 28 36 29 37 TerrainPage::TerrainPage( Terrain *_owner, int _xOffset, int _zOffset ) … … 668 676 owner->getBufferBroker()->release( vbIdentifier, ibIdentifier ); 669 677 #endif 670 if ( vertices ) { 671 delete[] vertices; 672 vertices = NULL; 673 } 674 if ( indices ) { 675 delete[] indices; 676 indices = NULL; 677 numIndices = 0; 678 } 678 SAVE_DELETE_ARRAY( vertices ); 679 numVertices = 0; 680 SAVE_DELETE_ARRAY( indices ); 681 numIndices = 0; 679 682 deactivate(); 680 683 } -
branches/terrain/src/lib/graphics/importer/terrain/terrain_page.h
r8770 r8775 43 43 enum { TP_LEFT = 0, TP_RIGHT = 1, TP_BOTTOM = 2, TP_TOP = 3 }; 44 44 const static int MAX_LODS = 5; 45 45 46 /** 46 47 * Creates a new terrain page with its lower left corner set … … 58 59 inline bool isActive() { return active; } 59 60 60 61 ~TerrainPage( ) 62 { 63 if ( isVisible ) 64 hide(); 65 } 66 61 virtual ~TerrainPage(); 67 62 /** 68 63 * @brief Makes the terrain look as if it were created with the given level of -
branches/terrain/src/lib/graphics/importer/terrain/terrain_quad.cc
r8697 r8775 21 21 { 22 22 scale = owner->getScale(); 23 children[0] = children[1] = children[2] = children[3] = NULL; 23 24 } 24 25 -
branches/terrain/src/lib/graphics/importer/terrain/terrain_quad.h
r8697 r8775 32 32 virtual ~TerrainQuad( ) 33 33 { 34 for ( int i = 0; i < 4; ++i ) 35 if ( children[i] != NULL ) 36 delete children[i]; 34 for ( int i = 0; i < 4; ++i ) { 35 if ( !children[i]->isChildless() ) 36 SAVE_DELETE( children[i] ); 37 } 37 38 } 38 39 int cull( ); -
branches/terrain/src/lib/graphics/importer/terrain/types.h
r8770 r8775 21 21 #include <math.h> 22 22 #include "texture.h" 23 24 #define SAVE_DELETE_ARRAY( _a ) if ( _a ) { delete[] _a; _a = NULL; } 25 #define SAVE_DELETE( _a ) if ( _a ) { delete _a; _a = NULL; } 23 26 24 27 struct Triple { -
branches/terrain/src/lib/sound/ogg_player.cc
r8362 r8775 399 399 if(size == 0) 400 400 return false; 401 /*#ifdef SDL_BIG_ENDIAN402 int cnt = wavLength/2;403 Uint16* wavBufferAsShorts = ( Uint16* )wavBuffer;404 405 406 #endif */401 #ifdef SDL_BIG_ENDIAN 402 int cnt = OGG_PLAYER_BUFFER_SIZE/2; 403 Uint16* wavBufferAsShorts = ( Uint16* )pcm; 404 for ( int i = 0; i < cnt; ++i, ++wavBufferAsShorts ) 405 *wavBufferAsShorts = SDL_Swap16( *wavBufferAsShorts ); 406 #endif 407 407 alBufferData(buffer, format, pcm, size, vorbisInfo->rate); 408 408 if (DEBUG_LEVEL >= 3) -
branches/terrain/src/lib/sound/sound_buffer.cc
r8619 r8775 76 76 } 77 77 #if SDL_BYTEORDER == SDL_BIG_ENDIAN 78 79 80 81 82 83 78 if ( !( wavSpec.format == AUDIO_U8 || wavSpec.format == AUDIO_S8 ) ) { 79 int cnt = wavLength/2; 80 Uint16* wavBufferAsShorts = ( Uint16* )wavBuffer; 81 for ( int i = 0; i < cnt; ++i, ++wavBufferAsShorts ) 82 *wavBufferAsShorts = SDL_Swap16( *wavBufferAsShorts ); 83 } 84 84 #endif 85 85 alBufferData(this->bufferID, SoundBuffer::sdlAudioSpecToAlFormat(&wavSpec), -
branches/terrain/src/world_entities/camera.cc
r8697 r8775 83 83 { 84 84 this->nearClip = nearClip; 85 this->farClip = 400.0f;//farClip;85 this->farClip = farClip; 86 86 } 87 87
Note: See TracChangeset
for help on using the changeset viewer.