RigsofRods
Soft-body Physics Simulation
Buoyance.h
Go to the documentation of this file.
1 /*
2  This source file is part of Rigs of Rods
3  Copyright 2005-2012 Pierre-Michel Ricordel
4  Copyright 2007-2012 Thomas Fischer
5 
6  For more information, see http://www.rigsofrods.org/
7 
8  Rigs of Rods is free software: you can redistribute it and/or modify
9  it under the terms of the GNU General Public License version 3, as
10  published by the Free Software Foundation.
11 
12  Rigs of Rods is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with Rigs of Rods. If not, see <http://www.gnu.org/licenses/>.
19 */
20 
21 #pragma once
22 
23 #include "Application.h"
24 
25 namespace RoR {
26 
29 
30 class Buoyance
31 {
32 public:
33 
34  Buoyance(DustPool* splash, DustPool* ripple);
35  ~Buoyance();
36 
37  void computeNodeForce(node_t *a, node_t *b, node_t *c, bool doUpdate, int type);
38 
40 
41  bool sink;
42 
43 private:
44 
45  //compute tetrahedron volume
46  inline float computeVolume(Ogre::Vector3 o, Ogre::Vector3 a, Ogre::Vector3 b, Ogre::Vector3 c);
47 
48  //compute pressure and drag force on a submerged triangle
49  Ogre::Vector3 computePressureForceSub(Ogre::Vector3 a, Ogre::Vector3 b, Ogre::Vector3 c, Ogre::Vector3 vel, int type);
50 
51  //compute pressure and drag forces on a random triangle
52  Ogre::Vector3 computePressureForce(Ogre::Vector3 a, Ogre::Vector3 b, Ogre::Vector3 c, Ogre::Vector3 vel, int type);
53 
55  bool update;
56 };
57 
59 
60 } // namespace RoRs
61 
RoR::Buoyance::computeNodeForce
void computeNodeForce(node_t *a, node_t *b, node_t *c, bool doUpdate, int type)
Definition: Buoyance.cpp:180
RoR::DustPool
Definition: DustPool.h:33
RoR::Buoyance::BUOY_DRAGLESS
@ BUOY_DRAGLESS
Definition: Buoyance.h:39
RoR::Buoyance::BUOY_NORMAL
@ BUOY_NORMAL
Definition: Buoyance.h:39
RoR::Buoyance::BUOY_DRAGONLY
@ BUOY_DRAGONLY
Definition: Buoyance.h:39
RoR::Buoyance::computeVolume
float computeVolume(Ogre::Vector3 o, Ogre::Vector3 a, Ogre::Vector3 b, Ogre::Vector3 c)
Definition: Buoyance.cpp:48
RoR::Buoyance
Definition: Buoyance.h:30
RoR::Buoyance::Buoyance
Buoyance(DustPool *splash, DustPool *ripple)
Definition: Buoyance.cpp:35
RoR::Buoyance::computePressureForce
Ogre::Vector3 computePressureForce(Ogre::Vector3 a, Ogre::Vector3 b, Ogre::Vector3 c, Ogre::Vector3 vel, int type)
Definition: Buoyance.cpp:126
RoR::Buoyance::computePressureForceSub
Ogre::Vector3 computePressureForceSub(Ogre::Vector3 a, Ogre::Vector3 b, Ogre::Vector3 c, Ogre::Vector3 vel, int type)
Definition: Buoyance.cpp:54
Application.h
Central state/object manager and communications hub.
RoR::node_t
Physics: A vertex in the softbody structure.
Definition: SimData.h:285
RoR::Buoyance::update
bool update
Definition: Buoyance.h:55
RoR::Buoyance::ripplep
DustPool * ripplep
Definition: Buoyance.h:54
RoR::Buoyance::splashp
DustPool * splashp
Definition: Buoyance.h:54
RoR::Buoyance::~Buoyance
~Buoyance()
Definition: Buoyance.cpp:43
RoR
Definition: AppContext.h:36
RoR::Buoyance::sink
bool sink
Definition: Buoyance.h:41