Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 24, 2006, 12:59:44 PM (18 years ago)
Author:
bensch
Message:

some newlines

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/terrain/src/lib/graphics/importer/terrain/terrain_page.h

    r9414 r9415  
    11/*
    22        orxonox - the future of 3D-vertical-scrollers
    3  
     3
    44        Copyright (C) 2006 orx
    5  
     5
    66        This program is free software; you can redistribute it and/or modify
    77        it under the terms of the GNU General Public License as published by
    88        the Free Software Foundation; either version 2, or (at your option)
    99        any later version.
    10  
     10
    1111        ### File Specific:
    1212        main programmer: Marco Biasini
    13  
     13
    1414 */
    1515
     
    2727
    2828struct Vertex {
    29         TexCoord        t;     
     29        TexCoord        t;
    3030        Vector          p;
    3131};
     
    4343                enum { TP_LEFT = 0, TP_RIGHT = 1, TP_BOTTOM = 2, TP_TOP = 3 };
    4444                const static int MAX_LODS                       = 5;
    45                
     45
    4646                /**
    4747                 * Creates a new terrain page with its lower left corner set
     
    5252                 */
    5353                TerrainPage( Terrain *_owner, int _xOffset, int _zOffset );
    54                
     54
    5555                /**
    5656                 * This is used only internally for communication between the TerrainPage and
     
    5858                 */
    5959                inline bool isActive() { return active; }
    60                
     60
    6161                virtual ~TerrainPage();
    6262                /**
    63                  * @brief Makes the terrain look as if it were created with the given level of 
     63                 * @brief Makes the terrain look as if it were created with the given level of
    6464                 * detail.
    6565                 */
    6666                void mimick( int _level ) {}
    67                
     67
    6868                /**
    6969                 * @brief Draws a box around the TerrainPage. For debugging purposes.
    7070                 */
    7171                void drawBox();
    72                
    73                 /** 
     72
     73                /**
    7474                 * @brief Calculates the smallest fitting axis aligned bounding box for this TerrainPage.
    7575                 */
    76                 virtual void calculateBounds();         
    77                
    78                
    79                 /**
    80                  * @brief Sets the visibility to _flag. If the visibility changed, the vertex and 
     76                virtual void calculateBounds();
     77
     78
     79                /**
     80                 * @brief Sets the visibility to _flag. If the visibility changed, the vertex and
    8181                 * index arrays are allocated or freed, respectively.
    8282                 */
     
    8787                 */
    8888                void show( );
    89                
     89
    9090                /**
    9191                 * @brief Frees most of the memory for economomical reasons.
    9292                 */
    93                 void hide( ); 
    94                
     93                void hide( );
     94
    9595                /**
    9696                 * @brief Updates the tesselation if necessary.
    9797                 */
    9898                void updateTesselation( );
    99                
     99
    100100                /**
    101101                 * @return The current tesselation level.
    102102                 */
    103103                int getLOD() { return currentLOD; }
    104                
    105                 /**
    106                  * @return The curren tween factor. This is a floating point value  between 0.0f 
     104
     105                /**
     106                 * @return The curren tween factor. This is a floating point value  between 0.0f
    107107                 * and 1.0f
    108108                 */
    109109                float getTween() { return 0.0f; }
    110                
     110
    111111                /**
    112112                 * @brief Determines the new LOD which should be used by this terrain page based on
    113                  * the distance from the camera. 
     113                 * the distance from the camera.
    114114                 *
    115                  * No geometry is updated in this method. You need to call 
     115                 * No geometry is updated in this method. You need to call
    116116                 * updateTesselation() in order to see a change in geometry. This method is
    117                  * just a recommondation for the LOD. It might be invalid due to outer 
     117                 * just a recommondation for the LOD. It might be invalid due to outer
    118118                 * constraints.
    119119                 */
    120120                int chooseLOD();
    121                
     121
    122122                /**
    123123                 * If the terrain pages tesselation level changed between the last and the
     
    127127                 */
    128128                bool isDirty() { return forceTesselation; }
    129                
     129
    130130                /**
    131131                 * @brief Calculates the maximal errors for every LOD.
    132132                 */
    133133                void calculateErrors();
    134                
     134
    135135                /**
    136136                 * @brief Calculates the error for the given LOD. We just need to know the "worst"
     
    138138                 */
    139139                void calculateError( int _lod );
    140                
    141                
     140
     141
    142142                /**
    143143                 * Tests if the terrain page would cull against the viewing frustum.
     
    150150                 * pages is at the border.
    151151                 */
    152                 inline void setNeighbors( pTerrainPage _left, pTerrainPage _right, 
     152                inline void setNeighbors( pTerrainPage _left, pTerrainPage _right,
    153153                        pTerrainPage _top, pTerrainPage _bottom )
    154154                {
    155155                        left = _left; right = _right; top = _top; bottom = _bottom;
    156156                }
    157                
     157
    158158                /**
    159159                 * Sets the position of the TerrainPage. Is this needed?
     
    169169                pTerrainPage getRight() { return right; }
    170170                pTerrainPage getBottom() { return bottom; }
    171                 pTerrainPage getTop() { return top; }                                           
    172                
     171                pTerrainPage getTop() { return top; }
     172
    173173                /**
    174174                 *  Does what exactly what the name says and nothing more.
    175175                 */
    176176                void draw( );
    177                
     177
    178178                /**
    179179                 * @return the next active page
     
    181181                inline pTerrainPage getNext() { return next; }
    182182                void setLayerVisibility( int _layer, LayerVisibility _lv );
    183                 bool hasMaterial( int _layer );         
     183                bool hasMaterial( int _layer );
    184184                /**
    185185                 * Returns the previous active page
    186186                 */
    187                 inline pTerrainPage getPrevious() { return previous; }                 
     187                inline pTerrainPage getPrevious() { return previous; }
    188188                inline int getCurrentLOD() { return currentLOD; }
    189189                /**
     
    192192                 */
    193193                inline int getWantedLOD() { return wantedLOD; }
    194                
     194
    195195                /**
    196196                 * @brief Removes the page from the active page list.
    197197                 */
    198198                void deactivate();
    199                
    200                 /** 
     199
     200                /**
    201201                 * @brief Inserts the page into the active page list.
    202202                 */
    203                 void activate();               
     203                void activate();
    204204
    205205                inline void setWantedLOD( int _lod )
     
    212212                                wantedLOD = _lod;
    213213                }
    214                                
     214
    215215        protected:
    216                
     216
    217217                /**
    218218                 * @brief Tesselates one row of the terrain page.
     
    221221                 * @param _zStride              Defines the step-size vertically.
    222222                 * @param _adaptLeft    True if the left neighbor has a coarser
    223                  *                                              tesselation level.             
     223                 *                                              tesselation level.
    224224                 * @param _adaptRight   True if the right neighbor has a coarser
    225225                 *                                              tesselation level.
     
    228228                void tesselateTopRow( int _z, int _stride, bool _adaptLeft, bool _adaptRight );
    229229                void tesselateBottomRow( int _z, int _stride, bool _adaptLeft, bool _adaptRight );
    230                 /** 
     230                /**
    231231                 * @brief Returns four boolean values in the oder
    232232                 */
    233233                void determineBorderAdaption( bool _adapt[] );
    234                
     234
    235235                /**
    236236                 * @brief Adds the given index to the index-array
    237237                 */
    238238                inline void addIndex( unsigned short _index );
    239                
     239
    240240                /**
    241241                 * @brief We programmers are very lazy :) This method just adds the last added index
     
    243243                 */
    244244                inline void addAgain();
    245                
    246                
     245
     246
    247247                void getCoord( int _x, int _z, TexCoord& _coord) const;
    248                
    249                 /** 
     248
     249                /**
    250250                 * Fills _vertex with the vertex information at index.
    251251                 */
    252252                void getVertex( int _x, int _z, Vector& _vertex ) const;
    253                
     253
    254254                /**
    255255                 * Use this method to safely get a vertex at location ( _x, _z ). If it wasn't
    256                  * created before, this method does that for you. 
    257                  */                     
     256                 * created before, this method does that for you.
     257                 */
    258258                unsigned short getIndex( int _x, int _z );
    259259                void tesselateLevelFourPage( bool _adapt[] );
     
    261261                * Generates the tesselation for the given level of detail.
    262262                */
    263                 void tesselate( int _lod );                     
     263                void tesselate( int _lod );
    264264
    265265                float getAltitude( int _x, int _z ) const;
    266                
     266
    267267                int                                                     currentLOD,
    268268                                                                        wantedLOD;
    269                 pTerrainPage                            left, 
     269                pTerrainPage                            left,
    270270                                                                        right,
    271271                                                                        top,
     
    283283                GLuint                                          ibIdentifier,
    284284                                                                        vbIdentifier;
    285 #endif         
     285#endif
    286286                bool                                            isVisible;
    287287                pTerrainPage                            next;
     
    313313}
    314314
    315 inline void TerrainPage::addAgain() 
    316 { 
    317         indices[numIndices] = indices[numIndices-1]; numIndices++;                             
     315inline void TerrainPage::addAgain()
     316{
     317        indices[numIndices] = indices[numIndices-1]; numIndices++;
    318318}
    319319
Note: See TracChangeset for help on using the changeset viewer.