@@ -1927,7 +1927,16 @@ bool VTF::hasImageData() const {
19271927 return this ->format != ImageFormat::EMPTY && this ->width > 0 && this ->height > 0 ;
19281928}
19291929
1930- std::span<std::byte> VTF::getImageDataRaw (uint8_t mip, uint16_t frame, uint8_t face, uint16_t slice) const {
1930+ std::span<const std::byte> VTF::getImageDataRaw (uint8_t mip, uint16_t frame, uint8_t face, uint16_t slice) const {
1931+ if (const auto imageResource = this ->getResource (Resource::TYPE_IMAGE_DATA)) {
1932+ if (uint32_t offset, length; ImageFormatDetails::getDataPosition (offset, length, this ->format , mip, this ->mipCount , frame, this ->frameCount , face, this ->getFaceCount (), this ->width , this ->height , slice, this ->depth )) {
1933+ return imageResource->data .subspan (offset, length);
1934+ }
1935+ }
1936+ return {};
1937+ }
1938+
1939+ std::span<std::byte> VTF::getImageDataRaw (uint8_t mip, uint16_t frame, uint8_t face, uint16_t slice) {
19311940 if (const auto imageResource = this ->getResource (Resource::TYPE_IMAGE_DATA)) {
19321941 if (uint32_t offset, length; ImageFormatDetails::getDataPosition (offset, length, this ->format , mip, this ->mipCount , frame, this ->frameCount , face, this ->getFaceCount (), this ->width , this ->height , slice, this ->depth )) {
19331942 return imageResource->data .subspan (offset, length);
@@ -2057,7 +2066,14 @@ bool VTF::hasThumbnailData() const {
20572066 return this ->thumbnailFormat != ImageFormat::EMPTY && this ->thumbnailWidth > 0 && this ->thumbnailHeight > 0 ;
20582067}
20592068
2060- std::span<std::byte> VTF::getThumbnailDataRaw () const {
2069+ std::span<const std::byte> VTF::getThumbnailDataRaw () const {
2070+ if (const auto thumbnailResource = this ->getResource (Resource::TYPE_THUMBNAIL_DATA)) {
2071+ return thumbnailResource->data ;
2072+ }
2073+ return {};
2074+ }
2075+
2076+ std::span<std::byte> VTF::getThumbnailDataRaw () {
20612077 if (const auto thumbnailResource = this ->getResource (Resource::TYPE_THUMBNAIL_DATA)) {
20622078 return thumbnailResource->data ;
20632079 }
@@ -2153,7 +2169,16 @@ bool VTF::hasFallbackData() const {
21532169 return this ->fallbackWidth > 0 && this ->fallbackHeight > 0 && this ->fallbackMipCount > 0 ;
21542170}
21552171
2156- std::span<std::byte> VTF::getFallbackDataRaw (uint8_t mip, uint16_t frame, uint8_t face) const {
2172+ std::span<const std::byte> VTF::getFallbackDataRaw (uint8_t mip, uint16_t frame, uint8_t face) const {
2173+ if (const auto fallbackResource = this ->getResource (Resource::TYPE_FALLBACK_DATA)) {
2174+ if (uint32_t offset, length; ImageFormatDetails::getDataPosition (offset, length, this ->format , mip, this ->fallbackMipCount , frame, this ->frameCount , face, this ->getFaceCount (), this ->fallbackWidth , this ->fallbackHeight )) {
2175+ return fallbackResource->data .subspan (offset, length);
2176+ }
2177+ }
2178+ return {};
2179+ }
2180+
2181+ std::span<std::byte> VTF::getFallbackDataRaw (uint8_t mip, uint16_t frame, uint8_t face) {
21572182 if (const auto fallbackResource = this ->getResource (Resource::TYPE_FALLBACK_DATA)) {
21582183 if (uint32_t offset, length; ImageFormatDetails::getDataPosition (offset, length, this ->format , mip, this ->fallbackMipCount , frame, this ->frameCount , face, this ->getFaceCount (), this ->fallbackWidth , this ->fallbackHeight )) {
21592184 return fallbackResource->data .subspan (offset, length);
0 commit comments