SourcePP
Several modern C++20 libraries for sanely parsing Valve's formats.
Loading...
Searching...
No Matches
vtfpp::VTF Class Reference

#include <VTF.h>

Collaboration diagram for vtfpp::VTF:

Classes

struct  CreationOptions
 

Public Types

enum  Flags : int32_t {
  FLAG_NONE = 0 , FLAG_POINT_SAMPLE = 1 << 0 , FLAG_TRILINEAR = 1 << 1 , FLAG_CLAMP_S = 1 << 2 ,
  FLAG_CLAMP_T = 1 << 3 , FLAG_ANISOTROPIC = 1 << 4 , FLAG_HINT_DXT5 = 1 << 5 , FLAG_PWL_CORRECTED = 1 << 6 ,
  FLAG_NORMAL = 1 << 7 , FLAG_NO_MIP = 1 << 8 , FLAG_NO_LOD = 1 << 9 , FLAG_LOAD_ALL_MIPS = 1 << 10 ,
  FLAG_PROCEDURAL = 1 << 11 , FLAG_ONE_BIT_ALPHA = 1 << 12 , FLAG_MULTI_BIT_ALPHA = 1 << 13 , FLAG_ENVMAP = 1 << 14 ,
  FLAG_RENDERTARGET = 1 << 15 , FLAG_DEPTH_RENDERTARGET = 1 << 16 , FLAG_NO_DEBUG_OVERRIDE = 1 << 17 , FLAG_SINGLE_COPY = 1 << 18 ,
  FLAG_SRGB = 1 << 19 , FLAG_DEFAULT_POOL = 1 << 20 , FLAG_COMBINED = 1 << 21 , FLAG_ASYNC_DOWNLOAD = 1 << 22 ,
  FLAG_NO_DEPTH_BUFFER = 1 << 23 , FLAG_SKIP_INITIAL_DOWNLOAD = 1 << 24 , FLAG_CLAMP_U = 1 << 25 , FLAG_VERTEX_TEXTURE = 1 << 26 ,
  FLAG_XBOX_PRESWIZZLED = 1 << 26 , FLAG_SSBUMP = 1 << 27 , FLAG_XBOX_CACHEABLE = 1 << 27 , FLAG_LOAD_MOST_MIPS = 1 << 28 ,
  FLAG_BORDER = 1 << 29 , FLAG_YCOCG = 1 << 30 , FLAG_ASYNC_SKIP_INITIAL_LOW_RES = 1 << 31
}
 
enum  Platform : uint32_t {
  PLATFORM_UNKNOWN = 0x000 , PLATFORM_PC = 0x001 , PLATFORM_PS3_PORTAL2 = 0x003 , PLATFORM_PS3_ORANGEBOX = 0x333 ,
  PLATFORM_X360 = 0x360
}
 

Public Member Functions

 VTF ()
 
 VTF (std::vector< std::byte > &&vtfData, bool parseHeaderOnly=false)
 
 VTF (std::span< const std::byte > vtfData, bool parseHeaderOnly=false)
 
 VTF (const std::string &vtfPath, bool parseHeaderOnly=false)
 
 VTF (const VTF &other)
 
VTFoperator= (const VTF &other)
 
 VTF (VTF &&) noexcept=default
 
VTFoperator= (VTF &&) noexcept=default
 
 operator bool () const
 
Platform getPlatform () const
 
void setPlatform (Platform newPlatform)
 
uint32_t getMajorVersion () const
 
uint32_t getMinorVersion () const
 
void setVersion (uint32_t newMajorVersion, uint32_t newMinorVersion)
 
void setMajorVersion (uint32_t newMajorVersion)
 
void setMinorVersion (uint32_t newMinorVersion)
 
ImageConversion::ResizeMethod getImageWidthResizeMethod () const
 
ImageConversion::ResizeMethod getImageHeightResizeMethod () const
 
void setImageResizeMethods (ImageConversion::ResizeMethod imageWidthResizeMethod_, ImageConversion::ResizeMethod imageHeightResizeMethod_)
 
void setImageWidthResizeMethod (ImageConversion::ResizeMethod imageWidthResizeMethod_)
 
void setImageHeightResizeMethod (ImageConversion::ResizeMethod imageHeightResizeMethod_)
 
uint16_t getWidth (uint8_t mip=0) const
 
uint16_t getHeight (uint8_t mip=0) const
 
void setSize (uint16_t newWidth, uint16_t newHeight, ImageConversion::ResizeFilter filter)
 
Flags getFlags () const
 
void setFlags (Flags flags_)
 
void addFlags (Flags flags_)
 
void removeFlags (Flags flags_)
 
void computeTransparencyFlags ()
 
ImageFormat getFormat () const
 
void setFormat (ImageFormat newFormat, ImageConversion::ResizeFilter filter=ImageConversion::ResizeFilter::DEFAULT)
 
uint8_t getMipCount () const
 
bool setMipCount (uint8_t newMipCount)
 
bool setRecommendedMipCount ()
 
void computeMips (ImageConversion::ResizeFilter filter=ImageConversion::ResizeFilter::DEFAULT)
 
uint16_t getFrameCount () const
 
