Browse Source

Using new type aliases in whole root Magnum namespace.

pull/278/head
Vladimír Vondruš 13 years ago
parent
commit
2d2d1c07f4
  1. 46
      src/AbstractShaderProgram.cpp
  2. 232
      src/AbstractShaderProgram.h
  3. 8
      src/AbstractTexture.cpp
  4. 16
      src/AbstractTexture.h
  5. 16
      src/Array.h
  6. 2
      src/BufferImage.cpp
  7. 10
      src/BufferImage.h
  8. 2
      src/BufferTexture.h
  9. 4
      src/Color.h
  10. 10
      src/Context.h
  11. 12
      src/CubeMapTexture.h
  12. 18
      src/CubeMapTextureArray.h
  13. 2
      src/DefaultFramebuffer.cpp
  14. 2
      src/DefaultFramebuffer.h
  15. 26
      src/DimensionTraits.h
  16. 4
      src/Framebuffer.cpp
  17. 12
      src/Framebuffer.h
  18. 2
      src/Image.cpp
  19. 12
      src/Image.h
  20. 12
      src/ImageWrapper.h
  21. 22
      src/Magnum.h
  22. 2
      src/Mesh.cpp
  23. 48
      src/Mesh.h
  24. 16
      src/Query.cpp
  25. 32
      src/Query.h
  26. 28
      src/Renderer.h
  27. 2
      src/Resource.h
  28. 12
      src/ResourceManager.h
  29. 8
      src/Test/AbstractShaderProgramTest.cpp
  30. 10
      src/Test/ColorTest.cpp
  31. 24
      src/Test/ResourceManagerTest.cpp
  32. 16
      src/Test/SwizzleTest.cpp
  33. 16
      src/Texture.h
  34. 4
      src/Timeline.cpp
  35. 14
      src/Timeline.h

46
src/AbstractShaderProgram.cpp

