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

Scene field data.

Convenience type for populating SceneData, see its documentation for an introduction. Additionally usable in various SceneTools algorithms such as SceneTools::combineFields(Trade::SceneMappingType, UnsignedLong, Containers::ArrayView<const Trade::SceneFieldData>).

Usage

The most straightforward usage is constructing an instance from a SceneField and a strided view for the field data and object mapping. The SceneMappingType and SceneFieldType get inferred from the view types:

Containers::StridedArrayView1D<UnsignedInt> transformationMapping = ;
Containers::StridedArrayView1D<Matrix4> transformations = ;

Trade::SceneFieldData field{Trade::SceneField::Transformation,
    transformationMapping, transformations};

Alternatively, you can pass typeless const void or 2D views and supply SceneMappingType and SceneFieldType explicitly.

Offset-only field data

If the actual field / mapping data location is not known yet, the instance can be created as "offset-only" using SceneFieldData(SceneField, std::size_t, SceneMappingType, std::size_t, std::ptrdiff_t, SceneFieldType, std::size_t, std::ptrdiff_t, UnsignedShort, SceneFieldFlags) and related constructor overloads, meaning the actual views get created only later when passed to a SceneData instance with a concrete data array. This is useful mainly to avoid pointer patching during data serialization, but also for example when the data layout is static (and thus can be defined at compile time), but the actual data is allocated / populated at runtime.

struct Node {
    UnsignedInt mapping;
    Int parent;
    Matrix4 transformation;
};

Trade::SceneFieldData parents{Trade::SceneField::Parent, objectCount,
    Trade::SceneMappingType::UnsignedInt, offsetof(Node, mapping), sizeof(Node),
    Trade::SceneFieldType::Int, offsetof(Node, parent), sizeof(Node)};
Trade::SceneFieldData transformations{Trade::SceneField::Transformation, objectCount,
    Trade::SceneMappingType::UnsignedInt, offsetof(Node, mapping), sizeof(Node),
    Trade::SceneFieldType::Matrix4x4, offsetof(Node, transformation), sizeof(Node)};

See the corresponding SceneData documentation for a complete usage example. Offset-only fields are marked with SceneFieldFlag::OffsetOnly in flags(). Note that SceneTools algorithms generally don't accept offset-only SceneFieldData instances except when passed through a SceneData, as for a standalone offset-only SceneFieldData it's impossible to know what data it points to.

Ordered and implicit object mapping

If you can guarantee the object mapping field is monotonically non-decreasing, it's recommended to annotate it with SceneFieldFlag::OrderedMapping. This makes certain convenience APIs such as SceneData::findFieldObjectOffset() or e.g. transformation3DFor() perform the lookup in $ \mathcal{O}(\log{} n) $ instead of $ \mathcal{O}(n) $ . Data consuming algorithms on the application side can then also adapt based on what flags are present in SceneData::fieldFlags().

In some cases the object mapping is even implicit, i.e. the first entry of the field specifying data for object 0, second entry for object 1, third for object 2 and so on. You can annotate such fields with SceneFieldFlag::ImplicitMapping, which is a superset of OrderedMapping.

Bit fields

Bit fields have dedicated constructors taking a Containers::StridedBitArrayView1D or Containers::StridedBitArrayView2D, and because the type is always SceneFieldType::Bit, it's omitted. For offset-only bit fields there's a SceneFieldData(SceneField, std::size_t, SceneMappingType, std::size_t, std::ptrdiff_t, std::size_t, std::size_t, std::ptrdiff_t, UnsignedShort, SceneFieldFlags) constructor that omits SceneFieldType as well, but contains an additional bit offset parameter.

String fields

String fields have to be constructed using dedicated constructors that additionally take a const char* base string pointer, and because a particular type can correspond to more than one SceneFieldType (such as SceneFieldType::StringOffset32 and SceneFieldType::StringRangeNullTerminated32 being both represented with an UnsignedInt), the type has to be specified explicitly:

Containers::StridedArrayView1D<UnsignedInt> mapping = ;
Containers::StringView string = ;
Containers::StridedArrayView1D<Containers::Pair<UnsignedInt, UnsignedInt>> ranges = ;

Trade::SceneFieldData field{Trade::sceneFieldCustom(35), mapping,
    string.data(), Trade::SceneFieldType::StringRange32, ranges};

Offset-only constructors have it similar, containing an extra base string offset. Due to packing in the internal layout, string fields can't be arrays.

Constructors, destructors, conversion operators

