cesium-native 0.43.0
Loading...
Searching...
No Matches
AccessorWriter.h
1#pragma once
2
3#include "CesiumGltf/AccessorView.h"
4
5namespace CesiumGltf {
6
10template <class T> class AccessorWriter final {
11private:
12 AccessorView<T> _accessor;
13
14public:
18 typedef T value_type;
19
20 AccessorWriter() : _accessor() {}
21
25 AccessorWriter(const AccessorView<T>& accessorView)
26 : _accessor(accessorView) {}
27
30 AccessorWriter(std::byte* pData, int64_t stride, int64_t offset, int64_t size)
31 : _accessor(pData, stride, offset, size) {}
32
34 AccessorWriter(Model& model, const Accessor& accessor)
35 : _accessor(model, accessor) {}
36
38 AccessorWriter(Model& model, int32_t accessorIndex) noexcept
39 : _accessor(model, accessorIndex) {}
40
42 const T& operator[](int64_t i) const { return this->_accessor[i]; }
43
45 T& operator[](int64_t i) { return const_cast<T&>(this->_accessor[i]); }
46
48 int64_t size() const noexcept { return this->_accessor.size(); }
49
56 AccessorViewStatus status() const noexcept {
57 return this->_accessor.status();
58 }
59
61 int64_t stride() const noexcept { return this->_accessor.stride(); }
62
64 int64_t offset() const noexcept { return this->_accessor.offset(); }
65
67 std::byte* data() noexcept {
68 return const_cast<std::byte*>(this->_accessor.data());
69 }
70};
71
72} // namespace CesiumGltf
A view on the data of one accessor of a glTF asset.
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...
int64_t stride() const noexcept
Returns the stride of this accessor, which is the number of bytes from the start of one element to th...
int64_t size() const noexcept
Returns the size (number of elements) of this accessor.
const std::byte * data() const noexcept
Returns a pointer to the first byte of this accessor view's data. The elements are stored contiguousl...
AccessorViewStatus status() const noexcept
Gets the status of this accessor view.
Provides write access to an AccessorView.
std::byte * data() noexcept
Returns a pointer to the first byte of this accessor view's data. The elements are stored contiguousl...
T & operator[](int64_t i)
Provides the specified accessor element.
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...
AccessorWriter(std::byte *pData, int64_t stride, int64_t offset, int64_t size)
Creates a new instance from low-level parameters.
AccessorWriter(Model &model, const Accessor &accessor)
Creates a new instance from a given model and Accessor.
AccessorWriter(Model &model, int32_t accessorIndex) noexcept
Creates a new instance from a given model and accessor index.
int64_t stride() const noexcept
Returns the stride of this accessor, which is the number of bytes from the start of one element to th...
AccessorWriter(const AccessorView< T > &accessorView)
Constructs a new instance from an AccessorView.
int64_t size() const noexcept
Returns the size (number of elements) of this accessor.
const T & operator[](int64_t i) const
Provides the specified accessor element.
AccessorViewStatus status() const noexcept
Gets the status of this accessor writer.
T value_type
The type of the elements in the accessor.
Classes for working with glTF models.
AccessorViewStatus
Indicates the status of an accessor view.
This class is not meant to be instantiated directly. Use Accessor instead.
Definition Accessor.h:12
This class is not meant to be instantiated directly. Use Model instead.
Definition Model.h:14