RigsofRods
Soft-body Physics Simulation
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 "Prerequisites.h"
28 
29 namespace SkyX
30 {
31  class SkyX;
32 
33  class GPUManager
34  {
35  public:
39  {
40  // Vertex program
42  // Fragment program
44  };
45 
49  GPUManager(SkyX *s);
50 
53  ~GPUManager();
54 
60  void addGroundPass(Ogre::Pass* GroundPass, const Ogre::Real& AtmosphereRadius, const Ogre::SceneBlendType& SBT = Ogre::SBT_ADD);
61 
68  void setGpuProgramParameter(const GpuProgram &GpuP, const Ogre::String &Name, const int &Value, const bool& UpdateGroundPasses = true);
69 
76  void setGpuProgramParameter(const GpuProgram &GpuP, const Ogre::String &Name, const Ogre::Real &Value, const bool& UpdateGroundPasses = true);
77 
84  void setGpuProgramParameter(const GpuProgram &GpuP, const Ogre::String &Name, const Ogre::Vector2 &Value, const bool& UpdateGroundPasses = true);
85 
92  void setGpuProgramParameter(const GpuProgram &GpuP, const Ogre::String &Name, const Ogre::Vector3 &Value, const bool& UpdateGroundPasses = true);
93 
97  const Ogre::String getSkydomeMaterialName() const;
98 
102  inline const Ogre::String getMoonMaterialName() const
103  {
104  return "SkyX_Moon";
105  }
106 
110  void _updateFP();
111 
116  {
117  mSkydomeMaterial = static_cast<Ogre::MaterialPtr>(Ogre::MaterialManager::getSingleton().getByName(getSkydomeMaterialName()));
118 
119  if (mSkydomeMaterial.isNull())
120  {
121  SkyXLOG("Error in SkyX::GPUManager: '" + getSkydomeMaterialName() + "' material not found");
122  return;
123  }
124  }
125 
126  private:
131  void _setTextureHWGammaCorrection(const Ogre::String& n, const bool& g);
132 
134  Ogre::MaterialPtr mSkydomeMaterial;
136  std::vector<Ogre::Pass*> mGroundPasses;
137 
140  };
141 }
142 
143 #endif
SkyX::GPUManager::~GPUManager
~GPUManager()
Destructor.
Definition: GPUManager.cpp:37
Prerequisites.h
SkyX::GPUManager::getSkydomeMaterialName
const Ogre::String getSkydomeMaterialName() const
Get skydome material name.
Definition: GPUManager.cpp:341
SkyX::GPUManager::GpuProgram
GpuProgram
Gpu program enum.
Definition: GPUManager.h:38
SkyX::GPUManager::mSkydomeMaterial
Ogre::MaterialPtr mSkydomeMaterial
Skydome material.
Definition: GPUManager.h:134
SkyX
Definition: AtmosphereManager.cpp:30
SkyX::GPUManager::_updateFP
void _updateFP()
Update fragment program materials.
Definition: GPUManager.cpp:68
SkyX::GPUManager::_setTextureHWGammaCorrection
void _setTextureHWGammaCorrection(const Ogre::String &n, const bool &g)
Set texture HW gamma correction.
Definition: GPUManager.cpp:348
SkyX::GPUManager::setGpuProgramParameter
void setGpuProgramParameter(const GpuProgram &GpuP, const Ogre::String &Name, const int &Value, const bool &UpdateGroundPasses=true)
Set gpu program int parameter.
Definition: GPUManager.cpp:99
SkyX::GPUManager::mSkyX
SkyX * mSkyX
SkyX parent pointer.
Definition: GPUManager.h:139
SkyX::GPUManager::mGroundPasses
std::vector< Ogre::Pass * > mGroundPasses
Ground pass vector.
Definition: GPUManager.h:136
SkyX::GPUManager::GPUP_VERTEX
@ GPUP_VERTEX
Definition: GPUManager.h:41
SkyX::GPUManager::GPUP_FRAGMENT
@ GPUP_FRAGMENT
Definition: GPUManager.h:43
SkyX::GPUManager::addGroundPass
void addGroundPass(Ogre::Pass *GroundPass, const Ogre::Real &AtmosphereRadius, const Ogre::SceneBlendType &SBT=Ogre::SBT_ADD)
Add ground pass (Use for atmospheric scattering effect on the terrain)
Definition: GPUManager.cpp:41
SkyX::GPUManager::getMoonMaterialName
const Ogre::String getMoonMaterialName() const
Get moon material name.
Definition: GPUManager.h:102
SkyX::GPUManager::_notifySkydomeMaterialChanged
void _notifySkydomeMaterialChanged()
Notify skydome material changed.
Definition: GPUManager.h:115
SkyXLOG
#define SkyXLOG(msg)
Include external headers.
Definition: Prerequisites.h:34
SkyX::GPUManager::GPUManager
GPUManager(SkyX *s)
Constructor.
Definition: GPUManager.cpp:30
SkyX::GPUManager
Definition: GPUManager.h:33