DMX model: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
(updated from some ASCII DMX examples)
Line 4: Line 4:


* {{todo|Are names case sensitive?}}
* {{todo|Are names case sensitive?}}
* {{todo|Are all apparent pointers actually arrays?}}


<source lang=cpp>
<source lang=cpp>
class DMXModel
class DmeModelRoot
{
{
DMXModelData* model;
// model and skeleton point to the same object
// NB: it appears that skeletons actually reside in separate files now.
DmeModel* model;
// model and skeleton appear to be identical, and probably point to the same data.
DmeModel* skeleton;
DMXModelData* skeleton;
DmeCombinationOperator* combinationOperator; // flex animations only
};
};


class DMXModel_Data
class DmeCombinationOperator
{
{
CUtlString name;
DmeCombinationInputControl controls[];
DMXModelData children[];
Vector controlValues[]; // rest position...but why a 3D vector?
DMXModel_Transform* transform; // or array?
Vector controlValuesLagged[];
DMXModel_Shape* shape; // or array?
bool usesLaggedValues;
bool visible;
DmeMesh* dominators[];
DMXModel_Transform jointTransforms[];
DmeMesh* targets[]; // mesh with shapes on
DMXModel_State BaseStates[];
};
 
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 DMXModel_Transform
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
{
{
CUtlString name; // of a defined model if there are children, otherwise blank
Vector position;
Vector position;
Quaternion orientation;
Quaternion orientation;
};
};


// Collection of states...suspected that there will only be more than one in a vertex animation DMX.
class DmeAttachment
class DMXModel_Shape
{
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.
{
{
CUtlString name;
bool visible;
bool visible;


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


DMXModel_FaceSet faceSets[];
DmeFaceSet faceSets[];


Vector2D deltaStateWeights[];
Vector2D deltaStateWeights[];
Line 51: Line 88:


// Actual model/skeleton data
// Actual model/skeleton data
class DMXModel_State
class DmeVertexData
{
{
CUtlString name;
CUtlString vertexFormat[];
CUtlString vertexFormat[];
int jointCount;
int jointCount;
Line 69: Line 105:


// Defines a group of faces, and associates them with a material
// Defines a group of faces, and associates them with a material
class DMXModel_FaceSet
class DmeFaceSet
{
{
CUtlString name; // of what?
DmeMaterial material;
DMXModel_Material material;
int faces[];
int faces[];
};
};


// A material reference
// A material reference
class DMXModel_Material
class DmeMaterial
{
{
CUtlString name;
CUtlString mtlName; // relative to /materials, no extension
CUtlString mtlName; // relative to /materials, no extension
};
};
</source>
</source>

Revision as of 13:35, 4 January 2011

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
};