RigsofRods
Soft-body Physics Simulation
GPUNormalMapManager.h
Go to the documentation of this file.
1 /*
2 --------------------------------------------------------------------------------
3 This source file is part of Hydrax.
4 Visit ---
5 
6 Copyright (C) 2008 Xavier Verguín González <xavierverguin@hotmail.com>
7  <xavyiy@gmail.com>
8 
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
12 version.
13 
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.
17 
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 --------------------------------------------------------------------------------
23 */
24 
25 #ifndef _Hydrax_GPUNormalMapManager_H_
26 #define _Hydrax_GPUNormalMapManager_H_
27 
28 #include "Prerequisites.h"
29 
30 #include "Enums.h"
31 #include "RttManager.h"
32 
35 
38 
39 namespace Hydrax
40 {
41  class Hydrax;
42 
46  {
47  public:
52 
56 
60  void create();
61 
64  void remove();
65 
69  inline void setActive(const bool& Active)
70  {
71  if (Active)
72  {
74  }
75  else
76  {
78  }
79  }
80 
84  inline const bool& isCreated() const
85  {
86  return mCreated;
87  }
88 
94  inline Hydrax* getHydrax()
95  {
96  return mHydrax;
97  }
98 
102  inline Ogre::MaterialPtr &getNormalMapMaterial()
103  {
104  return mNormalMapMaterial;
105  }
106 
111  inline Ogre::TexturePtr &getTexture(const int& Index)
112  {
113  return mTextures.at(Index);
114  }
115 
119  void addTexture(Ogre::TexturePtr &Texture)
120  {
121  mTextures.push_back(Texture);
122  }
123 
127  inline void removeTexture(const int& Index)
128  {
129  Ogre::TextureManager::getSingleton().remove(mTextures.at(Index)->getName());
130 
131  std::vector<Ogre::TexturePtr>::iterator TexIt = mTextures.begin() + Index;
132 
133  mTextures.erase(TexIt);
134  }
135 
136  private:
137 
142 
144  bool mCreated;
145 
151  Ogre::MaterialPtr mNormalMapMaterial;
152 
157  std::vector<Ogre::TexturePtr> mTextures;
158  };
159 }
160 
163 
164 #endif
Hydrax::GPUNormalMapManager::mCreated
bool mCreated
Has been create() already called?
Definition: GPUNormalMapManager.h:144
Hydrax::GPUNormalMapManager::getTexture
Ogre::TexturePtr & getTexture(const int &Index)
Get a texture.
Definition: GPUNormalMapManager.h:111
Hydrax::GPUNormalMapManager::isCreated
const bool & isCreated() const
Has been created() already called?
Definition: GPUNormalMapManager.h:84
Hydrax::GPUNormalMapManager::getNormalMapMaterial
Ogre::MaterialPtr & getNormalMapMaterial()
Get the normal map material.
Definition: GPUNormalMapManager.h:102
Hydrax
Definition: CfgFileManager.cpp:28
Hydrax::GPUNormalMapManager::mHydrax
Hydrax * mHydrax
Hydrax main pointer.
Definition: GPUNormalMapManager.h:139
Hydrax::RttManager::RTT_GPU_NORMAL_MAP
@ RTT_GPU_NORMAL_MAP
Definition: RttManager.h:57
Hydrax::GPUNormalMapManager::mRttManager
RttManager * mRttManager
Rtt manager pointer.
Definition: GPUNormalMapManager.h:141
Hydrax::GPUNormalMapManager::mTextures
std::vector< Ogre::TexturePtr > mTextures
The normal map material needs some textures wich will be filled by code.
Definition: GPUNormalMapManager.h:157
Hydrax::GPUNormalMapManager::addTexture
void addTexture(Ogre::TexturePtr &Texture)
Create a texture.
Definition: GPUNormalMapManager.h:119
Hydrax::GPUNormalMapManager::mNormalMapMaterial
Ogre::MaterialPtr mNormalMapMaterial
This material must be created in the noise module, in order to be according with the Hydrax modulable...
Definition: GPUNormalMapManager.h:151
Enums.h
Hydrax::GPUNormalMapManager
Class to manager GPU normal maps.
Definition: GPUNormalMapManager.h:45
Hydrax::GPUNormalMapManager::removeTexture
void removeTexture(const int &Index)
Remove a texture.
Definition: GPUNormalMapManager.h:127
Hydrax::GPUNormalMapManager::~GPUNormalMapManager
~GPUNormalMapManager()
Destructor.
Definition: GPUNormalMapManager.cpp:42
RttManager.h
Hydrax::RttManager
Rtt's manager class.
Definition: RttManager.h:45
Hydrax::GPUNormalMapManager::getHydrax
Hydrax * getHydrax()
Get the Hydrax parent pointer.
Definition: GPUNormalMapManager.h:94
Hydrax::GPUNormalMapManager::remove
void remove()
Remove.
Definition: GPUNormalMapManager.cpp:61
Hydrax::GPUNormalMapManager::GPUNormalMapManager
GPUNormalMapManager(Hydrax *h)
Constructor.
Definition: GPUNormalMapManager.cpp:31
Prerequisites.h
Hydrax::GPUNormalMapManager::setActive
void setActive(const bool &Active)
Set active.
Definition: GPUNormalMapManager.h:69
Hydrax::GPUNormalMapManager::create
void create()
Create.
Definition: GPUNormalMapManager.cpp:47
Hydrax::RttManager::initialize
void initialize(const RttType &Rtt)
Initialize a RTT.
Definition: RttManager.cpp:78
Hydrax::RttManager::remove
void remove(const RttType &Rtt)
Removes a RTT.
Definition: RttManager.cpp:128