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  FlagsV0 : uint32_t {
  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_NORMAL = 1 << 7 , FLAG_NO_MIP = 1 << 8 ,
  FLAG_NO_LOD = 1 << 9 , FLAG_MIN_MIP = 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
}
 
enum  FlagsV2 : uint32_t { FLAG_V2_NO_DEPTH_BUFFER = 1 << 23 , FLAG_V2_CLAMP_U = 1 << 25 }
 
enum  FlagsV3 : uint32_t { FLAG_V3_LOAD_ALL_MIPS = 1 << 10 , FLAG_V3_VERTEX_TEXTURE = 1 << 26 , FLAG_V3_SSBUMP = 1 << 27 , FLAG_V3_BORDER = 1 << 29 }
 
enum  FlagsV4 : uint32_t { FLAG_V4_SRGB = 1 << 6 }
 
enum  FlagsV4_TF2 : uint32_t {
  FLAG_V4_TF2_STAGING_MEMORY = 1 << 19 , FLAG_V4_TF2_IMMEDIATE_CLEANUP = 1 << 20 , FLAG_V4_TF2_IGNORE_PICMIP = 1 << 21 , FLAG_V4_TF2_STREAMABLE_COARSE = 1 << 30 ,
  FLAG_V4_TF2_STREAMABLE_FINE = static_cast<uint32_t>(1 << 31)
}
 
enum  FlagsV5 : uint32_t { FLAG_V5_PWL_CORRECTED = 1 << 6 , FLAG_V5_SRGB = 1 << 19 , FLAG_V5_DEFAULT_POOL = 1 << 20 , FLAG_V5_LOAD_MOST_MIPS = 1 << 28 }
 
enum  FlagsV5_CSGO : uint32_t {
  FLAG_V5_CSGO_COMBINED = 1 << 21 , FLAG_V5_CSGO_ASYNC_DOWNLOAD = 1 << 22 , FLAG_V5_CSGO_SKIP_INITIAL_DOWNLOAD = 1 << 24 , FLAG_V5_CSGO_YCOCG = 1 << 30 ,
  FLAG_V5_CSGO_ASYNC_SKIP_INITIAL_LOW_RES = static_cast<uint32_t>(1 << 31)
}
 
enum  Platform : uint32_t {
  PLATFORM_UNKNOWN = 0x000 , PLATFORM_PC = 0x001 , PLATFORM_X360 = 0x360 , PLATFORM_PS3_ORANGEBOX = 0x333 ,
  PLATFORM_PS3_PORTAL2 = 0x003
}
 

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 getVersion () const
 
void setVersion (uint32_t newVersion)
 
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)
 
uint32_t getFlags () const
 
void setFlags (uint32_t flags_)
 
void addFlags (uint32_t flags_)
 
void removeFlags (uint32_t flags_)
 
bool isSRGB () const
 
void setSRGB (bool srgb)
 
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)
 
uint16_t getSliceCount () const
 
bool setSliceCount (uint16_t newSliceCount)
 
bool setFrameFaceAndSliceCount (uint16_t newFrameCount, bool isCubeMap, 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 ()
 
void setHotspotDataResource (const HOT &value)
 
void removeHotspotDataResource ()
 
int16_t getCompressionLevel () const
 
void setCompressionLevel (int16_t newCompressionLevel)
 
CompressionMethod getCompressionMethod () const
 
void setCompressionMethod (CompressionMethod newCompressionMethod)
 
bool hasImageData () 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 version, bool isCubeMap)
 

Static Public Attributes

static constexpr uint32_t FLAGS_MASK_V0 = FLAG_POINT_SAMPLE | FLAG_TRILINEAR | FLAG_CLAMP_S | FLAG_CLAMP_T | FLAG_ANISOTROPIC | FLAG_HINT_DXT5 | FLAG_NORMAL | FLAG_NO_MIP | FLAG_NO_LOD | FLAG_MIN_MIP | FLAG_PROCEDURAL | FLAG_ONE_BIT_ALPHA | FLAG_MULTI_BIT_ALPHA | FLAG_ENVMAP | FLAG_RENDERTARGET | FLAG_DEPTH_RENDERTARGET | FLAG_NO_DEBUG_OVERRIDE | FLAG_SINGLE_COPY
 
