RigsofRods
Soft-body Physics Simulation
TextureManager.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_TextureManager_H_
26 #define _Hydrax_TextureManager_H_
27 
28 #include "Prerequisites.h"
29 
30 #include "Enums.h"
31 #include "Image.h"
32 
35 
38 
39 namespace Hydrax
40 {
41  class Hydrax;
42 
46  {
47  public:
51  {
52  // Normal map
54  };
55 
60 
64 
68  void create(const Size &Size);
69 
72  void remove();
73 
82  inline bool update(const TexturesID &Id, Image &Image)
83  {
84  if (Id == TEX_NORMAL_ID)
85  {
86  return _updateNormalMap(Image);
87  }
88 
89  return false;
90  }
91 
96  inline Ogre::TexturePtr& getTexture(const TexturesID &Id)
97  {
98  return mTextures[static_cast<int>(Id)];
99  }
100 
105  inline const Ogre::String& getTextureName(const TexturesID &Id) const
106  {
107  return mTextureNames[static_cast<int>(Id)];
108  }
109 
110  private:
117  bool _createTexture(Ogre::TexturePtr &Texture, const Ogre::String &Name, const Size &Size);
118 
123  Ogre::TexturePtr _getTexture(const Ogre::String &Name);
124 
131 
133  Ogre::TexturePtr mTextures[1];
135  Ogre::String mTextureNames[1];
136 
138  bool mCreated;
139 
142  };
143 }
144 
147 
148 #endif
Hydrax::TextureManager::mHydrax
Hydrax * mHydrax
Hydrax main pointer.
Definition: TextureManager.h:141
Hydrax::TextureManager::mTextures
Ogre::TexturePtr mTextures[1]
Our Ogre::TexturePtr array.
Definition: TextureManager.h:133
Hydrax::TextureManager::TexturesID
TexturesID
Textures enumeration.
Definition: TextureManager.h:50
Hydrax::TextureManager
Class for manager Normal maps.
Definition: TextureManager.h:45
Hydrax::TextureManager::create
void create(const Size &Size)
Create height and normal map textures.
Definition: TextureManager.cpp:48
Hydrax
Definition: CfgFileManager.cpp:28
Hydrax::TextureManager::TEX_NORMAL_ID
@ TEX_NORMAL_ID
Definition: TextureManager.h:53
Hydrax::Size
Struct wich contains an especific width and height value.
Definition: Help.h:40
Enums.h
Hydrax::TextureManager::~TextureManager
~TextureManager()
Destructor.
Definition: TextureManager.cpp:43
Image.h
Hydrax::TextureManager::getTexture
Ogre::TexturePtr & getTexture(const TexturesID &Id)
Get texture.
Definition: TextureManager.h:96
Hydrax::TextureManager::TextureManager
TextureManager(Hydrax *h)
Constructor.
Definition: TextureManager.cpp:31
Hydrax::TextureManager::remove
void remove()
Remove textures.
Definition: TextureManager.cpp:62
Hydrax::TextureManager::mTextureNames
Ogre::String mTextureNames[1]
Our Ogre::String array for store texture's names.
Definition: TextureManager.h:135
Hydrax::TextureManager::_getTexture
Ogre::TexturePtr _getTexture(const Ogre::String &Name)
Get an Ogre::TexturePtr.
Hydrax::TextureManager::mCreated
bool mCreated
Have been created already called?
Definition: TextureManager.h:138
Hydrax::TextureManager::_updateNormalMap
bool _updateNormalMap(Image &Image)
Update normal map.
Definition: TextureManager.cpp:78
Hydrax::TextureManager::update
bool update(const TexturesID &Id, Image &Image)
Update.
Definition: TextureManager.h:82
Prerequisites.h
Hydrax::Image
Class for store variable channels of an image.
Definition: Image.h:42
Hydrax::TextureManager::_createTexture
bool _createTexture(Ogre::TexturePtr &Texture, const Ogre::String &Name, const Size &Size)
Create an Ogre::Texture.
Definition: TextureManager.cpp:131
Hydrax::TextureManager::getTextureName
const Ogre::String & getTextureName(const TexturesID &Id) const
Get texture's name.
Definition: TextureManager.h:105