Browse Source

MeshTools: completed documentation review.

pull/54/merge
Vladimír Vondruš 12 years ago
parent
commit
86302ea602
  1. 15
      src/Magnum/MeshTools/FlipNormals.h
  2. 10
      src/Magnum/MeshTools/GenerateFlatNormals.h
  3. 2
      src/Magnum/MeshTools/Subdivide.h
  4. 2
      src/Magnum/MeshTools/Tipsify.h
  5. 20
      src/Magnum/MeshTools/Transform.h

15
src/Magnum/MeshTools/FlipNormals.h

@ -26,7 +26,7 @@
*/ */
/** @file /** @file
* @brief Function Magnum::MeshTools::flipNormals() * @brief Function @ref Magnum::MeshTools::flipFaceWinding(), @ref Magnum::MeshTools::flipNormals()
*/ */
#include <vector> #include <vector>
@ -38,16 +38,21 @@ namespace Magnum { namespace MeshTools {
/** /**
@brief Flip face winding @brief Flip face winding
@param[in,out] indices Index array to operate on
The same as flipNormals(std::vector<UnsignedInt>&, std::vector<Vector3>&), The same as @ref flipNormals(std::vector<UnsignedInt>&, std::vector<Vector3>&),
but flips only face winding. but flips only face winding.
@attention The function requires the mesh to have triangle faces, thus index
count must be divisible by 3.
*/ */
void MAGNUM_MESHTOOLS_EXPORT flipFaceWinding(std::vector<UnsignedInt>& indices); void MAGNUM_MESHTOOLS_EXPORT flipFaceWinding(std::vector<UnsignedInt>& indices);
/** /**
@brief Flip mesh normals @brief Flip mesh normals
@param[in,out] normals Normal array to operate on
The same as flipNormals(std::vector<UnsignedInt>&, std::vector<Vector3>&), The same as @ref flipNormals(std::vector<UnsignedInt>&, std::vector<Vector3>&),
but flips only normals, not face winding. but flips only normals, not face winding.
*/ */
void MAGNUM_MESHTOOLS_EXPORT flipNormals(std::vector<Vector3>& normals); void MAGNUM_MESHTOOLS_EXPORT flipNormals(std::vector<Vector3>& normals);
@ -58,8 +63,8 @@ void MAGNUM_MESHTOOLS_EXPORT flipNormals(std::vector<Vector3>& normals);
@param[in,out] normals Normal array to operate on @param[in,out] normals Normal array to operate on
Flips normal vectors and face winding in index array for face culling to work Flips normal vectors and face winding in index array for face culling to work
properly too. See also flipNormals(std::vector<Vector3>&) and properly too. See also @ref flipNormals(std::vector<Vector3>&) and
flipFaceWinding(), which flip normals or face winding only. @ref flipFaceWinding(), which flip normals or face winding only.
@attention The function requires the mesh to have triangle faces, thus index @attention The function requires the mesh to have triangle faces, thus index
count must be divisible by 3. count must be divisible by 3.

10
src/Magnum/MeshTools/GenerateFlatNormals.h

@ -26,7 +26,7 @@
*/ */
/** @file /** @file
* @brief Function Magnum::MeshTools::generateFlatNormals() * @brief Function @ref Magnum::MeshTools::generateFlatNormals()
*/ */
#include <tuple> #include <tuple>
@ -53,11 +53,11 @@ std::vector<UnsignedInt> normalIndices;
std::vector<Vector3> normals; std::vector<Vector3> normals;
std::tie(normalIndices, normals) = MeshTools::generateFlatNormals(vertexIndices, positions); std::tie(normalIndices, normals) = MeshTools::generateFlatNormals(vertexIndices, positions);
@endcode @endcode
You can then use combineIndexedArrays() to combine normal and vertex array to You can then use @ref combineIndexedArrays() to combine normal and vertex array
use the same indices. to use the same indices.
@attention Index count must be divisible by 3, otherwise zero length result @attention The function requires the mesh to have triangle faces, thus index
is generated. count must be divisible by 3.
*/ */
std::tuple<std::vector<UnsignedInt>, std::vector<Vector3>> MAGNUM_MESHTOOLS_EXPORT generateFlatNormals(const std::vector<UnsignedInt>& indices, const std::vector<Vector3>& positions); std::tuple<std::vector<UnsignedInt>, std::vector<Vector3>> MAGNUM_MESHTOOLS_EXPORT generateFlatNormals(const std::vector<UnsignedInt>& indices, const std::vector<Vector3>& positions);

2
src/Magnum/MeshTools/Subdivide.h

@ -26,7 +26,7 @@
*/ */
/** @file /** @file
* @brief Function Magnum::MeshTools::subdivide() * @brief Function @ref Magnum::MeshTools::subdivide()
*/ */
#include <vector> #include <vector>

2
src/Magnum/MeshTools/Tipsify.h

@ -26,7 +26,7 @@
*/ */
/** @file /** @file
* @brief Function Magnum::MeshTools::tipsify() * @brief Function @ref Magnum::MeshTools::tipsify()
*/ */
#include <vector> #include <vector>

20
src/Magnum/MeshTools/Transform.h

@ -26,7 +26,7 @@
*/ */
/** @file /** @file
* @brief Function Magnum::MeshTools::transformVectorsInPlace(), Magnum::MeshTools::transformVectors(), Magnum::MeshTools::transformPointsInPlace(), Magnum::MeshTools::transformPoints() * @brief Function @ref Magnum::MeshTools::transformVectorsInPlace(), @ref Magnum::MeshTools::transformVectors(), @ref Magnum::MeshTools::transformPointsInPlace(), @ref Magnum::MeshTools::transformPoints()
*/ */
#include "Magnum/Math/DualQuaternion.h" #include "Magnum/Math/DualQuaternion.h"
@ -43,7 +43,7 @@ with compatible vector type as @p vectors. Expects that @ref Math::Quaternion "Q
is normalized, no further requirements are for other transformation is normalized, no further requirements are for other transformation
representations. representations.
Unlike in transformPointsInPlace(), the transformation does not involve Unlike in @ref transformPointsInPlace(), the transformation does not involve
translation. translation.
Example usage: Example usage:
@ -53,8 +53,9 @@ auto transformation = Quaternion::rotation(35.0_degf, Vector3::yAxis());
MeshTools::transformVectorsInPlace(rotation, vectors); MeshTools::transformVectorsInPlace(rotation, vectors);
@endcode @endcode
@see transformVectors(), Matrix3::transformVector(), Matrix4::transformVector(), @see @ref transformVectors(), @ref Matrix3::transformVector(),
Complex::transformVectorNormalized(), Quaternion::transformVectorNormalized() @ref Matrix4::transformVector(), @ref Complex::transformVector(),
@ref Quaternion::transformVectorNormalized()
@todo GPU transform feedback implementation (otherwise this is only bad joke) @todo GPU transform feedback implementation (otherwise this is only bad joke)
*/ */
template<class T, class U> void transformVectorsInPlace(const Math::Quaternion<T>& normalizedQuaternion, U& vectors) { template<class T, class U> void transformVectorsInPlace(const Math::Quaternion<T>& normalizedQuaternion, U& vectors) {
@ -80,7 +81,7 @@ template<class T, class U> void transformVectorsInPlace(const Math::Matrix4<T>&
@brief Transform vectors using given transformation @brief Transform vectors using given transformation
Returns transformed vectors instead of modifying them in-place. See Returns transformed vectors instead of modifying them in-place. See
transformVectorsInPlace() for more information. @ref transformVectorsInPlace() for more information.
*/ */
template<class T, class U> U transformVectors(const T& transformation, U vectors) { template<class T, class U> U transformVectors(const T& transformation, U vectors) {
U result(std::move(vectors)); U result(std::move(vectors));
@ -97,7 +98,7 @@ with compatible vector type as @p vectors. Expects that
@ref Math::DualQuaternion "DualQuaternion" is normalized, no further @ref Math::DualQuaternion "DualQuaternion" is normalized, no further
requirements are for other transformation representations. requirements are for other transformation representations.
Unlike in transformVectorsInPlace(), the transformation also involves Unlike in @ref transformVectorsInPlace(), the transformation also involves
translation. translation.
Example usage: Example usage:
@ -108,8 +109,9 @@ auto transformation = DualQuaternion::rotation(35.0_degf, Vector3::yAxis())*
MeshTools::transformPointsInPlace(rotation, points); MeshTools::transformPointsInPlace(rotation, points);
@endcode @endcode
@see transformPoints(), Matrix3::transformPoint(), Matrix4::transformPoint(), @see @ref transformPoints(), @ref Matrix3::transformPoint(),
DualQuaternion::transformPointNormalized() @ref Matrix4::transformPoint(),
@ref DualQuaternion::transformPointNormalized()
*/ */
template<class T, class U> void transformPointsInPlace(const Math::DualQuaternion<T>& normalizedDualQuaternion, U& points) { template<class T, class U> void transformPointsInPlace(const Math::DualQuaternion<T>& normalizedDualQuaternion, U& points) {
for(auto& point: points) point = normalizedDualQuaternion.transformPointNormalized(point); for(auto& point: points) point = normalizedDualQuaternion.transformPointNormalized(point);
@ -134,7 +136,7 @@ template<class T, class U> void transformPointsInPlace(const Math::Matrix4<T>& m
@brief Transform points using given transformation @brief Transform points using given transformation
Returns transformed points instead of modifying them in-place. See Returns transformed points instead of modifying them in-place. See
transformPointsInPlace() for more information. @ref transformPointsInPlace() for more information.
*/ */
template<class T, class U> U transformPoints(const T& transformation, U vectors) { template<class T, class U> U transformPoints(const T& transformation, U vectors) {
U result(std::move(vectors)); U result(std::move(vectors));

Loading…
Cancel
Save