VTFX file format: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
Line 16: Line 16:


=== VTFX header ===
=== VTFX header ===
typedef struct tagVTFXHEADER   
typedef struct tagVTFXHEADER   
{
{
char fileTypeString[4];        // VTFX.
char fileTypeString[4];        // VTFX.
int version[2]; // version[0].version[1].
int version[2]; // version[0].version[1].
int headerSize;
int headerSize;
unsigned int flags;
unsigned int flags;
unsigned short width; // actual width of data in file.
unsigned short width; // actual width of data in file.
unsigned short height; // actual height of data in file.
unsigned short height; // actual height of data in file.
unsigned short depth; // actual depth of data in file.
unsigned short depth; // actual depth of data in file.
unsigned short numFrames;
unsigned short numFrames;
unsigned short preloadDataSize; // exact size of preload data (may extend into image!).
unsigned short preloadDataSize; // exact size of preload data (may extend into image!).
unsigned char mipSkipCount; // used to resconstruct mapping dimensions.
unsigned char mipSkipCount; // used to resconstruct mapping dimensions.
unsigned char numResources;
unsigned char numResources;
Vector reflectivity; // Resides on 16 byte boundary!.
Vector reflectivity; // Resides on 16 byte boundary!.
float bumpScale;
float bumpScale;
ImageFormat imageFormat;
ImageFormat imageFormat;
unsigned char lowResImageSample[4];
unsigned char lowResImageSample[4];
unsigned int compressedSize;
unsigned int compressedSize;
<br />
// *** followed by *** ResourceEntryInfo resources[0];
// *** followed by *** ResourceEntryInfo resources[0];
} VTFXHEADER;
} VTFXHEADER;
&#35;define VTF_X360_MAJOR_VERSION 0x0360
&#35;define VTF_X360_MAJOR_VERSION 0x0360
&#35;define VTF_X360_MINOR_VERSION 8
&#35;define VTF_X360_MINOR_VERSION 8

Revision as of 06:52, 23 August 2009

Stub

This article or section is a stub. You can help by expanding it.

VTFx is a file format used by Valve to store textures on the Xbox 360. It has a different header from normal VTF files and stores it's data in a compressed DirectDraw Surface. Conversion or reading from a VTFX file is not possible at this time.

VTFX file format

VTFX layout

(estimated based on VTF)

VTFX Header
VTFX Low Resolution Image Data
For Each Mipmap (Smallest to Largest)
  For Each Frame (First to Last)
    For Each Face (First to Last)
      For Each Z Slice (Min to Max; Varies with Mipmap)
        VTFX High Resolution Image Data

VTFX header

typedef struct tagVTFXHEADER  
{
	char fileTypeString[4];         // VTFX.
	int version[2]; 		// version[0].version[1].
	int headerSize;
	unsigned int	flags;
	unsigned short	width;					// actual width of data in file.
	unsigned short	height;					// actual height of data in file.
	unsigned short	depth;					// actual depth of data in file.
	unsigned short	numFrames;
	unsigned short	preloadDataSize;		// exact size of preload data (may extend into image!).
	unsigned char	mipSkipCount;			// used to resconstruct mapping dimensions.
	unsigned char	numResources;
	Vector			reflectivity;			// Resides on 16 byte boundary!.
	float			bumpScale;
	ImageFormat		imageFormat;
	unsigned char	lowResImageSample[4];
	unsigned int	compressedSize;

	// *** followed by *** ResourceEntryInfo resources[0];
} VTFXHEADER;
#define VTF_X360_MAJOR_VERSION	0x0360
#define VTF_X360_MINOR_VERSION	8