Magnum::Trade::MeshIndexData class new in Git master

Mesh index data.

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::Containers::StridedArrayView, following limitations of GPU index buffers that also have to be contiguous.

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::UnsignedInt the data array size should be divisible by 4). If you know the type at compile time, you can use one of the MeshIndexData(Containers::ArrayView<const UnsignedByte>), MeshIndexData(Containers::ArrayView<const UnsignedShort>) or MeshIndexData(Containers::ArrayView<const UnsignedInt>) constructors, which infer the index type automatically.

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::nullptr_t) constructor.

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.

Containers::ArrayView<const void> Magnum::Trade::MeshIndexData::data() const constexpr

Type-erased index data.