SceneFieldData() explicit constexpr noexcept
Default constructor.
SceneFieldData(SceneField name, SceneMappingType mappingType, const Containers::StridedArrayView1D<const void>& mappingData, SceneFieldType fieldType, const Containers::StridedArrayView1D<const void>& fieldData, UnsignedShort fieldArraySize = 0, SceneFieldFlags flags = {}) explicit constexpr noexcept
Construct from type-erased views.
SceneFieldData(SceneField name, SceneMappingType mappingType, const Containers::StridedArrayView1D<const void>& mappingData, SceneFieldType fieldType, const Containers::StridedArrayView1D<const void>& fieldData, SceneFieldFlags flags) explicit constexpr noexcept
SceneFieldData(SceneField name, const Containers::StridedArrayView2D<const char>& mappingData, SceneFieldType fieldType, const Containers::StridedArrayView2D<const char>& fieldData, UnsignedShort fieldArraySize = 0, SceneFieldFlags flags = {}) explicit noexcept
Construct from 2D type-erased views.
SceneFieldData(SceneField name, const Containers::StridedArrayView2D<const char>& mappingData, SceneFieldType fieldType, const Containers::StridedArrayView2D<const char>& fieldData, SceneFieldFlags flags) explicit noexcept
template<class T, class U>
SceneFieldData(SceneField name, const Containers::StridedArrayView1D<T>& mappingData, const Containers::StridedArrayView1D<U>& fieldData, SceneFieldFlags flags = {}) explicit constexpr noexcept
Constructor.
template<class T, class U>
SceneFieldData(SceneField name, const Containers::StridedArrayView1D<T>& mappingData, const Containers::ArrayView<U>& fieldData, SceneFieldFlags flags = {}) explicit constexpr noexcept
template<class T, class U>
SceneFieldData(SceneField name, const Containers::ArrayView<T>& mappingData, const Containers::StridedArrayView1D<U>& fieldData, SceneFieldFlags flags = {}) explicit constexpr noexcept
template<class T, class U>
SceneFieldData(SceneField name, const Containers::ArrayView<T>& mappingData, const Containers::ArrayView<U>& fieldData, SceneFieldFlags flags = {}) explicit constexpr noexcept
template<class T, class U>
SceneFieldData(SceneField name, const Containers::StridedArrayView1D<T>& mappingData, const Containers::StridedArrayView2D<U>& fieldData, SceneFieldFlags flags = {}) explicit constexpr noexcept
Construct an array field.
template<class T, class U>
SceneFieldData(SceneField name, const Containers::ArrayView<T>& mappingData, const Containers::StridedArrayView2D<U>& fieldData, SceneFieldFlags flags = {}) explicit constexpr noexcept
SceneFieldData(SceneField name, SceneMappingType mappingType, const Containers::StridedArrayView1D<const void>& mappingData, const Containers::StridedBitArrayView1D& fieldData, SceneFieldFlags flags = {}) explicit constexpr noexcept
Construct a bit field with a type-erased mapping view.
SceneFieldData(SceneField name, const Containers::StridedArrayView2D<const char>& mappingData, const Containers::StridedBitArrayView1D& fieldData, SceneFieldFlags flags = {}) explicit noexcept
Construct a bit field with a 2D type-erased mapping view.
template<class T>
SceneFieldData(SceneField name, const Containers::StridedArrayView1D<T>& mappingData, const Containers::StridedBitArrayView1D& fieldData, SceneFieldFlags flags = {}) explicit constexpr noexcept
Construct a bit field.
template<class T>
SceneFieldData(SceneField name, const Containers::ArrayView<T>& mappingData, const Containers::StridedBitArrayView1D& fieldData, SceneFieldFlags flags = {}) explicit constexpr noexcept
SceneFieldData(SceneField name, SceneMappingType mappingType, const Containers::StridedArrayView1D<const void>& mappingData, const Containers::StridedBitArrayView2D& fieldData, SceneFieldFlags flags = {}) explicit constexpr noexcept
Construct an array bit field with a type-erased mapping view.
SceneFieldData(SceneField name, const Containers::StridedArrayView2D<const char>& mappingData, const Containers::StridedBitArrayView2D& fieldData, SceneFieldFlags flags = {}) explicit noexcept
Construct an array bit field with a 2D type-erased mapping view.
template<class T>
SceneFieldData(SceneField name, const Containers::StridedArrayView1D<T>& mappingData, const Containers::StridedBitArrayView2D& fieldData, SceneFieldFlags flags = {}) explicit constexpr noexcept
Construct an array bit field.
template<class T>
SceneFieldData(SceneField name, const Containers::ArrayView<T>& mappingData, const Containers::StridedBitArrayView2D& fieldData, SceneFieldFlags flags = {}) explicit constexpr noexcept
SceneFieldData(SceneField name, SceneMappingType mappingType, const Containers::StridedArrayView1D<const void>& mappingData, const char* stringData, SceneFieldType fieldType, const Containers::StridedArrayView1D<const void>& fieldData, SceneFieldFlags flags = {}) explicit noexcept
Construct a string field from type-erased views.
SceneFieldData(SceneField name, const Containers::StridedArrayView2D<const char>& mappingData, const char* stringData, SceneFieldType fieldType, const Containers::StridedArrayView2D<const char>& fieldData, SceneFieldFlags flags = {}) explicit noexcept
Construct a string field from 2D type-erased views.
template<class T>
SceneFieldData(SceneField name, const Containers::StridedArrayView1D<T>& mappingData, const char* stringData, SceneFieldType fieldType, const Containers::StridedArrayView1D<const void>& fieldData, SceneFieldFlags flags = {}) explicit noexcept
Construct a string field.
template<class T>
SceneFieldData(SceneField name, const Containers::ArrayView<T>& mappingData, const char* stringData, SceneFieldType fieldType, const Containers::StridedArrayView1D<const void>& fieldData, SceneFieldFlags flags = {}) explicit noexcept
SceneFieldData(SceneField name, std::size_t size, SceneMappingType mappingType, std::size_t mappingOffset, std::ptrdiff_t mappingStride, SceneFieldType fieldType, std::size_t fieldOffset, std::ptrdiff_t fieldStride, UnsignedShort fieldArraySize = 0, SceneFieldFlags flags = {}) explicit constexpr noexcept
Construct an offset-only field.
SceneFieldData(SceneField name, std::size_t size, SceneMappingType mappingType, std::size_t mappingOffset, std::ptrdiff_t mappingStride, SceneFieldType fieldType, std::size_t fieldOffset, std::ptrdiff_t fieldStride, SceneFieldFlags flags) explicit constexpr noexcept
SceneFieldData(SceneField name, std::size_t size, SceneMappingType mappingType, std::size_t mappingOffset, std::ptrdiff_t mappingStride, std::size_t fieldOffset, std::size_t fieldBitOffset, std::ptrdiff_t fieldStride, UnsignedShort fieldArraySize = 0, SceneFieldFlags flags = {}) explicit constexpr noexcept
Construct an offset-only bit field.
SceneFieldData(SceneField name, std::size_t size, SceneMappingType mappingType, std::size_t mappingOffset, std::ptrdiff_t mappingStride, std::size_t fieldOffset, std::size_t fieldBitOffset, std::ptrdiff_t fieldStride, SceneFieldFlags flags) explicit constexpr noexcept
SceneFieldData(SceneField name, std::size_t size, SceneMappingType mappingType, std::size_t mappingOffset, std::ptrdiff_t mappingStride, std::size_t stringOffset, SceneFieldType fieldType, std::size_t fieldOffset, std::ptrdiff_t fieldStride, SceneFieldFlags flags = {}) explicit constexpr noexcept
Construct an offset-only string field.

