Added aqua_speed for rite geo 50 tryker
[ryzomcore.git] / nel / tools / 3d / object_viewer / ps_wrapper.h
blobc305fa945bab49caf9cb781d734dc5ef0da1ff52
1 // NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef _PS_WRAPPER_H
20 #define _PS_WRAPPER_H
25 #include "nel/misc/rgba.h"
26 #include "nel/misc/vector.h"
28 #include "nel/3d/ps_attrib_maker.h"
29 #include "nel/3d/texture.h"
31 #include "particle_workspace.h"
34 // wrapper to read/write a value of type T
35 template <class T> class IPSWrapper
37 public:
38 CParticleWorkspace::CNode *OwnerNode; // Owner node of the property. When the property is modified, then the node will be marked as 'modified'
39 public:
40 IPSWrapper() : OwnerNode(NULL)
43 // for derivers : get a value
44 virtual T get(void) const = 0;
45 void setAndUpdateModifiedFlag(const T &value)
47 if (OwnerNode)
49 OwnerNode->setModified(true);
51 set(value);
53 protected:
54 // for derivers : set a value
55 virtual void set(const T &) = 0;
59 // wrapper to read/write a scheme of type T
60 template <class T> class IPSSchemeWrapper
62 public:
63 CParticleWorkspace::CNode *OwnerNode; // Owner node of the property. When the property is modified, then the node will be marked as 'modified'
64 public:
65 IPSSchemeWrapper() : OwnerNode(NULL) {}
66 typedef NL3D::CPSAttribMaker<T> scheme_type;
67 virtual scheme_type *getScheme(void) const = 0;
68 void setSchemeAndUpdateModifiedFlag(scheme_type *s)
70 if (OwnerNode)
72 OwnerNode->setModified(true);
74 setScheme(s);
76 protected:
77 virtual void setScheme(scheme_type *s) = 0;
82 // RGBA wrapper
83 typedef IPSWrapper<NLMISC::CRGBA> IPSWrapperRGBA;
84 typedef IPSSchemeWrapper<NLMISC::CRGBA> IPSSchemeWrapperRGBA;
86 // float wrapper
87 typedef IPSWrapper<float> IPSWrapperFloat;
88 typedef IPSSchemeWrapper<float> IPSSchemeWrapperFloat;
90 // uint wrapper
91 typedef IPSWrapper<uint32> IPSWrapperUInt;
92 typedef IPSSchemeWrapper<uint32> IPSSchemeWrapperUInt;
95 // texture
96 class IPSWrapperTexture
98 public:
99 CParticleWorkspace::CNode *OwnerNode;
100 public:
101 // ctor
102 IPSWrapperTexture() : OwnerNode(NULL) {}
103 virtual NL3D::ITexture *get(void) = 0;
104 virtual void setAndUpdateModifiedFlag(NL3D::ITexture *tex)
106 if (OwnerNode) OwnerNode->setModified(true);
107 set(tex);
109 protected:
110 virtual void set(NL3D::ITexture *) = 0;
113 #endif