VTFParser
Simple and modern library for parsing the Valve Texture Format
|
#include <vtf.hpp>
Classes | |
struct | HighResImageExtent |
struct | LowResImageExtent |
Public Member Functions | |
Vtf (std::shared_ptr< std::vector< std::byte > > data) | |
ImageFormat | getHighResImageFormat () const |
HighResImageExtent | getHighResImageExtent (uint8_t mipLevel=0) const |
uint8_t | getFaces () const |
uint8_t | getMipLevels () const |
uint16_t | getFrames () const |
uint16_t | getFirstFrame () const |
TextureFlags | getFlags () const |
std::span< const std::byte > | getHighResImageData () const |
size_t | getImageSliceOffset (const uint8_t mipLevel=0, const uint16_t frame=0, const uint8_t face=0, const uint16_t depth=0) const |
ImageFormat | getLowResImageFormat () const |
LowResImageExtent | getLowResImageExtent () const |
std::span< const std::byte > | getLowResImageData () const |
Abstracts parsing and accessing the contents of the Valve Texture Format (VTF).
|
explicit |
Loads the VTF given by the binary data into an easily accessible structure.
data |
uint8_t VtfParser::Vtf::getFaces | ( | ) | const |
Gets the number of cubemap faces in the image.
uint16_t VtfParser::Vtf::getFirstFrame | ( | ) | const |
Gets the frame of animation to start on.
TextureFlags VtfParser::Vtf::getFlags | ( | ) | const |
Gets the flags set on the texture.
uint16_t VtfParser::Vtf::getFrames | ( | ) | const |
Gets the number of frames of animation in the image.
std::span< const std::byte > VtfParser::Vtf::getHighResImageData | ( | ) | const |
Gets the high resolution image data.
Vtf::HighResImageExtent VtfParser::Vtf::getHighResImageExtent | ( | uint8_t | mipLevel = 0 | ) | const |
Gets the extents (size on each axis) of the high resolution image data at the given mip level.
mipLevel | Mipmap to get the extents of. |
ImageFormat VtfParser::Vtf::getHighResImageFormat | ( | ) | const |
Gets the format of the high resolution image data.
size_t VtfParser::Vtf::getImageSliceOffset | ( | const uint8_t | mipLevel = 0 , |
const uint16_t | frame = 0 , |
||
const uint8_t | face = 0 , |
||
const uint16_t | depth = 0 |
||
) | const |
Gets the offset to an image slice at the given mipmap level, animation frame, cubemap face and depth in the high res image data.
mipLevel | Level of the mipmap chain. |
frame | Frame of animation. |
face | Face of a cubemap. |
depth | Depth or Z value of a volumetric texture. |
std::span< const std::byte > VtfParser::Vtf::getLowResImageData | ( | ) | const |
Gets the low resolution image data.
Vtf::LowResImageExtent VtfParser::Vtf::getLowResImageExtent | ( | ) | const |
Gets the extents (size on each axis) of the low resolution image data.
ImageFormat VtfParser::Vtf::getLowResImageFormat | ( | ) | const |
Gets the format of the low resolution image data.
uint8_t VtfParser::Vtf::getMipLevels | ( | ) | const |
Gets the number of levels in the image's mipmap chain.