Public functions

auto flags() const -> SceneFieldFlags constexpr
Field flags.
auto name() const -> SceneField constexpr
Field name.
auto size() const -> std::size_t constexpr
Number of entries.
auto mappingType() const -> SceneMappingType constexpr
Object mapping type.
auto mappingData() const -> Containers::StridedArrayView1D<const void>
Type-erased object mapping data.
auto mappingData(Containers::ArrayView<const void> data) const -> Containers::StridedArrayView1D<const void>
Type-erased object mapping data for an offset-only field.
auto fieldType() const -> SceneFieldType
Field type.
auto fieldArraySize() const -> UnsignedShort
Field array size.
auto fieldData() const -> Containers::StridedArrayView1D<const void>
Type-erased field data.
auto fieldData(Containers::ArrayView<const void> data) const -> Containers::StridedArrayView1D<const void>
Type-erased field data for an offset-only field.
auto fieldBitData() const -> Containers::StridedBitArrayView2D
Bit field data.
auto fieldBitData(Containers::ArrayView<const void> data) const -> Containers::StridedBitArrayView2D
Bit field data for an offset-only field.
auto stringData() const -> const char*
Base data pointer for a string field.
auto stringData(Containers::ArrayView<const void> data) const -> const char*
Base data pointer for an offset-only string field.

Function documentation

Magnum::Trade::SceneFieldData::SceneFieldData() explicit constexpr noexcept

Default constructor.

Leaves contents at unspecified values. Provided as a convenience for initialization of the field array for SceneData, expected to be replaced with concrete values later.

Magnum::Trade::SceneFieldData::SceneFieldData(SceneField name, SceneMappingType mappingType, const Containers::StridedArrayView1D<const void>& mappingData, SceneFieldType fieldType, const Containers::StridedArrayView1D<const void>& fieldData, UnsignedShort fieldArraySize = 0, SceneFieldFlags flags = {}) explicit constexpr noexcept