static constexpr uint32_t FLAGS_MASK_V2 = FLAG_V2_NO_DEPTH_BUFFER | FLAG_V2_CLAMP_U
 
static constexpr uint32_t FLAGS_MASK_V3 = FLAG_V3_LOAD_ALL_MIPS | FLAG_V3_VERTEX_TEXTURE | FLAG_V3_SSBUMP | FLAG_V3_BORDER
 
static constexpr uint32_t FLAGS_MASK_V4 = FLAG_V4_SRGB
 
static constexpr uint32_t FLAGS_MASK_V4_TF2 = FLAG_V4_TF2_STAGING_MEMORY | FLAG_V4_TF2_IMMEDIATE_CLEANUP | FLAG_V4_TF2_IGNORE_PICMIP | FLAG_V4_TF2_STREAMABLE_COARSE | FLAG_V4_TF2_STREAMABLE_FINE
 
static constexpr uint32_t FLAGS_MASK_V5 = FLAG_V5_PWL_CORRECTED | FLAG_V5_SRGB | FLAG_V5_DEFAULT_POOL | FLAG_V5_LOAD_MOST_MIPS
 
static constexpr uint32_t FLAGS_MASK_V5_CSGO = FLAG_V5_CSGO_COMBINED | FLAG_V5_CSGO_ASYNC_DOWNLOAD | FLAG_V5_CSGO_SKIP_INITIAL_DOWNLOAD | FLAG_V5_CSGO_YCOCG | FLAG_V5_CSGO_ASYNC_SKIP_INITIAL_LOW_RES
 
static constexpr uint32_t FLAGS_MASK_INTERNAL = FLAG_NO_MIP | FLAG_ENVMAP
 
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 bool createInternal (VTF &writer, CreationOptions options)
 

Protected Attributes

bool opened = false
 
std::vector< std::byte > data
 
uint32_t version {}
 
uint16_t width {}
 
uint16_t height {}
 
uint32_t 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 145 of file VTF.h.

Member Enumeration Documentation

◆ FlagsV0

enum vtfpp::VTF::FlagsV0 : uint32_t
Enumerator
FLAG_POINT_SAMPLE 
FLAG_TRILINEAR 
FLAG_CLAMP_S 
FLAG_CLAMP_T 
FLAG_ANISOTROPIC 
FLAG_HINT_DXT5 
FLAG_NORMAL 
FLAG_NO_MIP 
FLAG_NO_LOD 
FLAG_MIN_MIP 
FLAG_PROCEDURAL 
FLAG_ONE_BIT_ALPHA 
FLAG_MULTI_BIT_ALPHA 
FLAG_ENVMAP 
FLAG_RENDERTARGET 
FLAG_DEPTH_RENDERTARGET 
FLAG_NO_DEBUG_OVERRIDE 
FLAG_SINGLE_COPY 

Definition at line 147 of file VTF.h.

◆ FlagsV2

enum vtfpp::VTF::FlagsV2 : uint32_t
Enumerator
FLAG_V2_NO_DEPTH_BUFFER 
FLAG_V2_CLAMP_U 

Definition at line 169 of file VTF.h.

◆ FlagsV3

enum vtfpp::VTF::FlagsV3 : uint32_t
Enumerator
FLAG_V3_LOAD_ALL_MIPS 
FLAG_V3_VERTEX_TEXTURE 
FLAG_V3_SSBUMP 
FLAG_V3_BORDER 

Definition at line 175 of file VTF.h.

◆ FlagsV4

enum vtfpp::VTF::FlagsV4 : uint32_t
Enumerator
FLAG_V4_SRGB 

Definition at line 183 of file VTF.h.

◆ FlagsV4_TF2

