|
cesium-native 0.62.0
|
A view on the data of one accessor of a glTF asset. More...
#include <CesiumGltf/AccessorView.h>
Public Types | |
| typedef T | value_type |
| The type of the elements in the accessor. | |
Public Member Functions | |
| AccessorView (AccessorViewStatus status=AccessorViewStatus::InvalidAccessorIndex) | |
| Construct a new instance not pointing to any data. | |
| AccessorView (const std::byte *pData, int64_t stride, int64_t offset, int64_t size, bool normalized) | |
| Creates a new instance from low-level parameters. | |
| AccessorView (const Model &model, const Accessor &accessor) noexcept | |
Creates a new instance from a given model and Accessor. | |
| AccessorView (const Model &model, int32_t accessorIndex) noexcept | |
| Creates a new instance from a given model and accessor index. | |
| const T & | operator[] (int64_t i) const |
| Provides the specified accessor element. | |
| int64_t | size () const noexcept |
| Returns the size (number of elements) of this accessor. | |
| AccessorViewStatus | status () const noexcept |
| Gets the status of this accessor view. | |
| int64_t | stride () const noexcept |
| Returns the stride of this accessor, which is the number of bytes from the start of one element to the start of the next. | |
| int64_t | offset () const noexcept |
| Returns the offset of this accessor, which is the number of bytes from the start of the buffer to the first element. | |
| bool | normalized () const noexcept |
| Returns whether the accessor values are normalized. | |
| const std::byte * | data () const noexcept |
Returns a pointer to the first byte of this accessor view's data. The elements are stored contiguously, so the next one starts stride bytes later. | |
A view on the data of one accessor of a glTF asset.
It provides the actual accessor data like an array of elements. The type of the accessor elements is determined by the template parameter. Instances are usually from an Accessor, and the operator[]() can be used to access the elements:
| T | The type of the elements in the accessor. |
Definition at line 87 of file AccessorView.h.
| typedef T CesiumGltf::AccessorView< T >::value_type |
The type of the elements in the accessor.
Definition at line 100 of file AccessorView.h.
|
inline |
Construct a new instance not pointing to any data.
The new instance will have a size of 0 and a status of AccessorViewStatus::InvalidAccessorIndex.
| status | The status of the new accessor. Defaults to AccessorViewStatus::InvalidAccessorIndex. |
Definition at line 111 of file AccessorView.h.
|
inline |
Creates a new instance from low-level parameters.
The provided parameters are not validated in any way, and so this overload can easily be used to access invalid memory.
| pData | The raw data buffer from which to read. |
| stride | The stride, in bytes, between successive elements. |
| offset | The offset from the start of the buffer to the first element. |
| size | The total number of elements. |
| normalized | Whether the accessor values are normalized. |
Definition at line 132 of file AccessorView.h.
|
inlinenoexcept |
Creates a new instance from a given model and Accessor.
If the accessor cannot be viewed, the construct will still complete successfully without throwing an exception. However, size will return 0 and status will indicate what went wrong.
| model | The model to access. |
| accessor | The accessor to view. |
Definition at line 156 of file AccessorView.h.
|
inlinenoexcept |
Creates a new instance from a given model and accessor index.
If the accessor cannot be viewed, the construct will still complete successfully without throwing an exception. However, size will return 0 and status will indicate what went wrong.
| model | The model to access. |
| accessorIndex | The index of the accessor to view in the model's Model::accessors list. |
Definition at line 173 of file AccessorView.h.
|
inlinenoexcept |
Returns a pointer to the first byte of this accessor view's data. The elements are stored contiguously, so the next one starts stride bytes later.
Definition at line 247 of file AccessorView.h.
|
inlinenoexcept |
Returns whether the accessor values are normalized.
Definition at line 239 of file AccessorView.h.
|
inlinenoexcept |
Returns the offset of this accessor, which is the number of bytes from the start of the buffer to the first element.
Definition at line 232 of file AccessorView.h.
|
inline |
Provides the specified accessor element.
| i | The index of the element. |
| A | std::range_error if the given index is negative or not smaller than the size of this accessor. |
Definition at line 192 of file AccessorView.h.
|
inlinenoexcept |
Returns the size (number of elements) of this accessor.
This is the number of elements of type T that this accessor contains.
Definition at line 208 of file AccessorView.h.
|
inlinenoexcept |
Gets the status of this accessor view.
Indicates whether the view accurately reflects the accessor's data, or whether an error occurred.
Definition at line 216 of file AccessorView.h.
|
inlinenoexcept |
Returns the stride of this accessor, which is the number of bytes from the start of one element to the start of the next.
Definition at line 224 of file AccessorView.h.