Construct from type-erased views.

Parameters
name Field name
mappingType Object mapping type
mappingData Object mapping data
fieldType Field type. SceneFieldType::Bit and SceneFieldType::String* values are not allowed here.
fieldData Field data
fieldArraySize Field array size. Use 0 for non-array fields.
flags Field flags. SceneFieldFlag::OffsetOnly and SceneFieldFlag::NullTerminatedString is not allowed here.

Expects that mappingData and fieldData have the same size; and for builtin fields that fieldType corresponds to name and fieldArraySize is zero.

Magnum::Trade::SceneFieldData::SceneFieldData(SceneField name, SceneMappingType mappingType, const Containers::StridedArrayView1D<const void>& mappingData, SceneFieldType fieldType, const Containers::StridedArrayView1D<const void>& fieldData, SceneFieldFlags flags) explicit constexpr noexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Magnum::Trade::SceneFieldData::SceneFieldData(SceneField name, const Containers::StridedArrayView2D<const char>& mappingData, SceneFieldType fieldType, const Containers::StridedArrayView2D<const char>& fieldData, UnsignedShort fieldArraySize = 0, SceneFieldFlags flags = {}) explicit noexcept

Construct from 2D type-erased views.

Parameters
name Field name
mappingData Object mapping data
fieldType Field type. SceneFieldType::Bit and SceneFieldType::String* values are not allowed here.
fieldData Field data
fieldArraySize Field array size. Use 0 for non-array fields.
flags Field flags. SceneFieldFlag::OffsetOnly and SceneFieldFlag::NullTerminatedString is not allowed here.

Expects that mappingData and fieldData have the same size in the first dimension; that the second dimension of mappingData is contiguous and its size is either 1, 2, 4 or 8, corresponding to one of the SceneMappingType values; that the second dimension of fieldData is contiguous and its size matches fieldType and fieldArraySize; and that for builtin fields fieldType corresponds to name and fieldArraySize is zero.

Magnum::Trade::SceneFieldData::SceneFieldData(SceneField name, const Containers::StridedArrayView2D<const char>& mappingData, SceneFieldType fieldType, const Containers::StridedArrayView2D<const char>& fieldData, SceneFieldFlags flags) explicit noexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<class T, class U>
Magnum::Trade::SceneFieldData::SceneFieldData(SceneField name, const Containers::StridedArrayView1D<T>& mappingData, const Containers::StridedArrayView1D<U>& fieldData, SceneFieldFlags flags = {}) explicit constexpr noexcept

Constructor.

Parameters
name Field name
mappingData Object mapping data
fieldData Field data
flags Field flags. SceneFieldFlag::OffsetOnly and SceneFieldFlag::NullTerminatedString is not allowed here.

Detects SceneMappingType based on T and SceneFieldType based on U and calls SceneFieldData(SceneField, SceneMappingType, const Containers::StridedArrayView1D<const void>&, SceneFieldType, const Containers::StridedArrayView1D<const void>&, UnsignedShort, SceneFieldFlags). For all types known by Magnum, the detected SceneFieldType is of the same name as the type (so e.g. Vector3ui gets recognized as SceneFieldType::Vector3ui).

template<class T, class U>
Magnum::Trade::SceneFieldData::SceneFieldData(SceneField name, const Containers::StridedArrayView1D<T>& mappingData, const Containers::ArrayView<U>& fieldData, SceneFieldFlags flags = {}) explicit constexpr noexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<class T, class U>
Magnum::Trade::SceneFieldData::SceneFieldData(SceneField name, const Containers::ArrayView<T>& mappingData, const Containers::StridedArrayView1D<U>& fieldData, SceneFieldFlags flags = {}) explicit constexpr noexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<class T, class U>
Magnum::Trade::SceneFieldData::SceneFieldData(SceneField name, const Containers::ArrayView<T>& mappingData, const Containers::ArrayView<U>& fieldData, SceneFieldFlags flags = {}) explicit constexpr noexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<class T, class U>
Magnum::Trade::SceneFieldData::SceneFieldData(SceneField name, const Containers::StridedArrayView1D<T>& mappingData, const Containers::StridedArrayView2D<U>& fieldData, SceneFieldFlags flags = {}) explicit constexpr noexcept

Construct an array field.

Parameters
name Field name
mappingData Object mapping data
fieldData Field data
flags Field flags. SceneFieldFlag::OffsetOnly and SceneFieldFlag::NullTerminatedString is not allowed here.

