diff --git a/doc/portability.dox b/doc/portability.dox index 673ca1f42..fb0d32d8d 100644 --- a/doc/portability.dox +++ b/doc/portability.dox @@ -157,7 +157,7 @@ class MyApplication: public ApplicationBase { } protected: - void viewportEvent(const Math::Vector2& size) override { + void viewportEvent(const Vector2i& size) override { // ... } @@ -165,7 +165,7 @@ class MyApplication: public ApplicationBase { // ... } - void keyPressEvent(Key key, Modifiers modifiers, const Math::Vector2& position) { + void keyPressEvent(Key key, Modifiers modifiers, const Vector2i& position) { // ... } }; diff --git a/src/AbstractShaderProgram.h b/src/AbstractShaderProgram.h index 19653753c..53a383d1a 100644 --- a/src/AbstractShaderProgram.h +++ b/src/AbstractShaderProgram.h @@ -298,14 +298,13 @@ class MAGNUM_EXPORT AbstractShaderProgram { * location `0`. * * Template parameter @p T is the type which is used for shader - * attribute, e.g. @ref Math::Vector4 "Vector4" for `ivec4`. - * DataType is type of passed data when adding vertex buffers to mesh. - * By default it is the same as type used in shader (e.g. - * @ref DataType "DataType::Int" for @ref Math::Vector4 "Vector4"). - * It's also possible to pass integer data to floating-point shader - * inputs. In this case you may want to normalize the values (e.g. - * color components from 0-255 to 0.0f-1.0f) - see - * @ref DataOption "DataOption::Normalize". + * attribute, e.g. @ref Vector4i for `ivec4`. DataType is type of + * passed data when adding vertex buffers to mesh. By default it is + * the same as type used in shader (e.g. @ref DataType "DataType::Int" + * for @ref Vector4i). It's also possible to pass integer data to + * floating-point shader inputs. In this case you may want to + * normalize the values (e.g. color components from 0-255 to + * 0.0f - 1.0f) -- see @ref DataOption "DataOption::Normalize". * * Only some types are allowed as attribute types, see * @ref AbstractShaderProgram-types or TypeTraits::AttributeType for @@ -425,7 +424,7 @@ class MAGNUM_EXPORT AbstractShaderProgram { * @brief Constructor * @param dataType Type of passed data. Default is the * same as type used in shader (e.g. DataType::Integer - * for Vector4). + * for Vector4i). * @param dataOptions Data options. Default is no options. */ inline constexpr Attribute(DataType dataType = Implementation::Attribute::DefaultDataType, DataOptions dataOptions = DataOptions()): _dataType(dataType), _dataOptions(dataOptions) {} diff --git a/src/AbstractTexture.cpp b/src/AbstractTexture.cpp index e5ef0c416..dedbd221c 100644 --- a/src/AbstractTexture.cpp +++ b/src/AbstractTexture.cpp @@ -235,18 +235,18 @@ void AbstractTexture::imageImplementationDSA(GLenum target, GLint mipLevel, Inte } #endif -void AbstractTexture::imageImplementationDefault(GLenum target, GLint mipLevel, InternalFormat internalFormat, const Math::Vector2& size, AbstractImage::Components components, AbstractImage::ComponentType type, const GLvoid* data) { +void AbstractTexture::imageImplementationDefault(GLenum target, GLint mipLevel, InternalFormat internalFormat, const Vector2i& size, AbstractImage::Components components, AbstractImage::ComponentType type, const GLvoid* data) { bindInternal(); glTexImage2D(target, mipLevel, internalFormat, size.x(), size.y(), 0, static_cast(components), static_cast(type), data); } #ifndef MAGNUM_TARGET_GLES -void AbstractTexture::imageImplementationDSA(GLenum target, GLint mipLevel, InternalFormat internalFormat, const Math::Vector2& size, AbstractImage::Components components, AbstractImage::ComponentType type, const GLvoid* data) { +void AbstractTexture::imageImplementationDSA(GLenum target, GLint mipLevel, InternalFormat internalFormat, const Vector2i& size, AbstractImage::Components components, AbstractImage::ComponentType type, const GLvoid* data) { glTextureImage2DEXT(_id, target, mipLevel, internalFormat, size.x(), size.y(), 0, static_cast(components), static_cast(type), data); } #endif -void AbstractTexture::imageImplementationDefault(GLenum target, GLint mipLevel, InternalFormat internalFormat, const Math::Vector3& size, AbstractImage::Components components, AbstractImage::ComponentType type, const GLvoid* data) { +void AbstractTexture::imageImplementationDefault(GLenum target, GLint mipLevel, InternalFormat internalFormat, const Vector3i& size, AbstractImage::Components components, AbstractImage::ComponentType type, const GLvoid* data) { bindInternal(); /** @todo Get some extension wrangler instead to avoid linker errors to glTexImage3D() on ES2 */ #ifndef MAGNUM_TARGET_GLES2 @@ -263,7 +263,7 @@ void AbstractTexture::imageImplementationDefault(GLenum target, GLint mipLevel, } #ifndef MAGNUM_TARGET_GLES -void AbstractTexture::imageImplementationDSA(GLenum target, GLint mipLevel, InternalFormat internalFormat, const Math::Vector3& size, AbstractImage::Components components, AbstractImage::ComponentType type, const GLvoid* data) { +void AbstractTexture::imageImplementationDSA(GLenum target, GLint mipLevel, InternalFormat internalFormat, const Vector3i& size, AbstractImage::Components components, AbstractImage::ComponentType type, const GLvoid* data) { glTextureImage3DEXT(_id, target, mipLevel, internalFormat, size.x(), size.y(), size.z(), 0, static_cast(components), static_cast(type), data); } #endif @@ -279,18 +279,18 @@ void AbstractTexture::subImageImplementationDSA(GLenum target, GLint mipLevel, c } #endif -void AbstractTexture::subImageImplementationDefault(GLenum target, GLint mipLevel, const Math::Vector2& offset, const Math::Vector2& size, AbstractImage::Components components, AbstractImage::ComponentType type, const GLvoid* data) { +void AbstractTexture::subImageImplementationDefault(GLenum target, GLint mipLevel, const Vector2i& offset, const Vector2i& size, AbstractImage::Components components, AbstractImage::ComponentType type, const GLvoid* data) { bindInternal(); glTexSubImage2D(target, mipLevel, offset.x(), offset.y(), size.x(), size.y(), static_cast(components), static_cast(type), data); } #ifndef MAGNUM_TARGET_GLES -void AbstractTexture::subImageImplementationDSA(GLenum target, GLint mipLevel, const Math::Vector2& offset, const Math::Vector2& size, AbstractImage::Components components, AbstractImage::ComponentType type, const GLvoid* data) { +void AbstractTexture::subImageImplementationDSA(GLenum target, GLint mipLevel, const Vector2i& offset, const Vector2i& size, AbstractImage::Components components, AbstractImage::ComponentType type, const GLvoid* data) { glTextureSubImage2DEXT(_id, target, mipLevel, offset.x(), offset.y(), size.x(), size.y(), static_cast(components), static_cast(type), data); } #endif -void AbstractTexture::subImageImplementationDefault(GLenum target, GLint mipLevel, const Math::Vector3& offset, const Math::Vector3& size, AbstractImage::Components components, AbstractImage::ComponentType type, const GLvoid* data) { +void AbstractTexture::subImageImplementationDefault(GLenum target, GLint mipLevel, const Vector3i& offset, const Vector3i& size, AbstractImage::Components components, AbstractImage::ComponentType type, const GLvoid* data) { bindInternal(); /** @todo Get some extension wrangler instead to avoid linker errors to glTexSubImage3D() on ES2 */ #ifndef MAGNUM_TARGET_GLES2 @@ -307,7 +307,7 @@ void AbstractTexture::subImageImplementationDefault(GLenum target, GLint mipLeve } #ifndef MAGNUM_TARGET_GLES -void AbstractTexture::subImageImplementationDSA(GLenum target, GLint mipLevel, const Math::Vector3& offset, const Math::Vector3& size, AbstractImage::Components components, AbstractImage::ComponentType type, const GLvoid* data) { +void AbstractTexture::subImageImplementationDSA(GLenum target, GLint mipLevel, const Vector3i& offset, const Vector3i& size, AbstractImage::Components components, AbstractImage::ComponentType type, const GLvoid* data) { glTextureSubImage3DEXT(_id, target, mipLevel, offset.x(), offset.y(), offset.z(), size.x(), size.y(), size.z(), static_cast(components), static_cast(type), data); } #endif diff --git a/src/AbstractTexture.h b/src/AbstractTexture.h index 933e4ec90..37d00b61b 100644 --- a/src/AbstractTexture.h +++ b/src/AbstractTexture.h @@ -772,14 +772,14 @@ class MAGNUM_EXPORT AbstractTexture { static Image1DImplementation image1DImplementation; #endif - typedef void(AbstractTexture::*Image2DImplementation)(GLenum, GLint, InternalFormat, const Math::Vector2&, AbstractImage::Components, AbstractImage::ComponentType, const GLvoid*); - void MAGNUM_LOCAL imageImplementationDefault(GLenum target, GLint mipLevel, InternalFormat internalFormat, const Math::Vector2& size, AbstractImage::Components components, AbstractImage::ComponentType type, const GLvoid* data); - void MAGNUM_LOCAL imageImplementationDSA(GLenum target, GLint mipLevel, InternalFormat internalFormat, const Math::Vector2& size, AbstractImage::Components components, AbstractImage::ComponentType type, const GLvoid* data); + typedef void(AbstractTexture::*Image2DImplementation)(GLenum, GLint, InternalFormat, const Vector2i&, AbstractImage::Components, AbstractImage::ComponentType, const GLvoid*); + void MAGNUM_LOCAL imageImplementationDefault(GLenum target, GLint mipLevel, InternalFormat internalFormat, const Vector2i& size, AbstractImage::Components components, AbstractImage::ComponentType type, const GLvoid* data); + void MAGNUM_LOCAL imageImplementationDSA(GLenum target, GLint mipLevel, InternalFormat internalFormat, const Vector2i& size, AbstractImage::Components components, AbstractImage::ComponentType type, const GLvoid* data); static Image2DImplementation image2DImplementation; - typedef void(AbstractTexture::*Image3DImplementation)(GLenum, GLint, InternalFormat, const Math::Vector3&, AbstractImage::Components, AbstractImage::ComponentType, const GLvoid*); - void MAGNUM_LOCAL imageImplementationDefault(GLenum target, GLint mipLevel, InternalFormat internalFormat, const Math::Vector3& size, AbstractImage::Components components, AbstractImage::ComponentType type, const GLvoid* data); - void MAGNUM_LOCAL imageImplementationDSA(GLenum target, GLint mipLevel, InternalFormat internalFormat, const Math::Vector3& size, AbstractImage::Components components, AbstractImage::ComponentType type, const GLvoid* data); + typedef void(AbstractTexture::*Image3DImplementation)(GLenum, GLint, InternalFormat, const Vector3i&, AbstractImage::Components, AbstractImage::ComponentType, const GLvoid*); + void MAGNUM_LOCAL imageImplementationDefault(GLenum target, GLint mipLevel, InternalFormat internalFormat, const Vector3i& size, AbstractImage::Components components, AbstractImage::ComponentType type, const GLvoid* data); + void MAGNUM_LOCAL imageImplementationDSA(GLenum target, GLint mipLevel, InternalFormat internalFormat, const Vector3i& size, AbstractImage::Components components, AbstractImage::ComponentType type, const GLvoid* data); static Image3DImplementation image3DImplementation; #ifndef MAGNUM_TARGET_GLES @@ -789,14 +789,14 @@ class MAGNUM_EXPORT AbstractTexture { static SubImage1DImplementation subImage1DImplementation; #endif - typedef void(AbstractTexture::*SubImage2DImplementation)(GLenum, GLint, const Math::Vector2&, const Math::Vector2&, AbstractImage::Components, AbstractImage::ComponentType, const GLvoid*); - void MAGNUM_LOCAL subImageImplementationDefault(GLenum target, GLint mipLevel, const Math::Vector2& offset, const Math::Vector2& size, AbstractImage::Components components, AbstractImage::ComponentType type, const GLvoid* data); - void MAGNUM_LOCAL subImageImplementationDSA(GLenum target, GLint mipLevel, const Math::Vector2& offset, const Math::Vector2& size, AbstractImage::Components components, AbstractImage::ComponentType type, const GLvoid* data); + typedef void(AbstractTexture::*SubImage2DImplementation)(GLenum, GLint, const Vector2i&, const Vector2i&, AbstractImage::Components, AbstractImage::ComponentType, const GLvoid*); + void MAGNUM_LOCAL subImageImplementationDefault(GLenum target, GLint mipLevel, const Vector2i& offset, const Vector2i& size, AbstractImage::Components components, AbstractImage::ComponentType type, const GLvoid* data); + void MAGNUM_LOCAL subImageImplementationDSA(GLenum target, GLint mipLevel, const Vector2i& offset, const Vector2i& size, AbstractImage::Components components, AbstractImage::ComponentType type, const GLvoid* data); static SubImage2DImplementation subImage2DImplementation; - typedef void(AbstractTexture::*SubImage3DImplementation)(GLenum, GLint, const Math::Vector3&, const Math::Vector3&, AbstractImage::Components, AbstractImage::ComponentType, const GLvoid*); - void MAGNUM_LOCAL subImageImplementationDefault(GLenum target, GLint mipLevel, const Math::Vector3& offset, const Math::Vector3& size, AbstractImage::Components components, AbstractImage::ComponentType type, const GLvoid* data); - void MAGNUM_LOCAL subImageImplementationDSA(GLenum target, GLint mipLevel, const Math::Vector3& offset, const Math::Vector3& size, AbstractImage::Components components, AbstractImage::ComponentType type, const GLvoid* data); + typedef void(AbstractTexture::*SubImage3DImplementation)(GLenum, GLint, const Vector3i&, const Vector3i&, AbstractImage::Components, AbstractImage::ComponentType, const GLvoid*); + void MAGNUM_LOCAL subImageImplementationDefault(GLenum target, GLint mipLevel, const Vector3i& offset, const Vector3i& size, AbstractImage::Components components, AbstractImage::ComponentType type, const GLvoid* data); + void MAGNUM_LOCAL subImageImplementationDSA(GLenum target, GLint mipLevel, const Vector3i& offset, const Vector3i& size, AbstractImage::Components components, AbstractImage::ComponentType type, const GLvoid* data); static SubImage3DImplementation subImage3DImplementation; GLuint _id; @@ -860,12 +860,12 @@ template<> struct MAGNUM_EXPORT AbstractTexture::DataHelper<2> { (texture->*image2DImplementation)(target, mipLevel, internalFormat, image->size(), image->components(), image->type(), image->data()); } - template inline static typename std::enable_if::type setSub(AbstractTexture* texture, GLenum target, GLint mipLevel, const Math::Vector2& offset, Image* image) { + template inline static typename std::enable_if::type setSub(AbstractTexture* texture, GLenum target, GLint mipLevel, const Vector2i& offset, Image* image) { (texture->*subImage2DImplementation)(target, mipLevel, offset, image->size(), image->components(), image->type(), image->data()); } - template inline static typename std::enable_if::type setSub(AbstractTexture* texture, GLenum target, GLint mipLevel, const Math::Vector2& offset, Image* image) { - (texture->*subImage2DImplementation)(target, mipLevel, offset, Math::Vector2(image->size(), 1), image->components(), image->type(), image->data()); + template inline static typename std::enable_if::type setSub(AbstractTexture* texture, GLenum target, GLint mipLevel, const Vector2i& offset, Image* image) { + (texture->*subImage2DImplementation)(target, mipLevel, offset, Vector2i(image->size(), 1), image->components(), image->type(), image->data()); } }; template<> struct MAGNUM_EXPORT AbstractTexture::DataHelper<3> { @@ -886,12 +886,12 @@ template<> struct MAGNUM_EXPORT AbstractTexture::DataHelper<3> { (texture->*image3DImplementation)(target, mipLevel, internalFormat, image->size(), image->components(), image->type(), image->data()); } - template inline static typename std::enable_if::type setSub(AbstractTexture* texture, GLenum target, GLint mipLevel, const Math::Vector3& offset, Image* image) { + template inline static typename std::enable_if::type setSub(AbstractTexture* texture, GLenum target, GLint mipLevel, const Vector3i& offset, Image* image) { (texture->*subImage3DImplementation)(target, mipLevel, offset, image->size(), image->components(), image->type(), image->data()); } - template inline static typename std::enable_if::type setSub(AbstractTexture* texture, GLenum target, GLint mipLevel, const Math::Vector3& offset, Image* image) { - (texture->*subImage3DImplementation)(target, mipLevel, offset, Math::Vector3(image->size(), 1), image->components(), image->type(), image->data()); + template inline static typename std::enable_if::type setSub(AbstractTexture* texture, GLenum target, GLint mipLevel, const Vector3i& offset, Image* image) { + (texture->*subImage3DImplementation)(target, mipLevel, offset, Vector3i(image->size(), 1), image->components(), image->type(), image->data()); } }; #endif diff --git a/src/CubeMapTexture.h b/src/CubeMapTexture.h index 7da8f60a4..f645a45c0 100644 --- a/src/CubeMapTexture.h +++ b/src/CubeMapTexture.h @@ -122,7 +122,7 @@ class CubeMapTexture: public AbstractTexture { * @param coordinate Coordinate * @return Pointer to self (for method chaining) */ - template inline CubeMapTexture* setSubData(Coordinate coordinate, GLint mipLevel, const Math::Vector2& offset, const Image* image) { + template inline CubeMapTexture* setSubData(Coordinate coordinate, GLint mipLevel, const Vector2i& offset, const Image* image) { DataHelper<2>::setSub(this, static_cast(coordinate), mipLevel, offset, image); return this; } diff --git a/src/CubeMapTextureArray.h b/src/CubeMapTextureArray.h index cc558a5ee..a232c5888 100644 --- a/src/CubeMapTextureArray.h +++ b/src/CubeMapTextureArray.h @@ -127,8 +127,8 @@ class CubeMapTextureArray: public AbstractTexture { * * @see setSubData(GLsizei, Coordinate, GLint, const Math::Vector<2, GLint>&, const Image*) */ - template inline CubeMapTextureArray* setSubData(GLint mipLevel, const Math::Vector3& offset, const Image* image) { - DataHelper<3>::setSub(this, GL_TEXTURE_CUBE_MAP_ARRAY, mipLevel, offset, image, Math::Vector3(Math::Vector())); + template inline CubeMapTextureArray* setSubData(GLint mipLevel, const Vector3i& offset, const Image* image) { + DataHelper<3>::setSub(this, GL_TEXTURE_CUBE_MAP_ARRAY, mipLevel, offset, image, Vector3i(Math::Vector())); return this; } @@ -147,8 +147,8 @@ class CubeMapTextureArray: public AbstractTexture { * * @see setSubData(GLint, const Math::Vector<3, GLint>&, const Image*) */ - template inline CubeMapTextureArray* setSubData(GLsizei layer, Coordinate coordinate, GLint mipLevel, const Math::Vector2& offset, const Image* image) { - DataHelper<3>::setSub(this, GL_TEXTURE_CUBE_MAP_ARRAY, mipLevel, Math::Vector3(offset, layer*6+static_cast(coordinate)), image, Math::Vector<2, GLsizei>(Math::Vector())); + template inline CubeMapTextureArray* setSubData(GLsizei layer, Coordinate coordinate, GLint mipLevel, const Vector2i& offset, const Image* image) { + DataHelper<3>::setSub(this, GL_TEXTURE_CUBE_MAP_ARRAY, mipLevel, Vector3i(offset, layer*6+static_cast(coordinate)), image, Vector2i(Math::Vector())); return this; } diff --git a/src/Framebuffer.cpp b/src/Framebuffer.cpp index f63c9915f..cec234536 100644 --- a/src/Framebuffer.cpp +++ b/src/Framebuffer.cpp @@ -45,14 +45,14 @@ void Framebuffer::mapForDraw(std::initializer_list colorAttachments delete[] attachments; } -void Framebuffer::read(const Math::Vector2& offset, const Math::Vector2& size, AbstractImage::Components components, AbstractImage::ComponentType type, Image2D* image) { +void Framebuffer::read(const Vector2i& offset, const Vector2i& size, AbstractImage::Components components, AbstractImage::ComponentType type, Image2D* image) { char* data = new char[AbstractImage::pixelSize(components, type)*size.product()]; glReadPixels(offset.x(), offset.y(), size.x(), size.y(), static_cast(components), static_cast(type), data); image->setData(size, components, type, data); } #ifndef MAGNUM_TARGET_GLES2 -void Framebuffer::read(const Math::Vector2& offset, const Math::Vector2& size, AbstractImage::Components components, AbstractImage::ComponentType type, BufferedImage2D* image, Buffer::Usage usage) { +void Framebuffer::read(const Vector2i& offset, const Vector2i& size, AbstractImage::Components components, AbstractImage::ComponentType type, BufferedImage2D* image, Buffer::Usage usage) { /* If the buffer doesn't have sufficient size, resize it */ /** @todo Explicitly reset also when buffer usage changes */ if(image->size() != size || image->components() != components || image->type() != type) diff --git a/src/Framebuffer.h b/src/Framebuffer.h index afe0a57f1..f4aba3115 100644 --- a/src/Framebuffer.h +++ b/src/Framebuffer.h @@ -127,7 +127,7 @@ class MAGNUM_EXPORT Framebuffer { * Call when window size changes. * @see @fn_gl{Viewport} */ - inline static void setViewport(const Math::Vector2& position, const Math::Vector2& size) { + inline static void setViewport(const Vector2i& position, const Vector2i& size) { glViewport(position.x(), position.y(), size.x(), size.y()); } @@ -211,7 +211,7 @@ class MAGNUM_EXPORT Framebuffer { * @attention You have to enable scissoring with setFeature() first. * @see @fn_gl{Scissor} */ - inline static void setScissor(const Math::Vector2& bottomLeft, const Math::Vector2& size) { + inline static void setScissor(const Vector2i& bottomLeft, const Vector2i& size) { glScissor(bottomLeft.x(), bottomLeft.y(), size.x(), size.y()); } @@ -1235,7 +1235,7 @@ class MAGNUM_EXPORT Framebuffer { * @requires_gl30 Extension @extension{EXT,framebuffer_blit} * @requires_gles30 %Extension @es_extension{ANGLE,framebuffer_blit} */ - inline static void blit(const Math::Vector2& bottomLeft, const Math::Vector2& topRight, const Math::Vector2& destinationBottomLeft, const Math::Vector2& destinationTopRight, BlitMask blitMask, AbstractTexture::Filter filter) { + inline static void blit(const Vector2i& bottomLeft, const Vector2i& topRight, const Vector2i& destinationBottomLeft, const Vector2i& destinationTopRight, BlitMask blitMask, AbstractTexture::Filter filter) { /** @todo Get some extension wrangler instead to avoid undeclared glBlitFramebuffer() on ES2 */ #ifndef MAGNUM_TARGET_GLES2 glBlitFramebuffer(bottomLeft.x(), bottomLeft.y(), topRight.x(), topRight.y(), destinationBottomLeft.x(), destinationBottomLeft.y(), destinationTopRight.x(), destinationTopRight.y(), static_cast(blitMask), static_cast(filter)); @@ -1266,7 +1266,7 @@ class MAGNUM_EXPORT Framebuffer { * @requires_gl30 Extension @extension{EXT,framebuffer_blit} * @requires_gles30 %Extension @es_extension{ANGLE,framebuffer_blit} */ - inline static void blit(const Math::Vector2& bottomLeft, const Math::Vector2& topRight, BlitMask blitMask) { + inline static void blit(const Vector2i& bottomLeft, const Vector2i& topRight, BlitMask blitMask) { /** @todo Get some extension wrangler instead to avoid undeclared glBlitFramebuffer() on ES2 */ #ifndef MAGNUM_TARGET_GLES2 glBlitFramebuffer(bottomLeft.x(), bottomLeft.y(), topRight.x(), topRight.y(), bottomLeft.x(), bottomLeft.y(), topRight.x(), topRight.y(), static_cast(blitMask), static_cast(AbstractTexture::Filter::NearestNeighbor)); @@ -1288,7 +1288,7 @@ class MAGNUM_EXPORT Framebuffer { * @see @fn_gl{ReadPixels} * @requires_gl30 Extension @extension{EXT,framebuffer_object} */ - static void read(const Math::Vector2& offset, const Math::Vector2& size, AbstractImage::Components components, AbstractImage::ComponentType type, Image2D* image); + static void read(const Vector2i& offset, const Vector2i& size, AbstractImage::Components components, AbstractImage::ComponentType type, Image2D* image); #ifndef MAGNUM_TARGET_GLES2 /** @@ -1304,7 +1304,7 @@ class MAGNUM_EXPORT Framebuffer { * @requires_gl30 Extension @extension{EXT,framebuffer_object} * @requires_gles30 Pixel buffer objects are not available in OpenGL ES 2.0. */ - static void read(const Math::Vector2& offset, const Math::Vector2& size, AbstractImage::Components components, AbstractImage::ComponentType type, BufferedImage2D* image, Buffer::Usage usage); + static void read(const Vector2i& offset, const Vector2i& size, AbstractImage::Components components, AbstractImage::ComponentType type, BufferedImage2D* image, Buffer::Usage usage); #endif /*@}*/ diff --git a/src/Platform/AbstractXApplication.cpp b/src/Platform/AbstractXApplication.cpp index 9379d7492..aa71c876d 100644 --- a/src/Platform/AbstractXApplication.cpp +++ b/src/Platform/AbstractXApplication.cpp @@ -29,7 +29,7 @@ using namespace std; namespace Magnum { namespace Platform { -AbstractXApplication::AbstractXApplication(AbstractContextHandler* contextHandler, int&, char**, const string& title, const Math::Vector2& size): contextHandler(contextHandler), viewportSize(size), flags(Flag::Redraw) { +AbstractXApplication::AbstractXApplication(AbstractContextHandler* contextHandler, int&, char**, const string& title, const Vector2i& size): contextHandler(contextHandler), viewportSize(size), flags(Flag::Redraw) { /* Get default X display */ display = XOpenDisplay(0); @@ -108,7 +108,7 @@ int AbstractXApplication::exec() { switch(event.type) { /* Window resizing */ case ConfigureNotify: { - Math::Vector2 size(event.xconfigure.width, event.xconfigure.height); + Vector2i size(event.xconfigure.width, event.xconfigure.height); if(size != viewportSize) { viewportSize = size; viewportEvent(size); diff --git a/src/Platform/AbstractXApplication.h b/src/Platform/AbstractXApplication.h index 783f7c479..d26ddcc8b 100644 --- a/src/Platform/AbstractXApplication.h +++ b/src/Platform/AbstractXApplication.h @@ -57,7 +57,7 @@ class AbstractXApplication { * * Creates window with double-buffered OpenGL ES 2 context. */ - AbstractXApplication(AbstractContextHandler* contextHandler, int& argc, char** argv, const std::string& title = "Magnum X application", const Math::Vector2& size = Math::Vector2(800, 600)); + AbstractXApplication(AbstractContextHandler* contextHandler, int& argc, char** argv, const std::string& title = "Magnum X application", const Vector2i& size = Vector2i(800, 600)); /** * @brief Destructor @@ -79,7 +79,7 @@ class AbstractXApplication { protected: /** @copydoc GlutApplication::viewportEvent() */ - virtual void viewportEvent(const Math::Vector2& size) = 0; + virtual void viewportEvent(const Vector2i& size) = 0; /** @copydoc GlutApplication::drawEvent() */ virtual void drawEvent() = 0; @@ -209,7 +209,7 @@ class AbstractXApplication { * * Called when an key is pressed. Default implementation does nothing. */ - virtual void keyPressEvent(Key key, Modifiers modifiers, const Math::Vector2& position); + virtual void keyPressEvent(Key key, Modifiers modifiers, const Vector2i& position); /** * @brief Key press event @@ -219,7 +219,7 @@ class AbstractXApplication { * * Called when an key is released. Default implementation does nothing. */ - virtual void keyReleaseEvent(Key key, Modifiers modifiers, const Math::Vector2& position); + virtual void keyReleaseEvent(Key key, Modifiers modifiers, const Vector2i& position); /*@}*/ @@ -249,7 +249,7 @@ class AbstractXApplication { * Called when mouse button is pressed. Default implementation does * nothing. */ - virtual void mousePressEvent(MouseButton button, Modifiers modifiers, const Math::Vector2& position); + virtual void mousePressEvent(MouseButton button, Modifiers modifiers, const Vector2i& position); /** * @brief Mouse release event @@ -260,7 +260,7 @@ class AbstractXApplication { * Called when mouse button is released. Default implementation does * nothing. */ - virtual void mouseReleaseEvent(MouseButton button, Modifiers modifiers, const Math::Vector2& position); + virtual void mouseReleaseEvent(MouseButton button, Modifiers modifiers, const Vector2i& position); /** * @brief Mouse motion event @@ -269,7 +269,7 @@ class AbstractXApplication { * * Called when mouse is moved. */ - virtual void mouseMotionEvent(Modifiers modifiers, const Math::Vector2& position); + virtual void mouseMotionEvent(Modifiers modifiers, const Vector2i& position); /*@}*/ @@ -291,7 +291,7 @@ class AbstractXApplication { Context* c; /** @todo Get this from the created window */ - Math::Vector2 viewportSize; + Vector2i viewportSize; Flags flags; }; @@ -328,11 +328,11 @@ CORRADE_ENUMSET_OPERATORS(AbstractXApplication::Modifiers) CORRADE_ENUMSET_OPERATORS(AbstractXApplication::Flags) /* Implementations for inline functions with unused parameters */ -inline void AbstractXApplication::keyPressEvent(Key, Modifiers, const Math::Vector2&) {} -inline void AbstractXApplication::keyReleaseEvent(Key, Modifiers, const Math::Vector2&) {} -inline void AbstractXApplication::mousePressEvent(MouseButton, Modifiers, const Math::Vector2&) {} -inline void AbstractXApplication::mouseReleaseEvent(MouseButton, Modifiers, const Math::Vector2&) {} -inline void AbstractXApplication::mouseMotionEvent(Modifiers, const Math::Vector2&) {} +inline void AbstractXApplication::keyPressEvent(Key, Modifiers, const Vector2i&) {} +inline void AbstractXApplication::keyReleaseEvent(Key, Modifiers, const Vector2i&) {} +inline void AbstractXApplication::mousePressEvent(MouseButton, Modifiers, const Vector2i&) {} +inline void AbstractXApplication::mouseReleaseEvent(MouseButton, Modifiers, const Vector2i&) {} +inline void AbstractXApplication::mouseMotionEvent(Modifiers, const Vector2i&) {} }} diff --git a/src/Platform/GlutApplication.cpp b/src/Platform/GlutApplication.cpp index 321d51c2b..85eab4416 100644 --- a/src/Platform/GlutApplication.cpp +++ b/src/Platform/GlutApplication.cpp @@ -22,7 +22,7 @@ namespace Magnum { namespace Platform { GlutApplication* GlutApplication::instance = nullptr; -GlutApplication::GlutApplication(int& argc, char** argv, const std::string& title, const Math::Vector2& size) { +GlutApplication::GlutApplication(int& argc, char** argv, const std::string& title, const Vector2i& size) { /* Save global instance */ instance = this; diff --git a/src/Platform/GlutApplication.h b/src/Platform/GlutApplication.h index 07e5c4572..9d7e65c6a 100644 --- a/src/Platform/GlutApplication.h +++ b/src/Platform/GlutApplication.h @@ -61,7 +61,7 @@ class GlutApplication { * * Creates double-buffered RGBA window with depth and stencil buffers. */ - GlutApplication(int& argc, char** argv, const std::string& title = "Magnum GLUT application", const Math::Vector2& size = Math::Vector2(800, 600)); + GlutApplication(int& argc, char** argv, const std::string& title = "Magnum GLUT application", const Vector2i& size = Vector2i(800, 600)); virtual ~GlutApplication(); @@ -84,7 +84,7 @@ class GlutApplication { * Framebuffer::setViewport() (and SceneGraph::AbstractCamera::setViewport(), * if using scene graph). */ - virtual void viewportEvent(const Math::Vector2& size) = 0; + virtual void viewportEvent(const Vector2i& size) = 0; /** * @brief Draw event @@ -157,7 +157,7 @@ class GlutApplication { * * Called when an key is pressed. Default implementation does nothing. */ - virtual void keyPressEvent(Key key, const Math::Vector2& position); + virtual void keyPressEvent(Key key, const Vector2i& position); /*@}*/ @@ -203,7 +203,7 @@ class GlutApplication { } /** @brief Warp mouse cursor to given coordinates */ - inline void warpMouseCursor(const Math::Vector2& position) { + inline void warpMouseCursor(const Vector2i& position) { glutWarpPointer(position.x(), position.y()); } @@ -214,7 +214,7 @@ class GlutApplication { * Called when mouse button is pressed. Default implementation does * nothing. */ - virtual void mousePressEvent(MouseButton button, const Math::Vector2& position); + virtual void mousePressEvent(MouseButton button, const Vector2i& position); /** * @brief Mouse release event @@ -222,7 +222,7 @@ class GlutApplication { * Called when mouse button is released. Default implementation does * nothing. */ - virtual void mouseReleaseEvent(MouseButton button, const Math::Vector2& position); + virtual void mouseReleaseEvent(MouseButton button, const Vector2i& position); /** * @brief Mouse motion event @@ -231,7 +231,7 @@ class GlutApplication { * implementation does nothing. * @see setMouseTracking() */ - virtual void mouseMotionEvent(const Math::Vector2& position); + virtual void mouseMotionEvent(const Vector2i& position); /*@}*/ @@ -293,10 +293,10 @@ When no other application header is included this macro is also aliased to #endif /* Implementations for inline functions with unused parameters */ -inline void GlutApplication::keyPressEvent(Key, const Math::Vector2&) {} -inline void GlutApplication::mousePressEvent(MouseButton, const Math::Vector2&) {} -inline void GlutApplication::mouseReleaseEvent(MouseButton, const Math::Vector2&) {} -inline void GlutApplication::mouseMotionEvent(const Math::Vector2&) {} +inline void GlutApplication::keyPressEvent(Key, const Vector2i&) {} +inline void GlutApplication::mousePressEvent(MouseButton, const Vector2i&) {} +inline void GlutApplication::mouseReleaseEvent(MouseButton, const Vector2i&) {} +inline void GlutApplication::mouseMotionEvent(const Vector2i&) {} }} diff --git a/src/Platform/GlxApplication.h b/src/Platform/GlxApplication.h index f17d683be..fec492946 100644 --- a/src/Platform/GlxApplication.h +++ b/src/Platform/GlxApplication.h @@ -53,7 +53,7 @@ class GlxApplication: public AbstractXApplication { * Creates window with double-buffered OpenGL 3.2 core context or * OpenGL ES 2.0 context, if targetting OpenGL ES. */ - inline GlxApplication(int& argc, char** argv, const std::string& title = "Magnum GLX application", const Math::Vector2& size = Math::Vector2(800, 600)): AbstractXApplication(new GlxContextHandler, argc, argv, title, size) {} + inline GlxApplication(int& argc, char** argv, const std::string& title = "Magnum GLX application", const Vector2i& size = Vector2i(800, 600)): AbstractXApplication(new GlxContextHandler, argc, argv, title, size) {} }; }} diff --git a/src/Platform/NaClApplication.cpp b/src/Platform/NaClApplication.cpp index 909aea265..6bcf4203d 100644 --- a/src/Platform/NaClApplication.cpp +++ b/src/Platform/NaClApplication.cpp @@ -23,7 +23,7 @@ namespace Magnum { namespace Platform { -NaClApplication::NaClApplication(PP_Instance instance, const Math::Vector2& size): Instance(instance), Graphics3DClient(this), MouseLock(this), viewportSize(size) { +NaClApplication::NaClApplication(PP_Instance instance, const Vector2i& size): Instance(instance), Graphics3DClient(this), MouseLock(this), viewportSize(size) { int32_t attributes[] = { PP_GRAPHICS3DATTRIB_ALPHA_SIZE, 8, PP_GRAPHICS3DATTRIB_DEPTH_SIZE, 24, @@ -101,7 +101,7 @@ void NaClApplication::DidChangeView(const pp::View& view) { else return; } - Math::Vector2 size(view.GetRect().width(), view.GetRect().height()); + Vector2i size(view.GetRect().width(), view.GetRect().height()); /* Canvas resized */ if(viewportSize != size) { diff --git a/src/Platform/NaClApplication.h b/src/Platform/NaClApplication.h index aabdb6c9a..81d670603 100644 --- a/src/Platform/NaClApplication.h +++ b/src/Platform/NaClApplication.h @@ -72,7 +72,7 @@ class NaClApplication: public pp::Instance, public pp::Graphics3DClient, public * * Creates double-buffered RGBA canvas with depth and stencil buffers. */ - explicit NaClApplication(PP_Instance instance, const Math::Vector2& size = Math::Vector2(640, 480)); + explicit NaClApplication(PP_Instance instance, const Vector2i& size = Vector2i(640, 480)); ~NaClApplication(); @@ -94,7 +94,7 @@ class NaClApplication: public pp::Instance, public pp::Graphics3DClient, public /** @{ @name Drawing functions */ /** @copydoc GlutApplication::viewportEvent() */ - virtual void viewportEvent(const Math::Vector2& size) = 0; + virtual void viewportEvent(const Vector2i& size) = 0; /** @copydoc GlutApplication::drawEvent() */ virtual void drawEvent() = 0; @@ -205,7 +205,7 @@ class NaClApplication: public pp::Instance, public pp::Graphics3DClient, public pp::Graphics3D* graphics; pp::Fullscreen* fullscreen; Context* c; - Math::Vector2 viewportSize; + Vector2i viewportSize; Flags flags; CORRADE_ENUMSET_FRIEND_OPERATORS(Flags) @@ -399,13 +399,13 @@ class NaClApplication::MouseEvent: public NaClApplication::InputEvent { inline Button button() const { return _button; } /** @brief Position */ - inline Math::Vector2 position() const { return _position; } + inline Vector2i position() const { return _position; } private: - inline MouseEvent(Button button, const Math::Vector2& position, Modifiers modifiers): InputEvent(modifiers), _button(button), _position(position) {} + inline MouseEvent(Button button, const Vector2i& position, Modifiers modifiers): InputEvent(modifiers), _button(button), _position(position) {} const Button _button; - const Math::Vector2 _position; + const Vector2i _position; }; /** @@ -419,19 +419,19 @@ class NaClApplication::MouseMoveEvent: public NaClApplication::InputEvent { public: /** @brief Position */ - inline Math::Vector2 position() const { return _position; } + inline Vector2i position() const { return _position; } /** * @brief Relative position * * Position relative to previous event. */ - inline Math::Vector2 relativePosition() const { return _relativePosition; } + inline Vector2i relativePosition() const { return _relativePosition; } private: - inline MouseMoveEvent(const Math::Vector2& position, const Math::Vector2& relativePosition, Modifiers modifiers): InputEvent(modifiers), _position(position), _relativePosition(relativePosition) {} + inline MouseMoveEvent(const Vector2i& position, const Vector2i& relativePosition, Modifiers modifiers): InputEvent(modifiers), _position(position), _relativePosition(relativePosition) {} - const Math::Vector2 _position, _relativePosition; + const Vector2i _position, _relativePosition; }; CORRADE_ENUMSET_OPERATORS(NaClApplication::Flags) diff --git a/src/Platform/Sdl2Application.cpp b/src/Platform/Sdl2Application.cpp index cf6a31b34..49e6980e8 100644 --- a/src/Platform/Sdl2Application.cpp +++ b/src/Platform/Sdl2Application.cpp @@ -40,7 +40,7 @@ Sdl2Application::InputEvent::Modifiers fixedModifiers(Uint16 mod) { } -Sdl2Application::Sdl2Application(int, char**, const std::string& name, const Math::Vector2& size): _redraw(true) { +Sdl2Application::Sdl2Application(int, char**, const std::string& name, const Vector2i& size): _redraw(true) { if(SDL_Init(SDL_INIT_VIDEO) < 0) { Error() << "Cannot initialize SDL."; exit(1); diff --git a/src/Platform/Sdl2Application.h b/src/Platform/Sdl2Application.h index c7b634d31..ac1265881 100644 --- a/src/Platform/Sdl2Application.h +++ b/src/Platform/Sdl2Application.h @@ -65,7 +65,7 @@ class Sdl2Application { * @param title Window title * @param size Window size */ - Sdl2Application(int argc, char** argv, const std::string& title = "Magnum SDL2 application", const Math::Vector2& size = Math::Vector2(800, 600)); + Sdl2Application(int argc, char** argv, const std::string& title = "Magnum SDL2 application", const Vector2i& size = Vector2i(800, 600)); /** * @brief Destructor @@ -85,7 +85,7 @@ class Sdl2Application { /** @{ @name Drawing functions */ /** @copydoc GlutApplication::viewportEvent() */ - virtual void viewportEvent(const Math::Vector2& size) = 0; + virtual void viewportEvent(const Vector2i& size) = 0; /** @copydoc GlutApplication::drawEvent() */ virtual void drawEvent() = 0; @@ -351,7 +351,7 @@ class Sdl2Application::MouseEvent: public Sdl2Application::InputEvent { inline Button button() const { return _button; } /** @brief Position */ - inline Math::Vector2 position() const { return _position; } + inline Vector2i position() const { return _position; } /** * @brief Modifiers @@ -361,10 +361,10 @@ class Sdl2Application::MouseEvent: public Sdl2Application::InputEvent { Modifiers modifiers(); private: - inline MouseEvent(Button button, const Math::Vector2& position): _button(button), _position(position), modifiersLoaded(false) {} + inline MouseEvent(Button button, const Vector2i& position): _button(button), _position(position), modifiersLoaded(false) {} const Button _button; - const Math::Vector2 _position; + const Vector2i _position; bool modifiersLoaded; Modifiers _modifiers; }; @@ -379,14 +379,14 @@ class Sdl2Application::MouseMoveEvent: public Sdl2Application::InputEvent { public: /** @brief Position */ - inline Math::Vector2 position() const { return _position; } + inline Vector2i position() const { return _position; } /** * @brief Relative position * * Position relative to previous event. */ - inline Math::Vector2 relativePosition() const { return _relativePosition; } + inline Vector2i relativePosition() const { return _relativePosition; } /** * @brief Modifiers @@ -396,9 +396,9 @@ class Sdl2Application::MouseMoveEvent: public Sdl2Application::InputEvent { Modifiers modifiers(); private: - inline MouseMoveEvent(const Math::Vector2& position, const Math::Vector2& relativePosition): _position(position), _relativePosition(relativePosition), modifiersLoaded(false) {} + inline MouseMoveEvent(const Vector2i& position, const Vector2i& relativePosition): _position(position), _relativePosition(relativePosition), modifiersLoaded(false) {} - const Math::Vector2 _position, _relativePosition; + const Vector2i _position, _relativePosition; bool modifiersLoaded; Modifiers _modifiers; }; diff --git a/src/Platform/XEglApplication.h b/src/Platform/XEglApplication.h index 7fdcfe1f4..c0a12317f 100644 --- a/src/Platform/XEglApplication.h +++ b/src/Platform/XEglApplication.h @@ -52,7 +52,7 @@ class XEglApplication: public AbstractXApplication { * * Creates window with double-buffered OpenGL ES 2 context. */ - inline XEglApplication(int& argc, char** argv, const std::string& title = "Magnum X/EGL application", const Math::Vector2& size = Math::Vector2(800, 600)): AbstractXApplication(new EglContextHandler, argc, argv, title, size) {} + inline XEglApplication(int& argc, char** argv, const std::string& title = "Magnum X/EGL application", const Vector2i& size = Vector2i(800, 600)): AbstractXApplication(new EglContextHandler, argc, argv, title, size) {} }; }} diff --git a/src/Renderbuffer.h b/src/Renderbuffer.h index 23b03e657..2ee87b8bc 100644 --- a/src/Renderbuffer.h +++ b/src/Renderbuffer.h @@ -230,7 +230,7 @@ class Renderbuffer { * * @see bind(), @fn_gl{RenderbufferStorage} */ - inline void setStorage(InternalFormat internalFormat, const Math::Vector2& size) { + inline void setStorage(InternalFormat internalFormat, const Vector2i& size) { bind(); glRenderbufferStorage(GL_RENDERBUFFER, internalFormat, size.x(), size.y()); } diff --git a/src/SceneGraph/AbstractCamera.h b/src/SceneGraph/AbstractCamera.h index 8af0eec73..31c11fa39 100644 --- a/src/SceneGraph/AbstractCamera.h +++ b/src/SceneGraph/AbstractCamera.h @@ -40,7 +40,7 @@ enum class AspectRatioPolicy: std::uint8_t { #ifndef DOXYGEN_GENERATING_OUTPUT namespace Implementation { - template typename DimensionTraits::MatrixType aspectRatioFix(AspectRatioPolicy aspectRatioPolicy, const Math::Vector2& projectionScale, const Math::Vector2& viewport); + template typename DimensionTraits::MatrixType aspectRatioFix(AspectRatioPolicy aspectRatioPolicy, const Math::Vector2& projectionScale, const Vector2i& viewport); } #endif @@ -121,7 +121,7 @@ class MAGNUM_SCENEGRAPH_EXPORT AbstractCamera: public AbstractFeature viewport() const { return _viewport; } + inline Vector2i viewport() const { return _viewport; } /** * @brief Set viewport size @@ -130,7 +130,7 @@ class MAGNUM_SCENEGRAPH_EXPORT AbstractCamera: public AbstractFeature& size); + virtual void setViewport(const Vector2i& size); /** * @brief Draw @@ -158,7 +158,7 @@ class MAGNUM_SCENEGRAPH_EXPORT AbstractCamera: public AbstractFeature::MatrixType _projectionMatrix; typename DimensionTraits::MatrixType _cameraMatrix; - Math::Vector2 _viewport; + Vector2i _viewport; }; template inline AbstractCamera::~AbstractCamera() {} diff --git a/src/SceneGraph/Test/CameraTest.cpp b/src/SceneGraph/Test/CameraTest.cpp index c3396e458..4dd856798 100644 --- a/src/SceneGraph/Test/CameraTest.cpp +++ b/src/SceneGraph/Test/CameraTest.cpp @@ -47,13 +47,13 @@ CameraTest::CameraTest() { void CameraTest::fixAspectRatio() { Vector2 projectionScale(0.5f, 1.0f/3.0f); - Math::Vector2 size(400, 300); + Vector2i size(400, 300); /* Division by zero */ Vector2 projectionScaleZeroY(0.5f, 0.0f); Vector2 projectionScaleZeroX(0.0f, 0.5f); - Math::Vector2 sizeZeroY(400, 0); - Math::Vector2 sizeZeroX(0, 300); + Vector2i sizeZeroY(400, 0); + Vector2i sizeZeroX(0, 300); CORRADE_COMPARE((Implementation::aspectRatioFix<3, GLfloat>(AspectRatioPolicy::Clip, projectionScaleZeroX, size)), Matrix4()); CORRADE_COMPARE((Implementation::aspectRatioFix<3, GLfloat>(AspectRatioPolicy::Clip, projectionScaleZeroY, size)), Matrix4()); CORRADE_COMPARE((Implementation::aspectRatioFix<3, GLfloat>(AspectRatioPolicy::Clip, projectionScale, sizeZeroY)), Matrix4()); diff --git a/src/Swizzle.h b/src/Swizzle.h index 529d538ec..0805f6a9c 100644 --- a/src/Swizzle.h +++ b/src/Swizzle.h @@ -90,7 +90,7 @@ namespace Implementation { Creates new vector from given components. Example: @code -Vector4 original(-1, 2, 3, 4); +Vector4i original(-1, 2, 3, 4); auto vec = swizzle<'a', '1', '0', 'r', 'g', 'b'>(original); // vec == { 4, 1, 0, -1, 2, 3 } @@ -118,7 +118,7 @@ template inline constexpr typename Implementation:: Creates new vector from given components. Example: @code -Vector4 original(-1, 2, 3, 4); +Vector4i original(-1, 2, 3, 4); auto vec = swizzle(original, "a10rgb"); // vec == { 4, 1, 0, -1, 2, 3 } diff --git a/src/Test/SwizzleTest.cpp b/src/Test/SwizzleTest.cpp index fa36a4576..3ac1c4139 100644 --- a/src/Test/SwizzleTest.cpp +++ b/src/Test/SwizzleTest.cpp @@ -23,10 +23,6 @@ CORRADE_TEST_MAIN(Magnum::Test::SwizzleTest) namespace Magnum { namespace Test { -typedef Math::Vector2 Vector2; -typedef Math::Vector3 Vector3; -typedef Math::Vector4 Vector4; - SwizzleTest::SwizzleTest() { addTests(&SwizzleTest::xyzw, &SwizzleTest::rgba, @@ -37,42 +33,42 @@ SwizzleTest::SwizzleTest() { } void SwizzleTest::xyzw() { - Vector4 orig(2, 4, 5, 7); - Vector4 swizzled(5, 2, 7, 4); + Vector4i orig(2, 4, 5, 7); + Vector4i swizzled(5, 2, 7, 4); CORRADE_COMPARE(swizzle(orig, "zxwy"), swizzled); CORRADE_COMPARE((swizzle<'z', 'x', 'w', 'y'>(orig)), swizzled); } void SwizzleTest::rgba() { - Vector4 orig(2, 4, 5, 7); - Vector4 swizzled(5, 2, 7, 4); + Vector4i orig(2, 4, 5, 7); + Vector4i swizzled(5, 2, 7, 4); CORRADE_COMPARE(swizzle(orig, "brag"), swizzled); CORRADE_COMPARE((swizzle<'b', 'r', 'a', 'g'>(orig)), swizzled); } void SwizzleTest::constants() { - Vector4 orig(2, 4, 5, 7); - Vector4 swizzled(1, 7, 0, 4); + Vector4i orig(2, 4, 5, 7); + Vector4i swizzled(1, 7, 0, 4); CORRADE_COMPARE(swizzle(orig, "1w0g"), swizzled); CORRADE_COMPARE((swizzle<'1', 'w', '0', 'g'>(orig)), swizzled); } void SwizzleTest::fromSmall() { /* Force compile-time evaluation for both */ - constexpr Vector2 orig(1, 2); - constexpr Vector3 swizzled(swizzle(orig, "gxr")); + constexpr Vector2i orig(1, 2); + constexpr Vector3i swizzled(swizzle(orig, "gxr")); CORRADE_VERIFY((integral_constant::value)); - CORRADE_COMPARE((swizzle<'g', 'x', 'r'>(orig)), Vector3(2, 1, 1)); + CORRADE_COMPARE((swizzle<'g', 'x', 'r'>(orig)), Vector3i(2, 1, 1)); } void SwizzleTest::type() { - Vector4 orig; - CORRADE_VERIFY((is_same(orig)), Vector2>::value)); - CORRADE_VERIFY((is_same::value)); - CORRADE_VERIFY((is_same(orig)), Vector3>::value)); - CORRADE_VERIFY((is_same::value)); - CORRADE_VERIFY((is_same(orig)), Vector4>::value)); - CORRADE_VERIFY((is_same::value)); + Vector4i orig; + CORRADE_VERIFY((is_same(orig)), Vector2i>::value)); + CORRADE_VERIFY((is_same::value)); + CORRADE_VERIFY((is_same(orig)), Vector3i>::value)); + CORRADE_VERIFY((is_same::value)); + CORRADE_VERIFY((is_same(orig)), Vector4i>::value)); + CORRADE_VERIFY((is_same::value)); Color3 origColor3; Color4 origColor4; @@ -87,7 +83,7 @@ void SwizzleTest::type() { } void SwizzleTest::defaultType() { - Vector4 orig(1, 2, 3, 4); + Vector4i orig(1, 2, 3, 4); CORRADE_COMPARE(swizzle<'b'>(orig), (Math::Vector<1, int32_t>(3))); CORRADE_COMPARE(swizzle(orig, "b"), (Math::Vector<1, int32_t>(3))); CORRADE_COMPARE((swizzle<'b', 'r', 'a', 'g', 'z', 'y', 'x'>(orig)), (Math::Vector<7, int32_t>(3, 1, 4, 2, 3, 2, 1)));