bool setFrameCount (uint16_t newFrameCount)
 
uint8_t getFaceCount () const
 
bool setFaceCount (bool isCubemap, bool hasSphereMap=false)
 
uint16_t getSliceCount () const
 
bool setSliceCount (uint16_t newSliceCount)
 
bool setFrameFaceAndSliceCount (uint16_t newFrameCount, bool isCubemap, bool hasSphereMap=false, uint16_t newSliceCount=1)
 
uint16_t getStartFrame () const
 
void setStartFrame (uint16_t newStartFrame)
 
sourcepp::math::Vec3f getReflectivity () const
 
void setReflectivity (sourcepp::math::Vec3f newReflectivity)
 
void computeReflectivity ()
 
float getBumpMapScale () const
 
void setBumpMapScale (float newBumpMapScale)
 
ImageFormat getThumbnailFormat () const
 
uint8_t getThumbnailWidth () const
 
uint8_t getThumbnailHeight () const
 
const std::vector< Resource > & getResources () const
 
const ResourcegetResource (Resource::Type type) const
 
std::vector< std::byte > getParticleSheetFrameDataRaw (uint16_t &spriteWidth, uint16_t &spriteHeight, uint32_t shtSequenceID, uint32_t shtFrame, uint8_t shtBounds=0, uint8_t mip=0, uint16_t frame=0, uint8_t face=0, uint16_t slice=0) const
 This is a convenience function. You're best off uploading the bounds to the GPU and scaling the UV there if trying to render a particle.
 
std::vector< std::byte > getParticleSheetFrameDataAs (ImageFormat newFormat, uint16_t &spriteWidth, uint16_t &spriteHeight, uint32_t shtSequenceID, uint32_t shtFrame, uint8_t shtBounds=0, uint8_t mip=0, uint16_t frame=0, uint8_t face=0, uint16_t slice=0) const
 This is a convenience function. You're best off uploading the bounds to the GPU and scaling the UV there if trying to render a particle.
 
std::vector< std::byte > getParticleSheetFrameDataAsRGBA8888 (uint16_t &spriteWidth, uint16_t &spriteHeight, uint32_t shtSequenceID, uint32_t shtFrame, uint8_t shtBounds=0, uint8_t mip=0, uint16_t frame=0, uint8_t face=0, uint16_t slice=0) const
 This is a convenience function. You're best off uploading the bounds to the GPU and scaling the UV there if trying to render a particle.
 
void setParticleSheetResource (const SHT &value)
 
void removeParticleSheetResource ()
 
void setCRCResource (uint32_t value)
 
void removeCRCResource ()
 
void setLODResource (uint8_t u, uint8_t v, uint8_t u360=0, uint8_t v360=0)
 
void removeLODResource ()
 
void setExtendedFlagsResource (uint32_t value)
 
void removeExtendedFlagsResource ()
 
void setKeyValuesDataResource (const std::string &value)
 
void removeKeyValuesDataResource ()
 
int16_t getCompressionLevel () const
 
void setCompressionLevel (int16_t newCompressionLevel)
 
CompressionMethod getCompressionMethod () const
 
void setCompressionMethod (CompressionMethod newCompressionMethod)
 
bool hasImageData () const
 
bool imageDataIsSRGB () const
 
std::span< const std::byte > getImageDataRaw (uint8_t mip=0, uint16_t frame=0, uint8_t face=0, uint16_t slice=0) const
 
std::vector< std::byte > getImageDataAs (ImageFormat newFormat, uint8_t mip=0, uint16_t frame=0, uint8_t face=0, uint16_t slice=0) const
 
std::vector< std::byte > getImageDataAsRGBA8888 (uint8_t mip=0, uint16_t frame=0, uint8_t face=0, uint16_t slice=0) const
 
bool setImage (std::span< const std::byte > imageData_, ImageFormat format_, uint16_t width_, uint16_t height_, ImageConversion::ResizeFilter filter=ImageConversion::ResizeFilter::DEFAULT, uint8_t mip=0, uint16_t frame=0, uint8_t face=0, uint16_t slice=0)
 
bool setImage (const std::string &imagePath, ImageConversion::ResizeFilter filter=ImageConversion::ResizeFilter::DEFAULT, uint8_t mip=0, uint16_t frame=0, uint8_t face=0, uint16_t slice=0)
 
std::vector< std::byte > saveImageToFile (uint8_t mip=0, uint16_t frame=0, uint8_t face=0, uint16_t slice=0, ImageConversion::FileFormat fileFormat=ImageConversion::FileFormat::DEFAULT) const
 
bool saveImageToFile (const std::string &imagePath, uint8_t mip=0, uint16_t frame=0, uint8_t face=0, uint16_t slice=0, ImageConversion::FileFormat fileFormat=ImageConversion::FileFormat::DEFAULT) const
 
bool hasThumbnailData () const
 
std::span< const std::byte > getThumbnailDataRaw () const
 
std::vector< std::byte > getThumbnailDataAs (ImageFormat newFormat) const
 
std::vector< std::byte > getThumbnailDataAsRGBA8888 () const
 
