Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 16, 2006, 11:35:49 PM (18 years ago)
Author:
ponder
Message:
  • Added multitexturing support to the terrain-class.
  • The lightmap gets screwed up and I don't know why…
File:
1 edited

Legend:

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

    r8349 r8548  
    199199                 */
    200200                void activate();               
    201                
    202                 protected:
    203                        
    204                         /**
    205                          * @brief Tesselates one row of the terrain page.
    206                          * @param _z                    The z-offset of the row
    207                          * @param _xStride              Determines the step-size horizontally
    208                          * @param _zStride              Determines the step-size vertically.
    209                          * @param _adaptRight   True if the right neighbor has a coarser
    210                          *                                              tesselation level.
    211                          * @param _adaptLeft    True if the left neighbor has a coarser
    212                          *                                              tesselation level.                     
    213                          */
    214                         void tesselateRow( int _z, int _xStride, int _zStride, bool _adaptLeft, bool _adaptRight );
    215 
    216                         /**
    217                          * @brief Returns four boolean values in the oder
    218                          */
    219                         void determineBorderAdaption( bool _adapt[] );
    220                        
    221                         /**
    222                          * @brief Adds the given index to the index-array
    223                          */
    224                         inline void addIndex( unsigned short _index );
    225                        
    226                         /**
    227                          * @brief We programmers are very lazy :) This method just adds the last added index
    228                          * again.
    229                          */
    230                         inline void addAgain();
    231                        
    232                        
    233                         void getCoord( int _x, int _z, TexCoord& _coord) const;
    234                        
    235                         /**
    236                          * Fills _vertex with the vertex information at index.
    237                          */
    238                         void getVertex( int _x, int _z, Triple& _vertex ) const;
    239                        
    240                         /**
    241                          * Use this method to safely get a vertex at location ( _x, _z ). If it wasn't
    242                          * created before, this method does that for you.
    243                          */                     
    244                         short getIndex( int _x, int _z );
    245                         void tesselateLevelFourPatch( bool _adapt[] );
    246                    /**
    247                         * Generates the tesselation for the given level of detail.
    248                         */
    249                         void tesselate( int _lod );                     
    250                        
    251                         float getAltitude( int _x, int _z ) const;
    252                        
    253                         int                                                     currentLOD,
    254                                                                                 wantedLOD;
    255                         float                                           tween;
    256                         pTerrainPage                            left,
    257                                                                                 right,
    258                                                                                 top,
    259                                                                                 bottom;
    260                         bool                                            forceTesselation;
    261                         bool                                            active;
    262                         Triple                                          *vertices;
    263                         unsigned short                          *indices;
    264                         unsigned short                          *indexHash;
    265                         TexCoord                                        *coords;
    266                         int                                                     numIndices;
    267                         int                                                     numVertices;
    268                         bool                                            isVisible;
    269                         pTerrainPage                            next;
    270                         pTerrainPage                            previous;
    271                         LODError                                        *errors;
    272                         Triple                                          position;
     201                inline bool hasMaterial( int _i )
     202                {
     203                        return true;
     204                }
     205               
     206                inline void setWantedLOD( int _lod )
     207                {
     208                        if ( wantedLOD >= TerrainPage::MAX_LODS )
     209                                wantedLOD = 4;
     210                        else
     211                                wantedLOD = _lod;
     212                }               
     213        protected:
     214               
     215                /**
     216                 * @brief Tesselates one row of the terrain page.
     217                 * @param _z                    The z-offset of the row
     218                 * @param _xStride              Determines the step-size horizontally
     219                 * @param _zStride              Determines the step-size vertically.
     220                 * @param _adaptRight   True if the right neighbor has a coarser
     221                 *                                              tesselation level.
     222                 * @param _adaptLeft    True if the left neighbor has a coarser
     223                 *                                              tesselation level.                     
     224                 */
     225                void tesselateRow( int _z, int _xStride, int _zStride, bool _adaptLeft, bool _adaptRight );
     226
     227                /**
     228                 * @brief Returns four boolean values in the oder
     229                 */
     230                void determineBorderAdaption( bool _adapt[] );
     231               
     232                /**
     233                 * @brief Adds the given index to the index-array
     234                 */
     235                inline void addIndex( unsigned short _index );
     236               
     237                /**
     238                 * @brief We programmers are very lazy :) This method just adds the last added index
     239                 * again.
     240                 */
     241                inline void addAgain();
     242               
     243               
     244                void getCoord( int _x, int _z, TexCoord& _coord) const;
     245               
     246                /**
     247                 * Fills _vertex with the vertex information at index.
     248                 */
     249                void getVertex( int _x, int _z, Triple& _vertex ) const;
     250               
     251                /**
     252                 * Use this method to safely get a vertex at location ( _x, _z ). If it wasn't
     253                 * created before, this method does that for you.
     254                 */                     
     255                short getIndex( int _x, int _z );
     256                void tesselateLevelFourPatch( bool _adapt[] );
     257           /**
     258                * Generates the tesselation for the given level of detail.
     259                */
     260                void tesselate( int _lod );                     
     261
     262                float getAltitude( int _x, int _z ) const;
     263               
     264                int                                                     currentLOD,
     265                                                                        wantedLOD;
     266                float                                           tween;
     267                pTerrainPage                            left,
     268                                                                        right,
     269                                                                        top,
     270                                                                        bottom;
     271                bool                                            forceTesselation;
     272                bool                                            active;
     273                Triple                                          *vertices;
     274                unsigned short                          *indices;
     275                unsigned short                          *indexHash;
     276                TexCoord                                        *coords;
     277                int                                                     numIndices;
     278                int                                                     numVertices;
     279                bool                                            isVisible;
     280                pTerrainPage                            next;
     281                pTerrainPage                            previous;
     282                LODError                                        *errors;
     283                Triple                                          position;
    273284};
    274285
Note: See TracChangeset for help on using the changeset viewer.