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
PressurePoint.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 PRESSUREPOINT_H_INCLUDED
25#define PRESSUREPOINT_H_INCLUDED
26
27// ----------------------------------------------------------------------------
28// Include standar libraries
29// ----------------------------------------------------------------------------
30#include <math.h>
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#ifndef _HydraxDensity_
48 #define _HydraxDensity_ 1025
49#endif
50#ifndef _HydraxGravity_
51 #define _HydraxGravity_ 9.81
52#endif
53
56
59
60namespace Hydrax{ namespace Noise
61{
62
70{
71public:
84 PressurePoint(Ogre::Vector2 Orig, float p, float T, float L);
85
89
95 bool update(const Ogre::Real &timeSinceLastFrame);
96
103 float getValue(const float &x, const float &y);
104
108 inline Ogre::Vector2 getOrigin() const{return mPos;}
112 inline float GetTyrePressure() const{return mP;}
116 inline float getMaximumTime() const{return mT;}
120 inline float getTime() const{return mTime;}
124 inline float getLength() const{return mL;}
125
126protected:
127
128
129private:
131 double mTime;
132
134 Ogre::Vector2 mPos;
136 float mP;
138 float mT;
140 float mL;
142 float mA;
144 float mK;
146 float mC;
148 float mW;
150 float mK1;
152 float mK2;
153
154};
155
156}} // Namespace
157
160
161#endif // PRESSUREPOINT_H_INCLUDED
A PressurePoint defined by the origen, pressure pulse, Maximum time of perturbation and wave longitud...
Ogre::Vector2 getOrigin() const
Returns origin of the PressurePoint.
float GetTyrePressure() const
Returns pressure pulse.
float mK1
Time decay term.
bool update(const Ogre::Real &timeSinceLastFrame)
Call it each frame.
double mTime
Elapsed time.
float mK2
Distance decay term.
Ogre::Vector2 mPos
Direction (must be normalised)
float getValue(const float &x, const float &y)
Get the especified x/y noise value.
float getTime() const
Returns time ellapsed.
float mC
Speed (calculated)
float mK
Dispersion factor.
float getMaximumTime() const
Returns maximum time.
float getLength() const
Returns wave length.