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
DecalsManager.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_DecalsManager_H_
26#define _Hydrax_DecalsManager_H_
27
28#include "Prerequisites.h"
29
32
35
36namespace Hydrax
37{
38 class Hydrax;
39
42 class Decal
43 {
44 public:
50 Decal(Hydrax *h, const Ogre::String &TextureName, const int& Id);
51
54 ~Decal();
55
59 void registerPass(Ogre::Pass* _Pass);
60
63 void unregister();
64
68 inline const Ogre::String& getTextureName() const
69 {
70 return mTextureName;
71 }
72
76 inline const int& getId() const
77 {
78 return mId;
79 }
80
84 inline Ogre::Frustum* getProjector()
85 {
86 return mProjector;
87 }
88
92 inline Ogre::SceneNode* getSceneNode()
93 {
94 return mSceneNode;
95 }
96
101 inline Ogre::Pass *getRegisteredPass()
102 {
103 return mRegisteredPass;
104 }
105
109 inline const Ogre::Vector2& getPosition() const
110 {
111 return mPosition;
112 }
113
117 inline const Ogre::Vector2& getSize() const
118 {
119 return mSize;
120 }
121
125 inline const Ogre::Radian& getOrientation() const
126 {
127 return mOrientation;
128 }
129
133 inline const Ogre::Real& getTransparency() const
134 {
135 return mTransparency;
136 }
137
141 inline const bool& isVisible() const
142 {
143 return mVisible;
144 }
145
149 void setPosition(const Ogre::Vector2& Position);
150
154 void setSize(const Ogre::Vector2& Size);
155
159 void setOrientation(const Ogre::Radian& Orientation);
160
165 void setTransparency(const Ogre::Real& Transparency);
166
170 void setVisible(const bool& Visible);
171
172 private:
174 Ogre::String mTextureName;
176 int mId;
178 Ogre::Frustum *mProjector;
180 Ogre::SceneNode *mSceneNode;
182 Ogre::Pass *mRegisteredPass;
183
185 Ogre::Vector2 mPosition;
187 Ogre::Vector2 mSize;
189 Ogre::Radian mOrientation;
191 Ogre::Real mTransparency;
194
197 };
198
203 {
204 public:
209
213
217 void update();
218
223 Decal* add(const Ogre::String& TextureName);
224
229 Decal* get(const int& Id);
230
234 void remove(const int& Id);
235
238 void removeAll();
239
243 void registerAll();
244
248 inline std::vector<Decal*> getDecals()
249 {
250 return mDecals;
251 }
252
256 inline const Ogre::Real _getWaterStrength() const
257 {
258 return mWaterStrength;
259 }
260
264 inline void _setWaterStrength(const Ogre::Real &WaterStrength)
265 {
266 mWaterStrength = WaterStrength;
267 }
268
271 inline void _forceToUpdate()
272 {
273 mForceToUpdate = true;
274 }
275
276 private:
278 std::vector<Decal*> mDecals;
280 std::vector<Decal*>::iterator DecalIt;
283
285 Ogre::Real mWaterStrength;
286
288 Ogre::Vector3 mLastPosition;
289 Ogre::Quaternion mLastOrientation;
292
295 };
296};
297
300
301#endif
Decal class.
const int & getId() const
Get the decal Id.
Ogre::Frustum * mProjector
Decal projector.
const Ogre::Vector2 & getSize() const
Get decal size.
Ogre::Pass * getRegisteredPass()
Get the pass the decal is in.
Ogre::Real mTransparency
Transparency.
int mId
Decal Id.
bool mVisible
Is decal visible?
Ogre::Vector2 mPosition
Position.
const bool & isVisible() const
Is decal visile?
Ogre::SceneNode * getSceneNode()
Get the decal scene node.
void setPosition(const Ogre::Vector2 &Position)
Set decal position.
void setVisible(const bool &Visible)
Set decal visibile or not.
void setOrientation(const Ogre::Radian &Orientation)
Set decal orientation.
Ogre::Pass * mRegisteredPass
Registered pass.
const Ogre::Vector2 & getPosition() const
Get decal position.
const Ogre::String & getTextureName() const
Get decal texture name.
Ogre::Radian mOrientation
Orientation.
void registerPass(Ogre::Pass *_Pass)
Register the decal int the specified pass.
const Ogre::Radian & getOrientation() const
Get decal orientation.
Hydrax * mHydrax
Hydrax parent pointer.
Ogre::String mTextureName
Decal texture name.
void unregister()
Unregister from current technique.
~Decal()
Destructor.
Ogre::SceneNode * mSceneNode
Decal scene node.
void setTransparency(const Ogre::Real &Transparency)
Set decal transparency.
Ogre::Frustum * getProjector()
Get the decal projector.
Ogre::Vector2 mSize
Size.
void setSize(const Ogre::Vector2 &Size)
Set decal size.
const Ogre::Real & getTransparency() const
Get decal transparency.
Decals manager class.
std::vector< Decal * > getDecals()
Get decals std::vector.
void remove(const int &Id)
Remove decal.
Ogre::Real mWaterStrength
Water strength (For decals culling)
Ogre::Quaternion mLastOrientation
void update()
Update decal manager.
Ogre::Vector3 mLastPosition
Last camera position, orientation, underwater.
Decal * get(const int &Id)
Get decal.
Decal * add(const Ogre::String &TextureName)
Add decal.
void _setWaterStrength(const Ogre::Real &WaterStrength)
Set water strength (used for decals culling)
Hydrax * mHydrax
Hydrax parent pointer.
const Ogre::Real _getWaterStrength() const
Get water strength (used for decals culling)
void removeAll()
Remove all decals.
void registerAll()
Register all decals.
void _forceToUpdate()
Call to force to update decals.
std::vector< Decal * > mDecals
Decals std::vector.
std::vector< Decal * >::iterator DecalIt
Decal iterator.
Struct wich contains an especific width and height value.
Definition Help.h:41