Browse Source

Have first letter of static constants uppercase, like previously.

Lowecase didn't prove to be better, because Doxygen cannot implicitly
link to it and it collides with non-type template parameters and private
variables.
vectorfields
Vladimír Vondruš 14 years ago
parent
commit
4aec678539
  1. 8
      src/Math/Matrix.h
  2. 20
      src/Math/RectangularMatrix.h
  3. 12
      src/Math/Vector.h
  4. 8
      src/MeshTools/Clean.h
  5. 2
      src/MeshTools/Test/CleanTest.h
  6. 2
      src/MeshTools/Test/SubdivideTest.h
  7. 2
      src/SceneGraph/Camera.cpp
  8. 2
      src/Swizzle.h

8
src/Math/Matrix.h

@ -31,16 +31,16 @@ namespace Implementation {
/**
@brief Square matrix
@tparam s %Matrix size
@tparam T Data type
@tparam size %Matrix size
@tparam T Data type
See @ref matrix-vector for brief introduction.
@configurationvalueref{Magnum::Math::Matrix}
*/
template<size_t s, class T> class Matrix: public RectangularMatrix<s, s, T> {
template<size_t size, class T> class Matrix: public RectangularMatrix<size, size, T> {
public:
const static size_t size = s; /**< @brief %Matrix size */
const static size_t Size = size; /**< @brief %Matrix size */
/** @brief Pass to constructor to create zero-filled matrix */
enum ZeroType { Zero };

20
src/Math/RectangularMatrix.h

@ -53,20 +53,20 @@ template<size_t size, class T> class Vector;
/**
@brief Rectangular matrix
@tparam c Column count
@tparam r Row count
@tparam T Data type
@tparam cols Column count
@tparam rows Row count
@tparam T Data type
See @ref matrix-vector for brief introduction. See also Matrix (square) and
Vector.
*/
template<size_t c, size_t r, class T> class RectangularMatrix {
static_assert(c != 0 && r != 0, "Matrix cannot have zero elements");
template<size_t cols, size_t rows, class T> class RectangularMatrix {
static_assert(cols != 0 && rows != 0, "Matrix cannot have zero elements");
public:
typedef T Type; /**< @brief Data type */
const static size_t cols = c; /**< @brief %Matrix column count */
const static size_t rows = r; /**< @brief %Matrix row count */
typedef T Type; /**< @brief Data type */
const static size_t Cols = cols; /**< @brief %Matrix column count */
const static size_t Rows = rows; /**< @brief %Matrix row count */
/**
* @brief %Matrix from array
@ -129,10 +129,10 @@ template<size_t c, size_t r, class T> class RectangularMatrix {
#endif
/** @brief Copy constructor */
inline constexpr RectangularMatrix(const RectangularMatrix<c, r, T>&) = default;
inline constexpr RectangularMatrix(const RectangularMatrix<cols, rows, T>&) = default;
/** @brief Assignment operator */
inline RectangularMatrix<c, r, T>& operator=(const RectangularMatrix<c, r, T>&) = default;
inline RectangularMatrix<cols, rows, T>& operator=(const RectangularMatrix<cols, rows, T>&) = default;
/**
* @brief Raw data

12
src/Math/Vector.h

@ -25,15 +25,15 @@ namespace Magnum { namespace Math {
/**
@brief %Vector
@tparam s %Vector size
@tparam T Data type
@tparam size %Vector size
@tparam T Data type
See @ref matrix-vector for brief introduction.
@configurationvalueref{Magnum::Math::Vector}
*/
template<size_t s, class T> class Vector: public RectangularMatrix<1, s, T> {
template<size_t size, class T> class Vector: public RectangularMatrix<1, size, T> {
public:
const static size_t size = s; /**< @brief %Vector size */
const static size_t Size = size; /**< @brief %Vector size */
/**
* @brief Dot product
@ -224,8 +224,8 @@ template<size_t s, class T> class Vector: public RectangularMatrix<1, s, T> {
private:
/* Hiding unused things from RectangularMatrix */
using RectangularMatrix<1, size, T>::cols;
using RectangularMatrix<1, size, T>::rows;
using RectangularMatrix<1, size, T>::Cols;
using RectangularMatrix<1, size, T>::Rows;
using RectangularMatrix<1, size, T>::operator[];
using RectangularMatrix<1, size, T>::operator();
};

8
src/MeshTools/Clean.h

@ -40,7 +40,7 @@ template<class Vertex, size_t vertexSize = Vertex::Size> class Clean {
/* Get mesh bounds */
Vertex min, max;
for(size_t i = 0; i != Vertex::size; ++i) {
for(size_t i = 0; i != Vertex::Size; ++i) {
min[i] = std::numeric_limits<typename Vertex::Type>::max();
max[i] = std::numeric_limits<typename Vertex::Type>::min();
}
@ -54,7 +54,7 @@ template<class Vertex, size_t vertexSize = Vertex::Size> class Clean {
/* Make epsilon so large that size_t can index all vertices inside
mesh bounds. */
Vertex size = max-min;
for(size_t i = 0; i != Vertex::size; ++i)
for(size_t i = 0; i != Vertex::Size; ++i)
if(static_cast<typename Vertex::Type>(size[i]/std::numeric_limits<size_t>::max()) > epsilon)
epsilon = static_cast<typename Vertex::Type>(size[i]/std::numeric_limits<size_t>::max());
@ -92,7 +92,7 @@ template<class Vertex, size_t vertexSize = Vertex::Size> class Clean {
std::swap(newVertices, vertices);
/* Move vertex coordinates by epsilon/2 in next direction */
if(moving != Vertex::size) {
if(moving != Vertex::Size) {
moved = Vertex();
moved[moving] = epsilon/2;
}
@ -137,7 +137,7 @@ Removes duplicate vertices from the mesh.
@todo Interpolate vertices, not collapse them to first in the cell
@todo Ability to specify other attributes for interpolation
*/
template<class Vertex, size_t vertexSize = Vertex::size> inline void clean(std::vector<unsigned int>& indices, std::vector<Vertex>& vertices, typename Vertex::Type epsilon = TypeTraits<typename Vertex::Type>::epsilon()) {
template<class Vertex, size_t vertexSize = Vertex::Size> inline void clean(std::vector<unsigned int>& indices, std::vector<Vertex>& vertices, typename Vertex::Type epsilon = TypeTraits<typename Vertex::Type>::epsilon()) {
Implementation::Clean<Vertex, vertexSize>(indices, vertices)(epsilon);
}

2
src/MeshTools/Test/CleanTest.h

@ -28,7 +28,7 @@ class CleanTest: public Corrade::TestSuite::Tester<CleanTest> {
private:
class Vector1 {
public:
static const size_t size = 1;
static const size_t Size = 1;
typedef int Type;
Vector1(): data(0) {}

2
src/MeshTools/Test/SubdivideTest.h

@ -29,7 +29,7 @@ class SubdivideTest: public Corrade::TestSuite::Tester<SubdivideTest> {
private:
class Vector1 {
public:
static const size_t size = 1;
static const size_t Size = 1;
typedef int Type;
Vector1(): data(0) {}

2
src/SceneGraph/Camera.cpp

@ -32,7 +32,7 @@ template<class MatrixType> MatrixType aspectRatioFix(AspectRatioPolicy aspectRat
/* Extend on larger side = scale larger side down
Clip on smaller side = scale smaller side up */
return Camera<MatrixType::size-1>::aspectRatioScale(
return Camera<MatrixType::Size-1>::aspectRatioScale(
(relativeAspectRatio.x() > relativeAspectRatio.y()) == (aspectRatioPolicy == AspectRatioPolicy::Extend) ?
Vector2(relativeAspectRatio.y()/relativeAspectRatio.x(), 1.0f) :
Vector2(1.0f, relativeAspectRatio.x()/relativeAspectRatio.y()));

2
src/Swizzle.h

@ -110,7 +110,7 @@ instead of at runtime.
Vector4::xy(), Vector3::xy()
*/
template<char ...components, class T> inline constexpr typename Implementation::TypeForSize<sizeof...(components), T>::Type swizzle(const T& vector) {
return {Implementation::Component<T::size, components>::value(vector)...};
return {Implementation::Component<T::Size, components>::value(vector)...};
}
/**

Loading…
Cancel
Save