Detects SceneMappingType based on T and SceneFieldType based on U and calls SceneFieldData(SceneField, SceneMappingType, const Containers::StridedArrayView1D<const void>&, SceneFieldType, const Containers::StridedArrayView1D<const void>&, UnsignedShort, SceneFieldFlags) with the fieldData second dimension size passed to fieldArraySize. Expects that the second dimension of fieldData is contiguous. At the moment only custom fields can be arrays, which means this constructor can't be used with a builtin name. See SceneFieldData(SceneField, const Containers::StridedArrayView1D<T>&, const Containers::StridedArrayView1D<U>&, SceneFieldFlags) for details about SceneMappingType and SceneFieldType detection.

template<class T, class U>
Magnum::Trade::SceneFieldData::SceneFieldData(SceneField name, const Containers::ArrayView<T>& mappingData, const Containers::StridedArrayView2D<U>& fieldData, SceneFieldFlags flags = {}) explicit constexpr noexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Magnum::Trade::SceneFieldData::SceneFieldData(SceneField name, SceneMappingType mappingType, const Containers::StridedArrayView1D<const void>& mappingData, const Containers::StridedBitArrayView1D& fieldData, SceneFieldFlags flags = {}) explicit constexpr noexcept

Construct a bit field with a type-erased mapping view.

Parameters
name Field name
mappingType Object mapping type
mappingData Object mapping data
fieldData Field data
flags Field flags. SceneFieldFlag::OffsetOnly and SceneFieldFlag::NullTerminatedString is not allowed here.

Field type is implicitly SceneFieldType::Bit and array size is 0. Expects that mappingData and fieldData have the same size. At the moment only custom fields can be bits, which means this constructor can't be used with a builtin name.

Magnum::Trade::SceneFieldData::SceneFieldData(SceneField name, const Containers::StridedArrayView2D<const char>& mappingData, const Containers::StridedBitArrayView1D& fieldData, SceneFieldFlags flags = {}) explicit noexcept

Construct a bit field with a 2D type-erased mapping view.

Parameters
name Field name
mappingData Object mapping data
fieldData Field data
flags Field flags. SceneFieldFlag::OffsetOnly and SceneFieldFlag::NullTerminatedString is not allowed here.

Field type is implicitly SceneFieldType::Bit and array size is 0. Expects that mappingData and fieldData have the same size in the first dimension and that the second dimension of mappingData is contiguous and its size is either 1, 2, 4 or 8, corresponding to one of the SceneMappingType values. At the moment only custom fields can be bits, which means this constructor can't be used with a builtin name.

template<class T>
Magnum::Trade::SceneFieldData::SceneFieldData(SceneField name, const Containers::StridedArrayView1D<T>& mappingData, const Containers::StridedBitArrayView1D& fieldData, SceneFieldFlags flags = {}) explicit constexpr noexcept

Construct a bit field.

Parameters
name Field name
mappingData Object mapping data
fieldData Field data
flags Field flags. SceneFieldFlag::OffsetOnly and SceneFieldFlag::NullTerminatedString is not allowed here.

Detects SceneMappingType based on T and calls SceneFieldData(SceneField, SceneMappingType, const Containers::StridedArrayView1D<const void>&, const Containers::StridedBitArrayView1D&, SceneFieldFlags).

template<class T>
Magnum::Trade::SceneFieldData::SceneFieldData(SceneField name, const Containers::ArrayView<T>& mappingData, const Containers::StridedBitArrayView1D& fieldData, SceneFieldFlags flags = {}) explicit constexpr noexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Magnum::Trade::SceneFieldData::SceneFieldData(SceneField name, SceneMappingType mappingType, const Containers::StridedArrayView1D<const void>& mappingData, const Containers::StridedBitArrayView2D& fieldData, SceneFieldFlags flags = {}) explicit constexpr noexcept

Construct an array bit field with a type-erased mapping view.

Parameters
name Field name
mappingType Object mapping type
mappingData Object mapping data
fieldData Field data
flags Field flags. SceneFieldFlag::OffsetOnly and SceneFieldFlag::NullTerminatedString is not allowed here.

Field type is implicitly SceneFieldType::Bit. Expects that mappingData and fieldData have the same size in the first dimension and that the second dimension of fieldData is contiguous. At the moment only custom fields can be bits, which means this constructor can't be used with a builtin name.

Magnum::Trade::SceneFieldData::SceneFieldData(SceneField name, const Containers::StridedArrayView2D<const char>& mappingData, const Containers::StridedBitArrayView2D& fieldData, SceneFieldFlags flags = {}) explicit noexcept

Construct an array bit field with a 2D type-erased mapping view.

Parameters
name Field name
mappingData Object mapping data
fieldData Field data
flags Field flags. SceneFieldFlag::OffsetOnly and SceneFieldFlag::NullTerminatedString is not allowed here.

