DMX model: Difference between revisions
		
		
		
		
		
		Jump to navigation
		Jump to search
		
				
		
		
	
TomEdwards (talk | contribs)  (updated from some ASCII DMX examples)  | 
				TomEdwards (talk | contribs)   (deciphered Dag and Indicies)  | 
				||
| Line 8: | Line 8: | ||
class DmeModelRoot  | class DmeModelRoot  | ||
{  | {  | ||
	// model and skeleton point to the same object  | 	// model and skeleton should point to the same object  | ||
	DmeModel*	model;  | 	DmeModel*	model;  | ||
	DmeModel*	skeleton;  | 	DmeModel*	skeleton;  | ||
	DmeCombinationOperator*	combinationOperator; // flex animations only  | 	DmeCombinationOperator*	combinationOperator; // flex animations only  | ||
};  | };  | ||
class DmeCombinationOperator  | class DmeCombinationOperator // flex controller global settings  | ||
{  | {  | ||
	DmeCombinationInputControl	controls[];  | 	DmeCombinationInputControl	controls[];  | ||
	Vector		controlValues[]; // rest position...but why a 3D vector?  | 	Vector		controlValues[];		// rest position...but why a 3D vector?  | ||
	Vector		controlValuesLagged[];  | 	Vector		controlValuesLagged[];	// unknown  | ||
	bool		usesLaggedValues;  | 	bool		usesLaggedValues;  | ||
	DmeMesh*	dominators[];  | 	DmeMesh*	dominators[];			// unknown  | ||
	DmeMesh*	targets[]; // mesh with shapes on  | 	DmeMesh*	targets[];				// mesh with the shapes on  | ||
};  | };  | ||
class DmeCombinationInputControl // flex controller  | class DmeCombinationInputControl // a flex controller  | ||
{  | {  | ||
	CUtlString	rawControlNames[];  | 	CUtlString	rawControlNames[];	// which controls are being wrapped  | ||
	bool		stereo;  | 	bool		stereo;				// equivalent to QC 'split'?  | ||
	bool		eyelid;  | 	bool		eyelid;				// flags as an eyelid used by AI for blinking  | ||
	float		wrinkleScales[];  | 	float		wrinkleScales[];	// wrinkle map, a recent tech that is not documented yet. One value for each named control.  | ||
};  | };  | ||
class DmeModel  | class DmeModel  | ||
{  | {  | ||
	DmeTransform*	transform; // global model transform?  | 	DmeTransform*	transform;		// global model transform? DAG not supported here?  | ||
	DmeAttachment*	shape;   | 	DmeAttachment*	shape;  | ||
	bool			visible;  | 	bool			visible;  | ||
	DmeModel		children[];   | 	DmeModel		children[];  | ||
	DmeJoint		jointList[];  | 	DmeJoint		jointList[];  | ||
	DmeVertexData	BaseStates[];  | 	DmeVertexData	BaseStates[];  | ||
	CUtlString		upAxis; // uppercase character  | 	CUtlString		upAxis;			// uppercase character  | ||
};  | };  | ||
class DmeDag   | // A "DAG" is a generic Maya container, appearing here in order to transform objects.  | ||
// It can take the place of a DmeMesh, DmeJoint or DmeAttachment at any time.  | |||
class DmeDag  | |||
{  | {  | ||
	DmeTransform*	transform;  | 	DmeTransform*	transform;  | ||
	bool			visible;  | |||
	void			children[]; // never seen used  | |||
	// One of the following:  | |||
	CUtlString		name // of a DmeJoint  | |||
	DmeMesh*		shape;  | |||
	DmeAttachment*	shape;  | 	DmeAttachment*	shape;  | ||
};  | };  | ||
| Line 65: | Line 72: | ||
};  | };  | ||
class DmeAttachment  | class DmeAttachment // an attachment  | ||
{  | {  | ||
	bool		visible;  | 	bool		visible;  | ||
	bool		IsRigid;  | 	bool		IsRigid; // does not animate with associated bone  | ||
	bool		isWorldAligned;  | 	bool		isWorldAligned; // transform in world co-ords  | ||
};  | };  | ||
class DmeMesh   | class DmeMesh  | ||
{  | {  | ||
	bool				visible;  | 	bool				visible;  | ||
	DmeVertexData		bindState; // needs confirmation - only seen empty  | 	DmeVertexData		bindState;		// needs confirmation - only seen empty  | ||
	DmeVertexData*		currentState; // pointer to default baseState  | 	DmeVertexData*		currentState;	// pointer to default baseState  | ||
	DmeVertexData		baseStates[];  | 	DmeVertexData		baseStates[];	// never seen with more than one member  | ||
	DmeVertexData		deltaStates[];  | 	DmeVertexData		deltaStates[];	// unknown  | ||
	DmeFaceSet			faceSets[];  | 	DmeFaceSet			faceSets[];  | ||
| Line 87: | Line 94: | ||
};  | };  | ||
//   | class DmeVertexData // mesh data  | ||
{  | {  | ||
	CUtlString	vertexFormat[];  | 	CUtlString	vertexFormat[];		// positions, normals, textureCoordinates  | ||
	int			jointCount;  | 	int			jointCount;			// what is this doing here?  | ||
	bool		flipVCoordinates;  | 	bool		flipVCoordinates;	// left-hand to right hand?  | ||
	Vector		positions[];  | 	// In each of the below cases, the "Indicies" value contains one entry for each vertex.  | ||
	int			positionsIndicies[];  | 	// the indice value defines which value from the 'real' array the vertex takes. In this  | ||
	// way, vertices can share data. This is a useful optimisation since each poly has its  | |||
	// own three verts, even if they overlap other verts.  | |||
	Vector		positions[];			// location of each vertex  | |||
	int			positionsIndicies[];	// unknown  | |||
	Vector		normals[];  | 	Vector		normals[];			// normal of each vertex  | ||
	int			normalsIndicies[];  | 	int			normalsIndicies[];	// unknown  | ||
	Vector2D	textureCoordinates[];  | 	Vector2D	textureCoordinates[];			// UV co-ord of each vertex  | ||
	int			textureCoordinatesIndicies[];  | 	int			textureCoordinatesIndicies[];	// the vertex that each value applies to -   | ||
};  | };  | ||
//   | class DmeFaceSet // defines faces, including their material  | ||
{  | {  | ||
	DmeMaterial	  | 	DmeMaterial*	material; // the material this face is drawn with  | ||
	int				faces[];  | 	int				faces[]; // the vertices that make up each face, delimited by -1. Supports quads.  | ||
};  | };  | ||
//   | class DmeMaterial // a material  | ||
{  | {  | ||
	CUtlString	  | 	CUtlString	mtlName; // relative to \game\materials\, no extension  | ||
};  | };  | ||
</source>  | </source>  | ||
Revision as of 14:28, 4 January 2011
For sanity's sake, the data structure is expressed in pseudo-C++.
- Todo: Are names case sensitive?
 
