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

#include <PPL.h>

Collaboration diagram for vtfpp::PPL:

Classes

struct  Image
 

Public Member Functions

 PPL (uint32_t modelChecksum, ImageFormat format_=ImageFormat::RGB888, uint32_t version_=0)
 
 PPL (std::span< const std::byte > pplData)
 
 PPL (const std::string &pplPath)
 
 operator bool () const
 
uint32_t getVersion () const
 
void setVersion (uint32_t newVersion)
 
uint32_t getModelChecksum () const
 
void setModelChecksum (uint32_t newChecksum)
 
ImageFormat getFormat () const
 
void setFormat (ImageFormat newFormat)
 
bool hasImageForLOD (uint32_t lod) const
 
std::vector< uint32_t > getImageLODs () const
 
const ImagegetImageRaw (uint32_t lod=0) const
 
std::optional< ImagegetImageAs (ImageFormat newFormat, uint32_t lod=0) const
 
std::optional< ImagegetImageAsRGB888 (uint32_t lod=0) const
 
bool setImage (std::span< const std::byte > imageData, ImageFormat format_, uint32_t width, uint32_t height, uint32_t lod=0)
 
bool setImage (std::span< const std::byte > imageData, ImageFormat format_, uint32_t width, uint32_t height, uint32_t resizedWidth, uint32_t resizedHeight, uint32_t lod=0, ImageConversion::ResizeFilter filter=ImageConversion::ResizeFilter::DEFAULT)
 
bool setImage (const std::string &imagePath, uint32_t lod=0)
 
bool setImage (const std::string &imagePath, uint32_t resizedWidth, uint32_t resizedHeight, uint32_t lod=0, ImageConversion::ResizeFilter filter=ImageConversion::ResizeFilter::DEFAULT)
 
std::vector< std::byte > saveImageToFile (uint32_t lod=0, ImageConversion::FileFormat fileFormat=ImageConversion::FileFormat::DEFAULT) const
 
bool saveImageToFile (const std::string &imagePath, uint32_t lod=0, ImageConversion::FileFormat fileFormat=ImageConversion::FileFormat::DEFAULT) const
 
std::vector< std::byte > bake ()
 
bool bake (const std::string &pplPath)
 

Protected Attributes

uint32_t version {}
 
uint32_t checksum {}
 
ImageFormat format {}
 
std::unordered_map< uint32_t, Imageimages
 

Detailed Description

Definition at line 14 of file PPL.h.

Constructor & Destructor Documentation

◆ PPL() [1/3]

PPL::PPL ( uint32_t  modelChecksum,
ImageFormat  format_ = ImageFormat::RGB888,
uint32_t  version_ = 0 
)
explicit

Definition at line 10 of file PPL.cpp.

◆ PPL() [2/3]

PPL::PPL ( std::span< const std::byte >  pplData)
explicit

Definition at line 15 of file PPL.cpp.

◆ PPL() [3/3]

PPL::PPL ( const std::string &  pplPath)
explicit

Definition at line 37 of file PPL.cpp.

Member Function Documentation

◆ bake() [1/2]

std::vector< std::byte > PPL::bake ( )

Definition at line 180 of file PPL.cpp.

◆ bake() [2/2]

bool PPL::bake ( const std::string &  pplPath)

Definition at line 216 of file PPL.cpp.

◆ getFormat()

ImageFormat PPL::getFormat ( ) const

Definition at line 60 of file PPL.cpp.

◆ getImageAs()

std::optional< PPL::Image > PPL::getImageAs ( ImageFormat  newFormat,
uint32_t  lod = 0 
) const

Definition at line 87 of file PPL.cpp.

◆ getImageAsRGB888()

std::optional< PPL::Image > PPL::getImageAsRGB888 ( uint32_t  lod = 0) const

Definition at line 99 of file PPL.cpp.

◆ getImageLODs()

std::vector< uint32_t > PPL::getImageLODs ( ) const

Definition at line 75 of file PPL.cpp.

◆ getImageRaw()

const PPL::Image * PPL::getImageRaw ( uint32_t  lod = 0) const

Definition at line 80 of file PPL.cpp.

◆ getModelChecksum()

uint32_t PPL::getModelChecksum ( ) const

Definition at line 52 of file PPL.cpp.

◆ getVersion()

uint32_t PPL::getVersion ( ) const

Definition at line 44 of file PPL.cpp.

◆ hasImageForLOD()

bool PPL::hasImageForLOD ( uint32_t  lod) const

Definition at line 71 of file PPL.cpp.

◆ operator bool()

PPL::operator bool ( ) const
explicit

Definition at line 40 of file PPL.cpp.

◆ saveImageToFile() [1/2]

bool PPL::saveImageToFile ( const std::string &  imagePath,
uint32_t  lod = 0,
ImageConversion::FileFormat  fileFormat = ImageConversion::FileFormat::DEFAULT 
) const

Definition at line 173 of file PPL.cpp.

◆ saveImageToFile() [2/2]

std::vector< std::byte > PPL::saveImageToFile ( uint32_t  lod = 0,
ImageConversion::FileFormat  fileFormat = ImageConversion::FileFormat::DEFAULT 
) const

Definition at line 166 of file PPL.cpp.

◆ setFormat()

void PPL::setFormat ( ImageFormat  newFormat)

Definition at line 64 of file PPL.cpp.

◆ setImage() [1/4]

bool PPL::setImage ( const std::string &  imagePath,
uint32_t  lod = 0 
)

Definition at line 128 of file PPL.cpp.

◆ setImage() [2/4]

bool PPL::setImage ( const std::string &  imagePath,
uint32_t  resizedWidth,
uint32_t  resizedHeight,
uint32_t  lod = 0,
ImageConversion::ResizeFilter  filter = ImageConversion::ResizeFilter::DEFAULT 
)

Definition at line 147 of file PPL.cpp.

◆ setImage() [3/4]

bool PPL::setImage ( std::span< const std::byte >  imageData,
ImageFormat  format_,
uint32_t  width,
uint32_t  height,
uint32_t  lod = 0 
)

Definition at line 103 of file PPL.cpp.

◆ setImage() [4/4]

bool PPL::setImage ( std::span< const std::byte >  imageData,
ImageFormat  format_,
uint32_t  width,
uint32_t  height,
uint32_t  resizedWidth,
uint32_t  resizedHeight,
uint32_t  lod = 0,
ImageConversion::ResizeFilter  filter = ImageConversion::ResizeFilter::DEFAULT 
)

Definition at line 115 of file PPL.cpp.

◆ setModelChecksum()

void PPL::setModelChecksum ( uint32_t  newChecksum)

Definition at line 56 of file PPL.cpp.

◆ setVersion()

void PPL::setVersion ( uint32_t  newVersion)

Definition at line 48 of file PPL.cpp.

Member Data Documentation

◆ checksum

uint32_t vtfpp::PPL::checksum {}
protected

Definition at line 70 of file PPL.h.

◆ format

ImageFormat vtfpp::PPL::format {}
protected

Definition at line 71 of file PPL.h.

◆ images

std::unordered_map<uint32_t, Image> vtfpp::PPL::images
protected

Definition at line 73 of file PPL.h.

◆ version

uint32_t vtfpp::PPL::version {}
protected

Definition at line 69 of file PPL.h.


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