void setThumbnail (std::span< const std::byte > imageData_, ImageFormat format_, uint16_t width_, uint16_t height_)
 
void computeThumbnail (ImageConversion::ResizeFilter filter=ImageConversion::ResizeFilter::DEFAULT)
 
void removeThumbnail ()
 
std::vector< std::byte > saveThumbnailToFile (ImageConversion::FileFormat fileFormat=ImageConversion::FileFormat::DEFAULT) const
 
bool saveThumbnailToFile (const std::string &imagePath, ImageConversion::FileFormat fileFormat=ImageConversion::FileFormat::DEFAULT) const
 
std::vector< std::byte > bake () const
 
bool bake (const std::string &vtfPath) const
 

Static Public Member Functions

static bool create (std::span< const std::byte > imageData, ImageFormat format, uint16_t width, uint16_t height, const std::string &vtfPath, CreationOptions options)
 
static bool create (ImageFormat format, uint16_t width, uint16_t height, const std::string &vtfPath, CreationOptions options)
 
static VTF create (std::span< const std::byte > imageData, ImageFormat format, uint16_t width, uint16_t height, CreationOptions options)
 
static VTF create (ImageFormat format, uint16_t width, uint16_t height, CreationOptions options)
 
static bool create (const std::string &imagePath, const std::string &vtfPath, CreationOptions options)
 
static VTF create (const std::string &imagePath, CreationOptions options)
 
static ImageFormat getDefaultCompressedFormat (ImageFormat inputFormat, uint32_t majorVersion, uint32_t minorVersion)
 

Static Public Attributes

static constexpr std::underlying_type_t< FlagsFLAG_MASK_AFTER_V7_3 = FLAG_LOAD_ALL_MIPS | FLAG_SRGB | FLAG_DEFAULT_POOL | FLAG_COMBINED | FLAG_ASYNC_DOWNLOAD | FLAG_SKIP_INITIAL_DOWNLOAD | FLAG_LOAD_MOST_MIPS | FLAG_YCOCG | FLAG_ASYNC_SKIP_INITIAL_LOW_RES
 
static constexpr std::underlying_type_t< FlagsFLAG_MASK_INTERNAL = FLAG_NO_MIP | FLAG_ENVMAP
 
static constexpr std::underlying_type_t< FlagsFLAG_MASK_SRGB = FLAG_PWL_CORRECTED | FLAG_SRGB
 
static constexpr auto FORMAT_UNCHANGED = static_cast<ImageFormat>(-2)
 This value is only valid when passed to VTF::create through CreationOptions.
 
static constexpr auto FORMAT_DEFAULT = static_cast<ImageFormat>(-1)
 This value is only valid when passed to VTF::create through CreationOptions or VTF::setFormat.
 

Protected Member Functions

ResourcegetResourceInternal (Resource::Type type)
 
void setResourceInternal (Resource::Type type, std::span< const std::byte > data_)
 
void removeResourceInternal (Resource::Type type)
 
void regenerateImageData (ImageFormat newFormat, uint16_t newWidth, uint16_t newHeight, uint8_t newMipCount, uint16_t newFrameCount, uint8_t newFaceCount, uint16_t newSliceCount, ImageConversion::ResizeFilter filter=ImageConversion::ResizeFilter::DEFAULT)
 

Static Protected Member Functions

static void createInternal (VTF &writer, CreationOptions options)
 

Protected Attributes

bool opened = false
 
std::vector< std::byte > data
 
uint32_t majorVersion {}
 
uint32_t minorVersion {}
 
uint16_t width {}
 
uint16_t height {}
 
Flags flags {}
 
uint16_t frameCount = 1
 
uint16_t startFrame {}
 
sourcepp::math::Vec3f reflectivity {}
 
float bumpMapScale {}
 
ImageFormat format = ImageFormat::EMPTY
 
uint8_t mipCount = 1
 
ImageFormat thumbnailFormat = ImageFormat::EMPTY
 
uint8_t thumbnailWidth {}
 
uint8_t thumbnailHeight {}
 
uint16_t sliceCount = 1
 
std::vector< Resourceresources
 
Platform platform = PLATFORM_PC
 
int16_t compressionLevel = 0
 
CompressionMethod compressionMethod = CompressionMethod::ZSTD
 
ImageConversion::ResizeMethod imageWidthResizeMethod = ImageConversion::ResizeMethod::POWER_OF_TWO_BIGGER
 
ImageConversion::ResizeMethod imageHeightResizeMethod = ImageConversion::ResizeMethod::POWER_OF_TWO_BIGGER
 

Detailed Description

Definition at line 126 of file VTF.h.

Member Enumeration Documentation

◆ Flags