@ -29,16 +29,16 @@
namespace Magnum { namespace Magnum {
#ifndef DOXYGEN_GENERATING_OUTPUT #ifndef DOXYGEN_GENERATING_OUTPUT
static_assert(std::is_same<GLubyte, std::uint8_t>::value, "GLubyte is not the same as std::uint8_t"); static_assert(std::is_same<GLubyte, UnsignedByte>::value, "GLubyte is not the same as UnsignedByte");
static_assert(std::is_same<GLbyte, std::int8_t>::value, "GLbyte is not the same as std::int8_t"); static_assert(std::is_same<GLbyte, Byte>::value, "GLbyte is not the same as Byte");
static_assert(std::is_same<GLushort, std::uint16_t>::value, "GLushort is not the same as std::uint16_t"); static_assert(std::is_same<GLushort, UnsignedShort>::value, "GLushort is not the same as UnsignedShort");
static_assert(std::is_same<GLshort, std::int16_t>::value, "GLshort is not the same as std::int16_t"); static_assert(std::is_same<GLshort, Short>::value, "GLshort is not the same as Short");
static_assert(std::is_same<GLuint, std::uint32_t>::value, "GLuint is not the same as std::uint32_t"); static_assert(std::is_same<GLuint, UnsignedInt>::value, "GLuint is not the same as UnsignedInt");
static_assert(std::is_same<GLint, std::int32_t>::value, "GLint is not the same as std::int32_t"); static_assert(std::is_same<GLint, Int>::value, "GLint is not the same as Int");
static_assert(std::is_same<GLsizei, std::int32_t>::value, "GLsizei is not the same as std::int32_t"); static_assert(std::is_same<GLsizei, Int>::value, "GLsizei is not the same as Int");
static_assert(std::is_same<GLfloat, float>::value, "GLfloat is not the same as float"); static_assert(std::is_same<GLfloat, Float>::value, "GLfloat is not the same as Float");
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
static_assert(std::is_same<GLdouble, double>::value, "GLdouble is not the same as double"); static_assert(std::is_same<GLdouble, Double>::value, "GLdouble is not the same as Double");
#endif #endif
#endif #endif
@ -86,7 +86,7 @@ AbstractShaderProgram::UniformMatrix3x4dvImplementation AbstractShaderProgram::u
AbstractShaderProgram::UniformMatrix4x3dvImplementation AbstractShaderProgram::uniformMatrix4x3dvImplementation = &AbstractShaderProgram::uniformImplementationDefault; AbstractShaderProgram::UniformMatrix4x3dvImplementation AbstractShaderProgram::uniformMatrix4x3dvImplementation = &AbstractShaderProgram::uniformImplementationDefault;
#endif #endif
GLint AbstractShaderProgram::maxSupportedVertexAttributeCount() { Int AbstractShaderProgram::maxSupportedVertexAttributeCount() {
GLint& value = Context::current()->state()->shaderProgram->maxSupportedVertexAttributeCount; GLint& value = Context::current()->state()->shaderProgram->maxSupportedVertexAttributeCount;
/* Get the value, if not already cached */ /* Get the value, if not already cached */
@ -121,19 +121,19 @@ bool AbstractShaderProgram::attachShader(Shader& shader) {
return true; return true;
} }
void AbstractShaderProgram::bindAttributeLocation(GLuint location, const std::string& name) { void AbstractShaderProgram::bindAttributeLocation(UnsignedInt location, const std::string& name) {
CORRADE_ASSERT(state == Initialized, "AbstractShaderProgram: attribute cannot be bound after linking.", ); CORRADE_ASSERT(state == Initialized, "AbstractShaderProgram: attribute cannot be bound after linking.", );
glBindAttribLocation(_id, location, name.c_str()); glBindAttribLocation(_id, location, name.c_str());
} }
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
void AbstractShaderProgram::bindFragmentDataLocation(GLuint location, const std::string& name) { void AbstractShaderProgram::bindFragmentDataLocation(UnsignedInt location, const std::string& name) {
CORRADE_ASSERT(state == Initialized, "AbstractShaderProgram: fragment data location cannot be bound after linking.", ); CORRADE_ASSERT(state == Initialized, "AbstractShaderProgram: fragment data location cannot be bound after linking.", );
glBindFragDataLocation(_id, location, name.c_str()); glBindFragDataLocation(_id, location, name.c_str());
} }
void AbstractShaderProgram::bindFragmentDataLocationIndexed(GLuint location, GLuint index, const std::string& name) { void AbstractShaderProgram::bindFragmentDataLocationIndexed(UnsignedInt location, UnsignedInt index, const std::string& name) {
CORRADE_ASSERT(state == Initialized, "AbstractShaderProgram: fragment data location cannot be bound after linking.", ); CORRADE_ASSERT(state == Initialized, "AbstractShaderProgram: fragment data location cannot be bound after linking.", );
glBindFragDataLocationIndexed(_id, location, index, name.c_str()); glBindFragDataLocationIndexed(_id, location, index, name.c_str());
@ -169,7 +169,7 @@ void AbstractShaderProgram::link() {
state = status == GL_FALSE ? Failed : Linked; state = status == GL_FALSE ? Failed : Linked;
} }
GLint AbstractShaderProgram::uniformLocation(const std::string& name) { Int AbstractShaderProgram::uniformLocation(const std::string& name) {
/** @todo What if linking just failed (not programmer error?) */ /** @todo What if linking just failed (not programmer error?) */
CORRADE_ASSERT(state == Linked, "AbstractShaderProgram: uniform location cannot be retrieved before linking.", -1); CORRADE_ASSERT(state == Linked, "AbstractShaderProgram: uniform location cannot be retrieved before linking.", -1);
@ -640,7 +640,7 @@ std::size_t DoubleAttribute::size(GLint components, DataType dataType) {
} }
#endif #endif
std::size_t Attribute<Math::Vector<4, GLfloat>>::size(GLint components, DataType dataType) { std::size_t Attribute<Math::Vector<4, Float>>::size(GLint components, DataType dataType) {
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
if(components == GL_BGRA) components = 4; if(components == GL_BGRA) components = 4;
#endif #endif
@ -749,18 +749,18 @@ Debug operator<<(Debug debug, SizedMatrixAttribute<4>::Components value) {
return debug << "AbstractShaderProgram::Attribute::Components::(invalid)"; return debug << "AbstractShaderProgram::Attribute::Components::(invalid)";
} }
Debug operator<<(Debug debug, Attribute<Math::Vector<4, GLfloat>>::Components value) { Debug operator<<(Debug debug, Attribute<Math::Vector<4, Float>>::Components value) {
switch(value) { switch(value) {
case Attribute<Math::Vector<4, GLfloat>>::Components::One: case Attribute<Math::Vector<4, Float>>::Components::One:
return debug << "AbstractShaderProgram::Attribute::Components::One"; return debug << "AbstractShaderProgram::Attribute::Components::One";
case Attribute<Math::Vector<4, GLfloat>>::Components::Two: case Attribute<Math::Vector<4, Float>>::Components::Two:
return debug << "AbstractShaderProgram::Attribute::Components::Two"; return debug << "AbstractShaderProgram::Attribute::Components::Two";
case Attribute<Math::Vector<4, GLfloat>>::Components::Three: case Attribute<Math::Vector<4, Float>>::Components::Three:
return debug << "AbstractShaderProgram::Attribute::Components::Three"; return debug << "AbstractShaderProgram::Attribute::Components::Three";
case Attribute<Math::Vector<4, GLfloat>>::Components::Four: case Attribute<Math::Vector<4, Float>>::Components::Four:
return debug << "AbstractShaderProgram::Attribute::Components::Four"; return debug << "AbstractShaderProgram::Attribute::Components::Four";
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
case Attribute<Math::Vector<4, GLfloat>>::Components::BGRA: case Attribute<Math::Vector<4, Float>>::Components::BGRA:
return debug << "AbstractShaderProgram::Attribute::Components::BGRA"; return debug << "AbstractShaderProgram::Attribute::Components::BGRA";
#endif #endif
} }
@ -817,9 +817,9 @@ Debug operator<<(Debug debug, DoubleAttribute::DataType value) {
} }
#endif #endif
Debug operator<<(Debug debug, Attribute<Math::Vector<4, GLfloat>>::DataType value) { Debug operator<<(Debug debug, Attribute<Math::Vector<4, Float>>::DataType value) {
switch(value) { switch(value) {
#define _c(value) case Attribute<Math::Vector<4, GLfloat>>::DataType::value: return debug << "AbstractShaderProgram::Attribute::DataType::" #value; #define _c(value) case Attribute<Math::Vector<4, Float>>::DataType::value: return debug << "AbstractShaderProgram::Attribute::DataType::" #value;
_c(UnsignedByte) _c(UnsignedByte)
_c(Byte) _c(Byte)
_c(UnsignedShort) _c(UnsignedShort)

232
src/AbstractShaderProgram.h

@ -52,7 +52,7 @@ typedef Attribute<2, Vector2> TextureCoordinates;
@endcode @endcode
- **Output attribute locations**, if desired, for example: - **Output attribute locations**, if desired, for example:
@code @code
enum: GLuint { enum: UnsignedInt {
ColorOutput = 0, ColorOutput = 0,
NormalOutput = 1 NormalOutput = 1
}; };
@ -60,7 +60,7 @@ enum: GLuint {
- **Layers for texture uniforms** to which the textures will be bound before - **Layers for texture uniforms** to which the textures will be bound before
rendering, for example: rendering, for example:
@code @code
enum: GLint { enum: Int {
DiffuseTextureLayer = 0, DiffuseTextureLayer = 0,
SpecularTextureLayer = 1 SpecularTextureLayer = 1
}; };
@ -68,7 +68,7 @@ enum: GLint {
- **Uniform locations** for setting uniform data (see below) (private - **Uniform locations** for setting uniform data (see below) (private
variables), for example: variables), for example:
@code @code
GLint TransformationUniform = 0, Int TransformationUniform = 0,
ProjectionUniform = 1, ProjectionUniform = 1,
DiffuseTextureUniform = 2, DiffuseTextureUniform = 2,
SpecularTextureUniform = 3; SpecularTextureUniform = 3;
@ -164,8 +164,8 @@ layout(location = 1) uniform mat4 projection;
If you don't have the required extension, you can get uniform location using If you don't have the required extension, you can get uniform location using
uniformLocation() after linking stage: uniformLocation() after linking stage:
@code @code
GLint transformationUniform = uniformLocation("transformation"); Int transformationUniform = uniformLocation("transformation");
GLint projectionUniform = uniformLocation("projection"); Int projectionUniform = uniformLocation("projection");
@endcode @endcode
@requires_gl43 %Extension @extension{ARB,explicit_uniform_location} for @requires_gl43 %Extension @extension{ARB,explicit_uniform_location} for
@ -185,16 +185,16 @@ layout(binding = 1) uniform sampler2D specularTexture;
@endcode @endcode
If you don't have the required extension (or if you want to change the layer If you don't have the required extension (or if you want to change the layer
later), you can set the texture layer uniform using setUniform(GLint, GLint): later), you can set the texture layer uniform using setUniform(Int, Int):
@code @code
setUniform(DiffuseTextureUniform, DiffuseTextureLayer); setUniform(DiffuseTextureUniform, DiffuseTextureLayer);
setUniform(SpecularTextureUniform, SpecularTextureLayer); setUniform(SpecularTextureUniform, SpecularTextureLayer);
@endcode @endcode
@requires_gl42 %Extension @extension{ARB,shading_language_420pack} for explicit @requires_gl42 %Extension @extension{ARB,shading_language_420pack} for explicit
texture layer binding instead of using setUniform(GLint, GLint). texture layer binding instead of using setUniform(Int, Int).
@requires_gl Explicit texture layer binding is not supported in OpenGL ES. Use @requires_gl Explicit texture layer binding is not supported in OpenGL ES. Use
setUniform(GLint, GLint) instead. setUniform(Int, Int) instead.
@section AbstractShaderProgram-rendering-workflow Rendering workflow @section AbstractShaderProgram-rendering-workflow Rendering workflow
@ -204,7 +204,7 @@ for more information) and map shader outputs to framebuffer attachments if
needed (see @ref Framebuffer-usage "Framebuffer documentation" for more needed (see @ref Framebuffer-usage "Framebuffer documentation" for more
information). In each draw event set uniforms, mark the shader for use, bind information). In each draw event set uniforms, mark the shader for use, bind
specific framebuffer (if needed) and bind required textures to their specific framebuffer (if needed) and bind required textures to their
respective layers using AbstractTexture::bind(GLint). Then call Mesh::draw(). respective layers using AbstractTexture::bind(Int). Then call Mesh::draw().
Example: Example:
@code @code
shader->setTransformation(transformation) shader->setTransformation(transformation)
@ -252,7 +252,7 @@ are cached, so repeated queries don't result in repeated @fn_gl{Get} calls.
If extension @extension{ARB,separate_shader_objects} or If extension @extension{ARB,separate_shader_objects} or
@extension{EXT,direct_state_access} is available, uniform setting functions @extension{EXT,direct_state_access} is available, uniform setting functions
use DSA functions to avoid unnecessary calls to @fn_gl{UseProgram}. See use DSA functions to avoid unnecessary calls to @fn_gl{UseProgram}. See
setUniform(GLint, GLfloat) documentation for more information. setUniform() documentation for more information.
To achieve least state changes, set all uniforms in one run -- method chaining To achieve least state changes, set all uniforms in one run -- method chaining
comes in handy. comes in handy.
@ -293,9 +293,9 @@ class MAGNUM_EXPORT AbstractShaderProgram {
* shaders and @ref Mesh-configuration for example usage when adding * shaders and @ref Mesh-configuration for example usage when adding
* vertex buffers to mesh. * vertex buffers to mesh.
*/ */
template<GLuint location, class T> class Attribute { template<UnsignedInt location, class T> class Attribute {
public: public:
enum: GLuint { enum: UnsignedInt {
Location = location /**< Location to which the attribute is bound */ Location = location /**< Location to which the attribute is bound */
}; };
@ -424,7 +424,7 @@ class MAGNUM_EXPORT AbstractShaderProgram {
* @see DataOptions, Attribute() * @see DataOptions, Attribute()
*/ */
#ifdef DOXYGEN_GENERATING_OUTPUT #ifdef DOXYGEN_GENERATING_OUTPUT
enum class DataOption: std::uint8_t { enum class DataOption: UnsignedByte {
/** /**
* Normalize integer components. Only for float attribute * Normalize integer components. Only for float attribute
* types. Default is to not normalize. * types. Default is to not normalize.
@ -440,7 +440,7 @@ class MAGNUM_EXPORT AbstractShaderProgram {
* @see Attribute() * @see Attribute()
*/ */
#ifdef DOXYGEN_GENERATING_OUTPUT #ifdef DOXYGEN_GENERATING_OUTPUT
typedef typename Corrade::Containers::EnumSet<DataOption, std::uint8_t> DataOptions; typedef typename Corrade::Containers::EnumSet<DataOption, UnsignedByte> DataOptions;
#else #else
typedef typename Implementation::Attribute<T>::DataOptions DataOptions; typedef typename Implementation::Attribute<T>::DataOptions DataOptions;
#endif #endif
@ -494,7 +494,7 @@ class MAGNUM_EXPORT AbstractShaderProgram {
* OpenGL calls. * OpenGL calls.
* @see Attribute, @fn_gl{Get} with @def_gl{MAX_VERTEX_ATTRIBS} * @see Attribute, @fn_gl{Get} with @def_gl{MAX_VERTEX_ATTRIBS}
*/ */
static GLint maxSupportedVertexAttributeCount(); static Int maxSupportedVertexAttributeCount();
/** /**
* @brief Constructor * @brief Constructor
@ -590,7 +590,7 @@ class MAGNUM_EXPORT AbstractShaderProgram {
* for more information. * for more information.
* @see @fn_gl{BindAttribLocation} * @see @fn_gl{BindAttribLocation}
*/ */
void bindAttributeLocation(GLuint location, const std::string& name); void bindAttributeLocation(UnsignedInt location, const std::string& name);
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
/** /**
@ -613,7 +613,7 @@ class MAGNUM_EXPORT AbstractShaderProgram {
* @requires_gl Multiple blend function inputs are not available in * @requires_gl Multiple blend function inputs are not available in
* OpenGL ES. * OpenGL ES.
*/ */
void bindFragmentDataLocationIndexed(GLuint location, GLuint index, const std::string& name); void bindFragmentDataLocationIndexed(UnsignedInt location, UnsignedInt index, const std::string& name);
/** /**
* @brief Bind fragment data to given location and first color input index * @brief Bind fragment data to given location and first color input index
@ -627,7 +627,7 @@ class MAGNUM_EXPORT AbstractShaderProgram {
* @requires_gl Use explicit location specification in OpenGL ES 3.0 * @requires_gl Use explicit location specification in OpenGL ES 3.0
* instead. * instead.
*/ */
void bindFragmentDataLocation(GLuint location, const std::string& name); void bindFragmentDataLocation(UnsignedInt location, const std::string& name);
#endif #endif
/** /**
@ -651,7 +651,7 @@ class MAGNUM_EXPORT AbstractShaderProgram {
* for more information. * for more information.
* @see @fn_gl{GetUniformLocation} * @see @fn_gl{GetUniformLocation}
*/ */
GLint uniformLocation(const std::string& name); Int uniformLocation(const std::string& name);
/** /**
* @brief Set uniform value * @brief Set uniform value
@ -664,265 +664,265 @@ class MAGNUM_EXPORT AbstractShaderProgram {
* @see @fn_gl{UseProgram}, @fn_gl{Uniform} or `glProgramUniform()` * @see @fn_gl{UseProgram}, @fn_gl{Uniform} or `glProgramUniform()`
* from @extension{ARB,separate_shader_objects}/@extension{EXT,direct_state_access}. * from @extension{ARB,separate_shader_objects}/@extension{EXT,direct_state_access}.
*/ */
inline void setUniform(GLint location, GLfloat value) { inline void setUniform(Int location, Float value) {
(this->*uniform1fImplementation)(location, value); (this->*uniform1fImplementation)(location, value);
} }
/** @copydoc setUniform(GLint, GLfloat) */ /** @copydoc setUniform(Int, Float) */
inline void setUniform(GLint location, const Math::Vector<2, GLfloat>& value) { inline void setUniform(Int location, const Math::Vector<2, Float>& value) {
(this->*uniform2fvImplementation)(location, value); (this->*uniform2fvImplementation)(location, value);
} }
/** @copydoc setUniform(GLint, GLfloat) */ /** @copydoc setUniform(Int, Float) */
inline void setUniform(GLint location, const Math::Vector<3, GLfloat>& value) { inline void setUniform(Int location, const Math::Vector<3, Float>& value) {
(this->*uniform3fvImplementation)(location, value); (this->*uniform3fvImplementation)(location, value);
} }
/** @copydoc setUniform(GLint, GLfloat) */ /** @copydoc setUniform(Int, Float) */
inline void setUniform(GLint location, const Math::Vector<4, GLfloat>& value) { inline void setUniform(Int location, const Math::Vector<4, Float>& value) {
(this->*uniform4fvImplementation)(location, value); (this->*uniform4fvImplementation)(location, value);
} }
/** @copydoc setUniform(GLint, GLfloat) */ /** @copydoc setUniform(Int, Float) */
inline void setUniform(GLint location, GLint value) { inline void setUniform(Int location, Int value) {
(this->*uniform1iImplementation)(location, value); (this->*uniform1iImplementation)(location, value);
} }
/** @copydoc setUniform(GLint, GLfloat) */ /** @copydoc setUniform(Int, Float) */
inline void setUniform(GLint location, const Math::Vector<2, GLint>& value) { inline void setUniform(Int location, const Math::Vector<2, Int>& value) {
(this->*uniform2ivImplementation)(location, value); (this->*uniform2ivImplementation)(location, value);
} }
/** @copydoc setUniform(GLint, GLfloat) */ /** @copydoc setUniform(Int, Float) */
inline void setUniform(GLint location, const Math::Vector<3, GLint>& value) { inline void setUniform(Int location, const Math::Vector<3, Int>& value) {
(this->*uniform3ivImplementation)(location, value); (this->*uniform3ivImplementation)(location, value);
} }
/** @copydoc setUniform(GLint, GLfloat) */ /** @copydoc setUniform(Int, Float) */
inline void setUniform(GLint location, const Math::Vector<4, GLint>& value) { inline void setUniform(Int location, const Math::Vector<4, Int>& value) {
(this->*uniform4ivImplementation)(location, value); (this->*uniform4ivImplementation)(location, value);
} }
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
/** /**
* @copydoc setUniform(GLint, GLfloat) * @copydoc setUniform(Int, Float)
* @requires_gl30 %Extension @extension{EXT,gpu_shader4} * @requires_gl30 %Extension @extension{EXT,gpu_shader4}
* @requires_gles30 Only signed integers are available in OpenGL ES 2.0. * @requires_gles30 Only signed integers are available in OpenGL ES 2.0.
*/ */
inline void setUniform(GLint location, GLuint value) { inline void setUniform(Int location, UnsignedInt value) {
(this->*uniform1uiImplementation)(location, value); (this->*uniform1uiImplementation)(location, value);
} }
/** /**
* @copydoc setUniform(GLint, GLfloat) * @copydoc setUniform(Int, Float)
* @requires_gl30 %Extension @extension{EXT,gpu_shader4} * @requires_gl30 %Extension @extension{EXT,gpu_shader4}
* @requires_gles30 Only signed integers are available in OpenGL ES 2.0. * @requires_gles30 Only signed integers are available in OpenGL ES 2.0.
*/ */
inline void setUniform(GLint location, const Math::Vector<2, GLuint>& value) { inline void setUniform(Int location, const Math::Vector<2, UnsignedInt>& value) {
(this->*uniform2uivImplementation)(location, value); (this->*uniform2uivImplementation)(location, value);
} }
/** /**
* @copydoc setUniform(GLint, GLfloat) * @copydoc setUniform(Int, Float)
* @requires_gl30 %Extension @extension{EXT,gpu_shader4} * @requires_gl30 %Extension @extension{EXT,gpu_shader4}
* @requires_gles30 Only signed integers are available in OpenGL ES 2.0. * @requires_gles30 Only signed integers are available in OpenGL ES 2.0.
*/ */
inline void setUniform(GLint location, const Math::Vector<3, GLuint>& value) { inline void setUniform(Int location, const Math::Vector<3, UnsignedInt>& value) {
(this->*uniform3uivImplementation)(location, value); (this->*uniform3uivImplementation)(location, value);
} }
/** /**
* @copydoc setUniform(GLint, GLfloat) * @copydoc setUniform(Int, Float)
* @requires_gl30 %Extension @extension{EXT,gpu_shader4} * @requires_gl30 %Extension @extension{EXT,gpu_shader4}
* @requires_gles30 Only signed integers are available in OpenGL ES 2.0. * @requires_gles30 Only signed integers are available in OpenGL ES 2.0.
*/ */
inline void setUniform(GLint location, const Math::Vector<4, GLuint>& value) { inline void setUniform(Int location, const Math::Vector<4, UnsignedInt>& value) {
(this->*uniform4uivImplementation)(location, value); (this->*uniform4uivImplementation)(location, value);
} }
#endif #endif
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
/** /**
* @copydoc setUniform(GLint, GLfloat) * @copydoc setUniform(Int, Float)
* @requires_gl40 %Extension @extension{ARB,gpu_shader_fp64} * @requires_gl40 %Extension @extension{ARB,gpu_shader_fp64}
* @requires_gl Only floats are available in OpenGL ES. * @requires_gl Only floats are available in OpenGL ES.
*/ */
inline void setUniform(GLint location, GLdouble value) { inline void setUniform(Int location, Double value) {
(this->*uniform1dImplementation)(location, value); (this->*uniform1dImplementation)(location, value);
} }
/** /**
* @copydoc setUniform(GLint, GLfloat) * @copydoc setUniform(Int, Float)
* @requires_gl40 %Extension @extension{ARB,gpu_shader_fp64} * @requires_gl40 %Extension @extension{ARB,gpu_shader_fp64}
* @requires_gl Only floats are available in OpenGL ES. * @requires_gl Only floats are available in OpenGL ES.
*/ */
inline void setUniform(GLint location, const Math::Vector<2, GLdouble>& value) { inline void setUniform(Int location, const Math::Vector<2, Double>& value) {
(this->*uniform2dvImplementation)(location, value); (this->*uniform2dvImplementation)(location, value);
} }
/** /**
* @copydoc setUniform(GLint, GLfloat) * @copydoc setUniform(Int, Float)
* @requires_gl40 %Extension @extension{ARB,gpu_shader_fp64} * @requires_gl40 %Extension @extension{ARB,gpu_shader_fp64}
* @requires_gl Only floats are available in OpenGL ES. * @requires_gl Only floats are available in OpenGL ES.
*/ */
inline void setUniform(GLint location, const Math::Vector<3, GLdouble>& value) { inline void setUniform(Int location, const Math::Vector<3, Double>& value) {
(this->*uniform3dvImplementation)(location, value); (this->*uniform3dvImplementation)(location, value);
} }
/** /**
* @copydoc setUniform(GLint, GLfloat) * @copydoc setUniform(Int, Float)
* @requires_gl40 %Extension @extension{ARB,gpu_shader_fp64} * @requires_gl40 %Extension @extension{ARB,gpu_shader_fp64}
* @requires_gl Only floats are available in OpenGL ES. * @requires_gl Only floats are available in OpenGL ES.
*/ */
inline void setUniform(GLint location, const Math::Vector<4, GLdouble>& value) { inline void setUniform(Int location, const Math::Vector<4, Double>& value) {
(this->*uniform4dvImplementation)(location, value); (this->*uniform4dvImplementation)(location, value);
} }
#endif #endif
/** @copydoc setUniform(GLint, GLfloat) */ /** @copydoc setUniform(Int, Float) */
inline void setUniform(GLint location, const Math::Matrix<2, GLfloat>& value) { inline void setUniform(Int location, const Math::Matrix<2, Float>& value) {
(this->*uniformMatrix2fvImplementation)(location, value); (this->*uniformMatrix2fvImplementation)(location, value);
} }
/** @copydoc setUniform(GLint, GLfloat) */ /** @copydoc setUniform(Int, Float) */
inline void setUniform(GLint location, const Math::Matrix<3, GLfloat>& value) { inline void setUniform(Int location, const Math::Matrix<3, Float>& value) {
(this->*uniformMatrix3fvImplementation)(location, value); (this->*uniformMatrix3fvImplementation)(location, value);
} }
/** @copydoc setUniform(GLint, GLfloat) */ /** @copydoc setUniform(Int, Float) */
inline void setUniform(GLint location, const Math::Matrix<4, GLfloat>& value) { inline void setUniform(Int location, const Math::Matrix<4, Float>& value) {
(this->*uniformMatrix4fvImplementation)(location, value); (this->*uniformMatrix4fvImplementation)(location, value);
} }
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
/** /**
* @copydoc setUniform(GLint, GLfloat) * @copydoc setUniform(Int, Float)
* @requires_gles30 Only square matrices are available in OpenGL ES 2.0. * @requires_gles30 Only square matrices are available in OpenGL ES 2.0.
*/ */
inline void setUniform(GLint location, const Math::RectangularMatrix<2, 3, GLfloat>& value) { inline void setUniform(Int location, const Math::RectangularMatrix<2, 3, Float>& value) {
(this->*uniformMatrix2x3fvImplementation)(location, value); (this->*uniformMatrix2x3fvImplementation)(location, value);
} }
/** /**
* @copydoc setUniform(GLint, GLfloat) * @copydoc setUniform(Int, Float)
* @requires_gles30 Only square matrices are available in OpenGL ES 2.0. * @requires_gles30 Only square matrices are available in OpenGL ES 2.0.
*/ */
inline void setUniform(GLint location, const Math::RectangularMatrix<3, 2, GLfloat>& value) { inline void setUniform(Int location, const Math::RectangularMatrix<3, 2, Float>& value) {
(this->*uniformMatrix3x2fvImplementation)(location, value); (this->*uniformMatrix3x2fvImplementation)(location, value);
} }
/** /**
* @copydoc setUniform(GLint, GLfloat) * @copydoc setUniform(Int, Float)
* @requires_gles30 Only square matrices are available in OpenGL ES 2.0. * @requires_gles30 Only square matrices are available in OpenGL ES 2.0.
*/ */
inline void setUniform(GLint location, const Math::RectangularMatrix<2, 4, GLfloat>& value) { inline void setUniform(Int location, const Math::RectangularMatrix<2, 4, Float>& value) {
(this->*uniformMatrix2x4fvImplementation)(location, value); (this->*uniformMatrix2x4fvImplementation)(location, value);
} }
/** /**
* @copydoc setUniform(GLint, GLfloat) * @copydoc setUniform(Int, Float)
* @requires_gles30 Only square matrices are available in OpenGL ES 2.0. * @requires_gles30 Only square matrices are available in OpenGL ES 2.0.
*/ */
inline void setUniform(GLint location, const Math::RectangularMatrix<4, 2, GLfloat>& value) { inline void setUniform(Int location, const Math::RectangularMatrix<4, 2, Float>& value) {
(this->*uniformMatrix4x2fvImplementation)(location, value); (this->*uniformMatrix4x2fvImplementation)(location, value);
} }
/** /**
* @copydoc setUniform(GLint, GLfloat) * @copydoc setUniform(Int, Float)
* @requires_gles30 Only square matrices are available in OpenGL ES 2.0. * @requires_gles30 Only square matrices are available in OpenGL ES 2.0.
*/ */
inline void setUniform(GLint location, const Math::RectangularMatrix<3, 4, GLfloat>& value) { inline void setUniform(Int location, const Math::RectangularMatrix<3, 4, Float>& value) {
(this->*uniformMatrix3x4fvImplementation)(location, value); (this->*uniformMatrix3x4fvImplementation)(location, value);
} }
/** /**
* @copydoc setUniform(GLint, GLfloat) * @copydoc setUniform(Int, Float)
* @requires_gles30 Only square matrices are available in OpenGL ES 2.0. * @requires_gles30 Only square matrices are available in OpenGL ES 2.0.
*/ */
inline void setUniform(GLint location, const Math::RectangularMatrix<4, 3, GLfloat>& value) { inline void setUniform(Int location, const Math::RectangularMatrix<4, 3, Float>& value) {
(this->*uniformMatrix4x3fvImplementation)(location, value); (this->*uniformMatrix4x3fvImplementation)(location, value);
} }
#endif #endif
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
/** /**
* @copydoc setUniform(GLint, GLfloat) * @copydoc setUniform(Int, Float)
* @requires_gl40 %Extension @extension{ARB,gpu_shader_fp64} * @requires_gl40 %Extension @extension{ARB,gpu_shader_fp64}
* @requires_gl Only floats are available in OpenGL ES. * @requires_gl Only floats are available in OpenGL ES.
*/ */
inline void setUniform(GLint location, const Math::Matrix<2, GLdouble>& value) { inline void setUniform(Int location, const Math::Matrix<2, Double>& value) {
(this->*uniformMatrix2dvImplementation)(location, value); (this->*uniformMatrix2dvImplementation)(location, value);
} }
/** /**
* @copydoc setUniform(GLint, GLfloat) * @copydoc setUniform(Int, Float)
* @requires_gl40 %Extension @extension{ARB,gpu_shader_fp64} * @requires_gl40 %Extension @extension{ARB,gpu_shader_fp64}
* @requires_gl Only floats are available in OpenGL ES. * @requires_gl Only floats are available in OpenGL ES.
*/ */
inline void setUniform(GLint location, const Math::Matrix<3, GLdouble>& value) { inline void setUniform(Int location, const Math::Matrix<3, Double>& value) {
(this->*uniformMatrix3dvImplementation)(location, value); (this->*uniformMatrix3dvImplementation)(location, value);
} }
/** /**
* @copydoc setUniform(GLint, GLfloat) * @copydoc setUniform(Int, Float)
* @requires_gl40 %Extension @extension{ARB,gpu_shader_fp64} * @requires_gl40 %Extension @extension{ARB,gpu_shader_fp64}
* @requires_gl Only floats are available in OpenGL ES. * @requires_gl Only floats are available in OpenGL ES.
*/ */
inline void setUniform(GLint location, const Math::Matrix<4, GLdouble>& value) { inline void setUniform(Int location, const Math::Matrix<4, Double>& value) {
(this->*uniformMatrix4dvImplementation)(location, value); (this->*uniformMatrix4dvImplementation)(location, value);
} }
/** /**
* @copydoc setUniform(GLint, GLfloat) * @copydoc setUniform(Int, Float)
* @requires_gl40 %Extension @extension{ARB,gpu_shader_fp64} * @requires_gl40 %Extension @extension{ARB,gpu_shader_fp64}
* @requires_gl Only floats are available in OpenGL ES. * @requires_gl Only floats are available in OpenGL ES.
*/ */
inline void setUniform(GLint location, const Math::RectangularMatrix<2, 3, GLdouble>& value) { inline void setUniform(Int location, const Math::RectangularMatrix<2, 3, Double>& value) {
(this->*uniformMatrix2x3dvImplementation)(location, value); (this->*uniformMatrix2x3dvImplementation)(location, value);
} }
/** /**
* @copydoc setUniform(GLint, GLfloat) * @copydoc setUniform(Int, Float)
* @requires_gl40 %Extension @extension{ARB,gpu_shader_fp64} * @requires_gl40 %Extension @extension{ARB,gpu_shader_fp64}
* @requires_gl Only floats are available in OpenGL ES. * @requires_gl Only floats are available in OpenGL ES.
*/ */
inline void setUniform(GLint location, const Math::RectangularMatrix<3, 2, GLdouble>& value) { inline void setUniform(Int location, const Math::RectangularMatrix<3, 2, Double>& value) {
(this->*uniformMatrix3x2dvImplementation)(location, value); (this->*uniformMatrix3x2dvImplementation)(location, value);
} }
/** /**
* @copydoc setUniform(GLint, GLfloat) * @copydoc setUniform(Int, Float)
* @requires_gl40 %Extension @extension{ARB,gpu_shader_fp64} * @requires_gl40 %Extension @extension{ARB,gpu_shader_fp64}
* @requires_gl Only floats are available in OpenGL ES. * @requires_gl Only floats are available in OpenGL ES.
*/ */
inline void setUniform(GLint location, const Math::RectangularMatrix<2, 4, GLdouble>& value) { inline void setUniform(Int location, const Math::RectangularMatrix<2, 4, Double>& value) {
(this->*uniformMatrix2x4dvImplementation)(location, value); (this->*uniformMatrix2x4dvImplementation)(location, value);
} }
/** /**
* @copydoc setUniform(GLint, GLfloat) * @copydoc setUniform(Int, Float)
* @requires_gl40 %Extension @extension{ARB,gpu_shader_fp64} * @requires_gl40 %Extension @extension{ARB,gpu_shader_fp64}
* @requires_gl Only floats are available in OpenGL ES. * @requires_gl Only floats are available in OpenGL ES.
*/ */
inline void setUniform(GLint location, const Math::RectangularMatrix<4, 2, GLdouble>& value) { inline void setUniform(Int location, const Math::RectangularMatrix<4, 2, Double>& value) {
(this->*uniformMatrix4x2dvImplementation)(location, value); (this->*uniformMatrix4x2dvImplementation)(location, value);
} }
/** /**
* @copydoc setUniform(GLint, GLfloat) * @copydoc setUniform(Int, Float)
* @requires_gl40 %Extension @extension{ARB,gpu_shader_fp64} * @requires_gl40 %Extension @extension{ARB,gpu_shader_fp64}
* @requires_gl Only floats are available in OpenGL ES. * @requires_gl Only floats are available in OpenGL ES.
*/ */
inline void setUniform(GLint location, const Math::RectangularMatrix<3, 4, GLdouble>& value) { inline void setUniform(Int location, const Math::RectangularMatrix<3, 4, Double>& value) {
(this->*uniformMatrix3x4dvImplementation)(location, value); (this->*uniformMatrix3x4dvImplementation)(location, value);
} }
/** /**
* @copydoc setUniform(GLint, GLfloat) * @copydoc setUniform(Int, Float)
* @requires_gl40 %Extension @extension{ARB,gpu_shader_fp64} * @requires_gl40 %Extension @extension{ARB,gpu_shader_fp64}
* @requires_gl Only floats are available in OpenGL ES. * @requires_gl Only floats are available in OpenGL ES.
*/ */
inline void setUniform(GLint location, const Math::RectangularMatrix<4, 3, GLdouble>& value) { inline void setUniform(Int location, const Math::RectangularMatrix<4, 3, Double>& value) {
(this->*uniformMatrix4x3dvImplementation)(location, value); (this->*uniformMatrix4x3dvImplementation)(location, value);
} }
#endif #endif
@ -1175,7 +1175,7 @@ template<class> struct Attribute;
/* Base for float attributes */ /* Base for float attributes */
struct FloatAttribute { struct FloatAttribute {
typedef GLfloat Type; typedef Float Type;
enum class DataType: GLenum { enum class DataType: GLenum {
UnsignedByte = GL_UNSIGNED_BYTE, UnsignedByte = GL_UNSIGNED_BYTE,
@ -1198,10 +1198,10 @@ struct FloatAttribute {
}; };
constexpr static DataType DefaultDataType = DataType::Float; constexpr static DataType DefaultDataType = DataType::Float;
enum class DataOption: std::uint8_t { enum class DataOption: UnsignedByte {
Normalized = 1 << 0 Normalized = 1 << 0
}; };
typedef Corrade::Containers::EnumSet<DataOption, std::uint8_t> DataOptions; typedef Corrade::Containers::EnumSet<DataOption, UnsignedByte> DataOptions;
static std::size_t MAGNUM_EXPORT size(GLint components, DataType dataType); static std::size_t MAGNUM_EXPORT size(GLint components, DataType dataType);
}; };
@ -1213,7 +1213,7 @@ Debug MAGNUM_EXPORT operator<<(Debug debug, FloatAttribute::DataType value);
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
/* Base for int attributes */ /* Base for int attributes */
struct IntAttribute { struct IntAttribute {
typedef GLint Type; typedef Int Type;
enum class DataType: GLenum { enum class DataType: GLenum {
UnsignedByte = GL_UNSIGNED_BYTE, UnsignedByte = GL_UNSIGNED_BYTE,
@ -1225,8 +1225,8 @@ struct IntAttribute {
}; };
constexpr static DataType DefaultDataType = DataType::Int; constexpr static DataType DefaultDataType = DataType::Int;
enum class DataOption: std::uint8_t {}; enum class DataOption: UnsignedByte {};
typedef Corrade::Containers::EnumSet<DataOption, std::uint8_t> DataOptions; typedef Corrade::Containers::EnumSet<DataOption, UnsignedByte> DataOptions;
static std::size_t MAGNUM_EXPORT size(GLint components, DataType dataType); static std::size_t MAGNUM_EXPORT size(GLint components, DataType dataType);
}; };
@ -1235,13 +1235,13 @@ Debug MAGNUM_EXPORT operator<<(Debug debug, IntAttribute::DataType value);
/* Base for unsigned int attributes */ /* Base for unsigned int attributes */
struct UnsignedIntAttribute { struct UnsignedIntAttribute {
typedef GLuint Type; typedef UnsignedInt Type;
typedef IntAttribute::DataType DataType; typedef IntAttribute::DataType DataType;
constexpr static DataType DefaultDataType = DataType::UnsignedInt; constexpr static DataType DefaultDataType = DataType::UnsignedInt;
typedef IntAttribute::DataOption DataOption; typedef IntAttribute::DataOption DataOption;
typedef Corrade::Containers::EnumSet<DataOption, std::uint8_t> DataOptions; typedef Corrade::Containers::EnumSet<DataOption, UnsignedByte> DataOptions;
inline static std::size_t size(GLint components, DataType dataType) { inline static std::size_t size(GLint components, DataType dataType) {
return IntAttribute::size(components, dataType); return IntAttribute::size(components, dataType);
@ -1252,15 +1252,15 @@ struct UnsignedIntAttribute {
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
/* Base for double attributes */ /* Base for double attributes */
struct DoubleAttribute { struct DoubleAttribute {
typedef GLdouble Type; typedef Double Type;
enum class DataType: GLenum { enum class DataType: GLenum {
Double = GL_DOUBLE Double = GL_DOUBLE
}; };
constexpr static DataType DefaultDataType = DataType::Double; constexpr static DataType DefaultDataType = DataType::Double;
enum class DataOption: std::uint8_t {}; enum class DataOption: UnsignedByte {};
typedef Corrade::Containers::EnumSet<DataOption, std::uint8_t> DataOptions; typedef Corrade::Containers::EnumSet<DataOption, UnsignedByte> DataOptions;
static std::size_t MAGNUM_EXPORT size(GLint components, DataType dataType); static std::size_t MAGNUM_EXPORT size(GLint components, DataType dataType);
}; };
@ -1269,8 +1269,8 @@ Debug MAGNUM_EXPORT operator<<(Debug debug, DoubleAttribute::DataType value);
#endif #endif
/* Floating-point four-component vector is absolutely special case */ /* Floating-point four-component vector is absolutely special case */
template<> struct Attribute<Math::Vector<4, GLfloat>> { template<> struct Attribute<Math::Vector<4, Float>> {
typedef GLfloat Type; typedef Float Type;
enum class Components: GLint { enum class Components: GLint {
One = 1, One = 1,
@ -1309,39 +1309,39 @@ template<> struct Attribute<Math::Vector<4, GLfloat>> {
}; };
constexpr static DataType DefaultDataType = DataType::Float; constexpr static DataType DefaultDataType = DataType::Float;
enum class DataOption: std::uint8_t { enum class DataOption: UnsignedByte {
Normalized = 1 << 0 Normalized = 1 << 0
}; };
typedef Corrade::Containers::EnumSet<DataOption, std::uint8_t> DataOptions; typedef Corrade::Containers::EnumSet<DataOption, UnsignedByte> DataOptions;
inline constexpr static std::size_t vectorCount() { return 1; } inline constexpr static std::size_t vectorCount() { return 1; }
static std::size_t MAGNUM_EXPORT size(GLint components, DataType dataType); static std::size_t MAGNUM_EXPORT size(GLint components, DataType dataType);
}; };
typedef Math::Vector<4, GLfloat> _Vector4; typedef Math::Vector<4, Float> _Vector4;
CORRADE_ENUMSET_OPERATORS(Attribute<_Vector4>::DataOptions) CORRADE_ENUMSET_OPERATORS(Attribute<_Vector4>::DataOptions)
Debug MAGNUM_EXPORT operator<<(Debug debug, Attribute<Math::Vector<4, GLfloat>>::Components value); Debug MAGNUM_EXPORT operator<<(Debug debug, Attribute<Math::Vector<4, Float>>::Components value);
Debug MAGNUM_EXPORT operator<<(Debug debug, Attribute<Math::Vector<4, GLfloat>>::DataType value); Debug MAGNUM_EXPORT operator<<(Debug debug, Attribute<Math::Vector<4, Float>>::DataType value);
/* Common float, int, unsigned int and double scalar attributes */ /* Common float, int, unsigned int and double scalar attributes */
template<> struct Attribute<GLfloat>: FloatAttribute, SizedAttribute<1, 1> {}; template<> struct Attribute<Float>: FloatAttribute, SizedAttribute<1, 1> {};
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
template<> struct Attribute<GLint>: IntAttribute, SizedAttribute<1, 1> {}; template<> struct Attribute<Int>: IntAttribute, SizedAttribute<1, 1> {};
template<> struct Attribute<GLuint>: UnsignedIntAttribute, SizedAttribute<1, 1> {}; template<> struct Attribute<UnsignedInt>: UnsignedIntAttribute, SizedAttribute<1, 1> {};
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
template<> struct Attribute<GLdouble>: DoubleAttribute, SizedAttribute<1, 1> {}; template<> struct Attribute<Double>: DoubleAttribute, SizedAttribute<1, 1> {};
#endif #endif
#endif #endif
/* Common float, int, unsigned int and double vector attributes */ /* Common float, int, unsigned int and double vector attributes */
template<std::size_t size_> struct Attribute<Math::Vector<size_, GLfloat>>: FloatAttribute, SizedAttribute<1, size_> {}; template<std::size_t size_> struct Attribute<Math::Vector<size_, Float>>: FloatAttribute, SizedAttribute<1, size_> {};
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
template<std::size_t size_> struct Attribute<Math::Vector<size_, GLint>>: IntAttribute, SizedAttribute<1, size_> {}; template<std::size_t size_> struct Attribute<Math::Vector<size_, Int>>: IntAttribute, SizedAttribute<1, size_> {};
template<std::size_t size_> struct Attribute<Math::Vector<size_, GLuint>>: UnsignedIntAttribute, SizedAttribute<1, size_> {}; template<std::size_t size_> struct Attribute<Math::Vector<size_, UnsignedInt>>: UnsignedIntAttribute, SizedAttribute<1, size_> {};
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
template<std::size_t size_> struct Attribute<Math::Vector<size_, GLdouble>>: DoubleAttribute, SizedAttribute<1, size_> {}; template<std::size_t size_> struct Attribute<Math::Vector<size_, Double>>: DoubleAttribute, SizedAttribute<1, size_> {};
#endif #endif
#endif #endif
template<class T> struct Attribute<Math::Vector2<T>>: Attribute<Math::Vector<2, T>> {}; template<class T> struct Attribute<Math::Vector2<T>>: Attribute<Math::Vector<2, T>> {};
@ -1351,15 +1351,15 @@ template<class T> struct Attribute<Color3<T>>: Attribute<Math::Vector3<T>> {};
template<class T> struct Attribute<Color4<T>>: Attribute<Math::Vector4<T>> {}; template<class T> struct Attribute<Color4<T>>: Attribute<Math::Vector4<T>> {};
/* Common float and double rectangular matrix attributes */ /* Common float and double rectangular matrix attributes */
template<std::size_t cols, std::size_t rows> struct Attribute<Math::RectangularMatrix<cols, rows, GLfloat>>: FloatAttribute, SizedAttribute<cols, rows> {}; template<std::size_t cols, std::size_t rows> struct Attribute<Math::RectangularMatrix<cols, rows, Float>>: FloatAttribute, SizedAttribute<cols, rows> {};
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
template<std::size_t cols, std::size_t rows> struct Attribute<Math::RectangularMatrix<cols, rows, GLdouble>>: DoubleAttribute, SizedAttribute<cols, rows> {}; template<std::size_t cols, std::size_t rows> struct Attribute<Math::RectangularMatrix<cols, rows, Double>>: DoubleAttribute, SizedAttribute<cols, rows> {};
#endif #endif
/* Common float and double square matrix attributes */ /* Common float and double square matrix attributes */
template<std::size_t size_> struct Attribute<Math::Matrix<size_, GLfloat>>: Attribute<Math::RectangularMatrix<size_, size_, GLfloat>> {}; template<std::size_t size_> struct Attribute<Math::Matrix<size_, Float>>: Attribute<Math::RectangularMatrix<size_, size_, Float>> {};
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
template<std::size_t size_> struct Attribute<Math::Matrix<size_, GLdouble>>: Attribute<Math::RectangularMatrix<size_, size_, GLdouble>> {}; template<std::size_t size_> struct Attribute<Math::Matrix<size_, Double>>: Attribute<Math::RectangularMatrix<size_, size_, Double>> {};
#endif #endif
template<class T> struct Attribute<Math::Matrix3<T>>: Attribute<Math::Matrix<3, T>> {}; template<class T> struct Attribute<Math::Matrix3<T>>: Attribute<Math::Matrix<3, T>> {};
template<class T> struct Attribute<Math::Matrix4<T>>: Attribute<Math::Matrix<4, T>> {}; template<class T> struct Attribute<Math::Matrix4<T>>: Attribute<Math::Matrix<4, T>> {};

8
src/AbstractTexture.cpp

@ -83,11 +83,11 @@ static_assert((filter_or(NearestNeighbor, BaseLevel) == GL_NEAREST) &&
#undef filter_or #undef filter_or
#endif #endif
GLint AbstractTexture::maxSupportedLayerCount() { Int AbstractTexture::maxSupportedLayerCount() {
return Context::current()->state()->texture->maxSupportedLayerCount; return Context::current()->state()->texture->maxSupportedLayerCount;
} }
GLfloat AbstractTexture::maxSupportedAnisotropy() { Float AbstractTexture::maxSupportedAnisotropy() {
GLfloat& value = Context::current()->state()->texture->maxSupportedAnisotropy; GLfloat& value = Context::current()->state()->texture->maxSupportedAnisotropy;
/** @todo Re-enable when extension header is available */ /** @todo Re-enable when extension header is available */
@ -131,7 +131,7 @@ AbstractTexture& AbstractTexture::operator=(AbstractTexture&& other) {
return *this; return *this;
} }
void AbstractTexture::bind(GLint layer) { void AbstractTexture::bind(Int layer) {
Implementation::TextureState* const textureState = Context::current()->state()->texture; Implementation::TextureState* const textureState = Context::current()->state()->texture;
/* If already bound in given layer, nothing to do */ /* If already bound in given layer, nothing to do */
@ -453,7 +453,7 @@ void AbstractTexture::invalidateSubImplementationARB(GLint level, const Vector3i
#ifndef DOXYGEN_GENERATING_OUTPUT #ifndef DOXYGEN_GENERATING_OUTPUT
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
namespace Implementation { namespace Implementation {
template<std::uint8_t dimensions> const GLvoid* ImageHelper<BufferImage<dimensions>>::dataOrPixelUnpackBuffer(BufferImage<dimensions>* image) { template<UnsignedInt dimensions> const GLvoid* ImageHelper<BufferImage<dimensions>>::dataOrPixelUnpackBuffer(BufferImage<dimensions>* image) {
image->buffer()->bind(Buffer::Target::PixelUnpack); image->buffer()->bind(Buffer::Target::PixelUnpack);
return nullptr; return nullptr;
} }

16
src/AbstractTexture.h

@ -979,11 +979,11 @@ class MAGNUM_EXPORT AbstractTexture {
* *
* The result is cached, repeated queries don't result in repeated * The result is cached, repeated queries don't result in repeated
* OpenGL calls. * OpenGL calls.
* @see @ref AbstractShaderProgram-subclassing, bind(GLint), * @see @ref AbstractShaderProgram-subclassing, bind(Int),
* @fn_gl{Get} with @def_gl{MAX_COMBINED_TEXTURE_IMAGE_UNITS}, * @fn_gl{Get} with @def_gl{MAX_COMBINED_TEXTURE_IMAGE_UNITS},
* @fn_gl{ActiveTexture} * @fn_gl{ActiveTexture}
*/ */
static GLint maxSupportedLayerCount(); static Int maxSupportedLayerCount();
/** /**
* @brief Max supported anisotropy * @brief Max supported anisotropy
@ -994,7 +994,7 @@ class MAGNUM_EXPORT AbstractTexture {
* @requires_extension %Extension @extension{EXT,texture_filter_anisotropic} * @requires_extension %Extension @extension{EXT,texture_filter_anisotropic}
* @requires_es_extension %Extension @es_extension2{EXT,texture_filter_anisotropic,texture_filter_anisotropic} * @requires_es_extension %Extension @es_extension2{EXT,texture_filter_anisotropic,texture_filter_anisotropic}
*/ */
static GLfloat maxSupportedAnisotropy(); static Float maxSupportedAnisotropy();
#ifndef DOXYGEN_GENERATING_OUTPUT #ifndef DOXYGEN_GENERATING_OUTPUT
inline explicit AbstractTexture(GLenum target): _target(target) { inline explicit AbstractTexture(GLenum target): _target(target) {
@ -1030,7 +1030,7 @@ class MAGNUM_EXPORT AbstractTexture {
* @see @fn_gl{ActiveTexture}, @fn_gl{BindTexture} or * @see @fn_gl{ActiveTexture}, @fn_gl{BindTexture} or
* @fn_gl_extension{BindMultiTexture,EXT,direct_state_access} * @fn_gl_extension{BindMultiTexture,EXT,direct_state_access}
*/ */
void bind(GLint layer); void bind(Int layer);
/** /**
* @brief Set minification filter * @brief Set minification filter
@ -1108,7 +1108,7 @@ class MAGNUM_EXPORT AbstractTexture {
* @requires_extension %Extension @extension{EXT,texture_filter_anisotropic} * @requires_extension %Extension @extension{EXT,texture_filter_anisotropic}
* @requires_es_extension %Extension @es_extension2{EXT,texture_filter_anisotropic,texture_filter_anisotropic} * @requires_es_extension %Extension @es_extension2{EXT,texture_filter_anisotropic,texture_filter_anisotropic}
*/ */
inline AbstractTexture* setMaxAnisotropy(GLfloat anisotropy) { inline AbstractTexture* setMaxAnisotropy(Float anisotropy) {
(this->*parameterfImplementation)(GL_TEXTURE_MAX_ANISOTROPY_EXT, anisotropy); (this->*parameterfImplementation)(GL_TEXTURE_MAX_ANISOTROPY_EXT, anisotropy);
return this; return this;
} }
@ -1122,7 +1122,7 @@ class MAGNUM_EXPORT AbstractTexture {
* @see @ref Texture::invalidateSubImage() "invalidateSubImage()", * @see @ref Texture::invalidateSubImage() "invalidateSubImage()",
* @fn_gl{InvalidateTexImage} * @fn_gl{InvalidateTexImage}
*/ */
inline void invalidateImage(GLint level) { inline void invalidateImage(Int level) {
(this->*invalidateImplementation)(level); (this->*invalidateImplementation)(level);
} }
@ -1142,7 +1142,7 @@ class MAGNUM_EXPORT AbstractTexture {
protected: protected:
#ifndef DOXYGEN_GENERATING_OUTPUT #ifndef DOXYGEN_GENERATING_OUTPUT
template<std::uint8_t textureDimensions> struct DataHelper {}; template<UnsignedInt textureDimensions> struct DataHelper {};
/* Unlike bind() this also sets the binding layer as active */ /* Unlike bind() this also sets the binding layer as active */
void MAGNUM_LOCAL bindInternal(); void MAGNUM_LOCAL bindInternal();
@ -1290,7 +1290,7 @@ namespace Implementation {
}; };
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
template<std::uint8_t dimensions> struct MAGNUM_EXPORT ImageHelper<BufferImage<dimensions>> { template<UnsignedInt dimensions> struct MAGNUM_EXPORT ImageHelper<BufferImage<dimensions>> {
static const GLvoid* dataOrPixelUnpackBuffer(BufferImage<dimensions>* image); static const GLvoid* dataOrPixelUnpackBuffer(BufferImage<dimensions>* image);
}; };
#endif #endif

16
src/Array.h

@ -37,10 +37,10 @@ need any math operations and fuzzy comparison (e.g. enum values). Unlike
Math::Vector this class has non-explicit constructor from one value. Math::Vector this class has non-explicit constructor from one value.
@see Array1D, Array2D, Array3D @see Array1D, Array2D, Array3D
*/ */
template<std::uint8_t dimensions, class T> class Array { template<UnsignedInt dimensions, class T> class Array {
public: public:
typedef T Type; /**< @brief Data type */ typedef T Type; /**< @brief Data type */
const static std::uint8_t Dimensions = dimensions; /**< @brief Dimension count */ const static UnsignedInt Dimensions = dimensions; /**< @brief Dimension count */
/** /**
* @brief Default constructor * @brief Default constructor
@ -68,13 +68,13 @@ template<std::uint8_t dimensions, class T> class Array {
* @param value Value for all fields * @param value Value for all fields
*/ */
template<class U, class = typename std::enable_if<std::is_same<T, U>::value && dimensions != 1, U>::type> inline /*implicit*/ Array(U value) { template<class U, class = typename std::enable_if<std::is_same<T, U>::value && dimensions != 1, U>::type> inline /*implicit*/ Array(U value) {
for(std::uint8_t i = 0; i != dimensions; ++i) for(UnsignedInt i = 0; i != dimensions; ++i)
_data[i] = value; _data[i] = value;
} }
/** @brief Equality */ /** @brief Equality */
inline bool operator==(const Array<dimensions, T>& other) const { inline bool operator==(const Array<dimensions, T>& other) const {
for(std::uint8_t i = 0; i != dimensions; ++i) for(UnsignedInt i = 0; i != dimensions; ++i)
if(_data[i] != other._data[i]) return false; if(_data[i] != other._data[i]) return false;
return true; return true;
} }
@ -85,8 +85,8 @@ template<std::uint8_t dimensions, class T> class Array {
} }
/** @brief Value at given position */ /** @brief Value at given position */
inline T& operator[](std::uint8_t pos) { return _data[pos]; } inline T& operator[](UnsignedInt pos) { return _data[pos]; }
inline constexpr T operator[](std::uint8_t pos) const { return _data[pos]; } /**< @overload */ inline constexpr T operator[](UnsignedInt pos) const { return _data[pos]; } /**< @overload */
/** /**
* @brief Raw data * @brief Raw data
@ -181,10 +181,10 @@ template<class T> class Array3D: public Array<3, T> {
}; };
/** @debugoperator{Magnum::Array} */ /** @debugoperator{Magnum::Array} */
template<std::uint8_t dimensions, class T> Debug operator<<(Debug debug, const Array<dimensions, T>& value) { template<UnsignedInt dimensions, class T> Debug operator<<(Debug debug, const Array<dimensions, T>& value) {
debug << "Array("; debug << "Array(";
debug.setFlag(Debug::SpaceAfterEachValue, false); debug.setFlag(Debug::SpaceAfterEachValue, false);
for(std::uint8_t i = 0; i != dimensions; ++i) { for(UnsignedInt i = 0; i != dimensions; ++i) {
if(i != 0) debug << ", "; if(i != 0) debug << ", ";
debug << value[i]; debug << value[i];
} }

2
src/BufferImage.cpp

@ -18,7 +18,7 @@
namespace Magnum { namespace Magnum {
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
template<std::uint8_t dimensions> void BufferImage<dimensions>::setData(const typename DimensionTraits<Dimensions, GLsizei>::VectorType& size, Format format, Type type, const GLvoid* data, Buffer::Usage usage) { template<UnsignedInt dimensions> void BufferImage<dimensions>::setData(const typename DimensionTraits<Dimensions, GLsizei>::VectorType& size, Format format, Type type, const GLvoid* data, Buffer::Usage usage) {
_format = format; _format = format;
_type = type; _type = type;
_size = size; _size = size;

10
src/BufferImage.h

@ -37,9 +37,9 @@ Trade::ImageData.
@see BufferImage1D, BufferImage2D, BufferImage3D, Buffer @see BufferImage1D, BufferImage2D, BufferImage3D, Buffer
@requires_gles30 Pixel buffer objects are not available in OpenGL ES 2.0. @requires_gles30 Pixel buffer objects are not available in OpenGL ES 2.0.
*/ */
template<std::uint8_t dimensions> class MAGNUM_EXPORT BufferImage: public AbstractImage { template<UnsignedInt dimensions> class MAGNUM_EXPORT BufferImage: public AbstractImage {
public: public:
const static std::uint8_t Dimensions = dimensions; /**< @brief %Image dimension count */ const static UnsignedInt Dimensions = dimensions; /**< @brief %Image dimension count */
/** /**
* @brief Constructor * @brief Constructor
@ -54,7 +54,7 @@ template<std::uint8_t dimensions> class MAGNUM_EXPORT BufferImage: public Abstra
} }
/** @brief %Image size */ /** @brief %Image size */
inline typename DimensionTraits<Dimensions, GLsizei>::VectorType size() const { return _size; } inline typename DimensionTraits<Dimensions, Int>::VectorType size() const { return _size; }
/** @brief %Image buffer */ /** @brief %Image buffer */
inline Buffer* buffer() { return &_buffer; } inline Buffer* buffer() { return &_buffer; }
@ -72,10 +72,10 @@ template<std::uint8_t dimensions> class MAGNUM_EXPORT BufferImage: public Abstra
* *
* @see Buffer::setData() * @see Buffer::setData()
*/ */
void setData(const typename DimensionTraits<Dimensions, GLsizei>::VectorType& size, Format format, Type type, const GLvoid* data, Buffer::Usage usage); void setData(const typename DimensionTraits<Dimensions, Int>::VectorType& size, Format format, Type type, const GLvoid* data, Buffer::Usage usage);
private: private:
Math::Vector<Dimensions, GLsizei> _size; Math::Vector<Dimensions, Int> _size;
Buffer _buffer; Buffer _buffer;
}; };

2
src/BufferTexture.h

@ -197,7 +197,7 @@ class MAGNUM_EXPORT BufferTexture: private AbstractTexture {
inline explicit BufferTexture(): AbstractTexture(GL_TEXTURE_BUFFER) {} inline explicit BufferTexture(): AbstractTexture(GL_TEXTURE_BUFFER) {}
/** @copydoc AbstractTexture::bind() */ /** @copydoc AbstractTexture::bind() */
inline void bind(GLint layer) { AbstractTexture::bind(layer); } inline void bind(Int layer) { AbstractTexture::bind(layer); }
/** /**
* @brief Set texture buffer * @brief Set texture buffer

4
src/Color.h

@ -144,7 +144,7 @@ range @f$ [0.0, 1.0] @f$.
#ifndef DOXYGEN_GENERATING_OUTPUT #ifndef DOXYGEN_GENERATING_OUTPUT
template<class T> template<class T>
#else #else
template<class T = GLfloat> template<class T = Float>
#endif #endif
class Color3: public Math::Vector3<T> { class Color3: public Math::Vector3<T> {
public: public:
@ -267,7 +267,7 @@ See Color3 for more information.
#ifndef DOXYGEN_GENERATING_OUTPUT #ifndef DOXYGEN_GENERATING_OUTPUT
template<class T> template<class T>
#else #else
template<class T = GLfloat> template<class T = Float>
#endif #endif
class Color4: public Math::Vector4<T> { class Color4: public Math::Vector4<T> {
public: public:

10
src/Context.h

@ -39,7 +39,7 @@ namespace Implementation {
@see Context, MAGNUM_ASSERT_VERSION_SUPPORTED() @see Context, MAGNUM_ASSERT_VERSION_SUPPORTED()
*/ */
enum class Version: GLint { enum class Version: Int {
None = 0xFFFF, /**< @brief Unspecified */ None = 0xFFFF, /**< @brief Unspecified */
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
GL210 = 210, /**< @brief OpenGL 2.1 / GLSL 1.20 */ GL210 = 210, /**< @brief OpenGL 2.1 / GLSL 1.20 */
@ -166,7 +166,7 @@ class MAGNUM_EXPORT Context {
* @see minorVersion(), version(), versionString(), * @see minorVersion(), version(), versionString(),
* shadingLanguageVersionString() * shadingLanguageVersionString()
*/ */
inline GLint majorVersion() const { return _majorVersion; } inline Int majorVersion() const { return _majorVersion; }
/** /**
* @brief Minor OpenGL version (e.g. `3`) * @brief Minor OpenGL version (e.g. `3`)
@ -174,7 +174,7 @@ class MAGNUM_EXPORT Context {
* @see majorVersion(), version(), versionString(), * @see majorVersion(), version(), versionString(),
* shadingLanguageVersionString() * shadingLanguageVersionString()
*/ */
inline GLint minorVersion() const { return _minorVersion; } inline Int minorVersion() const { return _minorVersion; }
/** /**
* @brief Vendor string * @brief Vendor string
@ -293,8 +293,8 @@ class MAGNUM_EXPORT Context {
static Context* _current; static Context* _current;
Version _version; Version _version;
GLint _majorVersion; Int _majorVersion;
GLint _minorVersion; Int _minorVersion;
std::bitset<128> extensionStatus; std::bitset<128> extensionStatus;
std::vector<Extension> _supportedExtensions; std::vector<Extension> _supportedExtensions;

12
src/CubeMapTexture.h

@ -119,7 +119,7 @@ class CubeMapTexture: public AbstractTexture {
* See Texture::imageSize() for more information. * See Texture::imageSize() for more information.
* @requires_gl %Texture image queries are not available in OpenGL ES. * @requires_gl %Texture image queries are not available in OpenGL ES.
*/ */
inline Vector2i imageSize(Coordinate coordinate, GLint level) { inline Vector2i imageSize(Coordinate coordinate, Int level) {
return DataHelper<2>::imageSize(this, static_cast<GLenum>(coordinate), level); return DataHelper<2>::imageSize(this, static_cast<GLenum>(coordinate), level);
} }
#endif #endif
@ -129,7 +129,7 @@ class CubeMapTexture: public AbstractTexture {
* *
* See Texture::setStorage() for more information. * See Texture::setStorage() for more information.
*/ */
inline CubeMapTexture* setStorage(GLsizei levels, InternalFormat internalFormat, const Vector2i& size) { inline CubeMapTexture* setStorage(Int levels, InternalFormat internalFormat, const Vector2i& size) {
DataHelper<2>::setStorage(this, _target, levels, internalFormat, size); DataHelper<2>::setStorage(this, _target, levels, internalFormat, size);
return this; return this;
} }
@ -145,7 +145,7 @@ class CubeMapTexture: public AbstractTexture {
* *
* See Texture::setImage() for more information. * See Texture::setImage() for more information.
*/ */
template<class Image> inline CubeMapTexture* setImage(Coordinate coordinate, GLint level, InternalFormat internalFormat, Image* image) { template<class Image> inline CubeMapTexture* setImage(Coordinate coordinate, Int level, InternalFormat internalFormat, Image* image) {
DataHelper<2>::set(this, static_cast<GLenum>(coordinate), level, internalFormat, image); DataHelper<2>::set(this, static_cast<GLenum>(coordinate), level, internalFormat, image);
return this; return this;
} }
@ -161,7 +161,7 @@ class CubeMapTexture: public AbstractTexture {
* *
* See Texture::setSubImage() for more information. * See Texture::setSubImage() for more information.
*/ */
template<class Image> inline CubeMapTexture* setSubImage(Coordinate coordinate, GLint level, const Vector2i& offset, const Image* image) { template<class Image> inline CubeMapTexture* setSubImage(Coordinate coordinate, Int level, const Vector2i& offset, const Image* image) {
DataHelper<2>::setSub(this, static_cast<GLenum>(coordinate), level, offset, image); DataHelper<2>::setSub(this, static_cast<GLenum>(coordinate), level, offset, image);
return this; return this;
} }
@ -178,7 +178,7 @@ class CubeMapTexture: public AbstractTexture {
* *
* See Texture::invalidateSubImage() for more information. * See Texture::invalidateSubImage() for more information.
*/ */
inline void invalidateSubImage(GLint level, const Vector3i& offset, const Vector3i& size) { inline void invalidateSubImage(Int level, const Vector3i& offset, const Vector3i& size) {
DataHelper<3>::invalidateSub(this, level, offset, size); DataHelper<3>::invalidateSub(this, level, offset, size);
} }
@ -198,7 +198,7 @@ class CubeMapTexture: public AbstractTexture {
return this; return this;
} }
#endif #endif
inline CubeMapTexture* setMaxAnisotropy(GLfloat anisotropy) { inline CubeMapTexture* setMaxAnisotropy(Float anisotropy) {
AbstractTexture::setMaxAnisotropy(anisotropy); AbstractTexture::setMaxAnisotropy(anisotropy);
return this; return this;
} }

18
src/CubeMapTextureArray.h

@ -106,7 +106,7 @@ class CubeMapTextureArray: public AbstractTexture {
* *
* See Texture::imageSize() for more information. * See Texture::imageSize() for more information.
*/ */
inline Vector3i imageSize(Coordinate coordinate, GLint level) { inline Vector3i imageSize(Coordinate coordinate, Int level) {
return DataHelper<3>::imageSize(this, GL_TEXTURE_CUBE_MAP_POSITIVE_X + static_cast<GLenum>(coordinate), level); return DataHelper<3>::imageSize(this, GL_TEXTURE_CUBE_MAP_POSITIVE_X + static_cast<GLenum>(coordinate), level);
} }
@ -115,7 +115,7 @@ class CubeMapTextureArray: public AbstractTexture {
* *
* See Texture::setStorage() for more information. * See Texture::setStorage() for more information.
*/ */
inline CubeMapTextureArray* setStorage(GLsizei levels, InternalFormat internalFormat, const Vector3i& size) { inline CubeMapTextureArray* setStorage(Int levels, InternalFormat internalFormat, const Vector3i& size) {
DataHelper<3>::setStorage(this, _target, levels, internalFormat, size); DataHelper<3>::setStorage(this, _target, levels, internalFormat, size);
return this; return this;
} }
@ -134,7 +134,7 @@ class CubeMapTextureArray: public AbstractTexture {
* *
* See Texture::setImage() for more information. * See Texture::setImage() for more information.
*/ */
template<class T> inline CubeMapTextureArray* setImage(GLint level, InternalFormat internalFormat, T* image) { template<class T> inline CubeMapTextureArray* setImage(Int level, InternalFormat internalFormat, T* image) {
DataHelper<3>::set(this, GL_TEXTURE_CUBE_MAP_ARRAY, level, internalFormat, image); DataHelper<3>::set(this, GL_TEXTURE_CUBE_MAP_ARRAY, level, internalFormat, image);
return this; return this;
} }
@ -156,9 +156,9 @@ class CubeMapTextureArray: public AbstractTexture {
* *
* See Texture::setSubImage() for more information. * See Texture::setSubImage() for more information.
* *
* @see setSubImage(GLsizei, Coordinate, GLint, const Math::Vector<2, GLint>&, const Image*) * @see setSubImage(Int, Coordinate, Int, const Math::Vector<2, Int>&, const Image*)
*/ */
template<class Image> inline CubeMapTextureArray* setSubImage(GLint level, const Vector3i& offset, const Image* image) { template<class Image> inline CubeMapTextureArray* setSubImage(Int level, const Vector3i& offset, const Image* image) {
DataHelper<3>::setSub(this, GL_TEXTURE_CUBE_MAP_ARRAY, level, offset, image, Vector3i(Math::Vector<Image::Dimensions, GLsizei>())); DataHelper<3>::setSub(this, GL_TEXTURE_CUBE_MAP_ARRAY, level, offset, image, Vector3i(Math::Vector<Image::Dimensions, GLsizei>()));
return this; return this;
} }
@ -175,9 +175,9 @@ class CubeMapTextureArray: public AbstractTexture {
* *
* See Texture::setSubImage() for more information. * See Texture::setSubImage() for more information.
* *
* @see setSubImage(GLint, const Math::Vector<3, GLint>&, const Image*) * @see setSubImage(Int, const Math::Vector<3, Int>&, const Image*)
*/ */
template<class Image> inline CubeMapTextureArray* setSubImage(GLsizei layer, Coordinate coordinate, GLint level, const Vector2i& offset, const Image* image) { template<class Image> inline CubeMapTextureArray* setSubImage(Int layer, Coordinate coordinate, Int level, const Vector2i& offset, const Image* image) {
DataHelper<3>::setSub(this, GL_TEXTURE_CUBE_MAP_ARRAY, level, Vector3i(offset, layer*6+static_cast<GLsizei>(coordinate)), image, Vector2i(Math::Vector<Image::Dimensions, GLsizei>())); DataHelper<3>::setSub(this, GL_TEXTURE_CUBE_MAP_ARRAY, level, Vector3i(offset, layer*6+static_cast<GLsizei>(coordinate)), image, Vector2i(Math::Vector<Image::Dimensions, GLsizei>()));
return this; return this;
} }
@ -194,7 +194,7 @@ class CubeMapTextureArray: public AbstractTexture {
* *
* See Texture::invalidateSubImage() for more information. * See Texture::invalidateSubImage() for more information.
*/ */
inline void invalidateSubImage(GLint level, const Vector3i& offset, const Vector3i& size) { inline void invalidateSubImage(Int level, const Vector3i& offset, const Vector3i& size) {
DataHelper<3>::invalidateSub(this, level, offset, size); DataHelper<3>::invalidateSub(this, level, offset, size);
} }
@ -212,7 +212,7 @@ class CubeMapTextureArray: public AbstractTexture {
AbstractTexture::setBorderColor(color); AbstractTexture::setBorderColor(color);
return this; return this;
} }
inline CubeMapTextureArray* setMaxAnisotropy(GLfloat anisotropy) { inline CubeMapTextureArray* setMaxAnisotropy(Float anisotropy) {
AbstractTexture::setMaxAnisotropy(anisotropy); AbstractTexture::setMaxAnisotropy(anisotropy);
return this; return this;
} }

2
src/DefaultFramebuffer.cpp

@ -28,7 +28,7 @@ DefaultFramebuffer defaultFramebuffer;
DefaultFramebuffer::DefaultFramebuffer() { _id = 0; } DefaultFramebuffer::DefaultFramebuffer() { _id = 0; }
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
void DefaultFramebuffer::mapForDraw(std::initializer_list<std::pair<GLuint, DrawAttachment>> attachments) { void DefaultFramebuffer::mapForDraw(std::initializer_list<std::pair<UnsignedInt, DrawAttachment>> attachments) {
/* Max attachment location */ /* Max attachment location */
std::size_t max = 0; std::size_t max = 0;
for(const auto& attachment: attachments) for(const auto& attachment: attachments)

2
src/DefaultFramebuffer.h

@ -282,7 +282,7 @@ class MAGNUM_EXPORT DefaultFramebuffer: public AbstractFramebuffer {
* @requires_gles30 Draw attachments for default framebuffer are * @requires_gles30 Draw attachments for default framebuffer are
* available only in OpenGL ES 3.0. * available only in OpenGL ES 3.0.
*/ */
void mapForDraw(std::initializer_list<std::pair<GLuint, DrawAttachment>> attachments); void mapForDraw(std::initializer_list<std::pair<UnsignedInt, DrawAttachment>> attachments);
/** /**
* @brief Map shader output to buffer attachment * @brief Map shader output to buffer attachment

26
src/DimensionTraits.h

@ -24,7 +24,7 @@
namespace Magnum { namespace Magnum {
/** @brief Matrix, point and vector specializations for given dimension count */ /** @brief Matrix, point and vector specializations for given dimension count */
template<std::uint8_t dimensions, class T = GLfloat> struct DimensionTraits { template<UnsignedInt dimensions, class T = Float> struct DimensionTraits {
DimensionTraits() = delete; DimensionTraits() = delete;
#ifdef DOXYGEN_GENERATING_OUTPUT #ifdef DOXYGEN_GENERATING_OUTPUT
@ -61,17 +61,17 @@ template<class T> struct DimensionTraits<2, T> {
}; };
/* Two dimensions - floating-point */ /* Two dimensions - floating-point */
template<> struct DimensionTraits<2, float> { template<> struct DimensionTraits<2, Float> {
DimensionTraits() = delete; DimensionTraits() = delete;
typedef Math::Vector2<float> VectorType; typedef Math::Vector2<Float> VectorType;
typedef Math::Matrix3<float> MatrixType; typedef Math::Matrix3<Float> MatrixType;
}; };
template<> struct DimensionTraits<2, double> { template<> struct DimensionTraits<2, Double> {
DimensionTraits() = delete; DimensionTraits() = delete;
typedef Math::Vector2<double> VectorType; typedef Math::Vector2<Double> VectorType;
typedef Math::Matrix3<double> MatrixType; typedef Math::Matrix3<Double> MatrixType;
}; };
/* Three dimensions - integral */ /* Three dimensions - integral */
@ -82,17 +82,17 @@ template<class T> struct DimensionTraits<3, T> {
}; };
/* Three dimensions - floating-point */ /* Three dimensions - floating-point */
template<> struct DimensionTraits<3, float> { template<> struct DimensionTraits<3, Float> {
DimensionTraits() = delete; DimensionTraits() = delete;
typedef Math::Vector3<float> VectorType; typedef Math::Vector3<Float> VectorType;
typedef Math::Matrix4<float> MatrixType; typedef Math::Matrix4<Float> MatrixType;
}; };
template<> struct DimensionTraits<3, double> { template<> struct DimensionTraits<3, Double> {
DimensionTraits() = delete; DimensionTraits() = delete;
typedef Math::Vector3<double> VectorType; typedef Math::Vector3<Double> VectorType;
typedef Math::Matrix4<double> MatrixType; typedef Math::Matrix4<Double> MatrixType;
}; };
#endif #endif

4
src/Framebuffer.cpp

@ -58,7 +58,7 @@ Framebuffer::~Framebuffer() {
glDeleteFramebuffers(1, &_id); glDeleteFramebuffers(1, &_id);
} }
void Framebuffer::mapForDraw(std::initializer_list<std::pair<GLuint, DrawAttachment>> attachments) { void Framebuffer::mapForDraw(std::initializer_list<std::pair<UnsignedInt, DrawAttachment>> attachments) {
/* Max attachment location */ /* Max attachment location */
std::size_t max = 0; std::size_t max = 0;
for(const auto& attachment: attachments) for(const auto& attachment: attachments)
@ -94,7 +94,7 @@ void Framebuffer::invalidate(std::initializer_list<InvalidationAttachment> attac
delete _attachments; delete _attachments;
} }
void Framebuffer::attachTexture2D(BufferAttachment attachment, Texture2D* texture, GLint mipLevel) { void Framebuffer::attachTexture2D(BufferAttachment attachment, Texture2D* texture, Int mipLevel) {
/** @todo Check for texture target compatibility */ /** @todo Check for texture target compatibility */
(this->*texture2DImplementation)(attachment, GLenum(texture->target()), texture->id(), mipLevel); (this->*texture2DImplementation)(attachment, GLenum(texture->target()), texture->id(), mipLevel);
} }

12
src/Framebuffer.h

@ -105,7 +105,7 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer {
* @brief Constructor * @brief Constructor
* @param id Color attachment id * @param id Color attachment id
*/ */
inline constexpr explicit ColorAttachment(std::uint8_t id): attachment(GL_COLOR_ATTACHMENT0 + id) {} inline constexpr explicit ColorAttachment(UnsignedInt id): attachment(GL_COLOR_ATTACHMENT0 + id) {}
#ifndef DOXYGEN_GENERATING_OUTPUT #ifndef DOXYGEN_GENERATING_OUTPUT
inline constexpr explicit operator GLenum() const { return attachment; } inline constexpr explicit operator GLenum() const { return attachment; }
@ -238,7 +238,7 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer {
* @fn_gl_extension{FramebufferDrawBuffers,EXT,direct_state_access} * @fn_gl_extension{FramebufferDrawBuffers,EXT,direct_state_access}
* @requires_gles30 %Extension @es_extension2{NV,draw_buffers,GL_NV_draw_buffers} * @requires_gles30 %Extension @es_extension2{NV,draw_buffers,GL_NV_draw_buffers}
*/ */
void mapForDraw(std::initializer_list<std::pair<GLuint, DrawAttachment>> attachments); void mapForDraw(std::initializer_list<std::pair<UnsignedInt, DrawAttachment>> attachments);
/** /**
* @brief Map shader output to attachment * @brief Map shader output to attachment
@ -333,7 +333,7 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer {
* @fn_gl_extension{NamedFramebufferTexture1D,EXT,direct_state_access} * @fn_gl_extension{NamedFramebufferTexture1D,EXT,direct_state_access}
* @requires_gl Only 2D and 3D textures are available in OpenGL ES. * @requires_gl Only 2D and 3D textures are available in OpenGL ES.
*/ */
inline void attachTexture1D(BufferAttachment attachment, Texture1D* texture, GLint level) { inline void attachTexture1D(BufferAttachment attachment, Texture1D* texture, Int level) {
(this->*texture1DImplementation)(attachment, texture, level); (this->*texture1DImplementation)(attachment, texture, level);
} }
#endif #endif
@ -350,7 +350,7 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer {
* @see attachCubeMapTexture(), @fn_gl{BindFramebuffer}, @fn_gl{FramebufferTexture} * @see attachCubeMapTexture(), @fn_gl{BindFramebuffer}, @fn_gl{FramebufferTexture}
* or @fn_gl_extension{NamedFramebufferTexture2D,EXT,direct_state_access} * or @fn_gl_extension{NamedFramebufferTexture2D,EXT,direct_state_access}
*/ */
void attachTexture2D(BufferAttachment attachment, Texture2D* texture, GLint level); void attachTexture2D(BufferAttachment attachment, Texture2D* texture, Int level);
/** /**
* @brief Attach cube map texture to given buffer * @brief Attach cube map texture to given buffer
@ -365,7 +365,7 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer {
* @see attachTexture2D(), @fn_gl{BindFramebuffer}, @fn_gl{FramebufferTexture} * @see attachTexture2D(), @fn_gl{BindFramebuffer}, @fn_gl{FramebufferTexture}
* or @fn_gl_extension{NamedFramebufferTexture2D,EXT,direct_state_access} * or @fn_gl_extension{NamedFramebufferTexture2D,EXT,direct_state_access}
*/ */
inline void attachCubeMapTexture(BufferAttachment attachment, CubeMapTexture* texture, CubeMapTexture::Coordinate coordinate, GLint level) { inline void attachCubeMapTexture(BufferAttachment attachment, CubeMapTexture* texture, CubeMapTexture::Coordinate coordinate, Int level) {
(this->*texture2DImplementation)(attachment, GLenum(coordinate), texture->id(), level); (this->*texture2DImplementation)(attachment, GLenum(coordinate), texture->id(), level);
} }
@ -383,7 +383,7 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer {
* @fn_gl_extension{NamedFramebufferTexture3D,EXT,direct_state_access} * @fn_gl_extension{NamedFramebufferTexture3D,EXT,direct_state_access}
* @requires_es_extension %Extension @es_extension{OES,texture_3D} * @requires_es_extension %Extension @es_extension{OES,texture_3D}
*/ */
inline void attachTexture3D(BufferAttachment attachment, Texture3D* texture, GLint level, GLint layer) { inline void attachTexture3D(BufferAttachment attachment, Texture3D* texture, Int level, Int layer) {
/** @todo Check for texture target compatibility */ /** @todo Check for texture target compatibility */
(this->*texture3DImplementation)(attachment, texture, level, layer); (this->*texture3DImplementation)(attachment, texture, level, layer);
} }

2
src/Image.cpp

@ -17,7 +17,7 @@
namespace Magnum { namespace Magnum {
template<std::uint8_t dimensions> void Image<dimensions>::setData(const typename DimensionTraits<Dimensions, GLsizei>::VectorType& size, Format format, Type type, GLvoid* data) { template<UnsignedInt dimensions> void Image<dimensions>::setData(const typename DimensionTraits<Dimensions, GLsizei>::VectorType& size, Format format, Type type, GLvoid* data) {
delete[] _data; delete[] _data;
_format = format; _format = format;
_type = type; _type = type;

12
src/Image.h

@ -32,9 +32,9 @@ Stores image data on client memory. Interchangeable with ImageWrapper,
BufferImage or Trade::ImageData. BufferImage or Trade::ImageData.
@see Image1D, Image2D, Image3D @see Image1D, Image2D, Image3D
*/ */
template<std::uint8_t dimensions> class Image: public AbstractImage { template<UnsignedInt dimensions> class Image: public AbstractImage {
public: public:
const static std::uint8_t Dimensions = dimensions; /**< @brief %Image dimension count */ const static UnsignedInt Dimensions = dimensions; /**< @brief %Image dimension count */
/** /**
* @brief Constructor * @brief Constructor
@ -46,7 +46,7 @@ template<std::uint8_t dimensions> class Image: public AbstractImage {
* Note that the image data are not copied on construction, but they * Note that the image data are not copied on construction, but they
* are deleted on class destruction. * are deleted on class destruction.
*/ */
inline explicit Image(const typename DimensionTraits<Dimensions, GLsizei>::VectorType& size, Format format, Type type, GLvoid* data): AbstractImage(format, type), _size(size), _data(reinterpret_cast<char*>(data)) {} inline explicit Image(const typename DimensionTraits<Dimensions, Int>::VectorType& size, Format format, Type type, GLvoid* data): AbstractImage(format, type), _size(size), _data(reinterpret_cast<char*>(data)) {}
/** /**
* @brief Constructor * @brief Constructor
@ -62,7 +62,7 @@ template<std::uint8_t dimensions> class Image: public AbstractImage {
inline ~Image() { delete[] _data; } inline ~Image() { delete[] _data; }
/** @brief %Image size */ /** @brief %Image size */
inline typename DimensionTraits<Dimensions, GLsizei>::VectorType size() const { return _size; } inline typename DimensionTraits<Dimensions, Int>::VectorType size() const { return _size; }
/** @brief Pointer to raw data */ /** @brief Pointer to raw data */
inline void* data() { return _data; } inline void* data() { return _data; }
@ -78,10 +78,10 @@ template<std::uint8_t dimensions> class Image: public AbstractImage {
* Deletes previous data and replaces them with new. Note that the * Deletes previous data and replaces them with new. Note that the
* data are not copied, but they are deleted on destruction. * data are not copied, but they are deleted on destruction.
*/ */
void setData(const typename DimensionTraits<Dimensions, GLsizei>::VectorType& size, Format format, Type type, GLvoid* data); void setData(const typename DimensionTraits<Dimensions, Int>::VectorType& size, Format format, Type type, GLvoid* data);
private: private:
Math::Vector<Dimensions, GLsizei> _size; Math::Vector<Dimensions, Int> _size;
char* _data; char* _data;
}; };

12
src/ImageWrapper.h

@ -40,9 +40,9 @@ to change image properties, only data pointer.
Interchangeable with Image, BufferImage or Trade::ImageData. Interchangeable with Image, BufferImage or Trade::ImageData.
@see ImageWrapper1D, ImageWrapper2D, ImageWrapper3D @see ImageWrapper1D, ImageWrapper2D, ImageWrapper3D
*/ */
template<std::uint8_t dimensions> class ImageWrapper: public AbstractImage { template<UnsignedInt dimensions> class ImageWrapper: public AbstractImage {
public: public:
const static std::uint8_t Dimensions = dimensions; /**< @brief %Image dimension count */ const static UnsignedInt Dimensions = dimensions; /**< @brief %Image dimension count */
/** /**
* @brief Constructor * @brief Constructor
* @param size %Image size * @param size %Image size
@ -53,7 +53,7 @@ template<std::uint8_t dimensions> class ImageWrapper: public AbstractImage {
* Note that the image data are not copied on construction, but they * Note that the image data are not copied on construction, but they
* are deleted on class destruction. * are deleted on class destruction.
*/ */
inline explicit ImageWrapper(const typename DimensionTraits<Dimensions, GLsizei>::VectorType& size, Format format, Type type, GLvoid* data): AbstractImage(format, type), _size(size), _data(reinterpret_cast<char*>(data)) {} inline explicit ImageWrapper(const typename DimensionTraits<Dimensions, Int>::VectorType& size, Format format, Type type, GLvoid* data): AbstractImage(format, type), _size(size), _data(reinterpret_cast<char*>(data)) {}
/** /**
* @brief Constructor * @brief Constructor
@ -64,10 +64,10 @@ template<std::uint8_t dimensions> class ImageWrapper: public AbstractImage {
* Dimensions and data pointer are set to zero, call setData() to fill * Dimensions and data pointer are set to zero, call setData() to fill
* the image with data. * the image with data.
*/ */
inline explicit ImageWrapper(const typename DimensionTraits<Dimensions, GLsizei>::VectorType& size, Format format, Type type): AbstractImage(format, type), _size(size), _data(nullptr) {} inline explicit ImageWrapper(const typename DimensionTraits<Dimensions, Int>::VectorType& size, Format format, Type type): AbstractImage(format, type), _size(size), _data(nullptr) {}
/** @brief %Image size */ /** @brief %Image size */
inline typename DimensionTraits<Dimensions, GLsizei>::VectorType size() const { return _size; } inline typename DimensionTraits<Dimensions, Int>::VectorType size() const { return _size; }
/** @brief Pointer to raw data */ /** @brief Pointer to raw data */
inline void* data() { return _data; } inline void* data() { return _data; }
@ -86,7 +86,7 @@ template<std::uint8_t dimensions> class ImageWrapper: public AbstractImage {
} }
private: private:
Math::Vector<Dimensions, GLsizei> _size; Math::Vector<Dimensions, Int> _size;
char* _data; char* _data;
}; };

22
src/Magnum.h

@ -267,7 +267,7 @@ class AbstractImage;
class AbstractShaderProgram; class AbstractShaderProgram;
class AbstractTexture; class AbstractTexture;
template<std::uint8_t, class T> class Array; template<UnsignedInt, class T> class Array;
template<class T> class Array1D; template<class T> class Array1D;
template<class T> class Array2D; template<class T> class Array2D;
template<class T> class Array3D; template<class T> class Array3D;
@ -275,7 +275,7 @@ template<class T> class Array3D;
class Buffer; class Buffer;
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
template<std::uint8_t> class BufferImage; template<UnsignedInt> class BufferImage;
typedef BufferImage<1> BufferImage1D; typedef BufferImage<1> BufferImage1D;
typedef BufferImage<2> BufferImage2D; typedef BufferImage<2> BufferImage2D;
typedef BufferImage<3> BufferImage3D; typedef BufferImage<3> BufferImage3D;
@ -285,10 +285,10 @@ typedef BufferImage<3> BufferImage3D;
class BufferTexture; class BufferTexture;
#endif #endif
template<class T = GLfloat> class Color3; template<class T = Float> class Color3;
template<class T = GLfloat> class Color4; template<class T = Float> class Color4;
enum class Version: GLint; enum class Version: Int;
class Context; class Context;
class CubeMapTexture; class CubeMapTexture;
@ -303,12 +303,12 @@ class CubeMapTextureArray;
class Extension; class Extension;
class Framebuffer; class Framebuffer;
template<std::uint8_t> class Image; template<UnsignedInt> class Image;
typedef Image<1> Image1D; typedef Image<1> Image1D;
typedef Image<2> Image2D; typedef Image<2> Image2D;
typedef Image<3> Image3D; typedef Image<3> Image3D;
template<std::uint8_t> class ImageWrapper; template<UnsignedInt> class ImageWrapper;
typedef ImageWrapper<1> ImageWrapper1D; typedef ImageWrapper<1> ImageWrapper1D;
typedef ImageWrapper<2> ImageWrapper2D; typedef ImageWrapper<2> ImageWrapper2D;
typedef ImageWrapper<3> ImageWrapper3D; typedef ImageWrapper<3> ImageWrapper3D;
@ -317,16 +317,16 @@ class Mesh;
class Query; class Query;
class Renderbuffer; class Renderbuffer;
enum class ResourceState: std::uint8_t; enum class ResourceState: UnsignedByte;
enum class ResourceDataState: std::uint8_t; enum class ResourceDataState: UnsignedByte;
enum class ResourcePolicy: std::uint8_t; enum class ResourcePolicy: UnsignedByte;
template<class T, class U = T> class Resource; template<class T, class U = T> class Resource;
class ResourceKey; class ResourceKey;
template<class...> class ResourceManager; template<class...> class ResourceManager;
class Shader; class Shader;
template<std::uint8_t> class Texture; template<UnsignedInt> class Texture;
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
typedef Texture<1> Texture1D; typedef Texture<1> Texture1D;
#endif #endif

2
src/Mesh.cpp

@ -108,7 +108,7 @@ Mesh& Mesh::operator=(Mesh&& other) {
return *this; return *this;
} }
Mesh* Mesh::setIndexBuffer(Buffer* buffer, GLintptr offset, IndexType type, GLuint start, GLuint end) { Mesh* Mesh::setIndexBuffer(Buffer* buffer, GLintptr offset, IndexType type, UnsignedInt start, UnsignedInt end) {
indexOffset = offset; indexOffset = offset;
indexType = type; indexType = type;
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2

48
src/Mesh.h

@ -381,7 +381,7 @@ class MAGNUM_EXPORT Mesh {
* polygon offset for desired polygon modes. * polygon offset for desired polygon modes.
* @see @fn_gl{PolygonOffset} * @see @fn_gl{PolygonOffset}
*/ */
inline static void setPolygonOffset(GLfloat factor, GLfloat units) { inline static void setPolygonOffset(Float factor, Float units) {
glPolygonOffset(factor, units); glPolygonOffset(factor, units);
} }
@ -391,7 +391,7 @@ class MAGNUM_EXPORT Mesh {
* Initial value is `1.0f`. * Initial value is `1.0f`.
* @see @fn_gl{LineWidth} * @see @fn_gl{LineWidth}
*/ */
inline static void setLineWidth(GLfloat width) { inline static void setLineWidth(Float width) {
glLineWidth(width); glLineWidth(width);
} }
@ -404,7 +404,7 @@ class MAGNUM_EXPORT Mesh {
* @requires_gl Set directly in vertex shader using @c gl_PointSize * @requires_gl Set directly in vertex shader using @c gl_PointSize
* builtin variable. * builtin variable.
*/ */
inline static void setPointSize(GLfloat size) { inline static void setPointSize(Float size) {
glPointSize(size); glPointSize(size);
} }
@ -528,7 +528,7 @@ class MAGNUM_EXPORT Mesh {
} }
/** @brief Vertex count */ /** @brief Vertex count */
inline GLsizei vertexCount() const { return _vertexCount; } inline Int vertexCount() const { return _vertexCount; }
/** /**
* @brief Set vertex count * @brief Set vertex count
@ -538,13 +538,13 @@ class MAGNUM_EXPORT Mesh {
* @see setPrimitive(), addVertexBuffer(), addInterleavedVertexBuffer(), * @see setPrimitive(), addVertexBuffer(), addInterleavedVertexBuffer(),
* addVertexBufferStride(), MeshTools::interleave() * addVertexBufferStride(), MeshTools::interleave()
*/ */
inline Mesh* setVertexCount(GLsizei vertexCount) { inline Mesh* setVertexCount(Int vertexCount) {
_vertexCount = vertexCount; _vertexCount = vertexCount;
return this; return this;
} }
/** @brief Index count */ /** @brief Index count */
inline GLsizei indexCount() const { return _indexCount; } inline Int indexCount() const { return _indexCount; }
/** /**
* @brief Set index count * @brief Set index count
@ -553,7 +553,7 @@ class MAGNUM_EXPORT Mesh {
* Default is zero. * Default is zero.
* @see setIndexBuffer(), MeshTools::compressIndices() * @see setIndexBuffer(), MeshTools::compressIndices()
*/ */
inline Mesh* setIndexCount(GLsizei count) { inline Mesh* setIndexCount(Int count) {
_indexCount = count; _indexCount = count;
return this; return this;
} }
@ -637,7 +637,7 @@ class MAGNUM_EXPORT Mesh {
* Buffer* buffer; * Buffer* buffer;
* mesh->addInterleavedVertexBuffer(buffer, * mesh->addInterleavedVertexBuffer(buffer,
* 35, // skip other data * 35, // skip other data
* sizeof(GLfloat), // skip vertex weight * sizeof(Float), // skip vertex weight
* Shaders::PhongShader::Position(), // vertex position * Shaders::PhongShader::Position(), // vertex position
* sizeof(Vector2), // skip texture coordinates * sizeof(Vector2), // skip texture coordinates
* Shaders::PhongShader::Normal()); // vertex normal * Shaders::PhongShader::Normal()); // vertex normal
@ -648,14 +648,14 @@ class MAGNUM_EXPORT Mesh {
* between vertex attributes: * between vertex attributes:
* @code * @code
* GLsizei stride = // size of one vertex * GLsizei stride = // size of one vertex
* sizeof(GLfloat) + * sizeof(Float) +
* sizeof(Shaders::PhongShader::Position::Type) + * sizeof(Shaders::PhongShader::Position::Type) +
* sizeof(Vector2) + * sizeof(Vector2) +
* sizeof(Shaders::PhongShader::Normal::Type); * sizeof(Shaders::PhongShader::Normal::Type);
* *
* mesh->addVertexBufferStride(buffer, 35 + sizeof(GLfloat), * mesh->addVertexBufferStride(buffer, 35 + sizeof(Float),
* stride, Shaders::PhongShader::Position()); * stride, Shaders::PhongShader::Position());
* ->addVertexBufferStride(buffer, 35 + sizeof(GLfloat) + * ->addVertexBufferStride(buffer, 35 + sizeof(Float) +
* sizeof(Shaders::PhongShader::Position::Type) + sizeof(Vector2), * sizeof(Shaders::PhongShader::Position::Type) + sizeof(Vector2),
* stride, Shaders::PhongShader::Normal()); * stride, Shaders::PhongShader::Normal());
* @endcode * @endcode
@ -683,7 +683,7 @@ class MAGNUM_EXPORT Mesh {
* *
* See addInterleavedVertexBuffer() for more information. * See addInterleavedVertexBuffer() for more information.
*/ */
template<GLuint location, class T> inline Mesh* addVertexBufferStride(Buffer* buffer, GLintptr offset, GLsizei stride, const AbstractShaderProgram::Attribute<location, T>& attribute) { template<UnsignedInt location, class T> inline Mesh* addVertexBufferStride(Buffer* buffer, GLintptr offset, GLsizei stride, const AbstractShaderProgram::Attribute<location, T>& attribute) {
addInterleavedVertexBufferInternal(buffer, offset, stride, attribute); addInterleavedVertexBufferInternal(buffer, offset, stride, attribute);
return this; return this;
} }
@ -708,7 +708,7 @@ class MAGNUM_EXPORT Mesh {
* @fn_gl{BindVertexArray}, @fn_gl{BindBuffer} (if * @fn_gl{BindVertexArray}, @fn_gl{BindBuffer} (if
* @extension{APPLE,vertex_array_object} is available) * @extension{APPLE,vertex_array_object} is available)
*/ */
Mesh* setIndexBuffer(Buffer* buffer, GLintptr offset, IndexType type, GLuint start, GLuint end); Mesh* setIndexBuffer(Buffer* buffer, GLintptr offset, IndexType type, UnsignedInt start, UnsignedInt end);
/** /**
* @brief Set index buffer * @brief Set index buffer
@ -717,7 +717,7 @@ class MAGNUM_EXPORT Mesh {
* @param type Index data type * @param type Index data type
* @return Pointer to self (for method chaining) * @return Pointer to self (for method chaining)
* *
* Prefer to use setIndexBuffer(Buffer*, GLintptr, IndexType, GLuint, GLuint) * Prefer to use setIndexBuffer(Buffer*, GLintptr, IndexType, UnsignedInt, UnsignedInt)
* for better performance. * for better performance.
* @see setIndexCount(), MeshTools::compressIndices(), * @see setIndexCount(), MeshTools::compressIndices(),
* @fn_gl{BindVertexArray}, @fn_gl{BindBuffer} (if * @fn_gl{BindVertexArray}, @fn_gl{BindBuffer} (if
@ -778,7 +778,7 @@ class MAGNUM_EXPORT Mesh {
static void MAGNUM_LOCAL initializeContextBasedFunctionality(Context* context); static void MAGNUM_LOCAL initializeContextBasedFunctionality(Context* context);
/* Adding non-interleaved vertex attributes */ /* Adding non-interleaved vertex attributes */
template<GLuint location, class T, class ...U> inline void addVertexBufferInternal(Buffer* buffer, GLintptr offset, const AbstractShaderProgram::Attribute<location, T>& attribute, const U&... attributes) { template<UnsignedInt location, class T, class ...U> inline void addVertexBufferInternal(Buffer* buffer, GLintptr offset, const AbstractShaderProgram::Attribute<location, T>& attribute, const U&... attributes) {
addVertexAttribute(buffer, attribute, offset, 0); addVertexAttribute(buffer, attribute, offset, 0);
/* Add size of this attribute array to offset for next attribute */ /* Add size of this attribute array to offset for next attribute */
@ -791,7 +791,7 @@ class MAGNUM_EXPORT Mesh {
inline void addVertexBufferInternal(Buffer*, GLintptr) {} inline void addVertexBufferInternal(Buffer*, GLintptr) {}
/* Computing stride of interleaved vertex attributes */ /* Computing stride of interleaved vertex attributes */
template<GLuint location, class T, class ...U> inline static GLsizei strideOfInterleaved(const AbstractShaderProgram::Attribute<location, T>& attribute, const U&... attributes) { template<UnsignedInt location, class T, class ...U> inline static GLsizei strideOfInterleaved(const AbstractShaderProgram::Attribute<location, T>& attribute, const U&... attributes) {
return attribute.dataSize() + strideOfInterleaved(attributes...); return attribute.dataSize() + strideOfInterleaved(attributes...);
} }
template<class ...T> inline static GLsizei strideOfInterleaved(GLintptr gap, const T&... attributes) { template<class ...T> inline static GLsizei strideOfInterleaved(GLintptr gap, const T&... attributes) {
@ -800,7 +800,7 @@ class MAGNUM_EXPORT Mesh {
inline static GLsizei strideOfInterleaved() { return 0; } inline static GLsizei strideOfInterleaved() { return 0; }
/* Adding interleaved vertex attributes */ /* Adding interleaved vertex attributes */
template<GLuint location, class T, class ...U> inline void addInterleavedVertexBufferInternal(Buffer* buffer, GLintptr offset, GLsizei stride, const AbstractShaderProgram::Attribute<location, T>& attribute, const U&... attributes) { template<UnsignedInt location, class T, class ...U> inline void addInterleavedVertexBufferInternal(Buffer* buffer, GLintptr offset, GLsizei stride, const AbstractShaderProgram::Attribute<location, T>& attribute, const U&... attributes) {
addVertexAttribute(buffer, attribute, offset, stride); addVertexAttribute(buffer, attribute, offset, stride);
/* Add size of this attribute to offset for next attribute */ /* Add size of this attribute to offset for next attribute */
@ -812,8 +812,8 @@ class MAGNUM_EXPORT Mesh {
} }
inline void addInterleavedVertexBufferInternal(Buffer*, GLsizei, GLintptr) {} inline void addInterleavedVertexBufferInternal(Buffer*, GLsizei, GLintptr) {}
template<GLuint location, class T> inline void addVertexAttribute(typename std::enable_if<std::is_same<typename Implementation::Attribute<T>::Type, GLfloat>::value, Buffer*>::type buffer, const AbstractShaderProgram::Attribute<location, T>& attribute, GLintptr offset, GLsizei stride) { template<UnsignedInt location, class T> inline void addVertexAttribute(typename std::enable_if<std::is_same<typename Implementation::Attribute<T>::Type, Float>::value, Buffer*>::type buffer, const AbstractShaderProgram::Attribute<location, T>& attribute, GLintptr offset, GLsizei stride) {
for(GLuint i = 0; i != Implementation::Attribute<T>::vectorCount(); ++i) for(UnsignedInt i = 0; i != Implementation::Attribute<T>::vectorCount(); ++i)
(this->*attributePointerImplementation)(Attribute{ (this->*attributePointerImplementation)(Attribute{
buffer, buffer,
location+i, location+i,
@ -826,7 +826,7 @@ class MAGNUM_EXPORT Mesh {
} }
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
template<GLuint location, class T> inline void addVertexAttribute(typename std::enable_if<std::is_integral<typename Implementation::Attribute<T>::Type>::value, Buffer*>::type buffer, const AbstractShaderProgram::Attribute<location, T>& attribute, GLintptr offset, GLsizei stride) { template<UnsignedInt location, class T> inline void addVertexAttribute(typename std::enable_if<std::is_integral<typename Implementation::Attribute<T>::Type>::value, Buffer*>::type buffer, const AbstractShaderProgram::Attribute<location, T>& attribute, GLintptr offset, GLsizei stride) {
(this->*attributeIPointerImplementation)(IntegerAttribute{ (this->*attributeIPointerImplementation)(IntegerAttribute{
buffer, buffer,
location, location,
@ -838,8 +838,8 @@ class MAGNUM_EXPORT Mesh {
} }
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
template<GLuint location, class T> inline void addVertexAttribute(typename std::enable_if<std::is_same<typename Implementation::Attribute<T>::Type, GLdouble>::value, Buffer*>::type buffer, const AbstractShaderProgram::Attribute<location, T>& attribute, GLintptr offset, GLsizei stride) { template<UnsignedInt location, class T> inline void addVertexAttribute(typename std::enable_if<std::is_same<typename Implementation::Attribute<T>::Type, Double>::value, Buffer*>::type buffer, const AbstractShaderProgram::Attribute<location, T>& attribute, GLintptr offset, GLsizei stride) {
for(GLuint i = 0; i != Implementation::Attribute<T>::vectorCount(); ++i) for(UnsignedInt i = 0; i != Implementation::Attribute<T>::vectorCount(); ++i)
(this->*attributeLPointerImplementation)(LongAttribute{ (this->*attributeLPointerImplementation)(LongAttribute{
buffer, buffer,
location+i, location+i,
@ -915,9 +915,9 @@ class MAGNUM_EXPORT Mesh {
GLuint vao; GLuint vao;
Primitive _primitive; Primitive _primitive;
GLsizei _vertexCount, _indexCount; Int _vertexCount, _indexCount;
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
GLuint indexStart, indexEnd; UnsignedInt indexStart, indexEnd;
#endif #endif
GLintptr indexOffset; GLintptr indexOffset;
IndexType indexType; IndexType indexType;

16
src/Query.cpp

@ -39,10 +39,10 @@ template<> bool AbstractQuery::result<bool>() {
#endif #endif
} }
template<> GLuint AbstractQuery::result<GLuint>() { template<> UnsignedInt AbstractQuery::result<UnsignedInt>() {
/** @todo Re-enable when extension wrangler is available for ES */ /** @todo Re-enable when extension wrangler is available for ES */
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
GLuint result; UnsignedInt result;
glGetQueryObjectuiv(_id, GL_QUERY_RESULT, &result); glGetQueryObjectuiv(_id, GL_QUERY_RESULT, &result);
return result; return result;
#else #else
@ -51,20 +51,20 @@ template<> GLuint AbstractQuery::result<GLuint>() {
} }
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
template<> GLint AbstractQuery::result<GLint>() { template<> Int AbstractQuery::result<Int>() {
GLint result; Int result;
glGetQueryObjectiv(_id, GL_QUERY_RESULT, &result); glGetQueryObjectiv(_id, GL_QUERY_RESULT, &result);
return result; return result;
} }
template<> GLuint64 AbstractQuery::result<GLuint64>() { template<> UnsignedLong AbstractQuery::result<UnsignedLong>() {
GLuint64 result; UnsignedLong result;
glGetQueryObjectui64v(_id, GL_QUERY_RESULT, &result); glGetQueryObjectui64v(_id, GL_QUERY_RESULT, &result);
return result; return result;
} }
template<> GLint64 AbstractQuery::result<GLint64>() { template<> Long AbstractQuery::result<Long>() {
GLint64 result; Long result;
glGetQueryObjecti64v(_id, GL_QUERY_RESULT, &result); glGetQueryObjecti64v(_id, GL_QUERY_RESULT, &result);
return result; return result;
} }

32
src/Query.h

@ -72,16 +72,16 @@ class MAGNUM_EXPORT AbstractQuery {
/** /**
* @brief Result * @brief Result
* @tparam T Result type. Can be either `bool`, `GLuint`, * @tparam T Result type. Can be either `bool`, @ref UnsignedInt,
* `GLint`, `GLuint64` or `GLint64`. * @ref Int, @ref UnsignedLong or @ref Long.
* *
* Note that this function is blocking until the result is available. * Note that this function is blocking until the result is available.
* See resultAvailable(). * See resultAvailable().
* @see @fn_gl{GetQueryObject} with @def_gl{QUERY_RESULT} * @see @fn_gl{GetQueryObject} with @def_gl{QUERY_RESULT}
* @requires_gl33 %Extension @extension{ARB,timer_query} (result * @requires_gl33 %Extension @extension{ARB,timer_query} (result type
* type `GLuint64` and `GLint64`) * UnsignedInt and Long)
* @requires_gl Result types @c GLint, @c GLuint64 and @c GLint64 are * @requires_gl Result types Int, UnsignedLong and Long are not
* not available in OpenGL ES. * available in OpenGL ES.
*/ */
template<class T> T result(); template<class T> T result();
@ -92,11 +92,11 @@ class MAGNUM_EXPORT AbstractQuery {
#ifndef DOXYGEN_GENERATING_OUTPUT #ifndef DOXYGEN_GENERATING_OUTPUT
template<> bool MAGNUM_EXPORT AbstractQuery::result<bool>(); template<> bool MAGNUM_EXPORT AbstractQuery::result<bool>();
template<> GLuint MAGNUM_EXPORT AbstractQuery::result<GLuint>(); template<> UnsignedInt MAGNUM_EXPORT AbstractQuery::result<UnsignedInt>();
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
template<> GLint MAGNUM_EXPORT AbstractQuery::result<GLint>(); template<> Int MAGNUM_EXPORT AbstractQuery::result<Int>();
template<> GLuint64 MAGNUM_EXPORT AbstractQuery::result<GLuint64>(); template<> UnsignedLong MAGNUM_EXPORT AbstractQuery::result<UnsignedLong>();
template<> GLint64 MAGNUM_EXPORT AbstractQuery::result<GLint64>(); template<> Long MAGNUM_EXPORT AbstractQuery::result<Long>();
#endif #endif
#endif #endif
@ -118,7 +118,7 @@ if(!q.resultAvailable()) {
} }
// ...or block until the result is available // ...or block until the result is available
GLuint primitiveCount = q.result<GLuint>(); UnsignedInt primitiveCount = q.result<UnsignedInt>();
@endcode @endcode
@requires_gl30 %Extension @extension{EXT,transform_feedback} @requires_gl30 %Extension @extension{EXT,transform_feedback}
@requires_gles30 Only sample queries are available on OpenGL ES 2.0. @requires_gles30 Only sample queries are available on OpenGL ES 2.0.
@ -338,8 +338,8 @@ q1.end();
q2.begin(Query::Target::TimeElapsed); q2.begin(Query::Target::TimeElapsed);
// another rendering... // another rendering...
q2.end(); q2.end();
GLuint timeElapsed1 = q1.result<GLuint>(); UnsignedInt timeElapsed1 = q1.result<UnsignedInt>();
GLuint timeElapsed2 = q2.result<GLuint>(); UnsignedInt timeElapsed2 = q2.result<UnsignedInt>();
@endcode @endcode
@code @code
TimeQuery q1, q2, q3; TimeQuery q1, q2, q3;
@ -348,9 +348,9 @@ q1.timestamp();
q2.timestamp(); q2.timestamp();
// another rendering... // another rendering...
q3.timestamp(); q3.timestamp();
GLuint tmp = q2.result<GLuint>(); UnsignedInt tmp = q2.result<UnsignedInt>();
GLuint timeElapsed1 = tmp-q1.result<GLuint>(); UnsignedInt timeElapsed1 = tmp-q1.result<UnsignedInt>();
GLuint timeElapsed2 = q3.result<GLuint>()-tmp; UnsignedInt timeElapsed2 = q3.result<UnsignedInt>()-tmp;
@endcode @endcode
Using this query results in fewer OpenGL calls when doing more measures. Using this query results in fewer OpenGL calls when doing more measures.
@requires_gl33 %Extension @extension{ARB,timer_query} @requires_gl33 %Extension @extension{ARB,timer_query}

28
src/Renderer.h

@ -43,9 +43,9 @@ class MAGNUM_EXPORT Renderer {
* @brief Affected polygon facing for culling, stencil operations and masks * @brief Affected polygon facing for culling, stencil operations and masks
* *
* @see setFaceCullingMode(), * @see setFaceCullingMode(),
* setStencilFunction(PolygonFacing, StencilFunction, GLint, GLuint), * setStencilFunction(PolygonFacing, StencilFunction, Int, UnsignedInt),
* setStencilOperation(PolygonFacing, StencilOperation, StencilOperation, StencilOperation), * setStencilOperation(PolygonFacing, StencilOperation, StencilOperation, StencilOperation),
* setStencilMask(PolygonFacing, GLuint) * setStencilMask(PolygonFacing, UnsignedInt)
*/ */
enum class PolygonFacing: GLenum { enum class PolygonFacing: GLenum {
Front = GL_FRONT, /**< Front-facing polygons */ Front = GL_FRONT, /**< Front-facing polygons */
@ -137,9 +137,9 @@ class MAGNUM_EXPORT Renderer {
* *
* Initial value is `1.0`. * Initial value is `1.0`.
* @see @fn_gl{ClearDepth} * @see @fn_gl{ClearDepth}
* @requires_gl See setClearDepth(GLfloat), which is available in OpenGL ES. * @requires_gl See setClearDepth(Float), which is available in OpenGL ES.
*/ */
inline static void setClearDepth(GLdouble depth) { glClearDepth(depth); } inline static void setClearDepth(Double depth) { glClearDepth(depth); }
#endif #endif
/** /**
@ -149,7 +149,7 @@ class MAGNUM_EXPORT Renderer {
* @requires_gl41 %Extension @extension{ARB,ES2_compatibility} * @requires_gl41 %Extension @extension{ARB,ES2_compatibility}
* @todo Call double version if the extension is not available * @todo Call double version if the extension is not available
*/ */
inline static void setClearDepth(GLfloat depth) { glClearDepthf(depth); } inline static void setClearDepth(Float depth) { glClearDepthf(depth); }
/** /**
* @brief Set clear stencil * @brief Set clear stencil
@ -157,7 +157,7 @@ class MAGNUM_EXPORT Renderer {
* Initial value is `0`. * Initial value is `0`.
* @see @fn_gl{ClearStencil} * @see @fn_gl{ClearStencil}
*/ */
inline static void setClearStencil(GLint stencil) { glClearStencil(stencil); } inline static void setClearStencil(Int stencil) { glClearStencil(stencil); }
/*@}*/ /*@}*/
@ -252,21 +252,21 @@ class MAGNUM_EXPORT Renderer {
* Initial value is all `1`s. * Initial value is all `1`s.
* *
* @attention You have to enable stencil test with setFeature() first. * @attention You have to enable stencil test with setFeature() first.
* @see setStencilFunction(StencilFunction, GLint, GLuint), * @see setStencilFunction(StencilFunction, Int, UnsignedInt),
* @fn_gl{StencilFuncSeparate} * @fn_gl{StencilFuncSeparate}
*/ */
inline static void setStencilFunction(PolygonFacing facing, StencilFunction function, GLint referenceValue, GLuint mask) { inline static void setStencilFunction(PolygonFacing facing, StencilFunction function, Int referenceValue, UnsignedInt mask) {
glStencilFuncSeparate(static_cast<GLenum>(facing), static_cast<GLenum>(function), referenceValue, mask); glStencilFuncSeparate(static_cast<GLenum>(facing), static_cast<GLenum>(function), referenceValue, mask);
} }
/** /**
* @brief Set stencil function * @brief Set stencil function
* *
* The same as setStencilFunction(PolygonFacing, StencilFunction, GLint, GLuint) * The same as setStencilFunction(PolygonFacing, StencilFunction, Int, UnsignedInt)
* with `facing` set to `PolygonFacing::FrontAndBack`. * with `facing` set to `PolygonFacing::FrontAndBack`.
* @see @fn_gl{StencilFunc} * @see @fn_gl{StencilFunc}
*/ */
inline static void setStencilFunction(StencilFunction function, GLint referenceValue, GLuint mask) { inline static void setStencilFunction(StencilFunction function, Int referenceValue, UnsignedInt mask) {
glStencilFunc(static_cast<GLenum>(function), referenceValue, mask); glStencilFunc(static_cast<GLenum>(function), referenceValue, mask);
} }
@ -353,20 +353,20 @@ class MAGNUM_EXPORT Renderer {
* *
* Set given bit to `0` to disallow writing stencil value for given * Set given bit to `0` to disallow writing stencil value for given
* faces to it. Initial value is all `1`s. * faces to it. Initial value is all `1`s.
* @see setStencilMask(GLuint), @fn_gl{StencilMaskSeparate} * @see setStencilMask(UnsignedInt), @fn_gl{StencilMaskSeparate}
*/ */
inline static void setStencilMask(PolygonFacing facing, GLuint allowBits) { inline static void setStencilMask(PolygonFacing facing, UnsignedInt allowBits) {
glStencilMaskSeparate(static_cast<GLenum>(facing), allowBits); glStencilMaskSeparate(static_cast<GLenum>(facing), allowBits);
} }
/** /**
* @brief Mask stencil writes * @brief Mask stencil writes
* *
* The same as setStencilMask(PolygonFacing, GLuint) with `facing` set * The same as setStencilMask(PolygonFacing, UnsignedInt) with `facing` set
* to `PolygonFacing::FrontAndBack`. * to `PolygonFacing::FrontAndBack`.
* @see @fn_gl{StencilMask} * @see @fn_gl{StencilMask}
*/ */
inline static void setStencilMask(GLuint allowBits) { inline static void setStencilMask(UnsignedInt allowBits) {
glStencilMask(allowBits); glStencilMask(allowBits);
} }

2
src/Resource.h

@ -33,7 +33,7 @@ namespace Magnum {
* *
* @see Resource::state(), ResourceManager::state() * @see Resource::state(), ResourceManager::state()
*/ */
enum class ResourceState: std::uint8_t { enum class ResourceState: UnsignedByte {
/** The resource is not yet loaded (and no fallback is available). */ /** The resource is not yet loaded (and no fallback is available). */
NotLoaded, NotLoaded,

12
src/ResourceManager.h

@ -30,18 +30,18 @@ namespace Magnum {
* *
* @see ResourceManager::set(), ResourceState * @see ResourceManager::set(), ResourceState
*/ */
enum class ResourceDataState: std::uint8_t { enum class ResourceDataState: UnsignedByte {
/** /**
* The resource is currently loading. Parameter @p data in ResourceManager::set() * The resource is currently loading. Parameter @p data in ResourceManager::set()
* should be set to `null`. * should be set to `null`.
*/ */
Loading = int(ResourceState::Loading), Loading = UnsignedByte(ResourceState::Loading),
/** /**
* The resource was not found. Parameter @p data in ResourceManager::set() * The resource was not found. Parameter @p data in ResourceManager::set()
* should be set to `null`. * should be set to `null`.
*/ */
NotFound = int(ResourceState::NotFound), NotFound = UnsignedByte(ResourceState::NotFound),
/** /**
* The resource can be changed by the manager in the future. This is * The resource can be changed by the manager in the future. This is
@ -49,14 +49,14 @@ enum class ResourceDataState: std::uint8_t {
* the data are accessed, but allows changing the data for e.g. debugging * the data are accessed, but allows changing the data for e.g. debugging
* purposes. * purposes.
*/ */
Mutable = std::uint8_t(ResourceState::Mutable), Mutable = UnsignedByte(ResourceState::Mutable),
/** /**
* The resource cannot be changed by the manager in the future. This is * The resource cannot be changed by the manager in the future. This is
* faster, as Resource instances will ask for the data only one time, thus * faster, as Resource instances will ask for the data only one time, thus
* suitable for production code. * suitable for production code.
*/ */
Final = std::uint8_t(ResourceState::Final) Final = UnsignedByte(ResourceState::Final)
}; };
/** @relates ResourceManager /** @relates ResourceManager
@ -64,7 +64,7 @@ enum class ResourceDataState: std::uint8_t {
@see ResourceManager::set(), ResourceManager::free() @see ResourceManager::set(), ResourceManager::free()
*/ */
enum class ResourcePolicy: std::uint8_t { enum class ResourcePolicy: UnsignedByte {
/** The resource will stay resident for whole lifetime of resource manager. */ /** The resource will stay resident for whole lifetime of resource manager. */
Resident, Resident,

8
src/Test/AbstractShaderProgramTest.cpp

@ -57,7 +57,7 @@ AbstractShaderProgramTest::AbstractShaderProgramTest() {
} }
void AbstractShaderProgramTest::attributeScalar() { void AbstractShaderProgramTest::attributeScalar() {
typedef AbstractShaderProgram::Attribute<3, GLfloat> Attribute; typedef AbstractShaderProgram::Attribute<3, Float> Attribute;
CORRADE_COMPARE(Attribute::Location, 3); CORRADE_COMPARE(Attribute::Location, 3);
/* Default constructor */ /* Default constructor */
@ -74,7 +74,7 @@ void AbstractShaderProgramTest::attributeScalar() {
} }
void AbstractShaderProgramTest::attributeScalarInt() { void AbstractShaderProgramTest::attributeScalarInt() {
typedef AbstractShaderProgram::Attribute<3, GLint> Attribute; typedef AbstractShaderProgram::Attribute<3, Int> Attribute;
/* Default constructor */ /* Default constructor */
Attribute a; Attribute a;
@ -86,7 +86,7 @@ void AbstractShaderProgramTest::attributeScalarInt() {
} }
void AbstractShaderProgramTest::attributeScalarUnsignedInt() { void AbstractShaderProgramTest::attributeScalarUnsignedInt() {
typedef AbstractShaderProgram::Attribute<3, GLuint> Attribute; typedef AbstractShaderProgram::Attribute<3, UnsignedInt> Attribute;
/* Default constructor */ /* Default constructor */
Attribute a; Attribute a;
@ -99,7 +99,7 @@ void AbstractShaderProgramTest::attributeScalarUnsignedInt() {
void AbstractShaderProgramTest::attributeScalarDouble() { void AbstractShaderProgramTest::attributeScalarDouble() {
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
typedef AbstractShaderProgram::Attribute<3, GLdouble> Attribute; typedef AbstractShaderProgram::Attribute<3, Double> Attribute;
/* Default constructor */ /* Default constructor */
Attribute a; Attribute a;

10
src/Test/ColorTest.cpp

@ -43,10 +43,10 @@ class ColorTest: public Corrade::TestSuite::Tester {
void configuration(); void configuration();
}; };
typedef Magnum::Color3<std::uint8_t> Color3; typedef Magnum::Color3<UnsignedByte> Color3;
typedef Magnum::Color4<std::uint8_t> Color4; typedef Magnum::Color4<UnsignedByte> Color4;
typedef Magnum::Color3<float> Color3f; typedef Magnum::Color3<Float> Color3f;
typedef Magnum::Color4<float> Color4f; typedef Magnum::Color4<Float> Color4f;
ColorTest::ColorTest() { ColorTest::ColorTest() {
addTests(&ColorTest::access, addTests(&ColorTest::access,
@ -130,7 +130,7 @@ void ColorTest::hsv() {
CORRADE_COMPARE(Color3::fromHSV(Deg(230.0f), 0.749f, 0.427f), Color3(27, 40, 108)); CORRADE_COMPARE(Color3::fromHSV(Deg(230.0f), 0.749f, 0.427f), Color3(27, 40, 108));
Deg hue; Deg hue;
float saturation, value; Float saturation, value;
std::tie(hue, saturation, value) = Color3(27, 41, 109).toHSV(); std::tie(hue, saturation, value) = Color3(27, 41, 109).toHSV();
CORRADE_COMPARE(hue, Deg(229.756106f)); CORRADE_COMPARE(hue, Deg(229.756106f));
CORRADE_COMPARE(saturation, 0.752294f); CORRADE_COMPARE(saturation, 0.752294f);

24
src/Test/ResourceManagerTest.cpp

@ -45,16 +45,16 @@ class Data {
inline ~Data() { --count; } inline ~Data() { --count; }
}; };
typedef Magnum::ResourceManager<std::int32_t, Data> ResourceManager; typedef Magnum::ResourceManager<Int, Data> ResourceManager;
class IntResourceLoader: public AbstractResourceLoader<std::int32_t> { class IntResourceLoader: public AbstractResourceLoader<Int> {
public: public:
void load(ResourceKey key) override { void load(ResourceKey key) override {
AbstractResourceLoader::load(key); AbstractResourceLoader::load(key);
} }
void load() { void load() {
set("hello", new std::int32_t(773), ResourceDataState::Final, ResourcePolicy::Resident); set("hello", new Int(773), ResourceDataState::Final, ResourcePolicy::Resident);
setNotFound("world"); setNotFound("world");
} }
}; };
@ -143,27 +143,27 @@ void ResourceManagerTest::basic() {
/* One mutable, one final */ /* One mutable, one final */
ResourceKey questionKey("the-question"); ResourceKey questionKey("the-question");
ResourceKey answerKey("the-answer"); ResourceKey answerKey("the-answer");
rm.set(questionKey, new std::int32_t(10), ResourceDataState::Mutable, ResourcePolicy::Resident); rm.set(questionKey, new Int(10), ResourceDataState::Mutable, ResourcePolicy::Resident);
rm.set(answerKey, new std::int32_t(42), ResourceDataState::Final, ResourcePolicy::Resident); rm.set(answerKey, new Int(42), ResourceDataState::Final, ResourcePolicy::Resident);
Resource<std::int32_t> theQuestion = rm.get<std::int32_t>(questionKey); Resource<Int> theQuestion = rm.get<Int>(questionKey);
Resource<std::int32_t> theAnswer = rm.get<std::int32_t>(answerKey); Resource<Int> theAnswer = rm.get<Int>(answerKey);
/* Check basic functionality */ /* Check basic functionality */
CORRADE_COMPARE(theQuestion.state(), ResourceState::Mutable); CORRADE_COMPARE(theQuestion.state(), ResourceState::Mutable);
CORRADE_COMPARE(theAnswer.state(), ResourceState::Final); CORRADE_COMPARE(theAnswer.state(), ResourceState::Final);
CORRADE_COMPARE(*theQuestion, 10); CORRADE_COMPARE(*theQuestion, 10);
CORRADE_COMPARE(*theAnswer, 42); CORRADE_COMPARE(*theAnswer, 42);
CORRADE_COMPARE(rm.count<std::int32_t>(), 2); CORRADE_COMPARE(rm.count<Int>(), 2);
/* Cannot change already final resource */ /* Cannot change already final resource */
std::ostringstream out; std::ostringstream out;
Error::setOutput(&out); Error::setOutput(&out);
rm.set(answerKey, new std::int32_t(43), ResourceDataState::Mutable, ResourcePolicy::Resident); rm.set(answerKey, new Int(43), ResourceDataState::Mutable, ResourcePolicy::Resident);
CORRADE_COMPARE(*theAnswer, 42); CORRADE_COMPARE(*theAnswer, 42);
CORRADE_COMPARE(out.str(), "ResourceManager::set(): cannot change already final resource " + answerKey.hexString() + '\n'); CORRADE_COMPARE(out.str(), "ResourceManager::set(): cannot change already final resource " + answerKey.hexString() + '\n');
/* But non-final can be changed */ /* But non-final can be changed */
rm.set(questionKey, new std::int32_t(20), ResourceDataState::Final, ResourcePolicy::Resident); rm.set(questionKey, new Int(20), ResourceDataState::Final, ResourcePolicy::Resident);
CORRADE_COMPARE(theQuestion.state(), ResourceState::Final); CORRADE_COMPARE(theQuestion.state(), ResourceState::Final);
CORRADE_COMPARE(*theQuestion, 20); CORRADE_COMPARE(*theQuestion, 20);
} }
@ -235,8 +235,8 @@ void ResourceManagerTest::loader() {
rm.setLoader(&loader); rm.setLoader(&loader);
Resource<Data> data = rm.get<Data>("data"); Resource<Data> data = rm.get<Data>("data");
Resource<std::int32_t> hello = rm.get<std::int32_t>("hello"); Resource<Int> hello = rm.get<Int>("hello");
Resource<std::int32_t> world = rm.get<std::int32_t>("world"); Resource<Int> world = rm.get<Int>("world");
CORRADE_COMPARE(data.state(), ResourceState::NotLoaded); CORRADE_COMPARE(data.state(), ResourceState::NotLoaded);
CORRADE_COMPARE(hello.state(), ResourceState::Loading); CORRADE_COMPARE(hello.state(), ResourceState::Loading);
CORRADE_COMPARE(world.state(), ResourceState::Loading); CORRADE_COMPARE(world.state(), ResourceState::Loading);

16
src/Test/SwizzleTest.cpp

@ -44,18 +44,18 @@ void SwizzleTest::type() {
CORRADE_VERIFY((std::is_same<decltype(swizzle<'y', 'z', 'a'>(orig)), Vector3i>::value)); CORRADE_VERIFY((std::is_same<decltype(swizzle<'y', 'z', 'a'>(orig)), Vector3i>::value));
CORRADE_VERIFY((std::is_same<decltype(swizzle<'y', 'a', 'y', 'x'>(orig)), Vector4i>::value)); CORRADE_VERIFY((std::is_same<decltype(swizzle<'y', 'a', 'y', 'x'>(orig)), Vector4i>::value));
Color3<float> origColor3; Color3<Float> origColor3;
Color4<double> origColor4; Color4<Double> origColor4;
CORRADE_VERIFY((std::is_same<decltype(swizzle<'y', 'z', 'r'>(origColor3)), Color3<>>::value)); CORRADE_VERIFY((std::is_same<decltype(swizzle<'y', 'z', 'r'>(origColor3)), Color3<Float>>::value));
CORRADE_VERIFY((std::is_same<decltype(swizzle<'y', 'z', 'a'>(origColor4)), Color3<double>>::value)); CORRADE_VERIFY((std::is_same<decltype(swizzle<'y', 'z', 'a'>(origColor4)), Color3<Double>>::value));
CORRADE_VERIFY((std::is_same<decltype(swizzle<'y', 'z', 'y', 'x'>(origColor3)), Color4<>>::value)); CORRADE_VERIFY((std::is_same<decltype(swizzle<'y', 'z', 'y', 'x'>(origColor3)), Color4<Float>>::value));
CORRADE_VERIFY((std::is_same<decltype(swizzle<'y', 'a', 'y', 'x'>(origColor4)), Color4<double>>::value)); CORRADE_VERIFY((std::is_same<decltype(swizzle<'y', 'a', 'y', 'x'>(origColor4)), Color4<Double>>::value));
} }
void SwizzleTest::defaultType() { void SwizzleTest::defaultType() {
Vector4i orig(1, 2, 3, 4); Vector4i orig(1, 2, 3, 4);
CORRADE_COMPARE(swizzle<'b'>(orig), (Math::Vector<1, std::int32_t>(3))); CORRADE_COMPARE(swizzle<'b'>(orig), (Math::Vector<1, Int>(3)));
CORRADE_COMPARE((swizzle<'b', 'r', 'a', 'g', 'z', 'y', 'x'>(orig)), (Math::Vector<7, std::int32_t>(3, 1, 4, 2, 3, 2, 1))); CORRADE_COMPARE((swizzle<'b', 'r', 'a', 'g', 'z', 'y', 'x'>(orig)), (Math::Vector<7, Int>(3, 1, 4, 2, 3, 2, 1)));
} }
}} }}

16
src/Texture.h

@ -107,9 +107,9 @@ generateMipmap() documentation for more information.
@see Texture1D, Texture2D, Texture3D, CubeMapTexture, CubeMapTextureArray @see Texture1D, Texture2D, Texture3D, CubeMapTexture, CubeMapTextureArray
@todo @extension{AMD,sparse_texture} @todo @extension{AMD,sparse_texture}
*/ */
template<std::uint8_t dimensions> class Texture: public AbstractTexture { template<UnsignedInt dimensions> class Texture: public AbstractTexture {
public: public:
static const std::uint8_t Dimensions = dimensions; /**< @brief %Texture dimension count */ static const UnsignedInt Dimensions = dimensions; /**< @brief %Texture dimension count */
#ifdef DOXYGEN_GENERATING_OUTPUT #ifdef DOXYGEN_GENERATING_OUTPUT
/** /**
@ -186,7 +186,7 @@ template<std::uint8_t dimensions> class Texture: public AbstractTexture {
* with @def_gl{TEXTURE_WIDTH}, @def_gl{TEXTURE_HEIGHT} or @def_gl{TEXTURE_DEPTH}. * with @def_gl{TEXTURE_WIDTH}, @def_gl{TEXTURE_HEIGHT} or @def_gl{TEXTURE_DEPTH}.
* @requires_gl %Texture image queries are not available in OpenGL ES. * @requires_gl %Texture image queries are not available in OpenGL ES.
*/ */
inline typename DimensionTraits<Dimensions, GLint>::VectorType imageSize(GLint level) { inline typename DimensionTraits<Dimensions, Int>::VectorType imageSize(Int level) {
return DataHelper<Dimensions>::imageSize(this, _target, level); return DataHelper<Dimensions>::imageSize(this, _target, level);
} }
#endif #endif
@ -236,7 +236,7 @@ template<std::uint8_t dimensions> class Texture: public AbstractTexture {
* @requires_gl42 %Extension @extension{ARB,texture_storage} * @requires_gl42 %Extension @extension{ARB,texture_storage}
* @requires_gles30 %Extension @es_extension{EXT,texture_storage} * @requires_gles30 %Extension @es_extension{EXT,texture_storage}
*/ */
inline Texture<Dimensions>* setStorage(GLsizei levels, InternalFormat internalFormat, const typename DimensionTraits<Dimensions, GLint>::VectorType& size) { inline Texture<Dimensions>* setStorage(Int levels, InternalFormat internalFormat, const typename DimensionTraits<Dimensions, Int>::VectorType& size) {
DataHelper<Dimensions>::setStorage(this, _target, levels, internalFormat, size); DataHelper<Dimensions>::setStorage(this, _target, levels, internalFormat, size);
return this; return this;
} }
@ -263,7 +263,7 @@ template<std::uint8_t dimensions> class Texture: public AbstractTexture {
* @fn_gl_extension{TextureImage2D,EXT,direct_state_access}/ * @fn_gl_extension{TextureImage2D,EXT,direct_state_access}/
* @fn_gl_extension{TextureImage3D,EXT,direct_state_access} * @fn_gl_extension{TextureImage3D,EXT,direct_state_access}
*/ */
template<class Image> inline Texture<Dimensions>* setImage(GLint level, InternalFormat internalFormat, Image* image) { template<class Image> inline Texture<Dimensions>* setImage(Int level, InternalFormat internalFormat, Image* image) {
DataHelper<Dimensions>::set(this, _target, level, internalFormat, image); DataHelper<Dimensions>::set(this, _target, level, internalFormat, image);
return this; return this;
} }
@ -293,7 +293,7 @@ template<std::uint8_t dimensions> class Texture: public AbstractTexture {
* @fn_gl_extension{TextureSubImage2D,EXT,direct_state_access}/ * @fn_gl_extension{TextureSubImage2D,EXT,direct_state_access}/
* @fn_gl_extension{TextureSubImage3D,EXT,direct_state_access} * @fn_gl_extension{TextureSubImage3D,EXT,direct_state_access}
*/ */
template<class Image> inline Texture<Dimensions>* setSubImage(GLint level, const typename DimensionTraits<Dimensions, GLint>::VectorType& offset, Image* image) { template<class Image> inline Texture<Dimensions>* setSubImage(Int level, const typename DimensionTraits<Dimensions, Int>::VectorType& offset, Image* image) {
DataHelper<Dimensions>::setSub(this, _target, level, offset, image); DataHelper<Dimensions>::setSub(this, _target, level, offset, image);
return this; return this;
} }
@ -308,7 +308,7 @@ template<std::uint8_t dimensions> class Texture: public AbstractTexture {
* is not available, this function does nothing. * is not available, this function does nothing.
* @see invalidateImage(), @fn_gl{InvalidateTexSubImage} * @see invalidateImage(), @fn_gl{InvalidateTexSubImage}
*/ */
inline void invalidateSubImage(GLint level, const typename DimensionTraits<Dimensions, GLint>::VectorType& offset, const typename DimensionTraits<Dimensions, GLint>::VectorType& size) { inline void invalidateSubImage(Int level, const typename DimensionTraits<Dimensions, Int>::VectorType& offset, const typename DimensionTraits<Dimensions, Int>::VectorType& size) {
DataHelper<dimensions>::invalidateSub(this, level, offset, size); DataHelper<dimensions>::invalidateSub(this, level, offset, size);
} }
@ -327,7 +327,7 @@ template<std::uint8_t dimensions> class Texture: public AbstractTexture {
AbstractTexture::setBorderColor(color); AbstractTexture::setBorderColor(color);
return this; return this;
} }
inline Texture<Dimensions>* setMaxAnisotropy(GLfloat anisotropy) { inline Texture<Dimensions>* setMaxAnisotropy(Float anisotropy) {
AbstractTexture::setMaxAnisotropy(anisotropy); AbstractTexture::setMaxAnisotropy(anisotropy);
return this; return this;
} }

4
src/Timeline.cpp

@ -39,7 +39,7 @@ void Timeline::nextFrame() {
if(!running) return; if(!running) return;
auto now = high_resolution_clock::now(); auto now = high_resolution_clock::now();
std::uint32_t duration = duration_cast<microseconds>(now-_previousFrameTime).count(); UnsignedInt duration = duration_cast<microseconds>(now-_previousFrameTime).count();
_previousFrameDuration = duration/1e6f; _previousFrameDuration = duration/1e6f;
if(_previousFrameDuration < _minimalFrameTime) { if(_previousFrameDuration < _minimalFrameTime) {
@ -51,7 +51,7 @@ void Timeline::nextFrame() {
_previousFrameTime = now; _previousFrameTime = now;
} }
GLfloat Timeline::previousFrameTime() const { Float Timeline::previousFrameTime() const {
return duration_cast<microseconds>(_previousFrameTime-_startTime).count()/1e6f; return duration_cast<microseconds>(_previousFrameTime-_startTime).count()/1e6f;
} }

14
src/Timeline.h

@ -60,7 +60,7 @@ MyApplication::MyApplication(...): Platform::GlutApplication(...) {
void MyApplication::drawEvent() { void MyApplication::drawEvent() {
// Distance of object travelling at speed of 15 units per second // Distance of object travelling at speed of 15 units per second
GLfloat distance = 15.0f*timeline.previousFrameDuration(); Float distance = 15.0f*timeline.previousFrameDuration();
// Move object, draw ... // Move object, draw ...
@ -81,7 +81,7 @@ class MAGNUM_EXPORT Timeline {
inline constexpr explicit Timeline(): _minimalFrameTime(0), _previousFrameDuration(0), running(false) {} inline constexpr explicit Timeline(): _minimalFrameTime(0), _previousFrameDuration(0), running(false) {}
/** @brief Minimal frame time (in seconds) */ /** @brief Minimal frame time (in seconds) */
inline constexpr GLfloat minimalFrameTime() const { inline constexpr Float minimalFrameTime() const {
return _minimalFrameTime; return _minimalFrameTime;
} }
@ -91,7 +91,7 @@ class MAGNUM_EXPORT Timeline {
* Default value is 0. * Default value is 0.
* @see nextFrame() * @see nextFrame()
*/ */
inline void setMinimalFrameTime(GLfloat seconds) { inline void setMinimalFrameTime(Float seconds) {
_minimalFrameTime = seconds; _minimalFrameTime = seconds;
} }
@ -126,22 +126,22 @@ class MAGNUM_EXPORT Timeline {
* Returns time elapsed since start() was called. If the timeline is * Returns time elapsed since start() was called. If the timeline is
* stopped, the function returns `0.0f`. * stopped, the function returns `0.0f`.
*/ */
GLfloat previousFrameTime() const; Float previousFrameTime() const;
/** /**
* @brief Duration of previous frame (in seconds) * @brief Duration of previous frame (in seconds)
* *
* If the timeline is stopped, the function returns `0.0f`. * If the timeline is stopped, the function returns `0.0f`.
*/ */
inline constexpr GLfloat previousFrameDuration() const { inline constexpr Float previousFrameDuration() const {
return _previousFrameDuration; return _previousFrameDuration;
} }
private: private:
std::chrono::high_resolution_clock::time_point _startTime; std::chrono::high_resolution_clock::time_point _startTime;
std::chrono::high_resolution_clock::time_point _previousFrameTime; std::chrono::high_resolution_clock::time_point _previousFrameTime;
GLfloat _minimalFrameTime; Float _minimalFrameTime;
GLfloat _previousFrameDuration; Float _previousFrameDuration;
bool running; bool running;
}; };

Loading…
Cancel
Save