class new in 2020.06
#include <Magnum/Trade/MeshData.h>
MeshIndexData Mesh index data.
Contents
Convenience type for populating MeshData, see its documentation for an introduction.
Usage
The most straightforward usage is constructing the instance from a view on the index array. The MeshIndexType gets inferred from the view type:
Containers::ArrayView<const UnsignedShort> indices; Trade::MeshIndexData data{indices};
Alternatively, you can pass a typeless const void
view and supply MeshIndexType explicitly, or a contiguous 2D view and let the class detect the actual index type from second dimension size. Note that the class accepts only contiguous views and not Corrade::
Constructors, destructors, conversion operators
-
MeshIndexData(std::
nullptr_t = nullptr) explicit noexcept - Construct for a non-indexed mesh.
-
MeshIndexData(MeshIndexType type,
Containers::
ArrayView<const void> data) explicit noexcept - Construct with a runtime-specified index type.
-
MeshIndexData(Containers::
ArrayView<const UnsignedByte> data) explicit constexpr noexcept - Construct with unsigned byte indices.
-
MeshIndexData(Containers::
ArrayView<const UnsignedShort> data) explicit constexpr noexcept - Construct with unsigned short indices.
-
MeshIndexData(Containers::
ArrayView<const UnsignedInt> data) explicit constexpr noexcept - Construct with unsigned int indices.
-
MeshIndexData(const Containers::
StridedArrayView2D<const char>& data) explicit noexcept - Constructor.
Public functions
- auto type() const -> MeshIndexType constexpr
- Index type.
-
auto data() const -> Containers::
ArrayView<const void> constexpr - Type-erased index data.
Function documentation
Magnum:: Trade:: MeshIndexData:: MeshIndexData(MeshIndexType type,
Containers:: ArrayView<const void> data) explicit noexcept
Construct with a runtime-specified index type.
Parameters | |
---|---|
type | Index type |
data | Index data |
The data
size is expected to correspond to given type
(e.g., for MeshIndexType::data
array size should be divisible by 4). If you know the type
at compile time, you can use one of the MeshIndexData(Containers::
If data
is empty, the mesh will be treated as indexed but with zero indices. To create a non-indexed mesh, use the MeshIndexData(std::
Magnum:: Trade:: MeshIndexData:: MeshIndexData(const Containers:: StridedArrayView2D<const char>& data) explicit noexcept
Constructor.
Expects that data
is contiguous and size of the second dimension is either 1, 2 or 4, corresponding to one of the MeshIndexType values. As a special case, if second dimension size is 0, the constructor is equivalent to MeshIndexData(std::
Containers:: ArrayView<const void> Magnum:: Trade:: MeshIndexData:: data() const constexpr
Type-erased index data.