Rigs of Rods 2023.09
Soft-body Physics Simulation
Loading...
Searching...
No Matches
Real.h
Go to the documentation of this file.
1/*
2--------------------------------------------------------------------------------
3This source file is part of Hydrax.
4Visit http://www.ogre3d.org/tikiwiki/Hydrax
5
6Copyright (C) 2011 Jose Luis Cercós Pita <jlcercos@gmail.com>
7
8This program is free software; you can redistribute it and/or modify it under
9the terms of the GNU Lesser General Public License as published by the Free Software
10Foundation; either version 2 of the License, or (at your option) any later
11version.
12
13This program is distributed in the hope that it will be useful, but WITHOUT
14ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
16
17You should have received a copy of the GNU Lesser General Public License along with
18this program; if not, write to the Free Software Foundation, Inc., 59 Temple
19Place - Suite 330, Boston, MA 02111-1307, USA, or go to
20http://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
59namespace Hydrax{ namespace Noise
60{
61
68class Real : public Noise
69{
70public:
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
168protected:
169
170
171private:
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
Class to manager GPU normal maps.
Base noise class, Override it for create different ways of create water noise.
Definition Noise.h:43
Perlin noise module class.
Definition Perlin.h:74
This class is a sea elevation module that combines several effects: Waves, defined by direction,...
Definition Real.h:69
GPUNormalMapManager * mGPUNormalMapManager
GPUNormalMapManager pointer.
Definition Real.h:179
Perlin * getPerlinNoise() const
Get current Real noise options.
Definition Real.h:166
void remove()
Remove.
Definition Real.cpp:66
void update(const Ogre::Real &timeSinceLastFrame)
Call it each frame.
Definition Real.cpp:163
int addWave(Ogre::Vector2 dir, float A, float T, float p=0.f)
Adds a wave to the system.
Definition Real.cpp:86
double mTime
Elapsed time.
Definition Real.h:173
bool eraseWave(int id)
Removes a wave from the system.
Definition Real.cpp:103
~Real()
Destructor.
Definition Real.cpp:47
void saveCfg(Ogre::String &Data)
Save config.
Definition Real.cpp:137
bool createGPUNormalMapResources(GPUNormalMapManager *g)
Create GPUNormalMap resources.
Definition Real.cpp:131
std::vector< PressurePoint > mPressurePoints
Vector of pressure points.
Definition Real.h:185
std::vector< Wave > mWaves
Vector of waves.
Definition Real.h:182
Perlin * mPerlinNoise
Perlin noise.
Definition Real.h:176
float getValue(const float &x, const float &y)
Get the especified x/y noise value.
Definition Real.cpp:178
void create()
Create.
Definition Real.cpp:55
int addPressurePoint(Ogre::Vector2 Orig, float p, float T, float L)
Adds a pressure point to the system.
Definition Real.cpp:92
Real()
Default constructor.
Definition Real.cpp:38
Wave getWave(int id) const
Returns a wave to the system.
Definition Real.cpp:98
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
bool loadCfg(Ogre::ConfigFile &CfgFile)
Load config.
Definition Real.cpp:142
A wave defined by the direction, amplitude, period, and optionally phase.
Definition Wave.h:60