@ -34,29 +34,29 @@ traits.
# ifdef DOXYGEN_GENERATING_OUTPUT
template < class T > struct TypeTraits : public Math : : TypeTraits < T > {
/**
* @ brief Type which can be used for indices
* @ brief OpenGL plain type ID
*
* Implemented only in types which can be used for vertex indices ( all
* unsigned types ) . This typedef is not present for types unusable for
* vertex indices , like GLfloat or GLint .
* Returns e . g . Type : : UnsignedInt for GLuint .
*/
typedef T IndexType ;
constexpr inline static Type type ( ) ;
/**
* @ brief Type which can be used in textur es
* @ brief OpenGL type ID for indic es
*
* Implemented only in types which can be used for texture data , like
* GLubyte . This typedef is not present for types unusable for texture data ,
* like GLdouble and Matrix3 .
* Implemented only in types which can be used for vertex indices ( all
* unsigned types ) . This function is not present for types unusable for
* vertex indices , like GLfloat or GLint .
*/
typedef T TextureType ;
constexpr inline static Type indexType ( ) ;
/**
* @ brief OpenGL plain type ID
* @ brief OpenGL type ID for images
*
* Returns e . g . Type : : UnsignedInt for GLuint .
* Implemented only in types which can be used for image data , like
* GLubyte . This function is not present for types unusable for image data ,
* like GLdouble and Matrix3 .
*/
constexpr inline static Type glType ( ) ;
constexpr inline static Type image Type( ) ;
/**
* @ brief Size of plain OpenGL type
@ -96,8 +96,8 @@ When you want to use TypeTraits on type specified only as enum value, you can
use this class to convert it into type , for example these two statements
are equivalent :
@ code
TypeTraits < TypeOf < Type : : UnsignedByte > : : Type > : : TextureType data ;
TypeTraits < GLubyte > : : TextureType data ;
type = TypeTraits < TypeOf < Type : : UnsignedByte > : : Type > : : imageType ( ) ;
type = TypeTraits < GLubyte > : : imageType ( ) ;
@ endcode
*/
template < Type T > class TypeOf {
@ -147,82 +147,73 @@ template<> struct TypeOf<Type::Float> { typedef GLfloat Type; };
template < > struct TypeOf < Type : : Double > { typedef GLdouble Type ; } ;
template < > struct TypeTraits < GLubyte > : public Math : : TypeTraits < unsigned char > {
typedef GLubyte IndexType ;
typedef GLubyte TextureType ;
inline constexpr static Type glType ( ) { return Type : : UnsignedByte ; }
inline constexpr static Type type ( ) { return Type : : UnsignedByte ; }
inline constexpr static Type indexType ( ) { return Type : : UnsignedByte ; }
inline constexpr static Type imageType ( ) { return Type : : UnsignedByte ; }
inline constexpr static size_t size ( ) { return sizeof ( GLubyte ) ; }
inline constexpr static size_t count ( ) { return 1 ; }
} ;
template < > struct TypeTraits < GLbyte > : public Math : : TypeTraits < char > {
inline constexpr static Type type ( ) { return Type : : Byte ; }
/* Can not be used for indices */
typedef GLbyte TextureType ;
inline constexpr static Type glType ( ) { return Type : : Byte ; }
inline constexpr static Type imageType ( ) { return Type : : Byte ; }
inline constexpr static size_t size ( ) { return sizeof ( GLbyte ) ; }
inline constexpr static size_t count ( ) { return 1 ; }
} ;
template < > struct TypeTraits < GLushort > : public Math : : TypeTraits < unsigned short > {
typedef GLushort IndexType ;
typedef GLushort TextureType ;
inline constexpr static Type glType ( ) { return Type : : UnsignedShort ; }
inline constexpr static Type type ( ) { return Type : : UnsignedShort ; }
inline constexpr static Type indexType ( ) { return Type : : UnsignedShort ; }
inline constexpr static Type imageType ( ) { return Type : : UnsignedShort ; }
inline constexpr static size_t size ( ) { return sizeof ( GLushort ) ; }
inline constexpr static size_t count ( ) { return 1 ; }
} ;
template < > struct TypeTraits < GLshort > : public Math : : TypeTraits < short > {
inline constexpr static Type type ( ) { return Type : : Short ; }
/* Can not be used for indices */
typedef GLshort TextureType ;
inline constexpr static Type glType ( ) { return Type : : Short ; }
inline constexpr static Type imageType ( ) { return Type : : Short ; }
inline constexpr static size_t size ( ) { return sizeof ( GLshort ) ; }
inline constexpr static size_t count ( ) { return 1 ; }
} ;
template < > struct TypeTraits < GLuint > : public Math : : TypeTraits < unsigned int > {
typedef GLuint IndexType ;
typedef GLuint TextureType ;
inline constexpr static Type glType ( ) { return Type : : UnsignedInt ; }
inline constexpr static Type type ( ) { return Type : : UnsignedInt ; }
inline constexpr static Type indexType ( ) { return Type : : UnsignedInt ; }
inline constexpr static Type imageType ( ) { return Type : : UnsignedInt ; }
inline constexpr static size_t size ( ) { return sizeof ( GLuint ) ; }
inline constexpr static size_t count ( ) { return 1 ; }
} ;
template < > struct TypeTraits < GLint > : public Math : : TypeTraits < int > {
inline constexpr static Type type ( ) { return Type : : Int ; }
/* Can not be used for indices */
typedef GLint TextureType ;
inline constexpr static Type glType ( ) { return Type : : Int ; }
inline constexpr static Type imageType ( ) { return Type : : Int ; }
inline constexpr static size_t size ( ) { return sizeof ( GLint ) ; }
inline constexpr static size_t count ( ) { return 1 ; }
} ;
template < > struct TypeTraits < GLfloat > : public Math : : TypeTraits < float > {
inline constexpr static Type type ( ) { return Type : : Float ; }
/* Can not be used for indices */
typedef GLfloat TextureType ;
inline constexpr static Type glType ( ) { return Type : : Float ; }
inline constexpr static Type imageType ( ) { return Type : : Float ; }
inline constexpr static size_t size ( ) { return sizeof ( GLfloat ) ; }
inline constexpr static size_t count ( ) { return 1 ; }
} ;
template < > struct TypeTraits < GLdouble > : public Math : : TypeTraits < double > {
inline constexpr static Type type ( ) { return Type : : Double ; }
/* Can not be used for indices */
/* Can not be used for textures */
inline constexpr static Type glType ( ) { return Type : : Double ; }
/* Can not be used for images */
inline constexpr static size_t size ( ) { return sizeof ( GLdouble ) ; }
inline constexpr static size_t count ( ) { return 1 ; }
} ;
template < class T , size_t vectorSize > struct TypeTraits < Math : : Vector < T , vectorSize > > {
inline constexpr static Type type ( ) { return TypeTraits < T > : : type ( ) ; }
/* Can not be used for indices */
/* Can not be used for textures */
inline constexpr static Type glType ( ) { return TypeTraits < T > : : glType ( ) ; }
/* Can not be used for images */
inline constexpr static size_t size ( ) { return sizeof ( T ) ; }
inline constexpr static size_t count ( ) { return vectorSize ; }
} ;
@ -232,10 +223,9 @@ template<class T> struct TypeTraits<Math::Vector3<T>>: public TypeTraits<Math::V
template < class T > struct TypeTraits < Math : : Vector4 < T > > : public TypeTraits < Math : : Vector < T , 4 > > { } ;
template < class T , size_t matrixSize > struct TypeTraits < Math : : Matrix < T , matrixSize > > {
inline constexpr static Type type ( ) { return TypeTraits < T > : : type ( ) ; }
/* Can not be used for indices */
/* Can not be used for textures, obviously */
inline constexpr static Type glType ( ) { return TypeTraits < T > : : glType ( ) ; }
/* Can not be used for images */
inline constexpr static size_t size ( ) { return sizeof ( T ) ; }
inline constexpr static size_t count ( ) { return matrixSize * matrixSize ; }
} ;