RigsofRods
Soft-body Physics Simulation
DustPool.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 #include <mutex>
26 #include <Ogre.h>
27 
28 namespace RoR {
29 
32 
33 class DustPool
34 {
35 public:
36 
37  DustPool(Ogre::SceneManager* sm, const char* dname, int dsize);
38  ~DustPool();
39 
40  void Discard(Ogre::SceneManager* sm);
41 
42  void setVisible(bool s);
43  //Dust
44  void malloc(Ogre::Vector3 pos, Ogre::Vector3 vel, Ogre::ColourValue col = Ogre::ColourValue(0.83, 0.71, 0.64, 1.0));
45  //clumps
46  void allocClump(Ogre::Vector3 pos, Ogre::Vector3 vel, Ogre::ColourValue col = Ogre::ColourValue(0.83, 0.71, 0.64, 1.0));
47  //Rubber smoke
48  void allocSmoke(Ogre::Vector3 pos, Ogre::Vector3 vel);
49  //
50  void allocSparks(Ogre::Vector3 pos, Ogre::Vector3 vel);
51  //Water vapour
52  void allocVapour(Ogre::Vector3 pos, Ogre::Vector3 vel, float time);
53 
54  void allocDrip(Ogre::Vector3 pos, Ogre::Vector3 vel, float time);
55 
56  void allocSplash(Ogre::Vector3 pos, Ogre::Vector3 vel);
57 
58  void allocRipple(Ogre::Vector3 pos, Ogre::Vector3 vel);
59 
60  void update();
61 
62 protected:
63 
64  static const int MAX_DUSTS = 100;
65 
66  enum DustTypes
67  {
76  };
77 
78  Ogre::ColourValue colours[MAX_DUSTS];
79  Ogre::ParticleSystem* pss[MAX_DUSTS];
80  Ogre::SceneNode* sns[MAX_DUSTS];
81  Ogre::SceneNode* parent_snode;
82  Ogre::Vector3 positions[MAX_DUSTS];
83  Ogre::Vector3 velocities[MAX_DUSTS];
84  float rates[MAX_DUSTS];
85  int allocated;
86  int size;
89 };
90 
92 
93 } // namespace RoRs
RoR::DustPool::allocSmoke
void allocSmoke(Ogre::Vector3 pos, Ogre::Vector3 vel)
Definition: DustPool.cpp:122
RoR::DustPool::allocSparks
void allocSparks(Ogre::Vector3 pos, Ogre::Vector3 vel)
Definition: DustPool.cpp:134
RoR::DustPool::DUST_CLUMP
@ DUST_CLUMP
Definition: DustPool.h:75
RoR::DustPool::size
int size
Definition: DustPool.h:86
RoR::DustPool::DustTypes
DustTypes
Definition: DustPool.h:66
RoR::DustPool
Definition: DustPool.h:33
RoR::DustPool::colours
Ogre::ColourValue colours[MAX_DUSTS]
Definition: DustPool.h:78
RoR::DustPool::DUST_RUBBER
@ DUST_RUBBER
Definition: DustPool.h:69
RoR::DustPool::update
void update()
Definition: DustPool.cpp:194
RoR::DustPool::DustPool
DustPool(Ogre::SceneManager *sm, const char *dname, int dsize)
Definition: DustPool.cpp:38
RoR::DustPool::allocDrip
void allocDrip(Ogre::Vector3 pos, Ogre::Vector3 vel, float time)
Definition: DustPool.cpp:160
RoR::DustPool::positions
Ogre::Vector3 positions[MAX_DUSTS]
Definition: DustPool.h:82
RoR::DustPool::allocClump
void allocClump(Ogre::Vector3 pos, Ogre::Vector3 vel, Ogre::ColourValue col=Ogre::ColourValue(0.83, 0.71, 0.64, 1.0))
Definition: DustPool.cpp:109
RoR::DustPool::DUST_RIPPLE
@ DUST_RIPPLE
Definition: DustPool.h:73
RoR::DustPool::rates
float rates[MAX_DUSTS]
Definition: DustPool.h:84
RoR::DustPool::allocRipple
void allocRipple(Ogre::Vector3 pos, Ogre::Vector3 vel)
Definition: DustPool.cpp:183
RoR::DustPool::pss
Ogre::ParticleSystem * pss[MAX_DUSTS]
Definition: DustPool.h:79
RoR::DustPool::DUST_DRIP
@ DUST_DRIP
Definition: DustPool.h:70
RoR::DustPool::parent_snode
Ogre::SceneNode * parent_snode
Definition: DustPool.h:81
RoR::DustPool::malloc
void malloc(Ogre::Vector3 pos, Ogre::Vector3 vel, Ogre::ColourValue col=Ogre::ColourValue(0.83, 0.71, 0.64, 1.0))
Definition: DustPool.cpp:96
RoR::DustPool::~DustPool
~DustPool()
Definition: DustPool.cpp:64
Application.h
Central state/object manager and communications hub.
RoR::DustPool::DUST_VAPOUR
@ DUST_VAPOUR
Definition: DustPool.h:71
RoR::DustPool::velocities
Ogre::Vector3 velocities[MAX_DUSTS]
Definition: DustPool.h:83
RoR::DustPool::setVisible
void setVisible(bool s)
Definition: DustPool.cpp:87
RoR::DustPool::MAX_DUSTS
static const int MAX_DUSTS
Definition: DustPool.h:64
RoR::DustPool::allocated
int allocated
Definition: DustPool.h:85
RoR::DustPool::allocSplash
void allocSplash(Ogre::Vector3 pos, Ogre::Vector3 vel)
Definition: DustPool.cpp:172
RoR::DustPool::m_is_discarded
bool m_is_discarded
Definition: DustPool.h:88
RoR::DustPool::types
int types[MAX_DUSTS]
Definition: DustPool.h:87
RoR::DustPool::DUST_SPLASH
@ DUST_SPLASH
Definition: DustPool.h:72
RoR::DustPool::allocVapour
void allocVapour(Ogre::Vector3 pos, Ogre::Vector3 vel, float time)
Definition: DustPool.cpp:148
RoR::DustPool::DUST_SPARKS
@ DUST_SPARKS
Definition: DustPool.h:74
RoR::DustPool::DUST_NORMAL
@ DUST_NORMAL
Definition: DustPool.h:68
RoR
Definition: AppContext.h:36
RoR::DustPool::Discard
void Discard(Ogre::SceneManager *sm)
Definition: DustPool.cpp:69
RoR::DustPool::sns
Ogre::SceneNode * sns[MAX_DUSTS]
Definition: DustPool.h:80