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

📄 ogrepaginglandscapedata2dmanager.h

📁 使用stl技术,(还没看,是听说的)
💻 H
字号:
/***************************************************************************
	OgrePagingLandScapeData2DManager.h  -  description
	-------------------
  begin                : Mon Jun 16 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 PAGINGLANDSCAPEDATA2DMANAGER_H
#define PAGINGLANDSCAPEDATA2DMANAGER_H

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

namespace Ogre
{

    class PagingLandScapeData2DManager : public Singleton<PagingLandScapeData2DManager>
    {
        public:

        
        PagingLandScapeData2DManager( );
        
        ~PagingLandScapeData2DManager( );
        
        void load( const uint dataX, const uint dataZ );
        
        void unload( const uint dataX, const uint dataZ );
        
        bool isLoaded( const uint dataX, const uint dataZ );
        
        
        const float getHeight( const uint dataX, const uint dataZ, 
                               const float x, const float z );
        
        const float getHeight( const uint dataX, const uint dataZ, 
                               const uint x, const uint z );
        
        const float getHeightAtPage(const uint dataX, const uint dataZ, 
                                    const float x, const float z);
        
        const float getHeightAtPage(const uint dataX, const uint dataZ, 
                                    const int x, const int z);
        
        void DeformHeight(const Vector3 &deformationPoint,
                          const Real &modificationHeight,
                          PagingLandScapeTileInfo* info);
        
        bool addNewHeight( const Sphere newSphere );
        
        bool removeNewHeight( const Sphere oldSphere );
        
        //This function will return the max possible value of height base on the current 2D Data implementation
        const float getMaxHeight(const uint x, const uint z);
        
        const Real getMaxHeight();
        /** Get the real world height at a particular position
            @remarks
            Method is used to get the terrain height at a world position based on x and z.
            This method just figures out what page the position is on and then asks the page node
            to do the dirty work of getting the height.
            
            @par
            the float returned is the real world height based on the scale of the world.  If the height could
            not be determined then -1 is returned and this would only occur if the page was not preloaded or loaded
            
            @param x  x world position
            @param z  z world position
        */
        const float getRealWorldHeight(const float x, const float z);
        const float getRealWorldHeight(const float x, const float z, PagingLandScapeTileInfo* info);
        
        const float getRealPageHeight (const float x, const float z, const uint pageX, const uint pageZ, const uint Lod);
        
        const ColourValue getCoverageAt( const uint dataX, const uint dataZ, const float x, const float z );
        const ColourValue getBaseAt( const uint dataX, const uint dataZ, const float x, const float z );
        
        const Vector3 getNormalAt( const uint dataX, const uint dataZ, const float x, const float z);
         
        // JEFF
        /** Get the Page indices from a world position vector
            @remarks
            Method is used to find the Page indices using a world position vector.
            Beats having to iterate through the Page list to find a page at a particular
            position in the world.
            @param pos the world position vector. Only components x and z are used
            @param x	result placed in reference to the x index of the page
            @param z	result placed in reference to the z index of the page
        */
        void getPageIndices(const Vector3& pos, uint& x, uint& z);
        
        PagingLandScapeData2D *getData2d (const uint x, const uint z);
        
        
        static PagingLandScapeData2DManager& getSingleton(void);
        
        static PagingLandScapeData2DManager* getSingletonPtr(void);
        
    protected:
        
        PagingLandScapeData2DPages mData2D;
        Real mMaxHeight;
        
    };
    
} //namespace

#endif

⌨️ 快捷键说明

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