enum vtfpp::VTF::Flags : int32_t
Enumerator
FLAG_NONE 
FLAG_POINT_SAMPLE 
FLAG_TRILINEAR 
FLAG_CLAMP_S 
FLAG_CLAMP_T 
FLAG_ANISOTROPIC 
FLAG_HINT_DXT5 
FLAG_PWL_CORRECTED 
FLAG_NORMAL 
FLAG_NO_MIP 
FLAG_NO_LOD 
FLAG_LOAD_ALL_MIPS 
FLAG_PROCEDURAL 
FLAG_ONE_BIT_ALPHA 
FLAG_MULTI_BIT_ALPHA 
FLAG_ENVMAP 
FLAG_RENDERTARGET 
FLAG_DEPTH_RENDERTARGET 
FLAG_NO_DEBUG_OVERRIDE 
FLAG_SINGLE_COPY 
FLAG_SRGB 
FLAG_DEFAULT_POOL 
FLAG_COMBINED 
FLAG_ASYNC_DOWNLOAD 
FLAG_NO_DEPTH_BUFFER 
FLAG_SKIP_INITIAL_DOWNLOAD 
FLAG_CLAMP_U 
FLAG_VERTEX_TEXTURE 
FLAG_XBOX_PRESWIZZLED 
FLAG_SSBUMP 
FLAG_XBOX_CACHEABLE 
FLAG_LOAD_MOST_MIPS 
FLAG_BORDER 
FLAG_YCOCG 
FLAG_ASYNC_SKIP_INITIAL_LOW_RES 

Definition at line 128 of file VTF.h.

◆ Platform

enum vtfpp::VTF::Platform : uint32_t
Enumerator
PLATFORM_UNKNOWN 
PLATFORM_PC 
PLATFORM_PS3_PORTAL2 
PLATFORM_PS3_ORANGEBOX 
PLATFORM_X360 

Definition at line 169 of file VTF.h.

Constructor & Destructor Documentation

◆ VTF() [1/6]

VTF::VTF ( )

Definition at line 173 of file VTF.cpp.

◆ VTF() [2/6]

VTF::VTF ( std::vector< std::byte > &&  vtfData,
bool  parseHeaderOnly = false 
)
explicit

Definition at line 191 of file VTF.cpp.

◆ VTF() [3/6]

VTF::VTF ( std::span< const std::byte >  vtfData,
bool  parseHeaderOnly = false 
)
explicit

Definition at line 481 of file VTF.cpp.

◆ VTF() [4/6]

VTF::VTF ( const std::string &  vtfPath,
bool  parseHeaderOnly = false 
)
explicit

Definition at line 484 of file VTF.cpp.

◆ VTF() [5/6]

VTF::VTF ( const VTF other)

Definition at line 487 of file VTF.cpp.

◆ VTF() [6/6]

vtfpp::VTF::VTF ( VTF &&  )
defaultnoexcept

Member Function Documentation

◆ addFlags()

void VTF::addFlags ( Flags  flags_)

Definition at line 744 of file VTF.cpp.

◆ bake() [1/2]

std::vector< std::byte > VTF::bake ( ) const

Definition at line 1495 of file VTF.cpp.

◆ bake() [2/2]

bool VTF::bake ( const std::string &  vtfPath) const

Definition at line 1741 of file VTF.cpp.

◆ computeMips()

Definition at line 835 of file VTF.cpp.

◆ computeReflectivity()

void VTF::computeReflectivity ( )

Definition at line 962 of file VTF.cpp.

◆ computeThumbnail()

Definition at line 1467 of file VTF.cpp.

◆ computeTransparencyFlags()

void VTF::computeTransparencyFlags ( )

Definition at line 752 of file VTF.cpp.

◆ create() [1/6]

bool VTF::create ( const std::string &  imagePath,
const std::string &  vtfPath,
CreationOptions  options 
)
static

Definition at line 595 of file VTF.cpp.

◆ create() [2/6]

VTF VTF::create ( const std::string &  imagePath,
CreationOptions  options 
)
static

Definition at line 607 of file VTF.cpp.

◆ create() [3/6]

bool VTF::create ( ImageFormat  format,
uint16_t  width,
uint16_t  height,
const std::string &  vtfPath,
CreationOptions  options 
)
static

Definition at line 573 of file VTF.cpp.

◆ create() [4/6]

VTF VTF::create ( ImageFormat  format,
uint16_t  width,
uint16_t  height,
CreationOptions  options 
)
static

Definition at line 589 of file VTF.cpp.

◆ create() [5/6]

bool VTF::create ( std::span< const std::byte >  imageData,
ImageFormat  format,
uint16_t  width,
uint16_t  height,
const std::string &  vtfPath,
CreationOptions  options 
)
static

Definition at line 561 of file VTF.cpp.

◆ create() [6/6]

VTF VTF::create ( std::span< const std::byte >  imageData,
ImageFormat  format,
uint16_t  width,
uint16_t  height,
CreationOptions  options 
)
static

Definition at line 579 of file VTF.cpp.

◆ createInternal()

void VTF::createInternal ( VTF writer,
CreationOptions  options 
)
staticprotected

Definition at line 531 of file VTF.cpp.

◆ getBumpMapScale()

float VTF::getBumpMapScale ( ) const

Definition at line 1026 of file VTF.cpp.

◆ getCompressionLevel()

int16_t VTF::getCompressionLevel ( ) const

Definition at line 1297 of file VTF.cpp.

◆ getCompressionMethod()

CompressionMethod VTF::getCompressionMethod ( ) const

Definition at line 1305 of file VTF.cpp.

◆ getDefaultCompressedFormat()

