diff --git a/src/Magnum/MeshTools/CombineIndexedArrays.h b/src/Magnum/MeshTools/CombineIndexedArrays.h index 6f030de61..c5a837e4e 100644 --- a/src/Magnum/MeshTools/CombineIndexedArrays.h +++ b/src/Magnum/MeshTools/CombineIndexedArrays.h @@ -157,7 +157,8 @@ attribute array as reference, so it can be replaced with combined data. To avoid explicit verbose specification of tuple type, you can write it with help of some STL functions like shown below. Also if one index array is shared by more than one attribute array, just pass the index array more times. Example: -@code + +@code{.cpp} std::vector vertexIndices; std::vector positions; std::vector normalTextureIndices; diff --git a/src/Magnum/MeshTools/Compile.h b/src/Magnum/MeshTools/Compile.h index 93cc1989d..28b5586be 100644 --- a/src/Magnum/MeshTools/Compile.h +++ b/src/Magnum/MeshTools/Compile.h @@ -49,7 +49,7 @@ attribute. No data compression or index optimization (except for index buffer packing) is done. The @p usage parameter is used for both vertex and index buffer. -The second returned buffer may be `nullptr` if the mesh is not indexed. +The second returned buffer may be @cpp nullptr @ce if the mesh is not indexed. This is just a convenience function for creating generic meshes, you might want to use @ref interleave() and @ref compressIndices() functions instead for @@ -70,7 +70,7 @@ bound to @ref Shaders::Generic2D::TextureCoordinates attribute. No data compression or index optimization (except for index buffer packing) is done. The @p usage parameter is used for both vertex and index buffer. -The second returned buffer may be `nullptr` if the mesh is not indexed. +The second returned buffer may be @cpp nullptr @ce if the mesh is not indexed. This is just a convenience function for creating generic meshes, you might want to use @ref interleave() and @ref compressIndices() functions instead for diff --git a/src/Magnum/MeshTools/CompressIndices.h b/src/Magnum/MeshTools/CompressIndices.h index 80aad9cf7..b74147bb4 100644 --- a/src/Magnum/MeshTools/CompressIndices.h +++ b/src/Magnum/MeshTools/CompressIndices.h @@ -47,7 +47,8 @@ wasteful to store them in array of 32bit integers, array of 16bit integers is sufficient. Example usage: -@code + +@code{.cpp} std::vector indices; Containers::Array indexData; @@ -76,7 +77,8 @@ The type can be either @ref Magnum::UnsignedByte "UnsignedByte", Values in the index array are expected to be representable with given type. Example usage: -@code + +@code{.cpp} std::vector indices; Containers::Array indexData = MeshTools::compressIndicesAs(indices); @endcode diff --git a/src/Magnum/MeshTools/FullScreenTriangle.h b/src/Magnum/MeshTools/FullScreenTriangle.h index 19a35a87b..706f2423b 100644 --- a/src/Magnum/MeshTools/FullScreenTriangle.h +++ b/src/Magnum/MeshTools/FullScreenTriangle.h @@ -52,15 +52,16 @@ computed from them. The vertex positions are, in order: @f] Based on @p version parameter, on OpenGL 2.1 and OpenGL ES 2.0 the vertex -positions are passed explicitly as attribute `0`, contained in the buffer. On -OpenGL 3.0+ and OpenGL ES 3.0+ the mesh is attribute-less and the vertex -positions can be computed using `gl_VertexID` builtin shader variable, thus -`nullptr` is returned instead of vertex buffer. +positions are passed explicitly as attribute @cpp 0 @ce, contained in the +buffer. On OpenGL 3.0+ and OpenGL ES 3.0+ the mesh is attribute-less and the +vertex positions can be computed using @glsl gl_VertexID @ce builtin shader +variable, thus @cpp nullptr @ce is returned instead of vertex buffer. Computing positions in vertex shader in a portable way might be done like this. For OpenGL 2.1 and OpenGL ES 2.0 you then need to bind the location of `position` -attribute to `0`. -@code +attribute to @cpp 0 @ce. + +@code{.glsl} #if (!defined(GL_ES) && __VERSION__ >= 130) || (defined(GL_ES) && __VERSION__ >= 300) #define NEW_GLSL #endif diff --git a/src/Magnum/MeshTools/GenerateFlatNormals.h b/src/Magnum/MeshTools/GenerateFlatNormals.h index cd248b377..c643032db 100644 --- a/src/Magnum/MeshTools/GenerateFlatNormals.h +++ b/src/Magnum/MeshTools/GenerateFlatNormals.h @@ -45,7 +45,8 @@ namespace Magnum { namespace MeshTools { For each face generates one normal vector, removes duplicates before returning. Example usage: -@code + +@code{.cpp} std::vector vertexIndices; std::vector positions; @@ -53,6 +54,7 @@ std::vector normalIndices; std::vector normals; std::tie(normalIndices, normals) = MeshTools::generateFlatNormals(vertexIndices, positions); @endcode + You can then use @ref combineIndexedArrays() to combine normal and vertex array to use the same indices. diff --git a/src/Magnum/MeshTools/Interleave.h b/src/Magnum/MeshTools/Interleave.h index 7259eed9f..c730ef2e4 100644 --- a/src/Magnum/MeshTools/Interleave.h +++ b/src/Magnum/MeshTools/Interleave.h @@ -99,7 +99,8 @@ This function takes list of attribute arrays and returns them interleaved, so data for each attribute are in continuous place in memory. Example usage: -@code + +@code{.cpp} MeshPrimitive primitive; std::vector positions; std::vector textureCoordinates; @@ -115,13 +116,15 @@ mesh.setPrimitive(primitive) It's often desirable to align data for one vertex on 32bit boundaries. To achieve that, you can specify gaps between the attributes: -@code + +@code{.cpp} std::vector positions; std::vector weights; std::vector vertexColors; auto data = MeshTools::interleave(positions, weights, 2, textureCoordinates, 1); @endcode + All gap bytes are set zero. This way vertex stride is 24 bytes, without gaps it would be 21 bytes, causing possible performance loss. @@ -130,7 +133,7 @@ would be 21 bytes, causing possible performance loss. @note The only requirements to attribute array type is that it must have typedef `T::value_type`, forward iterator (to be used with range-based for) and function `size()` returning count of elements. In most cases it - will be `std::vector` or `std::array`. + will be @ref std::vector or @ref std::array. @see @ref interleaveInto() */ diff --git a/src/Magnum/MeshTools/RemoveDuplicates.h b/src/Magnum/MeshTools/RemoveDuplicates.h index ebf4cf525..fe6d32c34 100644 --- a/src/Magnum/MeshTools/RemoveDuplicates.h +++ b/src/Magnum/MeshTools/RemoveDuplicates.h @@ -52,7 +52,7 @@ namespace Implementation { /** @brief Remove duplicate floating-point vector data from given array @param[in,out] data Input data array -@param[out] epsilon Epsilon value, vertices nearer than this distance will be +@param[in] epsilon Epsilon value, vertices nearer than this distance will be melt together @return Index array and unique data @@ -65,7 +65,8 @@ the usual sorting method is much more efficient. If you want to remove duplicate data from already indexed array, first remove duplicates as if the array wasn't indexed at all and then use @ref duplicate() to combine the two index arrays: -@code + +@code{.cpp} std::vector indices; std::vector positions; @@ -76,7 +77,8 @@ Removing duplicates in multiple indcidental arrays is also possible -- first remove duplicates in each array separately and then use @ref combineIndexedArrays() to combine the resulting index arrays to single index array and reorder the data accordingly: -@code + +@code{.cpp} std::vector positions; std::vector texCoords; diff --git a/src/Magnum/MeshTools/Subdivide.h b/src/Magnum/MeshTools/Subdivide.h index 2ef074e82..b58fc7bf7 100644 --- a/src/Magnum/MeshTools/Subdivide.h +++ b/src/Magnum/MeshTools/Subdivide.h @@ -92,18 +92,18 @@ template void Subdivide: newVertices[j] = addVertex(interpolator(vertices[indices[i+j]], vertices[indices[i+(j+1)%3]])); /* - * Add three new faces (0, 1, 3) and update original (2) - * - * orig 0 - * / \ - * / 0 \ - * / \ - * new 0 ----- new 2 - * / \ / \ - * / 1 \ 2 / 3 \ - * / \ / \ - * orig 1 ----- new 1 ---- orig 2 - */ + Add three new faces (0, 1, 3) and update original (2) + + orig 0 + / \ + / 0 \ + / \ + new 0 ----- new 2 + / \ / \ + / 1 \ 2 / 3 \ + / \ / \ + orig 1 ----- new 1 ---- orig 2 + */ addFace(indices[i], newVertices[0], newVertices[2]); addFace(newVertices[0], indices[i+1], newVertices[1]); addFace(newVertices[2], newVertices[1], indices[i+2]); diff --git a/src/Magnum/MeshTools/Tipsify.h b/src/Magnum/MeshTools/Tipsify.h index e08b110a5..dff33243c 100644 --- a/src/Magnum/MeshTools/Tipsify.h +++ b/src/Magnum/MeshTools/Tipsify.h @@ -68,7 +68,7 @@ class MAGNUM_MESHTOOLS_EXPORT Tipsify { Optimizes the mesh for vertex-bound applications by rearranging its index array for beter usage of post-transform vertex cache. Algorithm used: -*Pedro V. Sander, Diego Nehab, and Joshua Barczak - Fast Triangle Reordering +*Pedro V. Sander, Diego Nehab, and Joshua Barczak --- Fast Triangle Reordering for Vertex Locality and Reduced Overdraw, SIGGRAPH 2007, http://gfx.cs.princeton.edu/pubs/Sander_2007_%3ETR/index.php*. @todo Ability to compute vertex count automatically diff --git a/src/Magnum/MeshTools/Transform.h b/src/Magnum/MeshTools/Transform.h index 24b624d18..6dfde393b 100644 --- a/src/Magnum/MeshTools/Transform.h +++ b/src/Magnum/MeshTools/Transform.h @@ -47,7 +47,8 @@ Unlike in @ref transformPointsInPlace(), the transformation does not involve translation. Example usage: -@code + +@code{.cpp} std::vector vectors; auto transformation = Quaternion::rotation(35.0_degf, Vector3::yAxis()); MeshTools::transformVectorsInPlace(rotation, vectors); @@ -102,7 +103,8 @@ Unlike in @ref transformVectorsInPlace(), the transformation also involves translation. Example usage: -@code + +@code{.cpp} std::vector points; auto transformation = DualQuaternion::rotation(35.0_degf, Vector3::yAxis())* DualQuaternion::translation({0.5f, -1.0f, 3.0f});