Rigs of Rods 2023.09
Soft-body Physics Simulation
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Loading...
Searching...
No Matches
RadialGrid.h
Go to the documentation of this file.
1/*
2--------------------------------------------------------------------------------
3This source file is part of Hydrax.
4Visit ---
5
6Copyright (C) 2008 Xavier Vergu�n Gonz�lez <xavierverguin@hotmail.com>
7 <xavyiy@gmail.com>
8
9This program is free software; you can redistribute it and/or modify it under
10the terms of the GNU Lesser General Public License as published by the Free Software
11Foundation; either version 2 of the License, or (at your option) any later
12version.
13
14This program is distributed in the hope that it will be useful, but WITHOUT
15ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
17
18You should have received a copy of the GNU Lesser General Public License along with
19this program; if not, write to the Free Software Foundation, Inc., 59 Temple
20Place - Suite 330, Boston, MA 02111-1307, USA, or go to
21http://www.gnu.org/copyleft/lesser.txt.
22--------------------------------------------------------------------------------
23*/
24
25#ifndef _Hydrax_Modules_RadialGrid_H_
26#define _Hydrax_Modules_RadialGrid_H_
27
28
29
30#include "Hydrax.h"
31#include "Mesh.h"
32#include "Module.h"
33
36
39
40namespace Hydrax{ namespace Module
41{
44 class RadialGrid : public Module
45 {
46 public:
49 struct Options
50 {
52 int Steps;
56 float Radius;
58 bool Smooth;
70 float Strength;
71
75 : Steps(250)
76 , Circles(250)
77 , Radius(100)
78 , Smooth(false)
79 , ChoppyWaves(true)
80 , ChoppyStrength(3.5f)
81 , StepSizeCube(0.00001f)
82 , StepSizeFive(0.0f)
83 , StepSizeLin(0.1f)
84 , Strength(32.5f)
85 {
86 }
87
93 Options(const int &_Steps,
94 const int &_Circles,
95 const float &_Radius)
96 : Steps(_Steps)
97 , Circles(_Circles)
98 , Radius(_Radius)
99 , Smooth(false)
100 , ChoppyWaves(true)
101 , ChoppyStrength(3.5f)
102 , StepSizeCube(0.00001f)
103 , StepSizeFive(0.0f)
104 , StepSizeLin(0.1f)
105 , Strength(32.5f)
106 {
107 }
108
121 Options(const int &_Steps,
122 const int &_Circles,
123 const float &_Radius,
124 const bool &_Smooth,
125 const bool &_ChoppyWaves,
126 const float &_ChoppyStrength,
127 const float &_StepSizeCube,
128 const float &_StepSizeFive,
129 const float &_StepSizeLin,
130 const float &_Strength)
131 : Steps(_Steps)
132 , Circles(_Circles)
133 , Radius(_Radius)
134 , Smooth(_Smooth)
135 , ChoppyWaves(_ChoppyWaves)
136 , ChoppyStrength(_ChoppyStrength)
137 , StepSizeCube(_StepSizeCube)
138 , StepSizeFive(_StepSizeFive)
139 , StepSizeLin(_StepSizeLin)
140 , Strength(_Strength)
141 {
142 }
143 };
144
151
158 RadialGrid(Hydrax *h, Noise::Noise *n, const MaterialManager::NormalMode& NormalMode, const Options &Options);
159
162 ~RadialGrid();
163
166 void create();
167
170 void remove();
171
175 void update(const Ogre::Real &timeSinceLastFrame);
176
180 void setOptions(const Options &Options);
181
185 void saveCfg(Ogre::String &Data);
186
190 bool loadCfg(Ogre::ConfigFile &CfgFile);
191
196 float getHeigth(const Ogre::Vector2 &Position);
197
201 inline const Options& getOptions() const
202 {
203 return mOptions;
204 }
205
210 const bool _createGeometry(Mesh *mMesh) const;
211
212 private:
215 void _calculeNormals();
216
219 void _performChoppyWaves();
220
223
226
229
232 };
233}}
234
237
238#endif
NormalMode
Normal generation mode.
Class wich contains all funtions/variables related to Hydrax water mesh.
Definition Mesh.h:47
Base module class, Override it for create different ways of create water noise.
Definition Module.h:47
Hydrax radial grid module.
Definition RadialGrid.h:45
float getHeigth(const Ogre::Vector2 &Position)
Get the current heigth at a especified world-space point.
void saveCfg(Ogre::String &Data)
Save config.
bool loadCfg(Ogre::ConfigFile &CfgFile)
Load config.
void * mVertices
Vertex pointer (Mesh::POS_NORM_VERTEX or Mesh::POS_VERTEX)
Definition RadialGrid.h:222
Mesh::POS_NORM_VERTEX * mVerticesChoppyBuffer
Use it to store vertex positions when choppy displacement is enabled.
Definition RadialGrid.h:225
void _calculeNormals()
Calcule current normals.
void _performChoppyWaves()
Perform choppy waves.
const Options & getOptions() const
Get current options.
Definition RadialGrid.h:201
Hydrax * mHydrax
Our Hydrax pointer.
Definition RadialGrid.h:231
const bool _createGeometry(Mesh *mMesh) const
Create geometry in module(If special geometry is needed)
void setOptions(const Options &Options)
Set options.
void update(const Ogre::Real &timeSinceLastFrame)
Call it each frame.
Options mOptions
Our projected grid options.
Definition RadialGrid.h:228
Base noise class, Override it for create different ways of create water noise.
Definition Noise.h:43
Vertex struct for position and normals data.
Definition Mesh.h:61
Struct wich contains Hydrax simple grid module options.
Definition RadialGrid.h:50
float Radius
Radius (In world units)
Definition RadialGrid.h:56
Options(const int &_Steps, const int &_Circles, const float &_Radius)
Constructor.
Definition RadialGrid.h:93
float ChoppyStrength
Choppy waves strength.
Definition RadialGrid.h:62
float StepSizeFive
Step size five.
Definition RadialGrid.h:66
int Circles
Number of circles.
Definition RadialGrid.h:54
int Steps
Number of steps (Per circle)
Definition RadialGrid.h:52
Options()
Default constructor.
Definition RadialGrid.h:74
float Strength
Water strength.
Definition RadialGrid.h:70
Options(const int &_Steps, const int &_Circles, const float &_Radius, const bool &_Smooth, const bool &_ChoppyWaves, const float &_ChoppyStrength, const float &_StepSizeCube, const float &_StepSizeFive, const float &_StepSizeLin, const float &_Strength)
Constructor.
Definition RadialGrid.h:121
float StepSizeCube
Step cube size.
Definition RadialGrid.h:64
float StepSizeLin
Step lin size.
Definition RadialGrid.h:68