Exemplo n.º 1
0
		public void Apply(AnimSkel animSkel, float t)
		{
			if (this.frames == null)
			{
				return;
			}
			if (this.frames.Count == 0)
			{
				return;
			}
			var frame = this.frames[0];
			if (frame.Bones.Count == 0)
			{
				return;
			}
			if (this.IsAnonymousBones)
			{
				for (int index = 0; index < frame.Bones.Count; ++index)
				{
					var bone = frame.Bones[index];
					AnimBone b;
					if (!this.IsAnonymousBones)
					{
						b = animSkel.Bones[animSkel.EnsureBone(bone.NameHash)];
					}
					else
					{
						b = animSkel.Bones[index];
					}
					b.ActualPos = bone.BindingPos;
					b.ActualRot = bone.BindingRot;
				}
			}
		}
Exemplo n.º 2
0
		private static void ParseBone(TextParser parser, AnimSkel mesh)
		{
			parser.Consume("{");
			AnimBone bone = null;
			for (;;)
			{
				var attribute = parser.Lexem;
				if (attribute == "}")
				{
					parser.Consume();
					break;
				}
				if (attribute == "name")
				{
					parser.Consume();
					bone = mesh.Bones[mesh.EnsureBone(parser.ConsumeString())];
					continue;
				}
				if (attribute == "parent")
				{
					parser.Consume();
					bone.Parent = mesh.EnsureBone(parser.ConsumeString());
					continue;
				}
				if (attribute == "pos")
				{
					parser.Consume();
					bone.BindingPos = parser.ConsumeVector3();
					continue;
				}
				if (attribute == "rot")
				{
					parser.Consume();
					bone.BindingRot = parser.ConsumeQuaternion();
					continue;
				}
				parser.UnknownLexemError();
			}
		}