ImageFormat VTF::getDefaultCompressedFormat ( ImageFormat  inputFormat,
uint32_t  majorVersion,
uint32_t  minorVersion 
)
static

Definition at line 767 of file VTF.cpp.

◆ getFaceCount()

uint8_t VTF::getFaceCount ( ) const

Definition at line 897 of file VTF.cpp.

◆ getFlags()

VTF::Flags VTF::getFlags ( ) const

Definition at line 736 of file VTF.cpp.

◆ getFormat()

ImageFormat VTF::getFormat ( ) const

Definition at line 779 of file VTF.cpp.

◆ getFrameCount()

uint16_t VTF::getFrameCount ( ) const

Definition at line 885 of file VTF.cpp.

◆ getHeight()

uint16_t VTF::getHeight ( uint8_t  mip = 0) const

Definition at line 697 of file VTF.cpp.

◆ getImageDataAs()

std::vector< std::byte > VTF::getImageDataAs ( ImageFormat  newFormat,
uint8_t  mip = 0,
uint16_t  frame = 0,
uint8_t  face = 0,
uint16_t  slice = 0 
) const

Definition at line 1336 of file VTF.cpp.

◆ getImageDataAsRGBA8888()

std::vector< std::byte > VTF::getImageDataAsRGBA8888 ( uint8_t  mip = 0,
uint16_t  frame = 0,
uint8_t  face = 0,
uint16_t  slice = 0 
) const

Definition at line 1344 of file VTF.cpp.

◆ getImageDataRaw()

std::span< const std::byte > VTF::getImageDataRaw ( uint8_t  mip = 0,
uint16_t  frame = 0,
uint8_t  face = 0,
uint16_t  slice = 0 
) const

Definition at line 1327 of file VTF.cpp.

◆ getImageHeightResizeMethod()

ImageConversion::ResizeMethod VTF::getImageHeightResizeMethod ( ) const

Definition at line 676 of file VTF.cpp.

◆ getImageWidthResizeMethod()

ImageConversion::ResizeMethod VTF::getImageWidthResizeMethod ( ) const

Definition at line 672 of file VTF.cpp.

◆ getMajorVersion()

uint32_t VTF::getMajorVersion ( ) const

Definition at line 638 of file VTF.cpp.

◆ getMinorVersion()

uint32_t VTF::getMinorVersion ( ) const

Definition at line 642 of file VTF.cpp.

◆ getMipCount()

uint8_t VTF::getMipCount ( ) const

Definition at line 805 of file VTF.cpp.

◆ getParticleSheetFrameDataAs()

std::vector< std::byte > VTF::getParticleSheetFrameDataAs ( ImageFormat  newFormat,
uint16_t &  spriteWidth,
uint16_t &  spriteHeight,
uint32_t  shtSequenceID,
uint32_t  shtFrame,
uint8_t  shtBounds = 0,
uint8_t  mip = 0,
uint16_t  frame = 0,
uint8_t  face = 0,
uint16_t  slice = 0 
) const

This is a convenience function. You're best off uploading the bounds to the GPU and scaling the UV there if trying to render a particle.

Definition at line 1229 of file VTF.cpp.

◆ getParticleSheetFrameDataAsRGBA8888()

std::vector< std::byte > VTF::getParticleSheetFrameDataAsRGBA8888 ( uint16_t &  spriteWidth,
uint16_t &  spriteHeight,
uint32_t  shtSequenceID,
uint32_t  shtFrame,
uint8_t  shtBounds = 0,
uint8_t  mip = 0,
uint16_t  frame = 0,
uint8_t  face = 0,
uint16_t  slice = 0 
) const

This is a convenience function. You're best off uploading the bounds to the GPU and scaling the UV there if trying to render a particle.

Definition at line 1233 of file VTF.cpp.

◆ getParticleSheetFrameDataRaw()

std::vector< std::byte > VTF::getParticleSheetFrameDataRaw ( uint16_t &  spriteWidth,
uint16_t &  spriteHeight,
uint32_t  shtSequenceID,
uint32_t  shtFrame,
uint8_t  shtBounds = 0,
uint8_t  mip = 0,
uint16_t  frame = 0,
uint8_t  face = 0,
uint16_t  slice = 0 
) const

This is a convenience function. You're best off uploading the bounds to the GPU and scaling the UV there if trying to render a particle.

Definition at line 1187 of file VTF.cpp.

◆ getPlatform()

VTF::Platform VTF::getPlatform ( ) const

Definition at line 617 of file VTF.cpp.

◆ getReflectivity()

math::Vec3f VTF::getReflectivity ( ) const

Definition at line 954 of file VTF.cpp.

◆ getResource()

const Resource * VTF::getResource ( Resource::Type  type) const

Definition at line 1050 of file VTF.cpp.

◆ getResourceInternal()

Resource * VTF::getResourceInternal ( Resource::Type  type)
protected

Definition at line 1059 of file VTF.cpp.

◆ getResources()

const std::vector< Resource > & VTF::getResources ( ) const

Definition at line 1046 of file VTF.cpp.

◆ getSliceCount()

uint16_t VTF::getSliceCount ( ) const

Definition at line 926 of file VTF.cpp.

◆ getStartFrame()

uint16_t VTF::getStartFrame ( ) const

Definition at line 946 of file VTF.cpp.

◆ getThumbnailDataAs()

std::vector< std::byte > VTF::getThumbnailDataAs ( ImageFormat  newFormat) const

Definition at line 1445 of file VTF.cpp.

◆ getThumbnailDataAsRGBA8888()

std::vector< std::byte > VTF::getThumbnailDataAsRGBA8888 ( ) const

Definition at line 1453 of file VTF.cpp.

◆ getThumbnailDataRaw()

std::span< const std::byte > VTF::getThumbnailDataRaw ( ) const

Definition at line 1438 of file VTF.cpp.

◆ getThumbnailFormat()

ImageFormat VTF::getThumbnailFormat ( ) const

Definition at line 1034 of file VTF.cpp.

◆ getThumbnailHeight()

uint8_t VTF::getThumbnailHeight ( ) const

Definition at line 1042 of file VTF.cpp.

◆ getThumbnailWidth()

uint8_t VTF::getThumbnailWidth ( ) const

Definition at line 1038 of file VTF.cpp.

◆ getWidth()

uint16_t VTF::getWidth ( uint8_t  mip = 0) const

Definition at line 693 of file VTF.cpp.

◆ hasImageData()

bool VTF::hasImageData ( ) const

Definition at line 1319 of file VTF.cpp.

◆ hasThumbnailData()

bool VTF::hasThumbnailData ( ) const

Definition at line 1434 of file VTF.cpp.

◆ imageDataIsSRGB()

bool VTF::imageDataIsSRGB ( ) const

Definition at line 1323 of file VTF.cpp.

◆ operator bool()

VTF::operator bool ( ) const
explicit

Definition at line 527 of file VTF.cpp.

◆ operator=() [1/2]

VTF & VTF::operator= ( const VTF other)

Definition at line 491 of file VTF.cpp.

◆ operator=() [2/2]

VTF & vtfpp::VTF::operator= ( VTF &&  )
defaultnoexcept

◆ regenerateImageData()

void VTF::regenerateImageData ( ImageFormat  newFormat,
uint16_t  newWidth,
uint16_t  newHeight,
uint8_t  newMipCount,
uint16_t  newFrameCount,
uint8_t  newFaceCount,
uint16_t  newSliceCount,
ImageConversion::ResizeFilter  filter = ImageConversion::ResizeFilter::DEFAULT 
)
protected

Definition at line 1127 of file VTF.cpp.

◆ removeCRCResource()

void VTF::removeCRCResource ( )

Definition at line 1257 of file VTF.cpp.

◆ removeExtendedFlagsResource()

void VTF::removeExtendedFlagsResource ( )

Definition at line 1278 of file VTF.cpp.

◆ removeFlags()

void VTF::removeFlags ( Flags  flags_)

Definition at line 748 of file VTF.cpp.

◆ removeKeyValuesDataResource()

void VTF::removeKeyValuesDataResource ( )

Definition at line 1293 of file VTF.cpp.

◆ removeLODResource()

void VTF::removeLODResource ( )

Definition at line 1270 of file VTF.cpp.

◆ removeParticleSheetResource()

void VTF::removeParticleSheetResource ( )

Definition at line 1249 of file VTF.cpp.

◆ removeResourceInternal()

void VTF::removeResourceInternal ( Resource::Type  type)
protected

Definition at line 1123 of file VTF.cpp.

◆ removeThumbnail()

void VTF::removeThumbnail ( )

Definition at line 1477 of file VTF.cpp.

◆ saveImageToFile() [1/2]

bool VTF::saveImageToFile ( const std::string &  imagePath,
uint8_t  mip = 0,
uint16_t  frame = 0,
uint8_t  face = 0,
uint16_t  slice = 0,
ImageConversion::FileFormat  fileFormat = ImageConversion::FileFormat::DEFAULT 
) const

Definition at line 1427 of file VTF.cpp.

◆ saveImageToFile() [2/2]

std::vector< std::byte > VTF::saveImageToFile ( uint8_t  mip = 0,
uint16_t  frame = 0,
uint8_t  face = 0,
uint16_t  slice = 0,
ImageConversion::FileFormat  fileFormat = ImageConversion::FileFormat::DEFAULT 
) const

Definition at line 1423 of file VTF.cpp.

◆ saveThumbnailToFile() [1/2]

bool VTF::saveThumbnailToFile ( const std::string &  imagePath,
ImageConversion::FileFormat  fileFormat = ImageConversion::FileFormat::DEFAULT 
) const

Definition at line 1488 of file VTF.cpp.

◆ saveThumbnailToFile() [2/2]

std::vector< std::byte > VTF::saveThumbnailToFile ( ImageConversion::FileFormat  fileFormat = ImageConversion::FileFormat::DEFAULT) const

Definition at line 1484 of file VTF.cpp.

◆ setBumpMapScale()

void VTF::setBumpMapScale ( float  newBumpMapScale)

Definition at line 1030 of file VTF.cpp.

◆ setCompressionLevel()

void VTF::setCompressionLevel ( int16_t  newCompressionLevel)

