From Valve Developer Community
Revision as of 21:43, 26 August 2010 by Cfoust (talk | contribs) (adding file info)
Jump to: navigation, search

VVD is the extension for Source's proprietary model vertex data format. It stores position independent flat data for the bone weights, normals, vertices, tangents and texture coordinates used by the MDL.


struct vertexFileHeader_t
	int		id;						// MODEL_VERTEX_FILE_ID -- little-endian "IDSV"
	int		version;					// MODEL_VERTEX_FILE_VERSION
	long		checksum;					// same as studiohdr_t, ensures sync
	int		numLODs;					// num of valid lods
	int		numLODVertexes[MAX_NUM_LODS];			// num verts for desired root lod
	int		numFixups;					// num of vertexFileFixup_t
	int		fixupTableStart;				// offset from base to fixup table
	int		vertexDataStart;				// offset from base to vertex block
	int		tangentDataStart;				// offset from base to tangent block

Fixup Table

// apply sequentially to lod sorted vertex and tangent pools to re-establish mesh order
struct vertexFileFixup_t
	int		lod;				// used to skip culled root lod
	int		sourceVertexID;		// absolute index from start of vertex/tangent blocks
	int		numVertexes;

Vertex Data

A list of vertices follows the header

// NOTE: This is exactly 48 bytes
struct mstudiovertex_t
	mstudioboneweight_t		m_BoneWeights; //see below
	Vector				m_vecPosition;
	Vector				m_vecNormal;
	Vector2D			m_vecTexCoord;
// 16 bytes
struct mstudioboneweight_t
	float	weight[MAX_NUM_BONES_PER_VERT]; //MAX_NUM_BONES_PER_VERT is defined as 3
	char	bone[MAX_NUM_BONES_PER_VERT]; 
	byte	numbones;

Tangent Data

This seems to be an array of 4D vectors, one for each vertex

vec_t x, y, z, w;

See also