RigsofRods
Soft-body Physics Simulation
Noise.cpp
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 #include "Noise.h"
26 #include "Application.h"
27 
28 namespace Hydrax{namespace Noise
29 {
30  Noise::Noise(const Ogre::String &Name, const bool& GPUNormalMapSupported)
31  : mName(Name)
32  , mCreated(false)
33  , mGPUNormalMapSupported(GPUNormalMapSupported)
34  , mGPUNormalMapResourcesCreated(false)
35  {
36  }
37 
38  Noise::~Noise()
39  {
40  }
41 
42  void Noise::create()
43  {
44  mCreated = true;
45  }
46 
47  void Noise::remove()
48  {
49  mCreated = false;
50  }
51 
52  bool Noise::createGPUNormalMapResources(GPUNormalMapManager *g)
53  {
55  {
57  {
59  }
60 
62 
63  g->remove();
64 
65  return true;
66  }
67 
68  return false;
69  }
70 
71  void Noise::removeGPUNormalMapResources(GPUNormalMapManager *g)
72  {
74  {
76 
77  g->remove();
78  }
79  }
80 
81  void Noise::saveCfg(Ogre::String &Data)
82  {
83  Data += "#Noise options\n";
84  Data += "Noise="+mName+"\n\n";
85  }
86 
87  bool Noise::loadCfg(Ogre::ConfigFile &CfgFile)
88  {
89  if (CfgFile.getSetting("Noise") == mName)
90  {
91  HydraxLOG(mName + " options entry found.");
92  return true;
93  }
94 
95  HydraxLOG("Error (Noise::loadCfg):\t" + mName + " options entry can not be found.");
96  return false;
97  }
98 }}
Hydrax
Definition: CfgFileManager.cpp:28
Hydrax::Noise::Noise::removeGPUNormalMapResources
virtual void removeGPUNormalMapResources(GPUNormalMapManager *g)
Remove GPUNormalMap resources.
Definition: Noise.cpp:71
Hydrax::GPUNormalMapManager
Class to manager GPU normal maps.
Definition: GPUNormalMapManager.h:45
Noise.h
Hydrax::Noise::Noise
Base noise class, Override it for create different ways of create water noise.
Definition: Noise.h:42
Hydrax::Noise::Noise::mGPUNormalMapResourcesCreated
bool mGPUNormalMapResourcesCreated
Are GPU normal map resources created?
Definition: Noise.h:137
HydraxLOG
#define HydraxLOG(msg)
Definition: Application.h:59
Application.h
Central state/object manager and communications hub.
Hydrax::GPUNormalMapManager::remove
void remove()
Remove.
Definition: GPUNormalMapManager.cpp:61
Hydrax::Noise::Noise::mGPUNormalMapSupported
bool mGPUNormalMapSupported
Is GPU normal map generation supported?
Definition: Noise.h:135
Hydrax::Noise::Noise::mCreated
bool mCreated
Has create() been already called?
Definition: Noise.h:132
Hydrax::Noise::Noise::mName
Ogre::String mName
Module name.
Definition: Noise.h:130