Browse Source

Minor renaming in shader/mesh guts.

Function size() will be used later for commputing size of the attribute,
renaming the original to components().
pull/7/head
Vladimír Vondruš 13 years ago
parent
commit
fbeb7b02bc
  1. 28
      src/AbstractShaderProgram.h
  2. 6
      src/Mesh.h

28
src/AbstractShaderProgram.h

@ -1093,24 +1093,24 @@ template<> struct Attribute<GLfloat> {
static const DataType DefaultDataType = DataType::Float;
inline constexpr static GLint size(DataOptions) { return 1; }
inline constexpr static GLint components(DataOptions) { return 1; }
inline constexpr static std::size_t vectorCount() { return 1; }
};
CORRADE_ENUMSET_OPERATORS(Attribute<GLfloat>::DataOptions)
template<std::size_t vectorSize> struct Attribute<Math::Vector<vectorSize, GLfloat>>: public Attribute<GLfloat> {
inline constexpr static GLint size(DataOptions) { return vectorSize; }
inline constexpr static GLint components(DataOptions) { return vectorSize; }
inline constexpr static std::size_t vectorCount() { return 1; }
};
template<std::size_t cols, std::size_t rows> struct Attribute<Math::RectangularMatrix<cols, rows, GLfloat>>: public Attribute<GLfloat> {
inline constexpr static GLint size(DataOptions) { return rows; }
inline constexpr static GLint components(DataOptions) { return rows; }
inline constexpr static std::size_t vectorCount() { return cols; }
};
template<std::size_t matrixSize> struct Attribute<Math::Matrix<matrixSize, GLfloat>>: public Attribute<GLfloat> {
inline constexpr static GLint size(DataOptions) { return matrixSize; }
inline constexpr static GLint components(DataOptions) { return matrixSize; }
inline constexpr static std::size_t vectorCount() { return matrixSize; }
};
@ -1153,11 +1153,11 @@ template<> struct Attribute<Math::Vector<4, GLfloat>> {
static const DataType DefaultDataType = DataType::Float;
#ifndef MAGNUM_TARGET_GLES
inline constexpr static GLint size(DataOptions options) {
inline constexpr static GLint components(DataOptions options) {
return options & DataOption::BGRA ? GL_BGRA : 4;
}
#else
inline constexpr static GLint size(DataOptions) { return 4; }
inline constexpr static GLint components(DataOptions) { return 4; }
#endif
inline constexpr static std::size_t vectorCount() { return 1; }
@ -1182,7 +1182,7 @@ template<> struct Attribute<GLint> {
static const DataType DefaultDataType = DataType::Int;
inline constexpr static GLint size() { return 1; }
inline constexpr static GLint components() { return 1; }
};
template<> struct Attribute<GLuint> {
@ -1193,15 +1193,15 @@ template<> struct Attribute<GLuint> {
static const DataType DefaultDataType = DataType::UnsignedInt;
inline constexpr static GLint size() { return 1; }
inline constexpr static GLint components() { return 1; }
};
template<std::size_t size> struct Attribute<Math::Vector<size, GLint>>: public Attribute<GLint> {
inline constexpr static GLint size() { return size; }
inline constexpr static GLint components() { return size; }
};
template<std::size_t size> struct Attribute<Math::Vector<size, GLuint>>: public Attribute<GLuint> {
inline constexpr static GLint size() { return size; }
inline constexpr static GLint components() { return size; }
};
#ifndef MAGNUM_TARGET_GLES
@ -1216,22 +1216,22 @@ template<> struct Attribute<GLdouble> {
static const DataType DefaultDataType = DataType::Double;
inline constexpr static GLint size() { return 1; }
inline constexpr static GLint components() { return 1; }
inline constexpr static std::size_t vectorCount() { return 1; }
};
template<std::size_t cols, std::size_t rows> struct Attribute<Math::RectangularMatrix<cols, rows, GLdouble>>: public Attribute<GLdouble> {
inline constexpr static GLint size() { return rows; }
inline constexpr static GLint components() { return rows; }
inline constexpr static std::size_t vectorCount() { return cols; }
};
template<std::size_t size> struct Attribute<Math::Matrix<size, GLdouble>>: public Attribute<GLdouble> {
inline constexpr static GLint size() { return size; }
inline constexpr static GLint components() { return size; }
inline constexpr static std::size_t vectorCount() { return size; }
};
template<std::size_t size> struct Attribute<Math::Vector<size, GLdouble>>: public Attribute<GLdouble> {
inline constexpr static GLint size() { return size; }
inline constexpr static GLint components() { return size; }
inline constexpr static std::size_t vectorCount() { return size; }
};
#endif

6
src/Mesh.h

@ -632,7 +632,7 @@ class MAGNUM_EXPORT Mesh {
attributes.push_back({
buffer,
location+i,
Implementation::Attribute<T>::size(attribute.dataOptions()),
Implementation::Attribute<T>::components(attribute.dataOptions()),
static_cast<GLenum>(attribute.dataType()),
!!(attribute.dataOptions() & AbstractShaderProgram::Attribute<location, T>::DataOption::Normalized),
offset,
@ -648,7 +648,7 @@ class MAGNUM_EXPORT Mesh {
integerAttributes.push_back({
buffer,
location,
Implementation::Attribute<T>::size(),
Implementation::Attribute<T>::components(),
static_cast<GLenum>(attribute.dataType()),
offset,
stride
@ -663,7 +663,7 @@ class MAGNUM_EXPORT Mesh {
longAttributes.push_back({
buffer,
location+i,
Implementation::Attribute<T>::size(),
Implementation::Attribute<T>::components(),
static_cast<GLenum>(attribute.dataType()),
offset,
stride

Loading…
Cancel
Save