DMX model

From Valve Developer Community
Revision as of 13:35, 4 January 2011 by TomEdwards (talk | contribs) (updated from some ASCII DMX examples)
Jump to navigation Jump to search
Help.png
This article contains speculation that needs to be confirmed.

For sanity's sake, the data structure is expressed in pseudo-C++.

  • Todo: Are names case sensitive?
class DmeModelRoot
{
	// model and skeleton point to the same object
	DmeModel*	model;
	DmeModel*	skeleton;
	DmeCombinationOperator*	combinationOperator; // flex animations only
};

class DmeCombinationOperator
{
	DmeCombinationInputControl	controls[];
	Vector		controlValues[]; // rest position...but why a 3D vector?
	Vector		controlValuesLagged[];
	bool		usesLaggedValues;
	DmeMesh*	dominators[];
	DmeMesh*	targets[]; // mesh with shapes on
};

class DmeCombinationInputControl // flex controller
{
	CUtlString	rawControlNames[];
	bool		stereo;
	bool		eyelid;
	float		wrinkleScales[];
};

class DmeModel
{
	DmeTransform*	transform; // global model transform?
	DmeAttachment*	shape; // defines
	bool			visible;
	DmeModel		children[]; // also seen with "DmeDag" elements, which seem identical to DmeModels...?
	DmeJoint		jointList[];
	DmeVertexData	BaseStates[];
	CUtlString		upAxis; // uppercase character
};

class DmeDag // purpose unclear: seen defining both bones and meshes
{
	DmeTransform*	transform;
	DmeAttachment*	shape;
	bool			visible;
	DmeDag			children[];
};

class DmeJoint // a bone
{
	DmeTransform*	transform;
	void*			shape; // only seen empty
	bool			visible;
	DmeJoint		children[];
	bool			lockInfluenceWeights;

class DmeTransform // name is of a defined model if there are children, otherwise blank
{
	Vector		position;
	Quaternion	orientation;
};

class DmeAttachment
{
	bool		visible;
	bool		IsRigid;
	bool		isWorldAligned;
};

class DmeMesh // Collection of states...suspected that there will only be more than one in a vertex animation DMX.
{
	bool				visible;

	DmeVertexData		bindState; // needs confirmation - only seen empty
	DmeVertexData*		currentState; // pointer to default baseState
	DmeVertexData		baseStates[];
	DmeVertexData		deltaStates[];

	DmeFaceSet			faceSets[];

	Vector2D			deltaStateWeights[];
	Vector2D			deltaStateWeightsLagged[];
};

// Actual model/skeleton data
class DmeVertexData
{
	CUtlString	vertexFormat[];
	int			jointCount;
	bool		flipVCoordinates;

	Vector		positions[];
	int			positionsIndicies[];

	Vector		normals[];
	int			normalsIndicies[];

	Vector2D	textureCoordinates[];
	int			textureCoordinatesIndicies[];
};

// Defines a group of faces, and associates them with a material
class DmeFaceSet
{
	DmeMaterial		material;
	int				faces[];
};

// A material reference
class DmeMaterial
{
	CUtlString		mtlName; // relative to /materials, no extension
};