enum vtfpp::VTF::FlagsV4_TF2 : uint32_t
Enumerator
FLAG_V4_TF2_STAGING_MEMORY 
FLAG_V4_TF2_IMMEDIATE_CLEANUP 
FLAG_V4_TF2_IGNORE_PICMIP 
FLAG_V4_TF2_STREAMABLE_COARSE 
FLAG_V4_TF2_STREAMABLE_FINE 

Definition at line 188 of file VTF.h.

◆ FlagsV5

enum vtfpp::VTF::FlagsV5 : uint32_t
Enumerator
FLAG_V5_PWL_CORRECTED 
FLAG_V5_SRGB 
FLAG_V5_DEFAULT_POOL 
FLAG_V5_LOAD_MOST_MIPS 

Definition at line 197 of file VTF.h.

◆ FlagsV5_CSGO

enum vtfpp::VTF::FlagsV5_CSGO : uint32_t
Enumerator
FLAG_V5_CSGO_COMBINED 
FLAG_V5_CSGO_ASYNC_DOWNLOAD 
FLAG_V5_CSGO_SKIP_INITIAL_DOWNLOAD 
FLAG_V5_CSGO_YCOCG 
FLAG_V5_CSGO_ASYNC_SKIP_INITIAL_LOW_RES 

Definition at line 205 of file VTF.h.

◆ Platform

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

Definition at line 216 of file VTF.h.

Constructor & Destructor Documentation

◆ VTF() [1/6]

VTF::VTF ( )

Definition at line 159 of file VTF.cpp.

◆ VTF() [2/6]

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

Definition at line 176 of file VTF.cpp.

◆ VTF() [3/6]

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

Definition at line 468 of file VTF.cpp.

◆ VTF() [4/6]

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

Definition at line 471 of file VTF.cpp.

◆ VTF() [5/6]

VTF::VTF ( const VTF other)

Definition at line 474 of file VTF.cpp.

◆ VTF() [6/6]

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

Member Function Documentation

◆ addFlags()

void VTF::addFlags ( uint32_t  flags_)

Definition at line 759 of file VTF.cpp.

◆ bake() [1/2]

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

Definition at line 1547 of file VTF.cpp.

◆ bake() [2/2]

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

Definition at line 1797 of file VTF.cpp.

◆ computeMips()

Definition at line 873 of file VTF.cpp.

◆ computeReflectivity()

void VTF::computeReflectivity ( )

Definition at line 1005 of file VTF.cpp.

◆ computeThumbnail()

Definition at line 1519 of file VTF.cpp.

◆ computeTransparencyFlags()

void VTF::computeTransparencyFlags ( )

Definition at line 787 of file VTF.cpp.

◆ create() [1/6]

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

Definition at line 605 of file VTF.cpp.

◆ create() [2/6]

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

Definition at line 619 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 583 of file VTF.cpp.

◆ create() [4/6]

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

Definition at line 599 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 569 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 589 of file VTF.cpp.

◆ createInternal()

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

Definition at line 517 of file VTF.cpp.

◆ getBumpMapScale()

float VTF::getBumpMapScale ( ) const

Definition at line 1069 of file VTF.cpp.

◆ getCompressionLevel()

int16_t VTF::getCompressionLevel ( ) const

Definition at line 1353 of file VTF.cpp.

◆ getCompressionMethod()

CompressionMethod VTF::getCompressionMethod ( ) const

Definition at line 1361 of file VTF.cpp.

◆ getDefaultCompressedFormat()

ImageFormat VTF::getDefaultCompressedFormat ( ImageFormat  inputFormat,
uint32_t  version,
bool  isCubeMap 
)
static

Definition at line 802 of file VTF.cpp.

◆ getFaceCount()

uint8_t VTF::getFaceCount ( ) const

Definition at line 935 of file VTF.cpp.

◆ getFlags()

uint32_t VTF::getFlags ( ) const

Definition at line 751 of file VTF.cpp.

◆ getFormat()

ImageFormat VTF::getFormat ( ) const

Definition at line 817 of file VTF.cpp.

◆ getFrameCount()

uint16_t VTF::getFrameCount ( ) const

Definition at line 923 of file VTF.cpp.

◆ getHeight()

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

Definition at line 712 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 1388 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 1396 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 1379 of file VTF.cpp.

◆ getImageHeightResizeMethod()

ImageConversion::ResizeMethod VTF::getImageHeightResizeMethod ( ) const

Definition at line 691 of file VTF.cpp.

◆ getImageWidthResizeMethod()

ImageConversion::ResizeMethod VTF::getImageWidthResizeMethod ( ) const

Definition at line 687 of file VTF.cpp.

◆ getMipCount()

uint8_t VTF::getMipCount ( ) const

Definition at line 843 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 1272 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 1276 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 1230 of file VTF.cpp.

◆ getPlatform()

VTF::Platform VTF::getPlatform ( ) const

Definition at line 629 of file VTF.cpp.

◆ getReflectivity()

math::Vec3f VTF::getReflectivity ( ) const

Definition at line 997 of file VTF.cpp.

◆ getResource()

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

Definition at line 1093 of file VTF.cpp.

◆ getResourceInternal()

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

Definition at line 1102 of file VTF.cpp.

◆ getResources()

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

Definition at line 1089 of file VTF.cpp.

◆ getSliceCount()

uint16_t VTF::getSliceCount ( ) const

Definition at line 969 of file VTF.cpp.

◆ getStartFrame()

uint16_t VTF::getStartFrame ( ) const

Definition at line 989 of file VTF.cpp.

◆ getThumbnailDataAs()

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

Definition at line 1497 of file VTF.cpp.

◆ getThumbnailDataAsRGBA8888()

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

Definition at line 1505 of file VTF.cpp.

◆ getThumbnailDataRaw()

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

Definition at line 1490 of file VTF.cpp.

◆ getThumbnailFormat()

ImageFormat VTF::getThumbnailFormat ( ) const

Definition at line 1077 of file VTF.cpp.

◆ getThumbnailHeight()

uint8_t VTF::getThumbnailHeight ( ) const

Definition at line 1085 of file VTF.cpp.

◆ getThumbnailWidth()

uint8_t VTF::getThumbnailWidth ( ) const

Definition at line 1081 of file VTF.cpp.

◆ getVersion()

uint32_t VTF::getVersion ( ) const

Definition at line 650 of file VTF.cpp.

◆ getWidth()

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

Definition at line 708 of file VTF.cpp.

◆ hasImageData()

bool VTF::hasImageData ( ) const

Definition at line 1375 of file VTF.cpp.

◆ hasThumbnailData()

bool VTF::hasThumbnailData ( ) const

Definition at line 1486 of file VTF.cpp.

◆ isSRGB()

bool VTF::isSRGB ( ) const

Definition at line 767 of file VTF.cpp.

◆ operator bool()

VTF::operator bool ( ) const
explicit

Definition at line 513 of file VTF.cpp.

◆ operator=() [1/2]

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

Definition at line 478 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 1170 of file VTF.cpp.

◆ removeCRCResource()

void VTF::removeCRCResource ( )

Definition at line 1299 of file VTF.cpp.

◆ removeExtendedFlagsResource()

void VTF::removeExtendedFlagsResource ( )

Definition at line 1320 of file VTF.cpp.

◆ removeFlags()

void VTF::removeFlags ( uint32_t  flags_)

Definition at line 763 of file VTF.cpp.

◆ removeHotspotDataResource()

void VTF::removeHotspotDataResource ( )

Definition at line 1349 of file VTF.cpp.

◆ removeKeyValuesDataResource()

void VTF::removeKeyValuesDataResource ( )

Definition at line 1334 of file VTF.cpp.

◆ removeLODResource()

void VTF::removeLODResource ( )

Definition at line 1312 of file VTF.cpp.

◆ removeParticleSheetResource()

void VTF::removeParticleSheetResource ( )

Definition at line 1291 of file VTF.cpp.

◆ removeResourceInternal()

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

Definition at line 1166 of file VTF.cpp.

◆ removeThumbnail()

void VTF::removeThumbnail ( )

Definition at line 1529 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 1479 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 1475 of file VTF.cpp.

◆ saveThumbnailToFile() [1/2]

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

Definition at line 1540 of file VTF.cpp.

◆ saveThumbnailToFile() [2/2]

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

Definition at line 1536 of file VTF.cpp.

◆ setBumpMapScale()

void VTF::setBumpMapScale ( float  newBumpMapScale)

Definition at line 1073 of file VTF.cpp.

◆ setCompressionLevel()

void VTF::setCompressionLevel ( int16_t  newCompressionLevel)

Definition at line 1357 of file VTF.cpp.

◆ setCompressionMethod()

void VTF::setCompressionMethod ( CompressionMethod  newCompressionMethod)

Definition at line 1365 of file VTF.cpp.

◆ setCRCResource()

void VTF::setCRCResource ( uint32_t  value)

Definition at line 1295 of file VTF.cpp.

◆ setExtendedFlagsResource()

void VTF::setExtendedFlagsResource ( uint32_t  value)

Definition at line 1316 of file VTF.cpp.

◆ setFaceCount()

bool VTF::setFaceCount ( bool  isCubeMap)

Definition at line 961 of file VTF.cpp.

◆ setFlags()

void VTF::setFlags ( uint32_t  flags_)

Definition at line 755 of file VTF.cpp.

◆ setFormat()

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

Definition at line 821 of file VTF.cpp.

◆ setFrameCount()

bool VTF::setFrameCount ( uint16_t  newFrameCount)

Definition at line 927 of file VTF.cpp.

◆ setFrameFaceAndSliceCount()

bool VTF::setFrameFaceAndSliceCount ( uint16_t  newFrameCount,
bool  isCubeMap,
uint16_t  newSliceCount = 1 
)

Definition at line 981 of file VTF.cpp.

◆ setHotspotDataResource()

void VTF::setHotspotDataResource ( const HOT value)

Definition at line 1338 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 1445 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 1400 of file VTF.cpp.

◆ setImageHeightResizeMethod()

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

Definition at line 704 of file VTF.cpp.

◆ setImageResizeMethods()

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

Definition at line 695 of file VTF.cpp.

◆ setImageWidthResizeMethod()

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

Definition at line 700 of file VTF.cpp.

◆ setKeyValuesDataResource()

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

Definition at line 1324 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 1303 of file VTF.cpp.

◆ setMipCount()

bool VTF::setMipCount ( uint8_t  newMipCount)

Definition at line 847 of file VTF.cpp.

◆ setParticleSheetResource()

void VTF::setParticleSheetResource ( const SHT value)

Definition at line 1280 of file VTF.cpp.

◆ setPlatform()

void VTF::setPlatform ( Platform  newPlatform)

Definition at line 633 of file VTF.cpp.

◆ setRecommendedMipCount()

bool VTF::setRecommendedMipCount ( )

Definition at line 866 of file VTF.cpp.

◆ setReflectivity()

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

Definition at line 1001 of file VTF.cpp.

◆ setResourceInternal()

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

Definition at line 1111 of file VTF.cpp.

◆ setSize()

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

Definition at line 716 of file VTF.cpp.

◆ setSliceCount()

bool VTF::setSliceCount ( uint16_t  newSliceCount)

Definition at line 973 of file VTF.cpp.

◆ setSRGB()

void VTF::setSRGB ( bool  srgb)

Definition at line 771 of file VTF.cpp.

◆ setStartFrame()

void VTF::setStartFrame ( uint16_t  newStartFrame)

Definition at line 993 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 1509 of file VTF.cpp.

◆ setVersion()

void VTF::setVersion ( uint32_t  newVersion)

Definition at line 654 of file VTF.cpp.

Member Data Documentation

◆ bumpMapScale

float vtfpp::VTF::bumpMapScale {}
protected

