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

📄 ogrepaginglandscapetexture_image.cpp

📁 使用stl技术,(还没看,是听说的)
💻 CPP
字号:
/***************************************************************************
OgrePagingLandScapeTexture_Image.cpp  -  description
-------------------
begin                : Fri Apr 16 2004
copyright            : (C) 2003 by Jose A Milan
email                : spoke@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.                                   *
*                                                                         *
***************************************************************************/

#include "OgreVector3.h"
#include "OgreColourValue.h"

#include "OgreStringConverter.h"
#include "OgreMaterialManager.h"
#include "OgreTechnique.h"
#include "OgrePass.h"

#include "OgrePagingLandScapeOptions.h"
#include "OgrePagingLandScapeTexture.h"
#include "OgrePagingLandScapeTexture_Image.h"


namespace Ogre
{

PagingLandScapeTexture_Image::PagingLandScapeTexture_Image() : PagingLandScapeTexture()
{
}

//-----------------------------------------------------------------------
PagingLandScapeTexture_Image::~PagingLandScapeTexture_Image()
{
}

//-----------------------------------------------------------------------
void PagingLandScapeTexture_Image::_loadMaterial()
{
	if ( mMaterial == 0 )
	{
	
        if (PagingLandScapeOptions::getSingleton().ImageNameLoad)
        {
            // JEFF - all material settings configured through material script
            mMaterial = reinterpret_cast<Material *>(MaterialManager::getSingleton().getByName("PagingLandScape.0.0"));

            const String commonName = StringConverter::toString(mDataZ) + String(".") + StringConverter::toString(mDataX);
            const String matname = String("Image.") + commonName;
            mMaterial = mMaterial->clone(matname);

            const String texname = PagingLandScapeOptions::getSingleton().image_filename + "." +
                commonName + "." + PagingLandScapeOptions::getSingleton().landscape_extension;       
            // assign this texture to the material
            mMaterial->getTechnique(0)->getPass(0)->getTextureUnitState(0)->setTextureName(texname);
        }
        else
        {
            // JEFF - all material settings configured through material script
            mMaterial = reinterpret_cast<Material *>(MaterialManager::getSingleton().getByName("PagingLandScape." + StringConverter::toString( mDataZ ) + "." + StringConverter::toString( mDataX )));
        }
           
		mMaterial->load(); 
        mMaterial->setLightingEnabled( PagingLandScapeOptions::getSingleton().lit );
	}
}

//-----------------------------------------------------------------------
void PagingLandScapeTexture_Image::_unloadMaterial()
{
	if ( mMaterial != 0 )
	{
		mMaterial->unload();
		// We can磘 destroy de material here.
		//mMaterial -> destroy();
		//delete mMaterial;
		//mMaterial = 0;
	}
}

} //namespace

⌨️ 快捷键说明

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