RigsofRods
Soft-body Physics Simulation
Real.h
Go to the documentation of this file.
1 /*
2 --------------------------------------------------------------------------------
3 This source file is part of Hydrax.
4 Visit http://www.ogre3d.org/tikiwiki/Hydrax
5 
6 Copyright (C) 2011 Jose Luis Cercós Pita <jlcercos@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 REAL_H_INCLUDED
25 #define REAL_H_INCLUDED
26 
27 // ----------------------------------------------------------------------------
28 // Include standar libraries
29 // ----------------------------------------------------------------------------
30 #include <vector>
31 
32 // ----------------------------------------------------------------------------
33 // Include the hydrax prerequisites
34 // ----------------------------------------------------------------------------
35 #include "Prerequisites.h"
36 
37 // ----------------------------------------------------------------------------
38 // Include the noise module
39 // ----------------------------------------------------------------------------
40 #include "Noise.h"
41 
42 // ----------------------------------------------------------------------------
43 // Include the perlin noise
44 // ----------------------------------------------------------------------------
45 #include "Perlin.h"
46 
47 // ----------------------------------------------------------------------------
48 // Include the components
49 // ----------------------------------------------------------------------------
50 #include "Wave.h"
51 #include "PressurePoint.h"
52 
55 
58 
59 namespace Hydrax{ namespace Noise
60 {
61 
68 class Real : public Noise
69 {
70 public:
73  Real();
74 
77  ~Real();
78 
81  void create();
82 
85  void remove();
86 
94  int addWave(Ogre::Vector2 dir, float A, float T, float p=0.f);
95 
111  int addPressurePoint(Ogre::Vector2 Orig, float p, float T, float L);
112 
117  Wave getWave(int id) const;
118 
123  bool eraseWave(int id);
124 
132  bool modifyWave(int id,Ogre::Vector2 dir, float A, float T, float p=0.f);
133 
139 
143  void update(const Ogre::Real &timeSinceLastFrame);
144 
148  void saveCfg(Ogre::String &Data);
149 
153  bool loadCfg(Ogre::ConfigFile &CfgFile);
154 
161  float getValue(const float &x, const float &y);
162 
166  inline Perlin* getPerlinNoise() const{return mPerlinNoise;}
167 
168 protected:
169 
170 
171 private:
173  double mTime;
174 
177 
180 
182  std::vector<Wave> mWaves;
183 
185  std::vector<PressurePoint> mPressurePoints;
186 };
187 
188 }} // Namespace
189 
192 
193 #endif // REAL_H_INCLUDED
Hydrax::Noise::Real::mGPUNormalMapManager
GPUNormalMapManager * mGPUNormalMapManager
GPUNormalMapManager pointer.
Definition: Real.h:179
Hydrax::Noise::Real::eraseWave
bool eraseWave(int id)
Removes a wave from the system.
Definition: Real.cpp:103
Hydrax::Noise::Real::create
void create()
Create.
Definition: Real.cpp:55
y
float y
Definition: (ValueTypes) quaternion.h:6
Hydrax::Noise::Real::~Real
~Real()
Destructor.
Definition: Real.cpp:47
Hydrax::Noise::Real::getValue
float getValue(const float &x, const float &y)
Get the especified x/y noise value.
Definition: Real.cpp:178
Hydrax::Noise::Real::addWave
int addWave(Ogre::Vector2 dir, float A, float T, float p=0.f)
Adds a wave to the system.
Definition: Real.cpp:86
Hydrax::Noise::Real::mPressurePoints
std::vector< PressurePoint > mPressurePoints
Vector of pressure points.
Definition: Real.h:185
Hydrax
Definition: CfgFileManager.cpp:28
Hydrax::Noise::Real::mTime
double mTime
Elapsed time.
Definition: Real.h:173
Hydrax::Noise::Real::remove
void remove()
Remove.
Definition: Real.cpp:66
PressurePoint.h
Hydrax::Noise::Real::loadCfg
bool loadCfg(Ogre::ConfigFile &CfgFile)
Load config.
Definition: Real.cpp:142
Hydrax::GPUNormalMapManager
Class to manager GPU normal maps.
Definition: GPUNormalMapManager.h:45
Noise.h
Hydrax::Noise::Real::createGPUNormalMapResources
bool createGPUNormalMapResources(GPUNormalMapManager *g)
Create GPUNormalMap resources.
Definition: Real.cpp:131
Perlin.h
Hydrax::Noise::Real::saveCfg
void saveCfg(Ogre::String &Data)
Save config.
Definition: Real.cpp:137
Hydrax::Noise::Noise
Base noise class, Override it for create different ways of create water noise.
Definition: Noise.h:42
Hydrax::Noise::Real::modifyWave
bool modifyWave(int id, Ogre::Vector2 dir, float A, float T, float p=0.f)
Modify a wave from the system.
Definition: Real.cpp:120
Hydrax::Noise::Real::getPerlinNoise
Perlin * getPerlinNoise() const
Get current Real noise options.
Definition: Real.h:166
Hydrax::Noise::Real::addPressurePoint
int addPressurePoint(Ogre::Vector2 Orig, float p, float T, float L)
Adds a pressure point to the system.
Definition: Real.cpp:92
Prerequisites.h
Hydrax::Noise::Wave
A wave defined by the direction, amplitude, period, and optionally phase.
Definition: Wave.h:59
Hydrax::Noise::Real
This class is a sea elevation module that combines several effects: Waves, defined by direction,...
Definition: Real.h:68
Wave.h
Hydrax::Noise::Real::Real
Real()
Default constructor.
Definition: Real.cpp:38
Hydrax::Noise::Real::mPerlinNoise
Perlin * mPerlinNoise
Perlin noise.
Definition: Real.h:176
Hydrax::Noise::Real::update
void update(const Ogre::Real &timeSinceLastFrame)
Call it each frame.
Definition: Real.cpp:163
Hydrax::Noise::Perlin
Perlin noise module class.
Definition: Perlin.h:73
x
float x
Definition: (ValueTypes) quaternion.h:5
Hydrax::Noise::Real::mWaves
std::vector< Wave > mWaves
Vector of waves.
Definition: Real.h:182
Hydrax::Noise::Real::getWave
Wave getWave(int id) const
Returns a wave to the system.
Definition: Real.cpp:98