class new in Git master
#include <Magnum/Trade/SceneData.h>
SceneFieldData Scene field data.
Convenience type for populating SceneData, see its documentation for an introduction. Additionally usable in various SceneTools algorithms such as SceneTools::
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::
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::
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::
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::
Bit fields
Bit fields have dedicated constructors taking a Containers::
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::
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::SceneFieldType::String* values are not allowed here. |
fieldData | Field data |
fieldArraySize | Field array size. Use 0 for non-array fields. |
flags | Field flags. SceneFieldFlag:: |
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::SceneFieldType::String* values are not allowed here. |
fieldData | Field data |
fieldArraySize | Field array size. Use 0 for non-array fields. |
flags | Field flags. SceneFieldFlag:: |
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:: |
Detects SceneMappingType based on T
and SceneFieldType based on U
and calls SceneFieldData(SceneField, SceneMappingType, const Containers::
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:: |
Detects SceneMappingType based on T
and SceneFieldType based on U
and calls SceneFieldData(SceneField, SceneMappingType, const Containers::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::
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:: |
Field type is implicitly SceneFieldType::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:: |
Field type is implicitly SceneFieldType::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:: |
Detects SceneMappingType based on T
and calls SceneFieldData(SceneField, SceneMappingType, const Containers::
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:: |
Field type is implicitly SceneFieldType::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:: |
Field type is implicitly SceneFieldType::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:: |
Detects SceneMappingType based on T
and calls SceneFieldData(SceneField, SceneMappingType, const Containers::
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:: |
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:: |
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:: |
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:: |
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::
SceneFieldType::SceneFieldType::String*
values are not allowed in fieldType
. For offset-only bit fields use the SceneFieldData(SceneField, std::
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:: |
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::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::
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:: |
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::
Containers:: StridedArrayView1D<const void> Magnum:: Trade:: SceneFieldData:: mappingData() const
Type-erased object mapping data.
Expects that the field does not have SceneFieldFlag::
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::data
parameter is ignored.
Containers:: StridedArrayView1D<const void> Magnum:: Trade:: SceneFieldData:: fieldData() const
Type-erased field data.
Expects that the field is not SceneFieldType::
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::data
parameter is ignored.
Containers:: StridedBitArrayView2D Magnum:: Trade:: SceneFieldData:: fieldBitData() const
Bit field data.
Expects that the field is SceneFieldType::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::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::
Expects that the field does not have SceneFieldFlag::
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::
If the field does not have SceneFieldFlag::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.