Field type is implicitly SceneFieldType::Bit and array size is 0. Expects that mappingData and fieldData have the same size in the first dimension, that the second dimension of mappingData is contiguous and its size is either 1, 2, 4 or 8, corresponding to one of the SceneMappingType values, and that the second dimension of fieldData is contiguous. At the moment only custom fields can be bits, which means this constructor can't be used with a builtin name.

template<class T>
Magnum::Trade::SceneFieldData::SceneFieldData(SceneField name, const Containers::StridedArrayView1D<T>& mappingData, const Containers::StridedBitArrayView2D& fieldData, SceneFieldFlags flags = {}) explicit constexpr noexcept

Construct an array bit field.

Parameters
name Field name
mappingData Object mapping data
fieldData Field data
flags Field flags. SceneFieldFlag::OffsetOnly and SceneFieldFlag::NullTerminatedString is not allowed here.

Detects SceneMappingType based on T and calls SceneFieldData(SceneField, SceneMappingType, const Containers::StridedArrayView1D<const void>&, const Containers::StridedBitArrayView2D&, SceneFieldFlags).

template<class T>
Magnum::Trade::SceneFieldData::SceneFieldData(SceneField name, const Containers::ArrayView<T>& mappingData, const Containers::StridedBitArrayView2D& fieldData, SceneFieldFlags flags = {}) explicit constexpr noexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Magnum::Trade::SceneFieldData::SceneFieldData(SceneField name, SceneMappingType mappingType, const Containers::StridedArrayView1D<const void>& mappingData, const char* stringData, SceneFieldType fieldType, const Containers::StridedArrayView1D<const void>& fieldData, SceneFieldFlags flags = {}) explicit noexcept

Construct a string field from type-erased views.

Parameters
name Field name
mappingType Object mapping type
mappingData Object mapping data
stringData String to which the field offset or range data are relative to
fieldType Field type. Only SceneFieldType::String* values are allowed here.
fieldData Field data
flags Field flags. SceneFieldFlag::OffsetOnly is not allowed here. SceneFieldFlag::NullTerminatedString is set implicitly for SceneFieldType::StringRangeNullTerminated8, StringRangeNullTerminated16, StringRangeNullTerminated32 and StringRangeNullTerminated64.

Expects that mappingData and fieldData have the same size. At the moment only custom fields can be strings, which means this constructor can't be used with a builtin name.

Magnum::Trade::SceneFieldData::SceneFieldData(SceneField name, const Containers::StridedArrayView2D<const char>& mappingData, const char* stringData, SceneFieldType fieldType, const Containers::StridedArrayView2D<const char>& fieldData, SceneFieldFlags flags = {}) explicit noexcept

Construct a string field from 2D type-erased views.

Parameters
name Field name
mappingData Object mapping data
stringData String to which the field offset or range data are relative to
fieldType Field type. Only SceneFieldType::String* values are allowed here.
fieldData Field data
flags Field flags. SceneFieldFlag::OffsetOnly is not allowed here. SceneFieldFlag::NullTerminatedString is set implicitly for SceneFieldType::StringRangeNullTerminated8, StringRangeNullTerminated16, StringRangeNullTerminated32 and StringRangeNullTerminated64.

Expects that mappingData and fieldData have the same size in the first dimension; that the second dimension of mappingData is contiguous and its size is either 1, 2, 4 or 8, corresponding to one of the SceneMappingType values and that the second dimension of fieldData is contiguous and its size matches fieldType. At the moment only custom fields can be strings, which means this constructor can't be used with a builtin name.

template<class T>
Magnum::Trade::SceneFieldData::SceneFieldData(SceneField name, const Containers::StridedArrayView1D<T>& mappingData, const char* stringData, SceneFieldType fieldType, const Containers::StridedArrayView1D<const void>& fieldData, SceneFieldFlags flags = {}) explicit noexcept

Construct a string field.

Parameters
name Field name
mappingData Object mapping data
stringData String to which the field offset or range data are relative to
fieldType Field type. Only SceneFieldType::String* values are allowed here.
fieldData Field data
flags Field flags. SceneFieldFlag::OffsetOnly is not allowed here. SceneFieldFlag::NullTerminatedString is set implicitly for SceneFieldType::StringRangeNullTerminated8, StringRangeNullTerminated16, StringRangeNullTerminated32 and StringRangeNullTerminated64.

template<class T>
Magnum::Trade::SceneFieldData::SceneFieldData(SceneField name, const Containers::ArrayView<T>& mappingData, const char* stringData, SceneFieldType fieldType, const Containers::StridedArrayView1D<const void>& fieldData, SceneFieldFlags flags = {}) explicit noexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Magnum::Trade::SceneFieldData::SceneFieldData(SceneField name, std::size_t size, SceneMappingType mappingType, std::size_t mappingOffset, std::ptrdiff_t mappingStride, SceneFieldType fieldType, std::size_t fieldOffset, std::ptrdiff_t fieldStride, UnsignedShort fieldArraySize = 0, SceneFieldFlags flags = {}) explicit constexpr noexcept

