VTFLib
A C and C++ API that, with a few simple functions, can open and save .vtf and .vmt files.
|
VTF File access/creation class. More...
#include <VTFFile.h>
Public Member Functions | |
CVTFFile () | |
Default constructor. | |
CVTFFile (const CVTFFile &VTFFile) | |
Create a new VTFFile class as a copy of another. More... | |
CVTFFile (const CVTFFile &VTFFile, VTFImageFormat ImageFormat) | |
Create a new VTFFile class as a duplicate of another. More... | |
~CVTFFile () | |
Deconstructor. | |
vlBool | Create (vlUInt uiWidth, vlUInt uiHeight, vlUInt uiFrames=1, vlUInt uiFaces=1, vlUInt uiSlices=1, VTFImageFormat ImageFormat=IMAGE_FORMAT_RGBA8888, vlBool bThumbnail=vlTrue, vlBool bMipmaps=vlTrue, vlBool bNullImageData=vlFalse) |
Creates a new empty VTF image.. More... | |
vlBool | Create (vlUInt uiWidth, vlUInt uiHeight, vlByte *lpImageDataRGBA8888, const SVTFCreateOptions &VTFCreateOptions) |
Create a new VTF image from existing data. More... | |
vlBool | Create (vlUInt uiWidth, vlUInt uiHeight, vlUInt uiFrames, vlUInt uiFaces, vlUInt vlSlices, vlByte **lpImageDataRGBA8888, const SVTFCreateOptions &VTFCreateOptions) |
Create a new VTF multi-frame or cubemap image from existing data. More... | |
vlVoid | Destroy () |
Destroys the current VTF image by setting the header, thumbnail and image data to zero. | |
vlBool | IsLoaded () const |
Check if a VTFFile image is loaded or valid. More... | |
vlBool | Load (const vlChar *cFileName, vlBool bHeaderOnly=vlFalse) |
Loads a VTF image from disk. More... | |
vlBool | Load (const vlVoid *lpData, vlSize uiBufferSize, vlBool bHeaderOnly=vlFalse) |
Loads a VTF image from memory. More... | |
vlBool | Load (vlVoid *pUserData, vlBool bHeaderOnly=vlFalse) |
Loads a VTF image using callback functions. More... | |
vlBool | Save (const vlChar *cFileName) const |
Save a VTF image from disk. More... | |
vlBool | Save (vlVoid *lpData, vlSize uiBufferSize, vlSize &uiSize) const |
Save a VTF image to memory. More... | |
vlBool | Save (vlVoid *pUserData) const |
Save a VTF image using callback functions. More... | |
vlBool | GetHasImage () const |
Check if image data has been loaded. More... | |
vlUInt | GetMajorVersion () const |
Returns the VTF file major version number. | |
vlUInt | GetMinorVersion () const |
Returns the VTF file minor version number. | |
vlUInt | GetSize () const |
Returns the VTF file size in bytes. | |
vlUInt | GetWidth () const |
Returns the width of the image in pixels from the VTF header. | |
vlUInt | GetHeight () const |
Returns the height of the image in pixels from the VTF header. | |
vlUInt | GetDepth () const |
Returns the depth of the image in pixels from the VTF header. | |
vlUInt | GetFrameCount () const |
Returns the frame count from the VTF header. | |
vlUInt | GetFaceCount () const |
Returns the face count from the VTF header. | |
vlUInt | GetMipmapCount () const |
Returns the number of MIP levels in the image from the VTF header. | |
vlUInt | GetStartFrame () const |
Returns the start frame from the VTF header. | |
vlVoid | SetStartFrame (vlUInt uiStartFrame) |
Sets the start frame in the VTF header. | |
vlUInt | GetFlags () const |
Returns the image flags from the VTF header. | |
vlVoid | SetFlags (vlUInt uiFlags) |
Sets the image flags in the VTF header. | |
vlBool | GetFlag (VTFImageFlag ImageFlag) const |
Check if a specific flag is set in the VTF header. More... | |
vlVoid | SetFlag (VTFImageFlag ImageFlag, vlBool bState) |
Set the state of a specific flag in the VTF header. More... | |
vlSingle | GetBumpmapScale () const |
Get the bump scale value. | |
vlVoid | SetBumpmapScale (vlSingle sBumpmapScale) |
Set the bump scale value. More... | |
vlVoid | GetReflectivity (vlSingle &sX, vlSingle &sY, vlSingle &sZ) const |
Get the reflectivity values. More... | |
vlVoid | SetReflectivity (vlSingle sX, vlSingle sY, vlSingle sZ) |
Set the reflectivity values. More... | |
VTFImageFormat | GetFormat () const |
Returns the storage format of the main image data set in the VTF header. | |
vlByte * | GetData (vlUInt uiFrame, vlUInt uiFace, vlUInt uiSlice, vlUInt uiMipmapLevel) const |
Get a pointer to the image data for a specific image. More... | |
vlVoid | SetData (vlUInt uiFrame, vlUInt uiFace, vlUInt uiSlice, vlUInt uiMipmapLevel, vlByte *lpData) |
Set the image data for a specific image. More... | |
vlBool | GetHasThumbnail () const |
Returns if a the current VTF image image contains a thumbnail version. | |
vlUInt | GetThumbnailWidth () const |
Returns the width in pixels of the current images thumbnail. | |
vlUInt | GetThumbnailHeight () const |
Returns the heught in pixels of the current images thumbnail. | |
VTFImageFormat | GetThumbnailFormat () const |
Returns the image format of the current images thumbnail. | |
vlByte * | GetThumbnailData () const |
Get a pointer to the thumbnail image data for the current image. More... | |
vlVoid | SetThumbnailData (vlByte *lpData) |
Set the thumbnail image data for the current image. More... | |
vlBool | GetSupportsResources () const |
Returns true if the current VTF file version supports resources. | |
vlUInt | GetResourceCount () const |
Returns the number of resources contained within the VTF file. | |
vlUInt | GetResourceType (vlUInt uiIndex) const |
Returns the resource type;. | |
vlBool | GetHasResource (vlUInt uiType) const |
Returns true if the resource exists. | |
vlVoid * | GetResourceData (vlUInt uiType, vlUInt &uiSize) const |
Get a VTF resource type's data. More... | |
vlVoid * | SetResourceData (vlUInt uiType, vlUInt uiSize, vlVoid *lpData) |
Set a VTF resource type's data. More... | |
vlBool | GenerateMipmaps (VTFMipmapFilter MipmapFilter=MIPMAP_FILTER_BOX, VTFSharpenFilter SharpenFilter=SHARPEN_FILTER_NONE) |
Generate MIP maps from the main image data. More... | |
vlBool | GenerateMipmaps (vlUInt uiFace, vlUInt uiFrame, VTFMipmapFilter MipmapFilter=MIPMAP_FILTER_BOX, VTFSharpenFilter SharpenFilter=SHARPEN_FILTER_NONE) |
Generate MIP maps from a specific face and frame. More... | |
vlBool | GenerateThumbnail () |
Generate a thumbnail image. More... | |
vlBool | GenerateNormalMap (VTFKernelFilter KernelFilter=KERNEL_FILTER_3X3, VTFHeightConversionMethod HeightConversionMethod=HEIGHT_CONVERSION_METHOD_AVERAGE_RGB, VTFNormalAlphaResult NormalAlphaResult=NORMAL_ALPHA_RESULT_WHITE) |
Convert image to a normal map. More... | |
vlBool | GenerateNormalMap (vlUInt uiFrame, VTFKernelFilter KernelFilter=KERNEL_FILTER_3X3, VTFHeightConversionMethod HeightConversionMethod=HEIGHT_CONVERSION_METHOD_AVERAGE_RGB, VTFNormalAlphaResult NormalAlphaResult=NORMAL_ALPHA_RESULT_WHITE) |
Convert image to a normal map from a specific frame. More... | |
vlBool | GenerateSphereMap () |
Creates a spheremap from using the 6 faces of the image making up its cubemap. | |
vlBool | ComputeReflectivity () |
Calculates and sets the reflectivity vector values for the VTF image based on the colour averages of each pixel. | |
Static Public Member Functions | |
static SVTFImageFormatInfo const & | GetImageFormatInfo (VTFImageFormat ImageFormat) |
Get VTFImageFormat info. More... | |
static vlUInt | ComputeImageSize (vlUInt uiWidth, vlUInt uiHeight, vlUInt uiDepth, VTFImageFormat ImageFormat) |
Calculate data buffer size for an image. More... | |
static vlUInt | ComputeImageSize (vlUInt uiWidth, vlUInt uiHeight, vlUInt uiDepth, vlUInt uiMipmaps, VTFImageFormat ImageFormat) |
Calculate data buffer size for an image with MIP maps. More... | |
static vlUInt | ComputeMipmapCount (vlUInt uiWidth, vlUInt uiHeight, vlUInt uiDepth) |
Compute the number of MIP maps needed by an image. More... | |
static vlVoid | ComputeMipmapDimensions (vlUInt uiWidth, vlUInt uiHeight, vlUInt uiDepth, vlUInt uiMipmapLevel, vlUInt &uiMipmapWidth, vlUInt &uiMipmapHeight, vlUInt &uiMipmapDepth) |
Compute the dimensions of a specific MIP level. More... | |
static vlUInt | ComputeMipmapSize (vlUInt uiWidth, vlUInt uiHeight, vlUInt uiDepth, vlUInt uiMipmapLevel, VTFImageFormat ImageFormat) |
Compute how much memory a specific MIP map level needs. More... | |
static vlBool | ConvertToRGBA8888 (const vlByte *lpSource, vlByte *lpDest, vlUInt uiWidth, vlUInt uiHeight, VTFImageFormat SourceFormat) |
Convert an image to RGBA8888 format. More... | |
static vlBool | ConvertFromRGBA8888 (const vlByte *lpSource, vlByte *lpDest, vlUInt uiWidth, vlUInt uiHeight, VTFImageFormat DestFormat) |
Convert an image from RGBA8888 format. More... | |
static vlBool | Convert (const vlByte *lpSource, vlByte *lpDest, vlUInt uiWidth, vlUInt uiHeight, VTFImageFormat SourceFormat, VTFImageFormat DestFormat) |
Convert an image from any format to any format. More... | |
static vlBool | ConvertToNormalMap (const vlByte *lpSourceRGBA8888, vlByte *lpDestRGBA8888, vlUInt uiWidth, vlUInt uiHeight, VTFKernelFilter KernelFilter=KERNEL_FILTER_3X3, VTFHeightConversionMethod HeightConversionMethod=HEIGHT_CONVERSION_METHOD_AVERAGE_RGB, VTFNormalAlphaResult NormalAlphaResult=NORMAL_ALPHA_RESULT_WHITE, vlByte bMinimumZ=0, vlSingle sScale=2.0f, vlBool bWrap=vlFalse, vlBool bInvertX=vlFalse, vlBool bInvertY=vlFalse, vlBool bInvertZ=vlFalse) |
Convert an image to a normal map. More... | |
static vlBool | Resize (const vlByte *lpSourceRGBA8888, vlByte *lpDestRGBA8888, vlUInt uiSourceWidth, vlUInt uiSourceHeight, vlUInt uiDestWidth, vlUInt uiDestHeight, VTFMipmapFilter ResizeFilter=MIPMAP_FILTER_TRIANGLE, VTFSharpenFilter SharpenFilter=SHARPEN_FILTER_NONE) |
Re-sizes an image. More... | |
static vlVoid | CorrectImageGamma (vlByte *lpImageDataRGBA8888, vlUInt uiWidth, vlUInt uiHeight, vlSingle sGammaCorrection) |
Correct and images gamma. More... | |
static vlVoid | ComputeImageReflectivity (const vlByte *lpImageDataRGBA8888, vlUInt uiWidth, vlUInt uiHeight, vlSingle &sX, vlSingle &sY, vlSingle &sZ) |
Computes the reflectivity for an image. More... | |
static vlVoid | FlipImage (vlByte *lpImageDataRGBA8888, vlUInt uiWidth, vlUInt uiHeight) |
Flips an image vertically along its X-axis. | |
static vlVoid | MirrorImage (vlByte *lpImageDataRGBA8888, vlUInt uiWidth, vlUInt uiHeight) |
Flips an image horizontally along its Y-axis. | |
VTF File access/creation class.
The CVTFFile class is the component designed for working with VTF format image files. Its public functions allow you to load, save and create new VTF files plus perform various processes on the image data such as the generation of MIP maps or Normal maps.
VTFFile generally use RGBA8888 format for passing data to and from functions. This is 4 bytes per pixel, 8-bits per channel colour or in short, uncompressed 32-bit image data. There are functions for converting the data to other formats internally, however for image creation you are probably sticking best with RGBA8888 for simplicity.
The majority of functions return a vlBool value. This is simply a test as to whether a function has succeeded or failed to execute properly. In the case of functions for checking flags, the vlBool indicates if the flag is set or unset. Other data types reflect the purpose of the function used.
CVTFFile::CVTFFile | ( | const CVTFFile & | VTFFile | ) |
Create a new VTFFile class as a copy of another.
Creates a new VTFFile class as a copy of an existing one. The copy is not linked so any changes to it will not effect the class instance it was derived from.
VTFFile | is the CVTFFile class you want to copy. |
CVTFFile::CVTFFile | ( | const CVTFFile & | VTFFile, |
VTFImageFormat | ImageFormat | ||
) |
Create a new VTFFile class as a duplicate of another.
Create a new VTFFile class as a duplicate of an existing one, but convert the image data to the specified format.
VTFFile | is the CVTFFile class you want to copy. |
ImageFormat | the format you want to convert the copied image data to. |
|
static |
Computes the reflectivity for an image.
Calculates and sets the reflectivity vector values for the VTF image based on the colour averages of each pixel.
lpImageDataRGBA8888 | is a pointer to the image data in RGBA8888 format. |
uiWidth | is the width of the source image in pixels. |
uiHeight | is the height of the source image in pixels. |
sX,sY,sZ | are the variables to hold the values reflectivity vector. |
|
static |
Calculate data buffer size for an image.
Returns the total memory needed in bytes for an image uiWidth and uiHeight in size, in the specified format. The result includes the memory used by all MIP map levels from the largest dimension down to 1 x 1 pixel.
uiWidth | is the width in pixels of the largest MIP level. |
uiHeight | is the height in pixels of the largest MIP level. |
uiDepth | is the depth in pixels of the largest MIP level. |
ImageFormat | is the storage format of the image data. |
|
static |
Calculate data buffer size for an image with MIP maps.
Returns the total memory needed in bytes for an image uiWidth and uiHeight in size, in the specified format. The result includes the memory used by the number of MIP maps given as uiMipmaps starting with the original width and height.
uiWidth | is the width in pixels of the largest MIP level. |
uiHeight | is the height in pixels of the largest MIP level. |
uiDepth | is the depth in pixels of the largest MIP level. |
uiMipmaps | is the number of MIP maps to include in the calculation starting with the largest. |
ImageFormat | is the storage format of the image data. |
Compute the number of MIP maps needed by an image.
Returns how many MIP map levels an image of the specified size will need down to 1 x 1 pixels. The count includes the original source image.
uiWidth | is the width in pixels of the original image. |
uiHeight | is the height in pixels of the original image. |
uiDepth | is the depth in pixels of the original image. |
|
static |
Compute the dimensions of a specific MIP level.
Returns the dimensions of a given MIP level where the largest MIP level (level 0) is the specified width and height.
uiWidth | is the width in pixels of the largest MIP level. |
uiHeight | is the height in pixels of the largest MIP level. |
uiDepth | is the depth in pixels of the largest MIP level. |
uiMipmapLevel | is the MIP level you want the dimensions of. |
uiMipmapWidth | is the variable to hold the calculated width. |
uiMipmapHeight | is the variable to hold the calculated height. |
uiMipmapDepth | is the variable to hold the calculated depth. |
|
static |
Compute how much memory a specific MIP map level needs.
Computers the total memory needed in bytes for the a specific MIP map level of an image of a given width and height stored in the specified image format.
uiWidth | is the width in pixels of the source image. |
uiHeight | is the height in pixels of the source image. |
uiDepth | is the depth in pixels of the source image. |
uiMipmapLevel | is the MIP level you want the size of. |
ImageFormat | is the image format the MIP map image data is stored in. |
|
static |
Convert an image from any format to any format.
Converts image data stored in any format to the the specified storage format.
lpSource | is a pointer to the source image data. |
lpDest | is a pointer to the buffer for the converted data. |
uiWidth | is the width of the source image in pixels. |
uiHeight | is the height of the source image in pixels. |
SourceFormat | is the image format you are converting from. |
DestFormat | is the image format you wish to convert to. |
|
static |
Convert an image from RGBA8888 format.
Converts image data stored in RGBA8888 format to the the specified storage format.
lpSource | is a pointer to the source image data in RGBA8888 format. |
lpDest | is a pointer to the buffer for the converted data. |
uiWidth | is the width of the source image in pixels. |
uiHeight | is the height of the source image in pixels. |
DestFormat | is the image format you wish to convert to. |
|
static |
Convert an image to a normal map.
Converts image data stored in RGBA8888 format to a normal map.
lpSourceRGBA8888 | is a pointer to the source image data in RGBA8888 format. |
lpDestRGBA8888 | is a pointer to the buffer for the converted data. |
uiWidth | is the width of the source image in pixels. |
uiHeight | is the height of the source image in pixels. |
KernelFilter | is the kernel filter to use (default 3x3). |
HeightConversionMethod | is the method of determining the height data from the source (default average RGB). |
NormalAlphaResult | is how the alpha channel should be handled post processing (defaul make 100% opaque). |
bMinimumZ | is the minimum normal Z value (default 0). |
sScale | is the normal map height scale (default 2). |
bWrap | sets whether the normal map should be tileable (default false). |
bInvertX | sets if the normal map should be flipped along its X axis (default false). |
bInvertY | sets if the normal map should be flipped along its Y axis (default false). |
bInvertZ | sets if the normal map should be flipped along its Z axis (default false). |
|
static |
Convert an image to RGBA8888 format.
Converts image data stored in the given format to RGBA8888 format.
lpSource | is a pointer to the source image data. |
lpDest | is a pointer to the buffer for the converted data. |
uiWidth | is the width of the source image in pixels. |
uiHeight | is the height of the source image in pixels. |
SourceFormat | is the image format of the source data. |
|
static |
Correct and images gamma.
Applies gamma correction to an image.
lpImageDataRGBA8888 | is a pointer to the image data in RGBA8888 format. |
uiWidth | is the width of the source image in pixels. |
uiHeight | is the height of the source image in pixels. |
sGammaCorrection | is the amount of gamma correction to apply. |
vlBool CVTFFile::Create | ( | vlUInt | uiWidth, |
vlUInt | uiHeight, | ||
vlUInt | uiFrames = 1 , |
||
vlUInt | uiFaces = 1 , |
||
vlUInt | uiSlices = 1 , |
||
VTFImageFormat | ImageFormat = IMAGE_FORMAT_RGBA8888 , |
||
vlBool | bThumbnail = vlTrue , |
||
vlBool | bMipmaps = vlTrue , |
||
vlBool | bNullImageData = vlFalse |
||
) |
Creates a new empty VTF image..
Creates a new empty VTF format image within a the current CVTFFile class.
uiWidth | is the width in pixels of the main VTF image. |
uiHeight | is the height in pixels of the main VTF image. |
uiFrames | is the number of frames in the VTF image (default 1). |
uiFaces | is the number of faces in the VTF image (default 1). |
uiSlices | is the number of z slices in the VTF image (default 1). |
ImageFormat | is the storage format of the main VTF image (default RGBA8888). |
bThumbnail | sets if the VTF image will contain an additional thumbnail (default true). |
bMipmaps | sets if the VTF image will contain mipmaps (default true). |
bNullImageData | sets if the image data should be zero'd out on creation (default false). |
vlBool CVTFFile::Create | ( | vlUInt | uiWidth, |
vlUInt | uiHeight, | ||
vlByte * | lpImageDataRGBA8888, | ||
const SVTFCreateOptions & | VTFCreateOptions | ||
) |
Create a new VTF image from existing data.
Creates a new VTF image using image data already stored in memory. The existing image data should be stored in RGBA8888 format.
uiWidth | is the width in pixels of the main VTF image. |
uiHeight | is the height in pixels of the main VTF image. |
lpImageDataRGBA8888 | is a pointer to the source RGBA8888 data. |
VTFCreateOptions | contains the options for image creation. |
vlBool CVTFFile::Create | ( | vlUInt | uiWidth, |
vlUInt | uiHeight, | ||
vlUInt | uiFrames, | ||
vlUInt | uiFaces, | ||
vlUInt | vlSlices, | ||
vlByte ** | lpImageDataRGBA8888, | ||
const SVTFCreateOptions & | VTFCreateOptions | ||
) |
Create a new VTF multi-frame or cubemap image from existing data.
Creates a new multi-frame or cubemap VTF image using image data already stored in memory. The existing image data should be stored in RGBA8888 format.
uiWidth | is the width in pixels of the main VTF image. |
uiHeight | is the height in pixels of the main VTF image. |
uiFrames | is the number of frames in the VTF image. |
uiFaces | is the number of faces in the VTF image. |
vlSlices | is the number of z slices in the VTF image. |
lpImageDataRGBA8888 | is an array of pointers to the image data for each frame/face. |
VTFCreateOptions | contains the options for image creation. |
vlBool CVTFFile::GenerateMipmaps | ( | VTFMipmapFilter | MipmapFilter = MIPMAP_FILTER_BOX , |
VTFSharpenFilter | SharpenFilter = SHARPEN_FILTER_NONE |
||
) |
Generate MIP maps from the main image data.
Generates MIP maps for the image down to 1 x 1 pixel using the data in MIP level 0 as the source. Unless otherwise specified, a standard box filter with no sharpening is used during compression.
MipmapFilter | is the reduction filter to use (default Box). |
SharpenFilter | is the sharpening filter to use (default none). |
vlBool CVTFFile::GenerateMipmaps | ( | vlUInt | uiFace, |
vlUInt | uiFrame, | ||
VTFMipmapFilter | MipmapFilter = MIPMAP_FILTER_BOX , |
||
VTFSharpenFilter | SharpenFilter = SHARPEN_FILTER_NONE |
||
) |
Generate MIP maps from a specific face and frame.
Generates MIP maps for the image down to 1 x 1 pixel using the data in the given face and frame as the source. Unless otherwise specified, a standard box filter with no sharpening is used during compression.
uiFace | is the face index to use. |
uiFrame | is the frame index to use. |
MipmapFilter | is the reduction filter to use (default Box). |
SharpenFilter | is the sharpening filter to use (default none). |
vlBool CVTFFile::GenerateNormalMap | ( | VTFKernelFilter | KernelFilter = KERNEL_FILTER_3X3 , |
VTFHeightConversionMethod | HeightConversionMethod = HEIGHT_CONVERSION_METHOD_AVERAGE_RGB , |
||
VTFNormalAlphaResult | NormalAlphaResult = NORMAL_ALPHA_RESULT_WHITE |
||
) |
Convert image to a normal map.
Converts the image to a normal map using the image data in MIP level 0 as the source.
KernelFilter | is the kernel filter to use (default 3x3). |
HeightConversionMethod | is the method of determining the height data from the source (default average RGB). |
NormalAlphaResult | is how the alpha channel should be handled post processing (defaul make 100% opaque). |
vlBool CVTFFile::GenerateNormalMap | ( | vlUInt | uiFrame, |
VTFKernelFilter | KernelFilter = KERNEL_FILTER_3X3 , |
||
VTFHeightConversionMethod | HeightConversionMethod = HEIGHT_CONVERSION_METHOD_AVERAGE_RGB , |
||
VTFNormalAlphaResult | NormalAlphaResult = NORMAL_ALPHA_RESULT_WHITE |
||
) |
Convert image to a normal map from a specific frame.
Converts the image to a normal map using the image data in the given frame as the source.
uiFrame | is the frame index to use. |
KernelFilter | is the kernel filter to use (default 3x3). |
HeightConversionMethod | is the method of determining the height data from the source (default average RGB). |
NormalAlphaResult | is how the alpha channel should be handled post processing (defaul make 100% opaque). |
vlBool CVTFFile::GenerateThumbnail | ( | ) |
Generate a thumbnail image.
Generates the thumbnail image for the VTF image by copying an existing MIP map of the right size and converting it to the required format.
vlByte * CVTFFile::GetData | ( | vlUInt | uiFrame, |
vlUInt | uiFace, | ||
vlUInt | uiSlice, | ||
vlUInt | uiMipmapLevel | ||
) | const |
Get a pointer to the image data for a specific image.
Returns a pointer to the image data for a given frame, face and MIP level.
uiFrame | is the desired frame. |
uiFace | is the desired face. |
uiSlice | is the desired z slice. |
uiMipmapLevel | is the desired MIP level. |
vlBool CVTFFile::GetFlag | ( | VTFImageFlag | ImageFlag | ) | const |
Check if a specific flag is set in the VTF header.
Checks to see if the given flag is set in the VTF header struct.
ImageFlag | is the flag you wish to check for. |
vlBool CVTFFile::GetHasImage | ( | ) | const |
Check if image data has been loaded.
Check to see if the image buffer has data in it. If a VTF file was loaded into the class with the bHeaderOnly option, this will return false.
|
static |
Get VTFImageFormat info.
Returns a SImageFormatInfo info struct for the specified VTFImageFormat.
ImageFormat | is the format to get info on. |
Get the reflectivity values.
Get the reflectivity value for each vector axis from the VTF header.
sX,sY,sZ | are the variables to hold the values reflectivity vector. |
Get a VTF resource type's data.
Checks to see if the resource type exists and returns it's data.
uiType | is the resource type to retrieve. |
uiSize | is the size of the resource data. |
vlByte * CVTFFile::GetThumbnailData | ( | ) | const |
Get a pointer to the thumbnail image data for the current image.
Returns a pointer to the thumbnail image data for the current image.
vlBool CVTFFile::IsLoaded | ( | ) | const |
Check if a VTFFile image is loaded or valid.
Checks if a file was loaded or a new image was created correctly by checking for the existance of a valid header struct in the VTFFile class.
Loads a VTF image from disk.
Loads a VTF image file from disk into the current VTFFile class. You may choose to load just the header only if you want to get info about the file and save memory.
cFileName | is the path and filename of the file to load. |
bHeaderOnly | sets whether to load just the VTF header or not (default false). |
Loads a VTF image from memory.
Loads a VTF image file stored in memory into the current VTFFile class. You may choose to load just the header only if you want to get info about the file and save memory.
lpData | is a pointer to the VTF file in memory. |
uiBufferSize | is the size of the VTF file in bytes. |
bHeaderOnly | sets whether to load just the VTF header or not (default false). |
Loads a VTF image using callback functions.
Loads a VTF image file into the current VTFFile class. You may choose to load just the header only if you want to get info about the file and save memory.
pUserData | is a pointer to custom user data. |
bHeaderOnly | sets whether to load just the VTF header or not (default false). |
|
static |
Re-sizes an image.
Re-sizes an image in RGBA8888 format to the given dimensions using the specified filters.
lpSourceRGBA8888 | is a pointer to the source image data in RGBA8888 format. |
lpDestRGBA8888 | is a pointer to the buffer for the converted data. |
uiSourceWidth | is the width of the source image in pixels. |
uiSourceHeight | is the height of the source image in pixels. |
uiDestWidth | is the width of the destination image in pixels. |
uiDestHeight | is the height of the destination image in pixels. |
ResizeFilter | is the image reduction filter to use (default triangle). |
SharpenFilter | is the image sharpening filter to use (default none). |
Save a VTF image from disk.
Saves a VTF format image file to disk from the current VTFFile class.
cFileName | is the path and filename of the file to load. |
Save a VTF image to memory.
Saves a VTF format image file to memory from the current VTFFile class.
lpData | is a pointer to save the image to. |
uiBufferSize | is the size of the buffer in bytes. |
uiSize | is the size of VTF file in bytes as written into lpData. |
Save a VTF image using callback functions.
Saves a VTF format image file from the current VTFFile class.
pUserData | is a pointer to custom user data. |
Set the bump scale value.
Sets the bump scale in the VTF header to the given floating point value.
sBumpmapScale | is the scale value to set. |
vlVoid CVTFFile::SetData | ( | vlUInt | uiFrame, |
vlUInt | uiFace, | ||
vlUInt | uiSlice, | ||
vlUInt | uiMipmapLevel, | ||
vlByte * | lpData | ||
) |
Set the image data for a specific image.
Sets the image data for a given frame, face and MIP level. The source image data pointed to by lpData must be in the format specified in the VTF header.
uiFrame | is the desired frame. |
uiFace | is the desired face. |
uiSlice | is the desired z slice. |
uiMipmapLevel | is the desired MIP level. |
lpData | is a pointer to the image data. |
vlVoid CVTFFile::SetFlag | ( | VTFImageFlag | ImageFlag, |
vlBool | bState | ||
) |
Set the state of a specific flag in the VTF header.
Set the boolean state of the given flag in the VTF header struct.
ImageFlag | is the flag you wish to set. |
bState | is the state you wish to set for the flag. |
Set the reflectivity values.
Set the reflectivity value for each vector axis in the VTF header.
sX,sY,sZ | are the values for each reflectivity vector axis. |
Set a VTF resource type's data.
Set a resource type's data. If the type deson't exist, the resource is created. If uiSize is 0, the resource is deleted.
uiType | is the resource type to set. |
uiSize | is the size of the resource data; if 0 the resource is deleted, otherwise if the resource does not have a data chunk this must be 4. |
lpData | is the resource data; if null the resource data is zeroed. |
Set the thumbnail image data for the current image.
Sets the thumbnail image data for the current image. The source image data pointed to by lpData must be in the format specified for the thumbnail in the VTF header.
lpData | is a pointer to the image data. |