22 #include <osg/ref_ptr>
24 #include <osg/Callback>
32 #include <osg/GLExtensions>
72 template <
typename T,
unsigned int RowN,
unsigned int ColN>
92 if( &rhs ==
this )
return *
this;
99 void set(value_type
const *
const ptr)
101 value_type* local_ptr = (value_type*)
_mat;
102 for(
int i=0;i<
value_count;++i) local_ptr[i]=ptr[i];
105 value_type*
ptr() {
return (value_type*)
_mat; }
106 const value_type*
ptr()
const {
return (
const value_type*)
_mat; }
117 template <
typename T>
129 value_type a10, value_type a11 )
138 void set(value_type a00, value_type a01,
139 value_type a10, value_type a11 )
152 template <
typename T>
164 value_type a10, value_type a11, value_type a12 )
173 void set( value_type a00, value_type a01, value_type a02,
174 value_type a10, value_type a11, value_type a12 )
181 template <
typename T>
193 value_type a10, value_type a11, value_type a12, value_type a13 )
195 set( a00, a01, a02, a03,
196 a10, a11, a12, a13 );
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 )
210 template <
typename T>
221 value_type a10, value_type a11,
222 value_type a20, value_type a21 )
232 void set( value_type a00, value_type a01,
233 value_type a10, value_type a11,
234 value_type a20, value_type a21 )
242 template <
typename T>
253 value_type a10, value_type a11, value_type a12,
254 value_type a20, value_type a21, value_type a22 )
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 )
281 template <
typename T>
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 )
295 set( a00, a01, a02, a03,
297 a20, a21, a22, a23 );
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 )
313 template <
typename T>
324 value_type a10, value_type a11,
325 value_type a20, value_type a21,
326 value_type a30, value_type a31 )
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 )
349 template <
typename T>
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 )
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 )
547 Uniform( Type
type,
const std::string& name,
int numElements=1 );
564 bool setType( Type t );
570 virtual void setName(
const std::string& name );
573 void setNumElements(
unsigned int numElements );
580 unsigned int getInternalArrayNumElements()
const;
583 static const char* getTypename( Type t );
586 static int getTypeNumComponents( Type t );
592 static Type getGlApiType( Type t );
595 static GLenum getInternalArrayType( Type t );
598 static unsigned int getNameID(
const std::string& name);
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 );
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 );
641 virtual int compare(
const Uniform& rhs)
const;
642 virtual int compareData(
const Uniform& rhs)
const;
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; }
648 void copyData(
const Uniform& rhs );
655 inline const ParentList&
getParents()
const {
return _parents; }
673 inline unsigned int getNumParents()
const {
return static_cast<unsigned int>(_parents.size()); }
678 bool set(
double d );
680 bool set(
unsigned int ui );
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 );
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;
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;
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 );
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 );
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;
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;
862 inline void dirty() { ++_modifiedCount; }
890 unsigned int getNameID()
const;
892 void apply(
const GLExtensions* ext, GLint location)
const;
900 bool isCompatibleType( Type t )
const;
904 bool isCompatibleType( Type t1, Type t2 )
const;
906 void allocateDataArray();
Matrix2x4Template< float > Matrix2x4
MatrixTemplate< T, 3, 3 > base_class
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)
Matrix3x2Template< double > Matrix3x2d
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)
#define GL_INT_SAMPLER_2D_RECT_EXT
#define GL_UNSIGNED_INT_VEC4_EXT
#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE
Matrix2x4Template(const Matrix2x4Template &mat)
Matrix4x3Template(const Matrix4x3Template &mat)
#define GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY
Matrix4x3Template< float > Matrix4x3
#define GL_SAMPLER_2D_ARRAY_EXT
base_class::value_type value_type
#define GL_SAMPLER_2D_RECT
MatrixTemplate< T, 2, 3 > base_class
#define GL_UNSIGNED_INT_IMAGE_CUBE
#define GL_INT_SAMPLER_2D_ARRAY_EXT
#define GL_UNSIGNED_INT_VEC3_EXT
Matrix4x2Template< float > Matrix4x2
#define GL_SAMPLER_2D_ARRAY_SHADOW_EXT
const value_type * ptr() const
#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY
#define GL_UNSIGNED_INT_IMAGE_2D_RECT
#define GL_UNSIGNED_INT_SAMPLER_BUFFER_EXT
Matrix3x4Template< double > Matrix3x4d
#define GL_IMAGE_1D_ARRAY
void set(value_type a00, value_type a01, value_type a10, value_type a11, value_type a20, value_type a21)
#define GL_INT_IMAGE_CUBE_MAP_ARRAY
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)
#define GL_INT_IMAGE_BUFFER
#define GL_UNSIGNED_INT_VEC2_EXT
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)
#define GL_SAMPLER_2D_SHADOW
#define GL_UNSIGNED_INT_SAMPLER_1D_EXT
base_class::value_type value_type
base_class::value_type value_type
#define GL_IMAGE_2D_ARRAY
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)
#define GL_UNSIGNED_INT_SAMPLER_2D_EXT
MatrixTemplate< T, 4, 2 > base_class
Matrix2x3Template< double > Matrix2x3d
base_class::value_type value_type
#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE
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)
Matrix4x3Template< double > Matrix4x3d
#define GL_SAMPLER_2D_MULTISAMPLE
MatrixTemplate< T, 2, 4 > base_class
#define GL_SAMPLER_1D_ARRAY_SHADOW_EXT
Matrix3Template< float > Matrix3
Matrix3Template(const Matrix3Template &mat)
Matrix2x3Template(const Matrix2x3Template &mat)
Matrix3x2Template(const Matrix3x2Template &mat)
Matrix2x4Template< double > Matrix2x4d
#define GL_INT_SAMPLER_2D_EXT
#define GL_UNSIGNED_INT_IMAGE_2D_ARRAY
#define GL_INT_SAMPLER_3D_EXT
#define META_Object(library, name)
MatrixTemplate< T, 3, 4 > base_class
Matrix2Template(const Matrix2Template &mat)
#define GL_INT_SAMPLER_CUBE_EXT
#define GL_INT_SAMPLER_2D_MULTISAMPLE
base_class::value_type value_type
#define GL_INT_IMAGE_1D_ARRAY
#define GL_IMAGE_CUBE_MAP_ARRAY
value_type operator()(int row, int col) const
Matrix3x2Template< float > Matrix3x2
MatrixTemplate< T, 4, 3 > base_class
#define GL_SAMPLER_CUBE_MAP_ARRAY
#define GL_UNSIGNED_INT_IMAGE_3D
#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY_EXT
#define GL_INT_SAMPLER_BUFFER_EXT
#define GL_SAMPLER_2D_MULTISAMPLE_ARRAY
Matrix4x2Template< double > Matrix4x2d
Matrix4x2Template(const Matrix4x2Template &mat)
value_type _mat[row_count][col_count]
value_type & operator[](int i)
base_class::value_type value_type
#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW
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)
Matrix3x4Template(const Matrix3x4Template &mat)
#define GL_UNSIGNED_INT_SAMPLER_1D_ARRAY_EXT
#define GL_INT_IMAGE_2D_ARRAY
GLint GLenum GLsizei GLsizei GLsizei GLint GLenum GLenum type
#define GL_IMAGE_2D_MULTISAMPLE
#define GL_UNSIGNED_INT_SAMPLER_CUBE_EXT
Matrix3x4Template< float > Matrix3x4
#define GL_INT_SAMPLER_1D_ARRAY_EXT
void set(const MatrixTemplate &rhs)
Matrix2x3Template< float > Matrix2x3
#define GL_UNSIGNED_INT_SAMPLER_3D_EXT
Matrix2x3Template(value_type a00, value_type a01, value_type a02, value_type a10, value_type a11, value_type a12)
value_type & operator()(int row, int col)
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)
#define GL_UNSIGNED_INT_IMAGE_1D
#define GL_INT_SAMPLER_CUBE_MAP_ARRAY
void set(value_type a00, value_type a01, value_type a10, value_type a11)
#define GL_SAMPLER_2D_RECT_SHADOW
#define GL_SAMPLER_BUFFER_EXT
Matrix2Template(value_type a00, value_type a01, value_type a10, value_type a11)
#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY
MatrixTemplate< T, 2, 2 > base_class
#define GL_UNSIGNED_INT_SAMPLER_2D_RECT_EXT
#define GL_SAMPLER_1D_SHADOW
#define GL_IMAGE_2D_MULTISAMPLE_ARRAY
#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY
#define GL_SAMPLER_1D_ARRAY_EXT
Matrix2Template< double > Matrix2d
#define GL_UNSIGNED_INT_IMAGE_2D
#define GL_INT_SAMPLER_1D_EXT
void set(value_type a00, value_type a01, value_type a02, value_type a10, value_type a11, value_type a12)
void set(value_type const *const ptr)
base_class::value_type value_type
#define GL_SAMPLER_CUBE_SHADOW_EXT
#define GL_INT_IMAGE_CUBE
#define GL_UNSIGNED_INT_IMAGE_BUFFER
MatrixTemplate< T, 3, 2 > base_class
#define GL_UNSIGNED_INT_IMAGE_1D_ARRAY
Matrix2Template< float > Matrix2
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)
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)
base_class::value_type value_type
#define GL_INT_IMAGE_2D_MULTISAMPLE
Matrix3Template< double > Matrix3d
Matrix3x2Template(value_type a00, value_type a01, value_type a10, value_type a11, value_type a20, value_type a21)
#define GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY
MatrixTemplate & operator=(const MatrixTemplate &rhs)
#define GL_INT_IMAGE_2D_RECT
#define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY