RigsofRods
Soft-body Physics Simulation
Module.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_Module_H_
26 #define _Hydrax_Module_H_
27 
28 #include "Prerequisites.h"
29 #include "Application.h"
30 #include "Noise.h"
31 #include "Mesh.h"
32 #include "MaterialManager.h"
33 #include "GPUNormalMapManager.h"
34 
37 
40 
41 namespace Hydrax{ namespace Module
42 {
46  class Module
47  {
48  public:
55  Module(const Ogre::String &Name,
56  Noise::Noise *n,
57  const Mesh::Options &MeshOptions,
58  const MaterialManager::NormalMode &NormalMode);
59 
62  virtual ~Module();
63 
67  virtual void create();
68 
72  virtual void remove();
73 
79  void setNoise(Noise::Noise* Noise, GPUNormalMapManager* g = 0, const bool& DeleteOldNoise = true);
80 
84  virtual void update(const Ogre::Real &timeSinceLastFrame);
85 
89  virtual void saveCfg(Ogre::String &Data);
90 
94  virtual bool loadCfg(Ogre::ConfigFile &CfgFile);
95 
99  inline const Ogre::String& getName() const
100  {
101  return mName;
102  }
103 
107  inline const bool& isCreated() const
108  {
109  return mCreated;
110  }
111 
117  inline virtual const bool _createGeometry(Mesh *mMesh) const
118  {
119  return false;
120  }
121 
126  {
127  return mNormalMode;
128  }
129 
133  inline const Mesh::Options& getMeshOptions() const
134  {
135  return mMeshOptions;
136  }
137 
142  {
143  return mNoise;
144  }
145 
150  virtual float getHeigth(const Ogre::Vector2 &Position);
151 
152  protected:
154  Ogre::String mName;
162  bool mCreated;
163  };
164 }}
165 
168 
169 #endif
Hydrax::Module::Module::saveCfg
virtual void saveCfg(Ogre::String &Data)
Save config.
Definition: Module.cpp:99
Hydrax::Module::Module::isCreated
const bool & isCreated() const
Is created() called?
Definition: Module.h:107
Hydrax::Module::Module::_createGeometry
virtual const bool _createGeometry(Mesh *mMesh) const
Create geometry in module(If special geometry is needed)
Definition: Module.h:117
Hydrax
Definition: CfgFileManager.cpp:28
MaterialManager.h
Hydrax::Module::Module::~Module
virtual ~Module()
Destructor.
Definition: Module.cpp:41
Hydrax::Mesh::Options
Base Hydrax mesh options.
Definition: Mesh.h:93
Hydrax::GPUNormalMapManager
Class to manager GPU normal maps.
Definition: GPUNormalMapManager.h:45
Noise.h
Hydrax::Module::Module::create
virtual void create()
Create.
Definition: Module.cpp:46
Hydrax::Module::Module::getNoise
Noise::Noise * getNoise()
Get the Hydrax::Noise module pointer.
Definition: Module.h:141
Hydrax::Module::Module::setNoise
void setNoise(Noise::Noise *Noise, GPUNormalMapManager *g=0, const bool &DeleteOldNoise=true)
Set noise.
Definition: Module.cpp:60
Hydrax::Noise::Noise
Base noise class, Override it for create different ways of create water noise.
Definition: Noise.h:42
GPUNormalMapManager.h
Hydrax::Module::Module::getMeshOptions
const Mesh::Options & getMeshOptions() const
Get the mesh options for this module.
Definition: Module.h:133
Hydrax::Module::Module::getHeigth
virtual float getHeigth(const Ogre::Vector2 &Position)
Get the current heigth at a especified world-space point.
Definition: Module.cpp:117
Hydrax::MaterialManager::NormalMode
NormalMode
Normal generation mode.
Definition: MaterialManager.h:100
Application.h
Central state/object manager and communications hub.
Hydrax::Module::Module
Base module class, Override it for create different ways of create water noise.
Definition: Module.h:46
Hydrax::Module::Module::mCreated
bool mCreated
Is create() called?
Definition: Module.h:162
Hydrax::Mesh
Class wich contains all funtions/variables related to Hydrax water mesh.
Definition: Mesh.h:46
Hydrax::Module::Module::update
virtual void update(const Ogre::Real &timeSinceLastFrame)
Call it each frame.
Definition: Module.cpp:94
Hydrax::Module::Module::loadCfg
virtual bool loadCfg(Ogre::ConfigFile &CfgFile)
Load config.
Definition: Module.cpp:105
Prerequisites.h
Hydrax::Module::Module::mNormalMode
MaterialManager::NormalMode mNormalMode
Normal map generation mode.
Definition: Module.h:160
Mesh.h
Hydrax::Module::Module::mName
Ogre::String mName
Module name.
Definition: Module.h:154
Hydrax::Module::Module::getNormalMode
const MaterialManager::NormalMode & getNormalMode() const
Get the normal generation mode.
Definition: Module.h:125
Hydrax::Module::Module::getName
const Ogre::String & getName() const
Get module name.
Definition: Module.h:99
Hydrax::Module::Module::mNoise
Noise::Noise * mNoise
Noise generator pointer.
Definition: Module.h:156
Hydrax::Module::Module::remove
virtual void remove()
Remove.
Definition: Module.cpp:53
Hydrax::Module::Module::mMeshOptions
Mesh::Options mMeshOptions
Module mesh options.
Definition: Module.h:158
Hydrax::Module::Module::Module
Module(const Ogre::String &Name, Noise::Noise *n, const Mesh::Options &MeshOptions, const MaterialManager::NormalMode &NormalMode)
Constructor.
Definition: Module.cpp:29