⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ogrepaginglandscapeindexbuffer.h

📁 使用stl技术,(还没看,是听说的)
💻 H
字号:
/***************************************************************************
  OgrePagingLandScapeIndexBuffer.h  -  description
  -------------------
  begin                : Fri Feb 28 2003
  copyright            : (C) 2003 by Jose A Milan
  email                : spoke2@supercable.es
***************************************************************************/

/***************************************************************************
*                                                                         *
*   This program is free software; you can redistribute it and/or modify  *
*   it under the terms of the GNU Lesser General Public License as        *
*   published by the Free Software Foundation; either version 2 of the    *
*   License, or (at your option) any later version.                       *
*                                                                         *
***************************************************************************/

#ifndef PAGINGLANDSCAPEINDEXBUFFER_H
#define PAGINGLANDSCAPEINDEXBUFFER_H

#include "OgrePagingLandScapePrerequisites.h"
#include "OgreSingleton.h"

namespace Ogre
{

#define STITCH_NORTH_SHIFT 0
#define STITCH_SOUTH_SHIFT 8
#define STITCH_WEST_SHIFT  16
#define STITCH_EAST_SHIFT  24

#define STITCH_NORTH  128 << STITCH_NORTH_SHIFT
#define STITCH_SOUTH  128 << STITCH_SOUTH_SHIFT
#define STITCH_WEST   128 << STITCH_WEST_SHIFT
#define STITCH_EAST   128 << STITCH_EAST_SHIFT


class PagingLandScapeIndexBuffer : public Singleton<PagingLandScapeIndexBuffer>
{
    public:


	    PagingLandScapeIndexBuffer( );

	    ~PagingLandScapeIndexBuffer( );

	    IndexData *getIndex(const int LOD);

	    static PagingLandScapeIndexBuffer& getSingleton(void);

	    static PagingLandScapeIndexBuffer* getSingletonPtr(void);



        /** Utility method to generate stitching indexes on the edge of a tile
        @param neighbor The neighbor direction to stitch
        @param hiLOD The LOD of this tile
        @param loLOD The LOD of the neighbor
        @param omitFirstTri Whether the first tri of the stitch (always clockwise
        relative to the centre of this tile) is to be omitted because an 
        adjoining edge is also being stitched
        @param omitLastTri Whether the last tri of the stitch (always clockwise
        relative to the centre of this tile) is to be omitted because an 
        adjoining edge is also being stitched
        @param pIdx Pointer to a pointer to the index buffer to push the results 
        into (this pointer will be updated)
        @returns The number of indexes added
        */
        uint stitchEdge(Neighbor neighbor, const uint hiLOD, const uint loLOD, 
                        bool omitFirstTri, bool omitLastTri, 
                        unsigned short** ppIdx);

        /// Gets the index data for this tile based on current settings
        IndexData *getIndexData( const uint stitchFlags, const uint RenderLevel,
            PagingLandScapeRenderable **Neighbors);

        /// Internal method for generating triangle list terrain indexes
        IndexData* generateTriListIndexes(const uint stitchFlags, const uint RenderLevel,
            PagingLandScapeRenderable **Neighbors);

    protected:

        /** Returns the index into the height array for the given coordinates. */
        inline ushort _index( int x, int z ) const
        {
            return (x + z * mTileSize);
        };       

        uint mTileSize;

        IndexArray mCache;
        /// Shared array of IndexData (reuse indexes across tiles)
        LevelArray mLevelIndex;
	    // Store the indexes for every combination
        uint mNumIndexes;

};

}

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -