예제 #1
0
		public CoreTrack(XmlElement e, CoreSkeleton skeleton)
		{
			int boneId = int.Parse(e.GetAttribute("BONEID"));
			bone = skeleton.GetBone(boneId);

			keys = e.SelectElements("./KEYFRAME").Select(
				x => new Pair<float, Transform>(
					float.Parse(x.GetAttribute("TIME")),
					new Transform(
						Util.ReadQuaternion(x.SelectSingleNode("./ROTATION")),
						Util.ReadVector3(x.SelectSingleNode("./TRANSLATION"))))).ToList();
		}
예제 #2
0
		public CoreMesh(string filename, CoreSkeleton skeleton)
		{
			var doc = new XmlDocument();
			doc.Load(filename);

			vertices = doc.SelectElements("//VERTEX").Select(
				e => new Pair<Vertex, CoreBone>(
					new Vertex(e),
					skeleton.GetBone(int.Parse( e.SelectSingleNode("./INFLUENCE/@ID" ).Value )))).ToArray();

			indices = doc.SelectAttributes("//FACE/@VERTEXID").SelectMany(
				e => e.Value.Split(' ').Select(x => ushort.Parse(x))).ToArray();

			textureName = CoreMaterial.GetTextureFilename(
				Path.ChangeExtension(filename, ".xrf"));
		}
예제 #3
0
		internal CoreBone(XmlElement e, CoreSkeleton skeleton)
		{
			parentId = int.Parse(e.SelectSingleNode("./PARENTID").InnerText);

			name = e.GetAttribute("NAME");
			boneSpace = new Transform(
				Util.ReadQuaternion(e.SelectSingleNode("./LOCALROTATION")),
				Util.ReadVector3(e.SelectSingleNode("./LOCALTRANSLATION")));

			transform = new Transform(
				Util.ReadQuaternion(e.SelectSingleNode("./ROTATION")),
				Util.ReadVector3(e.SelectSingleNode("./TRANSLATION")));

			this.skeleton = skeleton;

			parent = Lazy.New(() => 
			{ 
				var bone = skeleton.GetBone(parentId); 
				if (bone != null)
					bone.AddChild(this);
				return bone;
			});
		}