Definition at line 1301 of file VTF.cpp.

◆ setCompressionMethod()

void VTF::setCompressionMethod ( CompressionMethod  newCompressionMethod)

Definition at line 1309 of file VTF.cpp.

◆ setCRCResource()

void VTF::setCRCResource ( uint32_t  value)

Definition at line 1253 of file VTF.cpp.

◆ setExtendedFlagsResource()

void VTF::setExtendedFlagsResource ( uint32_t  value)

Definition at line 1274 of file VTF.cpp.

◆ setFaceCount()

bool VTF::setFaceCount ( bool  isCubemap,
bool  hasSphereMap = false 
)

Definition at line 918 of file VTF.cpp.

◆ setFlags()

void VTF::setFlags ( Flags  flags_)

Definition at line 740 of file VTF.cpp.

◆ setFormat()

void VTF::setFormat ( ImageFormat  newFormat,
ImageConversion::ResizeFilter  filter = ImageConversion::ResizeFilter::DEFAULT 
)

Definition at line 783 of file VTF.cpp.

◆ setFrameCount()

bool VTF::setFrameCount ( uint16_t  newFrameCount)

Definition at line 889 of file VTF.cpp.

◆ setFrameFaceAndSliceCount()

bool VTF::setFrameFaceAndSliceCount ( uint16_t  newFrameCount,
bool  isCubemap,
bool  hasSphereMap = false,
uint16_t  newSliceCount = 1 
)

Definition at line 938 of file VTF.cpp.

◆ setImage() [1/2]

bool VTF::setImage ( const std::string &  imagePath,
ImageConversion::ResizeFilter  filter = ImageConversion::ResizeFilter::DEFAULT,
uint8_t  mip = 0,
uint16_t  frame = 0,
uint8_t  face = 0,
uint16_t  slice = 0 
)

Definition at line 1393 of file VTF.cpp.

◆ setImage() [2/2]

bool VTF::setImage ( std::span< const std::byte >  imageData_,
ImageFormat  format_,
uint16_t  width_,
uint16_t  height_,
ImageConversion::ResizeFilter  filter = ImageConversion::ResizeFilter::DEFAULT,
uint8_t  mip = 0,
uint16_t  frame = 0,
uint8_t  face = 0,
uint16_t  slice = 0 
)

Definition at line 1348 of file VTF.cpp.

◆ setImageHeightResizeMethod()

void VTF::setImageHeightResizeMethod ( ImageConversion::ResizeMethod  imageHeightResizeMethod_)

Definition at line 689 of file VTF.cpp.

◆ setImageResizeMethods()

void VTF::setImageResizeMethods ( ImageConversion::ResizeMethod  imageWidthResizeMethod_,
ImageConversion::ResizeMethod  imageHeightResizeMethod_ 
)

Definition at line 680 of file VTF.cpp.

◆ setImageWidthResizeMethod()

void VTF::setImageWidthResizeMethod ( ImageConversion::ResizeMethod  imageWidthResizeMethod_)

Definition at line 685 of file VTF.cpp.

◆ setKeyValuesDataResource()

void VTF::setKeyValuesDataResource ( const std::string &  value)

Definition at line 1282 of file VTF.cpp.

◆ setLODResource()

void VTF::setLODResource ( uint8_t  u,
uint8_t  v,
uint8_t  u360 = 0,
uint8_t  v360 = 0 
)

Definition at line 1261 of file VTF.cpp.

◆ setMajorVersion()

void VTF::setMajorVersion ( uint32_t  newMajorVersion)

Definition at line 651 of file VTF.cpp.

◆ setMinorVersion()

void VTF::setMinorVersion ( uint32_t  newMinorVersion)

Definition at line 658 of file VTF.cpp.

◆ setMipCount()

bool VTF::setMipCount ( uint8_t  newMipCount)

Definition at line 809 of file VTF.cpp.

◆ setParticleSheetResource()

void VTF::setParticleSheetResource ( const SHT value)

Definition at line 1237 of file VTF.cpp.

◆ setPlatform()

void VTF::setPlatform ( Platform  newPlatform)

Definition at line 621 of file VTF.cpp.

◆ setRecommendedMipCount()

bool VTF::setRecommendedMipCount ( )

Definition at line 828 of file VTF.cpp.

◆ setReflectivity()

void VTF::setReflectivity ( sourcepp::math::Vec3f  newReflectivity)

Definition at line 958 of file VTF.cpp.

◆ setResourceInternal()

void VTF::setResourceInternal ( Resource::Type  type,
std::span< const std::byte >  data_ 
)
protected

Definition at line 1068 of file VTF.cpp.

◆ setSize()

void VTF::setSize ( uint16_t  newWidth,
uint16_t  newHeight,
ImageConversion::ResizeFilter  filter 
)

Definition at line 701 of file VTF.cpp.

◆ setSliceCount()

bool VTF::setSliceCount ( uint16_t  newSliceCount)

Definition at line 930 of file VTF.cpp.

◆ setStartFrame()

void VTF::setStartFrame ( uint16_t  newStartFrame)

Definition at line 950 of file VTF.cpp.

◆ setThumbnail()

