Browse Source

Marking all constructors explicit, except for matrix and vector classes.

It prevents unwanted implicit conversions from e.g. nullptr to Camera,
Vector2 to Physics::Point etc. By making all the constructors explicit
it is easier to routinely add the keyword to all new classes instead of
thinking about cases when to add and when not to.
pull/7/head
Vladimír Vondruš 14 years ago
parent
commit
7e66a09461
  1. 2
      src/AbstractFramebuffer.h
  2. 2
      src/AbstractImage.h
  3. 2
      src/AbstractResourceLoader.h
  4. 2
      src/AbstractShaderProgram.h
  5. 2
      src/AbstractTexture.h
  6. 26
      src/Array.h
  7. 2
      src/Buffer.h
  8. 2
      src/BufferImage.h
  9. 2
      src/BufferTexture.h
  10. 22
      src/Color.h
  11. 2
      src/Context.h
  12. 2
      src/CubeMapTexture.h
  13. 2
      src/CubeMapTextureArray.h
  14. 2
      src/DefaultFramebuffer.h
  15. 2
      src/Framebuffer.h
  16. 4
      src/Image.h
  17. 4
      src/ImageWrapper.h
  18. 2
      src/IndexedMesh.h
  19. 6
      src/Math/Matrix.h
  20. 6
      src/Math/Matrix3.h
  21. 6
      src/Math/Matrix4.h
  22. 12
      src/Math/Point2D.h
  23. 12
      src/Math/Point3D.h
  24. 4
      src/Math/RectangularMatrix.h
  25. 6
      src/Math/Vector.h
  26. 10
      src/Math/Vector2.h
  27. 12
      src/Math/Vector3.h
  28. 12
      src/Math/Vector4.h
  29. 2
      src/Mesh.h
  30. 2
      src/Physics/AbstractShape.h
  31. 2
      src/Physics/AxisAlignedBox.h
  32. 2
      src/Physics/Box.h
  33. 2
      src/Physics/Capsule.h
  34. 2
      src/Physics/DebugDrawResourceManager.h
  35. 2
      src/Physics/Line.h
  36. 2
      src/Physics/LineSegment.h
  37. 2
      src/Physics/ObjectShape.h
  38. 2
      src/Physics/ObjectShapeGroup.h
  39. 2
      src/Physics/Plane.h
  40. 2
      src/Physics/Point.h
  41. 2
      src/Physics/ShapeGroup.h
  42. 2
      src/Physics/Sphere.h
  43. 2
      src/Platform/AbstractContextHandler.h
  44. 2
      src/Platform/AbstractXApplication.h
  45. 1
      src/Platform/EglContextHandler.h
  46. 2
      src/Platform/GlutApplication.h
  47. 2
      src/Platform/GlxApplication.h
  48. 1
      src/Platform/GlxContextHandler.h
  49. 2
      src/Platform/Sdl2Application.h
  50. 2
      src/Platform/WindowlessGlxApplication.h
  51. 2
      src/Platform/XEglApplication.h
  52. 2
      src/Primitives/Capsule.h
  53. 2
      src/Primitives/Cube.h
  54. 2
      src/Primitives/Cylinder.h
  55. 4
      src/Primitives/Icosphere.h
  56. 2
      src/Primitives/Plane.h
  57. 2
      src/Primitives/Square.h
  58. 2
      src/Primitives/UVSphere.h
  59. 2
      src/Profiler.h
  60. 8
      src/Query.h
  61. 2
      src/Renderbuffer.h
  62. 2
      src/Resource.h
  63. 2
      src/SceneGraph/AbstractCamera.h
  64. 2
      src/SceneGraph/AbstractFeature.h
  65. 2
      src/SceneGraph/AbstractGroupedFeature.h
  66. 1
      src/SceneGraph/AbstractObject.h
  67. 1
      src/SceneGraph/AbstractTransformation.h
  68. 2
      src/SceneGraph/AbstractTranslationRotation2D.h
  69. 2
      src/SceneGraph/AbstractTranslationRotation3D.h
  70. 2
      src/SceneGraph/AbstractTranslationRotationScaling2D.h
  71. 2
      src/SceneGraph/AbstractTranslationRotationScaling3D.h
  72. 2
      src/SceneGraph/Animable.h
  73. 2
      src/SceneGraph/AnimableGroup.h
  74. 2
      src/SceneGraph/Camera2D.h
  75. 2
      src/SceneGraph/Camera3D.h
  76. 2
      src/SceneGraph/Drawable.h
  77. 2
      src/SceneGraph/FeatureGroup.h
  78. 2
      src/SceneGraph/MatrixTransformation2D.h
  79. 2
      src/SceneGraph/MatrixTransformation3D.h
  80. 2
      src/SceneGraph/Object.h
  81. 2
      src/SceneGraph/Scene.h
  82. 2
      src/Shader.h
  83. 2
      src/Shaders/FlatShader.h
  84. 2
      src/Shaders/PhongShader.h
  85. 2
      src/Shaders/VertexColorShader.h
  86. 2
      src/SizeTraits.h
  87. 2
      src/Texture.h
  88. 2
      src/Timeline.h
  89. 2
      src/Trade/AbstractImporter.h

2
src/AbstractFramebuffer.h

@ -182,7 +182,7 @@ class MAGNUM_EXPORT AbstractFramebuffer {
blit(source, destination, bottomLeft, topRight, bottomLeft, topRight, mask, BlitFilter::NearestNeighbor);
}
AbstractFramebuffer() = default;
explicit AbstractFramebuffer() = default;
virtual ~AbstractFramebuffer() = 0;
/**

2
src/AbstractImage.h

@ -436,7 +436,7 @@ class MAGNUM_EXPORT AbstractImage {
* @param format Format of pixel data
* @param type Data type of pixel data
*/
inline AbstractImage(Format format, Type type): _format(format), _type(type) {}
inline explicit AbstractImage(Format format, Type type): _format(format), _type(type) {}
/** @brief Destructor */
virtual ~AbstractImage() = 0;

2
src/AbstractResourceLoader.h