class DmeModelRoot
{
	// model and skeleton should point to the same object
	DmeModel*	model;
	DmeModel*	skeleton;
	
	DmeCombinationOperator*	combinationOperator; // flex animations only
};
class DmeCombinationOperator // flex controller global settings
{
	DmeCombinationInputControl	controls[];
	Vector		controlValues[];		// rest position...but why a 3D vector?
	Vector		controlValuesLagged[];	// unknown
	bool		usesLaggedValues;
	DmeMesh*	dominators[];			// unknown
	DmeMesh*	targets[];				// mesh with the shapes on
};
class DmeCombinationInputControl // a flex controller
{
	CUtlString	rawControlNames[];	// which controls are being wrapped
	bool		stereo;				// equivalent to QC 'split'?
	bool		eyelid;				// flags as an eyelid used by AI for blinking
	float		wrinkleScales[];	// wrinkle map, a recent tech that is not documented yet. One value for each named control.
};
class DmeModel
{
	DmeTransform*	transform;		// global model transform? DAG not supported here?
	DmeAttachment*	shape;
	bool			visible;
	DmeModel		children[];
	DmeJoint		jointList[];
	DmeVertexData	BaseStates[];
	CUtlString		upAxis;			// uppercase character
};
// A "DAG" is a generic Maya container, appearing here in order to transform objects.
// It can take the place of a DmeMesh, DmeJoint or DmeAttachment at any time.
class DmeDag
{
	DmeTransform*	transform;
	bool			visible;
	void			children[]; // never seen used
	
	// One of the following:
	CUtlString		name // of a DmeJoint
	DmeMesh*		shape;
	DmeAttachment*	shape;
};
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 // an attachment
{
	bool		visible;
	bool		IsRigid; // does not animate with associated bone
	bool		isWorldAligned; // transform in world co-ords
};
class DmeMesh
{
	bool				visible;
	DmeVertexData		bindState;		// needs confirmation - only seen empty
	DmeVertexData*		currentState;	// pointer to default baseState
	DmeVertexData		baseStates[];	// never seen with more than one member
	DmeVertexData		deltaStates[];	// unknown
	DmeFaceSet			faceSets[];
	Vector2D			deltaStateWeights[];
	Vector2D			deltaStateWeightsLagged[];
};
class DmeVertexData // mesh data
{
	CUtlString	vertexFormat[];		// positions, normals, textureCoordinates
	int			jointCount;			// what is this doing here?
	bool		flipVCoordinates;	// left-hand to right hand?
	// In each of the below cases, the "Indicies" value contains one entry for each vertex.
	// the indice value defines which value from the 'real' array the vertex takes. In this
	// way, vertices can share data. This is a useful optimisation since each poly has its
	// own three verts, even if they overlap other verts.
	
	Vector		positions[];			// location of each vertex
	int			positionsIndicies[];	// unknown
	Vector		normals[];			// normal of each vertex
	int			normalsIndicies[];	// unknown
	Vector2D	textureCoordinates[];			// UV co-ord of each vertex
	int			textureCoordinatesIndicies[];	// the vertex that each value applies to - 
};
class DmeFaceSet // defines faces, including their material
{
	DmeMaterial*	material; // the material this face is drawn with
	int				faces[]; // the vertices that make up each face, delimited by -1. Supports quads.
};
class DmeMaterial // a material
{
	CUtlString	mtlName; // relative to \game\materials\, no extension
};