Browse Source

Trade: convenience MeshData*D::has*() functions.

Makes it more intuitive (and shorter) than calling
`if(data.textureCoords2DArrayCount())`.
pull/34/head
Vladimír Vondruš 13 years ago
parent
commit
8dfd6fd4fc
  1. 9
      src/Trade/MeshData2D.h
  2. 12
      src/Trade/MeshData3D.h

9
src/Trade/MeshData2D.h

@ -83,7 +83,11 @@ class MAGNUM_EXPORT MeshData2D {
std::vector<UnsignedInt>& indices();
const std::vector<UnsignedInt>& indices() const; /**< @overload */
/** @brief Count of position arrays */
/**
* @brief Count of position arrays
*
* There is always at least one.
*/
UnsignedInt positionArrayCount() const { return _positions.size(); }
/**
@ -95,6 +99,9 @@ class MAGNUM_EXPORT MeshData2D {
std::vector<Vector2>& positions(UnsignedInt id);
const std::vector<Vector2>& positions(UnsignedInt id) const; /**< @overload */
/** @brief Whether the data contain any 2D texture coordinates */
bool hasTextureCoords2D() const { return !_textureCoords2D.empty(); }
/** @brief Count of 2D texture coordinate arrays */
UnsignedInt textureCoords2DArrayCount() const { return _textureCoords2D.size(); }

12
src/Trade/MeshData3D.h

@ -84,7 +84,11 @@ class MAGNUM_EXPORT MeshData3D {
std::vector<UnsignedInt>& indices();
const std::vector<UnsignedInt>& indices() const; /**< @overload */
/** @brief Count of position arrays */
/**
* @brief Count of position arrays
*
* There is always at least one.
*/
UnsignedInt positionArrayCount() const { return _positions.size(); }
/**
@ -96,6 +100,9 @@ class MAGNUM_EXPORT MeshData3D {
std::vector<Vector3>& positions(UnsignedInt id);
const std::vector<Vector3>& positions(UnsignedInt id) const; /**< @overload */
/** @brief Whether the data contain any normals */
bool hasNormals() const { return !_normals.empty(); }
/** @brief Count of normal arrays */
UnsignedInt normalArrayCount() const { return _normals.size(); }
@ -108,6 +115,9 @@ class MAGNUM_EXPORT MeshData3D {
std::vector<Vector3>& normals(UnsignedInt id);
const std::vector<Vector3>& normals(UnsignedInt id) const; /**< @overload */
/** @brief Whether the data contain any 2D texture coordinates */
bool hasTextureCoords2D() const { return !_textureCoords2D.empty(); }
/** @brief Count of 2D texture coordinate arrays */
UnsignedInt textureCoords2DArrayCount() const { return _textureCoords2D.size(); }

Loading…
Cancel
Save