diff options
author | Treeki <treeki@gmail.com> | 2012-02-19 06:28:18 +0100 |
---|---|---|
committer | Treeki <treeki@gmail.com> | 2012-02-19 06:28:18 +0100 |
commit | 364e99d849378546323d1d06307b6773e813b742 (patch) | |
tree | 3a30e29e3bd9bd3b3f245425d74b879103e46004 /NW4RTools/Models | |
parent | f5f1901be759a9dc3837a4cc2933f75c0ea765b7 (diff) | |
download | nw4rtools-364e99d849378546323d1d06307b6773e813b742.tar.gz nw4rtools-364e99d849378546323d1d06307b6773e813b742.zip |
added what is probably horribly broken support for reading animations
Diffstat (limited to '')
-rw-r--r-- | NW4RTools/Models/Animation/CharacterAnim.cs | 96 | ||||
-rw-r--r-- | NW4RTools/Models/Animation/ColorAnim.cs | 34 | ||||
-rw-r--r-- | NW4RTools/Models/Animation/Shared.cs | 32 | ||||
-rw-r--r-- | NW4RTools/Models/Animation/TextureSRTAnim.cs | 18 |
4 files changed, 153 insertions, 27 deletions
diff --git a/NW4RTools/Models/Animation/CharacterAnim.cs b/NW4RTools/Models/Animation/CharacterAnim.cs index 33c30ce..dd496f6 100644 --- a/NW4RTools/Models/Animation/CharacterAnim.cs +++ b/NW4RTools/Models/Animation/CharacterAnim.cs @@ -1,44 +1,86 @@ using System; + namespace NW4RTools.Models.Animation { public class CharacterAnim { [FlagsAttribute] public enum Flags : uint { - Unk0 = 1, - Unk1 = 2, - Unk2 = 4, - Unk3 = 8, - Unk4 = 0x10, + AlwaysSet = 1, + Identity = 2, + RtZero = 4, + ScaleOne = 8, + ScaleUniform = 0x10, RotateZero = 0x20, TranslateZero = 0x40, - Unk7 = 0x80, - Unk8 = 0x100, - Unk9 = 0x200, - Unk10 = 0x400, - Unk11 = 0x800, - Unk12 = 0x1000, - Unk13 = 0x2000, - Unk14 = 0x4000, - Unk15 = 0x8000, - Unk16 = 0x10000, - Unk17 = 0x20000, - Unk18 = 0x40000, - Unk19 = 0x80000, - Unk20 = 0x100000, - Unk21 = 0x200000, + ScaleUseModel = 0x80, + RotateUseModel = 0x100, + TranslateUseModel = 0x200, + ScaleCompensateApply = 0x400, + ScaleCompensateParent = 0x800, + ClassicScaleOff = 0x1000, + ScaleXConstant = 0x2000, + ScaleYConstant = 0x4000, + ScaleZConstant = 0x8000, + RotateXConstant = 0x10000, + RotateYConstant = 0x20000, + RotateZConstant = 0x40000, + TranslateXConstant = 0x80000, + TranslateYConstant = 0x100000, + TranslateZConstant = 0x200000, CalcScale = 0x400000, CalcRotate = 0x800000, CalcTranslate = 0x1000000, - Unk25 = 0x2000000, - Unk26 = 0x4000000, - Unk27 = 0x8000000, - Unk28 = 0x10000000, - Unk29 = 0x20000000, - Unk30 = 0x40000000, - Unk31 = 0x80000000, + ScaleFormatMask = 0x6000000, + RotateFormatMask = 0x38000000, + TranslateFormatMask = 0xC0000000, + + ScaleXNotExist = Identity | ScaleOne | ScaleUseModel, + ScaleYNotExist = Identity | ScaleOne | ScaleUniform | ScaleUseModel, + ScaleZNotExist = Identity | ScaleOne | ScaleUniform | ScaleUseModel, + RotateXNotExist = Identity | RtZero | RotateZero | RotateUseModel, + RotateYNotExist = Identity | RtZero | RotateZero | RotateUseModel, + RotateZNotExist = Identity | RtZero | RotateZero | RotateUseModel, + TranslateXNotExist = Identity | RtZero | TranslateZero | TranslateUseModel, + TranslateYNotExist = Identity | RtZero | TranslateZero | TranslateUseModel, + TranslateZNotExist = Identity | RtZero | TranslateZero | TranslateUseModel, + + NonComputableFlags = ScaleCompensateApply | ScaleCompensateParent | ClassicScaleOff, } + public enum STFormatType { + Constant = 0, + Data32 = 1, + Data48 = 2, + Data96 = 3, + } + + public enum RotateFormatType { + Constant = 0, + Data32 = 1, + Data48 = 2, + Data96 = 3, + DataUnk4 = 4, + DataUnk5 = 5, + DataUnk6 = 6, + Zero = 7, + } + + public Model.ScaleModeType ScaleMode; + public bool Loop; + + public UInt16 FrameCount; + + public ResDict<Node> Nodes; + public class Node { + public CharacterAnim.Flags Flags; + + public KeyframeAnim ScaleX, ScaleY, ScaleZ; + public KeyframeAnim RotateX, RotateY, RotateZ; + public KeyframeAnim TranslateX, TranslateY, TranslateZ; + public STFormatType ScaleFormat; + public STFormatType TranslateFormat; + public RotateFormatType RotateFormat; } public CharacterAnim() { diff --git a/NW4RTools/Models/Animation/ColorAnim.cs b/NW4RTools/Models/Animation/ColorAnim.cs index e1e14bc..de8fdbd 100644 --- a/NW4RTools/Models/Animation/ColorAnim.cs +++ b/NW4RTools/Models/Animation/ColorAnim.cs @@ -1,6 +1,40 @@ using System; namespace NW4RTools.Models.Animation { public class ColorAnim { + public bool Loop; + + public UInt16 FrameCount; + + public ResDict<Node> Nodes; + + public struct Element { + public UInt32 Mask; + + public bool Exists, IsConstant; + + public Color ConstValue; + public Color[] Colors; + } + + public enum TargetType { + Material0 = 0, + Material1 = 1, + Ambient0 = 2, + Ambient1 = 3, + Tev0 = 4, + Tev1 = 5, + Tev2 = 6, + TevConst0 = 7, + TevConst1 = 8, + TevConst2 = 9, + TevConst3 = 10, + Count = 11, + } + + public class Node { + public Element[] Elements; + } + public ColorAnim() { } } diff --git a/NW4RTools/Models/Animation/Shared.cs b/NW4RTools/Models/Animation/Shared.cs new file mode 100644 index 0000000..f87bea6 --- /dev/null +++ b/NW4RTools/Models/Animation/Shared.cs @@ -0,0 +1,32 @@ +using System; + +namespace NW4RTools.Models.Animation { + public struct Keyframe { + public float Frame, Value, Slope; + } + + public struct KeyframeAnim { + public bool IsConstant; + + public float ConstValue; + + public Keyframe[] Keyframes; + + // Only valid sometimes + // This sucks but I'm not sure how else to do it atm + public float BaseValue, Multiplier; + public int[] Values; + public float[] FloatValues; + + public KeyframeAnim(float cv) { + IsConstant = true; + ConstValue = cv; + + Keyframes = null; + + BaseValue = Multiplier = 0; + Values = null; + FloatValues = null; + } + } +} diff --git a/NW4RTools/Models/Animation/TextureSRTAnim.cs b/NW4RTools/Models/Animation/TextureSRTAnim.cs index edc3593..d033f5f 100644 --- a/NW4RTools/Models/Animation/TextureSRTAnim.cs +++ b/NW4RTools/Models/Animation/TextureSRTAnim.cs @@ -1,6 +1,24 @@ using System; namespace NW4RTools.Models.Animation { public class TextureSRTAnim { + public Model.TexMatrixModeType MatrixMode; + public bool Loop; + + public UInt16 FrameCount; + + public ResDict<Node> Nodes; + + public struct Element { + public bool Exists; + + public KeyframeAnim ScaleS, ScaleT, Rotate, TransS, TransT; + } + + public class Node { + public Element[] Textures; + public Element[] IndirectTextures; + } + public TextureSRTAnim() { } } |