Construct an offset-only field.

Parameters
name Field name
size Number of entries
mappingType Object mapping type
mappingOffset Object mapping data offset
mappingStride Object mapping data stride
fieldType Field type
fieldOffset Field data offset
fieldStride Field data stride
fieldArraySize Field array size. Use 0 for non-array fields.
flags Field flags. SceneFieldFlag::OffsetOnly is set implicitly. SceneFieldFlag::NullTerminatedString is not allowed here.

Instances created this way refer to offsets in unspecified external scene data instead of containing the data views directly. Useful when the location of the scene data array is not known at field construction time. Expects that for builtin fields fieldType corresponds to name and fieldArraySize is zero.

Note that due to the constexpr nature of this constructor, no mappingType checks against mappingStride or fieldType / fieldArraySize checks against fieldStride can be done. You're encouraged to use the SceneFieldData(SceneField, SceneMappingType, const Containers::StridedArrayView1D<const void>&, SceneFieldType, const Containers::StridedArrayView1D<const void>&, UnsignedShort, SceneFieldFlags) constructor if you want additional safeguards.

SceneFieldType::Bit and SceneFieldType::String* values are not allowed in fieldType. For offset-only bit fields use the SceneFieldData(SceneField, std::size_t, SceneMappingType, std::size_t, std::ptrdiff_t, std::size_t, std::size_t, std::ptrdiff_t, UnsignedShort, SceneFieldFlags) constructor instead, for offset-only string fields use SceneFieldData(SceneField, std::size_t, SceneMappingType, std::size_t, std::ptrdiff_t, std::size_t, SceneFieldType, std::size_t, std::ptrdiff_t, SceneFieldFlags) instead.

Magnum::Trade::SceneFieldData::SceneFieldData(SceneField name, std::size_t size, SceneMappingType mappingType, std::size_t mappingOffset, std::ptrdiff_t mappingStride, SceneFieldType fieldType, std::size_t fieldOffset, std::ptrdiff_t fieldStride, SceneFieldFlags flags) explicit constexpr noexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Magnum::Trade::SceneFieldData::SceneFieldData(SceneField name, std::size_t size, SceneMappingType mappingType, std::size_t mappingOffset, std::ptrdiff_t mappingStride, std::size_t fieldOffset, std::size_t fieldBitOffset, std::ptrdiff_t fieldStride, UnsignedShort fieldArraySize = 0, SceneFieldFlags flags = {}) explicit constexpr noexcept

Construct an offset-only bit field.

Parameters
name Field name
size Number of entries
mappingType Object mapping type
mappingOffset Object mapping data offset
mappingStride Object mapping data stride
fieldOffset Field data offset in bytes
fieldBitOffset Field data bit offset
fieldStride Field data stride in bits
fieldArraySize Field array size. Use 0 for non-array fields.
flags Field flags. SceneFieldFlag::OffsetOnly is set implicitly. SceneFieldFlag::NullTerminatedString is not allowed here.

Instances created this way refer to offsets in unspecified external scene data instead of containing the data views directly. Useful when the location of the scene data array is not known at field construction time. At the moment only custom fields can be bits, which means this constructor can't be used with a builtin name. Expects that fieldBitOffset is less than 8, for consistency with Containers::StridedBitArrayView also expects that size fits into 29 bits on 32-bit platforms and into 61 bits on 64-bit platforms.

Note that due to the constexpr nature of this constructor, no mappingType checks against mappingStride can be done. You're encouraged to use the SceneFieldData(SceneField, SceneMappingType, const Containers::StridedArrayView1D<const void>&, const Containers::StridedBitArrayView1D&, SceneFieldFlags) or SceneFieldData(SceneField, SceneMappingType, const Containers::StridedArrayView1D<const void>&, const Containers::StridedBitArrayView2D&, SceneFieldFlags) constructors if you want additional safeguards.

Magnum::Trade::SceneFieldData::SceneFieldData(SceneField name, std::size_t size, SceneMappingType mappingType, std::size_t mappingOffset, std::ptrdiff_t mappingStride, std::size_t fieldOffset, std::size_t fieldBitOffset, std::ptrdiff_t fieldStride, SceneFieldFlags flags) explicit constexpr noexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Magnum::Trade::SceneFieldData::SceneFieldData(SceneField name, std::size_t size, SceneMappingType mappingType, std::size_t mappingOffset, std::ptrdiff_t mappingStride, std::size_t stringOffset, SceneFieldType fieldType, std::size_t fieldOffset, std::ptrdiff_t fieldStride, SceneFieldFlags flags = {}) explicit constexpr noexcept

Construct an offset-only string field.

Parameters
name Field name
size Number of entries
mappingType Object mapping type
mappingOffset Object mapping data offset
mappingStride Object mapping data stride
stringOffset String data offset to which the field offset or range data are relative to
fieldType Field type. Only SceneFieldType::String* values are allowed here.
fieldOffset Field data offset
fieldStride Field data stride
flags Field flags. SceneFieldFlag::OffsetOnly is set implicitly. SceneFieldFlag::NullTerminatedString is set implicitly for SceneFieldType::StringRangeNullTerminated8, StringRangeNullTerminated16, StringRangeNullTerminated32 and StringRangeNullTerminated64.

Instances created this way refer to offsets in unspecified external scene data instead of containing the data views directly. Useful when the location of the scene data array is not known at field construction time. At the moment only custom fields can be strings, which means this constructor can't be used with a builtin name.

Note that due to the constexpr nature of this constructor, no mappingType checks against mappingStride or fieldType checks against fieldStride can be done. You're encouraged to use the SceneFieldData(SceneField, SceneMappingType, const Containers::StridedArrayView1D<const void>&, SceneFieldType, const Containers::StridedArrayView1D<const void>&, UnsignedShort, SceneFieldFlags) constructor if you want additional safeguards.

Containers::StridedArrayView1D<const void> Magnum::Trade::SceneFieldData::mappingData() const

Type-erased object mapping data.

Expects that the field does not have SceneFieldFlag::OffsetOnly set, in that case use the mappingData(Containers::ArrayView<const void>) const overload instead.

Containers::StridedArrayView1D<const void> Magnum::Trade::SceneFieldData::mappingData(Containers::ArrayView<const void> data) const

Type-erased object mapping data for an offset-only field.

If the field does not have SceneFieldFlag::OffsetOnly set, the data parameter is ignored.

Containers::StridedArrayView1D<const void> Magnum::Trade::SceneFieldData::fieldData() const

Type-erased field data.

Expects that the field is not SceneFieldType::Bit and does not have SceneFieldFlag::OffsetOnly set. For bit fields use fieldBitData() instead, for offset-only fields use the fieldData(Containers::ArrayView<const void>) const overload instead.

Containers::StridedArrayView1D<const void> Magnum::Trade::SceneFieldData::fieldData(Containers::ArrayView<const void> data) const

Type-erased field data for an offset-only field.

Expects that the field is not SceneFieldType::Bit, in that case use fieldBitData(Containers::ArrayView<const void>) const instead. If the field does not have SceneFieldFlag::OffsetOnly set, the data parameter is ignored.

Containers::StridedBitArrayView2D Magnum::Trade::SceneFieldData::fieldBitData() const

Bit field data.

Expects that the field is SceneFieldType::Bit and does not have SceneFieldFlag::OffsetOnly set. For non-bit fields use fieldData() instead, for offset-only bit fields use the fieldBitData(Containers::ArrayView<const void>) const overload instead. The returned view is 2D with the second dimension being always 1 for non-array fields. The second dimension is always contiguous.

Containers::StridedBitArrayView2D Magnum::Trade::SceneFieldData::fieldBitData(Containers::ArrayView<const void> data) const

Bit field data for an offset-only field.

Expects that the field is SceneFieldType::Bit, otherwise use fieldData(Containers::ArrayView<const void>) const instead. If the field does not have SceneFieldFlag::OffsetOnly set, the data parameter is ignored. The returned view is 2D with the second dimension being always 1 for non-array fields. The second dimension is always contiguous.

const char* Magnum::Trade::SceneFieldData::stringData() const

Base data pointer for a string field.

Offsets and ranges returned from fieldData() are relative to this pointer. Can be only called on SceneFieldType::StringOffset*, StringRange* and StringRangeNullTerminated* fields.

Expects that the field does not have SceneFieldFlag::OffsetOnly set, in that case use the stringData(Containers::ArrayView<const void>) const overload instead.

const char* Magnum::Trade::SceneFieldData::stringData(Containers::ArrayView<const void> data) const

Base data pointer for an offset-only string field.

Offsets and ranges returned from SceneData::field() are relative to this pointer. Can be only called on SceneFieldType::StringOffset*, StringRange* and StringRangeNullTerminated* fields.

If the field does not have SceneFieldFlag::OffsetOnly set, the data parameter is ignored.

Containers::Array<SceneFieldData> sceneFieldDataNonOwningArray(Containers::ArrayView<const SceneFieldData> view) new in Git master

Create a non-owning array of SceneFieldData items.

Useful when you have the field definitions statically defined (for example when the data themselves are already defined at compile time) and don't want to allocate just to pass those to SceneData.