Browse Source

Primitives: document how to scale capsule / cylinder to preserve normals.

pull/231/head
Vladimír Vondruš 8 years ago
parent
commit
341a70a7f4
  1. 6
      src/Magnum/Primitives/Capsule.h
  2. 6
      src/Magnum/Primitives/Cylinder.h

6
src/Magnum/Primitives/Capsule.h

@ -81,6 +81,12 @@ class MAGNUM_PRIMITIVES_EXPORT Capsule3D {
* Indexed @ref MeshPrimitive::Triangles with normals and optional 2D * Indexed @ref MeshPrimitive::Triangles with normals and optional 2D
* texture coordinates. If texture coordinates are generated, vertices * texture coordinates. If texture coordinates are generated, vertices
* of one segment are duplicated for texture wrapping. * of one segment are duplicated for texture wrapping.
*
* The capsule is by default created with radius set to @cpp 1.0f @ce.
* In order to get radius @f$ r @f$, length @f$ l @f$ and preserve
* correct normals, set @p halfLength to @f$ 0.5 \frac{l}{r} @f$ and
* then scale all @ref Trade::MeshData3D::positions() by @f$ r @f$, for
* example using @ref MeshTools::transformPointsInPlace().
*/ */
static Trade::MeshData3D solid(UnsignedInt hemisphereRings, UnsignedInt cylinderRings, UnsignedInt segments, Float halfLength, TextureCoords textureCoords = TextureCoords::DontGenerate); static Trade::MeshData3D solid(UnsignedInt hemisphereRings, UnsignedInt cylinderRings, UnsignedInt segments, Float halfLength, TextureCoords textureCoords = TextureCoords::DontGenerate);

6
src/Magnum/Primitives/Cylinder.h

@ -74,6 +74,12 @@ class MAGNUM_PRIMITIVES_EXPORT Cylinder {
* texture coordinates and optional capped ends. If texture coordinates * texture coordinates and optional capped ends. If texture coordinates
* are generated, vertices of one segment are duplicated for texture * are generated, vertices of one segment are duplicated for texture
* wrapping. * wrapping.
*
* The cylinder is by default created with radius set to @cpp 1.0f @ce.
* In order to get radius @f$ r @f$, length @f$ l @f$ and preserve
* correct normals, set @p halfLength to @f$ 0.5 \frac{l}{r} @f$ and
* then scale all @ref Trade::MeshData3D::positions() by @f$ r @f$, for
* example using @ref MeshTools::transformPointsInPlace().
*/ */
static Trade::MeshData3D solid(UnsignedInt rings, UnsignedInt segments, Float halfLength, Flags flags = Flags()); static Trade::MeshData3D solid(UnsignedInt rings, UnsignedInt segments, Float halfLength, Flags flags = Flags());

Loading…
Cancel
Save