1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2000-2013 by the OpenSG Forum *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, carsten_neumann@gmx.net *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
15 * This library is free software; you can redistribute it and/or modify it *
16 * under the terms of the GNU Library General Public License as published *
17 * by the Free Software Foundation, version 2. *
19 * This library is distributed in the hope that it will be useful, but *
20 * WITHOUT ANY WARRANTY; without even the implied warranty of *
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
22 * Library General Public License for more details. *
24 * You should have received a copy of the GNU Library General Public *
25 * License along with this library; if not, write to the Free Software *
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
37 \*---------------------------------------------------------------------------*/
39 #ifndef _OSGMULTIPROPERTYUBOCHUNK_H_
40 #define _OSGMULTIPROPERTYUBOCHUNK_H_
45 #include "OSGMultiPropertyUBOChunkBase.h"
49 /*! \brief MultiPropertyUBOChunk class. See \ref
50 PageSystemMultiPropertyUBOChunk for a description.
53 class OSG_SYSTEM_DLLMAPPING MultiPropertyUBOChunk
: public MultiPropertyUBOChunkBase
57 /*========================== PUBLIC =================================*/
61 typedef MultiPropertyUBOChunkBase Inherited
;
62 typedef MultiPropertyUBOChunk Self
;
64 /*---------------------------------------------------------------------*/
65 /*! \name Interface */
80 UInt32
addMember (Types type
, UInt32 cardinality
= 1);
82 UInt32
getNumProperties () const;
83 UInt32
addProperty ();
84 void removeProperty (const UInt32 idx
);
85 void clearProperties ();
87 Real32
getFloatProperty (UInt32 idx
, UInt32 num
) const;
88 Real64
getDoubleProperty(UInt32 idx
, UInt32 num
) const;
89 Int32
getIntProperty (UInt32 idx
, UInt32 num
) const;
90 UInt32
getUIntProperty (UInt32 idx
, UInt32 num
) const;
91 bool getBoolProperty (UInt32 idx
, UInt32 num
) const;
92 const Vec3f
&getVec3Property (UInt32 idx
, UInt32 num
) const;
93 const Vec4f
&getVec4Property (UInt32 idx
, UInt32 num
) const;
94 const Matrix
&getMat4Property (UInt32 idx
, UInt32 num
) const;
96 void setFloatProperty (UInt32 idx
, UInt32 num
, Real32 value
);
97 void setDoubleProperty(UInt32 idx
, UInt32 num
, Real64 value
);
98 void setIntProperty (UInt32 idx
, UInt32 num
, Int32 value
);
99 void setUIntProperty (UInt32 idx
, UInt32 num
, UInt32 value
);
100 void setBoolProperty (UInt32 idx
, UInt32 num
, bool value
);
101 void setVec3Property (UInt32 idx
, UInt32 num
, const Vec3f
& value
);
102 void setVec4Property (UInt32 idx
, UInt32 num
, const Vec4f
& value
);
103 void setMat4Property (UInt32 idx
, UInt32 num
, const Matrix
& value
);
106 /*---------------------------------------------------------------------*/
110 virtual void changed(ConstFieldMaskArg whichField
,
115 /*---------------------------------------------------------------------*/
119 virtual void dump( UInt32 uiIndent
= 0,
120 const BitVector bvFlags
= 0) const;
123 /*---------------------------------------------------------------------*/
127 virtual void activate (DrawEnv
*pEnv
,
130 virtual void changeFrom (DrawEnv
*pEnv
,
134 virtual void deactivate (DrawEnv
*pEnv
,
138 /*---------------------------------------------------------------------*/
139 /*! \name OpenGL handling */
142 /*========================= PROTECTED ===============================*/
146 static const UInt8 _numTypes
;
149 // Variables should all be in MultiPropertyUBOChunkBase.
151 void onCreate (const MultiPropertyUBOChunk
*source
= NULL
);
152 void onCreateAspect(const MultiPropertyUBOChunk
*createAspect
,
153 const MultiPropertyUBOChunk
*source
= NULL
);
154 void onDestroy ( UInt32 uiContainerId
);
156 /*---------------------------------------------------------------------*/
157 /*! \name Constructors */
160 MultiPropertyUBOChunk(void);
161 MultiPropertyUBOChunk(const MultiPropertyUBOChunk
&source
);
164 /*---------------------------------------------------------------------*/
165 /*! \name Destructors */
168 virtual ~MultiPropertyUBOChunk(void);
171 /*---------------------------------------------------------------------*/
175 static void initMethod(InitPhase ePhase
);
178 /*========================== PRIVATE ================================*/
182 friend class FieldContainer
;
183 friend class MultiPropertyUBOChunkBase
;
185 /*---------------------------------------------------------------------*/
188 std::size_t calc_property_buffer_size () const;
189 std::vector
<UInt8
> create_property_buffer (DrawEnv
* pEnv
) const;
190 void create_property_state (DrawEnv
* pEnv
);
191 void update_property_state (DrawEnv
* pEnv
);
195 bool check_invariant() const;
197 // prohibit default functions (move to 'public' if you need one)
198 void operator =(const MultiPropertyUBOChunk
&source
);
201 typedef MultiPropertyUBOChunk
*MultiPropertyUBOChunkP
;
205 #include "OSGMultiPropertyUBOChunkBase.inl"
206 #include "OSGMultiPropertyUBOChunk.inl"
208 #endif /* _OSGMULTIPROPERTYUBOCHUNK_H_ */