Definition at line 482 of file VTF.h.

◆ compressionLevel

int16_t vtfpp::VTF::compressionLevel = 0
protected

Definition at line 501 of file VTF.h.

◆ compressionMethod

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

Definition at line 502 of file VTF.h.

◆ data

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

Definition at line 465 of file VTF.h.

◆ flags

uint32_t vtfpp::VTF::flags {}
protected

Definition at line 473 of file VTF.h.

◆ FLAGS_MASK_INTERNAL

constexpr uint32_t vtfpp::VTF::FLAGS_MASK_INTERNAL = FLAG_NO_MIP | FLAG_ENVMAP
staticconstexpr

Definition at line 214 of file VTF.h.

◆ FLAGS_MASK_V0

◆ FLAGS_MASK_V2

constexpr uint32_t vtfpp::VTF::FLAGS_MASK_V2 = FLAG_V2_NO_DEPTH_BUFFER | FLAG_V2_CLAMP_U
staticconstexpr

Definition at line 173 of file VTF.h.

◆ FLAGS_MASK_V3

constexpr uint32_t vtfpp::VTF::FLAGS_MASK_V3 = FLAG_V3_LOAD_ALL_MIPS | FLAG_V3_VERTEX_TEXTURE | FLAG_V3_SSBUMP | FLAG_V3_BORDER
staticconstexpr

Definition at line 181 of file VTF.h.

◆ FLAGS_MASK_V4

constexpr uint32_t vtfpp::VTF::FLAGS_MASK_V4 = FLAG_V4_SRGB
staticconstexpr

Definition at line 186 of file VTF.h.

◆ FLAGS_MASK_V4_TF2

Definition at line 195 of file VTF.h.

◆ FLAGS_MASK_V5

constexpr uint32_t vtfpp::VTF::FLAGS_MASK_V5 = FLAG_V5_PWL_CORRECTED | FLAG_V5_SRGB | FLAG_V5_DEFAULT_POOL | FLAG_V5_LOAD_MOST_MIPS
staticconstexpr

Definition at line 203 of file VTF.h.

◆ FLAGS_MASK_V5_CSGO

Definition at line 212 of file VTF.h.

◆ format

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

Definition at line 483 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 251 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 248 of file VTF.h.

◆ frameCount

uint16_t vtfpp::VTF::frameCount = 1
protected

Definition at line 475 of file VTF.h.

◆ height

uint16_t vtfpp::VTF::height {}
protected

Definition at line 472 of file VTF.h.

◆ imageHeightResizeMethod

Definition at line 504 of file VTF.h.

◆ imageWidthResizeMethod

Definition at line 503 of file VTF.h.

◆ mipCount

uint8_t vtfpp::VTF::mipCount = 1
protected

Definition at line 484 of file VTF.h.

◆ opened

bool vtfpp::VTF::opened = false
protected

Definition at line 463 of file VTF.h.

◆ platform

Platform vtfpp::VTF::platform = PLATFORM_PC
protected

Definition at line 500 of file VTF.h.

◆ reflectivity

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

Definition at line 479 of file VTF.h.

◆ resources

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

Definition at line 496 of file VTF.h.

◆ sliceCount

uint16_t vtfpp::VTF::sliceCount = 1
protected

Definition at line 491 of file VTF.h.

◆ startFrame

uint16_t vtfpp::VTF::startFrame {}
protected

Definition at line 476 of file VTF.h.

◆ thumbnailFormat

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

Definition at line 486 of file VTF.h.

◆ thumbnailHeight

uint8_t vtfpp::VTF::thumbnailHeight {}
protected

Definition at line 488 of file VTF.h.

◆ thumbnailWidth

uint8_t vtfpp::VTF::thumbnailWidth {}
protected

Definition at line 487 of file VTF.h.

◆ version

uint32_t vtfpp::VTF::version {}
protected

Definition at line 468 of file VTF.h.

◆ width

uint16_t vtfpp::VTF::width {}
protected

Definition at line 471 of file VTF.h.


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