Experimental bone animations playing from YCD. Windmills, fans, radars, ufos etc

This commit is contained in:
dexy
2019-11-02 18:14:36 +11:00
Unverified
parent 80b6f3742b
commit 6f0a7d99f9
4 changed files with 131 additions and 8 deletions
+4 -2
View File
@@ -697,7 +697,9 @@ namespace CodeWalker.GameFiles
public override float EvaluateFloat(int frame)
{
return Values[frame];
if (frame < Values?.Length) return Values[frame];
if (Values?.Length > 0) return Values[0];
return 0.0f;
}
public override void Read(Sequence blockStream, ref int channelOffset)
@@ -769,7 +771,7 @@ namespace CodeWalker.GameFiles
for (int n = 0; n < 4; n++)
{
if ((c + n) >= 4) break;
v[c + n] = sv3c.Value[n];
v[c + n] = ssqc.Value[n];
}
c += 4;
}
@@ -550,6 +550,10 @@ namespace CodeWalker.GameFiles
private ResourceSystemStructBlock<ushort> Unknown_40h_DataBlock = null;
public Dictionary<ushort, Bone> BonesMap { get; set; }//for convienience finding bones by tag
/// <summary>
/// Reads the data-block from a stream.
/// </summary>
@@ -611,6 +615,16 @@ namespace CodeWalker.GameFiles
}
}
BonesMap = new Dictionary<ushort, Bone>();
if (Bones != null)
{
for (int i = 0; i < Bones.Count; i++)
{
var bone = Bones[i];
BonesMap[bone.Id] = bone;
}
}
}
/// <summary>
@@ -784,6 +798,13 @@ namespace CodeWalker.GameFiles
private string_r NameBlock = null;
//used by CW for animating skeletons.
public Quaternion AnimRotation;
public Vector3 AnimTranslation;
/// <summary>
/// Reads the data-block from a stream.
/// </summary>
@@ -819,6 +840,10 @@ namespace CodeWalker.GameFiles
this.Name = reader.ReadStringAt(//BlockAt<string_r>(
this.NamePointer // offset
);
AnimRotation = Rotation;
AnimTranslation = Translation;
}
/// <summary>