Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

aphydx

3d model xml schema - need comments

This topic is 5245 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

i need some feedback on the following model structure. please take a look at my xml schema, and tell me what you think. i'm trying to store bone hierarchy, meshes, and animations, one model per file. - bones: store initial transform, name, and parent name. should be able to form hierarchy from this. - meshes: sort by material, then by bones used. mesh subsets are allowed a total of 3 bone influences, and they store the bones they use. - animations: store scalar, rotation, and translation keys and their respective "times" and target bones. more than one animation set allowed per file. - it should be pretty intuitive if you look at the hierarchy of the "Data" element in some sort of schema diagram viewer.
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema elementFormDefault="qualified" attributeFormDefault="unqualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">

	<xs:complexType name="Vector2">
		<xs:sequence>
			<xs:element name="X" type="xs:float"/>
			<xs:element name="Y" type="xs:float"/>
		</xs:sequence>
	</xs:complexType>
	<xs:complexType name="Vector3">
		<xs:sequence>
			<xs:element name="X" type="xs:float"/>
			<xs:element name="Y" type="xs:float"/>
			<xs:element name="Z" type="xs:float"/>
		</xs:sequence>
	</xs:complexType>
	<xs:complexType name="Quaternion">
		<xs:sequence>
			<xs:element name="W" type="xs:float"/>
			<xs:element name="X" type="xs:float"/>
			<xs:element name="Y" type="xs:float"/>
			<xs:element name="Z" type="xs:float"/>
		</xs:sequence>
	</xs:complexType>
	<xs:complexType name="Vertex">
		<xs:sequence>
			<xs:element name="Position" type="Vector3"/>
			<xs:element name="Normal" type="Vector3"/>
			<xs:element name="TextureCoords" type="Vector2" minOccurs="0"/>
			<xs:element name="BoneWeights" type="xs:float" minOccurs="0" maxOccurs="3"/>
		</xs:sequence>
	</xs:complexType>
	<xs:complexType name="ScalarKey">
		<xs:sequence>
			<xs:element name="Value" type="Vector3"/>
			<xs:element name="Time" type="xs:float"/>
		</xs:sequence>
	</xs:complexType>
	<xs:complexType name="RotationKey">
		<xs:sequence>
			<xs:element name="Value" type="Quaternion"/>
			<xs:element name="Time" type="xs:float"/>
		</xs:sequence>
	</xs:complexType>
	<xs:complexType name="TranslationKey">
		<xs:sequence>
			<xs:element name="Value" type="Vector3"/>
			<xs:element name="Time" type="xs:float"/>
		</xs:sequence>
	</xs:complexType>
	<xs:complexType name="Animation">
		<xs:sequence>
			<xs:element name="NumScalarKeys" type="xs:int"/>
			<xs:element name="ScalarKeys" type="ScalarKey" minOccurs="0" maxOccurs="unbounded"/>
			<xs:element name="NumRotationKeys" type="xs:int"/>
			<xs:element name="RotationKeys" type="RotationKey" minOccurs="0" maxOccurs="unbounded"/>
			<xs:element name="NumTranslationKeys" type="xs:int"/>
			<xs:element name="TranslationKeys" type="TranslationKey" minOccurs="0" maxOccurs="unbounded"/>
			<xs:element name="TargetBoneName" type="xs:string"/>
		</xs:sequence>
	</xs:complexType>
	<xs:complexType name="AnimationSet">
		<xs:sequence>
			<xs:element name="NumAnimations" type="xs:int"/>
			<xs:element name="Animations" type="Animation" maxOccurs="unbounded"/>
			<xs:element name="Name" type="xs:string"/>
		</xs:sequence>
	</xs:complexType>
	<xs:complexType name="Bone">
		<xs:sequence>
			<xs:element name="Scalar" type="Vector3"/>
			<xs:element name="Rotation" type="Quaternion"/>
			<xs:element name="Translation" type="Vector3"/>
			<xs:element name="Name" type="xs:string"/>
			<xs:element name="ParentBoneName" type="xs:string"/>
		</xs:sequence>
	</xs:complexType>
	<xs:complexType name="MeshSubset">
		<xs:sequence>
			<xs:element name="NumVertices" type="xs:int"/>
			<xs:element name="Vertices" type="Vertex" minOccurs="3" maxOccurs="unbounded"/>
			<xs:element name="NumIndices" type="xs:int"/>
			<xs:element name="Indices" type="xs:int" minOccurs="3" maxOccurs="unbounded"/>
			<xs:element name="NumBoneInfluences" type="xs:int"/>
			<xs:element name="BoneNames" type="xs:string" minOccurs="0" maxOccurs="3"/>
		</xs:sequence>
	</xs:complexType>
	<xs:complexType name="Color">
		<xs:sequence>
			<xs:element name="R" type="xs:byte"/>
			<xs:element name="G" type="xs:byte"/>
			<xs:element name="B" type="xs:byte"/>
			<xs:element name="A" type="xs:byte"/>
		</xs:sequence>
	</xs:complexType>
	<xs:complexType name="MaterialGroup">
		<xs:sequence>
			<xs:element name="NumMeshSubsets" type="xs:int"/>
			<xs:element name="MeshSubsets" type="MeshSubset" maxOccurs="unbounded"/>
			<xs:element name="Ambient" type="Color"/>
			<xs:element name="Diffuse" type="Color"/>
			<xs:element name="Specular" type="Color"/>
			<xs:element name="Emissive" type="Color"/>
			<xs:element name="IsTextured" type="xs:boolean"/>
			<xs:element name="TextureFilename" type="xs:string" minOccurs="0"/>
		</xs:sequence>
	</xs:complexType>
	<xs:complexType name="Model">
		<xs:sequence>
			<xs:element name="IsSkinned" type="xs:boolean"/>
			<xs:element name="NumBones" type="xs:int"/>
			<xs:element name="Bones" type="Bone" minOccurs="0" maxOccurs="unbounded"/>
			<xs:element name="NumMaterialGroups" type="xs:int"/>
			<xs:element name="MaterialGroups" type="MaterialGroup" maxOccurs="unbounded"/>
			<xs:element name="NumAnimationSets" type="xs:int"/>
			<xs:element name="AnimationSets" type="AnimationSet" minOccurs="0" maxOccurs="unbounded"/>
		</xs:sequence>
	</xs:complexType>
	<xs:element name="Data" type="Model"/>
</xs:schema>
[edited by - aphydx on June 10, 2004 6:34:56 PM]

Share this post


Link to post
Share on other sites
Advertisement
"X3D us a file format specification with requirements on how that file is to be displayed. It will be the ISO standard for 3D graphics".

And more.

I prefer to put standard types such as float, int, etc as attributes instead of elements. That makes the .xml file a little smaller and not so overwhelming. But that's a personal taste of mine


}-- Programmer/Gamer/Dreamer --{
I didn't choose to code, coding choose me.

[edited by - seriema on June 11, 2004 10:07:52 AM]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!