2
--------------------------------------------------------------------------------
3
This source file is part of Hydrax.
6
Copyright (C) 2008 Xavier Vergu�n Gonz�lez <xavierverguin@hotmail.com>
9
This program is free software; you can redistribute it and/or modify it under
10
the terms of the GNU Lesser General Public License as published by the Free Software
11
Foundation; either version 2 of the License, or (at your option) any later
14
This program is distributed in the hope that it will be useful, but WITHOUT
15
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
18
You should have received a copy of the GNU Lesser General Public License along with
19
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
20
Place - Suite 330, Boston, MA 02111-1307, USA, or go to
21
http://www.gnu.org/copyleft/lesser.txt.
22
--------------------------------------------------------------------------------
25
#include "GPUNormalMapManager.h"
31
GPUNormalMapManager::GPUNormalMapManager(Hydrax* h)
33
, mRttManager(h->getRttManager())
36
mRttManager->setBitsPerChannel(RttManager::RTT_GPU_NORMAL_MAP, RttManager::BPC_16);
37
mRttManager->setNumberOfChannels(RttManager::RTT_GPU_NORMAL_MAP, RttManager::NOC_3);
39
mNormalMapMaterial.setNull();
42
GPUNormalMapManager::~GPUNormalMapManager()
47
void GPUNormalMapManager::create()
49
mRttManager->initialize(RttManager::RTT_GPU_NORMAL_MAP);
51
mHydrax->getMaterialManager()->reload(MaterialManager::MAT_WATER);
53
if (mHydrax->isComponent(HYDRAX_COMPONENT_UNDERWATER))
55
mHydrax->getMaterialManager()->reload(MaterialManager::MAT_UNDERWATER);
61
void GPUNormalMapManager::remove()
68
for (unsigned int k = 0; k < mTextures.size(); k++)
70
Ogre::TextureManager::getSingleton().remove(mTextures.at(k)->getName());
75
mRttManager->remove(RttManager::RTT_GPU_NORMAL_MAP);
77
Ogre::HighLevelGpuProgramManager::getSingleton().unload(mNormalMapMaterial->getTechnique(0)->getPass(0)->getVertexProgramName());
78
Ogre::HighLevelGpuProgramManager::getSingleton().unload(mNormalMapMaterial->getTechnique(0)->getPass(0)->getFragmentProgramName());
79
Ogre::HighLevelGpuProgramManager::getSingleton().remove(mNormalMapMaterial->getTechnique(0)->getPass(0)->getVertexProgramName());
80
Ogre::HighLevelGpuProgramManager::getSingleton().remove(mNormalMapMaterial->getTechnique(0)->getPass(0)->getFragmentProgramName());
82
Ogre::MaterialManager::getSingleton().remove(mNormalMapMaterial->getName());
83
mNormalMapMaterial.setNull();
b'\\ No newline at end of file'