OSG  3.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Uniform.h
Go to the documentation of this file.
1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
2  * Copyright (C) 2003-2005 3Dlabs Inc. Ltd.
3  * Copyright (C) 2008 Zebra Imaging
4  * Copyright (C) 2012 David Callu
5  *
6  * This application is open source and may be redistributed and/or modified
7  * freely and without restriction, both in commercial and non commercial
8  * applications, as long as this copyright notice is maintained.
9  *
10  * This application is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 */
14 
15 /* file: include/osg/Uniform
16  * author: Mike Weiblen 2008-01-02
17 */
18 
19 #ifndef OSG_UNIFORM
20 #define OSG_UNIFORM 1
21 
22 #include <osg/ref_ptr>
23 #include <osg/Array>
24 #include <osg/Callback>
25 #include <osg/Vec2>
26 #include <osg/Vec3>
27 #include <osg/Vec4>
28 #include <osg/Vec2d>
29 #include <osg/Vec3d>
30 #include <osg/Vec4d>
31 #include <osg/Matrix>
32 #include <osg/GLExtensions>
33 
34 #include <string.h> // for memset
35 #include <string>
36 #include <vector>
37 
38 
39 namespace osg {
40 
41 // forward declare
42 class NodeVisitor;
43 
45 // C++ classes to represent the GLSL-specific types.
46 //
47 // Warning :
48 // OSG is Row major
49 // GLSL is Column Major
50 //
51 // If you define an Uniform with type Uniform::FLOAT_MAT4X2 and so use a Matrix4x2 to setup your Uniform,
52 // like this :
53 // 1 2
54 // 3 4
55 // 5 6
56 // 7 8
57 //
58 // you will get in your shader a Column Major Matrix like this :
59 // 1 3 5 7
60 // 2 4 6 8
61 //
62 // In simple term, you matrix in OSG will be a transposed matrix in GLSL
63 //
64 //
65 // You can avoid this behaviours starting GLSL version 1.40 with uniform layout :
66 //
67 // <GLSL code>
68 // layout(row_major) uniform matrix4x2 myVariable;
69 // <GLSL code>
70 //
71 //
72 template <typename T, unsigned int RowN, unsigned int ColN>
74 {
75  public:
76  enum { col_count = ColN };
77  enum { row_count = RowN };
78  enum { value_count = ColN * RowN };
79 
80  typedef T value_type;
81 
82 
83  public:
86 
87  value_type& operator()(int row, int col) { return _mat[row][col]; }
88  value_type operator()(int row, int col) const { return _mat[row][col]; }
89 
91  {
92  if( &rhs == this ) return *this;
93  set(rhs.ptr());
94  return *this;
95  }
96 
97  void set(const MatrixTemplate& rhs) { set(rhs.ptr()); }
98 
99  void set(value_type const * const ptr)
100  {
101  value_type* local_ptr = (value_type*)_mat;
102  for(int i=0;i<value_count;++i) local_ptr[i]=ptr[i];
103  }
104 
105  value_type* ptr() { return (value_type*)_mat; }
106  const value_type* ptr() const { return (const value_type*)_mat; }
107 
108  value_type& operator [] (int i) {return ptr()[i];}
109  value_type operator [] (int i) const {return ptr()[i];}
110 
111  void reset() { memset(_mat, 0, sizeof( value_type ) * value_count); }
112 
113  protected:
114  value_type _mat[row_count][col_count];
115 };
116 
117 template <typename T>
118 class Matrix2Template : public MatrixTemplate<T, 2, 2>
119 {
120  public:
123 
124 
125  public:
127  Matrix2Template( const Matrix2Template& mat ) { set(mat.ptr()); }
128  Matrix2Template( value_type a00, value_type a01,
129  value_type a10, value_type a11 )
130  {
131  set( a00, a01,
132  a10, a11 );
133  }
135 
136  using base_class::set;
137 
138  void set(value_type a00, value_type a01,
139  value_type a10, value_type a11 )
140  {
141  base_class::_mat[0][0]=a00; base_class::_mat[0][1]=a01;
142  base_class::_mat[1][0]=a10; base_class::_mat[1][1]=a11;
143  }
144 
146  {
147  set( 1, 0,
148  0, 1 );
149  }
150 };
151 
152 template <typename T>
153 class Matrix2x3Template : public MatrixTemplate<T, 2, 3>
154 {
155  public:
158 
159 
160  public:
162  Matrix2x3Template( const Matrix2x3Template& mat ) { set(mat.ptr()); }
163  Matrix2x3Template( value_type a00, value_type a01, value_type a02,
164  value_type a10, value_type a11, value_type a12 )
165  {
166  set( a00, a01, a02,
167  a10, a11, a12 );
168  }
170 
171  using base_class::set;
172 
173  void set( value_type a00, value_type a01, value_type a02,
174  value_type a10, value_type a11, value_type a12 )
175  {
176  base_class::_mat[0][0]=a00; base_class::_mat[0][1]=a01; base_class::_mat[0][2]=a02;
177  base_class::_mat[1][0]=a10; base_class::_mat[1][1]=a11; base_class::_mat[1][2]=a12;
178  }
179 };
180 
181 template <typename T>
182 class Matrix2x4Template : public MatrixTemplate<T, 2, 4>
183 {
184  public:
187 
188 
189  public:
191  Matrix2x4Template( const Matrix2x4Template& mat ) { set(mat.ptr()); }
192  Matrix2x4Template( value_type a00, value_type a01, value_type a02, value_type a03,
193  value_type a10, value_type a11, value_type a12, value_type a13 )
194  {
195  set( a00, a01, a02, a03,
196  a10, a11, a12, a13 );
197  }
199 
200  using base_class::set;
201 
202  void set( value_type a00, value_type a01, value_type a02, value_type a03,
203  value_type a10, value_type a11, value_type a12, value_type a13 )
204  {
205  base_class::_mat[0][0]=a00; base_class::_mat[0][1]=a01; base_class::_mat[0][2]=a02; base_class::_mat[0][3]=a03;
206  base_class::_mat[1][0]=a10; base_class::_mat[1][1]=a11; base_class::_mat[1][2]=a12; base_class::_mat[1][3]=a13;
207  }
208 };
209 
210 template <typename T>
211 class Matrix3x2Template : public MatrixTemplate<T, 3, 2>
212 {
213  public:
216 
217  public:
219  Matrix3x2Template( const Matrix3x2Template& mat ) { set(mat.ptr()); }
220  Matrix3x2Template( value_type a00, value_type a01,
221  value_type a10, value_type a11,
222  value_type a20, value_type a21 )
223  {
224  set( a00, a01,
225  a10, a11,
226  a20, a21 );
227  }
229 
230  using base_class::set;
231 
232  void set( value_type a00, value_type a01,
233  value_type a10, value_type a11,
234  value_type a20, value_type a21 )
235  {
236  base_class::_mat[0][0]=a00; base_class::_mat[0][1]=a01;
237  base_class::_mat[1][0]=a10; base_class::_mat[1][1]=a11;
238  base_class::_mat[2][0]=a20; base_class::_mat[2][1]=a21;
239  }
240 };
241 
242 template <typename T>
243 class Matrix3Template : public MatrixTemplate<T, 3, 3>
244 {
245  public:
248 
249  public:
251  Matrix3Template( const Matrix3Template& mat ) { set(mat.ptr()); }
252  Matrix3Template( value_type a00, value_type a01, value_type a02,
253  value_type a10, value_type a11, value_type a12,
254  value_type a20, value_type a21, value_type a22 )
255  {
256  set( a00, a01, a02,
257  a10, a11, a12,
258  a20, a21, a22 );
259  }
261 
262  using base_class::set;
263 
264  void set( value_type a00, value_type a01, value_type a02,
265  value_type a10, value_type a11, value_type a12,
266  value_type a20, value_type a21, value_type a22 )
267  {
268  base_class::_mat[0][0]=a00; base_class::_mat[0][1]=a01; base_class::_mat[0][2]=a02;
269  base_class::_mat[1][0]=a10; base_class::_mat[1][1]=a11; base_class::_mat[1][2]=a12;
270  base_class::_mat[2][0]=a20; base_class::_mat[2][1]=a21; base_class::_mat[2][2]=a22;
271  }
272 
274  {
275  set( 1, 0, 0,
276  0, 1, 0,
277  0, 0, 1 );
278  }
279 };
280 
281 template <typename T>
282 class Matrix3x4Template : public MatrixTemplate<T, 3, 4>
283 {
284  public:
287 
288  public:
290  Matrix3x4Template( const Matrix3x4Template& mat ) { set(mat.ptr()); }
291  Matrix3x4Template( value_type a00, value_type a01, value_type a02, value_type a03,
292  value_type a10, value_type a11, value_type a12, value_type a13,
293  value_type a20, value_type a21, value_type a22, value_type a23 )
294  {
295  set( a00, a01, a02, a03,
296  a10, a11, a12, a13,
297  a20, a21, a22, a23 );
298  }
300 
301  using base_class::set;
302 
303  void set( value_type a00, value_type a01, value_type a02, value_type a03,
304  value_type a10, value_type a11, value_type a12, value_type a13,
305  value_type a20, value_type a21, value_type a22, value_type a23 )
306  {
307  base_class::_mat[0][0]=a00; base_class::_mat[0][1]=a01; base_class::_mat[0][2]=a02; base_class::_mat[0][3]=a03;
308  base_class::_mat[1][0]=a10; base_class::_mat[1][1]=a11; base_class::_mat[1][2]=a12; base_class::_mat[1][3]=a13;
309  base_class::_mat[2][0]=a20; base_class::_mat[2][1]=a21; base_class::_mat[2][2]=a22; base_class::_mat[2][3]=a23;
310  }
311 };
312 
313 template <typename T>
314 class Matrix4x2Template : public MatrixTemplate<T, 4, 2>
315 {
316  public:
319 
320  public:
322  Matrix4x2Template( const Matrix4x2Template& mat ) { set(mat.ptr()); }
323  Matrix4x2Template( value_type a00, value_type a01,
324  value_type a10, value_type a11,
325  value_type a20, value_type a21,
326  value_type a30, value_type a31 )
327  {
328  set( a00, a01,
329  a10, a11,
330  a20, a21,
331  a30, a31 );
332  }
334 
335  using base_class::set;
336 
337  void set( value_type a00, value_type a01,
338  value_type a10, value_type a11,
339  value_type a20, value_type a21,
340  value_type a30, value_type a31 )
341  {
342  base_class::_mat[0][0]=a00; base_class::_mat[0][1]=a01;
343  base_class::_mat[1][0]=a10; base_class::_mat[1][1]=a11;
344  base_class::_mat[2][0]=a20; base_class::_mat[2][1]=a21;
345  base_class::_mat[3][0]=a30; base_class::_mat[3][1]=a31;
346  }
347 };
348 
349 template <typename T>
350 class Matrix4x3Template : public MatrixTemplate<T, 4, 3>
351 {
352  public:
355 
356  public:
358  Matrix4x3Template( const Matrix4x3Template& mat ) { set(mat.ptr()); }
359  Matrix4x3Template( value_type a00, value_type a01, value_type a02,
360  value_type a10, value_type a11, value_type a12,
361  value_type a20, value_type a21, value_type a22,
362  value_type a30, value_type a31, value_type a32 )
363  {
364  set( a00, a01, a02,
365  a10, a11, a12,
366  a20, a21, a22,
367  a30, a31, a32 );
368  }
370 
371  using base_class::set;
372 
373  void set( value_type a00, value_type a01, value_type a02,
374  value_type a10, value_type a11, value_type a12,
375  value_type a20, value_type a21, value_type a22,
376  value_type a30, value_type a31, value_type a32 )
377  {
378  base_class::_mat[0][0]=a00; base_class::_mat[0][1]=a01; base_class::_mat[0][2]=a02;
379  base_class::_mat[1][0]=a10; base_class::_mat[1][1]=a11; base_class::_mat[1][2]=a12;
380  base_class::_mat[2][0]=a20; base_class::_mat[2][1]=a21; base_class::_mat[2][2]=a22;
381  base_class::_mat[3][0]=a30; base_class::_mat[3][1]=a31; base_class::_mat[3][2]=a32;
382  }
383 };
384 
388 
392 
395 
396 
400 
404 
407 
408 
409 
411 
413 class OSG_EXPORT Uniform : public Object
414 {
415  public:
416  enum Type {
417  FLOAT = GL_FLOAT,
418  FLOAT_VEC2 = GL_FLOAT_VEC2,
419  FLOAT_VEC3 = GL_FLOAT_VEC3,
420  FLOAT_VEC4 = GL_FLOAT_VEC4,
421 
422  DOUBLE = GL_DOUBLE,
423  DOUBLE_VEC2 = GL_DOUBLE_VEC2,
424  DOUBLE_VEC3 = GL_DOUBLE_VEC3,
425  DOUBLE_VEC4 = GL_DOUBLE_VEC4,
426 
427  INT = GL_INT,
428  INT_VEC2 = GL_INT_VEC2,
429  INT_VEC3 = GL_INT_VEC3,
430  INT_VEC4 = GL_INT_VEC4,
431 
432  UNSIGNED_INT = GL_UNSIGNED_INT,
433  UNSIGNED_INT_VEC2 = GL_UNSIGNED_INT_VEC2_EXT,
434  UNSIGNED_INT_VEC3 = GL_UNSIGNED_INT_VEC3_EXT,
435  UNSIGNED_INT_VEC4 = GL_UNSIGNED_INT_VEC4_EXT,
436 
437  BOOL = GL_BOOL,
438  BOOL_VEC2 = GL_BOOL_VEC2,
439  BOOL_VEC3 = GL_BOOL_VEC3,
440  BOOL_VEC4 = GL_BOOL_VEC4,
441 
442  FLOAT_MAT2 = GL_FLOAT_MAT2,
443  FLOAT_MAT3 = GL_FLOAT_MAT3,
444  FLOAT_MAT4 = GL_FLOAT_MAT4,
445  FLOAT_MAT2x3 = GL_FLOAT_MAT2x3,
446  FLOAT_MAT2x4 = GL_FLOAT_MAT2x4,
447  FLOAT_MAT3x2 = GL_FLOAT_MAT3x2,
448  FLOAT_MAT3x4 = GL_FLOAT_MAT3x4,
449  FLOAT_MAT4x2 = GL_FLOAT_MAT4x2,
450  FLOAT_MAT4x3 = GL_FLOAT_MAT4x3,
451 
452  DOUBLE_MAT2 = GL_DOUBLE_MAT2,
453  DOUBLE_MAT3 = GL_DOUBLE_MAT3,
454  DOUBLE_MAT4 = GL_DOUBLE_MAT4,
455  DOUBLE_MAT2x3 = GL_DOUBLE_MAT2x3,
456  DOUBLE_MAT2x4 = GL_DOUBLE_MAT2x4,
457  DOUBLE_MAT3x2 = GL_DOUBLE_MAT3x2,
458  DOUBLE_MAT3x4 = GL_DOUBLE_MAT3x4,
459  DOUBLE_MAT4x2 = GL_DOUBLE_MAT4x2,
460  DOUBLE_MAT4x3 = GL_DOUBLE_MAT4x3,
461 
462  SAMPLER_1D = GL_SAMPLER_1D,
463  SAMPLER_2D = GL_SAMPLER_2D,
464  SAMPLER_3D = GL_SAMPLER_3D,
465  SAMPLER_CUBE = GL_SAMPLER_CUBE,
466  SAMPLER_1D_SHADOW = GL_SAMPLER_1D_SHADOW,
467  SAMPLER_2D_SHADOW = GL_SAMPLER_2D_SHADOW,
468  SAMPLER_1D_ARRAY = GL_SAMPLER_1D_ARRAY_EXT,
469  SAMPLER_2D_ARRAY = GL_SAMPLER_2D_ARRAY_EXT,
470  SAMPLER_CUBE_MAP_ARRAY = GL_SAMPLER_CUBE_MAP_ARRAY,
471  SAMPLER_1D_ARRAY_SHADOW = GL_SAMPLER_1D_ARRAY_SHADOW_EXT,
472  SAMPLER_2D_ARRAY_SHADOW = GL_SAMPLER_2D_ARRAY_SHADOW_EXT,
473  SAMPLER_2D_MULTISAMPLE = GL_SAMPLER_2D_MULTISAMPLE,
474  SAMPLER_2D_MULTISAMPLE_ARRAY = GL_SAMPLER_2D_MULTISAMPLE_ARRAY,
475  SAMPLER_CUBE_SHADOW = GL_SAMPLER_CUBE_SHADOW_EXT,
476  SAMPLER_CUBE_MAP_ARRAY_SHADOW = GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW,
477  SAMPLER_BUFFER = GL_SAMPLER_BUFFER_EXT,
478  SAMPLER_2D_RECT = GL_SAMPLER_2D_RECT,
479  SAMPLER_2D_RECT_SHADOW = GL_SAMPLER_2D_RECT_SHADOW,
480 
481  INT_SAMPLER_1D = GL_INT_SAMPLER_1D_EXT,
482  INT_SAMPLER_2D = GL_INT_SAMPLER_2D_EXT,
483  INT_SAMPLER_3D = GL_INT_SAMPLER_3D_EXT,
484  INT_SAMPLER_CUBE = GL_INT_SAMPLER_CUBE_EXT,
485  INT_SAMPLER_1D_ARRAY = GL_INT_SAMPLER_1D_ARRAY_EXT,
486  INT_SAMPLER_2D_ARRAY = GL_INT_SAMPLER_2D_ARRAY_EXT,
487  INT_SAMPLER_CUBE_MAP_ARRAY = GL_INT_SAMPLER_CUBE_MAP_ARRAY,
488  INT_SAMPLER_2D_MULTISAMPLE = GL_INT_SAMPLER_2D_MULTISAMPLE,
489  INT_SAMPLER_2D_MULTISAMPLE_ARRAY = GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY,
490  INT_SAMPLER_BUFFER = GL_INT_SAMPLER_BUFFER_EXT,
491  INT_SAMPLER_2D_RECT = GL_INT_SAMPLER_2D_RECT_EXT,
492 
493  UNSIGNED_INT_SAMPLER_1D = GL_UNSIGNED_INT_SAMPLER_1D_EXT,
494  UNSIGNED_INT_SAMPLER_2D = GL_UNSIGNED_INT_SAMPLER_2D_EXT,
495  UNSIGNED_INT_SAMPLER_3D = GL_UNSIGNED_INT_SAMPLER_3D_EXT,
496  UNSIGNED_INT_SAMPLER_CUBE = GL_UNSIGNED_INT_SAMPLER_CUBE_EXT,
497  UNSIGNED_INT_SAMPLER_1D_ARRAY = GL_UNSIGNED_INT_SAMPLER_1D_ARRAY_EXT,
498  UNSIGNED_INT_SAMPLER_2D_ARRAY = GL_UNSIGNED_INT_SAMPLER_2D_ARRAY_EXT,
499  UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY = GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY,
500  UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE = GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE,
501  UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY = GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY,
502  UNSIGNED_INT_SAMPLER_BUFFER = GL_UNSIGNED_INT_SAMPLER_BUFFER_EXT,
503  UNSIGNED_INT_SAMPLER_2D_RECT = GL_UNSIGNED_INT_SAMPLER_2D_RECT_EXT,
504 
505  IMAGE_1D = GL_IMAGE_1D,
506  IMAGE_2D = GL_IMAGE_2D,
507  IMAGE_3D = GL_IMAGE_3D,
508  IMAGE_2D_RECT = GL_IMAGE_2D_RECT,
509  IMAGE_CUBE = GL_IMAGE_CUBE,
510  IMAGE_BUFFER = GL_IMAGE_BUFFER,
511  IMAGE_1D_ARRAY = GL_IMAGE_1D_ARRAY,
512  IMAGE_2D_ARRAY = GL_IMAGE_2D_ARRAY,
513  IMAGE_CUBE_MAP_ARRAY = GL_IMAGE_CUBE_MAP_ARRAY,
514  IMAGE_2D_MULTISAMPLE = GL_IMAGE_2D_MULTISAMPLE,
515  IMAGE_2D_MULTISAMPLE_ARRAY = GL_IMAGE_2D_MULTISAMPLE_ARRAY,
516 
517  INT_IMAGE_1D = GL_INT_IMAGE_1D,
518  INT_IMAGE_2D = GL_INT_IMAGE_2D,
519  INT_IMAGE_3D = GL_INT_IMAGE_3D,
520  INT_IMAGE_2D_RECT = GL_INT_IMAGE_2D_RECT,
521  INT_IMAGE_CUBE = GL_INT_IMAGE_CUBE,
522  INT_IMAGE_BUFFER = GL_INT_IMAGE_BUFFER,
523  INT_IMAGE_1D_ARRAY = GL_INT_IMAGE_1D_ARRAY,
524  INT_IMAGE_2D_ARRAY = GL_INT_IMAGE_2D_ARRAY,
525  INT_IMAGE_CUBE_MAP_ARRAY = GL_INT_IMAGE_CUBE_MAP_ARRAY,
526  INT_IMAGE_2D_MULTISAMPLE = GL_INT_IMAGE_2D_MULTISAMPLE,
527  INT_IMAGE_2D_MULTISAMPLE_ARRAY = GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY,
528 
529  UNSIGNED_INT_IMAGE_1D = GL_UNSIGNED_INT_IMAGE_1D,
530  UNSIGNED_INT_IMAGE_2D = GL_UNSIGNED_INT_IMAGE_2D,
531  UNSIGNED_INT_IMAGE_3D = GL_UNSIGNED_INT_IMAGE_3D,
532  UNSIGNED_INT_IMAGE_2D_RECT = GL_UNSIGNED_INT_IMAGE_2D_RECT,
533  UNSIGNED_INT_IMAGE_CUBE = GL_UNSIGNED_INT_IMAGE_CUBE,
534  UNSIGNED_INT_IMAGE_BUFFER = GL_UNSIGNED_INT_IMAGE_BUFFER,
535  UNSIGNED_INT_IMAGE_1D_ARRAY = GL_UNSIGNED_INT_IMAGE_1D_ARRAY,
536  UNSIGNED_INT_IMAGE_2D_ARRAY = GL_UNSIGNED_INT_IMAGE_2D_ARRAY,
537  UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY = GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY,
538  UNSIGNED_INT_IMAGE_2D_MULTISAMPLE = GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE,
539  UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY = GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY,
540 
541  UNDEFINED = 0x0
542  };
543 
544  public:
545 
546  Uniform();
547  Uniform( Type type, const std::string& name, int numElements=1 );
548 
550  Uniform(const Uniform& rhs, const CopyOp& copyop=CopyOp::SHALLOW_COPY);
551 
553 
556  virtual Uniform* asUniform() { return this; }
557 
560  virtual const Uniform* asUniform() const { return this; }
561 
562 
564  bool setType( Type t );
565 
567  Type getType() const { return _type; }
568 
570  virtual void setName( const std::string& name );
571 
573  void setNumElements( unsigned int numElements );
574 
576  unsigned int getNumElements() const { return _numElements; }
577 
580  unsigned int getInternalArrayNumElements() const;
581 
583  static const char* getTypename( Type t );
584 
586  static int getTypeNumComponents( Type t );
587 
589  static Uniform::Type getTypeId( const std::string& tname );
590 
592  static Type getGlApiType( Type t );
593 
595  static GLenum getInternalArrayType( Type t );
596 
598  static unsigned int getNameID(const std::string& name);
599 
601  explicit Uniform( const char* name, float f );
602  explicit Uniform( const char* name, double d );
603  explicit Uniform( const char* name, int i );
604  explicit Uniform( const char* name, unsigned int ui );
605  explicit Uniform( const char* name, bool b );
606  Uniform( const char* name, const osg::Vec2& v2 );
607  Uniform( const char* name, const osg::Vec3& v3 );
608  Uniform( const char* name, const osg::Vec4& v4 );
609  Uniform( const char* name, const osg::Vec2d& v2 );
610  Uniform( const char* name, const osg::Vec3d& v3 );
611  Uniform( const char* name, const osg::Vec4d& v4 );
612  Uniform( const char* name, const osg::Matrix2& m2 );
613  Uniform( const char* name, const osg::Matrix3& m3 );
614  Uniform( const char* name, const osg::Matrixf& m4 );
615  Uniform( const char* name, const osg::Matrix2x3& m2x3 );
616  Uniform( const char* name, const osg::Matrix2x4& m2x4 );
617  Uniform( const char* name, const osg::Matrix3x2& m3x2 );
618  Uniform( const char* name, const osg::Matrix3x4& m3x4 );
619  Uniform( const char* name, const osg::Matrix4x2& m4x2 );
620  Uniform( const char* name, const osg::Matrix4x3& m4x3 );
621  Uniform( const char* name, const osg::Matrix2d& m2 );
622  Uniform( const char* name, const osg::Matrix3d& m3 );
623  Uniform( const char* name, const osg::Matrixd& m4 );
624  Uniform( const char* name, const osg::Matrix2x3d& m2x3 );
625  Uniform( const char* name, const osg::Matrix2x4d& m2x4 );
626  Uniform( const char* name, const osg::Matrix3x2d& m3x2 );
627  Uniform( const char* name, const osg::Matrix3x4d& m3x4 );
628  Uniform( const char* name, const osg::Matrix4x2d& m4x2 );
629  Uniform( const char* name, const osg::Matrix4x3d& m4x3 );
630  Uniform( const char* name, int i0, int i1 );
631  Uniform( const char* name, int i0, int i1, int i2 );
632  Uniform( const char* name, int i0, int i1, int i2, int i3 );
633  Uniform( const char* name, unsigned int ui0, unsigned int ui1 );
634  Uniform( const char* name, unsigned int ui0, unsigned int ui1, unsigned int ui2 );
635  Uniform( const char* name, unsigned int ui0, unsigned int ui1, unsigned int ui2, unsigned int ui3 );
636  Uniform( const char* name, bool b0, bool b1 );
637  Uniform( const char* name, bool b0, bool b1, bool b2 );
638  Uniform( const char* name, bool b0, bool b1, bool b2, bool b3 );
639 
641  virtual int compare(const Uniform& rhs) const;
642  virtual int compareData(const Uniform& rhs) const;
643 
644  bool operator < (const Uniform& rhs) const { return compare(rhs)<0; }
645  bool operator == (const Uniform& rhs) const { return compare(rhs)==0; }
646  bool operator != (const Uniform& rhs) const { return compare(rhs)!=0; }
647 
648  void copyData( const Uniform& rhs );
649 
650 
652  typedef std::vector<StateSet*> ParentList;
653 
655  inline const ParentList& getParents() const { return _parents; }
656 
659  inline ParentList getParents() { return _parents; }
660 
661  inline StateSet* getParent(unsigned int i) { return _parents[i]; }
667  inline const StateSet* getParent(unsigned int i) const { return _parents[i]; }
668 
673  inline unsigned int getNumParents() const { return static_cast<unsigned int>(_parents.size()); }
674 
675 
677  bool set( float f );
678  bool set( double d );
679  bool set( int i );
680  bool set( unsigned int ui );
681  bool set( bool b );
682  bool set( const osg::Vec2& v2 );
683  bool set( const osg::Vec3& v3 );
684  bool set( const osg::Vec4& v4 );
685  bool set( const osg::Vec2d& v2 );
686  bool set( const osg::Vec3d& v3 );
687  bool set( const osg::Vec4d& v4 );
688  bool set( const osg::Matrix2& m2 );
689  bool set( const osg::Matrix3& m3 );
690  bool set( const osg::Matrixf& m4 );
691  bool set( const osg::Matrix2x3& m2x3 );
692  bool set( const osg::Matrix2x4& m2x4 );
693  bool set( const osg::Matrix3x2& m3x2 );
694  bool set( const osg::Matrix3x4& m3x4 );
695  bool set( const osg::Matrix4x2& m4x2 );
696  bool set( const osg::Matrix4x3& m4x3 );
697  bool set( const osg::Matrix2d& m2 );
698  bool set( const osg::Matrix3d& m3 );
699  bool set( const osg::Matrixd& m4 );
700  bool set( const osg::Matrix2x3d& m2x3 );
701  bool set( const osg::Matrix2x4d& m2x4 );
702  bool set( const osg::Matrix3x2d& m3x2 );
703  bool set( const osg::Matrix3x4d& m3x4 );
704  bool set( const osg::Matrix4x2d& m4x2 );
705  bool set( const osg::Matrix4x3d& m4x3 );
706  bool set( int i0, int i1 );
707  bool set( int i0, int i1, int i2 );
708  bool set( int i0, int i1, int i2, int i3 );
709  bool set( unsigned int ui0, unsigned int ui1 );
710  bool set( unsigned int ui0, unsigned int ui1, unsigned int ui2 );
711  bool set( unsigned int ui0, unsigned int ui1, unsigned int ui2, unsigned int ui3 );
712  bool set( bool b0, bool b1 );
713  bool set( bool b0, bool b1, bool b2 );
714  bool set( bool b0, bool b1, bool b2, bool b3 );
715 
717  bool get( float& f ) const;
718  bool get( double& d ) const;
719  bool get( int& i ) const;
720  bool get( unsigned int& ui ) const;
721  bool get( bool& b ) const;
722  bool get( osg::Vec2& v2 ) const;
723  bool get( osg::Vec3& v3 ) const;
724  bool get( osg::Vec4& v4 ) const;
725  bool get( osg::Vec2d& v2 ) const;
726  bool get( osg::Vec3d& v3 ) const;
727  bool get( osg::Vec4d& v4 ) const;
728  bool get( osg::Matrix2& m2 ) const;
729  bool get( osg::Matrix3& m3 ) const;
730  bool get( osg::Matrixf& m4 ) const;
731  bool get( osg::Matrix2x3& m2x3 ) const;
732  bool get( osg::Matrix2x4& m2x4 ) const;
733  bool get( osg::Matrix3x2& m3x2 ) const;
734  bool get( osg::Matrix3x4& m3x4 ) const;
735  bool get( osg::Matrix4x2& m4x2 ) const;
736  bool get( osg::Matrix4x3& m4x3 ) const;
737  bool get( osg::Matrix2d& m2 ) const;
738  bool get( osg::Matrix3d& m3 ) const;
739  bool get( osg::Matrixd& m4 ) const;
740  bool get( osg::Matrix2x3d& m2x3 ) const;
741  bool get( osg::Matrix2x4d& m2x4 ) const;
742  bool get( osg::Matrix3x2d& m3x2 ) const;
743  bool get( osg::Matrix3x4d& m3x4 ) const;
744  bool get( osg::Matrix4x2d& m4x2 ) const;
745  bool get( osg::Matrix4x3d& m4x3 ) const;
746  bool get( int& i0, int& i1 ) const;
747  bool get( int& i0, int& i1, int& i2 ) const;
748  bool get( int& i0, int& i1, int& i2, int& i3 ) const;
749  bool get( unsigned int& ui0, unsigned int& ui1 ) const;
750  bool get( unsigned int& ui0, unsigned int& ui1, unsigned int& ui2 ) const;
751  bool get( unsigned int& ui0, unsigned int& ui1, unsigned int& ui2, unsigned int& ui3 ) const;
752  bool get( bool& b0, bool& b1 ) const;
753  bool get( bool& b0, bool& b1, bool& b2 ) const;
754  bool get( bool& b0, bool& b1, bool& b2, bool& b3 ) const;
755 
757  bool setElement( unsigned int index, float f );
758  bool setElement( unsigned int index, double d );
759  bool setElement( unsigned int index, int i );
760  bool setElement( unsigned int index, unsigned int ui );
761  bool setElement( unsigned int index, bool b );
762  bool setElement( unsigned int index, const osg::Vec2& v2 );
763  bool setElement( unsigned int index, const osg::Vec3& v3 );
764  bool setElement( unsigned int index, const osg::Vec4& v4 );
765  bool setElement( unsigned int index, const osg::Vec2d& v2 );
766  bool setElement( unsigned int index, const osg::Vec3d& v3 );
767  bool setElement( unsigned int index, const osg::Vec4d& v4 );
768  bool setElement( unsigned int index, const osg::Matrix2& m2 );
769  bool setElement( unsigned int index, const osg::Matrix3& m3 );
770  bool setElement( unsigned int index, const osg::Matrixf& m4 );
771  bool setElement( unsigned int index, const osg::Matrix2x3& m2x3 );
772  bool setElement( unsigned int index, const osg::Matrix2x4& m2x4 );
773  bool setElement( unsigned int index, const osg::Matrix3x2& m3x2 );
774  bool setElement( unsigned int index, const osg::Matrix3x4& m3x4 );
775  bool setElement( unsigned int index, const osg::Matrix4x2& m4x2 );
776  bool setElement( unsigned int index, const osg::Matrix4x3& m4x3 );
777  bool setElement( unsigned int index, const osg::Matrix2d& m2 );
778  bool setElement( unsigned int index, const osg::Matrix3d& m3 );
779  bool setElement( unsigned int index, const osg::Matrixd& m4 );
780  bool setElement( unsigned int index, const osg::Matrix2x3d& m2x3 );
781  bool setElement( unsigned int index, const osg::Matrix2x4d& m2x4 );
782  bool setElement( unsigned int index, const osg::Matrix3x2d& m3x2 );
783  bool setElement( unsigned int index, const osg::Matrix3x4d& m3x4 );
784  bool setElement( unsigned int index, const osg::Matrix4x2d& m4x2 );
785  bool setElement( unsigned int index, const osg::Matrix4x3d& m4x3 );
786  bool setElement( unsigned int index, int i0, int i1 );
787  bool setElement( unsigned int index, int i0, int i1, int i2 );
788  bool setElement( unsigned int index, int i0, int i1, int i2, int i3 );
789  bool setElement( unsigned int index, unsigned int ui0, unsigned int ui1 );
790  bool setElement( unsigned int index, unsigned int ui0, unsigned int ui1, unsigned int ui2 );
791  bool setElement( unsigned int index, unsigned int ui0, unsigned int ui1, unsigned int ui2, unsigned int ui3 );
792  bool setElement( unsigned int index, bool b0, bool b1 );
793  bool setElement( unsigned int index, bool b0, bool b1, bool b2 );
794  bool setElement( unsigned int index, bool b0, bool b1, bool b2, bool b3 );
795 
797  bool getElement( unsigned int index, float& f ) const;
798  bool getElement( unsigned int index, double& d ) const;
799  bool getElement( unsigned int index, int& i ) const;
800  bool getElement( unsigned int index, unsigned int& ui ) const;
801  bool getElement( unsigned int index, bool& b ) const;
802  bool getElement( unsigned int index, osg::Vec2& v2 ) const;
803  bool getElement( unsigned int index, osg::Vec3& v3 ) const;
804  bool getElement( unsigned int index, osg::Vec4& v4 ) const;
805  bool getElement( unsigned int index, osg::Vec2d& v2 ) const;
806  bool getElement( unsigned int index, osg::Vec3d& v3 ) const;
807  bool getElement( unsigned int index, osg::Vec4d& v4 ) const;
808  bool getElement( unsigned int index, osg::Matrix2& m2 ) const;
809  bool getElement( unsigned int index, osg::Matrix3& m3 ) const;
810  bool getElement( unsigned int index, osg::Matrixf& m4 ) const;
811  bool getElement( unsigned int index, osg::Matrix2x3& m2x3 ) const;
812  bool getElement( unsigned int index, osg::Matrix2x4& m2x4 ) const;
813  bool getElement( unsigned int index, osg::Matrix3x2& m3x2 ) const;
814  bool getElement( unsigned int index, osg::Matrix3x4& m3x4 ) const;
815  bool getElement( unsigned int index, osg::Matrix4x2& m4x2 ) const;
816  bool getElement( unsigned int index, osg::Matrix4x3& m4x3 ) const;
817  bool getElement( unsigned int index, osg::Matrix2d& m2 ) const;
818  bool getElement( unsigned int index, osg::Matrix3d& m3 ) const;
819  bool getElement( unsigned int index, osg::Matrixd& m4 ) const;
820  bool getElement( unsigned int index, osg::Matrix2x3d& m2x3 ) const;
821  bool getElement( unsigned int index, osg::Matrix2x4d& m2x4 ) const;
822  bool getElement( unsigned int index, osg::Matrix3x2d& m3x2 ) const;
823  bool getElement( unsigned int index, osg::Matrix3x4d& m3x4 ) const;
824  bool getElement( unsigned int index, osg::Matrix4x2d& m4x2 ) const;
825  bool getElement( unsigned int index, osg::Matrix4x3d& m4x3 ) const;
826  bool getElement( unsigned int index, int& i0, int& i1 ) const;
827  bool getElement( unsigned int index, int& i0, int& i1, int& i2 ) const;
828  bool getElement( unsigned int index, int& i0, int& i1, int& i2, int& i3 ) const;
829  bool getElement( unsigned int index, unsigned int& ui0, unsigned int& ui1 ) const;
830  bool getElement( unsigned int index, unsigned int& ui0, unsigned int& ui1, unsigned int& ui2 ) const;
831  bool getElement( unsigned int index, unsigned int& ui0, unsigned int& ui1, unsigned int& ui2, unsigned int& ui3 ) const;
832  bool getElement( unsigned int index, bool& b0, bool& b1 ) const;
833  bool getElement( unsigned int index, bool& b0, bool& b1, bool& b2 ) const;
834  bool getElement( unsigned int index, bool& b0, bool& b1, bool& b2, bool& b3 ) const;
835 
836 
839 
840 
842  void setUpdateCallback(UniformCallback* uc);
843 
845  UniformCallback* getUpdateCallback() { return _updateCallback.get(); }
846 
848  const UniformCallback* getUpdateCallback() const { return _updateCallback.get(); }
849 
851  void setEventCallback(UniformCallback* ec);
852 
854  UniformCallback* getEventCallback() { return _eventCallback.get(); }
855 
857  const UniformCallback* getEventCallback() const { return _eventCallback.get(); }
858 
862  inline void dirty() { ++_modifiedCount; }
863 
865  bool setArray( FloatArray* array );
866  bool setArray( DoubleArray* array );
867  bool setArray( IntArray* array );
868  bool setArray( UIntArray* array );
869 
871  FloatArray* getFloatArray() { return _floatArray.get(); }
872  const FloatArray* getFloatArray() const { return _floatArray.get(); }
873 
875  DoubleArray* getDoubleArray() { return _doubleArray.get(); }
876  const DoubleArray* getDoubleArray() const { return _doubleArray.get(); }
877 
879  IntArray* getIntArray() { return _intArray.get(); }
880  const IntArray* getIntArray() const { return _intArray.get(); }
881 
883  UIntArray* getUIntArray() { return _uintArray.get(); }
884  const UIntArray* getUIntArray() const { return _uintArray.get(); }
885 
886  inline void setModifiedCount(unsigned int mc) { _modifiedCount = mc; }
887  inline unsigned int getModifiedCount() const { return _modifiedCount; }
888 
890  unsigned int getNameID() const;
891 
892  void apply(const GLExtensions* ext, GLint location) const;
893 
894 
895  protected:
896 
897  virtual ~Uniform();
898  Uniform& operator=(const Uniform&) { return *this; }
899 
900  bool isCompatibleType( Type t ) const;
901  // for backward compatibility only
902  // see getElement(index, osg::Matrixd &)
903  // see setElement(index, osg::Matrixd &)
904  bool isCompatibleType( Type t1, Type t2 ) const;
905  bool isScalar() const { return _numElements==1; }
906  void allocateDataArray();
907 
908  void addParent(osg::StateSet* object);
909  void removeParent(osg::StateSet* object);
910 
911  ParentList _parents;
912  friend class osg::StateSet;
913 
915  unsigned int _numElements;
916  unsigned int _nameID;
917 
918 
919  // The internal data for osg::Uniforms are stored as an array of
920  // getInternalArrayType() of length getInternalArrayNumElements().
925 
928 
929  unsigned int _modifiedCount;
930 };
931 
932 }
933 
934 #endif
#define GL_DOUBLE_VEC2
Definition: GLDefines.h:331
Matrix2x4Template< float > Matrix2x4
Definition: Uniform.h:387
MatrixTemplate< T, 3, 3 > base_class
Definition: Uniform.h:246
void set(value_type a00, value_type a01, value_type a02, value_type a10, value_type a11, value_type a12, value_type a20, value_type a21, value_type a22, value_type a30, value_type a31, value_type a32)
Definition: Uniform.h:373
Matrix3x2Template< double > Matrix3x2d
Definition: Uniform.h:401
Matrix4x2Template(value_type a00, value_type a01, value_type a10, value_type a11, value_type a20, value_type a21, value_type a30, value_type a31)
Definition: Uniform.h:323
ref_ptr< FloatArray > _floatArray
Definition: Uniform.h:921
#define GL_FLOAT_MAT2
Definition: GLDefines.h:108
#define GL_INT_SAMPLER_2D_RECT_EXT
Definition: GLDefines.h:268
#define OSG_EXPORT
Definition: Export.h:43
#define GL_UNSIGNED_INT_VEC4_EXT
Definition: GLDefines.h:263
#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE
Definition: GLDefines.h:388
#define GL_DOUBLE_MAT4
Definition: GLDefines.h:336
#define GL_DOUBLE_MAT2x3
Definition: GLDefines.h:337
Matrix2x4Template(const Matrix2x4Template &mat)
Definition: Uniform.h:191
bool isScalar() const
Definition: Uniform.h:905
#define GL_FLOAT_MAT4x2
Definition: GLDefines.h:159
UniformCallback * getEventCallback()
Definition: Uniform.h:854
Matrix4x3Template(const Matrix4x3Template &mat)
Definition: Uniform.h:358
#define GL_SAMPLER_1D
Definition: GLDefines.h:137
#define GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY
Definition: GLDefines.h:378
Matrix4x3Template< float > Matrix4x3
Definition: Uniform.h:394
#define GL_SAMPLER_2D_ARRAY_EXT
Definition: GLDefines.h:582
#define GL_INT_VEC4
Definition: GLDefines.h:103
#define GL_DOUBLE_MAT4x3
Definition: GLDefines.h:342
base_class::value_type value_type
Definition: Uniform.h:215
#define GL_SAMPLER_2D_RECT
Definition: GLDefines.h:393
MatrixTemplate< T, 2, 3 > base_class
Definition: Uniform.h:156
#define GL_UNSIGNED_INT_IMAGE_CUBE
Definition: GLDefines.h:383
FloatArray * getFloatArray()
Definition: Uniform.h:871
#define GL_INT_SAMPLER_2D_ARRAY_EXT
Definition: GLDefines.h:270
#define GL_UNSIGNED_INT_VEC3_EXT
Definition: GLDefines.h:262
unsigned int getNumParents() const
Definition: Uniform.h:673
#define GL_BOOL_VEC3
Definition: GLDefines.h:106
Matrix4x2Template< float > Matrix4x2
Definition: Uniform.h:393
#define GL_SAMPLER_2D_ARRAY_SHADOW_EXT
Definition: GLDefines.h:583
const value_type * ptr() const
Definition: Uniform.h:106
virtual const Uniform * asUniform() const
Definition: Uniform.h:560
#define GL_FLOAT_VEC3
Definition: GLDefines.h:99
#define GL_FLOAT_VEC4
Definition: GLDefines.h:100
#define GL_DOUBLE
Definition: GL.h:158
#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY
Definition: GLDefines.h:435
#define GL_UNSIGNED_INT_IMAGE_2D_RECT
Definition: GLDefines.h:382
#define GL_IMAGE_CUBE
Definition: GLDefines.h:361
#define GL_UNSIGNED_INT_SAMPLER_BUFFER_EXT
Definition: GLDefines.h:279
Matrix3x4Template< double > Matrix3x4d
Definition: Uniform.h:403
#define GL_IMAGE_1D_ARRAY
Definition: GLDefines.h:363
void set(value_type a00, value_type a01, value_type a10, value_type a11, value_type a20, value_type a21)
Definition: Uniform.h:232
#define GL_INT_IMAGE_CUBE_MAP_ARRAY
Definition: GLDefines.h:376
void set(value_type a00, value_type a01, value_type a02, value_type a03, value_type a10, value_type a11, value_type a12, value_type a13, value_type a20, value_type a21, value_type a22, value_type a23)
Definition: Uniform.h:303
const ParentList & getParents() const
Definition: Uniform.h:655
unsigned int _nameID
Definition: Uniform.h:916
#define GL_INT_IMAGE_BUFFER
Definition: GLDefines.h:373
#define GL_UNSIGNED_INT_VEC2_EXT
Definition: GLDefines.h:261
const IntArray * getIntArray() const
Definition: Uniform.h:880
#define GL_FLOAT_MAT2x4
Definition: GLDefines.h:156
Matrix2x4Template(value_type a00, value_type a01, value_type a02, value_type a03, value_type a10, value_type a11, value_type a12, value_type a13)
Definition: Uniform.h:192
#define GL_SAMPLER_2D_SHADOW
Definition: GLDefines.h:145
#define GL_UNSIGNED_INT_SAMPLER_1D_EXT
Definition: GLDefines.h:272
base_class::value_type value_type
Definition: Uniform.h:354
base_class::value_type value_type
Definition: Uniform.h:122
#define GL_IMAGE_2D_ARRAY
Definition: GLDefines.h:364
#define GL_BOOL_VEC2
Definition: GLDefines.h:105
#define GL_DOUBLE_MAT3x4
Definition: GLDefines.h:340
const UniformCallback * getUpdateCallback() const
Definition: Uniform.h:848
Matrix3Template(value_type a00, value_type a01, value_type a02, value_type a10, value_type a11, value_type a12, value_type a20, value_type a21, value_type a22)
Definition: Uniform.h:252
#define GL_UNSIGNED_INT_SAMPLER_2D_EXT
Definition: GLDefines.h:273
MatrixTemplate< T, 4, 2 > base_class
Definition: Uniform.h:317
Matrix2x3Template< double > Matrix2x3d
Definition: Uniform.h:398
base_class::value_type value_type
Definition: Uniform.h:247
#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE
Definition: GLDefines.h:349
#define GL_FLOAT_MAT3x4
Definition: GLDefines.h:158
Matrix3x4Template(value_type a00, value_type a01, value_type a02, value_type a03, value_type a10, value_type a11, value_type a12, value_type a13, value_type a20, value_type a21, value_type a22, value_type a23)
Definition: Uniform.h:291
#define GL_UNSIGNED_INT
Definition: GL.h:167
Matrix4x3Template< double > Matrix4x3d
Definition: Uniform.h:406
#define GL_SAMPLER_2D_MULTISAMPLE
Definition: GLDefines.h:347
#define GL_BOOL_VEC4
Definition: GLDefines.h:107
MatrixTemplate< T, 2, 4 > base_class
Definition: Uniform.h:185
#define GL_SAMPLER_1D_ARRAY_SHADOW_EXT
Definition: GLDefines.h:258
Uniform & operator=(const Uniform &)
Definition: Uniform.h:898
#define GL_FLOAT_VEC2
Definition: GLDefines.h:98
Matrix3Template< float > Matrix3
Definition: Uniform.h:390
Matrix3Template(const Matrix3Template &mat)
Definition: Uniform.h:251
UniformCallback Callback
Definition: Uniform.h:838
Matrix2x3Template(const Matrix2x3Template &mat)
Definition: Uniform.h:162
#define GL_DOUBLE_MAT3
Definition: GLDefines.h:335
unsigned int getModifiedCount() const
Definition: Uniform.h:887
Matrix3x2Template(const Matrix3x2Template &mat)
Definition: Uniform.h:219
Matrix2x4Template< double > Matrix2x4d
Definition: Uniform.h:399
Type _type
Definition: Uniform.h:914
#define GL_INT_SAMPLER_2D_EXT
Definition: GLDefines.h:265
#define GL_UNSIGNED_INT_IMAGE_2D_ARRAY
Definition: GLDefines.h:386
ref_ptr< IntArray > _intArray
Definition: Uniform.h:923
#define GL_INT_SAMPLER_3D_EXT
Definition: GLDefines.h:266
unsigned int _modifiedCount
Definition: Uniform.h:929
#define META_Object(library, name)
Definition: Object.h:42
MatrixTemplate< T, 3, 4 > base_class
Definition: Uniform.h:285
#define GL_IMAGE_2D
Definition: GLDefines.h:358
std::vector< StateSet * > ParentList
Definition: Uniform.h:652
Matrix2Template(const Matrix2Template &mat)
Definition: Uniform.h:127
#define GL_FLOAT_MAT3
Definition: GLDefines.h:109
#define GL_BOOL
Definition: GLDefines.h:104
#define GL_INT_SAMPLER_CUBE_EXT
Definition: GLDefines.h:267
#define GL_INT_SAMPLER_2D_MULTISAMPLE
Definition: GLDefines.h:348
ParentList _parents
Definition: Uniform.h:911
base_class::value_type value_type
Definition: Uniform.h:286
#define GL_INT_IMAGE_1D_ARRAY
Definition: GLDefines.h:374
#define GL_IMAGE_CUBE_MAP_ARRAY
Definition: GLDefines.h:365
#define GL_INT
Definition: GL.h:163
value_type operator()(int row, int col) const
Definition: Uniform.h:88
Matrix3x2Template< float > Matrix3x2
Definition: Uniform.h:389
Type getType() const
Definition: Uniform.h:567
MatrixTemplate< T, 4, 3 > base_class
Definition: Uniform.h:353
#define GL_SAMPLER_CUBE_MAP_ARRAY
Definition: GLDefines.h:432
#define GL_UNSIGNED_INT_IMAGE_3D
Definition: GLDefines.h:381
#define GL_IMAGE_3D
Definition: GLDefines.h:359
const FloatArray * getFloatArray() const
Definition: Uniform.h:872
UIntArray * getUIntArray()
Definition: Uniform.h:883
#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY_EXT
Definition: GLDefines.h:278
#define GL_INT_SAMPLER_BUFFER_EXT
Definition: GLDefines.h:271
#define GL_INT_IMAGE_2D
Definition: GLDefines.h:369
#define GL_SAMPLER_2D_MULTISAMPLE_ARRAY
Definition: GLDefines.h:350
#define GL_DOUBLE_VEC3
Definition: GLDefines.h:332
Matrix4x2Template< double > Matrix4x2d
Definition: Uniform.h:405
virtual Uniform * asUniform()
Definition: Uniform.h:556
Matrix4x2Template(const Matrix4x2Template &mat)
Definition: Uniform.h:322
value_type _mat[row_count][col_count]
Definition: Uniform.h:114
value_type & operator[](int i)
Definition: Uniform.h:108
#define GL_SAMPLER_3D
Definition: GLDefines.h:140
ref_ptr< DoubleArray > _doubleArray
Definition: Uniform.h:922
base_class::value_type value_type
Definition: Uniform.h:318
#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW
Definition: GLDefines.h:433
void set(value_type a00, value_type a01, value_type a02, value_type a10, value_type a11, value_type a12, value_type a20, value_type a21, value_type a22)
Definition: Uniform.h:264
Matrix3x4Template(const Matrix3x4Template &mat)
Definition: Uniform.h:290
#define GL_FLOAT_MAT2x3
Definition: GLDefines.h:155
#define GL_UNSIGNED_INT_SAMPLER_1D_ARRAY_EXT
Definition: GLDefines.h:277
#define GL_INT_IMAGE_2D_ARRAY
Definition: GLDefines.h:375
UniformCallback * getUpdateCallback()
Definition: Uniform.h:845
#define GL_SAMPLER_CUBE
Definition: GLDefines.h:133
GLint GLenum GLsizei GLsizei GLsizei GLint GLenum GLenum type
Definition: GLU.h:71
#define GL_IMAGE_2D_MULTISAMPLE
Definition: GLDefines.h:366
value_type * ptr()
Definition: Uniform.h:105
#define GL_UNSIGNED_INT_SAMPLER_CUBE_EXT
Definition: GLDefines.h:275
Matrix3x4Template< float > Matrix3x4
Definition: Uniform.h:391
#define GL_INT_SAMPLER_1D_ARRAY_EXT
Definition: GLDefines.h:269
void set(const MatrixTemplate &rhs)
Definition: Uniform.h:97
Matrix2x3Template< float > Matrix2x3
Definition: Uniform.h:386
#define GL_UNSIGNED_INT_SAMPLER_3D_EXT
Definition: GLDefines.h:274
#define GL_FLOAT_MAT4x3
Definition: GLDefines.h:160
#define GL_IMAGE_BUFFER
Definition: GLDefines.h:362
Matrix2x3Template(value_type a00, value_type a01, value_type a02, value_type a10, value_type a11, value_type a12)
Definition: Uniform.h:163
#define GL_INT_IMAGE_1D
Definition: GLDefines.h:368
ref_ptr< UIntArray > _uintArray
Definition: Uniform.h:924
value_type & operator()(int row, int col)
Definition: Uniform.h:87
const DoubleArray * getDoubleArray() const
Definition: Uniform.h:876
void set(value_type a00, value_type a01, value_type a10, value_type a11, value_type a20, value_type a21, value_type a30, value_type a31)
Definition: Uniform.h:337
#define GL_INT_VEC2
Definition: GLDefines.h:101
#define GL_UNSIGNED_INT_IMAGE_1D
Definition: GLDefines.h:379
#define GL_DOUBLE_VEC4
Definition: GLDefines.h:333
const StateSet * getParent(unsigned int i) const
Definition: Uniform.h:667
#define GL_IMAGE_1D
Definition: GLDefines.h:357
#define GL_IMAGE_2D_RECT
Definition: GLDefines.h:360
#define GL_INT_SAMPLER_CUBE_MAP_ARRAY
Definition: GLDefines.h:434
#define GL_SAMPLER_2D
Definition: GLDefines.h:132
unsigned int _numElements
Definition: Uniform.h:915
const UniformCallback * getEventCallback() const
Definition: Uniform.h:857
void set(value_type a00, value_type a01, value_type a10, value_type a11)
Definition: Uniform.h:138
#define GL_SAMPLER_2D_RECT_SHADOW
Definition: GLDefines.h:394
ref_ptr< UniformCallback > _updateCallback
Definition: Uniform.h:926
#define GL_SAMPLER_BUFFER_EXT
Definition: GLDefines.h:257
unsigned int getNumElements() const
Definition: Uniform.h:576
Definition: AlphaFunc.h:19
#define GL_DOUBLE_MAT2
Definition: GLDefines.h:334
#define GL_INT_IMAGE_3D
Definition: GLDefines.h:370
Matrix2Template(value_type a00, value_type a01, value_type a10, value_type a11)
Definition: Uniform.h:128
#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY
Definition: GLDefines.h:389
MatrixTemplate< T, 2, 2 > base_class
Definition: Uniform.h:121
#define GL_UNSIGNED_INT_SAMPLER_2D_RECT_EXT
Definition: GLDefines.h:276
#define GL_SAMPLER_1D_SHADOW
Definition: GLDefines.h:144
#define GL_INT_VEC3
Definition: GLDefines.h:102
#define GL_IMAGE_2D_MULTISAMPLE_ARRAY
Definition: GLDefines.h:367
IntArray * getIntArray()
Definition: Uniform.h:879
#define GL_DOUBLE_MAT2x4
Definition: GLDefines.h:338
#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY
Definition: GLDefines.h:352
#define GL_SAMPLER_1D_ARRAY_EXT
Definition: GLDefines.h:255
Matrix2Template< double > Matrix2d
Definition: Uniform.h:397
#define GL_UNSIGNED_INT_IMAGE_2D
Definition: GLDefines.h:380
#define GL_INT_SAMPLER_1D_EXT
Definition: GLDefines.h:264
#define GL_FLOAT_MAT3x2
Definition: GLDefines.h:157
void set(value_type a00, value_type a01, value_type a02, value_type a10, value_type a11, value_type a12)
Definition: Uniform.h:173
void set(value_type const *const ptr)
Definition: Uniform.h:99
base_class::value_type value_type
Definition: Uniform.h:186
#define GL_FLOAT_MAT4
Definition: GLDefines.h:110
#define GL_SAMPLER_CUBE_SHADOW_EXT
Definition: GLDefines.h:260
#define GL_INT_IMAGE_CUBE
Definition: GLDefines.h:372
#define GL_UNSIGNED_INT_IMAGE_BUFFER
Definition: GLDefines.h:384
MatrixTemplate< T, 3, 2 > base_class
Definition: Uniform.h:214
ParentList getParents()
Definition: Uniform.h:659
ref_ptr< UniformCallback > _eventCallback
Definition: Uniform.h:927
#define GL_UNSIGNED_INT_IMAGE_1D_ARRAY
Definition: GLDefines.h:385
Matrix2Template< float > Matrix2
Definition: Uniform.h:385
void set(value_type a00, value_type a01, value_type a02, value_type a03, value_type a10, value_type a11, value_type a12, value_type a13)
Definition: Uniform.h:202
Matrix4x3Template(value_type a00, value_type a01, value_type a02, value_type a10, value_type a11, value_type a12, value_type a20, value_type a21, value_type a22, value_type a30, value_type a31, value_type a32)
Definition: Uniform.h:359
base_class::value_type value_type
Definition: Uniform.h:157
#define GL_INT_IMAGE_2D_MULTISAMPLE
Definition: GLDefines.h:377
DoubleArray * getDoubleArray()
Definition: Uniform.h:875
Matrix3Template< double > Matrix3d
Definition: Uniform.h:402
const UIntArray * getUIntArray() const
Definition: Uniform.h:884
Matrix3x2Template(value_type a00, value_type a01, value_type a10, value_type a11, value_type a20, value_type a21)
Definition: Uniform.h:220
void setModifiedCount(unsigned int mc)
Definition: Uniform.h:886
#define GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY
Definition: GLDefines.h:351
StateSet * getParent(unsigned int i)
Definition: Uniform.h:661
void dirty()
Definition: Uniform.h:862
MatrixTemplate & operator=(const MatrixTemplate &rhs)
Definition: Uniform.h:90
#define GL_DOUBLE_MAT3x2
Definition: GLDefines.h:339
#define GL_INT_IMAGE_2D_RECT
Definition: GLDefines.h:371
#define GL_DOUBLE_MAT4x2
Definition: GLDefines.h:341
#define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY
Definition: GLDefines.h:387