All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
GPUManager.h
Go to the documentation of this file.
1 /*
2 --------------------------------------------------------------------------------
3 This source file is part of SkyX.
4 Visit http://www.paradise-studios.net/products/skyx/
5 
6 Copyright (C) 2009-2012 Xavier Verguín González <xavyiy@gmail.com>
7 
8 This program is free software; you can redistribute it and/or modify it under
9 the terms of the GNU Lesser General Public License as published by the Free Software
10 Foundation; either version 2 of the License, or (at your option) any later
11 version.
12 
13 This program is distributed in the hope that it will be useful, but WITHOUT
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
16 
17 You should have received a copy of the GNU Lesser General Public License along with
18 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
19 Place - Suite 330, Boston, MA 02111-1307, USA, or go to
20 http://www.gnu.org/copyleft/lesser.txt.
21 --------------------------------------------------------------------------------
22 */
23 
24 #ifndef _SkyX_GPUManager_H_
25 #define _SkyX_GPUManager_H_
26 
27 #include <vector>
28 
29 #include "Prerequisites.h"
30 
31 namespace SkyX
32 {
33  class SkyX;
34 
35  class DllExport GPUManager
36  {
37  public:
40  enum GpuProgram
41  {
42  // Vertex program
43  GPUP_VERTEX = 0,
44  // Fragment program
45  GPUP_FRAGMENT = 1
46  };
47 
51  GPUManager(SkyX *s);
52 
55  ~GPUManager();
56 
63  void addGroundPass(Ogre::Pass* GroundPass,
64  const Ogre::Real& AtmosphereRadius,
65  const Ogre::SceneBlendType& SBT = Ogre::SBT_ADD);
66 
73  void setGpuProgramParameter(const GpuProgram &GpuP,
74  const Ogre::String &Name, const int &Value,
75  const bool& UpdateGroundPasses = true);
76 
83  void setGpuProgramParameter(const GpuProgram &GpuP,
84  const Ogre::String &Name, const Ogre::Real &Value,
85  const bool& UpdateGroundPasses = true);
86 
93  void setGpuProgramParameter(const GpuProgram &GpuP,
94  const Ogre::String &Name, const Ogre::Vector2 &Value,
95  const bool& UpdateGroundPasses = true);
96 
103  void setGpuProgramParameter(const GpuProgram &GpuP,
104  const Ogre::String &Name, const Ogre::Vector3 &Value,
105  const bool& UpdateGroundPasses = true);
106 
110  const Ogre::String getSkydomeMaterialName() const;
111 
115  inline const Ogre::String getMoonMaterialName() const
116  {
117  return "SkyX_Moon";
118  }
119 
123  void _updateFP();
124 
128  inline void _notifySkydomeMaterialChanged()
129  {
130  mSkydomeMaterial = static_cast<Ogre::MaterialPtr>(
131  Ogre::MaterialManager::getSingleton().getByName(
132  getSkydomeMaterialName()));
133 
134  if (mSkydomeMaterial.isNull())
135  {
136  SkyXLOG("Error in SkyX::GPUManager: '" +
137  getSkydomeMaterialName() + "' material not found");
138  return;
139  }
140  }
141 
142  private:
144  SkyX *mSkyX;
145 
147  std::vector<Ogre::Pass*> mGroundPasses;
148 
153  void _setTextureHWGammaCorrection(const Ogre::String& n, const bool& g);
154 
156  Ogre::MaterialPtr mSkydomeMaterial;
157  };
158 }
159 
160 #endif
SkyX(Ogre::SceneManager *sm, Controller *c)
Contructor.
#define SkyXLOG(msg)
Log macro.
Definition: Prerequisites.h:56
#define DllExport
Include external headers.
Definition: Prerequisites.h:45