@ -91,7 +91,7 @@ template<class T> class AbstractResourceLoader {
friend class Implementation::ResourceManagerData<T>;
public:
inline AbstractResourceLoader(): manager(nullptr), _requestedCount(0), _loadedCount(0), _notFoundCount(0) {}
inline explicit AbstractResourceLoader(): manager(nullptr), _requestedCount(0), _loadedCount(0), _notFoundCount(0) {}
inline virtual ~AbstractResourceLoader() {
if(manager) manager->_loader = nullptr;

2
src/AbstractShaderProgram.h

@ -455,7 +455,7 @@ class MAGNUM_EXPORT AbstractShaderProgram {
* Creates one OpenGL shader program.
* @see @fn_gl{CreateProgram}
*/
inline AbstractShaderProgram(): state(Initialized) {
inline explicit AbstractShaderProgram(): state(Initialized) {
_id = glCreateProgram();
}

2
src/AbstractTexture.h

@ -974,7 +974,7 @@ class MAGNUM_EXPORT AbstractTexture {
* Creates one OpenGL texture.
* @see @fn_gl{GenTextures}
*/
inline AbstractTexture(GLenum target): _target(target) {
inline explicit AbstractTexture(GLenum target): _target(target) {
glGenTextures(1, &_id);
}

26
src/Array.h

@ -45,7 +45,7 @@ template<std::uint8_t dimensions, class T> class Array {
*
* Sets all components to their default-constructed values
*/
inline constexpr Array(): _data() {}
inline constexpr /*implicit*/ Array(): _data() {}
/**
* @brief Initializer-list constructor
@ -53,19 +53,19 @@ template<std::uint8_t dimensions, class T> class Array {
* @param next Next values
*/
#ifndef DOXYGEN_GENERATING_OUTPUT
template<class ...U> inline constexpr Array(T first, T second, U... next): _data{first, second, next...} {
template<class ...U> inline constexpr /*implicit*/ Array(T first, T second, U... next): _data{first, second, next...} {
static_assert(sizeof...(next)+2 == dimensions, "Improper number of arguments passed to Array constructor");
}
template<class U = T> inline constexpr Array(typename std::enable_if<std::is_same<T, U>::value && dimensions == 1, U>::type first): _data{first} {}
template<class U = T> inline constexpr /*implicit*/ Array(typename std::enable_if<std::is_same<T, U>::value && dimensions == 1, U>::type first): _data{first} {}
#else
template<class ...U> inline constexpr Array(T first, U... next);
template<class ...U> inline constexpr /*implicit*/ Array(T first, U... next);
#endif
/**
* @brief Constructor
* @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 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)
_data[i] = value;
}
@ -104,13 +104,13 @@ template<std::uint8_t dimensions, class T> class Array {
template<class T> class Array1D: public Array<1, T> {
public:
/** @copydoc Array::Array() */
inline constexpr Array1D() = default;
inline constexpr /*implicit*/ Array1D() = default;
/**
* @brief Constructor
* @param x X component
*/
inline constexpr Array1D(T x): Array<1, T>(x) {}
inline constexpr /*implicit*/ Array1D(T x): Array<1, T>(x) {}
/** @brief Copy constructor */
inline constexpr Array1D(const Array<1, T>& other): Array<1, T>(other) {}
@ -126,17 +126,17 @@ template<class T> class Array1D: public Array<1, T> {
template<class T> class Array2D: public Array<2, T> {
public:
/** @copydoc Array::Array() */
inline constexpr Array2D() = default;
inline constexpr /*implicit*/ Array2D() = default;
/**
* @brief Constructor
* @param x X component
* @param y Y component
*/
inline constexpr Array2D(T x, T y): Array<2, T>(x, y) {}
inline constexpr /*implicit*/ Array2D(T x, T y): Array<2, T>(x, y) {}
/** @copydoc Array::Array(U) */
inline constexpr Array2D(T value): Array<2, T>(value, value) {}
inline constexpr /*implicit*/ Array2D(T value): Array<2, T>(value, value) {}
/** @brief Copy constructor */
inline constexpr Array2D(const Array<2, T>& other): Array<2, T>(other) {}
@ -154,7 +154,7 @@ template<class T> class Array2D: public Array<2, T> {
template<class T> class Array3D: public Array<3, T> {
public:
/** @copydoc Array::Array() */
inline constexpr Array3D() {}
inline constexpr /*implicit*/ Array3D() {}
/**
* @brief Constructor
@ -162,10 +162,10 @@ template<class T> class Array3D: public Array<3, T> {
* @param y Y component
* @param z Z component
*/
inline constexpr Array3D(T x, T y, T z): Array<3, T>(x, y, z) {}
inline constexpr /*implicit*/ Array3D(T x, T y, T z): Array<3, T>(x, y, z) {}
/** @copydoc Array::Array(U) */
inline constexpr Array3D(T value): Array<3, T>(value, value, value) {}
inline constexpr /*implicit*/ Array3D(T value): Array<3, T>(value, value, value) {}
/** @brief Copy constructor */
inline constexpr Array3D(const Array<3, T>& other): Array<3, T>(other) {}

2
src/Buffer.h

@ -311,7 +311,7 @@ class MAGNUM_EXPORT Buffer {
* Generates new OpenGL buffer.
* @see @fn_gl{GenBuffers}
*/
inline Buffer(Target targetHint = Target::Array): _targetHint(targetHint) {
inline explicit Buffer(Target targetHint = Target::Array): _targetHint(targetHint) {
glGenBuffers(1, &_id);
}

2
src/BufferImage.h

@ -49,7 +49,7 @@ template<std::uint8_t dimensions> class MAGNUM_EXPORT BufferImage: public Abstra
* Dimensions and buffer are empty, call setData() to fill the image
* with data.
*/
inline BufferImage(Format format, Type type): AbstractImage(format, type) {
inline explicit BufferImage(Format format, Type type): AbstractImage(format, type) {
_buffer.setTargetHint(Buffer::Target::PixelPack);
}

2
src/BufferTexture.h

@ -194,7 +194,7 @@ class MAGNUM_EXPORT BufferTexture: private AbstractTexture {
RGBA32F = GL_RGBA32F
};
inline BufferTexture(): AbstractTexture(GL_TEXTURE_BUFFER) {}
inline explicit BufferTexture(): AbstractTexture(GL_TEXTURE_BUFFER) {}
/** @copydoc AbstractTexture::bind() */
inline void bind(GLint layer) { AbstractTexture::bind(layer); }

22
src/Color.h

@ -211,7 +211,7 @@ class Color3: public Math::Vector3<T> {
*
* All components are set to zero.
*/
inline constexpr Color3() {}
inline constexpr /*implicit*/ Color3() {}
/**
* @brief Gray constructor
@ -219,16 +219,16 @@ class Color3: public Math::Vector3<T> {
*/
inline constexpr explicit Color3(T rgb): Math::Vector3<T>(rgb) {}
/** @brief Copy constructor */
inline constexpr Color3(const Math::RectangularMatrix<1, 3, T>& other): Math::Vector3<T>(other) {}
/**
* @brief Constructor
* @param r R value
* @param g G value
* @param b B value
*/
inline constexpr Color3(T r, T g, T b): Math::Vector3<T>(r, g, b) {}
inline constexpr /*implicit*/ Color3(T r, T g, T b): Math::Vector3<T>(r, g, b) {}
/** @brief Copy constructor */
inline constexpr Color3(const Math::RectangularMatrix<1, 3, T>& other): Math::Vector3<T>(other) {}
inline T& r() { return Math::Vector3<T>::x(); } /**< @brief R component */
inline constexpr T r() const { return Math::Vector3<T>::x(); } /**< @overload */
@ -343,7 +343,7 @@ class Color4: public Math::Vector4<T> {
* RGB components are set to zero, A component is set to 1.0 for
* floating-point types and maximum positive value for integral types.
*/
inline constexpr Color4(): Math::Vector4<T>(T(0), T(0), T(0), Implementation::defaultAlpha<T>()) {}
inline constexpr /*implicit*/ Color4(): Math::Vector4<T>(T(0), T(0), T(0), Implementation::defaultAlpha<T>()) {}
/**
* @copydoc Color3::Color3(T)
@ -352,9 +352,6 @@ class Color4: public Math::Vector4<T> {
*/
inline constexpr explicit Color4(T rgb, T alpha = Implementation::defaultAlpha<T>()): Math::Vector4<T>(rgb, rgb, rgb, alpha) {}
/** @brief Copy constructor */
inline constexpr Color4(const Math::RectangularMatrix<1, 4, T>& other): Math::Vector4<T>(other) {}
/**
* @brief Constructor
* @param r R value
@ -363,7 +360,7 @@ class Color4: public Math::Vector4<T> {
* @param a A value, defaults to 1.0 for floating-point types and
* maximum positive value for integral types.
*/
inline constexpr Color4(T r, T g, T b, T a = Implementation::defaultAlpha<T>()): Math::Vector4<T>(r, g, b, a) {}
inline constexpr /*implicit*/ Color4(T r, T g, T b, T a = Implementation::defaultAlpha<T>()): Math::Vector4<T>(r, g, b, a) {}
/**
* @brief Constructor
@ -372,7 +369,10 @@ class Color4: public Math::Vector4<T> {
*/
/* Not marked as explicit, because conversion from Color3 to Color4
is fairly common, nearly always with A set to 1 */
inline constexpr Color4(const Math::Vector3<T>& rgb, T a = Implementation::defaultAlpha<T>()): Math::Vector4<T>(rgb[0], rgb[1], rgb[2], a) {}
inline constexpr /*implicit*/ Color4(const Math::Vector3<T>& rgb, T a = Implementation::defaultAlpha<T>()): Math::Vector4<T>(rgb[0], rgb[1], rgb[2], a) {}
/** @brief Copy constructor */
inline constexpr Color4(const Math::RectangularMatrix<1, 4, T>& other): Math::Vector4<T>(other) {}
inline T& r() { return Math::Vector4<T>::x(); } /**< @brief R component */
inline constexpr T r() const { return Math::Vector4<T>::x(); } /**< @overload */

2
src/Context.h

@ -143,7 +143,7 @@ class MAGNUM_EXPORT Context {
* @see @fn_gl{Get} with @def_gl{MAJOR_VERSION}, @def_gl{MINOR_VERSION},
* @fn_gl{GetString} with @def_gl{EXTENSIONS}
*/
Context();
explicit Context();
~Context();

2
src/CubeMapTexture.h

@ -97,7 +97,7 @@ class CubeMapTexture: public AbstractTexture {
* Creates one cube map OpenGL texture.
* @see @def_gl{TEXTURE_CUBE_MAP}
*/
inline CubeMapTexture(): AbstractTexture(GL_TEXTURE_CUBE_MAP) {}
inline explicit CubeMapTexture(): AbstractTexture(GL_TEXTURE_CUBE_MAP) {}
/**
* @copydoc Texture::setWrapping()

2
src/CubeMapTextureArray.h

@ -87,7 +87,7 @@ class CubeMapTextureArray: public AbstractTexture {
* Creates one cube map OpenGL texture.
* @see @def_gl{TEXTURE_CUBE_MAP_ARRAY}
*/
inline CubeMapTextureArray(): AbstractTexture(GL_TEXTURE_CUBE_MAP_ARRAY) {}
inline explicit CubeMapTextureArray(): AbstractTexture(GL_TEXTURE_CUBE_MAP_ARRAY) {}
/**
* @copydoc Texture::setWrapping()

2
src/DefaultFramebuffer.h

@ -164,7 +164,7 @@ class MAGNUM_EXPORT DefaultFramebuffer: public AbstractFramebuffer {
#endif
};
MAGNUM_LOCAL DefaultFramebuffer();
explicit MAGNUM_LOCAL DefaultFramebuffer();
#ifndef MAGNUM_TARGET_GLES2
/**

2
src/Framebuffer.h

@ -38,7 +38,7 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer {
* Generates new OpenGL framebuffer.
* @see @fn_gl{GenFramebuffers}
*/
Framebuffer(const Vector2i& viewportPosition, const Vector2i& viewportSize);
explicit Framebuffer(const Vector2i& viewportPosition, const Vector2i& viewportSize);
/**
* @brief Destructor

4
src/Image.h

@ -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
* are deleted on class destruction.
*/
inline 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, GLsizei>::VectorType& size, Format format, Type type, GLvoid* data): AbstractImage(format, type), _size(size), _data(reinterpret_cast<char*>(data)) {}
/**
* @brief Constructor
@ -56,7 +56,7 @@ template<std::uint8_t dimensions> class Image: public AbstractImage {
* Dimensions and data pointer are set to zero, call setData() to fill
* the image with data.
*/
inline Image(Format format, Type type): AbstractImage(format, type), _data(nullptr) {}
inline explicit Image(Format format, Type type): AbstractImage(format, type), _data(nullptr) {}
/** @brief Destructor */
inline ~Image() { delete[] _data; }

4
src/ImageWrapper.h

@ -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
* are deleted on class destruction.
*/
inline 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, GLsizei>::VectorType& size, Format format, Type type, GLvoid* data): AbstractImage(format, type), _size(size), _data(reinterpret_cast<char*>(data)) {}
/**
* @brief Constructor
@ -64,7 +64,7 @@ template<std::uint8_t dimensions> class ImageWrapper: public AbstractImage {
* Dimensions and data pointer are set to zero, call setData() to fill
* the image with data.
*/
inline 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, GLsizei>::VectorType& size, Format format, Type type): AbstractImage(format, type), _size(size), _data(nullptr) {}
/** @brief %Image size */
inline typename DimensionTraits<Dimensions, GLsizei>::VectorType size() const { return _size; }

2
src/IndexedMesh.h

@ -80,7 +80,7 @@ class MAGNUM_EXPORT IndexedMesh: public Mesh {
* @see setPrimitive(), setVertexCount(), setIndexBuffer(),
* setIndexCount(), setIndexType()
*/
inline IndexedMesh(Primitive primitive = Primitive::Triangles): Mesh(primitive), _indexBuffer(nullptr), _indexCount(0), _indexType(Type::UnsignedShort) {}
inline explicit IndexedMesh(Primitive primitive = Primitive::Triangles): Mesh(primitive), _indexBuffer(nullptr), _indexCount(0), _indexType(Type::UnsignedShort) {}
/**
* @brief Set index buffer

6
src/Math/Matrix.h

@ -62,7 +62,7 @@ template<std::size_t size, class T> class Matrix: public RectangularMatrix<size,
* `Matrix m(Matrix::Identity);`. Optional parameter @p value allows
* you to specify value on diagonal.
*/
inline Matrix(IdentityType = Identity, T value = T(1)) {
inline /*implicit*/ Matrix(IdentityType = Identity, T value = T(1)) {
for(std::size_t i = 0; i != size; ++i)
(*this)(i, i) = value;
}
@ -77,9 +77,9 @@ template<std::size_t size, class T> class Matrix: public RectangularMatrix<size,
* @todoc Remove workaround when Doxygen supports uniform initialization
*/
#ifndef DOXYGEN_GENERATING_OUTPUT
template<class ...U> inline constexpr Matrix(T first, U... next): RectangularMatrix<size, size, T>(first, next...) {}
template<class ...U> inline constexpr /*implicit*/ Matrix(T first, U... next): RectangularMatrix<size, size, T>(first, next...) {}
#else
template<class ...U> inline constexpr Matrix(T first, U... next);
template<class ...U> inline constexpr /*implicit*/ Matrix(T first, U... next);
#endif
/** @brief Copy constructor */

6
src/Math/Matrix3.h

@ -87,7 +87,7 @@ template<class T> class Matrix3: public Matrix<3, T> {
inline constexpr explicit Matrix3(typename Matrix<3, T>::ZeroType): Matrix<3, T>(Matrix<3, T>::Zero) {}
/** @copydoc Matrix::Matrix(IdentityType, T) */
inline constexpr Matrix3(typename Matrix<3, T>::IdentityType = (Matrix<3, T>::Identity), T value = T(1)): Matrix<3, T>(
inline constexpr /*implicit*/ Matrix3(typename Matrix<3, T>::IdentityType = (Matrix<3, T>::Identity), T value = T(1)): Matrix<3, T>(
value, T(0), T(0),
T(0), value, T(0),
T(0), T(0), value
@ -95,9 +95,9 @@ template<class T> class Matrix3: public Matrix<3, T> {
/** @copydoc Matrix::Matrix */
#ifndef DOXYGEN_GENERATING_OUTPUT
template<class ...U> inline constexpr Matrix3(T first, U... next): Matrix<3, T>(first, next...) {}
template<class ...U> inline constexpr /*implicit*/ Matrix3(T first, U... next): Matrix<3, T>(first, next...) {}
#else
template<class ...U> inline constexpr Matrix3(T first, U... next) {}
template<class ...U> inline constexpr /*implicit*/ Matrix3(T first, U... next) {}
#endif
/** @brief Copy constructor */

6
src/Math/Matrix4.h

@ -177,7 +177,7 @@ template<class T> class Matrix4: public Matrix<4, T> {
inline constexpr explicit Matrix4(typename Matrix<4, T>::ZeroType): Matrix<4, T>(Matrix<4, T>::Zero) {}
/** @copydoc Matrix::Matrix(IdentityType, T) */
inline constexpr Matrix4(typename Matrix<4, T>::IdentityType = (Matrix<4, T>::Identity), T value = T(1)): Matrix<4, T>(
inline constexpr /*implicit*/ Matrix4(typename Matrix<4, T>::IdentityType = (Matrix<4, T>::Identity), T value = T(1)): Matrix<4, T>(
value, T(0), T(0), T(0),
T(0), value, T(0), T(0),
T(0), T(0), value, T(0),
@ -186,9 +186,9 @@ template<class T> class Matrix4: public Matrix<4, T> {
/** @copydoc Matrix::Matrix */
#ifndef DOXYGEN_GENERATING_OUTPUT
template<class ...U> inline constexpr Matrix4(T first, U... next): Matrix<4, T>(first, next...) {}
template<class ...U> inline constexpr /*implicit*/ Matrix4(T first, U... next): Matrix<4, T>(first, next...) {}
#else
template<class ...U> inline constexpr Matrix4(T first, U... next) {}
template<class ...U> inline constexpr /*implicit*/ Matrix4(T first, U... next) {}
#endif
/** @brief Copy constructor */

12
src/Math/Point2D.h

@ -39,10 +39,7 @@ template<class T> class Point2D: public Vector3<T> {
*
* X and Y components are set to zero, Z is set to one.
*/
inline constexpr Point2D(): Vector3<T>(T(0), T(0), T(1)) {}
/** @brief Copy constructor */
inline constexpr Point2D(const RectangularMatrix<1, 3, T>& other): Vector3<T>(other) {}
inline constexpr /*implicit*/ Point2D(): Vector3<T>(T(0), T(0), T(1)) {}
/**
* @brief Constructor
@ -50,14 +47,17 @@ template<class T> class Point2D: public Vector3<T> {
* @param y Y component
* @param z Z component
*/
inline constexpr Point2D(T x, T y, T z = T(1)): Vector3<T>(x, y, z) {}
inline constexpr /*implicit*/ Point2D(T x, T y, T z = T(1)): Vector3<T>(x, y, z) {}
/**
* @brief Constructor
* @param xy Two-component vector
* @param z Z component
*/
inline constexpr Point2D(const Vector2<T>& xy, T z = T(1)): Vector3<T>(xy, z) {}
inline constexpr /*implicit*/ Point2D(const Vector2<T>& xy, T z = T(1)): Vector3<T>(xy, z) {}
/** @brief Copy constructor */
inline constexpr Point2D(const RectangularMatrix<1, 3, T>& other): Vector3<T>(other) {}
/**
* @brief Vector part of the point

12
src/Math/Point3D.h

@ -39,10 +39,7 @@ template<class T> class Point3D: public Vector4<T> {
*
* X, Y and Z components are set to zero, W is set to one.
*/
inline constexpr Point3D(): Vector4<T>(T(0), T(0), T(0), T(1)) {}
/** @brief Copy constructor */
inline constexpr Point3D(const RectangularMatrix<1, 4, T>& other): Vector4<T>(other) {}
inline constexpr /*implicit*/ Point3D(): Vector4<T>(T(0), T(0), T(0), T(1)) {}
/**
* @brief Constructor
@ -51,14 +48,17 @@ template<class T> class Point3D: public Vector4<T> {
* @param z Z component
* @param w W component
*/
inline constexpr Point3D(T x, T y, T z, T w = T(1)): Vector4<T>(x, y, z, w) {}
inline constexpr /*implicit*/ Point3D(T x, T y, T z, T w = T(1)): Vector4<T>(x, y, z, w) {}
/**
* @brief Constructor
* @param xyz Three-component vector
* @param w W component
*/
inline constexpr Point3D(const Vector3<T>& xyz, T w = T(1)): Vector4<T>(xyz, w) {}
inline constexpr /*implicit*/ Point3D(const Vector3<T>& xyz, T w = T(1)): Vector4<T>(xyz, w) {}
/** @brief Copy constructor */
inline constexpr Point3D(const RectangularMatrix<1, 4, T>& other): Vector4<T>(other) {}
/**
* @brief Vector part of the point

4
src/Math/RectangularMatrix.h

@ -116,7 +116,7 @@ template<std::size_t cols, std::size_t rows, class T> class RectangularMatrix {
}
/** @brief Zero-filled matrix constructor */
inline constexpr RectangularMatrix(): _data() {}
inline constexpr /*implicit*/ RectangularMatrix(): _data() {}
/**
* @brief Initializer-list constructor
@ -127,7 +127,7 @@ template<std::size_t cols, std::size_t rows, class T> class RectangularMatrix {
* @todoc Remove workaround when Doxygen supports uniform initialization
*/
#ifndef DOXYGEN_GENERATING_OUTPUT
template<class ...U> inline constexpr RectangularMatrix(T first, U... next): _data{first, next...} {
template<class ...U> inline constexpr /*implicit*/ RectangularMatrix(T first, U... next): _data{first, next...} {
static_assert(sizeof...(next)+1 == cols*rows, "Improper number of arguments passed to RectangularMatrix constructor");
}
#else

6
src/Math/Vector.h

@ -69,7 +69,7 @@ template<std::size_t size, class T> class Vector: public RectangularMatrix<1, si
}
/** @brief Default constructor */
inline constexpr Vector() {}
inline constexpr /*implicit*/ Vector() {}
/** @todo Creating Vector from combination of vector and scalar types */
@ -79,9 +79,9 @@ template<std::size_t size, class T> class Vector: public RectangularMatrix<1, si
* @param next Next values
*/
#ifndef DOXYGEN_GENERATING_OUTPUT
template<class ...U> inline constexpr Vector(T first, U... next): RectangularMatrix<1, size, T>(first, next...) {}
template<class ...U> inline constexpr /*implicit*/ Vector(T first, U... next): RectangularMatrix<1, size, T>(first, next...) {}
#else
template<class ...U> inline constexpr Vector(T first, U... next);
template<class ...U> inline constexpr /*implicit*/ Vector(T first, U... next);
#endif
/**

10
src/Math/Vector2.h

@ -72,20 +72,20 @@ template<class T> class Vector2: public Vector<2, T> {
inline constexpr static Vector2<T> yScale(T scale) { return Vector2<T>(T(1), scale); }
/** @copydoc Vector::Vector() */
inline constexpr Vector2() {}
inline constexpr /*implicit*/ Vector2() {}
/** @copydoc Vector::Vector(T) */
inline constexpr explicit Vector2(T value): Vector<2, T>(value, value) {}
/** @brief Copy constructor */
inline constexpr Vector2(const RectangularMatrix<1, 2, T>& other): Vector<2, T>(other) {}
/**
* @brief Constructor
* @param x X component
* @param y Y component
*/
inline constexpr Vector2(T x, T y): Vector<2, T>(x, y) {}
inline constexpr /*implicit*/ Vector2(T x, T y): Vector<2, T>(x, y) {}
/** @brief Copy constructor */
inline constexpr Vector2(const RectangularMatrix<1, 2, T>& other): Vector<2, T>(other) {}
inline T& x() { return (*this)[0]; } /**< @brief X component */
inline constexpr T x() const { return (*this)[0]; } /**< @overload */

12
src/Math/Vector3.h

@ -104,28 +104,28 @@ template<class T> class Vector3: public Vector<3, T> {
}
/** @copydoc Vector::Vector() */
inline constexpr Vector3() {}
inline constexpr /*implicit*/ Vector3() {}
/** @copydoc Vector::Vector(T) */
inline constexpr explicit Vector3(T value): Vector<3, T>(value, value, value) {}
/** @brief Copy constructor */
inline constexpr Vector3(const RectangularMatrix<1, 3, T>& other): Vector<3, T>(other) {}
/**
* @brief Constructor
* @param x X component
* @param y Y component
* @param z Z component
*/
inline constexpr Vector3(T x, T y, T z): Vector<3, T>(x, y, z) {}
inline constexpr /*implicit*/ Vector3(T x, T y, T z): Vector<3, T>(x, y, z) {}
/**
* @brief Constructor
* @param xy Two-component vector
* @param z Z component
*/
inline constexpr Vector3(const Vector2<T>& xy, T z): Vector<3, T>(xy[0], xy[1], z) {}
inline constexpr /*implicit*/ Vector3(const Vector2<T>& xy, T z): Vector<3, T>(xy[0], xy[1], z) {}
/** @brief Copy constructor */
inline constexpr Vector3(const RectangularMatrix<1, 3, T>& other): Vector<3, T>(other) {}
inline T& x() { return (*this)[0]; } /**< @brief X component */
inline constexpr T x() const { return (*this)[0]; } /**< @overload */

12
src/Math/Vector4.h

@ -35,14 +35,11 @@ homogeneous three-dimensional coordinates.
template<class T> class Vector4: public Vector<4, T> {
public:
/** @copydoc Vector::Vector() */
inline constexpr Vector4() {}
inline constexpr /*implicit*/ Vector4() {}
/** @copydoc Vector::Vector(T) */
inline constexpr explicit Vector4(T value): Vector<4, T>(value, value, value, value) {}
/** @brief Copy constructor */
inline constexpr Vector4(const RectangularMatrix<1, 4, T>& other): Vector<4, T>(other) {}
/**
* @brief Constructor
* @param x X component
@ -50,14 +47,17 @@ template<class T> class Vector4: public Vector<4, T> {
* @param z Z component
* @param w W component
*/
inline constexpr Vector4(T x, T y, T z, T w): Vector<4, T>(x, y, z, w) {}
inline constexpr /*implicit*/ Vector4(T x, T y, T z, T w): Vector<4, T>(x, y, z, w) {}
/**
* @brief Constructor
* @param xyz Three-component vector
* @param w W component
*/
inline constexpr Vector4(const Vector3<T>& xyz, T w): Vector<4, T>(xyz[0], xyz[1], xyz[2], w) {}
inline constexpr /*implicit*/ Vector4(const Vector3<T>& xyz, T w): Vector<4, T>(xyz[0], xyz[1], xyz[2], w) {}
/** @brief Copy constructor */
inline constexpr Vector4(const RectangularMatrix<1, 4, T>& other): Vector<4, T>(other) {}
inline T& x() { return (*this)[0]; } /**< @brief X component */
inline constexpr T x() const { return (*this)[0]; } /**< @overload */

2
src/Mesh.h

@ -365,7 +365,7 @@ class MAGNUM_EXPORT Mesh {
* @see setPrimitive(), setVertexCount(), @fn_gl{GenVertexArrays} (if
* @extension{APPLE,vertex_array_object} is available)
*/
inline Mesh(Primitive primitive = Primitive::Triangles): _primitive(primitive), _vertexCount(0) {
inline explicit Mesh(Primitive primitive = Primitive::Triangles): _primitive(primitive), _vertexCount(0) {
(this->*createImplementation)();
}

2
src/Physics/AbstractShape.h

@ -93,7 +93,7 @@ template<std::uint8_t dimensions> class MAGNUM_PHYSICS_EXPORT AbstractShape {
typedef typename Implementation::ShapeDimensionTraits<dimensions>::Type Type;
#endif
/** @brief Destructor */
explicit AbstractShape() = default;
virtual inline ~AbstractShape() {}
/** @brief Shape type */

2
src/Physics/AxisAlignedBox.h

@ -34,7 +34,7 @@ namespace Magnum { namespace Physics {
template<std::uint8_t dimensions> class MAGNUM_PHYSICS_EXPORT AxisAlignedBox: public AbstractShape<dimensions> {
public:
/** @brief Constructor */
inline AxisAlignedBox(const typename DimensionTraits<dimensions>::VectorType& position, const typename DimensionTraits<dimensions>::VectorType& size): _position(position), _transformedPosition(position), _size(size), _transformedSize(size) {}
inline explicit AxisAlignedBox(const typename DimensionTraits<dimensions>::VectorType& position, const typename DimensionTraits<dimensions>::VectorType& size): _position(position), _transformedPosition(position), _size(size), _transformedSize(size) {}
inline typename AbstractShape<dimensions>::Type type() const override {
return AbstractShape<dimensions>::Type::AxisAlignedBox;

2
src/Physics/Box.h

@ -36,7 +36,7 @@ namespace Magnum { namespace Physics {
template<std::uint8_t dimensions> class MAGNUM_PHYSICS_EXPORT Box: public AbstractShape<dimensions> {
public:
/** @brief Constructor */
inline Box(const typename DimensionTraits<dimensions>::MatrixType& transformation): _transformation(transformation), _transformedTransformation(transformation) {}
inline explicit Box(const typename DimensionTraits<dimensions>::MatrixType& transformation): _transformation(transformation), _transformedTransformation(transformation) {}
inline typename AbstractShape<dimensions>::Type type() const override {
return AbstractShape<dimensions>::Type::Box;

2
src/Physics/Capsule.h

@ -37,7 +37,7 @@ applying transformation, the scale factor is averaged from all axes.
template<std::uint8_t dimensions> class MAGNUM_PHYSICS_EXPORT Capsule: public AbstractShape<dimensions> {
public:
/** @brief Constructor */
inline Capsule(const typename DimensionTraits<dimensions>::VectorType& a, const typename DimensionTraits<dimensions>::VectorType& b, float radius): _a(a), _transformedA(a), _b(b), _transformedB(b), _radius(radius), _transformedRadius(radius) {}
inline explicit Capsule(const typename DimensionTraits<dimensions>::VectorType& a, const typename DimensionTraits<dimensions>::VectorType& b, float radius): _a(a), _transformedA(a), _b(b), _transformedB(b), _radius(radius), _transformedRadius(radius) {}
inline typename AbstractShape<dimensions>::Type type() const override {
return AbstractShape<dimensions>::Type::Capsule;

2
src/Physics/DebugDrawResourceManager.h

@ -104,7 +104,7 @@ class MAGNUM_PHYSICS_EXPORT DebugDrawResourceManager: public ResourceManager<Abs
*/
template<std::uint8_t dimensions> static SceneGraph::Drawable<dimensions>* createDebugRenderer(ObjectShape<dimensions>* shape, ResourceKey options = ResourceKey());
DebugDrawResourceManager();
explicit DebugDrawResourceManager();
~DebugDrawResourceManager();
private:

2
src/Physics/Line.h

@ -35,7 +35,7 @@ namespace Magnum { namespace Physics {
template<std::uint8_t dimensions> class MAGNUM_PHYSICS_EXPORT Line: public AbstractShape<dimensions> {
public:
/** @brief Constructor */
inline Line(const typename DimensionTraits<dimensions>::VectorType& a, const typename DimensionTraits<dimensions>::VectorType& b): _a(a), _transformedA(a), _b(b), _transformedB(b) {}
inline explicit Line(const typename DimensionTraits<dimensions>::VectorType& a, const typename DimensionTraits<dimensions>::VectorType& b): _a(a), _transformedA(a), _b(b), _transformedB(b) {}
inline typename AbstractShape<dimensions>::Type type() const override {
return AbstractShape<dimensions>::Type::Line;

2
src/Physics/LineSegment.h

@ -31,7 +31,7 @@ namespace Magnum { namespace Physics {
template<std::uint8_t dimensions> class LineSegment: public Line<dimensions> {
public:
/** @brief Constructor */
inline LineSegment(const typename DimensionTraits<dimensions>::VectorType& a, const typename DimensionTraits<dimensions>::VectorType& b): Line<dimensions>(a, b) {}
inline explicit LineSegment(const typename DimensionTraits<dimensions>::VectorType& a, const typename DimensionTraits<dimensions>::VectorType& b): Line<dimensions>(a, b) {}
inline typename AbstractShape<dimensions>::Type type() const override {
return AbstractShape<dimensions>::Type::LineSegment;

2
src/Physics/ObjectShape.h

@ -42,7 +42,7 @@ template<std::uint8_t dimensions> class MAGNUM_PHYSICS_EXPORT ObjectShape: publi
* Creates empty object shape.
* @see setShape()
*/
ObjectShape(SceneGraph::AbstractObject<dimensions>* object, ObjectShapeGroup<dimensions>* group = nullptr);
explicit ObjectShape(SceneGraph::AbstractObject<dimensions>* object, ObjectShapeGroup<dimensions>* group = nullptr);
/**
* @brief Destructor

2
src/Physics/ObjectShapeGroup.h

@ -43,7 +43,7 @@ template<std::uint8_t dimensions> class MAGNUM_PHYSICS_EXPORT ObjectShapeGroup:
*
* Marks the group as dirty.
*/
inline ObjectShapeGroup(): dirty(true) {}
inline explicit ObjectShapeGroup(): dirty(true) {}
/**
* @brief Whether the group is dirty

2
src/Physics/Plane.h

@ -31,7 +31,7 @@ namespace Magnum { namespace Physics {
class MAGNUM_PHYSICS_EXPORT Plane: public AbstractShape<3> {
public:
/** @brief Constructor */
inline Plane(const Vector3& position, const Vector3& normal): _position(position), _transformedPosition(position), _normal(normal), _transformedNormal(normal) {}
inline explicit Plane(const Vector3& position, const Vector3& normal): _position(position), _transformedPosition(position), _normal(normal), _transformedNormal(normal) {}
inline Type type() const override { return Type::Plane; }

2
src/Physics/Point.h

@ -34,7 +34,7 @@ namespace Magnum { namespace Physics {
template<std::uint8_t dimensions> class MAGNUM_PHYSICS_EXPORT Point: public AbstractShape<dimensions> {
public:
/** @brief Constructor */
inline Point(const typename DimensionTraits<dimensions>::VectorType& position): _position(position), _transformedPosition(position) {}
inline explicit Point(const typename DimensionTraits<dimensions>::VectorType& position): _position(position), _transformedPosition(position) {}
inline typename AbstractShape<dimensions>::Type type() const override {
return AbstractShape<dimensions>::Type::Point;

2
src/Physics/ShapeGroup.h

@ -91,7 +91,7 @@ template<std::uint8_t dimensions> class MAGNUM_PHYSICS_EXPORT ShapeGroup: public
public:
/** @brief Default constructor */
inline ShapeGroup(): operation(Implementation::GroupOperation::AlwaysFalse), a(nullptr), b(nullptr) {}
inline explicit ShapeGroup(): operation(Implementation::GroupOperation::AlwaysFalse), a(nullptr), b(nullptr) {}
/** @brief Move constructor */
ShapeGroup(ShapeGroup&& other);

2
src/Physics/Sphere.h

@ -37,7 +37,7 @@ applying transformation, the scale factor is averaged from all axes.
template<std::uint8_t dimensions> class MAGNUM_PHYSICS_EXPORT Sphere: public AbstractShape<dimensions> {
public:
/** @brief Constructor */
inline Sphere(const typename DimensionTraits<dimensions>::VectorType& position, float radius): _position(position), _transformedPosition(position), _radius(radius), _transformedRadius(radius) {}
inline explicit Sphere(const typename DimensionTraits<dimensions>::VectorType& position, float radius): _position(position), _transformedPosition(position), _radius(radius), _transformedRadius(radius) {}
inline typename AbstractShape<dimensions>::Type type() const override {
return AbstractShape<dimensions>::Type::Sphere;

2
src/Platform/AbstractContextHandler.h

@ -33,6 +33,8 @@ template<class Display, class VisualId, class Window> class AbstractContextHandl
*/
virtual VisualId getVisualId(Display nativeDisplay) = 0;
explicit AbstractContextHandler() = default;
/**
* @brief Destructor
*

2
src/Platform/AbstractXApplication.h

@ -57,7 +57,7 @@ class AbstractXApplication {
*
* Creates window with double-buffered OpenGL ES 2 context.
*/
AbstractXApplication(AbstractContextHandler<Display*, VisualID, Window>* contextHandler, int& argc, char** argv, const std::string& title = "Magnum X application", const Vector2i& size = Vector2i(800, 600));
explicit AbstractXApplication(AbstractContextHandler<Display*, VisualID, Window>* contextHandler, int& argc, char** argv, const std::string& title = "Magnum X application", const Vector2i& size = Vector2i(800, 600));
/**
* @brief Destructor

1
src/Platform/EglContextHandler.h

@ -51,6 +51,7 @@ Used in XEglApplication.
*/
class EglContextHandler: public AbstractContextHandler<EGLNativeDisplayType, VisualId, EGLNativeWindowType> {
public:
explicit EglContextHandler() = default;
~EglContextHandler();
VisualId getVisualId(EGLNativeDisplayType nativeDisplay) override;

2
src/Platform/GlutApplication.h

@ -60,7 +60,7 @@ class GlutApplication {
* @param title Window title
* @param size Window size
*/
GlutApplication(int& argc, char** argv, const std::string& title = "Magnum GLUT application", const Vector2i& size = Vector2i(800, 600));
explicit GlutApplication(int& argc, char** argv, const std::string& title = "Magnum GLUT application", const Vector2i& size = Vector2i(800, 600));
virtual ~GlutApplication();

2
src/Platform/GlxApplication.h

@ -51,7 +51,7 @@ class GlxApplication: public AbstractXApplication {
* @param title Window title
* @param size Window 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) {}
inline explicit 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) {}
};
}}

1
src/Platform/GlxContextHandler.h

@ -39,6 +39,7 @@ GlxApplication.
*/
class GlxContextHandler: public AbstractContextHandler<Display*, VisualID, Window> {
public:
explicit GlxContextHandler() = default;
~GlxContextHandler();
VisualID getVisualId(Display* nativeDisplay) override;

2
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 Vector2i& size = Vector2i(800, 600));
explicit Sdl2Application(int argc, char** argv, const std::string& title = "Magnum SDL2 application", const Vector2i& size = Vector2i(800, 600));
/**
* @brief Destructor

2
src/Platform/WindowlessGlxApplication.h

@ -55,7 +55,7 @@ class WindowlessGlxApplication {
* Creates window with double-buffered OpenGL 3.2 core context or
* OpenGL ES 2.0 context, if targetting OpenGL ES.
*/
WindowlessGlxApplication(int& argc, char** argv);
explicit WindowlessGlxApplication(int& argc, char** argv);
~WindowlessGlxApplication();

2
src/Platform/XEglApplication.h

@ -51,7 +51,7 @@ class XEglApplication: public AbstractXApplication {
* @param title Window title
* @param size Window 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) {}
inline explicit 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) {}
};
}}

2
src/Primitives/Capsule.h

@ -53,7 +53,7 @@ class Capsule: public Trade::MeshData3D {
* If texture coordinates are generated, vertices of one segment are
* duplicated for texture wrapping.
*/
Capsule(std::uint32_t hemisphereRings, std::uint32_t cylinderRings, std::uint32_t segments, GLfloat length, TextureCoords textureCoords = TextureCoords::DontGenerate);
explicit Capsule(std::uint32_t hemisphereRings, std::uint32_t cylinderRings, std::uint32_t segments, GLfloat length, TextureCoords textureCoords = TextureCoords::DontGenerate);
private:
Capsule(std::uint32_t segments, TextureCoords textureCoords);

2
src/Primitives/Cube.h

@ -31,7 +31,7 @@ namespace Magnum { namespace Primitives {
class Cube: public Trade::MeshData3D {
public:
/** @brief Constructor */
Cube();
explicit Cube();
};
}}

2
src/Primitives/Cylinder.h

@ -58,7 +58,7 @@ class Cylinder: public Capsule {
* If texture coordinates are generated, vertices of one segment are
* duplicated for texture wrapping.
*/
Cylinder(std::uint32_t rings, std::uint32_t segments, GLfloat length, Flags flags = Flags());
explicit Cylinder(std::uint32_t rings, std::uint32_t segments, GLfloat length, Flags flags = Flags());
private:
void capVertexRing(GLfloat y, GLfloat textureCoordsV, const Vector3& normal);

4
src/Primitives/Icosphere.h

@ -38,7 +38,7 @@ from Blender.
template<> class Icosphere<0>: public Trade::MeshData3D {
public:
/** @brief Constructor */
Icosphere();
explicit Icosphere();
};
/**
@ -54,7 +54,7 @@ template<std::size_t subdivisions> class Icosphere {
#endif
public:
/** @brief Constructor */
Icosphere() {
explicit Icosphere() {
for(std::size_t i = 0; i != subdivisions; ++i)
MeshTools::subdivide(*indices(), *normals(0), [](const Vector3& a, const Vector3& b) {
return (a+b).normalized();

2
src/Primitives/Plane.h

@ -31,7 +31,7 @@ namespace Magnum { namespace Primitives {
class Plane: public Trade::MeshData3D {
public:
/** @brief Constructor */
Plane();
explicit Plane();
};
}}

2
src/Primitives/Square.h

@ -31,7 +31,7 @@ namespace Magnum { namespace Primitives {
class Square: public Trade::MeshData2D {
public:
/** @brief Constructor */
Square();
explicit Square();
};
}}

2
src/Primitives/UVSphere.h

@ -39,7 +39,7 @@ class UVSphere: public Capsule {
* If texture coordinates are generated, vertices of one segment are
* duplicated for texture wrapping.
*/
UVSphere(std::uint32_t rings, std::uint32_t segments, TextureCoords textureCoords = TextureCoords::DontGenerate);
explicit UVSphere(std::uint32_t rings, std::uint32_t segments, TextureCoords textureCoords = TextureCoords::DontGenerate);
};
}}

2
src/Profiler.h

@ -105,7 +105,7 @@ class MAGNUM_EXPORT Profiler {
static const Section otherSection = 0;
#ifndef DOXYGEN_GENERATING_OUTPUT
Profiler(): enabled(false), measureDuration(60), currentFrame(0), frameCount(0), sections{"Other"}, currentSection(otherSection) {}
explicit Profiler(): enabled(false), measureDuration(60), currentFrame(0), frameCount(0), sections{"Other"}, currentSection(otherSection) {}
#endif
/**

8
src/Query.h

@ -40,7 +40,7 @@ class MAGNUM_EXPORT AbstractQuery {
* Generates one OpenGL query.
* @see @fn_gl{GenQueries}
*/
inline AbstractQuery() {
inline explicit AbstractQuery() {
/** @todo Get some extension wrangler instead to avoid undeclared glGenQueries() on ES2 */
#ifndef MAGNUM_TARGET_GLES2
glGenQueries(1, &_id);
@ -153,7 +153,7 @@ class MAGNUM_EXPORT Query: public AbstractQuery {
#endif
};
inline Query(): target(nullptr) {}
inline explicit Query(): target(nullptr) {}
inline ~Query() { delete target; }
@ -284,7 +284,7 @@ class MAGNUM_EXPORT SampleQuery: public AbstractQuery {
};
#endif
inline SampleQuery(): target(nullptr) {}
inline explicit SampleQuery(): target(nullptr) {}
inline ~SampleQuery() { delete target; }
@ -358,6 +358,8 @@ Using this query results in fewer OpenGL calls when doing more measures.
*/
class TimeQuery: public AbstractQuery {
public:
explicit TimeQuery() = default;
/**
* @brief Query timestamp
*

2
src/Renderbuffer.h

@ -512,7 +512,7 @@ class Renderbuffer {
* Generates new OpenGL renderbuffer.
* @see @fn_gl{GenRenderbuffers}
*/
inline Renderbuffer() {
inline explicit Renderbuffer() {
glGenRenderbuffers(1, &renderbuffer);
}

2
src/Resource.h

@ -120,7 +120,7 @@ class Resource {
* Creates empty resource. Resources are acquired from the manager by
* calling ResourceManager::get().
*/
inline Resource(): manager(nullptr), lastCheck(0), _state(ResourceState::Final), data(nullptr) {}
inline explicit Resource(): manager(nullptr), lastCheck(0), _state(ResourceState::Final), data(nullptr) {}
/** @brief Copy constructor */
inline Resource(const Resource<T, U>& other): manager(other.manager), _key(other._key), lastCheck(other.lastCheck), _state(other._state), data(other.data) {

2
src/SceneGraph/AbstractCamera.h

@ -75,7 +75,7 @@ class MAGNUM_SCENEGRAPH_EXPORT AbstractCamera: public AbstractFeature<dimensions
* @brief Constructor
* @param object Object holding the camera
*/
inline AbstractCamera(AbstractObject<dimensions, T>* object): AbstractFeature<dimensions, T>(object), _aspectRatioPolicy(AspectRatioPolicy::NotPreserved) {
inline explicit AbstractCamera(AbstractObject<dimensions, T>* object): AbstractFeature<dimensions, T>(object), _aspectRatioPolicy(AspectRatioPolicy::NotPreserved) {
AbstractFeature<dimensions, T>::setCachedTransformations(AbstractFeature<dimensions, T>::CachedTransformation::InvertedAbsolute);
}

2
src/SceneGraph/AbstractFeature.h

@ -132,7 +132,7 @@ template<std::uint8_t dimensions, class T = GLfloat> class AbstractFeature
* @brief Constructor
* @param object %Object holding this feature
*/
inline AbstractFeature(AbstractObject<dimensions, T>* object) {
inline explicit AbstractFeature(AbstractObject<dimensions, T>* object) {
object->Corrade::Containers::LinkedList<AbstractFeature<dimensions, T>>::insert(this);
}

2
src/SceneGraph/AbstractGroupedFeature.h

@ -64,7 +64,7 @@ class AbstractGroupedFeature: public AbstractFeature<dimensions, T> {
* Adds the feature to the object and to group, if specified.
* @see FeatureGroup::add()
*/
inline AbstractGroupedFeature(AbstractObject<dimensions, T>* object, FeatureGroup<dimensions, Derived, T>* group = nullptr): AbstractFeature<dimensions, T>(object), _group(nullptr) {
inline explicit AbstractGroupedFeature(AbstractObject<dimensions, T>* object, FeatureGroup<dimensions, Derived, T>* group = nullptr): AbstractFeature<dimensions, T>(object), _group(nullptr) {
if(group) group->add(static_cast<Derived*>(this));
}

1
src/SceneGraph/AbstractObject.h

@ -59,6 +59,7 @@ template<std::uint8_t dimensions, class T = GLfloat> class AbstractObject
/** @brief Feature object type */
typedef AbstractFeature<dimensions, T> FeatureType;
explicit AbstractObject() = default;
inline virtual ~AbstractObject() {}
/** @brief Whether this object has features */

1
src/SceneGraph/AbstractTransformation.h

@ -54,6 +54,7 @@ class AbstractTransformation {
/** @brief Dimension count */
static const std::uint8_t Dimensions = dimensions;
explicit AbstractTransformation() = default;
virtual ~AbstractTransformation() = 0;
#ifdef DOXYGEN_GENERATING_OUTPUT

2
src/SceneGraph/AbstractTranslationRotation2D.h

@ -35,6 +35,8 @@ template<class T = GLfloat>
#endif
class AbstractTranslationRotation2D: public AbstractTransformation<2, T> {
public:
explicit AbstractTranslationRotation2D() = default;
/**
* @brief Translate object
* @param vector Translation vector

2
src/SceneGraph/AbstractTranslationRotation3D.h

@ -36,6 +36,8 @@ template<class T = GLfloat>
#endif
class AbstractTranslationRotation3D: public AbstractTransformation<3, T> {
public:
explicit AbstractTranslationRotation3D() = default;
/**
* @brief Translate object
* @param vector Translation vector

2
src/SceneGraph/AbstractTranslationRotationScaling2D.h

@ -35,6 +35,8 @@ template<class T = GLfloat>
#endif
class AbstractTranslationRotationScaling2D: public AbstractTranslationRotation2D<T> {
public:
explicit AbstractTranslationRotationScaling2D() = default;
/**
* @brief Scale object
* @param vector Scaling vector

2
src/SceneGraph/AbstractTranslationRotationScaling3D.h

@ -35,6 +35,8 @@ template<class T = GLfloat>
#endif
class AbstractTranslationRotationScaling3D: public AbstractTranslationRotation3D<T> {
public:
explicit AbstractTranslationRotationScaling3D() = default;
/**
* @brief Scale object
* @param vector Scaling vector

2
src/SceneGraph/Animable.h

@ -148,7 +148,7 @@ class MAGNUM_SCENEGRAPH_EXPORT Animable: public AbstractGroupedFeature<dimension
* adds the feature to the object and also to group, if specified.
* @see setRepeated(), AnimableGroup::add()
*/
Animable(AbstractObject<dimensions, T>* object, GLfloat duration, AnimableGroup<dimensions, T>* group = nullptr);
explicit Animable(AbstractObject<dimensions, T>* object, GLfloat duration, AnimableGroup<dimensions, T>* group = nullptr);
/** @brief Animation duration */
inline GLfloat duration() const { return _duration; }

2
src/SceneGraph/AnimableGroup.h

@ -43,7 +43,7 @@ class MAGNUM_SCENEGRAPH_EXPORT AnimableGroup: public FeatureGroup<dimensions, An
/**
* @brief Constructor
*/
inline AnimableGroup(): _runningCount(0), wakeUp(false) {}
inline explicit AnimableGroup(): _runningCount(0), wakeUp(false) {}
/**
* @brief Count of running animations

2
src/SceneGraph/Camera2D.h

@ -59,7 +59,7 @@ class MAGNUM_SCENEGRAPH_EXPORT Camera2D: public AbstractCamera<2, T> {
* Sets orthographic projection to the default OpenGL cube (range @f$ [-1; 1] @f$ in all directions).
* @see setOrthographic()
*/
inline Camera2D(AbstractObject<2, T>* object): AbstractCamera<2, T>(object) {}
inline explicit Camera2D(AbstractObject<2, T>* object): AbstractCamera<2, T>(object) {}
/**
* @brief Set projection

2
src/SceneGraph/Camera3D.h

@ -65,7 +65,7 @@ class MAGNUM_SCENEGRAPH_EXPORT Camera3D: public AbstractCamera<3, T> {
* (range @f$ [-1; 1] @f$ in all directions).
* @see setOrthographic(), setPerspective()
*/
inline Camera3D(AbstractObject<3, T>* object): AbstractCamera<3, T>(object), _near(0.0f), _far(0.0f) {}
inline explicit Camera3D(AbstractObject<3, T>* object): AbstractCamera<3, T>(object), _near(0.0f), _far(0.0f) {}
/**
* @brief Set orthographic projection

2
src/SceneGraph/Drawable.h

@ -115,7 +115,7 @@ template<std::uint8_t dimensions, class T = GLfloat>
class Drawable: public AbstractGroupedFeature<dimensions, Drawable<dimensions, T>, T> {
public:
/** @copydoc AbstractGroupedFeature::AbstractGroupedFeature() */
inline Drawable(AbstractObject<dimensions, T>* object, DrawableGroup<dimensions, T>* group = nullptr): AbstractGroupedFeature<dimensions, Drawable<dimensions, T>, T>(object, group) {}
inline explicit Drawable(AbstractObject<dimensions, T>* object, DrawableGroup<dimensions, T>* group = nullptr): AbstractGroupedFeature<dimensions, Drawable<dimensions, T>, T>(object, group) {}
/**
* @brief Draw the object using given camera

2
src/SceneGraph/FeatureGroup.h

@ -42,6 +42,8 @@ class FeatureGroup {
friend class AbstractGroupedFeature<dimensions, Feature, T>;
public:
explicit FeatureGroup() = default;
/**
* @brief Destructor
*

2
src/SceneGraph/MatrixTransformation2D.h

@ -131,7 +131,7 @@ class MatrixTransformation2D: public AbstractTranslationRotationScaling2D<T> {
protected:
/* Allow construction only from Object */
inline MatrixTransformation2D() {}
inline explicit MatrixTransformation2D() = default;
private:
Math::Matrix3<T> _transformation;

2
src/SceneGraph/MatrixTransformation3D.h

@ -162,7 +162,7 @@ class MatrixTransformation3D: public AbstractTranslationRotationScaling3D<T> {
protected:
/* Allow construction only from Object */
inline MatrixTransformation3D() {}
inline explicit MatrixTransformation3D() = default;
private:
Math::Matrix4<T> _transformation;

2
src/SceneGraph/Object.h

@ -105,7 +105,7 @@ template<class Transformation> class Object: public AbstractObject<Transformatio
* @brief Constructor
* @param parent Parent object
*/
inline Object(Object<Transformation>* parent = nullptr): counter(0xFFFFu), flags(Flag::Dirty) {
inline explicit Object(Object<Transformation>* parent = nullptr): counter(0xFFFFu), flags(Flag::Dirty) {
setParent(parent);
}

2
src/SceneGraph/Scene.h

@ -31,6 +31,8 @@ See @ref scenegraph for introduction.
*/
template<class Transformation> class Scene: public Object<Transformation> {
public:
explicit Scene() = default;
inline bool isScene() const { return true; }
};

2
src/Shader.h

@ -135,7 +135,7 @@ class MAGNUM_EXPORT Shader {
* beginning. Sources can be added with addSource() or addFile().
* @see fromData(), fromFile(), @fn_gl{CreateShader}
*/
Shader(Version version, Type type);
explicit Shader(Version version, Type type);
/**
* @brief Destructor

2
src/Shaders/FlatShader.h

@ -40,7 +40,7 @@ template<std::uint8_t dimensions> class MAGNUM_SHADERS_EXPORT FlatShader: public
/** @brief Vertex position */
typedef Attribute<0, typename DimensionTraits<dimensions>::PointType> Position;
FlatShader();
explicit FlatShader();
/**
* @brief Set transformation and projection matrix

2
src/Shaders/PhongShader.h

@ -38,7 +38,7 @@ class MAGNUM_SHADERS_EXPORT PhongShader: public AbstractShaderProgram {
typedef Attribute<0, Point3D> Position; /**< @brief Vertex position */
typedef Attribute<1, Vector3> Normal; /**< @brief Normal direction */
PhongShader();
explicit PhongShader();
/**
* @brief Set ambient color

2
src/Shaders/VertexColorShader.h

@ -43,7 +43,7 @@ template<std::uint8_t dimensions> class MAGNUM_SHADERS_EXPORT VertexColorShader:
/** @brief Vertex color */
typedef Attribute<1, Color3<>> Color;
VertexColorShader();
explicit VertexColorShader();
/**
* @brief Set transformation and projection matrix

2
src/SizeTraits.h

@ -113,7 +113,7 @@ template<class Base> struct SizeBasedCall: public Base {
* @brief Constructor
* @param size Data size
*/
SizeBasedCall(std::size_t size): size(size) {}
explicit SizeBasedCall(std::size_t size): size(size) {}
/**
* @brief Functor

2
src/Texture.h

@ -169,7 +169,7 @@ template<std::uint8_t dimensions> class Texture: public AbstractTexture {
*
* Creates one OpenGL texture.
*/
inline Texture(Target target = DataHelper<Dimensions>::target()): AbstractTexture(static_cast<GLenum>(target)) {}
inline explicit Texture(Target target = DataHelper<Dimensions>::target()): AbstractTexture(static_cast<GLenum>(target)) {}
/** @brief %Texture target */
inline constexpr Target target() const { return static_cast<Target>(_target); }

2
src/Timeline.h

@ -78,7 +78,7 @@ class MAGNUM_EXPORT Timeline {
* Creates stopped timeline.
* @see start()
*/
inline constexpr Timeline(): _minimalFrameTime(0), _previousFrameDuration(0), running(false) {}
inline constexpr explicit Timeline(): _minimalFrameTime(0), _previousFrameDuration(0), running(false) {}
/** @brief Minimal frame time (in seconds) */
inline constexpr GLfloat minimalFrameTime() const {

2
src/Trade/AbstractImporter.h

@ -75,7 +75,7 @@ class MAGNUM_EXPORT AbstractImporter: public Corrade::PluginManager::Plugin {
typedef Corrade::Containers::EnumSet<Feature, int> Features;
/** @brief Constructor */
inline AbstractImporter(Corrade::PluginManager::AbstractPluginManager* manager = nullptr, const std::string& plugin = ""): Plugin(manager, plugin) {}
inline explicit AbstractImporter(Corrade::PluginManager::AbstractPluginManager* manager = nullptr, const std::string& plugin = ""): Plugin(manager, plugin) {}
/** @brief Features supported by this importer */
virtual Features features() const = 0;

Loading…
Cancel
Save