void VTF::setThumbnail ( std::span< const std::byte >  imageData_,
ImageFormat  format_,
uint16_t  width_,
uint16_t  height_ 
)

Definition at line 1457 of file VTF.cpp.

◆ setVersion()

void VTF::setVersion ( uint32_t  newMajorVersion,
uint32_t  newMinorVersion 
)

Definition at line 646 of file VTF.cpp.

Member Data Documentation

◆ bumpMapScale

float vtfpp::VTF::bumpMapScale {}
protected

Definition at line 436 of file VTF.h.

◆ compressionLevel

int16_t vtfpp::VTF::compressionLevel = 0
protected

Definition at line 455 of file VTF.h.

◆ compressionMethod

CompressionMethod vtfpp::VTF::compressionMethod = CompressionMethod::ZSTD
protected

Definition at line 456 of file VTF.h.

◆ data

std::vector<std::byte> vtfpp::VTF::data
protected

Definition at line 418 of file VTF.h.

◆ FLAG_MASK_AFTER_V7_3

constexpr std::underlying_type_t<Flags> vtfpp::VTF::FLAG_MASK_AFTER_V7_3 = FLAG_LOAD_ALL_MIPS | FLAG_SRGB | FLAG_DEFAULT_POOL | FLAG_COMBINED | FLAG_ASYNC_DOWNLOAD | FLAG_SKIP_INITIAL_DOWNLOAD | FLAG_LOAD_MOST_MIPS | FLAG_YCOCG | FLAG_ASYNC_SKIP_INITIAL_LOW_RES
staticconstexpr

Definition at line 165 of file VTF.h.

◆ FLAG_MASK_INTERNAL

constexpr std::underlying_type_t<Flags> vtfpp::VTF::FLAG_MASK_INTERNAL = FLAG_NO_MIP | FLAG_ENVMAP
staticconstexpr

Definition at line 166 of file VTF.h.

◆ FLAG_MASK_SRGB

constexpr std::underlying_type_t<Flags> vtfpp::VTF::FLAG_MASK_SRGB = FLAG_PWL_CORRECTED | FLAG_SRGB
staticconstexpr

Definition at line 167 of file VTF.h.

◆ flags

Flags vtfpp::VTF::flags {}
protected

Definition at line 427 of file VTF.h.

◆ format

ImageFormat vtfpp::VTF::format = ImageFormat::EMPTY
protected

Definition at line 437 of file VTF.h.

◆ FORMAT_DEFAULT

constexpr auto vtfpp::VTF::FORMAT_DEFAULT = static_cast<ImageFormat>(-1)
staticconstexpr

This value is only valid when passed to VTF::create through CreationOptions or VTF::setFormat.

Definition at line 204 of file VTF.h.

◆ FORMAT_UNCHANGED

constexpr auto vtfpp::VTF::FORMAT_UNCHANGED = static_cast<ImageFormat>(-2)
staticconstexpr

This value is only valid when passed to VTF::create through CreationOptions.

Definition at line 201 of file VTF.h.

◆ frameCount

uint16_t vtfpp::VTF::frameCount = 1
protected

Definition at line 429 of file VTF.h.

◆ height

uint16_t vtfpp::VTF::height {}
protected

Definition at line 426 of file VTF.h.

◆ imageHeightResizeMethod

Definition at line 458 of file VTF.h.

◆ imageWidthResizeMethod

Definition at line 457 of file VTF.h.

◆ majorVersion

uint32_t vtfpp::VTF::majorVersion {}
protected

Definition at line 421 of file VTF.h.

◆ minorVersion

uint32_t vtfpp::VTF::minorVersion {}
protected

Definition at line 422 of file VTF.h.

◆ mipCount

uint8_t vtfpp::VTF::mipCount = 1
protected

Definition at line 438 of file VTF.h.

◆ opened

bool vtfpp::VTF::opened = false
protected

Definition at line 416 of file VTF.h.

◆ platform

Platform vtfpp::VTF::platform = PLATFORM_PC
protected

Definition at line 454 of file VTF.h.

◆ reflectivity

sourcepp::math::Vec3f vtfpp::VTF::reflectivity {}
protected

Definition at line 433 of file VTF.h.

◆ resources

std::vector<Resource> vtfpp::VTF::resources
protected

Definition at line 450 of file VTF.h.

◆ sliceCount

uint16_t vtfpp::VTF::sliceCount = 1
protected

Definition at line 445 of file VTF.h.

◆ startFrame

uint16_t vtfpp::VTF::startFrame {}
protected

Definition at line 430 of file VTF.h.

◆ thumbnailFormat

ImageFormat vtfpp::VTF::thumbnailFormat = ImageFormat::EMPTY
protected

Definition at line 440 of file VTF.h.

◆ thumbnailHeight

uint8_t vtfpp::VTF::thumbnailHeight {}
protected

Definition at line 442 of file VTF.h.

◆ thumbnailWidth

uint8_t vtfpp::VTF::thumbnailWidth {}
protected

Definition at line 441 of file VTF.h.

◆ width

uint16_t vtfpp::VTF::width {}
protected

Definition at line 425 of file VTF.h.


The documentation for this class was generated from the following files: