Browse Source

Shaders: explicitly list deleted/defaulted copy/move constructor.

Two reasons:

 * documentation
 * making it actually work because the rules are so complex and ever
   changing that a thing I thought "just worked" in fact did not work at
   all

The Vector tests now compile again.
pull/255/head
Vladimír Vondruš 8 years ago
parent
commit
f7122d3ce6
  1. 12
      src/Magnum/Shaders/AbstractVector.h
  2. 12
      src/Magnum/Shaders/DistanceFieldVector.h
  3. 12
      src/Magnum/Shaders/Flat.h
  4. 12
      src/Magnum/Shaders/MeshVisualizer.h
  5. 12
      src/Magnum/Shaders/Phong.h
  6. 18
      src/Magnum/Shaders/Vector.h
  7. 12
      src/Magnum/Shaders/VertexColor.h

12
src/Magnum/Shaders/AbstractVector.h

@ -57,6 +57,18 @@ template<UnsignedInt dimensions> class AbstractVector: public GL::AbstractShader
*/
typedef typename Generic<dimensions>::TextureCoordinates TextureCoordinates;
/** @brief Copying is not allowed */
AbstractVector(const AbstractVector<dimensions>&) = delete;
/** @brief Move constructor */
AbstractVector(AbstractVector<dimensions>&&) noexcept = default;
/** @brief Copying is not allowed */
AbstractVector<dimensions>& operator=(const AbstractVector<dimensions>&) = delete;
/** @brief Move assignment */
AbstractVector<dimensions>& operator=(AbstractVector<dimensions>&&) noexcept = default;
/**
* @brief Bind vector texture
* @return Reference to self (for method chaining)

12
src/Magnum/Shaders/DistanceFieldVector.h

@ -87,6 +87,18 @@ template<UnsignedInt dimensions> class MAGNUM_SHADERS_EXPORT DistanceFieldVector
#endif
{}
/** @brief Copying is not allowed */
DistanceFieldVector(const DistanceFieldVector<dimensions>&) = delete;
/** @brief Move constructor */
DistanceFieldVector(DistanceFieldVector<dimensions>&&) noexcept = default;
/** @brief Copying is not allowed */
DistanceFieldVector<dimensions>& operator=(const DistanceFieldVector<dimensions>&) = delete;
/** @brief Move assignment */
DistanceFieldVector<dimensions>& operator=(DistanceFieldVector<dimensions>&&) noexcept = default;
/**
* @brief Set transformation and projection matrix
* @return Reference to self (for method chaining)

12
src/Magnum/Shaders/Flat.h

@ -142,6 +142,18 @@ template<UnsignedInt dimensions> class MAGNUM_SHADERS_EXPORT Flat: public GL::Ab
*/
explicit Flat(NoCreateT) noexcept: GL::AbstractShaderProgram{NoCreate} {}
/** @brief Copying is not allowed */
Flat(const Flat<dimensions>&) = delete;
/** @brief Move constructor */
Flat(Flat<dimensions>&&) noexcept = default;
/** @brief Copying is not allowed */
Flat<dimensions>& operator=(const Flat<dimensions>&) = delete;
/** @brief Move assignment */
Flat<dimensions>& operator=(Flat<dimensions>&&) noexcept = default;
/** @brief Flags */
Flags flags() const { return _flags; }

12
src/Magnum/Shaders/MeshVisualizer.h

@ -170,6 +170,18 @@ class MAGNUM_SHADERS_EXPORT MeshVisualizer: public GL::AbstractShaderProgram {
*/
explicit MeshVisualizer(NoCreateT) noexcept: GL::AbstractShaderProgram{NoCreate} {}
/** @brief Copying is not allowed */
MeshVisualizer(const MeshVisualizer&) = delete;
/** @brief Move constructor */
MeshVisualizer(MeshVisualizer&&) noexcept = default;
/** @brief Copying is not allowed */
MeshVisualizer& operator=(const MeshVisualizer&) = delete;
/** @brief Move assignment */
MeshVisualizer& operator=(MeshVisualizer&&) noexcept = default;
/**
* @brief Set transformation and projection matrix
* @return Reference to self (for method chaining)

12
src/Magnum/Shaders/Phong.h

@ -149,6 +149,18 @@ class MAGNUM_SHADERS_EXPORT Phong: public GL::AbstractShaderProgram {
*/
explicit Phong(NoCreateT) noexcept: GL::AbstractShaderProgram{NoCreate} {}
/** @brief Copying is not allowed */
Phong(const Phong&) = delete;
/** @brief Move constructor */
Phong(Phong&&) noexcept = default;
/** @brief Copying is not allowed */
Phong& operator=(const Phong&) = delete;
/** @brief Move assignment */
Phong& operator=(Phong&&) noexcept = default;
/** @brief Flags */
Flags flags() const { return _flags; }

18
src/Magnum/Shaders/Vector.h

@ -84,11 +84,23 @@ template<UnsignedInt dimensions> class MAGNUM_SHADERS_EXPORT Vector: public Abst
#endif
{}
/** @brief Copying is not allowed */
Vector(const Vector<dimensions>&) = delete;
/** @brief Move constructor */
Vector(Vector<dimensions>&&) noexcept = default;
/** @brief Copying is not allowed */
Vector<dimensions>& operator=(const Vector<dimensions>&) = delete;
/** @brief Move assignment */
Vector<dimensions>& operator=(Vector<dimensions>&&) noexcept = default;
/**
* @brief Set transformation and projection matrix
* @return Reference to self (for method chaining)
*/
Vector& setTransformationProjectionMatrix(const MatrixTypeFor<dimensions, Float>& matrix) {
Vector<dimensions>& setTransformationProjectionMatrix(const MatrixTypeFor<dimensions, Float>& matrix) {
GL::AbstractShaderProgram::setUniform(_transformationProjectionMatrixUniform, matrix);
return *this;
}
@ -100,7 +112,7 @@ template<UnsignedInt dimensions> class MAGNUM_SHADERS_EXPORT Vector: public Abst
* Default is transparent black.
* @see @ref setColor()
*/
Vector& setBackgroundColor(const Color4& color) {
Vector<dimensions>& setBackgroundColor(const Color4& color) {
GL::AbstractShaderProgram::setUniform(_backgroundColorUniform, color);
return *this;
}
@ -111,7 +123,7 @@ template<UnsignedInt dimensions> class MAGNUM_SHADERS_EXPORT Vector: public Abst
*
* @see @ref setBackgroundColor()
*/
Vector& setColor(const Color4& color) {
Vector<dimensions>& setColor(const Color4& color) {
GL::AbstractShaderProgram::setUniform(_colorUniform, color);
return *this;
}

12
src/Magnum/Shaders/VertexColor.h

@ -96,6 +96,18 @@ template<UnsignedInt dimensions> class MAGNUM_SHADERS_EXPORT VertexColor: public
*/
explicit VertexColor(NoCreateT) noexcept: AbstractShaderProgram{NoCreate} {}
/** @brief Copying is not allowed */
VertexColor(const VertexColor<dimensions>&) = delete;
/** @brief Move constructor */
VertexColor(VertexColor<dimensions>&&) noexcept = default;
/** @brief Copying is not allowed */
VertexColor<dimensions>& operator=(const VertexColor<dimensions>&) = delete;
/** @brief Move assignment */
VertexColor<dimensions>& operator=(VertexColor<dimensions>&&) noexcept = default;
/**
* @brief Set transformation and projection matrix
* @return Reference to self (for method chaining)

Loading…
Cancel
Save