cesium-native 0.48.0
Loading...
Searching...
No Matches
ImageAsset.h
1#pragma once
2
3#include <CesiumGltf/Ktx2TranscodeTargets.h>
4#include <CesiumGltf/Library.h>
5#include <CesiumUtility/SharedAsset.h>
6
7#include <cstddef>
8#include <cstdint>
9#include <optional>
10#include <vector>
11
12namespace CesiumGltf {
13
17struct CESIUMGLTF_API ImageAssetMipPosition {
21 size_t byteOffset;
22
26 size_t byteSize;
27};
28
33struct CESIUMGLTF_API ImageAsset final
34 : public CesiumUtility::SharedAsset<ImageAsset> {
38 int32_t width = 0;
39
43 int32_t height = 0;
44
48 int32_t channels = 4;
49
53 int32_t bytesPerChannel = 1;
54
61
70 std::vector<ImageAssetMipPosition> mipPositions;
71
99 std::vector<std::byte> pixelData;
100
114 int64_t sizeBytes = -1;
115
119 ImageAsset() = default;
120
127 int64_t getSizeBytes() const {
128 return this->sizeBytes >= 0 ? this->sizeBytes
129 : static_cast<int64_t>(this->pixelData.size());
130 }
131};
132} // namespace CesiumGltf
An asset that is potentially shared between multiple objects, such as an image shared between multipl...
Definition SharedAsset.h:52
Classes for working with glTF models.
GpuCompressedPixelFormat
Supported GPU compressed pixel formats.
The byte range within a buffer where this mip exists.
Definition ImageAsset.h:17
size_t byteOffset
The byte index where this mip begins.
Definition ImageAsset.h:21
size_t byteSize
The size in bytes of this mip.
Definition ImageAsset.h:26
int64_t sizeBytes
The effective size of this image, in bytes, for estimating resource usage for caching purposes.
Definition ImageAsset.h:114
int32_t bytesPerChannel
The number of bytes per channel.
Definition ImageAsset.h:53
int32_t height
The height of the image in pixels.
Definition ImageAsset.h:43
std::vector< ImageAssetMipPosition > mipPositions
The offset of each mip in the pixel data.
Definition ImageAsset.h:70
ImageAsset()=default
Constructs an empty image asset.
int64_t getSizeBytes() const
Gets the size of this asset, in bytes.
Definition ImageAsset.h:127
int32_t width
The width of the image in pixels.
Definition ImageAsset.h:38
int32_t channels
The number of channels per pixel.
Definition ImageAsset.h:48
GpuCompressedPixelFormat compressedPixelFormat
The gpu compressed pixel format for this image or NONE if it is not compressed.
Definition ImageAsset.h:59
std::vector< std::byte > pixelData
The pixel data.
Definition ImageAsset.h:99