diff --git a/File_Format_Library/FileFormats/Pokemon/GFBANIM/FlatBuffers/gfbanim.cs b/File_Format_Library/FileFormats/Pokemon/GFBANIM/FlatBuffers/gfbanim.cs new file mode 100644 index 00000000..d35bf3c0 --- /dev/null +++ b/File_Format_Library/FileFormats/Pokemon/GFBANIM/FlatBuffers/gfbanim.cs @@ -0,0 +1,1391 @@ +// +// automatically generated by the FlatBuffers compiler, do not modify +// + +namespace Gfbanim +{ + + using global::System; + using global::FlatBuffers; + + public enum TriggerParams : byte + { + NONE = 0, + TriggerParameterInt = 1, + TriggerParameterFloat = 2, + TriggerParameterByte = 3, + TriggerParameterString = 4, + }; + + public enum VectorTrack : byte + { + NONE = 0, + FixedVectorTrack = 1, + DynamicVectorTrack = 2, + FramedVectorTrack = 3, + }; + + public enum QuatTrack : byte + { + NONE = 0, + FixedQuatTrack = 1, + DynamicQuatTrack = 2, + FramedQuatTrack = 3, + }; + + public enum BooleanTrack : byte + { + NONE = 0, + FixedBooleanTrack = 1, + DynamicBooleanTrack = 2, + FramedBooleanTrack = 3, + }; + + public enum ValueTrack : byte + { + NONE = 0, + FixedValueTrack = 1, + DynamicValueTrack = 2, + FramedValueTrack = 3, + }; + + public struct Animation : IFlatbufferObject + { + private Table __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public static Animation GetRootAsAnimation(ByteBuffer _bb) { return GetRootAsAnimation(_bb, new Animation()); } + public static Animation GetRootAsAnimation(ByteBuffer _bb, Animation obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public Animation __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public Config? AnimConfig { get { int o = __p.__offset(4); return o != 0 ? (Config?)(new Config()).__assign(__p.__indirect(o + __p.bb_pos), __p.bb) : null; } } + public BoneList? Bones { get { int o = __p.__offset(6); return o != 0 ? (BoneList?)(new BoneList()).__assign(__p.__indirect(o + __p.bb_pos), __p.bb) : null; } } + public MaterialList? Materials { get { int o = __p.__offset(8); return o != 0 ? (MaterialList?)(new MaterialList()).__assign(__p.__indirect(o + __p.bb_pos), __p.bb) : null; } } + public GroupList? Groups { get { int o = __p.__offset(10); return o != 0 ? (GroupList?)(new GroupList()).__assign(__p.__indirect(o + __p.bb_pos), __p.bb) : null; } } + public TriggerList? Triggers { get { int o = __p.__offset(12); return o != 0 ? (TriggerList?)(new TriggerList()).__assign(__p.__indirect(o + __p.bb_pos), __p.bb) : null; } } + + public static Offset CreateAnimation(FlatBufferBuilder builder, + Offset AnimConfigOffset = default(Offset), + Offset BonesOffset = default(Offset), + Offset MaterialsOffset = default(Offset), + Offset GroupsOffset = default(Offset), + Offset TriggersOffset = default(Offset)) + { + builder.StartObject(5); + Animation.AddTriggers(builder, TriggersOffset); + Animation.AddGroups(builder, GroupsOffset); + Animation.AddMaterials(builder, MaterialsOffset); + Animation.AddBones(builder, BonesOffset); + Animation.AddAnimConfig(builder, AnimConfigOffset); + return Animation.EndAnimation(builder); + } + + public static void StartAnimation(FlatBufferBuilder builder) { builder.StartObject(5); } + public static void AddAnimConfig(FlatBufferBuilder builder, Offset AnimConfigOffset) { builder.AddOffset(0, AnimConfigOffset.Value, 0); } + public static void AddBones(FlatBufferBuilder builder, Offset BonesOffset) { builder.AddOffset(1, BonesOffset.Value, 0); } + public static void AddMaterials(FlatBufferBuilder builder, Offset MaterialsOffset) { builder.AddOffset(2, MaterialsOffset.Value, 0); } + public static void AddGroups(FlatBufferBuilder builder, Offset GroupsOffset) { builder.AddOffset(3, GroupsOffset.Value, 0); } + public static void AddTriggers(FlatBufferBuilder builder, Offset TriggersOffset) { builder.AddOffset(4, TriggersOffset.Value, 0); } + public static Offset EndAnimation(FlatBufferBuilder builder) + { + int o = builder.EndObject(); + return new Offset(o); + } + public static void FinishAnimationBuffer(FlatBufferBuilder builder, Offset offset) { builder.Finish(offset.Value); } + public static void FinishSizePrefixedAnimationBuffer(FlatBufferBuilder builder, Offset offset) { builder.FinishSizePrefixed(offset.Value); } + }; + + public struct TriggerList : IFlatbufferObject + { + private Table __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public static TriggerList GetRootAsTriggerList(ByteBuffer _bb) { return GetRootAsTriggerList(_bb, new TriggerList()); } + public static TriggerList GetRootAsTriggerList(ByteBuffer _bb, TriggerList obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public TriggerList __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public Trigger? Triggers(int j) { int o = __p.__offset(4); return o != 0 ? (Trigger?)(new Trigger()).__assign(__p.__indirect(__p.__vector(o) + j * 4), __p.bb) : null; } + public int TriggersLength { get { int o = __p.__offset(4); return o != 0 ? __p.__vector_len(o) : 0; } } + + public static Offset CreateTriggerList(FlatBufferBuilder builder, + VectorOffset TriggersOffset = default(VectorOffset)) + { + builder.StartObject(1); + TriggerList.AddTriggers(builder, TriggersOffset); + return TriggerList.EndTriggerList(builder); + } + + public static void StartTriggerList(FlatBufferBuilder builder) { builder.StartObject(1); } + public static void AddTriggers(FlatBufferBuilder builder, VectorOffset TriggersOffset) { builder.AddOffset(0, TriggersOffset.Value, 0); } + public static VectorOffset CreateTriggersVector(FlatBufferBuilder builder, Offset[] data) { builder.StartVector(4, data.Length, 4); for (int i = data.Length - 1; i >= 0; i--) builder.AddOffset(data[i].Value); return builder.EndVector(); } + public static VectorOffset CreateTriggersVectorBlock(FlatBufferBuilder builder, Offset[] data) { builder.StartVector(4, data.Length, 4); builder.Add(data); return builder.EndVector(); } + public static void StartTriggersVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(4, numElems, 4); } + public static Offset EndTriggerList(FlatBufferBuilder builder) + { + int o = builder.EndObject(); + return new Offset(o); + } + }; + + public struct Trigger : IFlatbufferObject + { + private Table __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public static Trigger GetRootAsTrigger(ByteBuffer _bb) { return GetRootAsTrigger(_bb, new Trigger()); } + public static Trigger GetRootAsTrigger(ByteBuffer _bb, Trigger obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public Trigger __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public string Name { get { int o = __p.__offset(4); return o != 0 ? __p.__string(o + __p.bb_pos) : null; } } +#if ENABLE_SPAN_T + public Span GetNameBytes() { return __p.__vector_as_span(4); } +#else + public ArraySegment? GetNameBytes() { return __p.__vector_as_arraysegment(4); } +#endif + public byte[] GetNameArray() { return __p.__vector_as_array(4); } + public int FrameStart { get { int o = __p.__offset(6); return o != 0 ? __p.bb.GetInt(o + __p.bb_pos) : (int)0; } } + public int FrameEnd { get { int o = __p.__offset(8); return o != 0 ? __p.bb.GetInt(o + __p.bb_pos) : (int)0; } } + public TriggerParameter? Parameter { get { int o = __p.__offset(10); return o != 0 ? (TriggerParameter?)(new TriggerParameter()).__assign(__p.__indirect(o + __p.bb_pos), __p.bb) : null; } } + + public static Offset CreateTrigger(FlatBufferBuilder builder, + StringOffset NameOffset = default(StringOffset), + int FrameStart = 0, + int FrameEnd = 0, + Offset ParameterOffset = default(Offset)) + { + builder.StartObject(4); + Trigger.AddParameter(builder, ParameterOffset); + Trigger.AddFrameEnd(builder, FrameEnd); + Trigger.AddFrameStart(builder, FrameStart); + Trigger.AddName(builder, NameOffset); + return Trigger.EndTrigger(builder); + } + + public static void StartTrigger(FlatBufferBuilder builder) { builder.StartObject(4); } + public static void AddName(FlatBufferBuilder builder, StringOffset NameOffset) { builder.AddOffset(0, NameOffset.Value, 0); } + public static void AddFrameStart(FlatBufferBuilder builder, int FrameStart) { builder.AddInt(1, FrameStart, 0); } + public static void AddFrameEnd(FlatBufferBuilder builder, int FrameEnd) { builder.AddInt(2, FrameEnd, 0); } + public static void AddParameter(FlatBufferBuilder builder, Offset ParameterOffset) { builder.AddOffset(3, ParameterOffset.Value, 0); } + public static Offset EndTrigger(FlatBufferBuilder builder) + { + int o = builder.EndObject(); + return new Offset(o); + } + }; + + public struct TriggerParameter : IFlatbufferObject + { + private Table __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public static TriggerParameter GetRootAsTriggerParameter(ByteBuffer _bb) { return GetRootAsTriggerParameter(_bb, new TriggerParameter()); } + public static TriggerParameter GetRootAsTriggerParameter(ByteBuffer _bb, TriggerParameter obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public TriggerParameter __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public string Name { get { int o = __p.__offset(4); return o != 0 ? __p.__string(o + __p.bb_pos) : null; } } +#if ENABLE_SPAN_T + public Span GetNameBytes() { return __p.__vector_as_span(4); } +#else + public ArraySegment? GetNameBytes() { return __p.__vector_as_arraysegment(4); } +#endif + public byte[] GetNameArray() { return __p.__vector_as_array(4); } + public TriggerParams ParamsType { get { int o = __p.__offset(6); return o != 0 ? (TriggerParams)__p.bb.Get(o + __p.bb_pos) : TriggerParams.NONE; } } + public TTable? Params() where TTable : struct, IFlatbufferObject { int o = __p.__offset(8); return o != 0 ? (TTable?)__p.__union(o) : null; } + + public static Offset CreateTriggerParameter(FlatBufferBuilder builder, + StringOffset NameOffset = default(StringOffset), + TriggerParams Params_type = TriggerParams.NONE, + int ParamsOffset = 0) + { + builder.StartObject(3); + TriggerParameter.AddParams(builder, ParamsOffset); + TriggerParameter.AddName(builder, NameOffset); + TriggerParameter.AddParamsType(builder, Params_type); + return TriggerParameter.EndTriggerParameter(builder); + } + + public static void StartTriggerParameter(FlatBufferBuilder builder) { builder.StartObject(3); } + public static void AddName(FlatBufferBuilder builder, StringOffset NameOffset) { builder.AddOffset(0, NameOffset.Value, 0); } + public static void AddParamsType(FlatBufferBuilder builder, TriggerParams ParamsType) { builder.AddByte(1, (byte)ParamsType, 0); } + public static void AddParams(FlatBufferBuilder builder, int ParamsOffset) { builder.AddOffset(2, ParamsOffset, 0); } + public static Offset EndTriggerParameter(FlatBufferBuilder builder) + { + int o = builder.EndObject(); + return new Offset(o); + } + }; + + public struct TriggerParameterInt : IFlatbufferObject + { + private Table __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public static TriggerParameterInt GetRootAsTriggerParameterInt(ByteBuffer _bb) { return GetRootAsTriggerParameterInt(_bb, new TriggerParameterInt()); } + public static TriggerParameterInt GetRootAsTriggerParameterInt(ByteBuffer _bb, TriggerParameterInt obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public TriggerParameterInt __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public int Value { get { int o = __p.__offset(4); return o != 0 ? __p.bb.GetInt(o + __p.bb_pos) : (int)0; } } + + public static Offset CreateTriggerParameterInt(FlatBufferBuilder builder, + int Value = 0) + { + builder.StartObject(1); + TriggerParameterInt.AddValue(builder, Value); + return TriggerParameterInt.EndTriggerParameterInt(builder); + } + + public static void StartTriggerParameterInt(FlatBufferBuilder builder) { builder.StartObject(1); } + public static void AddValue(FlatBufferBuilder builder, int Value) { builder.AddInt(0, Value, 0); } + public static Offset EndTriggerParameterInt(FlatBufferBuilder builder) + { + int o = builder.EndObject(); + return new Offset(o); + } + }; + + public struct TriggerParameterFloat : IFlatbufferObject + { + private Table __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public static TriggerParameterFloat GetRootAsTriggerParameterFloat(ByteBuffer _bb) { return GetRootAsTriggerParameterFloat(_bb, new TriggerParameterFloat()); } + public static TriggerParameterFloat GetRootAsTriggerParameterFloat(ByteBuffer _bb, TriggerParameterFloat obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public TriggerParameterFloat __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public float Value { get { int o = __p.__offset(4); return o != 0 ? __p.bb.GetFloat(o + __p.bb_pos) : (float)0.0f; } } + + public static Offset CreateTriggerParameterFloat(FlatBufferBuilder builder, + float Value = 0.0f) + { + builder.StartObject(1); + TriggerParameterFloat.AddValue(builder, Value); + return TriggerParameterFloat.EndTriggerParameterFloat(builder); + } + + public static void StartTriggerParameterFloat(FlatBufferBuilder builder) { builder.StartObject(1); } + public static void AddValue(FlatBufferBuilder builder, float Value) { builder.AddFloat(0, Value, 0.0f); } + public static Offset EndTriggerParameterFloat(FlatBufferBuilder builder) + { + int o = builder.EndObject(); + return new Offset(o); + } + }; + + public struct TriggerParameterByte : IFlatbufferObject + { + private Table __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public static TriggerParameterByte GetRootAsTriggerParameterByte(ByteBuffer _bb) { return GetRootAsTriggerParameterByte(_bb, new TriggerParameterByte()); } + public static TriggerParameterByte GetRootAsTriggerParameterByte(ByteBuffer _bb, TriggerParameterByte obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public TriggerParameterByte __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public sbyte Value { get { int o = __p.__offset(4); return o != 0 ? __p.bb.GetSbyte(o + __p.bb_pos) : (sbyte)0; } } + + public static Offset CreateTriggerParameterByte(FlatBufferBuilder builder, + sbyte Value = 0) + { + builder.StartObject(1); + TriggerParameterByte.AddValue(builder, Value); + return TriggerParameterByte.EndTriggerParameterByte(builder); + } + + public static void StartTriggerParameterByte(FlatBufferBuilder builder) { builder.StartObject(1); } + public static void AddValue(FlatBufferBuilder builder, sbyte Value) { builder.AddSbyte(0, Value, 0); } + public static Offset EndTriggerParameterByte(FlatBufferBuilder builder) + { + int o = builder.EndObject(); + return new Offset(o); + } + }; + + public struct TriggerParameterString : IFlatbufferObject + { + private Table __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public static TriggerParameterString GetRootAsTriggerParameterString(ByteBuffer _bb) { return GetRootAsTriggerParameterString(_bb, new TriggerParameterString()); } + public static TriggerParameterString GetRootAsTriggerParameterString(ByteBuffer _bb, TriggerParameterString obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public TriggerParameterString __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public string Value { get { int o = __p.__offset(4); return o != 0 ? __p.__string(o + __p.bb_pos) : null; } } +#if ENABLE_SPAN_T + public Span GetValueBytes() { return __p.__vector_as_span(4); } +#else + public ArraySegment? GetValueBytes() { return __p.__vector_as_arraysegment(4); } +#endif + public byte[] GetValueArray() { return __p.__vector_as_array(4); } + + public static Offset CreateTriggerParameterString(FlatBufferBuilder builder, + StringOffset ValueOffset = default(StringOffset)) + { + builder.StartObject(1); + TriggerParameterString.AddValue(builder, ValueOffset); + return TriggerParameterString.EndTriggerParameterString(builder); + } + + public static void StartTriggerParameterString(FlatBufferBuilder builder) { builder.StartObject(1); } + public static void AddValue(FlatBufferBuilder builder, StringOffset ValueOffset) { builder.AddOffset(0, ValueOffset.Value, 0); } + public static Offset EndTriggerParameterString(FlatBufferBuilder builder) + { + int o = builder.EndObject(); + return new Offset(o); + } + }; + + public struct BoneList : IFlatbufferObject + { + private Table __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public static BoneList GetRootAsBoneList(ByteBuffer _bb) { return GetRootAsBoneList(_bb, new BoneList()); } + public static BoneList GetRootAsBoneList(ByteBuffer _bb, BoneList obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public BoneList __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public Bone? Bones(int j) { int o = __p.__offset(4); return o != 0 ? (Bone?)(new Bone()).__assign(__p.__indirect(__p.__vector(o) + j * 4), __p.bb) : null; } + public int BonesLength { get { int o = __p.__offset(4); return o != 0 ? __p.__vector_len(o) : 0; } } + public BoneDefaults? Defaults { get { int o = __p.__offset(6); return o != 0 ? (BoneDefaults?)(new BoneDefaults()).__assign(__p.__indirect(o + __p.bb_pos), __p.bb) : null; } } + + public static Offset CreateBoneList(FlatBufferBuilder builder, + VectorOffset BonesOffset = default(VectorOffset), + Offset DefaultsOffset = default(Offset)) + { + builder.StartObject(2); + BoneList.AddDefaults(builder, DefaultsOffset); + BoneList.AddBones(builder, BonesOffset); + return BoneList.EndBoneList(builder); + } + + public static void StartBoneList(FlatBufferBuilder builder) { builder.StartObject(2); } + public static void AddBones(FlatBufferBuilder builder, VectorOffset BonesOffset) { builder.AddOffset(0, BonesOffset.Value, 0); } + public static VectorOffset CreateBonesVector(FlatBufferBuilder builder, Offset[] data) { builder.StartVector(4, data.Length, 4); for (int i = data.Length - 1; i >= 0; i--) builder.AddOffset(data[i].Value); return builder.EndVector(); } + public static VectorOffset CreateBonesVectorBlock(FlatBufferBuilder builder, Offset[] data) { builder.StartVector(4, data.Length, 4); builder.Add(data); return builder.EndVector(); } + public static void StartBonesVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(4, numElems, 4); } + public static void AddDefaults(FlatBufferBuilder builder, Offset DefaultsOffset) { builder.AddOffset(1, DefaultsOffset.Value, 0); } + public static Offset EndBoneList(FlatBufferBuilder builder) + { + int o = builder.EndObject(); + return new Offset(o); + } + }; + + public struct MaterialList : IFlatbufferObject + { + private Table __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public static MaterialList GetRootAsMaterialList(ByteBuffer _bb) { return GetRootAsMaterialList(_bb, new MaterialList()); } + public static MaterialList GetRootAsMaterialList(ByteBuffer _bb, MaterialList obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public MaterialList __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public Material? Materials(int j) { int o = __p.__offset(4); return o != 0 ? (Material?)(new Material()).__assign(__p.__indirect(__p.__vector(o) + j * 4), __p.bb) : null; } + public int MaterialsLength { get { int o = __p.__offset(4); return o != 0 ? __p.__vector_len(o) : 0; } } + + public static Offset CreateMaterialList(FlatBufferBuilder builder, + VectorOffset MaterialsOffset = default(VectorOffset)) + { + builder.StartObject(1); + MaterialList.AddMaterials(builder, MaterialsOffset); + return MaterialList.EndMaterialList(builder); + } + + public static void StartMaterialList(FlatBufferBuilder builder) { builder.StartObject(1); } + public static void AddMaterials(FlatBufferBuilder builder, VectorOffset MaterialsOffset) { builder.AddOffset(0, MaterialsOffset.Value, 0); } + public static VectorOffset CreateMaterialsVector(FlatBufferBuilder builder, Offset[] data) { builder.StartVector(4, data.Length, 4); for (int i = data.Length - 1; i >= 0; i--) builder.AddOffset(data[i].Value); return builder.EndVector(); } + public static VectorOffset CreateMaterialsVectorBlock(FlatBufferBuilder builder, Offset[] data) { builder.StartVector(4, data.Length, 4); builder.Add(data); return builder.EndVector(); } + public static void StartMaterialsVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(4, numElems, 4); } + public static Offset EndMaterialList(FlatBufferBuilder builder) + { + int o = builder.EndObject(); + return new Offset(o); + } + }; + + public struct GroupList : IFlatbufferObject + { + private Table __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public static GroupList GetRootAsGroupList(ByteBuffer _bb) { return GetRootAsGroupList(_bb, new GroupList()); } + public static GroupList GetRootAsGroupList(ByteBuffer _bb, GroupList obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public GroupList __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public Group? Groups(int j) { int o = __p.__offset(4); return o != 0 ? (Group?)(new Group()).__assign(__p.__indirect(__p.__vector(o) + j * 4), __p.bb) : null; } + public int GroupsLength { get { int o = __p.__offset(4); return o != 0 ? __p.__vector_len(o) : 0; } } + + public static Offset CreateGroupList(FlatBufferBuilder builder, + VectorOffset GroupsOffset = default(VectorOffset)) + { + builder.StartObject(1); + GroupList.AddGroups(builder, GroupsOffset); + return GroupList.EndGroupList(builder); + } + + public static void StartGroupList(FlatBufferBuilder builder) { builder.StartObject(1); } + public static void AddGroups(FlatBufferBuilder builder, VectorOffset GroupsOffset) { builder.AddOffset(0, GroupsOffset.Value, 0); } + public static VectorOffset CreateGroupsVector(FlatBufferBuilder builder, Offset[] data) { builder.StartVector(4, data.Length, 4); for (int i = data.Length - 1; i >= 0; i--) builder.AddOffset(data[i].Value); return builder.EndVector(); } + public static VectorOffset CreateGroupsVectorBlock(FlatBufferBuilder builder, Offset[] data) { builder.StartVector(4, data.Length, 4); builder.Add(data); return builder.EndVector(); } + public static void StartGroupsVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(4, numElems, 4); } + public static Offset EndGroupList(FlatBufferBuilder builder) + { + int o = builder.EndObject(); + return new Offset(o); + } + }; + + public struct Bone : IFlatbufferObject + { + private Table __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public static Bone GetRootAsBone(ByteBuffer _bb) { return GetRootAsBone(_bb, new Bone()); } + public static Bone GetRootAsBone(ByteBuffer _bb, Bone obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public Bone __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public string Name { get { int o = __p.__offset(4); return o != 0 ? __p.__string(o + __p.bb_pos) : null; } } +#if ENABLE_SPAN_T + public Span GetNameBytes() { return __p.__vector_as_span(4); } +#else + public ArraySegment? GetNameBytes() { return __p.__vector_as_arraysegment(4); } +#endif + public byte[] GetNameArray() { return __p.__vector_as_array(4); } + public VectorTrack ScaleType { get { int o = __p.__offset(6); return o != 0 ? (VectorTrack)__p.bb.Get(o + __p.bb_pos) : VectorTrack.NONE; } } + public TTable? Scale() where TTable : struct, IFlatbufferObject { int o = __p.__offset(8); return o != 0 ? (TTable?)__p.__union(o) : null; } + public QuatTrack RotateType { get { int o = __p.__offset(10); return o != 0 ? (QuatTrack)__p.bb.Get(o + __p.bb_pos) : QuatTrack.NONE; } } + public TTable? Rotate() where TTable : struct, IFlatbufferObject { int o = __p.__offset(12); return o != 0 ? (TTable?)__p.__union(o) : null; } + public VectorTrack TranslateType { get { int o = __p.__offset(14); return o != 0 ? (VectorTrack)__p.bb.Get(o + __p.bb_pos) : VectorTrack.NONE; } } + public TTable? Translate() where TTable : struct, IFlatbufferObject { int o = __p.__offset(16); return o != 0 ? (TTable?)__p.__union(o) : null; } + public FrameRanges? ScaleFrames { get { int o = __p.__offset(18); return o != 0 ? (FrameRanges?)(new FrameRanges()).__assign(__p.__indirect(o + __p.bb_pos), __p.bb) : null; } } + public FrameRanges? RotationFrames { get { int o = __p.__offset(20); return o != 0 ? (FrameRanges?)(new FrameRanges()).__assign(__p.__indirect(o + __p.bb_pos), __p.bb) : null; } } + public FrameRanges? TranslationFrames { get { int o = __p.__offset(22); return o != 0 ? (FrameRanges?)(new FrameRanges()).__assign(__p.__indirect(o + __p.bb_pos), __p.bb) : null; } } + + public static Offset CreateBone(FlatBufferBuilder builder, + StringOffset NameOffset = default(StringOffset), + VectorTrack Scale_type = VectorTrack.NONE, + int ScaleOffset = 0, + QuatTrack Rotate_type = QuatTrack.NONE, + int RotateOffset = 0, + VectorTrack Translate_type = VectorTrack.NONE, + int TranslateOffset = 0, + Offset ScaleFramesOffset = default(Offset), + Offset RotationFramesOffset = default(Offset), + Offset TranslationFramesOffset = default(Offset)) + { + builder.StartObject(10); + Bone.AddTranslationFrames(builder, TranslationFramesOffset); + Bone.AddRotationFrames(builder, RotationFramesOffset); + Bone.AddScaleFrames(builder, ScaleFramesOffset); + Bone.AddTranslate(builder, TranslateOffset); + Bone.AddRotate(builder, RotateOffset); + Bone.AddScale(builder, ScaleOffset); + Bone.AddName(builder, NameOffset); + Bone.AddTranslateType(builder, Translate_type); + Bone.AddRotateType(builder, Rotate_type); + Bone.AddScaleType(builder, Scale_type); + return Bone.EndBone(builder); + } + + public static void StartBone(FlatBufferBuilder builder) { builder.StartObject(10); } + public static void AddName(FlatBufferBuilder builder, StringOffset NameOffset) { builder.AddOffset(0, NameOffset.Value, 0); } + public static void AddScaleType(FlatBufferBuilder builder, VectorTrack ScaleType) { builder.AddByte(1, (byte)ScaleType, 0); } + public static void AddScale(FlatBufferBuilder builder, int ScaleOffset) { builder.AddOffset(2, ScaleOffset, 0); } + public static void AddRotateType(FlatBufferBuilder builder, QuatTrack RotateType) { builder.AddByte(3, (byte)RotateType, 0); } + public static void AddRotate(FlatBufferBuilder builder, int RotateOffset) { builder.AddOffset(4, RotateOffset, 0); } + public static void AddTranslateType(FlatBufferBuilder builder, VectorTrack TranslateType) { builder.AddByte(5, (byte)TranslateType, 0); } + public static void AddTranslate(FlatBufferBuilder builder, int TranslateOffset) { builder.AddOffset(6, TranslateOffset, 0); } + public static void AddScaleFrames(FlatBufferBuilder builder, Offset ScaleFramesOffset) { builder.AddOffset(7, ScaleFramesOffset.Value, 0); } + public static void AddRotationFrames(FlatBufferBuilder builder, Offset RotationFramesOffset) { builder.AddOffset(8, RotationFramesOffset.Value, 0); } + public static void AddTranslationFrames(FlatBufferBuilder builder, Offset TranslationFramesOffset) { builder.AddOffset(9, TranslationFramesOffset.Value, 0); } + public static Offset EndBone(FlatBufferBuilder builder) + { + int o = builder.EndObject(); + return new Offset(o); + } + }; + + public struct BoneDefaults : IFlatbufferObject + { + private Table __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public static BoneDefaults GetRootAsBoneDefaults(ByteBuffer _bb) { return GetRootAsBoneDefaults(_bb, new BoneDefaults()); } + public static BoneDefaults GetRootAsBoneDefaults(ByteBuffer _bb, BoneDefaults obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public BoneDefaults __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public uint Unknown { get { int o = __p.__offset(4); return o != 0 ? __p.bb.GetUint(o + __p.bb_pos) : (uint)0; } } + public SRT? Transform(int j) { int o = __p.__offset(6); return o != 0 ? (SRT?)(new SRT()).__assign(__p.__vector(o) + j * 40, __p.bb) : null; } + public int TransformLength { get { int o = __p.__offset(6); return o != 0 ? __p.__vector_len(o) : 0; } } + + public static Offset CreateBoneDefaults(FlatBufferBuilder builder, + uint Unknown = 0, + VectorOffset TransformOffset = default(VectorOffset)) + { + builder.StartObject(2); + BoneDefaults.AddTransform(builder, TransformOffset); + BoneDefaults.AddUnknown(builder, Unknown); + return BoneDefaults.EndBoneDefaults(builder); + } + + public static void StartBoneDefaults(FlatBufferBuilder builder) { builder.StartObject(2); } + public static void AddUnknown(FlatBufferBuilder builder, uint Unknown) { builder.AddUint(0, Unknown, 0); } + public static void AddTransform(FlatBufferBuilder builder, VectorOffset TransformOffset) { builder.AddOffset(1, TransformOffset.Value, 0); } + public static void StartTransformVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(40, numElems, 4); } + public static Offset EndBoneDefaults(FlatBufferBuilder builder) + { + int o = builder.EndObject(); + return new Offset(o); + } + }; + + public struct Material : IFlatbufferObject + { + private Table __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public static Material GetRootAsMaterial(ByteBuffer _bb) { return GetRootAsMaterial(_bb, new Material()); } + public static Material GetRootAsMaterial(ByteBuffer _bb, Material obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public Material __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public string Name { get { int o = __p.__offset(4); return o != 0 ? __p.__string(o + __p.bb_pos) : null; } } +#if ENABLE_SPAN_T + public Span GetNameBytes() { return __p.__vector_as_span(4); } +#else + public ArraySegment? GetNameBytes() { return __p.__vector_as_arraysegment(4); } +#endif + public byte[] GetNameArray() { return __p.__vector_as_array(4); } + public MatSwitch? Switches(int j) { int o = __p.__offset(6); return o != 0 ? (MatSwitch?)(new MatSwitch()).__assign(__p.__indirect(__p.__vector(o) + j * 4), __p.bb) : null; } + public int SwitchesLength { get { int o = __p.__offset(6); return o != 0 ? __p.__vector_len(o) : 0; } } + public MatValue? Values(int j) { int o = __p.__offset(8); return o != 0 ? (MatValue?)(new MatValue()).__assign(__p.__indirect(__p.__vector(o) + j * 4), __p.bb) : null; } + public int ValuesLength { get { int o = __p.__offset(8); return o != 0 ? __p.__vector_len(o) : 0; } } + public MatVector? Vectors(int j) { int o = __p.__offset(10); return o != 0 ? (MatVector?)(new MatVector()).__assign(__p.__indirect(__p.__vector(o) + j * 4), __p.bb) : null; } + public int VectorsLength { get { int o = __p.__offset(10); return o != 0 ? __p.__vector_len(o) : 0; } } + + public static Offset CreateMaterial(FlatBufferBuilder builder, + StringOffset NameOffset = default(StringOffset), + VectorOffset SwitchesOffset = default(VectorOffset), + VectorOffset ValuesOffset = default(VectorOffset), + VectorOffset VectorsOffset = default(VectorOffset)) + { + builder.StartObject(4); + Material.AddVectors(builder, VectorsOffset); + Material.AddValues(builder, ValuesOffset); + Material.AddSwitches(builder, SwitchesOffset); + Material.AddName(builder, NameOffset); + return Material.EndMaterial(builder); + } + + public static void StartMaterial(FlatBufferBuilder builder) { builder.StartObject(4); } + public static void AddName(FlatBufferBuilder builder, StringOffset NameOffset) { builder.AddOffset(0, NameOffset.Value, 0); } + public static void AddSwitches(FlatBufferBuilder builder, VectorOffset SwitchesOffset) { builder.AddOffset(1, SwitchesOffset.Value, 0); } + public static VectorOffset CreateSwitchesVector(FlatBufferBuilder builder, Offset[] data) { builder.StartVector(4, data.Length, 4); for (int i = data.Length - 1; i >= 0; i--) builder.AddOffset(data[i].Value); return builder.EndVector(); } + public static VectorOffset CreateSwitchesVectorBlock(FlatBufferBuilder builder, Offset[] data) { builder.StartVector(4, data.Length, 4); builder.Add(data); return builder.EndVector(); } + public static void StartSwitchesVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(4, numElems, 4); } + public static void AddValues(FlatBufferBuilder builder, VectorOffset ValuesOffset) { builder.AddOffset(2, ValuesOffset.Value, 0); } + public static VectorOffset CreateValuesVector(FlatBufferBuilder builder, Offset[] data) { builder.StartVector(4, data.Length, 4); for (int i = data.Length - 1; i >= 0; i--) builder.AddOffset(data[i].Value); return builder.EndVector(); } + public static VectorOffset CreateValuesVectorBlock(FlatBufferBuilder builder, Offset[] data) { builder.StartVector(4, data.Length, 4); builder.Add(data); return builder.EndVector(); } + public static void StartValuesVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(4, numElems, 4); } + public static void AddVectors(FlatBufferBuilder builder, VectorOffset VectorsOffset) { builder.AddOffset(3, VectorsOffset.Value, 0); } + public static VectorOffset CreateVectorsVector(FlatBufferBuilder builder, Offset[] data) { builder.StartVector(4, data.Length, 4); for (int i = data.Length - 1; i >= 0; i--) builder.AddOffset(data[i].Value); return builder.EndVector(); } + public static VectorOffset CreateVectorsVectorBlock(FlatBufferBuilder builder, Offset[] data) { builder.StartVector(4, data.Length, 4); builder.Add(data); return builder.EndVector(); } + public static void StartVectorsVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(4, numElems, 4); } + public static Offset EndMaterial(FlatBufferBuilder builder) + { + int o = builder.EndObject(); + return new Offset(o); + } + }; + + public struct MatSwitch : IFlatbufferObject + { + private Table __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public static MatSwitch GetRootAsMatSwitch(ByteBuffer _bb) { return GetRootAsMatSwitch(_bb, new MatSwitch()); } + public static MatSwitch GetRootAsMatSwitch(ByteBuffer _bb, MatSwitch obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public MatSwitch __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public string Name { get { int o = __p.__offset(4); return o != 0 ? __p.__string(o + __p.bb_pos) : null; } } +#if ENABLE_SPAN_T + public Span GetNameBytes() { return __p.__vector_as_span(4); } +#else + public ArraySegment? GetNameBytes() { return __p.__vector_as_arraysegment(4); } +#endif + public byte[] GetNameArray() { return __p.__vector_as_array(4); } + public BooleanTrack ValueType { get { int o = __p.__offset(6); return o != 0 ? (BooleanTrack)__p.bb.Get(o + __p.bb_pos) : BooleanTrack.NONE; } } + public TTable? Value() where TTable : struct, IFlatbufferObject { int o = __p.__offset(8); return o != 0 ? (TTable?)__p.__union(o) : null; } + public FrameRanges? FrameRanges { get { int o = __p.__offset(10); return o != 0 ? (FrameRanges?)(new FrameRanges()).__assign(__p.__indirect(o + __p.bb_pos), __p.bb) : null; } } + + public static Offset CreateMatSwitch(FlatBufferBuilder builder, + StringOffset NameOffset = default(StringOffset), + BooleanTrack Value_type = BooleanTrack.NONE, + int ValueOffset = 0, + Offset frameRangesOffset = default(Offset)) + { + builder.StartObject(4); + MatSwitch.AddFrameRanges(builder, frameRangesOffset); + MatSwitch.AddValue(builder, ValueOffset); + MatSwitch.AddName(builder, NameOffset); + MatSwitch.AddValueType(builder, Value_type); + return MatSwitch.EndMatSwitch(builder); + } + + public static void StartMatSwitch(FlatBufferBuilder builder) { builder.StartObject(4); } + public static void AddName(FlatBufferBuilder builder, StringOffset NameOffset) { builder.AddOffset(0, NameOffset.Value, 0); } + public static void AddValueType(FlatBufferBuilder builder, BooleanTrack ValueType) { builder.AddByte(1, (byte)ValueType, 0); } + public static void AddValue(FlatBufferBuilder builder, int ValueOffset) { builder.AddOffset(2, ValueOffset, 0); } + public static void AddFrameRanges(FlatBufferBuilder builder, Offset frameRangesOffset) { builder.AddOffset(3, frameRangesOffset.Value, 0); } + public static Offset EndMatSwitch(FlatBufferBuilder builder) + { + int o = builder.EndObject(); + return new Offset(o); + } + }; + + public struct MatValue : IFlatbufferObject + { + private Table __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public static MatValue GetRootAsMatValue(ByteBuffer _bb) { return GetRootAsMatValue(_bb, new MatValue()); } + public static MatValue GetRootAsMatValue(ByteBuffer _bb, MatValue obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public MatValue __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public string Name { get { int o = __p.__offset(4); return o != 0 ? __p.__string(o + __p.bb_pos) : null; } } +#if ENABLE_SPAN_T + public Span GetNameBytes() { return __p.__vector_as_span(4); } +#else + public ArraySegment? GetNameBytes() { return __p.__vector_as_arraysegment(4); } +#endif + public byte[] GetNameArray() { return __p.__vector_as_array(4); } + public ValueTrack ValueType { get { int o = __p.__offset(6); return o != 0 ? (ValueTrack)__p.bb.Get(o + __p.bb_pos) : ValueTrack.NONE; } } + public TTable? Value() where TTable : struct, IFlatbufferObject { int o = __p.__offset(8); return o != 0 ? (TTable?)__p.__union(o) : null; } + public FrameRanges? FrameRanges { get { int o = __p.__offset(10); return o != 0 ? (FrameRanges?)(new FrameRanges()).__assign(__p.__indirect(o + __p.bb_pos), __p.bb) : null; } } + + public static Offset CreateMatValue(FlatBufferBuilder builder, + StringOffset NameOffset = default(StringOffset), + ValueTrack Value_type = ValueTrack.NONE, + int ValueOffset = 0, + Offset frameRangesOffset = default(Offset)) + { + builder.StartObject(4); + MatValue.AddFrameRanges(builder, frameRangesOffset); + MatValue.AddValue(builder, ValueOffset); + MatValue.AddName(builder, NameOffset); + MatValue.AddValueType(builder, Value_type); + return MatValue.EndMatValue(builder); + } + + public static void StartMatValue(FlatBufferBuilder builder) { builder.StartObject(4); } + public static void AddName(FlatBufferBuilder builder, StringOffset NameOffset) { builder.AddOffset(0, NameOffset.Value, 0); } + public static void AddValueType(FlatBufferBuilder builder, ValueTrack ValueType) { builder.AddByte(1, (byte)ValueType, 0); } + public static void AddValue(FlatBufferBuilder builder, int ValueOffset) { builder.AddOffset(2, ValueOffset, 0); } + public static void AddFrameRanges(FlatBufferBuilder builder, Offset frameRangesOffset) { builder.AddOffset(3, frameRangesOffset.Value, 0); } + public static Offset EndMatValue(FlatBufferBuilder builder) + { + int o = builder.EndObject(); + return new Offset(o); + } + }; + + public struct MatVector : IFlatbufferObject + { + private Table __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public static MatVector GetRootAsMatVector(ByteBuffer _bb) { return GetRootAsMatVector(_bb, new MatVector()); } + public static MatVector GetRootAsMatVector(ByteBuffer _bb, MatVector obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public MatVector __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public string Name { get { int o = __p.__offset(4); return o != 0 ? __p.__string(o + __p.bb_pos) : null; } } +#if ENABLE_SPAN_T + public Span GetNameBytes() { return __p.__vector_as_span(4); } +#else + public ArraySegment? GetNameBytes() { return __p.__vector_as_arraysegment(4); } +#endif + public byte[] GetNameArray() { return __p.__vector_as_array(4); } + public VectorTrack ValueType { get { int o = __p.__offset(6); return o != 0 ? (VectorTrack)__p.bb.Get(o + __p.bb_pos) : VectorTrack.NONE; } } + public TTable? Value() where TTable : struct, IFlatbufferObject { int o = __p.__offset(8); return o != 0 ? (TTable?)__p.__union(o) : null; } + public FrameRanges? FrameRanges { get { int o = __p.__offset(10); return o != 0 ? (FrameRanges?)(new FrameRanges()).__assign(__p.__indirect(o + __p.bb_pos), __p.bb) : null; } } + + public static Offset CreateMatVector(FlatBufferBuilder builder, + StringOffset NameOffset = default(StringOffset), + VectorTrack Value_type = VectorTrack.NONE, + int ValueOffset = 0, + Offset frameRangesOffset = default(Offset)) + { + builder.StartObject(4); + MatVector.AddFrameRanges(builder, frameRangesOffset); + MatVector.AddValue(builder, ValueOffset); + MatVector.AddName(builder, NameOffset); + MatVector.AddValueType(builder, Value_type); + return MatVector.EndMatVector(builder); + } + + public static void StartMatVector(FlatBufferBuilder builder) { builder.StartObject(4); } + public static void AddName(FlatBufferBuilder builder, StringOffset NameOffset) { builder.AddOffset(0, NameOffset.Value, 0); } + public static void AddValueType(FlatBufferBuilder builder, VectorTrack ValueType) { builder.AddByte(1, (byte)ValueType, 0); } + public static void AddValue(FlatBufferBuilder builder, int ValueOffset) { builder.AddOffset(2, ValueOffset, 0); } + public static void AddFrameRanges(FlatBufferBuilder builder, Offset frameRangesOffset) { builder.AddOffset(3, frameRangesOffset.Value, 0); } + public static Offset EndMatVector(FlatBufferBuilder builder) + { + int o = builder.EndObject(); + return new Offset(o); + } + }; + + public struct Group : IFlatbufferObject + { + private Table __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public static Group GetRootAsGroup(ByteBuffer _bb) { return GetRootAsGroup(_bb, new Group()); } + public static Group GetRootAsGroup(ByteBuffer _bb, Group obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public Group __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public string Name { get { int o = __p.__offset(4); return o != 0 ? __p.__string(o + __p.bb_pos) : null; } } +#if ENABLE_SPAN_T + public Span GetNameBytes() { return __p.__vector_as_span(4); } +#else + public ArraySegment? GetNameBytes() { return __p.__vector_as_arraysegment(4); } +#endif + public byte[] GetNameArray() { return __p.__vector_as_array(4); } + public BooleanTrack ValueType { get { int o = __p.__offset(6); return o != 0 ? (BooleanTrack)__p.bb.Get(o + __p.bb_pos) : BooleanTrack.NONE; } } + public TTable? Value() where TTable : struct, IFlatbufferObject { int o = __p.__offset(8); return o != 0 ? (TTable?)__p.__union(o) : null; } + + public static Offset CreateGroup(FlatBufferBuilder builder, + StringOffset NameOffset = default(StringOffset), + BooleanTrack Value_type = BooleanTrack.NONE, + int ValueOffset = 0) + { + builder.StartObject(3); + Group.AddValue(builder, ValueOffset); + Group.AddName(builder, NameOffset); + Group.AddValueType(builder, Value_type); + return Group.EndGroup(builder); + } + + public static void StartGroup(FlatBufferBuilder builder) { builder.StartObject(3); } + public static void AddName(FlatBufferBuilder builder, StringOffset NameOffset) { builder.AddOffset(0, NameOffset.Value, 0); } + public static void AddValueType(FlatBufferBuilder builder, BooleanTrack ValueType) { builder.AddByte(1, (byte)ValueType, 0); } + public static void AddValue(FlatBufferBuilder builder, int ValueOffset) { builder.AddOffset(2, ValueOffset, 0); } + public static Offset EndGroup(FlatBufferBuilder builder) + { + int o = builder.EndObject(); + return new Offset(o); + } + }; + + public struct Config : IFlatbufferObject + { + private Table __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public static Config GetRootAsConfig(ByteBuffer _bb) { return GetRootAsConfig(_bb, new Config()); } + public static Config GetRootAsConfig(ByteBuffer _bb, Config obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public Config __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public uint Unknown { get { int o = __p.__offset(4); return o != 0 ? __p.bb.GetUint(o + __p.bb_pos) : (uint)0; } } + public uint KeyFrames { get { int o = __p.__offset(6); return o != 0 ? __p.bb.GetUint(o + __p.bb_pos) : (uint)0; } } + public uint FramesPerSecond { get { int o = __p.__offset(8); return o != 0 ? __p.bb.GetUint(o + __p.bb_pos) : (uint)0; } } + + public static Offset CreateConfig(FlatBufferBuilder builder, + uint Unknown = 0, + uint KeyFrames = 0, + uint FramesPerSecond = 0) + { + builder.StartObject(3); + Config.AddFramesPerSecond(builder, FramesPerSecond); + Config.AddKeyFrames(builder, KeyFrames); + Config.AddUnknown(builder, Unknown); + return Config.EndConfig(builder); + } + + public static void StartConfig(FlatBufferBuilder builder) { builder.StartObject(3); } + public static void AddUnknown(FlatBufferBuilder builder, uint Unknown) { builder.AddUint(0, Unknown, 0); } + public static void AddKeyFrames(FlatBufferBuilder builder, uint KeyFrames) { builder.AddUint(1, KeyFrames, 0); } + public static void AddFramesPerSecond(FlatBufferBuilder builder, uint FramesPerSecond) { builder.AddUint(2, FramesPerSecond, 0); } + public static Offset EndConfig(FlatBufferBuilder builder) + { + int o = builder.EndObject(); + return new Offset(o); + } + }; + + public struct FixedVectorTrack : IFlatbufferObject + { + private Table __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public static FixedVectorTrack GetRootAsFixedVectorTrack(ByteBuffer _bb) { return GetRootAsFixedVectorTrack(_bb, new FixedVectorTrack()); } + public static FixedVectorTrack GetRootAsFixedVectorTrack(ByteBuffer _bb, FixedVectorTrack obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public FixedVectorTrack __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public Vector3? Value { get { int o = __p.__offset(4); return o != 0 ? (Vector3?)(new Vector3()).__assign(o + __p.bb_pos, __p.bb) : null; } } + + public static void StartFixedVectorTrack(FlatBufferBuilder builder) { builder.StartObject(1); } + public static void AddValue(FlatBufferBuilder builder, Offset ValueOffset) { builder.AddStruct(0, ValueOffset.Value, 0); } + public static Offset EndFixedVectorTrack(FlatBufferBuilder builder) + { + int o = builder.EndObject(); + return new Offset(o); + } + }; + + public struct DynamicVectorTrack : IFlatbufferObject + { + private Table __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public static DynamicVectorTrack GetRootAsDynamicVectorTrack(ByteBuffer _bb) { return GetRootAsDynamicVectorTrack(_bb, new DynamicVectorTrack()); } + public static DynamicVectorTrack GetRootAsDynamicVectorTrack(ByteBuffer _bb, DynamicVectorTrack obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public DynamicVectorTrack __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public Vector3? Values(int j) { int o = __p.__offset(4); return o != 0 ? (Vector3?)(new Vector3()).__assign(__p.__vector(o) + j * 12, __p.bb) : null; } + public int ValuesLength { get { int o = __p.__offset(4); return o != 0 ? __p.__vector_len(o) : 0; } } + + public static Offset CreateDynamicVectorTrack(FlatBufferBuilder builder, + VectorOffset ValuesOffset = default(VectorOffset)) + { + builder.StartObject(1); + DynamicVectorTrack.AddValues(builder, ValuesOffset); + return DynamicVectorTrack.EndDynamicVectorTrack(builder); + } + + public static void StartDynamicVectorTrack(FlatBufferBuilder builder) { builder.StartObject(1); } + public static void AddValues(FlatBufferBuilder builder, VectorOffset ValuesOffset) { builder.AddOffset(0, ValuesOffset.Value, 0); } + public static void StartValuesVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(12, numElems, 4); } + public static Offset EndDynamicVectorTrack(FlatBufferBuilder builder) + { + int o = builder.EndObject(); + return new Offset(o); + } + }; + + public struct FramedVectorTrack : IFlatbufferObject + { + private Table __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public static FramedVectorTrack GetRootAsFramedVectorTrack(ByteBuffer _bb) { return GetRootAsFramedVectorTrack(_bb, new FramedVectorTrack()); } + public static FramedVectorTrack GetRootAsFramedVectorTrack(ByteBuffer _bb, FramedVectorTrack obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public FramedVectorTrack __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public ushort Frames(int j) { int o = __p.__offset(4); return o != 0 ? __p.bb.GetUshort(__p.__vector(o) + j * 2) : (ushort)0; } + public int FramesLength { get { int o = __p.__offset(4); return o != 0 ? __p.__vector_len(o) : 0; } } +#if ENABLE_SPAN_T + public Span GetFramesBytes() { return __p.__vector_as_span(4); } +#else + public ArraySegment? GetFramesBytes() { return __p.__vector_as_arraysegment(4); } +#endif + public ushort[] GetFramesArray() { return __p.__vector_as_array(4); } + public Vector3? Values(int j) { int o = __p.__offset(6); return o != 0 ? (Vector3?)(new Vector3()).__assign(__p.__vector(o) + j * 12, __p.bb) : null; } + public int ValuesLength { get { int o = __p.__offset(6); return o != 0 ? __p.__vector_len(o) : 0; } } + + public static Offset CreateFramedVectorTrack(FlatBufferBuilder builder, + VectorOffset FramesOffset = default(VectorOffset), + VectorOffset ValuesOffset = default(VectorOffset)) + { + builder.StartObject(2); + FramedVectorTrack.AddValues(builder, ValuesOffset); + FramedVectorTrack.AddFrames(builder, FramesOffset); + return FramedVectorTrack.EndFramedVectorTrack(builder); + } + + public static void StartFramedVectorTrack(FlatBufferBuilder builder) { builder.StartObject(2); } + public static void AddFrames(FlatBufferBuilder builder, VectorOffset FramesOffset) { builder.AddOffset(0, FramesOffset.Value, 0); } + public static VectorOffset CreateFramesVector(FlatBufferBuilder builder, ushort[] data) { builder.StartVector(2, data.Length, 2); for (int i = data.Length - 1; i >= 0; i--) builder.AddUshort(data[i]); return builder.EndVector(); } + public static VectorOffset CreateFramesVectorBlock(FlatBufferBuilder builder, ushort[] data) { builder.StartVector(2, data.Length, 2); builder.Add(data); return builder.EndVector(); } + public static void StartFramesVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(2, numElems, 2); } + public static void AddValues(FlatBufferBuilder builder, VectorOffset ValuesOffset) { builder.AddOffset(1, ValuesOffset.Value, 0); } + public static void StartValuesVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(12, numElems, 4); } + public static Offset EndFramedVectorTrack(FlatBufferBuilder builder) + { + int o = builder.EndObject(); + return new Offset(o); + } + }; + + public struct FixedQuatTrack : IFlatbufferObject + { + private Table __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public static FixedQuatTrack GetRootAsFixedQuatTrack(ByteBuffer _bb) { return GetRootAsFixedQuatTrack(_bb, new FixedQuatTrack()); } + public static FixedQuatTrack GetRootAsFixedQuatTrack(ByteBuffer _bb, FixedQuatTrack obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public FixedQuatTrack __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public Quaternion? Value { get { int o = __p.__offset(4); return o != 0 ? (Quaternion?)(new Quaternion()).__assign(o + __p.bb_pos, __p.bb) : null; } } + + public static void StartFixedQuatTrack(FlatBufferBuilder builder) { builder.StartObject(1); } + public static void AddValue(FlatBufferBuilder builder, Offset ValueOffset) { builder.AddStruct(0, ValueOffset.Value, 0); } + public static Offset EndFixedQuatTrack(FlatBufferBuilder builder) + { + int o = builder.EndObject(); + return new Offset(o); + } + }; + + public struct DynamicQuatTrack : IFlatbufferObject + { + private Table __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public static DynamicQuatTrack GetRootAsDynamicQuatTrack(ByteBuffer _bb) { return GetRootAsDynamicQuatTrack(_bb, new DynamicQuatTrack()); } + public static DynamicQuatTrack GetRootAsDynamicQuatTrack(ByteBuffer _bb, DynamicQuatTrack obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public DynamicQuatTrack __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public Quaternion? Values(int j) { int o = __p.__offset(4); return o != 0 ? (Quaternion?)(new Quaternion()).__assign(__p.__vector(o) + j * 6, __p.bb) : null; } + public int ValuesLength { get { int o = __p.__offset(4); return o != 0 ? __p.__vector_len(o) : 0; } } + + public static Offset CreateDynamicQuatTrack(FlatBufferBuilder builder, + VectorOffset ValuesOffset = default(VectorOffset)) + { + builder.StartObject(1); + DynamicQuatTrack.AddValues(builder, ValuesOffset); + return DynamicQuatTrack.EndDynamicQuatTrack(builder); + } + + public static void StartDynamicQuatTrack(FlatBufferBuilder builder) { builder.StartObject(1); } + public static void AddValues(FlatBufferBuilder builder, VectorOffset ValuesOffset) { builder.AddOffset(0, ValuesOffset.Value, 0); } + public static void StartValuesVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(6, numElems, 2); } + public static Offset EndDynamicQuatTrack(FlatBufferBuilder builder) + { + int o = builder.EndObject(); + return new Offset(o); + } + }; + + public struct FramedQuatTrack : IFlatbufferObject + { + private Table __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public static FramedQuatTrack GetRootAsFramedQuatTrack(ByteBuffer _bb) { return GetRootAsFramedQuatTrack(_bb, new FramedQuatTrack()); } + public static FramedQuatTrack GetRootAsFramedQuatTrack(ByteBuffer _bb, FramedQuatTrack obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public FramedQuatTrack __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public ushort Frames(int j) { int o = __p.__offset(4); return o != 0 ? __p.bb.GetUshort(__p.__vector(o) + j * 2) : (ushort)0; } + public int FramesLength { get { int o = __p.__offset(4); return o != 0 ? __p.__vector_len(o) : 0; } } +#if ENABLE_SPAN_T + public Span GetFramesBytes() { return __p.__vector_as_span(4); } +#else + public ArraySegment? GetFramesBytes() { return __p.__vector_as_arraysegment(4); } +#endif + public ushort[] GetFramesArray() { return __p.__vector_as_array(4); } + public Quaternion? Values(int j) { int o = __p.__offset(6); return o != 0 ? (Quaternion?)(new Quaternion()).__assign(__p.__vector(o) + j * 6, __p.bb) : null; } + public int ValuesLength { get { int o = __p.__offset(6); return o != 0 ? __p.__vector_len(o) : 0; } } + + public static Offset CreateFramedQuatTrack(FlatBufferBuilder builder, + VectorOffset FramesOffset = default(VectorOffset), + VectorOffset ValuesOffset = default(VectorOffset)) + { + builder.StartObject(2); + FramedQuatTrack.AddValues(builder, ValuesOffset); + FramedQuatTrack.AddFrames(builder, FramesOffset); + return FramedQuatTrack.EndFramedQuatTrack(builder); + } + + public static void StartFramedQuatTrack(FlatBufferBuilder builder) { builder.StartObject(2); } + public static void AddFrames(FlatBufferBuilder builder, VectorOffset FramesOffset) { builder.AddOffset(0, FramesOffset.Value, 0); } + public static VectorOffset CreateFramesVector(FlatBufferBuilder builder, ushort[] data) { builder.StartVector(2, data.Length, 2); for (int i = data.Length - 1; i >= 0; i--) builder.AddUshort(data[i]); return builder.EndVector(); } + public static VectorOffset CreateFramesVectorBlock(FlatBufferBuilder builder, ushort[] data) { builder.StartVector(2, data.Length, 2); builder.Add(data); return builder.EndVector(); } + public static void StartFramesVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(2, numElems, 2); } + public static void AddValues(FlatBufferBuilder builder, VectorOffset ValuesOffset) { builder.AddOffset(1, ValuesOffset.Value, 0); } + public static void StartValuesVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(6, numElems, 2); } + public static Offset EndFramedQuatTrack(FlatBufferBuilder builder) + { + int o = builder.EndObject(); + return new Offset(o); + } + }; + + public struct FixedBooleanTrack : IFlatbufferObject + { + private Table __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public static FixedBooleanTrack GetRootAsFixedBooleanTrack(ByteBuffer _bb) { return GetRootAsFixedBooleanTrack(_bb, new FixedBooleanTrack()); } + public static FixedBooleanTrack GetRootAsFixedBooleanTrack(ByteBuffer _bb, FixedBooleanTrack obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public FixedBooleanTrack __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public sbyte Value { get { int o = __p.__offset(4); return o != 0 ? __p.bb.GetSbyte(o + __p.bb_pos) : (sbyte)0; } } + + public static Offset CreateFixedBooleanTrack(FlatBufferBuilder builder, + sbyte Value = 0) + { + builder.StartObject(1); + FixedBooleanTrack.AddValue(builder, Value); + return FixedBooleanTrack.EndFixedBooleanTrack(builder); + } + + public static void StartFixedBooleanTrack(FlatBufferBuilder builder) { builder.StartObject(1); } + public static void AddValue(FlatBufferBuilder builder, sbyte Value) { builder.AddSbyte(0, Value, 0); } + public static Offset EndFixedBooleanTrack(FlatBufferBuilder builder) + { + int o = builder.EndObject(); + return new Offset(o); + } + }; + + public struct DynamicBooleanTrack : IFlatbufferObject + { + private Table __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public static DynamicBooleanTrack GetRootAsDynamicBooleanTrack(ByteBuffer _bb) { return GetRootAsDynamicBooleanTrack(_bb, new DynamicBooleanTrack()); } + public static DynamicBooleanTrack GetRootAsDynamicBooleanTrack(ByteBuffer _bb, DynamicBooleanTrack obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public DynamicBooleanTrack __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public ushort Values(int j) { int o = __p.__offset(4); return o != 0 ? __p.bb.GetUshort(__p.__vector(o) + j * 2) : (ushort)0; } + public int ValuesLength { get { int o = __p.__offset(4); return o != 0 ? __p.__vector_len(o) : 0; } } +#if ENABLE_SPAN_T + public Span GetValuesBytes() { return __p.__vector_as_span(4); } +#else + public ArraySegment? GetValuesBytes() { return __p.__vector_as_arraysegment(4); } +#endif + public ushort[] GetValuesArray() { return __p.__vector_as_array(4); } + + public static Offset CreateDynamicBooleanTrack(FlatBufferBuilder builder, + VectorOffset ValuesOffset = default(VectorOffset)) + { + builder.StartObject(1); + DynamicBooleanTrack.AddValues(builder, ValuesOffset); + return DynamicBooleanTrack.EndDynamicBooleanTrack(builder); + } + + public static void StartDynamicBooleanTrack(FlatBufferBuilder builder) { builder.StartObject(1); } + public static void AddValues(FlatBufferBuilder builder, VectorOffset ValuesOffset) { builder.AddOffset(0, ValuesOffset.Value, 0); } + public static VectorOffset CreateValuesVector(FlatBufferBuilder builder, ushort[] data) { builder.StartVector(2, data.Length, 2); for (int i = data.Length - 1; i >= 0; i--) builder.AddUshort(data[i]); return builder.EndVector(); } + public static VectorOffset CreateValuesVectorBlock(FlatBufferBuilder builder, ushort[] data) { builder.StartVector(2, data.Length, 2); builder.Add(data); return builder.EndVector(); } + public static void StartValuesVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(2, numElems, 2); } + public static Offset EndDynamicBooleanTrack(FlatBufferBuilder builder) + { + int o = builder.EndObject(); + return new Offset(o); + } + }; + + public struct FramedBooleanTrack : IFlatbufferObject + { + private Table __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public static FramedBooleanTrack GetRootAsFramedBooleanTrack(ByteBuffer _bb) { return GetRootAsFramedBooleanTrack(_bb, new FramedBooleanTrack()); } + public static FramedBooleanTrack GetRootAsFramedBooleanTrack(ByteBuffer _bb, FramedBooleanTrack obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public FramedBooleanTrack __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public ushort Frames(int j) { int o = __p.__offset(4); return o != 0 ? __p.bb.GetUshort(__p.__vector(o) + j * 2) : (ushort)0; } + public int FramesLength { get { int o = __p.__offset(4); return o != 0 ? __p.__vector_len(o) : 0; } } +#if ENABLE_SPAN_T + public Span GetFramesBytes() { return __p.__vector_as_span(4); } +#else + public ArraySegment? GetFramesBytes() { return __p.__vector_as_arraysegment(4); } +#endif + public ushort[] GetFramesArray() { return __p.__vector_as_array(4); } + public ushort Values(int j) { int o = __p.__offset(6); return o != 0 ? __p.bb.GetUshort(__p.__vector(o) + j * 2) : (ushort)0; } + public int ValuesLength { get { int o = __p.__offset(6); return o != 0 ? __p.__vector_len(o) : 0; } } +#if ENABLE_SPAN_T + public Span GetValuesBytes() { return __p.__vector_as_span(6); } +#else + public ArraySegment? GetValuesBytes() { return __p.__vector_as_arraysegment(6); } +#endif + public ushort[] GetValuesArray() { return __p.__vector_as_array(6); } + + public static Offset CreateFramedBooleanTrack(FlatBufferBuilder builder, + VectorOffset FramesOffset = default(VectorOffset), + VectorOffset ValuesOffset = default(VectorOffset)) + { + builder.StartObject(2); + FramedBooleanTrack.AddValues(builder, ValuesOffset); + FramedBooleanTrack.AddFrames(builder, FramesOffset); + return FramedBooleanTrack.EndFramedBooleanTrack(builder); + } + + public static void StartFramedBooleanTrack(FlatBufferBuilder builder) { builder.StartObject(2); } + public static void AddFrames(FlatBufferBuilder builder, VectorOffset FramesOffset) { builder.AddOffset(0, FramesOffset.Value, 0); } + public static VectorOffset CreateFramesVector(FlatBufferBuilder builder, ushort[] data) { builder.StartVector(2, data.Length, 2); for (int i = data.Length - 1; i >= 0; i--) builder.AddUshort(data[i]); return builder.EndVector(); } + public static VectorOffset CreateFramesVectorBlock(FlatBufferBuilder builder, ushort[] data) { builder.StartVector(2, data.Length, 2); builder.Add(data); return builder.EndVector(); } + public static void StartFramesVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(2, numElems, 2); } + public static void AddValues(FlatBufferBuilder builder, VectorOffset ValuesOffset) { builder.AddOffset(1, ValuesOffset.Value, 0); } + public static VectorOffset CreateValuesVector(FlatBufferBuilder builder, ushort[] data) { builder.StartVector(2, data.Length, 2); for (int i = data.Length - 1; i >= 0; i--) builder.AddUshort(data[i]); return builder.EndVector(); } + public static VectorOffset CreateValuesVectorBlock(FlatBufferBuilder builder, ushort[] data) { builder.StartVector(2, data.Length, 2); builder.Add(data); return builder.EndVector(); } + public static void StartValuesVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(2, numElems, 2); } + public static Offset EndFramedBooleanTrack(FlatBufferBuilder builder) + { + int o = builder.EndObject(); + return new Offset(o); + } + }; + + public struct FixedValueTrack : IFlatbufferObject + { + private Table __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public static FixedValueTrack GetRootAsFixedValueTrack(ByteBuffer _bb) { return GetRootAsFixedValueTrack(_bb, new FixedValueTrack()); } + public static FixedValueTrack GetRootAsFixedValueTrack(ByteBuffer _bb, FixedValueTrack obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public FixedValueTrack __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public float Value { get { int o = __p.__offset(4); return o != 0 ? __p.bb.GetFloat(o + __p.bb_pos) : (float)0.0f; } } + + public static Offset CreateFixedValueTrack(FlatBufferBuilder builder, + float Value = 0.0f) + { + builder.StartObject(1); + FixedValueTrack.AddValue(builder, Value); + return FixedValueTrack.EndFixedValueTrack(builder); + } + + public static void StartFixedValueTrack(FlatBufferBuilder builder) { builder.StartObject(1); } + public static void AddValue(FlatBufferBuilder builder, float Value) { builder.AddFloat(0, Value, 0.0f); } + public static Offset EndFixedValueTrack(FlatBufferBuilder builder) + { + int o = builder.EndObject(); + return new Offset(o); + } + }; + + public struct DynamicValueTrack : IFlatbufferObject + { + private Table __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public static DynamicValueTrack GetRootAsDynamicValueTrack(ByteBuffer _bb) { return GetRootAsDynamicValueTrack(_bb, new DynamicValueTrack()); } + public static DynamicValueTrack GetRootAsDynamicValueTrack(ByteBuffer _bb, DynamicValueTrack obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public DynamicValueTrack __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public float Values(int j) { int o = __p.__offset(4); return o != 0 ? __p.bb.GetFloat(__p.__vector(o) + j * 4) : (float)0; } + public int ValuesLength { get { int o = __p.__offset(4); return o != 0 ? __p.__vector_len(o) : 0; } } +#if ENABLE_SPAN_T + public Span GetValuesBytes() { return __p.__vector_as_span(4); } +#else + public ArraySegment? GetValuesBytes() { return __p.__vector_as_arraysegment(4); } +#endif + public float[] GetValuesArray() { return __p.__vector_as_array(4); } + + public static Offset CreateDynamicValueTrack(FlatBufferBuilder builder, + VectorOffset ValuesOffset = default(VectorOffset)) + { + builder.StartObject(1); + DynamicValueTrack.AddValues(builder, ValuesOffset); + return DynamicValueTrack.EndDynamicValueTrack(builder); + } + + public static void StartDynamicValueTrack(FlatBufferBuilder builder) { builder.StartObject(1); } + public static void AddValues(FlatBufferBuilder builder, VectorOffset ValuesOffset) { builder.AddOffset(0, ValuesOffset.Value, 0); } + public static VectorOffset CreateValuesVector(FlatBufferBuilder builder, float[] data) { builder.StartVector(4, data.Length, 4); for (int i = data.Length - 1; i >= 0; i--) builder.AddFloat(data[i]); return builder.EndVector(); } + public static VectorOffset CreateValuesVectorBlock(FlatBufferBuilder builder, float[] data) { builder.StartVector(4, data.Length, 4); builder.Add(data); return builder.EndVector(); } + public static void StartValuesVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(4, numElems, 4); } + public static Offset EndDynamicValueTrack(FlatBufferBuilder builder) + { + int o = builder.EndObject(); + return new Offset(o); + } + }; + + public struct FramedValueTrack : IFlatbufferObject + { + private Table __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public static FramedValueTrack GetRootAsFramedValueTrack(ByteBuffer _bb) { return GetRootAsFramedValueTrack(_bb, new FramedValueTrack()); } + public static FramedValueTrack GetRootAsFramedValueTrack(ByteBuffer _bb, FramedValueTrack obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public FramedValueTrack __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public ushort Frames(int j) { int o = __p.__offset(4); return o != 0 ? __p.bb.GetUshort(__p.__vector(o) + j * 2) : (ushort)0; } + public int FramesLength { get { int o = __p.__offset(4); return o != 0 ? __p.__vector_len(o) : 0; } } +#if ENABLE_SPAN_T + public Span GetFramesBytes() { return __p.__vector_as_span(4); } +#else + public ArraySegment? GetFramesBytes() { return __p.__vector_as_arraysegment(4); } +#endif + public ushort[] GetFramesArray() { return __p.__vector_as_array(4); } + public float Values(int j) { int o = __p.__offset(6); return o != 0 ? __p.bb.GetFloat(__p.__vector(o) + j * 4) : (float)0; } + public int ValuesLength { get { int o = __p.__offset(6); return o != 0 ? __p.__vector_len(o) : 0; } } +#if ENABLE_SPAN_T + public Span GetValuesBytes() { return __p.__vector_as_span(6); } +#else + public ArraySegment? GetValuesBytes() { return __p.__vector_as_arraysegment(6); } +#endif + public float[] GetValuesArray() { return __p.__vector_as_array(6); } + + public static Offset CreateFramedValueTrack(FlatBufferBuilder builder, + VectorOffset FramesOffset = default(VectorOffset), + VectorOffset ValuesOffset = default(VectorOffset)) + { + builder.StartObject(2); + FramedValueTrack.AddValues(builder, ValuesOffset); + FramedValueTrack.AddFrames(builder, FramesOffset); + return FramedValueTrack.EndFramedValueTrack(builder); + } + + public static void StartFramedValueTrack(FlatBufferBuilder builder) { builder.StartObject(2); } + public static void AddFrames(FlatBufferBuilder builder, VectorOffset FramesOffset) { builder.AddOffset(0, FramesOffset.Value, 0); } + public static VectorOffset CreateFramesVector(FlatBufferBuilder builder, ushort[] data) { builder.StartVector(2, data.Length, 2); for (int i = data.Length - 1; i >= 0; i--) builder.AddUshort(data[i]); return builder.EndVector(); } + public static VectorOffset CreateFramesVectorBlock(FlatBufferBuilder builder, ushort[] data) { builder.StartVector(2, data.Length, 2); builder.Add(data); return builder.EndVector(); } + public static void StartFramesVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(2, numElems, 2); } + public static void AddValues(FlatBufferBuilder builder, VectorOffset ValuesOffset) { builder.AddOffset(1, ValuesOffset.Value, 0); } + public static VectorOffset CreateValuesVector(FlatBufferBuilder builder, float[] data) { builder.StartVector(4, data.Length, 4); for (int i = data.Length - 1; i >= 0; i--) builder.AddFloat(data[i]); return builder.EndVector(); } + public static VectorOffset CreateValuesVectorBlock(FlatBufferBuilder builder, float[] data) { builder.StartVector(4, data.Length, 4); builder.Add(data); return builder.EndVector(); } + public static void StartValuesVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(4, numElems, 4); } + public static Offset EndFramedValueTrack(FlatBufferBuilder builder) + { + int o = builder.EndObject(); + return new Offset(o); + } + }; + + public struct FrameRanges : IFlatbufferObject + { + private Table __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public static FrameRanges GetRootAsFrameRanges(ByteBuffer _bb) { return GetRootAsFrameRanges(_bb, new FrameRanges()); } + public static FrameRanges GetRootAsFrameRanges(ByteBuffer _bb, FrameRanges obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public FrameRanges __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public ushort StartFrames(int j) { int o = __p.__offset(4); return o != 0 ? __p.bb.GetUshort(__p.__vector(o) + j * 2) : (ushort)0; } + public int StartFramesLength { get { int o = __p.__offset(4); return o != 0 ? __p.__vector_len(o) : 0; } } +#if ENABLE_SPAN_T + public Span GetStartFramesBytes() { return __p.__vector_as_span(4); } +#else + public ArraySegment? GetStartFramesBytes() { return __p.__vector_as_arraysegment(4); } +#endif + public ushort[] GetStartFramesArray() { return __p.__vector_as_array(4); } + public ushort EndFrames(int j) { int o = __p.__offset(6); return o != 0 ? __p.bb.GetUshort(__p.__vector(o) + j * 2) : (ushort)0; } + public int EndFramesLength { get { int o = __p.__offset(6); return o != 0 ? __p.__vector_len(o) : 0; } } +#if ENABLE_SPAN_T + public Span GetEndFramesBytes() { return __p.__vector_as_span(6); } +#else + public ArraySegment? GetEndFramesBytes() { return __p.__vector_as_arraysegment(6); } +#endif + public ushort[] GetEndFramesArray() { return __p.__vector_as_array(6); } + + public static Offset CreateFrameRanges(FlatBufferBuilder builder, + VectorOffset StartFramesOffset = default(VectorOffset), + VectorOffset EndFramesOffset = default(VectorOffset)) + { + builder.StartObject(2); + FrameRanges.AddEndFrames(builder, EndFramesOffset); + FrameRanges.AddStartFrames(builder, StartFramesOffset); + return FrameRanges.EndFrameRanges(builder); + } + + public static void StartFrameRanges(FlatBufferBuilder builder) { builder.StartObject(2); } + public static void AddStartFrames(FlatBufferBuilder builder, VectorOffset StartFramesOffset) { builder.AddOffset(0, StartFramesOffset.Value, 0); } + public static VectorOffset CreateStartFramesVector(FlatBufferBuilder builder, ushort[] data) { builder.StartVector(2, data.Length, 2); for (int i = data.Length - 1; i >= 0; i--) builder.AddUshort(data[i]); return builder.EndVector(); } + public static VectorOffset CreateStartFramesVectorBlock(FlatBufferBuilder builder, ushort[] data) { builder.StartVector(2, data.Length, 2); builder.Add(data); return builder.EndVector(); } + public static void StartStartFramesVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(2, numElems, 2); } + public static void AddEndFrames(FlatBufferBuilder builder, VectorOffset EndFramesOffset) { builder.AddOffset(1, EndFramesOffset.Value, 0); } + public static VectorOffset CreateEndFramesVector(FlatBufferBuilder builder, ushort[] data) { builder.StartVector(2, data.Length, 2); for (int i = data.Length - 1; i >= 0; i--) builder.AddUshort(data[i]); return builder.EndVector(); } + public static VectorOffset CreateEndFramesVectorBlock(FlatBufferBuilder builder, ushort[] data) { builder.StartVector(2, data.Length, 2); builder.Add(data); return builder.EndVector(); } + public static void StartEndFramesVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(2, numElems, 2); } + public static Offset EndFrameRanges(FlatBufferBuilder builder) + { + int o = builder.EndObject(); + return new Offset(o); + } + }; + + public struct Vector3 : IFlatbufferObject + { + private Struct __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public Vector3 __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public float X { get { return __p.bb.GetFloat(__p.bb_pos + 0); } } + public float Y { get { return __p.bb.GetFloat(__p.bb_pos + 4); } } + public float Z { get { return __p.bb.GetFloat(__p.bb_pos + 8); } } + + public static Offset CreateVector3(FlatBufferBuilder builder, float X, float Y, float Z) + { + builder.Prep(4, 12); + builder.PutFloat(Z); + builder.PutFloat(Y); + builder.PutFloat(X); + return new Offset(builder.Offset); + } + }; + + public struct Vector4 : IFlatbufferObject + { + private Struct __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public Vector4 __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public float X { get { return __p.bb.GetFloat(__p.bb_pos + 0); } } + public float Y { get { return __p.bb.GetFloat(__p.bb_pos + 4); } } + public float Z { get { return __p.bb.GetFloat(__p.bb_pos + 8); } } + public float W { get { return __p.bb.GetFloat(__p.bb_pos + 12); } } + + public static Offset CreateVector4(FlatBufferBuilder builder, float X, float Y, float Z, float W) + { + builder.Prep(4, 16); + builder.PutFloat(W); + builder.PutFloat(Z); + builder.PutFloat(Y); + builder.PutFloat(X); + return new Offset(builder.Offset); + } + }; + + public struct Quaternion : IFlatbufferObject + { + private Struct __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public Quaternion __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public ushort X { get { return __p.bb.GetUshort(__p.bb_pos + 0); } } + public ushort Y { get { return __p.bb.GetUshort(__p.bb_pos + 2); } } + public ushort Z { get { return __p.bb.GetUshort(__p.bb_pos + 4); } } + + public static Offset CreateQuaternion(FlatBufferBuilder builder, ushort X, ushort Y, ushort Z) + { + builder.Prep(2, 6); + builder.PutUshort(Z); + builder.PutUshort(Y); + builder.PutUshort(X); + return new Offset(builder.Offset); + } + }; + + public struct SRT : IFlatbufferObject + { + private Struct __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public SRT __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public float ScaleX { get { return __p.bb.GetFloat(__p.bb_pos + 0); } } + public float ScaleY { get { return __p.bb.GetFloat(__p.bb_pos + 4); } } + public float ScaleZ { get { return __p.bb.GetFloat(__p.bb_pos + 8); } } + public float RotateX { get { return __p.bb.GetFloat(__p.bb_pos + 12); } } + public float RotateY { get { return __p.bb.GetFloat(__p.bb_pos + 16); } } + public float RotateZ { get { return __p.bb.GetFloat(__p.bb_pos + 20); } } + public float RotateW { get { return __p.bb.GetFloat(__p.bb_pos + 24); } } + public float TranslateX { get { return __p.bb.GetFloat(__p.bb_pos + 28); } } + public float TranslateY { get { return __p.bb.GetFloat(__p.bb_pos + 32); } } + public float TranslateZ { get { return __p.bb.GetFloat(__p.bb_pos + 36); } } + + public static Offset CreateSRT(FlatBufferBuilder builder, float ScaleX, float ScaleY, float ScaleZ, float RotateX, float RotateY, float RotateZ, float RotateW, float TranslateX, float TranslateY, float TranslateZ) + { + builder.Prep(4, 40); + builder.PutFloat(TranslateZ); + builder.PutFloat(TranslateY); + builder.PutFloat(TranslateX); + builder.PutFloat(RotateW); + builder.PutFloat(RotateZ); + builder.PutFloat(RotateY); + builder.PutFloat(RotateX); + builder.PutFloat(ScaleZ); + builder.PutFloat(ScaleY); + builder.PutFloat(ScaleX); + return new Offset(builder.Offset); + } + }; + + +} diff --git a/File_Format_Library/FileFormats/Pokemon/GFBANIM/GFBANM.cs b/File_Format_Library/FileFormats/Pokemon/GFBANIM/GFBANM.cs index 9234e5cd..814f28f5 100644 --- a/File_Format_Library/FileFormats/Pokemon/GFBANIM/GFBANM.cs +++ b/File_Format_Library/FileFormats/Pokemon/GFBANIM/GFBANM.cs @@ -9,11 +9,16 @@ using Toolbox.Library; using Toolbox.Library.IO; using OpenTK; using System.Reflection; +using Toolbox.Library.IO.FlatBuffer; +using Toolbox.Library.Animations; +using FirstPlugin.Forms; namespace FirstPlugin { - public class GFBANM : IFileFormat + public class GFBANM : TreeNodeFile, IFileFormat, IAnimationContainer { + public STAnimation AnimationController => AnimationData; + public FileType FileType { get; set; } = FileType.Model; public bool CanSave { get; set; } @@ -28,6 +33,17 @@ namespace FirstPlugin return Utils.GetExtension(FileName) == ".gfbanm"; } + public override void OnClick(TreeView treeView) + { + ViewportEditor editor = (ViewportEditor)LibraryGUI.GetActiveContent(typeof(ViewportEditor)); + if (editor == null) + { + editor = new ViewportEditor(true); + editor.Dock = DockStyle.Fill; + LibraryGUI.LoadEditor(editor); + } + } + public Type[] Types { get @@ -37,12 +53,31 @@ namespace FirstPlugin } } - Header header; + Animation AnimationData; public void Load(System.IO.Stream stream) { - using (var reader = new FileReader(stream)) - { - header = new Header(reader); + Text = FileName; + Gfbanim.Animation anim = Gfbanim.Animation.GetRootAsAnimation( + new FlatBuffers.ByteBuffer(stream.ToBytes())); + + AnimationData = new Animation(); + AnimationData.FrameCount = anim.AnimConfig.Value.KeyFrames; + + if (anim.Bones.HasValue) { + for (int i = 0; i < anim.Bones.Value.BonesLength; i++) + AnimationData.LoadBoneGroup(anim.Bones.Value.Bones(i).Value); + } + if (anim.Materials.HasValue) { + for (int i = 0; i < anim.Materials.Value.MaterialsLength; i++) + AnimationData.LoadMaterialGroup(anim.Materials.Value.Materials(i).Value); + } + if (anim.Groups.HasValue) { + for (int i = 0; i < anim.Groups.Value.GroupsLength; i++) + AnimationData.LoadVisibilyGroup(anim.Groups.Value.Groups(i).Value); + } + if (anim.Triggers.HasValue) { + for (int i = 0; i < anim.Triggers.Value.TriggersLength; i++) + AnimationData.LoadTriggerGroup(anim.Triggers.Value.Triggers(i).Value); } } @@ -55,199 +90,426 @@ namespace FirstPlugin { } - public class Header + public class Animation : STSkeletonAnimation { - public Config config; - public BoneList boneList; - - public Header(FileReader reader) + public override void NextFrame() { - config = ParseSection(reader, this); - boneList = ParseSection(reader, this); + if (Frame > FrameCount) return; - Console.WriteLine($"config NumKeyFrames {config.NumKeyFrames}"); - Console.WriteLine($"config FramesPerSecond {config.FramesPerSecond}"); - } - } + var skeleton = GetActiveSkeleton(); + if (skeleton == null) return; - private static T ParseSection(FileReader reader, Header header) - where T : GFSection, new() - { - var offset = reader.ReadOffset(true, typeof(uint)); - reader.SeekBegin(offset); + if (Frame == 0) + skeleton.reset(); - long origin = reader.Position; - - int layoutOffset = reader.ReadInt32(); - var dataOffset = reader.ReadOffset(true, typeof(uint)); - - T section = new T(); - using (reader.TemporarySeek(origin - layoutOffset, System.IO.SeekOrigin.Begin)) - { - ushort layoutSize = reader.ReadUInt16(); - ushort layoutStride = reader.ReadUInt16(); - - List pointers = new List(); - uint looper = 4; - while (looper < layoutSize) { - pointers.Add(reader.ReadUInt16()); - looper += 2; - } - - section.LayoutPointers = reader.ReadUInt16s((int)(layoutSize / 4)); - } - - using (reader.TemporarySeek(dataOffset, System.IO.SeekOrigin.Begin)) { - section.Read(reader, header); - } - - return section; - } - - public class GFSection - { - public ushort LayoutSize { get; set; } - public ushort LayoutStride { get; set; } - - public ushort[] LayoutPointers { get; set; } - - public void Read(FileReader reader, Header header) - { - long origin = reader.Position; - - PropertyInfo[] types = new PropertyInfo[(int)LayoutPointers?.Length]; - - var sectionType = this.GetType(); - - int index = 0; - foreach (var prop in sectionType.GetProperties()) { - if (!Attribute.IsDefined(prop, typeof(FlatTableParse))) - continue; - - types[index++] = prop; - } - - for (int i = 0; i < LayoutPointers?.Length; i++) + bool Updated = false; // no need to update skeleton of animations that didn't change + foreach (var animGroup in AnimGroups) { - reader.SeekBegin(origin + LayoutPointers[i]); - if (types[i] != null) + if (animGroup is BoneGroup) { - var prop = types[i]; - var propertyType = prop.PropertyType; + var node = animGroup as BoneGroup; - if (propertyType == typeof(uint)) - prop.SetValue(this, reader.ReadUInt32()); - else if (propertyType == typeof(int)) - prop.SetValue(this, reader.ReadInt32()); - else if(propertyType == typeof(byte)) - prop.SetValue(this, reader.ReadByte()); - else if(propertyType == typeof(sbyte)) - prop.SetValue(this, reader.ReadSByte()); - else if (propertyType == typeof(ushort)) - prop.SetValue(this, reader.ReadUInt16()); - else if (propertyType == typeof(short)) - prop.SetValue(this, reader.ReadInt16()); - else if (propertyType == typeof(Vector2)) - prop.SetValue(this, new Vector2( - reader.ReadSingle(), - reader.ReadSingle()) - ); - else if (propertyType == typeof(Vector3)) - prop.SetValue(this, new Vector3( - reader.ReadSingle(), - reader.ReadSingle(), - reader.ReadSingle()) - ); - else if (propertyType == typeof(Vector4)) - prop.SetValue(this, new Vector4( - reader.ReadSingle(), - reader.ReadSingle(), - reader.ReadSingle(), - reader.ReadSingle()) - ); - else if (propertyType == typeof(GFSection)) + STBone b = null; + b = skeleton.GetBone(node.Name); + if (b == null) continue; + + Updated = true; + + if (node.TranslateX.HasKeys) + b.pos.X = node.TranslateX.GetFrameValue(Frame); + if (node.TranslateY.HasKeys) + b.pos.Y = node.TranslateY.GetFrameValue(Frame); + if (node.TranslateZ.HasKeys) + b.pos.Z = node.TranslateZ.GetFrameValue(Frame); + + if (node.ScaleX.HasKeys) + b.sca.X = node.ScaleX.GetFrameValue(Frame); + else b.sca.X = 1; + if (node.ScaleY.HasKeys) + b.sca.Y = node.ScaleY.GetFrameValue(Frame); + else b.sca.Y = 1; + if (node.ScaleZ.HasKeys) + b.sca.Z = node.ScaleZ.GetFrameValue(Frame); + else b.sca.Z = 1; + + if (node.RotationX.HasKeys || node.RotationY.HasKeys || node.RotationZ.HasKeys) { - var offset = reader.ReadOffset(true, typeof(uint)); - reader.SeekBegin(offset); - } - else if (propertyType is IEnumerable) { + float x = node.RotationX.HasKeys ? node.RotationX.GetFrameValue(Frame) : b.rotation[0]; + float y = node.RotationY.HasKeys ? node.RotationY.GetFrameValue(Frame) : b.rotation[1]; + float z = node.RotationZ.HasKeys ? node.RotationZ.GetFrameValue(Frame) : b.rotation[2]; + var Rotation = new Vector3(x / 0xffff, y/ 0xffff, z / 0xffff).Normalized(); + b.rot = EulerToQuat(Rotation.Z, Rotation.Y, Rotation.X); + + // b.rot = EulerToQuat(Rotation.Z, Rotation.Y, Rotation.X); + + float Angle = Rotation.Length; + Console.WriteLine($"{node.Name} Angle {Angle}"); + + // b.rot = Angle > 0 + // ? Quaternion.FromAxisAngle(Vector3.Normalize(Rotation), Angle) + // : Quaternion.Identity; + } + else + { + b.rot = EulerToQuat(b.rotation[2], b.rotation[1], b.rotation[0]); } } } + + if (Updated) + { + skeleton.update(); + } + } + + public static Quaternion EulerToQuat(float z, float y, float x) + { + Quaternion xRotation = Quaternion.FromAxisAngle(Vector3.UnitX, x); + Quaternion yRotation = Quaternion.FromAxisAngle(Vector3.UnitY, y); + Quaternion zRotation = Quaternion.FromAxisAngle(Vector3.UnitZ, z); + return (zRotation * yRotation * xRotation); + } + + public void LoadBoneGroup(Gfbanim.Bone boneAnim) + { + BoneGroup groupAnim = new BoneGroup(); + groupAnim.Name = boneAnim.Name; + AnimGroups.Add(groupAnim); + + //Tracks use 3 types + // Fixed/constant + // Dynamic (baked and multiple keys, no frames) + // Framed (multiple keys and frames) + + List Frames = new List(); + + Console.WriteLine($"BoneGroup {groupAnim.Name }"); + + switch (boneAnim.RotateType) + { + case Gfbanim.QuatTrack.DynamicQuatTrack: + { + var rotate = boneAnim.Rotate(); + if (rotate.HasValue) + { + var values = LoadRotationTrack(rotate.Value); + groupAnim.RotationX = values[0]; + groupAnim.RotationY = values[1]; + groupAnim.RotationZ = values[2]; + } + } + break; + case Gfbanim.QuatTrack.FixedQuatTrack: + { + var rotate = boneAnim.Rotate(); + if (rotate.HasValue) + { + var vec = rotate.Value.Value.Value; + groupAnim.RotationX.KeyFrames.Add(new STKeyFrame(0, ConvertRotation(vec.X))); + groupAnim.RotationY.KeyFrames.Add(new STKeyFrame(0, ConvertRotation(vec.Y))); + groupAnim.RotationZ.KeyFrames.Add(new STKeyFrame(0, ConvertRotation(vec.Z))); + } + } + break; + case Gfbanim.QuatTrack.FramedQuatTrack: + { + var rotate = boneAnim.Rotate(); + if (rotate.HasValue) + { + var values = LoadRotationTrack(rotate.Value); + groupAnim.RotationX = values[0]; + groupAnim.RotationY = values[1]; + groupAnim.RotationZ = values[2]; + } + } + break; + } + switch (boneAnim.ScaleType) + { + case Gfbanim.VectorTrack.FixedVectorTrack: + { + var scale = boneAnim.Scale(); + if (scale.HasValue) + { + var vec = scale.Value.Value.Value; + groupAnim.ScaleX.KeyFrames.Add(new STKeyFrame(0, vec.X)); + groupAnim.ScaleY.KeyFrames.Add(new STKeyFrame(0, vec.Y)); + groupAnim.ScaleZ.KeyFrames.Add(new STKeyFrame(0, vec.Z)); + } + } + break; + } + switch (boneAnim.ScaleType) + { + case Gfbanim.VectorTrack.DynamicVectorTrack: + { + var scale = boneAnim.Scale(); + if (scale.HasValue) + { + var values = LoadVectorTrack(scale.Value); + groupAnim.ScaleX = values[0]; + groupAnim.ScaleY = values[1]; + groupAnim.ScaleZ = values[2]; + } + } + break; + case Gfbanim.VectorTrack.FramedVectorTrack: + { + var scale = boneAnim.Scale(); + if (scale.HasValue) + { + var values = LoadVectorTrack(scale.Value); + groupAnim.ScaleX = values[0]; + groupAnim.ScaleY = values[1]; + groupAnim.ScaleZ = values[2]; + } + } + break; + case Gfbanim.VectorTrack.FixedVectorTrack: + { + var scale = boneAnim.Scale(); + if (scale.HasValue) + { + var vec = scale.Value.Value.Value; + groupAnim.ScaleX.KeyFrames.Add(new STKeyFrame(0, vec.X)); + groupAnim.ScaleY.KeyFrames.Add(new STKeyFrame(0, vec.Y)); + groupAnim.ScaleZ.KeyFrames.Add(new STKeyFrame(0, vec.Z)); + } + } + break; + } + switch (boneAnim.TranslateType) + { + case Gfbanim.VectorTrack.DynamicVectorTrack: + { + var trans = boneAnim.Translate(); + if (trans.HasValue) + { + var values = LoadVectorTrack(trans.Value); + groupAnim.TranslateX = values[0]; + groupAnim.TranslateY = values[1]; + groupAnim.TranslateZ = values[2]; + } + } + break; + case Gfbanim.VectorTrack.FramedVectorTrack: + { + var trans = boneAnim.Translate(); + if (trans.HasValue) + { + var values = LoadVectorTrack(trans.Value); + groupAnim.TranslateX = values[0]; + groupAnim.TranslateY = values[1]; + groupAnim.TranslateZ = values[2]; + } + } + break; + case Gfbanim.VectorTrack.FixedVectorTrack: + { + var trans = boneAnim.Translate(); + if (trans.HasValue) + { + var vec = trans.Value.Value.Value; + groupAnim.TranslateX.KeyFrames.Add(new STKeyFrame(0, vec.X)); + groupAnim.TranslateY.KeyFrames.Add(new STKeyFrame(0, vec.Y)); + groupAnim.TranslateZ.KeyFrames.Add(new STKeyFrame(0, vec.Z)); + } + } + break; + } + } + + public float ConvertRotation(ushort val) + { + return val; + } + + public STAnimationTrack[] LoadRotationTrack(Gfbanim.DynamicQuatTrack dynamicTrack) + { + STAnimationTrack[] tracks = new STAnimationTrack[3]; + tracks[0] = new STAnimationTrack(STInterpoaltionType.Linear); + tracks[1] = new STAnimationTrack(STInterpoaltionType.Linear); + tracks[2] = new STAnimationTrack(STInterpoaltionType.Linear); + + for (int i = 0; i < dynamicTrack.ValuesLength; i++) + { + var quat = dynamicTrack.Values(i).Value; + tracks[0].KeyFrames.Add(new STKeyFrame(i, ConvertRotation(quat.X))); + tracks[1].KeyFrames.Add(new STKeyFrame(i, ConvertRotation(quat.Y))); + tracks[2].KeyFrames.Add(new STKeyFrame(i, ConvertRotation(quat.Z))); + + Console.WriteLine($"{i} { ConvertRotation(quat.X)} { ConvertRotation(quat.Y)} {ConvertRotation(quat.Z)}"); + } + return tracks; + } + + public STAnimationTrack[] LoadVectorTrack(Gfbanim.DynamicVectorTrack dynamicTrack) + { + STAnimationTrack[] tracks = new STAnimationTrack[3]; + tracks[0] = new STAnimationTrack(STInterpoaltionType.Linear); + tracks[1] = new STAnimationTrack(STInterpoaltionType.Linear); + tracks[2] = new STAnimationTrack(STInterpoaltionType.Linear); + + for (int i = 0; i < dynamicTrack.ValuesLength; i++) + { + var vec = dynamicTrack.Values(i).Value; + tracks[0].KeyFrames.Add(new STKeyFrame(i, vec.X)); + tracks[1].KeyFrames.Add(new STKeyFrame(i, vec.Y)); + tracks[2].KeyFrames.Add(new STKeyFrame(i, vec.Z)); + } + return tracks; + } + + public STAnimationTrack[] LoadVectorTrack(Gfbanim.FramedVectorTrack framedTrack) + { + ushort[] frames = framedTrack.GetFramesArray(); + + STAnimationTrack[] tracks = new STAnimationTrack[3]; + tracks[0] = new STAnimationTrack(STInterpoaltionType.Linear); + tracks[1] = new STAnimationTrack(STInterpoaltionType.Linear); + tracks[2] = new STAnimationTrack(STInterpoaltionType.Linear); + + for (int i = 0; i < framedTrack.ValuesLength; i++) + { + var vec = framedTrack.Values(i).Value; + int frame = i; + + if (i < frames?.Length) frame = frames[i]; + + tracks[0].KeyFrames.Add(new STKeyFrame(frame, vec.X)); + tracks[1].KeyFrames.Add(new STKeyFrame(frame, vec.Y)); + tracks[2].KeyFrames.Add(new STKeyFrame(frame, vec.Z)); + } + return tracks; + } + + public STAnimationTrack[] LoadRotationTrack(Gfbanim.FramedQuatTrack framedTrack) + { + ushort[] frames = framedTrack.GetFramesArray(); + + STAnimationTrack[] tracks = new STAnimationTrack[3]; + tracks[0] = new STAnimationTrack(STInterpoaltionType.Linear); + tracks[1] = new STAnimationTrack(STInterpoaltionType.Linear); + tracks[2] = new STAnimationTrack(STInterpoaltionType.Linear); + + for (int i = 0; i < framedTrack.ValuesLength; i++) + { + var quat = framedTrack.Values(i).Value; + int frame = i; + + if (i < frames?.Length) frame = frames[i]; + + tracks[0].KeyFrames.Add(new STKeyFrame(frame, ConvertRotation(quat.X))); + tracks[1].KeyFrames.Add(new STKeyFrame(frame, ConvertRotation(quat.Y))); + tracks[2].KeyFrames.Add(new STKeyFrame(frame, ConvertRotation(quat.Z))); + } + return tracks; + } + + public void LoadMaterialGroup(Gfbanim.Material matAnim) + { + + } + + public void LoadVisibilyGroup(Gfbanim.Group visAnim) + { + + } + + public void LoadTriggerGroup(Gfbanim.Trigger triggerAnim) + { + + } + + private STAnimationTrack LoadTrack(float[] Frames, float[] Values) + { + STAnimationTrack track = new STAnimationTrack(); + track.InterpolationType = STInterpoaltionType.Linear; + for (int i = 0; i < Values?.Length; i++) + { + STKeyFrame keyFrame = new STKeyFrame(); + keyFrame.Value = Values[i]; + keyFrame.Value = Frames[i]; + track.KeyFrames.Add(keyFrame); + } + return track; } } - public class FlatTableParse : Attribute { } - public class OffsetProperty : Attribute { } - - [OffsetProperty] - public class Config : GFSection + public class BoneGroup : STAnimGroup { - [FlatTableParse] - public int Unknown { get; set; } - [FlatTableParse] - public uint NumKeyFrames { get; set; } - [FlatTableParse] - public uint FramesPerSecond { get; set; } + public STAnimationTrack TranslateX = new STAnimationTrack(); + public STAnimationTrack TranslateY = new STAnimationTrack(); + public STAnimationTrack TranslateZ = new STAnimationTrack(); + + public STAnimationTrack RotationX = new STAnimationTrack(); + public STAnimationTrack RotationY = new STAnimationTrack(); + public STAnimationTrack RotationZ = new STAnimationTrack(); + public STAnimationTrack RotationW = new STAnimationTrack(); + + public STAnimationTrack ScaleX = new STAnimationTrack(); + public STAnimationTrack ScaleY = new STAnimationTrack(); + public STAnimationTrack ScaleZ = new STAnimationTrack(); + + public override List GetTracks() + { + List anims = new List(); + anims.Add(TranslateX); anims.Add(TranslateY); anims.Add(TranslateZ); + anims.Add(RotationX); anims.Add(RotationY); anims.Add(RotationZ); + anims.Add(ScaleX); anims.Add(ScaleY); anims.Add(ScaleZ); + return anims; + } } - [OffsetProperty] - public class BoneList : GFSection + public class MaterialGroup : STAnimGroup { - [FlatTableParse] - public List Bones = new List(); - [FlatTableParse] - public List BoneDefaults = new List(); } - public class Bone + public class MaterialSwitchGroup : STAnimGroup { - [FlatTableParse, OffsetProperty] - public string Name { get; set; } + public STAnimationTrack SwitchTrack = new STAnimationTrack(); - [FlatTableParse] - public byte ScaleType { get; set; } + public override List GetTracks() { + return new List() { SwitchTrack }; + } } - public class NammeOffset + public class MaterialValueGroup : STAnimGroup { - [FlatTableParse, OffsetProperty] - public string Name { get; set; } + public STAnimationTrack ValueTrack = new STAnimationTrack(); - [FlatTableParse] - public byte ScaleType { get; set; } + public override List GetTracks() { + return new List() { ValueTrack }; + } } - public class BoneDefaults + public class MaterialVectorGroup : STAnimGroup { - public int Unknown { get; set; } + public STAnimationTrack VectorX = new STAnimationTrack(); + public STAnimationTrack VectorY = new STAnimationTrack(); + public STAnimationTrack VectorZ = new STAnimationTrack(); - public Vector3 Scale { get; set; } - public Vector4 Rotation { get; set; } - public Vector3 Translation { get; set; } + public override List GetTracks() + { + return new List() + { VectorX, VectorY, VectorZ }; + } } - public class TriggerList + public class VisibiltyGroup : STAnimGroup { - public List Triggers = new List(); + public STAnimationTrack BooleanTrack = new STAnimationTrack(); + + public override List GetTracks() { + return new List() { BooleanTrack }; + } } - public class Trigger + public class TriggerGroup : STAnimGroup { - public string Name { get; set; } - public int StartFrame { get; set; } - public int EndFrame { get; set; } - } - public class TriggerParameter - { - public string Name { get; set; } - public byte Type { get; set; } - - //float, byte, int, string - public object Value { get; set; } } } } diff --git a/File_Format_Library/FileFormats/Pokemon/GFBANMCFG/FlatBuffers/gfbanmcfg.cs b/File_Format_Library/FileFormats/Pokemon/GFBANMCFG/FlatBuffers/gfbanmcfg.cs new file mode 100644 index 00000000..97a3ba25 --- /dev/null +++ b/File_Format_Library/FileFormats/Pokemon/GFBANMCFG/FlatBuffers/gfbanmcfg.cs @@ -0,0 +1,448 @@ +// +// automatically generated by the FlatBuffers compiler, do not modify +// + +namespace FlatBuffers.Gfbanmcfg +{ + + using global::System; + using global::FlatBuffers; + + public struct AnimationConfig : IFlatbufferObject + { + private Table __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public static AnimationConfig GetRootAsAnimationConfig(ByteBuffer _bb) { return GetRootAsAnimationConfig(_bb, new AnimationConfig()); } + public static AnimationConfig GetRootAsAnimationConfig(ByteBuffer _bb, AnimationConfig obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public AnimationConfig __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public PartList? Parts { get { int o = __p.__offset(4); return o != 0 ? (PartList?)(new PartList()).__assign(__p.__indirect(o + __p.bb_pos), __p.bb) : null; } } + public FloatingList? FloatList { get { int o = __p.__offset(6); return o != 0 ? (FloatingList?)(new FloatingList()).__assign(__p.__indirect(o + __p.bb_pos), __p.bb) : null; } } + public int Unkown { get { int o = __p.__offset(8); return o != 0 ? __p.bb.GetInt(o + __p.bb_pos) : (int)0; } } + public int Unkown2 { get { int o = __p.__offset(10); return o != 0 ? __p.bb.GetInt(o + __p.bb_pos) : (int)0; } } + public StateList? States { get { int o = __p.__offset(12); return o != 0 ? (StateList?)(new StateList()).__assign(__p.__indirect(o + __p.bb_pos), __p.bb) : null; } } + public Initial? Initial { get { int o = __p.__offset(14); return o != 0 ? (Initial?)(new Initial()).__assign(__p.__indirect(o + __p.bb_pos), __p.bb) : null; } } + public AnimationList? Animations { get { int o = __p.__offset(16); return o != 0 ? (AnimationList?)(new AnimationList()).__assign(__p.__indirect(o + __p.bb_pos), __p.bb) : null; } } + + public static Offset CreateAnimationConfig(FlatBufferBuilder builder, + Offset PartsOffset = default(Offset), + Offset FloatListOffset = default(Offset), + int Unkown = 0, + int Unkown2 = 0, + Offset StatesOffset = default(Offset), + Offset InitialOffset = default(Offset), + Offset AnimationsOffset = default(Offset)) + { + builder.StartObject(7); + AnimationConfig.AddAnimations(builder, AnimationsOffset); + AnimationConfig.AddInitial(builder, InitialOffset); + AnimationConfig.AddStates(builder, StatesOffset); + AnimationConfig.AddUnkown2(builder, Unkown2); + AnimationConfig.AddUnkown(builder, Unkown); + AnimationConfig.AddFloatList(builder, FloatListOffset); + AnimationConfig.AddParts(builder, PartsOffset); + return AnimationConfig.EndAnimationConfig(builder); + } + + public static void StartAnimationConfig(FlatBufferBuilder builder) { builder.StartObject(7); } + public static void AddParts(FlatBufferBuilder builder, Offset PartsOffset) { builder.AddOffset(0, PartsOffset.Value, 0); } + public static void AddFloatList(FlatBufferBuilder builder, Offset FloatListOffset) { builder.AddOffset(1, FloatListOffset.Value, 0); } + public static void AddUnkown(FlatBufferBuilder builder, int Unkown) { builder.AddInt(2, Unkown, 0); } + public static void AddUnkown2(FlatBufferBuilder builder, int Unkown2) { builder.AddInt(3, Unkown2, 0); } + public static void AddStates(FlatBufferBuilder builder, Offset StatesOffset) { builder.AddOffset(4, StatesOffset.Value, 0); } + public static void AddInitial(FlatBufferBuilder builder, Offset InitialOffset) { builder.AddOffset(5, InitialOffset.Value, 0); } + public static void AddAnimations(FlatBufferBuilder builder, Offset AnimationsOffset) { builder.AddOffset(6, AnimationsOffset.Value, 0); } + public static Offset EndAnimationConfig(FlatBufferBuilder builder) + { + int o = builder.EndObject(); + return new Offset(o); + } + public static void FinishAnimationConfigBuffer(FlatBufferBuilder builder, Offset offset) { builder.Finish(offset.Value); } + public static void FinishSizePrefixedAnimationConfigBuffer(FlatBufferBuilder builder, Offset offset) { builder.FinishSizePrefixed(offset.Value); } + }; + + public struct StateList : IFlatbufferObject + { + private Table __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public static StateList GetRootAsStateList(ByteBuffer _bb) { return GetRootAsStateList(_bb, new StateList()); } + public static StateList GetRootAsStateList(ByteBuffer _bb, StateList obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public StateList __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + + public static void StartStateList(FlatBufferBuilder builder) { builder.StartObject(0); } + public static Offset EndStateList(FlatBufferBuilder builder) + { + int o = builder.EndObject(); + return new Offset(o); + } + }; + + public struct Initial : IFlatbufferObject + { + private Table __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public static Initial GetRootAsInitial(ByteBuffer _bb) { return GetRootAsInitial(_bb, new Initial()); } + public static Initial GetRootAsInitial(ByteBuffer _bb, Initial obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public Initial __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + + public static void StartInitial(FlatBufferBuilder builder) { builder.StartObject(0); } + public static Offset EndInitial(FlatBufferBuilder builder) + { + int o = builder.EndObject(); + return new Offset(o); + } + }; + + public struct FloatingList : IFlatbufferObject + { + private Table __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public static FloatingList GetRootAsFloatingList(ByteBuffer _bb) { return GetRootAsFloatingList(_bb, new FloatingList()); } + public static FloatingList GetRootAsFloatingList(ByteBuffer _bb, FloatingList obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public FloatingList __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + + public static void StartFloatingList(FlatBufferBuilder builder) { builder.StartObject(0); } + public static Offset EndFloatingList(FlatBufferBuilder builder) + { + int o = builder.EndObject(); + return new Offset(o); + } + }; + + public struct AnimationList : IFlatbufferObject + { + private Table __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public static AnimationList GetRootAsAnimationList(ByteBuffer _bb) { return GetRootAsAnimationList(_bb, new AnimationList()); } + public static AnimationList GetRootAsAnimationList(ByteBuffer _bb, AnimationList obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public AnimationList __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public AnimationRef? Animations(int j) { int o = __p.__offset(4); return o != 0 ? (AnimationRef?)(new AnimationRef()).__assign(__p.__indirect(__p.__vector(o) + j * 4), __p.bb) : null; } + public int AnimationsLength { get { int o = __p.__offset(4); return o != 0 ? __p.__vector_len(o) : 0; } } + + public static Offset CreateAnimationList(FlatBufferBuilder builder, + VectorOffset AnimationsOffset = default(VectorOffset)) + { + builder.StartObject(1); + AnimationList.AddAnimations(builder, AnimationsOffset); + return AnimationList.EndAnimationList(builder); + } + + public static void StartAnimationList(FlatBufferBuilder builder) { builder.StartObject(1); } + public static void AddAnimations(FlatBufferBuilder builder, VectorOffset AnimationsOffset) { builder.AddOffset(0, AnimationsOffset.Value, 0); } + public static VectorOffset CreateAnimationsVector(FlatBufferBuilder builder, Offset[] data) { builder.StartVector(4, data.Length, 4); for (int i = data.Length - 1; i >= 0; i--) builder.AddOffset(data[i].Value); return builder.EndVector(); } + public static VectorOffset CreateAnimationsVectorBlock(FlatBufferBuilder builder, Offset[] data) { builder.StartVector(4, data.Length, 4); builder.Add(data); return builder.EndVector(); } + public static void StartAnimationsVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(4, numElems, 4); } + public static Offset EndAnimationList(FlatBufferBuilder builder) + { + int o = builder.EndObject(); + return new Offset(o); + } + }; + + public struct AnimationRef : IFlatbufferObject + { + private Table __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public static AnimationRef GetRootAsAnimationRef(ByteBuffer _bb) { return GetRootAsAnimationRef(_bb, new AnimationRef()); } + public static AnimationRef GetRootAsAnimationRef(ByteBuffer _bb, AnimationRef obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public AnimationRef __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public string Name { get { int o = __p.__offset(4); return o != 0 ? __p.__string(o + __p.bb_pos) : null; } } +#if ENABLE_SPAN_T + public Span GetNameBytes() { return __p.__vector_as_span(4); } +#else + public ArraySegment? GetNameBytes() { return __p.__vector_as_arraysegment(4); } +#endif + public byte[] GetNameArray() { return __p.__vector_as_array(4); } + public string File { get { int o = __p.__offset(6); return o != 0 ? __p.__string(o + __p.bb_pos) : null; } } +#if ENABLE_SPAN_T + public Span GetFileBytes() { return __p.__vector_as_span(6); } +#else + public ArraySegment? GetFileBytes() { return __p.__vector_as_arraysegment(6); } +#endif + public byte[] GetFileArray() { return __p.__vector_as_array(6); } + + public static Offset CreateAnimationRef(FlatBufferBuilder builder, + StringOffset NameOffset = default(StringOffset), + StringOffset FileOffset = default(StringOffset)) + { + builder.StartObject(2); + AnimationRef.AddFile(builder, FileOffset); + AnimationRef.AddName(builder, NameOffset); + return AnimationRef.EndAnimationRef(builder); + } + + public static void StartAnimationRef(FlatBufferBuilder builder) { builder.StartObject(2); } + public static void AddName(FlatBufferBuilder builder, StringOffset NameOffset) { builder.AddOffset(0, NameOffset.Value, 0); } + public static void AddFile(FlatBufferBuilder builder, StringOffset FileOffset) { builder.AddOffset(1, FileOffset.Value, 0); } + public static Offset EndAnimationRef(FlatBufferBuilder builder) + { + int o = builder.EndObject(); + return new Offset(o); + } + }; + + public struct PartList : IFlatbufferObject + { + private Table __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public static PartList GetRootAsPartList(ByteBuffer _bb) { return GetRootAsPartList(_bb, new PartList()); } + public static PartList GetRootAsPartList(ByteBuffer _bb, PartList obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public PartList __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + + public static void StartPartList(FlatBufferBuilder builder) { builder.StartObject(0); } + public static Offset EndPartList(FlatBufferBuilder builder) + { + int o = builder.EndObject(); + return new Offset(o); + } + }; + + public struct Part : IFlatbufferObject + { + private Table __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public static Part GetRootAsPart(ByteBuffer _bb) { return GetRootAsPart(_bb, new Part()); } + public static Part GetRootAsPart(ByteBuffer _bb, Part obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public Part __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public int ID { get { int o = __p.__offset(4); return o != 0 ? __p.bb.GetInt(o + __p.bb_pos) : (int)0; } } + public string Name { get { int o = __p.__offset(6); return o != 0 ? __p.__string(o + __p.bb_pos) : null; } } +#if ENABLE_SPAN_T + public Span GetNameBytes() { return __p.__vector_as_span(6); } +#else + public ArraySegment? GetNameBytes() { return __p.__vector_as_arraysegment(6); } +#endif + public byte[] GetNameArray() { return __p.__vector_as_array(6); } + public ModelRef? Objects { get { int o = __p.__offset(8); return o != 0 ? (ModelRef?)(new ModelRef()).__assign(__p.__indirect(o + __p.bb_pos), __p.bb) : null; } } + + public static Offset CreatePart(FlatBufferBuilder builder, + int ID = 0, + StringOffset NameOffset = default(StringOffset), + Offset ObjectsOffset = default(Offset)) + { + builder.StartObject(3); + Part.AddObjects(builder, ObjectsOffset); + Part.AddName(builder, NameOffset); + Part.AddID(builder, ID); + return Part.EndPart(builder); + } + + public static void StartPart(FlatBufferBuilder builder) { builder.StartObject(3); } + public static void AddID(FlatBufferBuilder builder, int ID) { builder.AddInt(0, ID, 0); } + public static void AddName(FlatBufferBuilder builder, StringOffset NameOffset) { builder.AddOffset(1, NameOffset.Value, 0); } + public static void AddObjects(FlatBufferBuilder builder, Offset ObjectsOffset) { builder.AddOffset(2, ObjectsOffset.Value, 0); } + public static Offset EndPart(FlatBufferBuilder builder) + { + int o = builder.EndObject(); + return new Offset(o); + } + }; + + public struct PartEffect : IFlatbufferObject + { + private Table __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public static PartEffect GetRootAsPartEffect(ByteBuffer _bb) { return GetRootAsPartEffect(_bb, new PartEffect()); } + public static PartEffect GetRootAsPartEffect(ByteBuffer _bb, PartEffect obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public PartEffect __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public int Empty { get { int o = __p.__offset(4); return o != 0 ? __p.bb.GetInt(o + __p.bb_pos) : (int)0; } } + + public static Offset CreatePartEffect(FlatBufferBuilder builder, + int empty = 0) + { + builder.StartObject(1); + PartEffect.AddEmpty(builder, empty); + return PartEffect.EndPartEffect(builder); + } + + public static void StartPartEffect(FlatBufferBuilder builder) { builder.StartObject(1); } + public static void AddEmpty(FlatBufferBuilder builder, int empty) { builder.AddInt(0, empty, 0); } + public static Offset EndPartEffect(FlatBufferBuilder builder) + { + int o = builder.EndObject(); + return new Offset(o); + } + }; + + public struct ModelRef : IFlatbufferObject + { + private Table __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public static ModelRef GetRootAsModelRef(ByteBuffer _bb) { return GetRootAsModelRef(_bb, new ModelRef()); } + public static ModelRef GetRootAsModelRef(ByteBuffer _bb, ModelRef obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public ModelRef __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public StringList? Bones { get { int o = __p.__offset(4); return o != 0 ? (StringList?)(new StringList()).__assign(__p.__indirect(o + __p.bb_pos), __p.bb) : null; } } + + public static Offset CreateModelRef(FlatBufferBuilder builder, + Offset BonesOffset = default(Offset)) + { + builder.StartObject(1); + ModelRef.AddBones(builder, BonesOffset); + return ModelRef.EndModelRef(builder); + } + + public static void StartModelRef(FlatBufferBuilder builder) { builder.StartObject(1); } + public static void AddBones(FlatBufferBuilder builder, Offset BonesOffset) { builder.AddOffset(0, BonesOffset.Value, 0); } + public static Offset EndModelRef(FlatBufferBuilder builder) + { + int o = builder.EndObject(); + return new Offset(o); + } + }; + + public struct StringList : IFlatbufferObject + { + private Table __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public static StringList GetRootAsStringList(ByteBuffer _bb) { return GetRootAsStringList(_bb, new StringList()); } + public static StringList GetRootAsStringList(ByteBuffer _bb, StringList obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public StringList __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public sbyte Unknown { get { int o = __p.__offset(4); return o != 0 ? __p.bb.GetSbyte(o + __p.bb_pos) : (sbyte)0; } } + public string List(int j) { int o = __p.__offset(6); return o != 0 ? __p.__string(__p.__vector(o) + j * 4) : null; } + public int ListLength { get { int o = __p.__offset(6); return o != 0 ? __p.__vector_len(o) : 0; } } + + public static Offset CreateStringList(FlatBufferBuilder builder, + sbyte Unknown = 0, + VectorOffset ListOffset = default(VectorOffset)) + { + builder.StartObject(2); + StringList.AddList(builder, ListOffset); + StringList.AddUnknown(builder, Unknown); + return StringList.EndStringList(builder); + } + + public static void StartStringList(FlatBufferBuilder builder) { builder.StartObject(2); } + public static void AddUnknown(FlatBufferBuilder builder, sbyte Unknown) { builder.AddSbyte(0, Unknown, 0); } + public static void AddList(FlatBufferBuilder builder, VectorOffset ListOffset) { builder.AddOffset(1, ListOffset.Value, 0); } + public static VectorOffset CreateListVector(FlatBufferBuilder builder, StringOffset[] data) { builder.StartVector(4, data.Length, 4); for (int i = data.Length - 1; i >= 0; i--) builder.AddOffset(data[i].Value); return builder.EndVector(); } + public static VectorOffset CreateListVectorBlock(FlatBufferBuilder builder, StringOffset[] data) { builder.StartVector(4, data.Length, 4); builder.Add(data); return builder.EndVector(); } + public static void StartListVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(4, numElems, 4); } + public static Offset EndStringList(FlatBufferBuilder builder) + { + int o = builder.EndObject(); + return new Offset(o); + } + }; + + public struct Vector3 : IFlatbufferObject + { + private Struct __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public Vector3 __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public float X { get { return __p.bb.GetFloat(__p.bb_pos + 0); } } + public float Y { get { return __p.bb.GetFloat(__p.bb_pos + 4); } } + public float Z { get { return __p.bb.GetFloat(__p.bb_pos + 8); } } + + public static Offset CreateVector3(FlatBufferBuilder builder, float X, float Y, float Z) + { + builder.Prep(4, 12); + builder.PutFloat(Z); + builder.PutFloat(Y); + builder.PutFloat(X); + return new Offset(builder.Offset); + } + }; + + public struct Vector4 : IFlatbufferObject + { + private Struct __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public Vector4 __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public float X { get { return __p.bb.GetFloat(__p.bb_pos + 0); } } + public float Y { get { return __p.bb.GetFloat(__p.bb_pos + 4); } } + public float Z { get { return __p.bb.GetFloat(__p.bb_pos + 8); } } + public float W { get { return __p.bb.GetFloat(__p.bb_pos + 12); } } + + public static Offset CreateVector4(FlatBufferBuilder builder, float X, float Y, float Z, float W) + { + builder.Prep(4, 16); + builder.PutFloat(W); + builder.PutFloat(Z); + builder.PutFloat(Y); + builder.PutFloat(X); + return new Offset(builder.Offset); + } + }; + + public struct Quaternion : IFlatbufferObject + { + private Struct __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public Quaternion __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public ushort X { get { return __p.bb.GetUshort(__p.bb_pos + 0); } } + public ushort Y { get { return __p.bb.GetUshort(__p.bb_pos + 2); } } + public ushort Z { get { return __p.bb.GetUshort(__p.bb_pos + 4); } } + + public static Offset CreateQuaternion(FlatBufferBuilder builder, ushort X, ushort Y, ushort Z) + { + builder.Prep(2, 6); + builder.PutUshort(Z); + builder.PutUshort(Y); + builder.PutUshort(X); + return new Offset(builder.Offset); + } + }; + + public struct SRT : IFlatbufferObject + { + private Struct __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public SRT __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public float ScaleX { get { return __p.bb.GetFloat(__p.bb_pos + 0); } } + public float ScaleY { get { return __p.bb.GetFloat(__p.bb_pos + 4); } } + public float ScaleZ { get { return __p.bb.GetFloat(__p.bb_pos + 8); } } + public float RotateX { get { return __p.bb.GetFloat(__p.bb_pos + 12); } } + public float RotateY { get { return __p.bb.GetFloat(__p.bb_pos + 16); } } + public float RotateZ { get { return __p.bb.GetFloat(__p.bb_pos + 20); } } + public float RotateW { get { return __p.bb.GetFloat(__p.bb_pos + 24); } } + public float TranslateX { get { return __p.bb.GetFloat(__p.bb_pos + 28); } } + public float TranslateY { get { return __p.bb.GetFloat(__p.bb_pos + 32); } } + public float TranslateZ { get { return __p.bb.GetFloat(__p.bb_pos + 36); } } + + public static Offset CreateSRT(FlatBufferBuilder builder, float ScaleX, float ScaleY, float ScaleZ, float RotateX, float RotateY, float RotateZ, float RotateW, float TranslateX, float TranslateY, float TranslateZ) + { + builder.Prep(4, 40); + builder.PutFloat(TranslateZ); + builder.PutFloat(TranslateY); + builder.PutFloat(TranslateX); + builder.PutFloat(RotateW); + builder.PutFloat(RotateZ); + builder.PutFloat(RotateY); + builder.PutFloat(RotateX); + builder.PutFloat(ScaleZ); + builder.PutFloat(ScaleY); + builder.PutFloat(ScaleX); + return new Offset(builder.Offset); + } + }; + + +} diff --git a/File_Format_Library/FileFormats/Pokemon/GFBANMCFG/GFBANMCFG.cs b/File_Format_Library/FileFormats/Pokemon/GFBANMCFG/GFBANMCFG.cs new file mode 100644 index 00000000..a5074b9a --- /dev/null +++ b/File_Format_Library/FileFormats/Pokemon/GFBANMCFG/GFBANMCFG.cs @@ -0,0 +1,111 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Toolbox; +using System.Windows.Forms; +using Toolbox.Library; +using Toolbox.Library.IO; +using OpenTK; +using System.Reflection; +using Toolbox.Library.Forms; +using Newtonsoft.Json; + +namespace FirstPlugin +{ + public class GFBANMCFG : IEditor, IFileFormat, IConvertableTextFormat + { + public FileType FileType { get; set; } = FileType.Model; + + public bool CanSave { get; set; } + public string[] Description { get; set; } = new string[] { "GFBANMCFG" }; + public string[] Extension { get; set; } = new string[] { "*.gfbanmcfg" }; + public string FileName { get; set; } + public string FilePath { get; set; } + public IFileInfo IFileInfo { get; set; } + + public bool Identify(System.IO.Stream stream) + { + return Utils.GetExtension(FileName) == ".gfbanmcfg"; + } + + public Type[] Types + { + get + { + List types = new List(); + return types.ToArray(); + } + } + + public AnimConfig Config; + + public void Load(System.IO.Stream stream) + { + Config = new AnimConfig(); + + var flatBuffer = FlatBuffers.Gfbanmcfg.AnimationConfig.GetRootAsAnimationConfig( + new FlatBuffers.ByteBuffer(stream.ToBytes())); + + if (flatBuffer.Animations != null) { + for (int i = 0; i < flatBuffer.Animations.Value.AnimationsLength; i++) + { + var anim = flatBuffer.Animations.Value.Animations(i).Value; + Console.WriteLine(anim.Name); + + Config.Animations.Add(new Animation() + { + Name = anim.Name, + FileName = anim.File, + }); + } + } + } + + public class AnimConfig + { + public List Animations = new List(); + } + + public class Animation + { + public string Name { get; set; } + public string FileName { get; set; } + } + + public TextEditor OpenForm() + { + return new TextEditor(); + } + + public void FillEditor(UserControl control) + { + ((TextEditor)control).FileFormat = this; + ((TextEditor)control).FillEditor(ConvertToString()); + } + + #region Text Converter Interface + public TextFileType TextFileType => TextFileType.Json; + public bool CanConvertBack => false; + + public string ConvertToString() { + return JsonConvert.SerializeObject(Config, Formatting.Indented, new JsonSerializerSettings()); + } + + public void ConvertFromString(string text) + { + } + + #endregion + + public void Unload() + { + + } + + public void Save(System.IO.Stream stream) + { + } + } +} diff --git a/File_Format_Library/FileFormats/Pokemon/GFBMDL/FlatBuffers/gfbmdl.cs b/File_Format_Library/FileFormats/Pokemon/GFBMDL/FlatBuffers/gfbmdl.cs new file mode 100644 index 00000000..ebed02ef --- /dev/null +++ b/File_Format_Library/FileFormats/Pokemon/GFBMDL/FlatBuffers/gfbmdl.cs @@ -0,0 +1,1006 @@ +// +// automatically generated by the FlatBuffers compiler, do not modify +// + +namespace FlatBuffers.Gfbmdl +{ + using global::System; + using global::FlatBuffers; + + public enum BoneType : uint + { + NoSkinning = 0, + HasSkinning = 1, + }; + + public enum VertexType : uint + { + Position = 0, + Normal = 1, + Binormal = 2, + UV1 = 3, + UV2 = 4, + UV3 = 5, + UV4 = 6, + Color1 = 7, + Color2 = 8, + Color3 = 9, + Color4 = 10, + BoneID = 11, + BoneWeight = 12, + }; + + public enum BufferFormat : uint + { + Float = 0, + HalfFloat = 1, + Byte = 3, + Short = 5, + BytesAsFloat = 8, + }; + + public struct Model : IFlatbufferObject + { + private Table __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public static Model GetRootAsModel(ByteBuffer _bb) { return GetRootAsModel(_bb, new Model()); } + public static Model GetRootAsModel(ByteBuffer _bb, Model obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public Model __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public uint Version { get { int o = __p.__offset(4); return o != 0 ? __p.bb.GetUint(o + __p.bb_pos) : (uint)0; } } + public BoundingBox? Bounding { get { int o = __p.__offset(6); return o != 0 ? (BoundingBox?)(new BoundingBox()).__assign(o + __p.bb_pos, __p.bb) : null; } } + public string TextureNames(int j) { int o = __p.__offset(8); return o != 0 ? __p.__string(__p.__vector(o) + j * 4) : null; } + public int TextureNamesLength { get { int o = __p.__offset(8); return o != 0 ? __p.__vector_len(o) : 0; } } + public string ShaderNames(int j) { int o = __p.__offset(10); return o != 0 ? __p.__string(__p.__vector(o) + j * 4) : null; } + public int ShaderNamesLength { get { int o = __p.__offset(10); return o != 0 ? __p.__vector_len(o) : 0; } } + public UnknownEmpty? Unknown(int j) { int o = __p.__offset(12); return o != 0 ? (UnknownEmpty?)(new UnknownEmpty()).__assign(__p.__indirect(__p.__vector(o) + j * 4), __p.bb) : null; } + public int UnknownLength { get { int o = __p.__offset(12); return o != 0 ? __p.__vector_len(o) : 0; } } + public string MaterialNames(int j) { int o = __p.__offset(14); return o != 0 ? __p.__string(__p.__vector(o) + j * 4) : null; } + public int MaterialNamesLength { get { int o = __p.__offset(14); return o != 0 ? __p.__vector_len(o) : 0; } } + public Material? Materials(int j) { int o = __p.__offset(16); return o != 0 ? (Material?)(new Material()).__assign(__p.__indirect(__p.__vector(o) + j * 4), __p.bb) : null; } + public int MaterialsLength { get { int o = __p.__offset(16); return o != 0 ? __p.__vector_len(o) : 0; } } + public Group? Groups(int j) { int o = __p.__offset(18); return o != 0 ? (Group?)(new Group()).__assign(__p.__indirect(__p.__vector(o) + j * 4), __p.bb) : null; } + public int GroupsLength { get { int o = __p.__offset(18); return o != 0 ? __p.__vector_len(o) : 0; } } + public Mesh? Meshes(int j) { int o = __p.__offset(20); return o != 0 ? (Mesh?)(new Mesh()).__assign(__p.__indirect(__p.__vector(o) + j * 4), __p.bb) : null; } + public int MeshesLength { get { int o = __p.__offset(20); return o != 0 ? __p.__vector_len(o) : 0; } } + public Bone? Bones(int j) { int o = __p.__offset(22); return o != 0 ? (Bone?)(new Bone()).__assign(__p.__indirect(__p.__vector(o) + j * 4), __p.bb) : null; } + public int BonesLength { get { int o = __p.__offset(22); return o != 0 ? __p.__vector_len(o) : 0; } } + public RenderInfo? RenderData(int j) { int o = __p.__offset(24); return o != 0 ? (RenderInfo?)(new RenderInfo()).__assign(__p.__indirect(__p.__vector(o) + j * 4), __p.bb) : null; } + public int RenderDataLength { get { int o = __p.__offset(24); return o != 0 ? __p.__vector_len(o) : 0; } } + + public static void StartModel(FlatBufferBuilder builder) { builder.StartObject(11); } + public static void AddVersion(FlatBufferBuilder builder, uint Version) { builder.AddUint(0, Version, 0); } + public static void AddBounding(FlatBufferBuilder builder, Offset BoundingOffset) { builder.AddStruct(1, BoundingOffset.Value, 0); } + public static void AddTextureNames(FlatBufferBuilder builder, VectorOffset TextureNamesOffset) { builder.AddOffset(2, TextureNamesOffset.Value, 0); } + public static VectorOffset CreateTextureNamesVector(FlatBufferBuilder builder, StringOffset[] data) { builder.StartVector(4, data.Length, 4); for (int i = data.Length - 1; i >= 0; i--) builder.AddOffset(data[i].Value); return builder.EndVector(); } + public static VectorOffset CreateTextureNamesVectorBlock(FlatBufferBuilder builder, StringOffset[] data) { builder.StartVector(4, data.Length, 4); builder.Add(data); return builder.EndVector(); } + public static void StartTextureNamesVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(4, numElems, 4); } + public static void AddShaderNames(FlatBufferBuilder builder, VectorOffset ShaderNamesOffset) { builder.AddOffset(3, ShaderNamesOffset.Value, 0); } + public static VectorOffset CreateShaderNamesVector(FlatBufferBuilder builder, StringOffset[] data) { builder.StartVector(4, data.Length, 4); for (int i = data.Length - 1; i >= 0; i--) builder.AddOffset(data[i].Value); return builder.EndVector(); } + public static VectorOffset CreateShaderNamesVectorBlock(FlatBufferBuilder builder, StringOffset[] data) { builder.StartVector(4, data.Length, 4); builder.Add(data); return builder.EndVector(); } + public static void StartShaderNamesVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(4, numElems, 4); } + public static void AddUnknown(FlatBufferBuilder builder, VectorOffset UnknownOffset) { builder.AddOffset(4, UnknownOffset.Value, 0); } + public static VectorOffset CreateUnknownVector(FlatBufferBuilder builder, Offset[] data) { builder.StartVector(4, data.Length, 4); for (int i = data.Length - 1; i >= 0; i--) builder.AddOffset(data[i].Value); return builder.EndVector(); } + public static VectorOffset CreateUnknownVectorBlock(FlatBufferBuilder builder, Offset[] data) { builder.StartVector(4, data.Length, 4); builder.Add(data); return builder.EndVector(); } + public static void StartUnknownVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(4, numElems, 4); } + public static void AddMaterialNames(FlatBufferBuilder builder, VectorOffset MaterialNamesOffset) { builder.AddOffset(5, MaterialNamesOffset.Value, 0); } + public static VectorOffset CreateMaterialNamesVector(FlatBufferBuilder builder, StringOffset[] data) { builder.StartVector(4, data.Length, 4); for (int i = data.Length - 1; i >= 0; i--) builder.AddOffset(data[i].Value); return builder.EndVector(); } + public static VectorOffset CreateMaterialNamesVectorBlock(FlatBufferBuilder builder, StringOffset[] data) { builder.StartVector(4, data.Length, 4); builder.Add(data); return builder.EndVector(); } + public static void StartMaterialNamesVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(4, numElems, 4); } + public static void AddMaterials(FlatBufferBuilder builder, VectorOffset MaterialsOffset) { builder.AddOffset(6, MaterialsOffset.Value, 0); } + public static VectorOffset CreateMaterialsVector(FlatBufferBuilder builder, Offset[] data) { builder.StartVector(4, data.Length, 4); for (int i = data.Length - 1; i >= 0; i--) builder.AddOffset(data[i].Value); return builder.EndVector(); } + public static VectorOffset CreateMaterialsVectorBlock(FlatBufferBuilder builder, Offset[] data) { builder.StartVector(4, data.Length, 4); builder.Add(data); return builder.EndVector(); } + public static void StartMaterialsVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(4, numElems, 4); } + public static void AddGroups(FlatBufferBuilder builder, VectorOffset GroupsOffset) { builder.AddOffset(7, GroupsOffset.Value, 0); } + public static VectorOffset CreateGroupsVector(FlatBufferBuilder builder, Offset[] data) { builder.StartVector(4, data.Length, 4); for (int i = data.Length - 1; i >= 0; i--) builder.AddOffset(data[i].Value); return builder.EndVector(); } + public static VectorOffset CreateGroupsVectorBlock(FlatBufferBuilder builder, Offset[] data) { builder.StartVector(4, data.Length, 4); builder.Add(data); return builder.EndVector(); } + public static void StartGroupsVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(4, numElems, 4); } + public static void AddMeshes(FlatBufferBuilder builder, VectorOffset MeshesOffset) { builder.AddOffset(8, MeshesOffset.Value, 0); } + public static VectorOffset CreateMeshesVector(FlatBufferBuilder builder, Offset[] data) { builder.StartVector(4, data.Length, 4); for (int i = data.Length - 1; i >= 0; i--) builder.AddOffset(data[i].Value); return builder.EndVector(); } + public static VectorOffset CreateMeshesVectorBlock(FlatBufferBuilder builder, Offset[] data) { builder.StartVector(4, data.Length, 4); builder.Add(data); return builder.EndVector(); } + public static void StartMeshesVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(4, numElems, 4); } + public static void AddBones(FlatBufferBuilder builder, VectorOffset BonesOffset) { builder.AddOffset(9, BonesOffset.Value, 0); } + public static VectorOffset CreateBonesVector(FlatBufferBuilder builder, Offset[] data) { builder.StartVector(4, data.Length, 4); for (int i = data.Length - 1; i >= 0; i--) builder.AddOffset(data[i].Value); return builder.EndVector(); } + public static VectorOffset CreateBonesVectorBlock(FlatBufferBuilder builder, Offset[] data) { builder.StartVector(4, data.Length, 4); builder.Add(data); return builder.EndVector(); } + public static void StartBonesVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(4, numElems, 4); } + public static void AddRenderData(FlatBufferBuilder builder, VectorOffset RenderDataOffset) { builder.AddOffset(10, RenderDataOffset.Value, 0); } + public static VectorOffset CreateRenderDataVector(FlatBufferBuilder builder, Offset[] data) { builder.StartVector(4, data.Length, 4); for (int i = data.Length - 1; i >= 0; i--) builder.AddOffset(data[i].Value); return builder.EndVector(); } + public static VectorOffset CreateRenderDataVectorBlock(FlatBufferBuilder builder, Offset[] data) { builder.StartVector(4, data.Length, 4); builder.Add(data); return builder.EndVector(); } + public static void StartRenderDataVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(4, numElems, 4); } + public static Offset EndModel(FlatBufferBuilder builder) + { + int o = builder.EndObject(); + return new Offset(o); + } + public static void FinishModelBuffer(FlatBufferBuilder builder, Offset offset) { builder.Finish(offset.Value); } + public static void FinishSizePrefixedModelBuffer(FlatBufferBuilder builder, Offset offset) { builder.FinishSizePrefixed(offset.Value); } + }; + + public struct UnknownEmpty : IFlatbufferObject + { + private Table __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public static UnknownEmpty GetRootAsUnknownEmpty(ByteBuffer _bb) { return GetRootAsUnknownEmpty(_bb, new UnknownEmpty()); } + public static UnknownEmpty GetRootAsUnknownEmpty(ByteBuffer _bb, UnknownEmpty obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public UnknownEmpty __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public uint Unk { get { int o = __p.__offset(4); return o != 0 ? __p.bb.GetUint(o + __p.bb_pos) : (uint)0; } } + + public static Offset CreateUnknownEmpty(FlatBufferBuilder builder, + uint unk = 0) + { + builder.StartObject(1); + UnknownEmpty.AddUnk(builder, unk); + return UnknownEmpty.EndUnknownEmpty(builder); + } + + public static void StartUnknownEmpty(FlatBufferBuilder builder) { builder.StartObject(1); } + public static void AddUnk(FlatBufferBuilder builder, uint unk) { builder.AddUint(0, unk, 0); } + public static Offset EndUnknownEmpty(FlatBufferBuilder builder) + { + int o = builder.EndObject(); + return new Offset(o); + } + }; + + public struct Material : IFlatbufferObject + { + private Table __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public static Material GetRootAsMaterial(ByteBuffer _bb) { return GetRootAsMaterial(_bb, new Material()); } + public static Material GetRootAsMaterial(ByteBuffer _bb, Material obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public Material __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public string Name { get { int o = __p.__offset(4); return o != 0 ? __p.__string(o + __p.bb_pos) : null; } } +#if ENABLE_SPAN_T + public Span GetNameBytes() { return __p.__vector_as_span(4); } +#else + public ArraySegment? GetNameBytes() { return __p.__vector_as_arraysegment(4); } +#endif + public byte[] GetNameArray() { return __p.__vector_as_array(4); } + public string ShaderGroup { get { int o = __p.__offset(6); return o != 0 ? __p.__string(o + __p.bb_pos) : null; } } +#if ENABLE_SPAN_T + public Span GetShaderGroupBytes() { return __p.__vector_as_span(6); } +#else + public ArraySegment? GetShaderGroupBytes() { return __p.__vector_as_arraysegment(6); } +#endif + public byte[] GetShaderGroupArray() { return __p.__vector_as_array(6); } + public int RenderLayer { get { int o = __p.__offset(8); return o != 0 ? __p.bb.GetInt(o + __p.bb_pos) : (int)0; } } + public sbyte Unknown1 { get { int o = __p.__offset(10); return o != 0 ? __p.bb.GetSbyte(o + __p.bb_pos) : (sbyte)0; } } + public sbyte Unknown2 { get { int o = __p.__offset(12); return o != 0 ? __p.bb.GetSbyte(o + __p.bb_pos) : (sbyte)0; } } + public int Parameter1 { get { int o = __p.__offset(14); return o != 0 ? __p.bb.GetInt(o + __p.bb_pos) : (int)0; } } + public int Parameter2 { get { int o = __p.__offset(16); return o != 0 ? __p.bb.GetInt(o + __p.bb_pos) : (int)0; } } + public int Parameter3 { get { int o = __p.__offset(18); return o != 0 ? __p.bb.GetInt(o + __p.bb_pos) : (int)0; } } + public int Parameter4 { get { int o = __p.__offset(20); return o != 0 ? __p.bb.GetInt(o + __p.bb_pos) : (int)0; } } + public int Parameter5 { get { int o = __p.__offset(22); return o != 0 ? __p.bb.GetInt(o + __p.bb_pos) : (int)0; } } + public int Parameter6 { get { int o = __p.__offset(24); return o != 0 ? __p.bb.GetInt(o + __p.bb_pos) : (int)0; } } + public TextureMap? Textures(int j) { int o = __p.__offset(26); return o != 0 ? (TextureMap?)(new TextureMap()).__assign(__p.__indirect(__p.__vector(o) + j * 4), __p.bb) : null; } + public int TexturesLength { get { int o = __p.__offset(26); return o != 0 ? __p.__vector_len(o) : 0; } } + public MatSwitch? Switches(int j) { int o = __p.__offset(28); return o != 0 ? (MatSwitch?)(new MatSwitch()).__assign(__p.__indirect(__p.__vector(o) + j * 4), __p.bb) : null; } + public int SwitchesLength { get { int o = __p.__offset(28); return o != 0 ? __p.__vector_len(o) : 0; } } + public MatFloat? Values(int j) { int o = __p.__offset(30); return o != 0 ? (MatFloat?)(new MatFloat()).__assign(__p.__indirect(__p.__vector(o) + j * 4), __p.bb) : null; } + public int ValuesLength { get { int o = __p.__offset(30); return o != 0 ? __p.__vector_len(o) : 0; } } + public MatColor? Colors(int j) { int o = __p.__offset(32); return o != 0 ? (MatColor?)(new MatColor()).__assign(__p.__indirect(__p.__vector(o) + j * 4), __p.bb) : null; } + public int ColorsLength { get { int o = __p.__offset(32); return o != 0 ? __p.__vector_len(o) : 0; } } + public sbyte Unknown3 { get { int o = __p.__offset(34); return o != 0 ? __p.bb.GetSbyte(o + __p.bb_pos) : (sbyte)0; } } + public sbyte Unknown4 { get { int o = __p.__offset(36); return o != 0 ? __p.bb.GetSbyte(o + __p.bb_pos) : (sbyte)0; } } + public sbyte Unknown5 { get { int o = __p.__offset(38); return o != 0 ? __p.bb.GetSbyte(o + __p.bb_pos) : (sbyte)0; } } + public sbyte Unknown6 { get { int o = __p.__offset(40); return o != 0 ? __p.bb.GetSbyte(o + __p.bb_pos) : (sbyte)0; } } + public sbyte Unknown7 { get { int o = __p.__offset(42); return o != 0 ? __p.bb.GetSbyte(o + __p.bb_pos) : (sbyte)0; } } + public MaterialCommon? Common { get { int o = __p.__offset(44); return o != 0 ? (MaterialCommon?)(new MaterialCommon()).__assign(__p.__indirect(o + __p.bb_pos), __p.bb) : null; } } + + public static Offset CreateMaterial(FlatBufferBuilder builder, + StringOffset NameOffset = default(StringOffset), + StringOffset ShaderGroupOffset = default(StringOffset), + int RenderLayer = 0, + sbyte Unknown1 = 0, + sbyte Unknown2 = 0, + int Parameter1 = 0, + int Parameter2 = 0, + int Parameter3 = 0, + int Parameter4 = 0, + int Parameter5 = 0, + int Parameter6 = 0, + VectorOffset TexturesOffset = default(VectorOffset), + VectorOffset SwitchesOffset = default(VectorOffset), + VectorOffset ValuesOffset = default(VectorOffset), + VectorOffset ColorsOffset = default(VectorOffset), + sbyte Unknown3 = 0, + sbyte Unknown4 = 0, + sbyte Unknown5 = 0, + sbyte Unknown6 = 0, + sbyte Unknown7 = 0, + Offset CommonOffset = default(Offset)) + { + builder.StartObject(21); + Material.AddCommon(builder, CommonOffset); + Material.AddColors(builder, ColorsOffset); + Material.AddValues(builder, ValuesOffset); + Material.AddSwitches(builder, SwitchesOffset); + Material.AddTextures(builder, TexturesOffset); + Material.AddParameter6(builder, Parameter6); + Material.AddParameter5(builder, Parameter5); + Material.AddParameter4(builder, Parameter4); + Material.AddParameter3(builder, Parameter3); + Material.AddParameter2(builder, Parameter2); + Material.AddParameter1(builder, Parameter1); + Material.AddRenderLayer(builder, RenderLayer); + Material.AddShaderGroup(builder, ShaderGroupOffset); + Material.AddName(builder, NameOffset); + Material.AddUnknown7(builder, Unknown7); + Material.AddUnknown6(builder, Unknown6); + Material.AddUnknown5(builder, Unknown5); + Material.AddUnknown4(builder, Unknown4); + Material.AddUnknown3(builder, Unknown3); + Material.AddUnknown2(builder, Unknown2); + Material.AddUnknown1(builder, Unknown1); + return Material.EndMaterial(builder); + } + + public static void StartMaterial(FlatBufferBuilder builder) { builder.StartObject(21); } + public static void AddName(FlatBufferBuilder builder, StringOffset NameOffset) { builder.AddOffset(0, NameOffset.Value, 0); } + public static void AddShaderGroup(FlatBufferBuilder builder, StringOffset ShaderGroupOffset) { builder.AddOffset(1, ShaderGroupOffset.Value, 0); } + public static void AddRenderLayer(FlatBufferBuilder builder, int RenderLayer) { builder.AddInt(2, RenderLayer, 0); } + public static void AddUnknown1(FlatBufferBuilder builder, sbyte Unknown1) { builder.AddSbyte(3, Unknown1, 0); } + public static void AddUnknown2(FlatBufferBuilder builder, sbyte Unknown2) { builder.AddSbyte(4, Unknown2, 0); } + public static void AddParameter1(FlatBufferBuilder builder, int Parameter1) { builder.AddInt(5, Parameter1, 0); } + public static void AddParameter2(FlatBufferBuilder builder, int Parameter2) { builder.AddInt(6, Parameter2, 0); } + public static void AddParameter3(FlatBufferBuilder builder, int Parameter3) { builder.AddInt(7, Parameter3, 0); } + public static void AddParameter4(FlatBufferBuilder builder, int Parameter4) { builder.AddInt(8, Parameter4, 0); } + public static void AddParameter5(FlatBufferBuilder builder, int Parameter5) { builder.AddInt(9, Parameter5, 0); } + public static void AddParameter6(FlatBufferBuilder builder, int Parameter6) { builder.AddInt(10, Parameter6, 0); } + public static void AddTextures(FlatBufferBuilder builder, VectorOffset TexturesOffset) { builder.AddOffset(11, TexturesOffset.Value, 0); } + public static VectorOffset CreateTexturesVector(FlatBufferBuilder builder, Offset[] data) { builder.StartVector(4, data.Length, 4); for (int i = data.Length - 1; i >= 0; i--) builder.AddOffset(data[i].Value); return builder.EndVector(); } + public static VectorOffset CreateTexturesVectorBlock(FlatBufferBuilder builder, Offset[] data) { builder.StartVector(4, data.Length, 4); builder.Add(data); return builder.EndVector(); } + public static void StartTexturesVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(4, numElems, 4); } + public static void AddSwitches(FlatBufferBuilder builder, VectorOffset SwitchesOffset) { builder.AddOffset(12, SwitchesOffset.Value, 0); } + public static VectorOffset CreateSwitchesVector(FlatBufferBuilder builder, Offset[] data) { builder.StartVector(4, data.Length, 4); for (int i = data.Length - 1; i >= 0; i--) builder.AddOffset(data[i].Value); return builder.EndVector(); } + public static VectorOffset CreateSwitchesVectorBlock(FlatBufferBuilder builder, Offset[] data) { builder.StartVector(4, data.Length, 4); builder.Add(data); return builder.EndVector(); } + public static void StartSwitchesVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(4, numElems, 4); } + public static void AddValues(FlatBufferBuilder builder, VectorOffset ValuesOffset) { builder.AddOffset(13, ValuesOffset.Value, 0); } + public static VectorOffset CreateValuesVector(FlatBufferBuilder builder, Offset[] data) { builder.StartVector(4, data.Length, 4); for (int i = data.Length - 1; i >= 0; i--) builder.AddOffset(data[i].Value); return builder.EndVector(); } + public static VectorOffset CreateValuesVectorBlock(FlatBufferBuilder builder, Offset[] data) { builder.StartVector(4, data.Length, 4); builder.Add(data); return builder.EndVector(); } + public static void StartValuesVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(4, numElems, 4); } + public static void AddColors(FlatBufferBuilder builder, VectorOffset ColorsOffset) { builder.AddOffset(14, ColorsOffset.Value, 0); } + public static VectorOffset CreateColorsVector(FlatBufferBuilder builder, Offset[] data) { builder.StartVector(4, data.Length, 4); for (int i = data.Length - 1; i >= 0; i--) builder.AddOffset(data[i].Value); return builder.EndVector(); } + public static VectorOffset CreateColorsVectorBlock(FlatBufferBuilder builder, Offset[] data) { builder.StartVector(4, data.Length, 4); builder.Add(data); return builder.EndVector(); } + public static void StartColorsVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(4, numElems, 4); } + public static void AddUnknown3(FlatBufferBuilder builder, sbyte Unknown3) { builder.AddSbyte(15, Unknown3, 0); } + public static void AddUnknown4(FlatBufferBuilder builder, sbyte Unknown4) { builder.AddSbyte(16, Unknown4, 0); } + public static void AddUnknown5(FlatBufferBuilder builder, sbyte Unknown5) { builder.AddSbyte(17, Unknown5, 0); } + public static void AddUnknown6(FlatBufferBuilder builder, sbyte Unknown6) { builder.AddSbyte(18, Unknown6, 0); } + public static void AddUnknown7(FlatBufferBuilder builder, sbyte Unknown7) { builder.AddSbyte(19, Unknown7, 0); } + public static void AddCommon(FlatBufferBuilder builder, Offset CommonOffset) { builder.AddOffset(20, CommonOffset.Value, 0); } + public static Offset EndMaterial(FlatBufferBuilder builder) + { + int o = builder.EndObject(); + return new Offset(o); + } + }; + + public struct MaterialCommon : IFlatbufferObject + { + private Table __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public static MaterialCommon GetRootAsMaterialCommon(ByteBuffer _bb) { return GetRootAsMaterialCommon(_bb, new MaterialCommon()); } + public static MaterialCommon GetRootAsMaterialCommon(ByteBuffer _bb, MaterialCommon obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public MaterialCommon __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public MatSwitch? Switches(int j) { int o = __p.__offset(4); return o != 0 ? (MatSwitch?)(new MatSwitch()).__assign(__p.__indirect(__p.__vector(o) + j * 4), __p.bb) : null; } + public int SwitchesLength { get { int o = __p.__offset(4); return o != 0 ? __p.__vector_len(o) : 0; } } + public MatInt? Values(int j) { int o = __p.__offset(6); return o != 0 ? (MatInt?)(new MatInt()).__assign(__p.__indirect(__p.__vector(o) + j * 4), __p.bb) : null; } + public int ValuesLength { get { int o = __p.__offset(6); return o != 0 ? __p.__vector_len(o) : 0; } } + public MatColor? Colors(int j) { int o = __p.__offset(8); return o != 0 ? (MatColor?)(new MatColor()).__assign(__p.__indirect(__p.__vector(o) + j * 4), __p.bb) : null; } + public int ColorsLength { get { int o = __p.__offset(8); return o != 0 ? __p.__vector_len(o) : 0; } } + + public static Offset CreateMaterialCommon(FlatBufferBuilder builder, + VectorOffset SwitchesOffset = default(VectorOffset), + VectorOffset ValuesOffset = default(VectorOffset), + VectorOffset ColorsOffset = default(VectorOffset)) + { + builder.StartObject(3); + MaterialCommon.AddColors(builder, ColorsOffset); + MaterialCommon.AddValues(builder, ValuesOffset); + MaterialCommon.AddSwitches(builder, SwitchesOffset); + return MaterialCommon.EndMaterialCommon(builder); + } + + public static void StartMaterialCommon(FlatBufferBuilder builder) { builder.StartObject(3); } + public static void AddSwitches(FlatBufferBuilder builder, VectorOffset SwitchesOffset) { builder.AddOffset(0, SwitchesOffset.Value, 0); } + public static VectorOffset CreateSwitchesVector(FlatBufferBuilder builder, Offset[] data) { builder.StartVector(4, data.Length, 4); for (int i = data.Length - 1; i >= 0; i--) builder.AddOffset(data[i].Value); return builder.EndVector(); } + public static VectorOffset CreateSwitchesVectorBlock(FlatBufferBuilder builder, Offset[] data) { builder.StartVector(4, data.Length, 4); builder.Add(data); return builder.EndVector(); } + public static void StartSwitchesVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(4, numElems, 4); } + public static void AddValues(FlatBufferBuilder builder, VectorOffset ValuesOffset) { builder.AddOffset(1, ValuesOffset.Value, 0); } + public static VectorOffset CreateValuesVector(FlatBufferBuilder builder, Offset[] data) { builder.StartVector(4, data.Length, 4); for (int i = data.Length - 1; i >= 0; i--) builder.AddOffset(data[i].Value); return builder.EndVector(); } + public static VectorOffset CreateValuesVectorBlock(FlatBufferBuilder builder, Offset[] data) { builder.StartVector(4, data.Length, 4); builder.Add(data); return builder.EndVector(); } + public static void StartValuesVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(4, numElems, 4); } + public static void AddColors(FlatBufferBuilder builder, VectorOffset ColorsOffset) { builder.AddOffset(2, ColorsOffset.Value, 0); } + public static VectorOffset CreateColorsVector(FlatBufferBuilder builder, Offset[] data) { builder.StartVector(4, data.Length, 4); for (int i = data.Length - 1; i >= 0; i--) builder.AddOffset(data[i].Value); return builder.EndVector(); } + public static VectorOffset CreateColorsVectorBlock(FlatBufferBuilder builder, Offset[] data) { builder.StartVector(4, data.Length, 4); builder.Add(data); return builder.EndVector(); } + public static void StartColorsVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(4, numElems, 4); } + public static Offset EndMaterialCommon(FlatBufferBuilder builder) + { + int o = builder.EndObject(); + return new Offset(o); + } + }; + + public struct MatSwitch : IFlatbufferObject + { + private Table __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public static MatSwitch GetRootAsMatSwitch(ByteBuffer _bb) { return GetRootAsMatSwitch(_bb, new MatSwitch()); } + public static MatSwitch GetRootAsMatSwitch(ByteBuffer _bb, MatSwitch obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public MatSwitch __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public string Name { get { int o = __p.__offset(4); return o != 0 ? __p.__string(o + __p.bb_pos) : null; } } +#if ENABLE_SPAN_T + public Span GetNameBytes() { return __p.__vector_as_span(4); } +#else + public ArraySegment? GetNameBytes() { return __p.__vector_as_arraysegment(4); } +#endif + public byte[] GetNameArray() { return __p.__vector_as_array(4); } + public bool Value { get { int o = __p.__offset(6); return o != 0 ? 0 != __p.bb.Get(o + __p.bb_pos) : (bool)false; } } + + public static Offset CreateMatSwitch(FlatBufferBuilder builder, + StringOffset NameOffset = default(StringOffset), + bool Value = false) + { + builder.StartObject(2); + MatSwitch.AddName(builder, NameOffset); + MatSwitch.AddValue(builder, Value); + return MatSwitch.EndMatSwitch(builder); + } + + public static void StartMatSwitch(FlatBufferBuilder builder) { builder.StartObject(2); } + public static void AddName(FlatBufferBuilder builder, StringOffset NameOffset) { builder.AddOffset(0, NameOffset.Value, 0); } + public static void AddValue(FlatBufferBuilder builder, bool Value) { builder.AddBool(1, Value, false); } + public static Offset EndMatSwitch(FlatBufferBuilder builder) + { + int o = builder.EndObject(); + return new Offset(o); + } + }; + + public struct MatColor : IFlatbufferObject + { + private Table __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public static MatColor GetRootAsMatColor(ByteBuffer _bb) { return GetRootAsMatColor(_bb, new MatColor()); } + public static MatColor GetRootAsMatColor(ByteBuffer _bb, MatColor obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public MatColor __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public string Name { get { int o = __p.__offset(4); return o != 0 ? __p.__string(o + __p.bb_pos) : null; } } +#if ENABLE_SPAN_T + public Span GetNameBytes() { return __p.__vector_as_span(4); } +#else + public ArraySegment? GetNameBytes() { return __p.__vector_as_arraysegment(4); } +#endif + public byte[] GetNameArray() { return __p.__vector_as_array(4); } + public ColorRGB32? Color { get { int o = __p.__offset(6); return o != 0 ? (ColorRGB32?)(new ColorRGB32()).__assign(o + __p.bb_pos, __p.bb) : null; } } + + public static void StartMatColor(FlatBufferBuilder builder) { builder.StartObject(2); } + public static void AddName(FlatBufferBuilder builder, StringOffset NameOffset) { builder.AddOffset(0, NameOffset.Value, 0); } + public static void AddColor(FlatBufferBuilder builder, Offset ColorOffset) { builder.AddStruct(1, ColorOffset.Value, 0); } + public static Offset EndMatColor(FlatBufferBuilder builder) + { + int o = builder.EndObject(); + return new Offset(o); + } + }; + + public struct MatInt : IFlatbufferObject + { + private Table __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public static MatInt GetRootAsMatInt(ByteBuffer _bb) { return GetRootAsMatInt(_bb, new MatInt()); } + public static MatInt GetRootAsMatInt(ByteBuffer _bb, MatInt obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public MatInt __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public string Name { get { int o = __p.__offset(4); return o != 0 ? __p.__string(o + __p.bb_pos) : null; } } +#if ENABLE_SPAN_T + public Span GetNameBytes() { return __p.__vector_as_span(4); } +#else + public ArraySegment? GetNameBytes() { return __p.__vector_as_arraysegment(4); } +#endif + public byte[] GetNameArray() { return __p.__vector_as_array(4); } + public int Value { get { int o = __p.__offset(6); return o != 0 ? __p.bb.GetInt(o + __p.bb_pos) : (int)0; } } + + public static Offset CreateMatInt(FlatBufferBuilder builder, + StringOffset NameOffset = default(StringOffset), + int Value = 0) + { + builder.StartObject(2); + MatInt.AddValue(builder, Value); + MatInt.AddName(builder, NameOffset); + return MatInt.EndMatInt(builder); + } + + public static void StartMatInt(FlatBufferBuilder builder) { builder.StartObject(2); } + public static void AddName(FlatBufferBuilder builder, StringOffset NameOffset) { builder.AddOffset(0, NameOffset.Value, 0); } + public static void AddValue(FlatBufferBuilder builder, int Value) { builder.AddInt(1, Value, 0); } + public static Offset EndMatInt(FlatBufferBuilder builder) + { + int o = builder.EndObject(); + return new Offset(o); + } + }; + + public struct MatFloat : IFlatbufferObject + { + private Table __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public static MatFloat GetRootAsMatFloat(ByteBuffer _bb) { return GetRootAsMatFloat(_bb, new MatFloat()); } + public static MatFloat GetRootAsMatFloat(ByteBuffer _bb, MatFloat obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public MatFloat __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public string Name { get { int o = __p.__offset(4); return o != 0 ? __p.__string(o + __p.bb_pos) : null; } } +#if ENABLE_SPAN_T + public Span GetNameBytes() { return __p.__vector_as_span(4); } +#else + public ArraySegment? GetNameBytes() { return __p.__vector_as_arraysegment(4); } +#endif + public byte[] GetNameArray() { return __p.__vector_as_array(4); } + public float Value { get { int o = __p.__offset(6); return o != 0 ? __p.bb.GetFloat(o + __p.bb_pos) : (float)0.0f; } } + + public static Offset CreateMatFloat(FlatBufferBuilder builder, + StringOffset NameOffset = default(StringOffset), + float Value = 0.0f) + { + builder.StartObject(2); + MatFloat.AddValue(builder, Value); + MatFloat.AddName(builder, NameOffset); + return MatFloat.EndMatFloat(builder); + } + + public static void StartMatFloat(FlatBufferBuilder builder) { builder.StartObject(2); } + public static void AddName(FlatBufferBuilder builder, StringOffset NameOffset) { builder.AddOffset(0, NameOffset.Value, 0); } + public static void AddValue(FlatBufferBuilder builder, float Value) { builder.AddFloat(1, Value, 0.0f); } + public static Offset EndMatFloat(FlatBufferBuilder builder) + { + int o = builder.EndObject(); + return new Offset(o); + } + }; + + public struct TextureMap : IFlatbufferObject + { + private Table __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public static TextureMap GetRootAsTextureMap(ByteBuffer _bb) { return GetRootAsTextureMap(_bb, new TextureMap()); } + public static TextureMap GetRootAsTextureMap(ByteBuffer _bb, TextureMap obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public TextureMap __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public string Name { get { int o = __p.__offset(4); return o != 0 ? __p.__string(o + __p.bb_pos) : null; } } +#if ENABLE_SPAN_T + public Span GetNameBytes() { return __p.__vector_as_span(4); } +#else + public ArraySegment? GetNameBytes() { return __p.__vector_as_arraysegment(4); } +#endif + public byte[] GetNameArray() { return __p.__vector_as_array(4); } + public int Index { get { int o = __p.__offset(6); return o != 0 ? __p.bb.GetInt(o + __p.bb_pos) : (int)0; } } + public TextureMapping? Mapping { get { int o = __p.__offset(8); return o != 0 ? (TextureMapping?)(new TextureMapping()).__assign(__p.__indirect(o + __p.bb_pos), __p.bb) : null; } } + + public static Offset CreateTextureMap(FlatBufferBuilder builder, + StringOffset NameOffset = default(StringOffset), + int Index = 0, + Offset MappingOffset = default(Offset)) + { + builder.StartObject(3); + TextureMap.AddMapping(builder, MappingOffset); + TextureMap.AddIndex(builder, Index); + TextureMap.AddName(builder, NameOffset); + return TextureMap.EndTextureMap(builder); + } + + public static void StartTextureMap(FlatBufferBuilder builder) { builder.StartObject(3); } + public static void AddName(FlatBufferBuilder builder, StringOffset NameOffset) { builder.AddOffset(0, NameOffset.Value, 0); } + public static void AddIndex(FlatBufferBuilder builder, int Index) { builder.AddInt(1, Index, 0); } + public static void AddMapping(FlatBufferBuilder builder, Offset MappingOffset) { builder.AddOffset(2, MappingOffset.Value, 0); } + public static Offset EndTextureMap(FlatBufferBuilder builder) + { + int o = builder.EndObject(); + return new Offset(o); + } + }; + + public struct TextureMapping : IFlatbufferObject + { + private Table __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public static TextureMapping GetRootAsTextureMapping(ByteBuffer _bb) { return GetRootAsTextureMapping(_bb, new TextureMapping()); } + public static TextureMapping GetRootAsTextureMapping(ByteBuffer _bb, TextureMapping obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public TextureMapping __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public uint Type { get { int o = __p.__offset(4); return o != 0 ? __p.bb.GetUint(o + __p.bb_pos) : (uint)0; } } + public uint Scale { get { int o = __p.__offset(6); return o != 0 ? __p.bb.GetUint(o + __p.bb_pos) : (uint)0; } } + public uint Translation { get { int o = __p.__offset(8); return o != 0 ? __p.bb.GetUint(o + __p.bb_pos) : (uint)0; } } + public uint Rotation { get { int o = __p.__offset(10); return o != 0 ? __p.bb.GetUint(o + __p.bb_pos) : (uint)0; } } + public uint WrapS { get { int o = __p.__offset(12); return o != 0 ? __p.bb.GetUint(o + __p.bb_pos) : (uint)0; } } + public uint WrapT { get { int o = __p.__offset(14); return o != 0 ? __p.bb.GetUint(o + __p.bb_pos) : (uint)0; } } + public uint MagFilter { get { int o = __p.__offset(16); return o != 0 ? __p.bb.GetUint(o + __p.bb_pos) : (uint)0; } } + public uint MinFilter { get { int o = __p.__offset(18); return o != 0 ? __p.bb.GetUint(o + __p.bb_pos) : (uint)0; } } + public float MinLOD { get { int o = __p.__offset(20); return o != 0 ? __p.bb.GetFloat(o + __p.bb_pos) : (float)0.0f; } } + + public static Offset CreateTextureMapping(FlatBufferBuilder builder, + uint Type = 0, + uint Scale = 0, + uint Translation = 0, + uint Rotation = 0, + uint WrapS = 0, + uint WrapT = 0, + uint magFilter = 0, + uint minFilter = 0, + float minLOD = 0.0f) + { + builder.StartObject(9); + TextureMapping.AddMinLOD(builder, minLOD); + TextureMapping.AddMinFilter(builder, minFilter); + TextureMapping.AddMagFilter(builder, magFilter); + TextureMapping.AddWrapT(builder, WrapT); + TextureMapping.AddWrapS(builder, WrapS); + TextureMapping.AddRotation(builder, Rotation); + TextureMapping.AddTranslation(builder, Translation); + TextureMapping.AddScale(builder, Scale); + TextureMapping.AddType(builder, Type); + return TextureMapping.EndTextureMapping(builder); + } + + public static void StartTextureMapping(FlatBufferBuilder builder) { builder.StartObject(9); } + public static void AddType(FlatBufferBuilder builder, uint Type) { builder.AddUint(0, Type, 0); } + public static void AddScale(FlatBufferBuilder builder, uint Scale) { builder.AddUint(1, Scale, 0); } + public static void AddTranslation(FlatBufferBuilder builder, uint Translation) { builder.AddUint(2, Translation, 0); } + public static void AddRotation(FlatBufferBuilder builder, uint Rotation) { builder.AddUint(3, Rotation, 0); } + public static void AddWrapS(FlatBufferBuilder builder, uint WrapS) { builder.AddUint(4, WrapS, 0); } + public static void AddWrapT(FlatBufferBuilder builder, uint WrapT) { builder.AddUint(5, WrapT, 0); } + public static void AddMagFilter(FlatBufferBuilder builder, uint magFilter) { builder.AddUint(6, magFilter, 0); } + public static void AddMinFilter(FlatBufferBuilder builder, uint minFilter) { builder.AddUint(7, minFilter, 0); } + public static void AddMinLOD(FlatBufferBuilder builder, float minLOD) { builder.AddFloat(8, minLOD, 0.0f); } + public static Offset EndTextureMapping(FlatBufferBuilder builder) + { + int o = builder.EndObject(); + return new Offset(o); + } + }; + + public struct Group : IFlatbufferObject + { + private Table __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public static Group GetRootAsGroup(ByteBuffer _bb) { return GetRootAsGroup(_bb, new Group()); } + public static Group GetRootAsGroup(ByteBuffer _bb, Group obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public Group __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public uint BoneID { get { int o = __p.__offset(4); return o != 0 ? __p.bb.GetUint(o + __p.bb_pos) : (uint)0; } } + public uint MeshID { get { int o = __p.__offset(6); return o != 0 ? __p.bb.GetUint(o + __p.bb_pos) : (uint)0; } } + public BoundingBox? Bounding { get { int o = __p.__offset(8); return o != 0 ? (BoundingBox?)(new BoundingBox()).__assign(o + __p.bb_pos, __p.bb) : null; } } + public uint Layer { get { int o = __p.__offset(10); return o != 0 ? __p.bb.GetUint(o + __p.bb_pos) : (uint)0; } } + + public static void StartGroup(FlatBufferBuilder builder) { builder.StartObject(4); } + public static void AddBoneID(FlatBufferBuilder builder, uint boneID) { builder.AddUint(0, boneID, 0); } + public static void AddMeshID(FlatBufferBuilder builder, uint meshID) { builder.AddUint(1, meshID, 0); } + public static void AddBounding(FlatBufferBuilder builder, Offset BoundingOffset) { builder.AddStruct(2, BoundingOffset.Value, 0); } + public static void AddLayer(FlatBufferBuilder builder, uint layer) { builder.AddUint(3, layer, 0); } + public static Offset EndGroup(FlatBufferBuilder builder) + { + int o = builder.EndObject(); + return new Offset(o); + } + }; + + public struct Mesh : IFlatbufferObject + { + private Table __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public static Mesh GetRootAsMesh(ByteBuffer _bb) { return GetRootAsMesh(_bb, new Mesh()); } + public static Mesh GetRootAsMesh(ByteBuffer _bb, Mesh obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public Mesh __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public MeshPolygon? Polygons(int j) { int o = __p.__offset(4); return o != 0 ? (MeshPolygon?)(new MeshPolygon()).__assign(__p.__indirect(__p.__vector(o) + j * 4), __p.bb) : null; } + public int PolygonsLength { get { int o = __p.__offset(4); return o != 0 ? __p.__vector_len(o) : 0; } } + public MeshAlignment? Alignments(int j) { int o = __p.__offset(6); return o != 0 ? (MeshAlignment?)(new MeshAlignment()).__assign(__p.__indirect(__p.__vector(o) + j * 4), __p.bb) : null; } + public int AlignmentsLength { get { int o = __p.__offset(6); return o != 0 ? __p.__vector_len(o) : 0; } } + public byte Data(int j) { int o = __p.__offset(8); return o != 0 ? __p.bb.Get(__p.__vector(o) + j * 1) : (byte)0; } + public int DataLength { get { int o = __p.__offset(8); return o != 0 ? __p.__vector_len(o) : 0; } } +#if ENABLE_SPAN_T + public Span GetDataBytes() { return __p.__vector_as_span(8); } +#else + public ArraySegment? GetDataBytes() { return __p.__vector_as_arraysegment(8); } +#endif + public byte[] GetDataArray() { return __p.__vector_as_array(8); } + + public static Offset CreateMesh(FlatBufferBuilder builder, + VectorOffset PolygonsOffset = default(VectorOffset), + VectorOffset AlignmentsOffset = default(VectorOffset), + VectorOffset DataOffset = default(VectorOffset)) + { + builder.StartObject(3); + Mesh.AddData(builder, DataOffset); + Mesh.AddAlignments(builder, AlignmentsOffset); + Mesh.AddPolygons(builder, PolygonsOffset); + return Mesh.EndMesh(builder); + } + + public static void StartMesh(FlatBufferBuilder builder) { builder.StartObject(3); } + public static void AddPolygons(FlatBufferBuilder builder, VectorOffset PolygonsOffset) { builder.AddOffset(0, PolygonsOffset.Value, 0); } + public static VectorOffset CreatePolygonsVector(FlatBufferBuilder builder, Offset[] data) { builder.StartVector(4, data.Length, 4); for (int i = data.Length - 1; i >= 0; i--) builder.AddOffset(data[i].Value); return builder.EndVector(); } + public static VectorOffset CreatePolygonsVectorBlock(FlatBufferBuilder builder, Offset[] data) { builder.StartVector(4, data.Length, 4); builder.Add(data); return builder.EndVector(); } + public static void StartPolygonsVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(4, numElems, 4); } + public static void AddAlignments(FlatBufferBuilder builder, VectorOffset AlignmentsOffset) { builder.AddOffset(1, AlignmentsOffset.Value, 0); } + public static VectorOffset CreateAlignmentsVector(FlatBufferBuilder builder, Offset[] data) { builder.StartVector(4, data.Length, 4); for (int i = data.Length - 1; i >= 0; i--) builder.AddOffset(data[i].Value); return builder.EndVector(); } + public static VectorOffset CreateAlignmentsVectorBlock(FlatBufferBuilder builder, Offset[] data) { builder.StartVector(4, data.Length, 4); builder.Add(data); return builder.EndVector(); } + public static void StartAlignmentsVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(4, numElems, 4); } + public static void AddData(FlatBufferBuilder builder, VectorOffset DataOffset) { builder.AddOffset(2, DataOffset.Value, 0); } + public static VectorOffset CreateDataVector(FlatBufferBuilder builder, byte[] data) { builder.StartVector(1, data.Length, 1); for (int i = data.Length - 1; i >= 0; i--) builder.AddByte(data[i]); return builder.EndVector(); } + public static VectorOffset CreateDataVectorBlock(FlatBufferBuilder builder, byte[] data) { builder.StartVector(1, data.Length, 1); builder.Add(data); return builder.EndVector(); } + public static void StartDataVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(1, numElems, 1); } + public static Offset EndMesh(FlatBufferBuilder builder) + { + int o = builder.EndObject(); + return new Offset(o); + } + }; + + public struct MeshPolygon : IFlatbufferObject + { + private Table __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public static MeshPolygon GetRootAsMeshPolygon(ByteBuffer _bb) { return GetRootAsMeshPolygon(_bb, new MeshPolygon()); } + public static MeshPolygon GetRootAsMeshPolygon(ByteBuffer _bb, MeshPolygon obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public MeshPolygon __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public uint MaterialID { get { int o = __p.__offset(4); return o != 0 ? __p.bb.GetUint(o + __p.bb_pos) : (uint)0; } } + public ushort Data(int j) { int o = __p.__offset(6); return o != 0 ? __p.bb.GetUshort(__p.__vector(o) + j * 2) : (ushort)0; } + public int DataLength { get { int o = __p.__offset(6); return o != 0 ? __p.__vector_len(o) : 0; } } +#if ENABLE_SPAN_T + public Span GetDataBytes() { return __p.__vector_as_span(6); } +#else + public ArraySegment? GetDataBytes() { return __p.__vector_as_arraysegment(6); } +#endif + public ushort[] GetDataArray() { return __p.__vector_as_array(6); } + + public static Offset CreateMeshPolygon(FlatBufferBuilder builder, + uint materialID = 0, + VectorOffset dataOffset = default(VectorOffset)) + { + builder.StartObject(2); + MeshPolygon.AddData(builder, dataOffset); + MeshPolygon.AddMaterialID(builder, materialID); + return MeshPolygon.EndMeshPolygon(builder); + } + + public static void StartMeshPolygon(FlatBufferBuilder builder) { builder.StartObject(2); } + public static void AddMaterialID(FlatBufferBuilder builder, uint materialID) { builder.AddUint(0, materialID, 0); } + public static void AddData(FlatBufferBuilder builder, VectorOffset dataOffset) { builder.AddOffset(1, dataOffset.Value, 0); } + public static VectorOffset CreateDataVector(FlatBufferBuilder builder, ushort[] data) { builder.StartVector(2, data.Length, 2); for (int i = data.Length - 1; i >= 0; i--) builder.AddUshort(data[i]); return builder.EndVector(); } + public static VectorOffset CreateDataVectorBlock(FlatBufferBuilder builder, ushort[] data) { builder.StartVector(2, data.Length, 2); builder.Add(data); return builder.EndVector(); } + public static void StartDataVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(2, numElems, 2); } + public static Offset EndMeshPolygon(FlatBufferBuilder builder) + { + int o = builder.EndObject(); + return new Offset(o); + } + }; + + public struct MeshAlignment : IFlatbufferObject + { + private Table __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public static MeshAlignment GetRootAsMeshAlignment(ByteBuffer _bb) { return GetRootAsMeshAlignment(_bb, new MeshAlignment()); } + public static MeshAlignment GetRootAsMeshAlignment(ByteBuffer _bb, MeshAlignment obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public MeshAlignment __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public VertexType TypeID { get { int o = __p.__offset(4); return o != 0 ? (VertexType)__p.bb.GetUint(o + __p.bb_pos) : VertexType.Position; } } + public BufferFormat FormatID { get { int o = __p.__offset(6); return o != 0 ? (BufferFormat)__p.bb.GetUint(o + __p.bb_pos) : BufferFormat.Float; } } + public uint ElementCount { get { int o = __p.__offset(8); return o != 0 ? __p.bb.GetUint(o + __p.bb_pos) : (uint)0; } } + + public static Offset CreateMeshAlignment(FlatBufferBuilder builder, + VertexType TypeID = VertexType.Position, + BufferFormat FormatID = BufferFormat.Float, + uint ElementCount = 0) + { + builder.StartObject(3); + MeshAlignment.AddElementCount(builder, ElementCount); + MeshAlignment.AddFormatID(builder, FormatID); + MeshAlignment.AddTypeID(builder, TypeID); + return MeshAlignment.EndMeshAlignment(builder); + } + + public static void StartMeshAlignment(FlatBufferBuilder builder) { builder.StartObject(3); } + public static void AddTypeID(FlatBufferBuilder builder, VertexType TypeID) { builder.AddUint(0, (uint)TypeID, 0); } + public static void AddFormatID(FlatBufferBuilder builder, BufferFormat FormatID) { builder.AddUint(1, (uint)FormatID, 0); } + public static void AddElementCount(FlatBufferBuilder builder, uint ElementCount) { builder.AddUint(2, ElementCount, 0); } + public static Offset EndMeshAlignment(FlatBufferBuilder builder) + { + int o = builder.EndObject(); + return new Offset(o); + } + }; + + public struct Bone : IFlatbufferObject + { + private Table __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public static Bone GetRootAsBone(ByteBuffer _bb) { return GetRootAsBone(_bb, new Bone()); } + public static Bone GetRootAsBone(ByteBuffer _bb, Bone obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public Bone __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public string Name { get { int o = __p.__offset(4); return o != 0 ? __p.__string(o + __p.bb_pos) : null; } } +#if ENABLE_SPAN_T + public Span GetNameBytes() { return __p.__vector_as_span(4); } +#else + public ArraySegment? GetNameBytes() { return __p.__vector_as_arraysegment(4); } +#endif + public byte[] GetNameArray() { return __p.__vector_as_array(4); } + public BoneType Type { get { int o = __p.__offset(6); return o != 0 ? (BoneType)__p.bb.GetUint(o + __p.bb_pos) : BoneType.NoSkinning; } } + public int Parent { get { int o = __p.__offset(8); return o != 0 ? __p.bb.GetInt(o + __p.bb_pos) : (int)0; } } + public uint Zero { get { int o = __p.__offset(10); return o != 0 ? __p.bb.GetUint(o + __p.bb_pos) : (uint)0; } } + public bool Visible { get { int o = __p.__offset(12); return o != 0 ? 0 != __p.bb.Get(o + __p.bb_pos) : (bool)false; } } + public Vector3? Scale { get { int o = __p.__offset(14); return o != 0 ? (Vector3?)(new Vector3()).__assign(o + __p.bb_pos, __p.bb) : null; } } + public Vector3? Rotation { get { int o = __p.__offset(16); return o != 0 ? (Vector3?)(new Vector3()).__assign(o + __p.bb_pos, __p.bb) : null; } } + public Vector3? Translation { get { int o = __p.__offset(18); return o != 0 ? (Vector3?)(new Vector3()).__assign(o + __p.bb_pos, __p.bb) : null; } } + public Vector3? RadiusStart { get { int o = __p.__offset(20); return o != 0 ? (Vector3?)(new Vector3()).__assign(o + __p.bb_pos, __p.bb) : null; } } + public Vector3? RadiusEnd { get { int o = __p.__offset(22); return o != 0 ? (Vector3?)(new Vector3()).__assign(o + __p.bb_pos, __p.bb) : null; } } + public UnknownData? SkinCheck { get { int o = __p.__offset(24); return o != 0 ? (UnknownData?)(new UnknownData()).__assign(o + __p.bb_pos, __p.bb) : null; } } + + public static void StartBone(FlatBufferBuilder builder) { builder.StartObject(11); } + public static void AddName(FlatBufferBuilder builder, StringOffset NameOffset) { builder.AddOffset(0, NameOffset.Value, 0); } + public static void AddType(FlatBufferBuilder builder, BoneType Type) { builder.AddUint(1, (uint)Type, 0); } + public static void AddParent(FlatBufferBuilder builder, int Parent) { builder.AddInt(2, Parent, 0); } + public static void AddZero(FlatBufferBuilder builder, uint Zero) { builder.AddUint(3, Zero, 0); } + public static void AddVisible(FlatBufferBuilder builder, bool Visible) { builder.AddBool(4, Visible, false); } + public static void AddScale(FlatBufferBuilder builder, Offset ScaleOffset) { builder.AddStruct(5, ScaleOffset.Value, 0); } + public static void AddRotation(FlatBufferBuilder builder, Offset RotationOffset) { builder.AddStruct(6, RotationOffset.Value, 0); } + public static void AddTranslation(FlatBufferBuilder builder, Offset TranslationOffset) { builder.AddStruct(7, TranslationOffset.Value, 0); } + public static void AddRadiusStart(FlatBufferBuilder builder, Offset RadiusStartOffset) { builder.AddStruct(8, RadiusStartOffset.Value, 0); } + public static void AddRadiusEnd(FlatBufferBuilder builder, Offset RadiusEndOffset) { builder.AddStruct(9, RadiusEndOffset.Value, 0); } + public static void AddSkinCheck(FlatBufferBuilder builder, Offset SkinCheckOffset) { builder.AddStruct(10, SkinCheckOffset.Value, 0); } + public static Offset EndBone(FlatBufferBuilder builder) + { + int o = builder.EndObject(); + return new Offset(o); + } + }; + + public struct UnknownData : IFlatbufferObject + { + private Struct __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public UnknownData __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public sbyte NoSkin { get { return __p.bb.GetSbyte(__p.bb_pos + 0); } } + + public static Offset CreateUnknownData(FlatBufferBuilder builder, sbyte NoSkin) + { + builder.Prep(1, 1); + builder.PutSbyte(NoSkin); + return new Offset(builder.Offset); + } + }; + + public struct RenderInfo : IFlatbufferObject + { + private Table __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public static RenderInfo GetRootAsRenderInfo(ByteBuffer _bb) { return GetRootAsRenderInfo(_bb, new RenderInfo()); } + public static RenderInfo GetRootAsRenderInfo(ByteBuffer _bb, RenderInfo obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public RenderInfo __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public uint Unknown1 { get { int o = __p.__offset(4); return o != 0 ? __p.bb.GetUint(o + __p.bb_pos) : (uint)0; } } + public uint Unknown2 { get { int o = __p.__offset(6); return o != 0 ? __p.bb.GetUint(o + __p.bb_pos) : (uint)0; } } + public RenderUnknown? Unknown3 { get { int o = __p.__offset(8); return o != 0 ? (RenderUnknown?)(new RenderUnknown()).__assign(__p.__indirect(o + __p.bb_pos), __p.bb) : null; } } + public RenderUnknown2? Unknown4 { get { int o = __p.__offset(10); return o != 0 ? (RenderUnknown2?)(new RenderUnknown2()).__assign(__p.__indirect(o + __p.bb_pos), __p.bb) : null; } } + + public static Offset CreateRenderInfo(FlatBufferBuilder builder, + uint Unknown1 = 0, + uint Unknown2 = 0, + Offset Unknown3Offset = default(Offset), + Offset Unknown4Offset = default(Offset)) + { + builder.StartObject(4); + RenderInfo.AddUnknown4(builder, Unknown4Offset); + RenderInfo.AddUnknown3(builder, Unknown3Offset); + RenderInfo.AddUnknown2(builder, Unknown2); + RenderInfo.AddUnknown1(builder, Unknown1); + return RenderInfo.EndRenderInfo(builder); + } + + public static void StartRenderInfo(FlatBufferBuilder builder) { builder.StartObject(4); } + public static void AddUnknown1(FlatBufferBuilder builder, uint Unknown1) { builder.AddUint(0, Unknown1, 0); } + public static void AddUnknown2(FlatBufferBuilder builder, uint Unknown2) { builder.AddUint(1, Unknown2, 0); } + public static void AddUnknown3(FlatBufferBuilder builder, Offset Unknown3Offset) { builder.AddOffset(2, Unknown3Offset.Value, 0); } + public static void AddUnknown4(FlatBufferBuilder builder, Offset Unknown4Offset) { builder.AddOffset(3, Unknown4Offset.Value, 0); } + public static Offset EndRenderInfo(FlatBufferBuilder builder) + { + int o = builder.EndObject(); + return new Offset(o); + } + }; + + public struct RenderUnknown : IFlatbufferObject + { + private Table __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public static RenderUnknown GetRootAsRenderUnknown(ByteBuffer _bb) { return GetRootAsRenderUnknown(_bb, new RenderUnknown()); } + public static RenderUnknown GetRootAsRenderUnknown(ByteBuffer _bb, RenderUnknown obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public RenderUnknown __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public uint Unknown { get { int o = __p.__offset(4); return o != 0 ? __p.bb.GetUint(o + __p.bb_pos) : (uint)0; } } + + public static Offset CreateRenderUnknown(FlatBufferBuilder builder, + uint Unknown = 0) + { + builder.StartObject(1); + RenderUnknown.AddUnknown(builder, Unknown); + return RenderUnknown.EndRenderUnknown(builder); + } + + public static void StartRenderUnknown(FlatBufferBuilder builder) { builder.StartObject(1); } + public static void AddUnknown(FlatBufferBuilder builder, uint Unknown) { builder.AddUint(0, Unknown, 0); } + public static Offset EndRenderUnknown(FlatBufferBuilder builder) + { + int o = builder.EndObject(); + return new Offset(o); + } + }; + + public struct RenderUnknown2 : IFlatbufferObject + { + private Table __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public static RenderUnknown2 GetRootAsRenderUnknown2(ByteBuffer _bb) { return GetRootAsRenderUnknown2(_bb, new RenderUnknown2()); } + public static RenderUnknown2 GetRootAsRenderUnknown2(ByteBuffer _bb, RenderUnknown2 obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public RenderUnknown2 __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public float Unknown1 { get { int o = __p.__offset(4); return o != 0 ? __p.bb.GetFloat(o + __p.bb_pos) : (float)0.0f; } } + public float Unknown2 { get { int o = __p.__offset(6); return o != 0 ? __p.bb.GetFloat(o + __p.bb_pos) : (float)0.0f; } } + public float Unknown3 { get { int o = __p.__offset(8); return o != 0 ? __p.bb.GetFloat(o + __p.bb_pos) : (float)0.0f; } } + public float Unknown4 { get { int o = __p.__offset(10); return o != 0 ? __p.bb.GetFloat(o + __p.bb_pos) : (float)0.0f; } } + public float Unknown5 { get { int o = __p.__offset(12); return o != 0 ? __p.bb.GetFloat(o + __p.bb_pos) : (float)0.0f; } } + public float Unknown6 { get { int o = __p.__offset(14); return o != 0 ? __p.bb.GetFloat(o + __p.bb_pos) : (float)0.0f; } } + + public static Offset CreateRenderUnknown2(FlatBufferBuilder builder, + float Unknown1 = 0.0f, + float Unknown2 = 0.0f, + float Unknown3 = 0.0f, + float Unknown4 = 0.0f, + float Unknown5 = 0.0f, + float Unknown6 = 0.0f) + { + builder.StartObject(6); + RenderUnknown2.AddUnknown6(builder, Unknown6); + RenderUnknown2.AddUnknown5(builder, Unknown5); + RenderUnknown2.AddUnknown4(builder, Unknown4); + RenderUnknown2.AddUnknown3(builder, Unknown3); + RenderUnknown2.AddUnknown2(builder, Unknown2); + RenderUnknown2.AddUnknown1(builder, Unknown1); + return RenderUnknown2.EndRenderUnknown2(builder); + } + + public static void StartRenderUnknown2(FlatBufferBuilder builder) { builder.StartObject(6); } + public static void AddUnknown1(FlatBufferBuilder builder, float Unknown1) { builder.AddFloat(0, Unknown1, 0.0f); } + public static void AddUnknown2(FlatBufferBuilder builder, float Unknown2) { builder.AddFloat(1, Unknown2, 0.0f); } + public static void AddUnknown3(FlatBufferBuilder builder, float Unknown3) { builder.AddFloat(2, Unknown3, 0.0f); } + public static void AddUnknown4(FlatBufferBuilder builder, float Unknown4) { builder.AddFloat(3, Unknown4, 0.0f); } + public static void AddUnknown5(FlatBufferBuilder builder, float Unknown5) { builder.AddFloat(4, Unknown5, 0.0f); } + public static void AddUnknown6(FlatBufferBuilder builder, float Unknown6) { builder.AddFloat(5, Unknown6, 0.0f); } + public static Offset EndRenderUnknown2(FlatBufferBuilder builder) + { + int o = builder.EndObject(); + return new Offset(o); + } + }; + + public struct BoundingBox : IFlatbufferObject + { + private Struct __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public BoundingBox __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public float MinX { get { return __p.bb.GetFloat(__p.bb_pos + 0); } } + public float MinY { get { return __p.bb.GetFloat(__p.bb_pos + 4); } } + public float MinZ { get { return __p.bb.GetFloat(__p.bb_pos + 8); } } + public float MaxX { get { return __p.bb.GetFloat(__p.bb_pos + 12); } } + public float MaxY { get { return __p.bb.GetFloat(__p.bb_pos + 16); } } + public float MaxZ { get { return __p.bb.GetFloat(__p.bb_pos + 20); } } + + public static Offset CreateBoundingBox(FlatBufferBuilder builder, float MinX, float MinY, float MinZ, float MaxX, float MaxY, float MaxZ) + { + builder.Prep(4, 24); + builder.PutFloat(MaxZ); + builder.PutFloat(MaxY); + builder.PutFloat(MaxX); + builder.PutFloat(MinZ); + builder.PutFloat(MinY); + builder.PutFloat(MinX); + return new Offset(builder.Offset); + } + }; + + public struct Vector3 : IFlatbufferObject + { + private Struct __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public Vector3 __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public float X { get { return __p.bb.GetFloat(__p.bb_pos + 0); } } + public float Y { get { return __p.bb.GetFloat(__p.bb_pos + 4); } } + public float Z { get { return __p.bb.GetFloat(__p.bb_pos + 8); } } + + public static Offset CreateVector3(FlatBufferBuilder builder, float X, float Y, float Z) + { + builder.Prep(4, 12); + builder.PutFloat(Z); + builder.PutFloat(Y); + builder.PutFloat(X); + return new Offset(builder.Offset); + } + }; + + public struct ColorRGB32 : IFlatbufferObject + { + private Struct __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public ColorRGB32 __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public float R { get { return __p.bb.GetFloat(__p.bb_pos + 0); } } + public float G { get { return __p.bb.GetFloat(__p.bb_pos + 4); } } + public float B { get { return __p.bb.GetFloat(__p.bb_pos + 8); } } + + public static Offset CreateColorRGB32(FlatBufferBuilder builder, float R, float G, float B) + { + builder.Prep(4, 12); + builder.PutFloat(B); + builder.PutFloat(G); + builder.PutFloat(R); + return new Offset(builder.Offset); + } + }; + + public struct Vector4 : IFlatbufferObject + { + private Struct __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public Vector4 __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public float X { get { return __p.bb.GetFloat(__p.bb_pos + 0); } } + public float Y { get { return __p.bb.GetFloat(__p.bb_pos + 4); } } + public float Z { get { return __p.bb.GetFloat(__p.bb_pos + 8); } } + public float W { get { return __p.bb.GetFloat(__p.bb_pos + 12); } } + + public static Offset CreateVector4(FlatBufferBuilder builder, float X, float Y, float Z, float W) + { + builder.Prep(4, 16); + builder.PutFloat(W); + builder.PutFloat(Z); + builder.PutFloat(Y); + builder.PutFloat(X); + return new Offset(builder.Offset); + } + }; + + +} diff --git a/File_Format_Library/FileFormats/Pokemon/GFBMDL/GFBMDL.cs b/File_Format_Library/FileFormats/Pokemon/GFBMDL/GFBMDL.cs index be7afb56..d5ed697e 100644 --- a/File_Format_Library/FileFormats/Pokemon/GFBMDL/GFBMDL.cs +++ b/File_Format_Library/FileFormats/Pokemon/GFBMDL/GFBMDL.cs @@ -49,40 +49,101 @@ namespace FirstPlugin bool DrawablesLoaded = false; - public override void OnClick(TreeView treeView) + public override void OnClick(TreeView treeView) { + LoadEditor(); + } + + public T LoadEditor() where T : UserControl, new() { + T control = new T(); + control.Dock = DockStyle.Fill; + ViewportEditor editor = (ViewportEditor)LibraryGUI.GetActiveContent(typeof(ViewportEditor)); - bool HasModels = DrawableContainer.Drawables.Count > 0; if (editor == null) { - editor = new ViewportEditor(HasModels); + editor = new ViewportEditor(true); editor.Dock = DockStyle.Fill; LibraryGUI.LoadEditor(editor); } - if (!DrawablesLoaded) { ObjectEditor.AddContainer(DrawableContainer); DrawablesLoaded = true; } - if (Runtime.UseOpenGL) editor.LoadViewport(DrawableContainer); + + editor.LoadEditor(control); + + return control; } - public Header header; public GFBMDL_Render Renderer; public DrawableContainer DrawableContainer = new DrawableContainer(); + public GFLXModel Model; + public void Load(System.IO.Stream stream) { + CanSave = false; + Text = FileName; DrawableContainer.Name = FileName; Renderer = new GFBMDL_Render(); + DrawableContainer.Drawables.Add(Renderer); - header = new Header(); - header.Read(new FileReader(stream), this); + Model = new GFLXModel(); + Model.LoadFile(FlatBuffers.Gfbmdl.Model.GetRootAsModel( + new FlatBuffers.ByteBuffer(stream.ToBytes())),this, Renderer); + + TreeNode SkeletonWrapper = new TreeNode("Skeleton"); + TreeNode MaterialFolderWrapper = new TreeNode("Materials"); + TreeNode VisualGroupWrapper = new TreeNode("Visual Groups"); + TreeNode Textures = new TreeNode("Textures"); + + if (Model.Skeleton.bones.Count > 0) + { + Nodes.Add(SkeletonWrapper); + DrawableContainer.Drawables.Add(Model.Skeleton); + + foreach (var bone in Model.Skeleton.bones) { + if (bone.Parent == null) + SkeletonWrapper.Nodes.Add(bone); + } + } + + for (int i = 0; i < Model.Textures.Count; i++) + { + foreach (var bntx in PluginRuntime.bntxContainers) + { + if (bntx.Textures.ContainsKey(Model.Textures[i])) + { + TreeNode tex = new TreeNode(Model.Textures[i]); + tex.ImageKey = "texture"; + tex.SelectedImageKey = "texture"; + + tex.Tag = bntx.Textures[Model.Textures[i]]; + Textures.Nodes.Add(tex); + } + } + } + + Nodes.Add(MaterialFolderWrapper); + Nodes.Add(VisualGroupWrapper); + if (Textures.Nodes.Count > 0) + Nodes.Add(Textures); + + for (int i = 0; i < Model.GenericMaterials.Count; i++) + MaterialFolderWrapper.Nodes.Add(Model.GenericMaterials[i]); + + for (int i = 0; i < Model.GenericMeshes.Count; i++) + VisualGroupWrapper.Nodes.Add(Model.GenericMeshes[i]); + } + + public void Save(System.IO.Stream stream) + { + Model.SaveFile(stream); } public ToolStripItem[] GetContextMenuItems() @@ -107,1269 +168,19 @@ namespace FirstPlugin public void ExportModel(string fileName, DAE.ExportSettings settings) { var model = new STGenericModel(); - model.Materials = header.GenericMaterials; - model.Objects = Renderer.Meshes; + model.Materials = Model.GenericMaterials; + model.Objects = Model.GenericMeshes; var textures = new List(); foreach (var bntx in PluginRuntime.bntxContainers) foreach (var tex in bntx.Textures.Values) textures.Add(tex); - DAE.Export(fileName, settings, model, textures, ((STSkeleton)DrawableContainer.Drawables[0])); + DAE.Export(fileName, settings, model, textures, Model.Skeleton); } public void Unload() { } - - public void Save(System.IO.Stream stream) - { - header.Write(new FileWriter(stream)); - } - - //Todo replace tedius offset handling with a class to store necessary data and methods to execute - //Structure thanks to RTB's script https://www.vg-resource.com/thread-29836.html - //And https://github.com/dragonation/pokemon-switch-model-resolver/blob/master/src/parse.js - public class Header - { - public STSkeleton Skeleton { get; set; } - - public uint Version { get; set; } - public float[] Boundings { get; set; } - public List ShaderNames = new List(); - public List TextureMaps = new List(); - public List MaterialNames = new List(); - public List VertexBuffers = new List(); - public List VisualGroups = new List(); - public List Materials = new List(); - - public List GenericMaterials = new List(); - - public bool IsV2 = false; - - public List SkinningIndices = new List(); - - public void Read(FileReader reader, GFBMDL Root) - { - Skeleton = new STSkeleton(); - Root.DrawableContainer.Drawables.Add(Skeleton); - Root.DrawableContainer.Drawables.Add(Root.Renderer); - - reader.SetByteOrder(false); - - Version = reader.ReadUInt32(); - ushort v2Check = reader.ReadUInt16(); - if (v2Check == 0) - IsV2 = true; - - if (IsV2) - reader.SeekBegin(0x28); - else - reader.SeekBegin(0x2C); - - long TextureOffset = reader.ReadOffset(true, typeof(uint)); - long ShaderNameOffset = reader.ReadOffset(true, typeof(uint)); - long Unknown1ffset = reader.ReadOffset(true, typeof(uint)); - long MaterialNameOffset = reader.ReadOffset(true, typeof(uint)); - long ShaderOffset = reader.ReadOffset(true, typeof(uint)); - long VisGroupOffset = reader.ReadOffset(true, typeof(uint)); - long VerteBufferOffset = reader.ReadOffset(true, typeof(uint)); - long BoneDataOffset = reader.ReadOffset(true, typeof(uint)); - - if (TextureOffset != 0) - { - reader.SeekBegin(TextureOffset); - uint Count = reader.ReadUInt32(); - TextureMaps = reader.ReadNameOffsets(Count, true, typeof(uint), true); - } - - if (ShaderNameOffset != 0) - { - reader.SeekBegin(ShaderNameOffset); - uint Count = reader.ReadUInt32(); - ShaderNames = reader.ReadNameOffsets(Count, true, typeof(uint)); - } - - if (MaterialNameOffset != 0) - { - reader.SeekBegin(MaterialNameOffset); - uint Count = reader.ReadUInt32(); - MaterialNames = reader.ReadNameOffsets(Count, true, typeof(uint)); - } - - - if (ShaderOffset != 0) - { - reader.SeekBegin(ShaderOffset); - uint Count = reader.ReadUInt32(); - for (int i = 0; i < Count; i++) - { - MaterialShaderData shaderData = new MaterialShaderData(); - shaderData.Read(reader); - Materials.Add(shaderData); - } - } - - if (VisGroupOffset != 0) - { - reader.SeekBegin(VisGroupOffset); - uint Count = reader.ReadUInt32(); - for (int i = 0; i < Count; i++) - { - VisGroup visualGroup = new VisGroup(); - visualGroup.Read(reader); - VisualGroups.Add(visualGroup); - } - } - - if (VerteBufferOffset != 0) - { - reader.SeekBegin(VerteBufferOffset); - uint Count = reader.ReadUInt32(); - for (int i = 0; i < Count; i++) - { - VertexBuffer vertexBuffer = new VertexBuffer(); - vertexBuffer.Read(reader); - VertexBuffers.Add(vertexBuffer); - } - } - - if (BoneDataOffset != 0) - { - TreeNode SkeletonWrapper = new TreeNode("Skeleton"); - Root.Nodes.Add(SkeletonWrapper); - - reader.SeekBegin(BoneDataOffset); - uint Count = reader.ReadUInt32(); - for (int i = 0; i < Count; i++) - { - var bone = new Bone(Skeleton); - bone.Read(reader); - if (i == 0) - bone.parentIndex = -1; - else if (bone.parentIndex == -1) - bone.parentIndex = 0; - - Skeleton.bones.Add(bone); - - if (bone.HasSkinning) - SkinningIndices.Add(Skeleton.bones.IndexOf(bone)); - } - - foreach (var bone in Skeleton.bones) - { - if (bone.Parent == null) - SkeletonWrapper.Nodes.Add(bone); - } - } - - TreeNode MaterialFolderWrapper = new TreeNode("Materials"); - Root.Nodes.Add(MaterialFolderWrapper); - - for (int i = 0; i < Materials.Count; i++) - { - GFBMaterial mat = new GFBMaterial(Root, Materials[i]); - mat.Text = Materials[i].Name; - - int textureUnit = 1; - foreach (var textureMap in Materials[i].TextureMaps) - { - textureMap.Name = TextureMaps[(int)textureMap.Index]; - - STGenericMatTexture matTexture = new STGenericMatTexture(); - matTexture.Name = textureMap.Name; - matTexture.textureUnit = textureUnit++; - matTexture.WrapModeS = STTextureWrapMode.Mirror; - matTexture.WrapModeT = STTextureWrapMode.Repeat; - - switch (textureMap.Effect) - { - case "Col0Tex": - matTexture.Type = STGenericMatTexture.TextureType.Diffuse; - break; - case "EmissionMaskTex": - // matTexture.Type = STGenericMatTexture.TextureType.Emission; - break; - case "LyCol0Tex": - break; - case "NormalMapTex": - matTexture.WrapModeT = STTextureWrapMode.Repeat; - matTexture.WrapModeT = STTextureWrapMode.Repeat; - matTexture.Type = STGenericMatTexture.TextureType.Normal; - break; - case "AmbientTex": - break; - case "LightTblTex": - break; - case "SphereMapTex": - break; - case "EffectTex": - break; - } - - Console.WriteLine("texture map " + textureMap.Effect); - - mat.TextureMaps.Add(matTexture); - - if (textureMap.Effect != string.Empty) - mat.Nodes.Add($"{textureMap.Name} ({textureMap.Effect})"); - else - mat.Nodes.Add($"{textureMap.Name}"); - } - - GenericMaterials.Add(mat); - MaterialFolderWrapper.Nodes.Add(mat); - } - - TreeNode VisualGroupWrapper = new TreeNode("Visual Groups"); - Root.Nodes.Add(VisualGroupWrapper); - - for (int i = 0; i < VisualGroups.Count; i++) - { - GFBMesh mesh = new GFBMesh(Root); - mesh.Checked = true; - mesh.ImageKey = "model"; - mesh.SelectedImageKey = "model"; - - int boneIndex = (int)VisualGroups[i].BoneIndex; - if (boneIndex < Skeleton.bones.Count && boneIndex > 0 && ((Bone)Skeleton.bones[boneIndex]).HasSkinning) - mesh.BoneIndex = boneIndex; - - mesh.Text = Skeleton.bones[(int)VisualGroups[i].MeshIndex].Text; - Root.Renderer.Meshes.Add(mesh); - - var Buffer = VertexBuffers[i]; - for (int v= 0; v < Buffer.Positions.Count; v++) - { - Vertex vertex = new Vertex(); - vertex.pos = Buffer.Positions[v]; - - if (Buffer.Normals.Count > 0) - vertex.nrm = Buffer.Normals[v]; - if (Buffer.TexCoord1.Count > 0) - vertex.uv0 = Buffer.TexCoord1[v]; - if (Buffer.TexCoord2.Count > 0) - vertex.uv1 = Buffer.TexCoord2[v]; - if (Buffer.TexCoord3.Count > 0) - vertex.uv2 = Buffer.TexCoord3[v]; - if (Buffer.Weights.Count > 0) - vertex.boneWeights = new List(Buffer.Weights[v]); - if (Buffer.BoneIndex.Count > 0) - { - var boneIndexList = Buffer.BoneIndex[v]; - for (int j = 0; j < boneIndexList.Length; j++) - vertex.boneIds.Add(SkinningIndices[boneIndexList[j]]); - } - if (Buffer.Colors1.Count > 0) - vertex.col = Buffer.Colors1[v] / 255f; - if (Buffer.Binormals.Count > 0) - vertex.bitan = Buffer.Binormals[v]; - - mesh.vertices.Add(vertex); - } - - mesh.FlipUvsVertical(); - - int polyIndex = 0; - foreach (var group in Buffer.PolygonGroups) - { - TreeNode polyWrapper = new TreeNode($"Polygon Group {polyIndex++}"); - polyWrapper.ImageKey = "mesh"; - polyWrapper.SelectedImageKey = "mesh"; - - var polygonGroup = new STGenericPolygonGroup(); - polygonGroup.faces = group.Faces.ToList(); - polygonGroup.MaterialIndex = group.MaterialID; - mesh.PolygonGroups.Add(polygonGroup); - - mesh.Nodes.Add(polyWrapper); - } - - VisualGroupWrapper.Nodes.Add(mesh); - } - - - Skeleton.update(); - Skeleton.reset(); - } - - public void Write(FileWriter writer) - { - writer.Write(Version); - } - } - - public class VisGroup - { - public Vector3 BoundingBoxMax = new Vector3(0); - public Vector3 BoundingBoxMin = new Vector3(0); - - public uint BoneIndex { get; set; } - public uint MeshIndex { get; set; } - - public void Read(FileReader reader) - { - long DataPosition = reader.Position; - var DataOffset = reader.ReadOffset(true, typeof(uint)); - - reader.SeekBegin(DataOffset); - long InfoPosition = reader.Position; - - int InfoOffset = reader.ReadInt32(); - - //Read the info section for position data - reader.SeekBegin(InfoPosition - InfoOffset); - ushort HeaderLength = reader.ReadUInt16(); - ushort VisBonePosition = 0; - ushort VisMeshPosition = 0; - ushort Unknown2Position = 0; - ushort VisBoundsPosition = 0; - ushort Unknown3Position = 0; - - if (HeaderLength == 0x0A) - { - VisBonePosition = reader.ReadUInt16(); - VisMeshPosition = reader.ReadUInt16(); - VisBoundsPosition = reader.ReadUInt16(); - Unknown2Position = reader.ReadUInt16(); - } - else if (HeaderLength == 0x0C) - { - VisBonePosition = reader.ReadUInt16(); - VisMeshPosition = reader.ReadUInt16(); - VisBoundsPosition = reader.ReadUInt16(); - Unknown2Position = reader.ReadUInt16(); - Unknown3Position = reader.ReadUInt16(); - } - else - throw new Exception("Unexpected Header Length! " + HeaderLength); - - if (VisBoundsPosition != 0) - { - reader.SeekBegin(InfoPosition + VisBoundsPosition); - BoundingBoxMin = reader.ReadVec3(); - BoundingBoxMax = reader.ReadVec3(); - } - - if (VisMeshPosition != 0) - { - reader.SeekBegin(InfoPosition + VisMeshPosition); - MeshIndex = reader.ReadUInt32(); - } - - if (VisBonePosition != 0) - { - reader.SeekBegin(InfoPosition + VisBonePosition); - BoneIndex = reader.ReadUInt32(); - } - - //Seek back to next in array - reader.SeekBegin(DataPosition + sizeof(uint)); - } - } - - public class MaterialShaderData - { - public string Name { get; set; } - public string ShaderName { get; set; } - - public List TextureMaps = new List(); - - public Dictionary SwitchParams = new Dictionary(); - public Dictionary ValueParams = new Dictionary(); - public Dictionary ColorParams = new Dictionary(); - - public void Read(FileReader reader) - { - long DataPosition = reader.Position; - var DataOffset = reader.ReadOffset(true, typeof(uint)); - - reader.SeekBegin(DataOffset); - long InfoPosition = reader.Position; - - int InfoOffset = reader.ReadInt32(); - - //Read the info section for position data - reader.SeekBegin(InfoPosition - InfoOffset); - ushort HeaderLength = reader.ReadUInt16(); - ushort ShaderPropertyPosition = reader.ReadUInt16(); - ushort MaterialStringNamePosition = reader.ReadUInt16(); - ushort ShaderStringNamePosition = reader.ReadUInt16(); - ushort Unknown1Position = reader.ReadUInt16(); - ushort Unknown2Position = reader.ReadUInt16(); - ushort Unknown3Position = reader.ReadUInt16(); - ushort ShaderParam1Position = reader.ReadUInt16(); - ushort ShaderParam2Position = reader.ReadUInt16(); - ushort ShaderParam3Position = reader.ReadUInt16(); - ushort ShaderParam4Position = reader.ReadUInt16(); - ushort ShaderParam5Position = reader.ReadUInt16(); - ushort ShaderParam6Position = reader.ReadUInt16(); - ushort TextureMapsPosition = reader.ReadUInt16(); - ushort ShaderParamAPosition = reader.ReadUInt16(); - ushort ShaderParamBPosition = reader.ReadUInt16(); - ushort ShaderParamCPosition = reader.ReadUInt16(); - ushort Unknown4Position = reader.ReadUInt16(); - ushort Unknown5Position = reader.ReadUInt16(); - ushort Unknown6Position = reader.ReadUInt16(); - ushort Unknown7Position = reader.ReadUInt16(); - ushort Unknown8Position = reader.ReadUInt16(); - ushort ShaderProperty2Position = reader.ReadUInt16(); - - if (MaterialStringNamePosition != 0) - { - reader.SeekBegin(InfoPosition + MaterialStringNamePosition); - Name = reader.ReadNameOffset(true, typeof(uint), true); - } - - if (ShaderStringNamePosition != 0) - { - reader.SeekBegin(InfoPosition + ShaderStringNamePosition); - ShaderName = reader.ReadNameOffset(true, typeof(uint), true); - } - - Console.WriteLine($"MAT Name {Name}"); - Console.WriteLine($"ShaderName {ShaderName}"); - - if (ShaderParamAPosition != 0) - { - reader.SeekBegin(InfoPosition + ShaderParamAPosition); - var ParamOffset = reader.ReadOffset(true, typeof(uint)); - reader.SeekBegin(ParamOffset); - - uint Count = reader.ReadUInt32(); - for (int i = 0; i < Count; i++) - { - SwitchParam param = new SwitchParam(); - param.ReadParam(reader); - SwitchParams.Add(param.Name, param); - } - } - - if (ShaderParamBPosition != 0) - { - reader.SeekBegin(InfoPosition + ShaderParamBPosition); - var ParamOffset = reader.ReadOffset(true, typeof(uint)); - reader.SeekBegin(ParamOffset); - - uint Count = reader.ReadUInt32(); - for (int i = 0; i < Count; i++) - { - ValueParam param = new ValueParam(); - param.ReadParam(reader); - ValueParams.Add(param.Name, param); - } - } - - - if (ShaderParamCPosition != 0) - { - reader.SeekBegin(InfoPosition + ShaderParamCPosition); - var ParamOffset = reader.ReadOffset(true, typeof(uint)); - reader.SeekBegin(ParamOffset); - - uint Count = reader.ReadUInt32(); - for (int i = 0; i < Count; i++) - { - ColorParam param = new ColorParam(); - param.ReadParam(reader); - ColorParams.Add(param.Name, param); - } - } - - - if (TextureMapsPosition != 0) - { - reader.SeekBegin(InfoPosition + TextureMapsPosition); - var TextureMapOffset = reader.ReadOffset(true, typeof(uint)); - reader.SeekBegin(TextureMapOffset); - - uint Count = reader.ReadUInt32(); - for (int i = 0; i < Count; i++) - { - TextureMap textureMap = new TextureMap(); - textureMap.Read(reader); - TextureMaps.Add(textureMap); - } - } - - //Seek back to next in array - reader.SeekBegin(DataPosition + sizeof(uint)); - } - } - - public class ColorParam : BaseParam - { - public void ReadParam(FileReader reader) - { - base.Read(reader); - - if (ValuePosition != 0) - { - reader.SeekBegin(InfoPosition + ValuePosition); - if (Format == 4) - Value = new Vector3(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()); - else if (Format == 8) - Value = new Vector3(reader.ReadUInt32(), reader.ReadUInt32(), reader.ReadUInt32()); - else - throw new Exception("Unknown format for switch param! " + Format); - } - else - Value = 0; - - Console.WriteLine($"Param {Name} {Value}"); - - //Seek back to next in array - reader.SeekBegin(DataPosition + sizeof(uint)); - } - } - - public class ValueParam : BaseParam - { - public void ReadParam(FileReader reader) - { - base.Read(reader); - - if (ValuePosition != 0) - { - reader.SeekBegin(InfoPosition + ValuePosition); - if (Format == 4) - Value = reader.ReadUInt32(); - else if (Format == 8) - Value = reader.ReadSingle(); - else - throw new Exception("Unknown format for switch param! " + Format); - } - else - Value = 0; - - //Seek back to next in array - reader.SeekBegin(DataPosition + sizeof(uint)); - } - } - - public class SwitchParam : BaseParam - { - public void ReadParam(FileReader reader) - { - base.Read(reader); - - if (ValuePosition != 0) - { - reader.SeekBegin(InfoPosition + ValuePosition); - if (Format == 4) - Value = (reader.ReadByte() == 1); - else - throw new Exception("Unknown format for switch param! " + Format); - } - else - Value = false; - - Console.WriteLine($"SwitchParam {Name} {Value}"); - - //Seek back to next in array - reader.SeekBegin(DataPosition + sizeof(uint)); - } - } - - public class BaseParam - { - public string Effect { get; set; } - public string Name { get; set; } - - public uint Index { get; set; } = 0; - - public uint Format { get; set; } - - public object Value { get; set; } - - internal long DataPosition; - internal long InfoPosition; - - internal ushort NamePosition; - internal ushort FormatPosition; - internal ushort ValuePosition; - - public void Read(FileReader reader) - { - DataPosition = reader.Position; - var DataOffset = reader.ReadOffset(true, typeof(uint)); - - reader.SeekBegin(DataOffset); - InfoPosition = reader.Position; - int InfoOffset = reader.ReadInt32(); - - //Read the info section for position data - reader.SeekBegin(InfoPosition - InfoOffset); - ushort HeaderSize = reader.ReadUInt16(); - NamePosition = 0; - FormatPosition = 0; - ValuePosition = 0; - - if (HeaderSize == 0x06) - { - NamePosition = reader.ReadUInt16(); - FormatPosition = reader.ReadUInt16(); - } - else if (HeaderSize == 0x08) - { - NamePosition = reader.ReadUInt16(); - FormatPosition = reader.ReadUInt16(); - ValuePosition = reader.ReadUInt16(); - } - else - throw new Exception("Unexpected header size! " + HeaderSize); - - if (NamePosition != 0) - { - reader.SeekBegin(InfoPosition + NamePosition); - uint NameLength = reader.ReadUInt32(); - Name = reader.ReadString((int)NameLength); - } - - if (FormatPosition != 0) - { - reader.SeekBegin(InfoPosition + FormatPosition); - Format = reader.ReadUInt32(); - } - } - } - - public class TextureMap - { - public string Effect { get; set; } - public string Name { get; set; } - - public uint Index { get; set; } = 0; - - public void Read(FileReader reader) - { - long DataPosition = reader.Position; - var DataOffset = reader.ReadOffset(true, typeof(uint)); - - reader.SeekBegin(DataOffset); - long InfoPosition = reader.Position; - int InfoOffset = reader.ReadInt32(); - - //Read the info section for position data - reader.SeekBegin(InfoPosition - InfoOffset); - ushort HeaderSize = reader.ReadUInt16(); - ushort EffectPosition = 0; - ushort UnknownPosition = 0; - ushort IdPosition = 0; - ushort UnknownPosition2 = 0; - - if (HeaderSize == 0x0A) - { - EffectPosition = reader.ReadUInt16(); - UnknownPosition = reader.ReadUInt16(); - IdPosition = reader.ReadUInt16(); - UnknownPosition2 = reader.ReadUInt16(); - } - else - throw new Exception("Unexpected header size! " + HeaderSize); - - if (EffectPosition != 0) - { - reader.SeekBegin(InfoPosition + EffectPosition); - uint NameLength = reader.ReadUInt32(); - Effect = reader.ReadString((int)NameLength); - } - - if (IdPosition != 0) - { - reader.SeekBegin(InfoPosition + IdPosition); - Index = reader.ReadUInt32(); - } - - //Seek back to next in array - reader.SeekBegin(DataPosition + sizeof(uint)); - } - } - - public class VertexBuffer - { - public List Attributes = new List(); - public List PolygonGroups = new List(); - - public List Positions = new List(); - public List Normals = new List(); - public List TexCoord1 = new List(); - public List TexCoord2 = new List(); - public List TexCoord3 = new List(); - public List TexCoord4 = new List(); - public List BoneIndex = new List(); - public List Weights = new List(); - public List Colors1 = new List(); - public List Colors2 = new List(); - public List Binormals = new List(); - - public void Read(FileReader reader) - { - long DataPosition = reader.Position; - var VertexBufferDataOffset = reader.ReadOffset(true, typeof(uint)); - - reader.SeekBegin(VertexBufferDataOffset); - long InfoPosition = reader.Position; - int InfoOffset = reader.ReadInt32(); - - //Read the info section for position data - reader.SeekBegin(InfoPosition - InfoOffset); - ushort InfoSize = reader.ReadUInt16(); - ushort VerticesPosition = 0; - ushort FacesPosition = 0; - ushort AttributeInfoPosition = 0; - ushort BufferUnknownPosition = 0; - - if (InfoSize == 0x0A) - { - BufferUnknownPosition = reader.ReadUInt16(); - FacesPosition = reader.ReadUInt16(); - AttributeInfoPosition = reader.ReadUInt16(); - VerticesPosition = reader.ReadUInt16(); - } - else - throw new Exception("Unexpected Vertex Buffer Info Header Size! " + InfoSize); - - uint VertBufferStride = 0; - - if (AttributeInfoPosition != 0) - { - reader.SeekBegin(InfoPosition + AttributeInfoPosition); - var AttributeOffset = reader.ReadOffset(true, typeof(uint)); - - reader.SeekBegin(AttributeOffset); - uint AttributeCount = reader.ReadUInt32(); - - for (int i = 0; i < AttributeCount; i++) - { - var attribute = new VertexAttribute(); - attribute.Read(reader); - Attributes.Add(attribute); - - switch (attribute.Type) - { - case VertexAttribute.BufferType.Position: - if (attribute.Format == VertexAttribute.BufferFormat.HalfFloat) - VertBufferStride += 0x08; - else if (attribute.Format == VertexAttribute.BufferFormat.Float) - VertBufferStride += 0x0C; - else - throw new Exception($"Unknown Combination! {attribute.Type} {attribute.Format}"); - break; - case VertexAttribute.BufferType.Normal: - if (attribute.Format == VertexAttribute.BufferFormat.HalfFloat) - VertBufferStride += 0x08; - else if (attribute.Format == VertexAttribute.BufferFormat.Float) - VertBufferStride += 0x0C; - else - throw new Exception($"Unknown Combination! {attribute.Type} {attribute.Format}"); - break; - case VertexAttribute.BufferType.Binormal: - if (attribute.Format == VertexAttribute.BufferFormat.HalfFloat) - VertBufferStride += 0x08; - else if (attribute.Format == VertexAttribute.BufferFormat.Float) - VertBufferStride += 0x0C; - else - throw new Exception($"Unknown Combination! {attribute.Type} {attribute.Format}"); - break; - case VertexAttribute.BufferType.TexCoord1: - case VertexAttribute.BufferType.TexCoord2: - case VertexAttribute.BufferType.TexCoord3: - case VertexAttribute.BufferType.TexCoord4: - if (attribute.Format == VertexAttribute.BufferFormat.HalfFloat) - VertBufferStride += 0x04; - else if (attribute.Format == VertexAttribute.BufferFormat.Float) - VertBufferStride += 0x08; - else - throw new Exception($"Unknown Combination! {attribute.Type} {attribute.Format}"); - break; - case VertexAttribute.BufferType.Color1: - case VertexAttribute.BufferType.Color2: - if (attribute.Format == VertexAttribute.BufferFormat.Byte) - VertBufferStride += 0x04; - else - throw new Exception($"Unknown Combination! {attribute.Type} {attribute.Format}"); - break; - case VertexAttribute.BufferType.BoneIndex: - if (attribute.Format == VertexAttribute.BufferFormat.Short) - VertBufferStride += 0x08; - else if (attribute.Format == VertexAttribute.BufferFormat.Byte) - VertBufferStride += 0x04; - else - throw new Exception($"Unknown Combination! {attribute.Type} {attribute.Format}"); - break; - case VertexAttribute.BufferType.Weights: - if (attribute.Format == VertexAttribute.BufferFormat.BytesAsFloat) - VertBufferStride += 0x04; - else - throw new Exception($"Unknown Combination! {attribute.Type} {attribute.Format}"); - break; - case VertexAttribute.BufferType.Unknown1: - case VertexAttribute.BufferType.Unknown2: - Console.WriteLine($"attribute.Format {attribute.Format}"); - if (attribute.Format == VertexAttribute.BufferFormat.HalfFloat) - VertBufferStride += 0x08; - else if (attribute.Format == VertexAttribute.BufferFormat.Float) - VertBufferStride += 0x0C; - else - throw new Exception($"Unknown Combination! {attribute.Type} {attribute.Format}"); - break; - } - - Console.WriteLine($"{attribute.Format} {attribute.Type} VertBufferStride {VertBufferStride}"); - } - } - - if (FacesPosition != 0) - { - reader.SeekBegin(InfoPosition + FacesPosition); - var BufferOffset = reader.ReadOffset(true, typeof(uint)); - - reader.SeekBegin(BufferOffset); - uint GroupCount = reader.ReadUInt32(); - - for (int i = 0; i < GroupCount; i++) - { - var polygonGroup = new PolygonGroup(); - polygonGroup.Read(reader); - PolygonGroups.Add(polygonGroup); - } - } - - if (VerticesPosition != 0) - { - reader.SeekBegin(InfoPosition + VerticesPosition); - var VertexOffset = reader.ReadOffset(true, typeof(uint)); - - reader.SeekBegin(VertexOffset); - uint VertexBufferSize = reader.ReadUInt32(); - - for (int v = 0; v < VertexBufferSize / VertBufferStride; v++) - { - for (int att = 0; att < Attributes.Count; att++) - { - switch (Attributes[att].Type) - { - case VertexAttribute.BufferType.Position: - var pos = ParseBuffer(reader, Attributes[att].Format, Attributes[att].Type); - Positions.Add(new Vector3(pos.X, pos.Y, pos.Z)); - break; - case VertexAttribute.BufferType.Normal: - var normal = ParseBuffer(reader, Attributes[att].Format, Attributes[att].Type); - Normals.Add(new Vector3(normal.X, normal.Y, normal.Z)); - break; - case VertexAttribute.BufferType.TexCoord1: - var texcoord1 = ParseBuffer(reader, Attributes[att].Format, Attributes[att].Type); - TexCoord1.Add(new Vector2(texcoord1.X, texcoord1.Y)); - break; - case VertexAttribute.BufferType.TexCoord2: - var texcoord2 = ParseBuffer(reader, Attributes[att].Format, Attributes[att].Type); - TexCoord2.Add(new Vector2(texcoord2.X, texcoord2.Y)); - break; - case VertexAttribute.BufferType.TexCoord3: - var texcoord3 = ParseBuffer(reader, Attributes[att].Format, Attributes[att].Type); - TexCoord3.Add(new Vector2(texcoord3.X, texcoord3.Y)); - break; - case VertexAttribute.BufferType.TexCoord4: - var texcoord4 = ParseBuffer(reader, Attributes[att].Format, Attributes[att].Type); - TexCoord4.Add(new Vector2(texcoord4.X, texcoord4.Y)); - break; - case VertexAttribute.BufferType.Weights: - var weights = ParseBuffer(reader, Attributes[att].Format, Attributes[att].Type); - Weights.Add(new float[] { weights.X, weights.Y, weights.Z, weights.W }); - break; - case VertexAttribute.BufferType.BoneIndex: - var boneIndices = ParseBuffer(reader, Attributes[att].Format, Attributes[att].Type); - BoneIndex.Add(new int[] { (int)boneIndices.X, (int)boneIndices.Y, (int)boneIndices.Z, (int)boneIndices.W }); - break; - case VertexAttribute.BufferType.Color1: - Vector4 colors1 = new Vector4(1, 1, 1, 1); - if (Attributes[att].Format == VertexAttribute.BufferFormat.Byte) - colors1 = ParseBuffer(reader, Attributes[att].Format, Attributes[att].Type); - - Colors1.Add(new Vector4(colors1.X, colors1.Y, colors1.Z, colors1.W)); - break; - case VertexAttribute.BufferType.Color2: - Vector4 colors2 = new Vector4(1,1,1,1); - if (Attributes[att].Format == VertexAttribute.BufferFormat.Byte) - colors2 = ParseBuffer(reader, Attributes[att].Format, Attributes[att].Type); - - Colors2.Add(new Vector4(colors2.X, colors2.Y, colors2.Z, colors2.W)); - break; - case VertexAttribute.BufferType.Binormal: - var binormals = ParseBuffer(reader, Attributes[att].Format, Attributes[att].Type); - Binormals.Add(new Vector4(binormals.X, binormals.Y, binormals.Z, binormals.W)); - break; - case VertexAttribute.BufferType.Unknown1: - ParseBuffer(reader, Attributes[att].Format, Attributes[att].Type); - break; - case VertexAttribute.BufferType.Unknown2: - ParseBuffer(reader, Attributes[att].Format, Attributes[att].Type); - break; - } - } - - } - } - - - - //Seek back to next in array - reader.SeekBegin(DataPosition + sizeof(uint)); - } - - private Vector4 ParseBuffer(FileReader reader, VertexAttribute.BufferFormat Format, VertexAttribute.BufferType AttributeType) - { - if (AttributeType == VertexAttribute.BufferType.Position) - { - switch (Format) - { - case VertexAttribute.BufferFormat.Float: - return new Vector4(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), 0); - case VertexAttribute.BufferFormat.HalfFloat: - return new Vector4(reader.ReadHalfSingle(), reader.ReadHalfSingle(), - reader.ReadHalfSingle(), reader.ReadHalfSingle()); - default: - throw new Exception($"Unknown Combination! {AttributeType} {Format}"); - } - } - else if (AttributeType == VertexAttribute.BufferType.Normal) - { - switch (Format) - { - case VertexAttribute.BufferFormat.Float: - return new Vector4(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), 0); - case VertexAttribute.BufferFormat.HalfFloat: - return new Vector4(reader.ReadHalfSingle(), reader.ReadHalfSingle(), - reader.ReadHalfSingle(), reader.ReadHalfSingle()); - default: - throw new Exception($"Unknown Combination! {AttributeType} {Format}"); - } - } - else if (AttributeType == VertexAttribute.BufferType.Binormal) - { - switch (Format) - { - case VertexAttribute.BufferFormat.Float: - return new Vector4(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), 0); - case VertexAttribute.BufferFormat.HalfFloat: - return new Vector4(reader.ReadHalfSingle(), reader.ReadHalfSingle(), - reader.ReadHalfSingle(), reader.ReadHalfSingle()); - default: - throw new Exception($"Unknown Combination! {AttributeType} {Format}"); - } - } - else if (AttributeType == VertexAttribute.BufferType.TexCoord1 || - AttributeType == VertexAttribute.BufferType.TexCoord2 || - AttributeType == VertexAttribute.BufferType.TexCoord3 || - AttributeType == VertexAttribute.BufferType.TexCoord4) - { - switch (Format) - { - case VertexAttribute.BufferFormat.Float: - return new Vector4(reader.ReadSingle(), reader.ReadSingle(), 0, 0); - case VertexAttribute.BufferFormat.HalfFloat: - return new Vector4(reader.ReadHalfSingle(), reader.ReadHalfSingle(), 0, 0); - default: - throw new Exception($"Unknown Combination! {AttributeType} {Format}"); - } - } - else if (AttributeType == VertexAttribute.BufferType.Color1 || - AttributeType == VertexAttribute.BufferType.Color2) - { - switch (Format) - { - case VertexAttribute.BufferFormat.Byte: - return new Vector4(reader.ReadByte(), reader.ReadByte(), reader.ReadByte(), reader.ReadByte()); - default: - throw new Exception($"Unknown Combination! {AttributeType} {Format}"); - } - } - else if (AttributeType == VertexAttribute.BufferType.BoneIndex) - { - switch (Format) - { - case VertexAttribute.BufferFormat.Short: - return new Vector4(reader.ReadInt16(), reader.ReadInt16(), reader.ReadInt16(), reader.ReadInt16()); - case VertexAttribute.BufferFormat.Byte: - return new Vector4(reader.ReadByte(), reader.ReadByte(), reader.ReadByte(), reader.ReadByte()); - default: - throw new Exception($"Unknown Combination! {AttributeType} {Format}"); - } - } - else if (AttributeType == VertexAttribute.BufferType.Weights) - { - switch (Format) - { - case VertexAttribute.BufferFormat.BytesAsFloat: - return new Vector4(reader.ReadByteAsFloat(), reader.ReadByteAsFloat(), - reader.ReadByteAsFloat(), reader.ReadByteAsFloat()); - default: - throw new Exception($"Unknown Combination! {AttributeType} {Format}"); - } - } - else if (AttributeType == VertexAttribute.BufferType.Unknown1 || - AttributeType == VertexAttribute.BufferType.Unknown2) - { - switch (Format) - { - case VertexAttribute.BufferFormat.HalfFloat: - return new Vector4(reader.ReadHalfSingle(), reader.ReadHalfSingle(), - reader.ReadHalfSingle(), reader.ReadHalfSingle()); - default: - throw new Exception($"Unknown Combination! {AttributeType} {Format}"); - } - } - - return new Vector4(0); - } - } - - //Represents an offset which points to another - public class OffsetInfo - { - - } - - public class PolygonGroup - { - public int MaterialID { get; set; } - public int[] Faces { get; set; } - - public void Read(FileReader reader) - { - long DataPosition = reader.Position; - var DataOffset = reader.ReadOffset(true, typeof(uint)); - - reader.SeekBegin(DataOffset); - long InfoPosition = reader.Position; - - int InfoOffset = reader.ReadInt32(); - - //Read the info section for position data - reader.SeekBegin(InfoPosition - InfoOffset); - ushort PolygonHeaderSize = reader.ReadUInt16(); - ushort PolygonStartPosition = 0; - ushort PolgonMaterialId = 0; - ushort PolygonUnknown = 0; - - if (PolygonHeaderSize == 0x08) - { - PolygonStartPosition = reader.ReadUInt16(); - PolgonMaterialId = reader.ReadUInt16(); - PolygonUnknown = reader.ReadUInt16(); - } - else - throw new Exception("Unexpected Polygon Buffer Info Header Size! " + PolygonHeaderSize); - - if (PolgonMaterialId != 0) - { - reader.SeekBegin(InfoPosition + PolgonMaterialId); - MaterialID = reader.ReadInt32(); - } - - if (PolygonStartPosition != 0) - { - reader.SeekBegin(InfoPosition + PolygonStartPosition); - uint FaceCount = reader.ReadUInt32(); - Faces = new int[FaceCount]; - for (int i = 0; i < FaceCount; i++) - Faces[i] = reader.ReadUInt16(); - } - - //Seek back to next in array - reader.SeekBegin(DataPosition + sizeof(uint)); - } - } - - public class VertexAttribute - { - public BufferFormat Format { get; set; } = BufferFormat.Float; - public BufferType Type { get; set; } = BufferType.Position; - - public enum BufferType - { - Position = 0, - Normal = 1, - Binormal = 2, - TexCoord1 = 3, - TexCoord2 = 4, - TexCoord3 = 5, - TexCoord4 = 6, - Color1 = 7, - Color2 = 8, - BoneIndex = 11, - Weights = 12, - Unknown1 = 13, - Unknown2 = 14, - } - - public enum BufferFormat - { - Float = 0, - HalfFloat = 1, - Byte = 3, - Short = 5, - BytesAsFloat = 8, - } - - public void Read(FileReader reader) - { - long DataPosition = reader.Position; - var DataOffset = reader.ReadOffset(true, typeof(uint)); - - reader.SeekBegin(DataOffset); - long InfoPosition = reader.Position; - int InfoOffset = reader.ReadInt32(); - - //Read the info section for position data - reader.SeekBegin(InfoPosition - InfoOffset); - ushort LayoutHeaderLength = reader.ReadUInt16(); - ushort LayoutSizePosition = 0; - ushort LayoutTypePosition = 0; - ushort LayoutFormatPosition = 0; - ushort LayoutUnknownPosition = 0; - - if (LayoutHeaderLength == 0x0A) - { - LayoutSizePosition = reader.ReadUInt16(); - LayoutTypePosition = reader.ReadUInt16(); - LayoutFormatPosition = reader.ReadUInt16(); - LayoutUnknownPosition = reader.ReadUInt16(); - } - else - throw new Exception("Unexpected Attribute Layout Header Size! " + LayoutHeaderLength); - - if (LayoutFormatPosition != 0) - { - reader.SeekBegin(InfoPosition + LayoutFormatPosition); - Format = reader.ReadEnum(true); - } - - if (LayoutTypePosition != 0) - { - reader.SeekBegin(InfoPosition + LayoutTypePosition); - Type = reader.ReadEnum(true); - - Console.WriteLine($"Type {Type}"); - } - - //Seek back to next in array - reader.SeekBegin(DataPosition + sizeof(uint)); - } - } - - public class Bone : STBone - { - internal BoneInfo BoneInfo { get; set; } - - public Bone(STSkeleton skeleton) : base(skeleton) { } - - public bool HasSkinning = false; - - public void Read(FileReader reader) - { - long DataPosition = reader.Position; - var BoneDataOffset = reader.ReadOffset(true, typeof(uint)); - - reader.SeekBegin(BoneDataOffset); - long InfoPosition = reader.Position; - - int BoneInfoOffset = reader.ReadInt32(); - - //Read the info section for position data - reader.SeekBegin(InfoPosition - BoneInfoOffset); - - BoneInfo = new BoneInfo(); - BoneInfo.Read(reader); - - HasSkinning = BoneInfo.BoneRigFlag1 == 4; - - RotationType = BoneRotationType.Euler; - Checked = true; - - if (BoneInfo.NamePosition != 0) - { - reader.SeekBegin(InfoPosition + BoneInfo.NamePosition); - uint NameLength = reader.ReadUInt32(); - Text = reader.ReadString((int)NameLength); - } - - if (BoneInfo.RotationPosition != 0) - { - reader.SeekBegin(InfoPosition + BoneInfo.RotationPosition); - float RotationX = reader.ReadSingle(); - float RotationY = reader.ReadSingle(); - float RotationZ = reader.ReadSingle(); - - rotation = new float[] { RotationX,RotationY, RotationZ }; - } - - if (BoneInfo.TranslationPosition != 0) - { - reader.SeekBegin(InfoPosition + BoneInfo.TranslationPosition); - float TranslateX = reader.ReadSingle(); - float TranslateY = reader.ReadSingle(); - float TranslateZ = reader.ReadSingle(); - position = new float[] { TranslateX, TranslateY, TranslateZ }; - } - - if (BoneInfo.ScalePosition != 0) - { - reader.SeekBegin(InfoPosition + BoneInfo.ScalePosition); - float ScaleX = reader.ReadSingle(); - float ScaleY = reader.ReadSingle(); - float ScaleZ = reader.ReadSingle(); - scale = new float[] { ScaleX, ScaleY, ScaleZ }; - } - - if (BoneInfo.ParentPosition != 0) - { - reader.SeekBegin(InfoPosition + BoneInfo.ParentPosition); - parentIndex = reader.ReadInt32(); - } - - //Seek back to next bone in array - reader.SeekBegin(DataPosition + sizeof(uint)); - } - } - - //A section that stores position info for bone data - public class BoneInfo - { - internal ushort SectionSize { get; set; } - internal ushort NamePosition { get; set; } - internal ushort UnknownPosition { get; set; } - internal ushort Unknown2Position { get; set; } - internal ushort ParentPosition { get; set; } - internal ushort Unknown3Position { get; set; } - internal ushort IsVisiblePosition { get; set; } - internal ushort ScalePosition { get; set; } - internal ushort RotationPosition { get; set; } - internal ushort TranslationPosition { get; set; } - internal ushort BoneRigFlag2 { get; set; } - internal ushort BoneRigFlag1 { get; set; } - - public void Read(FileReader reader) - { - SectionSize = reader.ReadUInt16(); - NamePosition = reader.ReadUInt16(); - UnknownPosition = reader.ReadUInt16(); - Unknown2Position = reader.ReadUInt16(); - ParentPosition = reader.ReadUInt16(); - Unknown3Position = reader.ReadUInt16(); //Padding - IsVisiblePosition = reader.ReadUInt16(); //Points to byte. 0 or 1 for visibilty - ScalePosition = reader.ReadUInt16(); - RotationPosition = reader.ReadUInt16(); - TranslationPosition = reader.ReadUInt16(); - BoneRigFlag2 = reader.ReadUInt16(); - BoneRigFlag1 = reader.ReadUInt16(); - } - } - - public class Material - { - - } } } diff --git a/File_Format_Library/FileFormats/Pokemon/GFBMDL/GFBMDL_Wrappers.cs b/File_Format_Library/FileFormats/Pokemon/GFBMDL/GFLXMesh.cs similarity index 70% rename from File_Format_Library/FileFormats/Pokemon/GFBMDL/GFBMDL_Wrappers.cs rename to File_Format_Library/FileFormats/Pokemon/GFBMDL/GFLXMesh.cs index 3780cb6a..c2912292 100644 --- a/File_Format_Library/FileFormats/Pokemon/GFBMDL/GFBMDL_Wrappers.cs +++ b/File_Format_Library/FileFormats/Pokemon/GFBMDL/GFLXMesh.cs @@ -6,31 +6,49 @@ using System.Threading.Tasks; using Toolbox.Library; using Toolbox.Library.Rendering; using OpenTK; +using Toolbox.Library.Forms; +using System.Windows.Forms; namespace FirstPlugin { - public class GFBMaterial : STGenericMaterial - { - public GFBMDL.MaterialShaderData MaterialData { get; set; } - - public GFBMDL ParentModel { get; set; } - - public GFBMaterial(GFBMDL model, GFBMDL.MaterialShaderData data) { - ParentModel = model; - MaterialData = data; - } - } - - public class GFBMesh : STGenericObject + public class GFLXMesh : STGenericObject, IContextMenuNode { public int[] display; public int DisplayId; - public GFBMDL ParentModel { get; set; } + public GFLXModel ParentModel { get; set; } - public GFBMaterial GetMaterial(STGenericPolygonGroup polygroup) + public FlatBuffers.Gfbmdl.Mesh MeshData { get; set; } + public FlatBuffers.Gfbmdl.Group GroupData { get; set; } + + public GFLXMaterialData GetMaterial(STGenericPolygonGroup polygroup) { - return ParentModel.header.GenericMaterials[polygroup.MaterialIndex]; + return ParentModel.GenericMaterials[polygroup.MaterialIndex]; + } + + public ToolStripItem[] GetContextMenuItems() + { + List Items = new List(); + var uvMenu = new ToolStripMenuItem("UVs"); + Items.Add(uvMenu); + uvMenu.DropDownItems.Add(new ToolStripMenuItem("Flip Vertical", null, FlipVerticalAction, Keys.Control | Keys.V)); + uvMenu.DropDownItems.Add(new ToolStripMenuItem("Flip Horizontal", null, FlipHorizontalAction, Keys.Control | Keys.H)); + return Items.ToArray(); + } + + private void FlipVerticalAction(object sender, EventArgs args) { + this.FlipUvsVertical(); + UpdateMesh(); + } + + private void FlipHorizontalAction(object sender, EventArgs args) { + this.FlipUvsHorizontal(); + UpdateMesh(); + } + + private void UpdateMesh() { + ParentModel.UpdateVertexData(true); + GFLXMeshBufferHelper.ReloadVertexData(this); } public struct DisplayVertex @@ -50,10 +68,17 @@ namespace FirstPlugin public static int Size = 4 * (3 + 3 + 3 + 2 + 4 + 4 + 4 + 2 + 2 + 3); } - public GFBMesh(GFBMDL model) { + public GFLXMesh(GFLXModel model, + FlatBuffers.Gfbmdl.Group group, + FlatBuffers.Gfbmdl.Mesh mesh) + { ParentModel = model; + GroupData = group; + MeshData = mesh; } + public int MeshIndex { get; set; } + public List CreateDisplayVertices() { List Faces = new List(); diff --git a/File_Format_Library/FileFormats/Pokemon/GFBMDL/GFLXMeshBufferHelper.cs b/File_Format_Library/FileFormats/Pokemon/GFBMDL/GFLXMeshBufferHelper.cs new file mode 100644 index 00000000..e9212f61 --- /dev/null +++ b/File_Format_Library/FileFormats/Pokemon/GFBMDL/GFLXMeshBufferHelper.cs @@ -0,0 +1,303 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Toolbox.Library.IO; +using OpenTK; +using FlatBuffers.Gfbmdl; +using Toolbox.Library.Rendering; +using Toolbox.Library; + +namespace FirstPlugin +{ + public class GFLXMeshBufferHelper + { + public static void ReloadVertexData(GFLXMesh mesh) + { + var flatMesh = mesh.MeshData; + var buf = flatMesh.ByteBuffer; + for (int v = 0; v < mesh.vertices.Count; v++) + { + // flatMesh.ByteBuffer.PutByte(); + // flatMesh.Data(v); + } + } + + public static uint GetTotalBufferStride(Mesh mesh) + { + uint VertBufferStride = 0; + for (int i = 0; i < mesh.AlignmentsLength; i++) + { + var attribute = mesh.Alignments(i).Value; + switch (attribute.TypeID) + { + case VertexType.Position: + if (attribute.FormatID == BufferFormat.HalfFloat) + VertBufferStride += 0x08; + else if (attribute.FormatID == BufferFormat.Float) + VertBufferStride += 0x0C; + else + throw new Exception($"Unknown Combination! {attribute.TypeID} {attribute.FormatID}"); + break; + case VertexType.Normal: + if (attribute.FormatID == BufferFormat.HalfFloat) + VertBufferStride += 0x08; + else if (attribute.FormatID == BufferFormat.Float) + VertBufferStride += 0x0C; + else + throw new Exception($"Unknown Combination! {attribute.TypeID} {attribute.FormatID}"); + break; + case VertexType.Binormal: + if (attribute.FormatID == BufferFormat.HalfFloat) + VertBufferStride += 0x08; + else if (attribute.FormatID == BufferFormat.Float) + VertBufferStride += 0x0C; + else + throw new Exception($"Unknown Combination! {attribute.TypeID} {attribute.FormatID}"); + break; + case VertexType.UV1: + case VertexType.UV2: + case VertexType.UV3: + case VertexType.UV4: + if (attribute.FormatID == BufferFormat.HalfFloat) + VertBufferStride += 0x04; + else if (attribute.FormatID == BufferFormat.Float) + VertBufferStride += 0x08; + else + throw new Exception($"Unknown Combination! {attribute.TypeID} {attribute.FormatID}"); + break; + case VertexType.Color1: + case VertexType.Color2: + if (attribute.FormatID == BufferFormat.Byte) + VertBufferStride += 0x04; + else + throw new Exception($"Unknown Combination! {attribute.TypeID} {attribute.FormatID}"); + break; + case VertexType.BoneID: + if (attribute.FormatID == BufferFormat.Short) + VertBufferStride += 0x08; + else if (attribute.FormatID == BufferFormat.Byte) + VertBufferStride += 0x04; + else + throw new Exception($"Unknown Combination! {attribute.TypeID} {attribute.FormatID}"); + break; + case VertexType.BoneWeight: + if (attribute.FormatID == BufferFormat.BytesAsFloat) + VertBufferStride += 0x04; + else + throw new Exception($"Unknown Combination! {attribute.TypeID} {attribute.FormatID}"); + break; + default: + Console.WriteLine($"attribute.FormatID {attribute.FormatID}"); + if (attribute.FormatID == BufferFormat.HalfFloat) + VertBufferStride += 0x08; + else if (attribute.FormatID == BufferFormat.Float) + VertBufferStride += 0x0C; + else + throw new Exception($"Unknown Combination! {attribute.TypeID} {attribute.FormatID}"); + break; + } + } + + return VertBufferStride; + } + + public static List LoadVertexData(Mesh mesh, OpenTK.Matrix4 transform, List boneSkinningIds) + { + List Vertices = new List(); + + uint VertBufferStride = GetTotalBufferStride(mesh); + + using (var reader = new FileReader(mesh.GetDataArray())) + { + uint numVertex = (uint)reader.BaseStream.Length / VertBufferStride; + for (int v = 0; v < numVertex; v++) + { + Vertex vertex = new Vertex(); + Vertices.Add(vertex); + + for (int att = 0; att < mesh.AlignmentsLength; att++) + { + var attribute = mesh.Alignments(att).Value; + + switch (attribute.TypeID) + { + case VertexType.Position: + var pos = ParseBuffer(reader, attribute.FormatID, attribute.TypeID); + vertex.pos = new OpenTK.Vector3(pos.X, pos.Y, pos.Z); + vertex.pos = OpenTK.Vector3.TransformPosition(vertex.pos, transform); + break; + case VertexType.Normal: + var normal = ParseBuffer(reader, attribute.FormatID, attribute.TypeID); + vertex.nrm = new OpenTK.Vector3(normal.X, normal.Y, normal.Z); + vertex.nrm = OpenTK.Vector3.TransformNormal(vertex.nrm, transform); + break; + case VertexType.UV1: + var texcoord1 = ParseBuffer(reader, attribute.FormatID, attribute.TypeID); + vertex.uv0 = new OpenTK.Vector2(texcoord1.X, texcoord1.Y); + break; + case VertexType.UV2: + var texcoord2 = ParseBuffer(reader, attribute.FormatID, attribute.TypeID); + vertex.uv1 = new OpenTK.Vector2(texcoord2.X, texcoord2.Y); + break; + case VertexType.UV3: + var texcoord3 = ParseBuffer(reader, attribute.FormatID, attribute.TypeID); + vertex.uv2 = new OpenTK.Vector2(texcoord3.X, texcoord3.Y); + break; + case VertexType.UV4: + var texcoord4 = ParseBuffer(reader, attribute.FormatID, attribute.TypeID); + break; + case VertexType.BoneWeight: + var weights = ParseBuffer(reader, attribute.FormatID, attribute.TypeID); + vertex.boneWeights.AddRange(new float[] + { + weights.X, + weights.Y, + weights.Z, + weights.W + }); + break; + case VertexType.BoneID: + var boneIndices = ParseBuffer(reader, attribute.FormatID, attribute.TypeID); + vertex.boneIds.AddRange(new int[] + { + boneSkinningIds[(int)boneIndices.X], + boneSkinningIds[(int)boneIndices.Y], + boneSkinningIds[(int)boneIndices.Z], + boneSkinningIds[(int)boneIndices.W], + }); + break; + case VertexType.Color1: + OpenTK.Vector4 colors1 = new OpenTK.Vector4(1, 1, 1, 1); + if (attribute.FormatID == BufferFormat.Byte) + colors1 = ParseBuffer(reader, attribute.FormatID, attribute.TypeID); + + vertex.col = new OpenTK.Vector4(colors1.X, colors1.Y, colors1.Z, colors1.W); + break; + case VertexType.Color2: + OpenTK.Vector4 colors2 = new OpenTK.Vector4(1, 1, 1, 1); + if (attribute.FormatID == BufferFormat.Byte) + colors2 = ParseBuffer(reader, attribute.FormatID, attribute.TypeID); + + break; + case VertexType.Binormal: + var binormals = ParseBuffer(reader, attribute.FormatID, attribute.TypeID); + + vertex.bitan = new OpenTK.Vector4(binormals.X, binormals.Y, binormals.Z, binormals.W); + break; + default: + ParseBuffer(reader, attribute.FormatID, attribute.TypeID); + break; + } + } + } + } + + return Vertices; + } + + private static OpenTK.Vector4 ParseBuffer(FileReader reader, BufferFormat Format, VertexType AttributeType) + { + if (AttributeType == VertexType.Position) + { + switch (Format) + { + case BufferFormat.Float: + return new OpenTK.Vector4(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), 0); + case BufferFormat.HalfFloat: + return new OpenTK.Vector4(reader.ReadHalfSingle(), reader.ReadHalfSingle(), + reader.ReadHalfSingle(), reader.ReadHalfSingle()); + default: + throw new Exception($"Unknown Combination! {AttributeType} {Format}"); + } + } + else if (AttributeType == VertexType.Normal) + { + switch (Format) + { + case BufferFormat.Float: + return new OpenTK.Vector4(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), 0); + case BufferFormat.HalfFloat: + return new OpenTK.Vector4(reader.ReadHalfSingle(), reader.ReadHalfSingle(), + reader.ReadHalfSingle(), reader.ReadHalfSingle()); + default: + throw new Exception($"Unknown Combination! {AttributeType} {Format}"); + } + } + else if (AttributeType == VertexType.Binormal) + { + switch (Format) + { + case BufferFormat.Float: + return new OpenTK.Vector4(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), 0); + case BufferFormat.HalfFloat: + return new OpenTK.Vector4(reader.ReadHalfSingle(), reader.ReadHalfSingle(), + reader.ReadHalfSingle(), reader.ReadHalfSingle()); + default: + throw new Exception($"Unknown Combination! {AttributeType} {Format}"); + } + } + else if (AttributeType == VertexType.UV1 || + AttributeType == VertexType.UV2 || + AttributeType == VertexType.UV3 || + AttributeType == VertexType.UV4) + { + switch (Format) + { + case BufferFormat.Float: + return new OpenTK.Vector4(reader.ReadSingle(), reader.ReadSingle(), 0, 0); + case BufferFormat.HalfFloat: + return new OpenTK.Vector4(reader.ReadHalfSingle(), reader.ReadHalfSingle(), 0, 0); + default: + throw new Exception($"Unknown Combination! {AttributeType} {Format}"); + } + } + else if (AttributeType == VertexType.Color1 || + AttributeType == VertexType.Color2) + { + switch (Format) + { + case BufferFormat.Byte: + return new OpenTK.Vector4(reader.ReadByte(), reader.ReadByte(), reader.ReadByte(), reader.ReadByte()); + default: + throw new Exception($"Unknown Combination! {AttributeType} {Format}"); + } + } + else if (AttributeType == VertexType.BoneID) + { + switch (Format) + { + case BufferFormat.Short: + return new OpenTK.Vector4(reader.ReadInt16(), reader.ReadInt16(), reader.ReadInt16(), reader.ReadInt16()); + case BufferFormat.Byte: + return new OpenTK.Vector4(reader.ReadByte(), reader.ReadByte(), reader.ReadByte(), reader.ReadByte()); + default: + throw new Exception($"Unknown Combination! {AttributeType} {Format}"); + } + } + else if (AttributeType == VertexType.BoneWeight) + { + switch (Format) + { + case BufferFormat.BytesAsFloat: + return new OpenTK.Vector4(reader.ReadByteAsFloat(), reader.ReadByteAsFloat(), + reader.ReadByteAsFloat(), reader.ReadByteAsFloat()); + default: + throw new Exception($"Unknown Combination! {AttributeType} {Format}"); + } + } + else + { + switch (Format) + { + case BufferFormat.HalfFloat: + return new OpenTK.Vector4(reader.ReadHalfSingle(), reader.ReadHalfSingle(), + reader.ReadHalfSingle(), reader.ReadHalfSingle()); + default: + throw new Exception($"Unknown Combination! {AttributeType} {Format}"); + } + } + } + } +} diff --git a/File_Format_Library/FileFormats/Pokemon/GFBMDL/GFLXModel.cs b/File_Format_Library/FileFormats/Pokemon/GFBMDL/GFLXModel.cs new file mode 100644 index 00000000..83915708 --- /dev/null +++ b/File_Format_Library/FileFormats/Pokemon/GFBMDL/GFLXModel.cs @@ -0,0 +1,329 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using FlatBuffers.Gfbmdl; +using Toolbox.Library; +using Toolbox.Library.IO; +using Toolbox.Library.Rendering; +using FirstPlugin.Forms; + +namespace FirstPlugin +{ + public class GFLXModel + { + public GFBMDL ParentFile; + + public List GenericMaterials = new List(); + public List GenericMeshes = new List(); + + public STSkeleton Skeleton = new STSkeleton(); + + public Model Model; + + public List Textures = new List(); + public List Shaders = new List(); + + public T LoadEditor() where T : + System.Windows.Forms.UserControl, new() + { + return ParentFile.LoadEditor(); + } + + public void UpdateVertexData(bool updateViewport) { + ParentFile.Renderer.UpdateVertexData(); + + if (updateViewport) + LibraryGUI.UpdateViewport(); + } + + public void LoadFile(Model model, GFBMDL file, GFBMDL_Render Renderer) { + Model = model; + ParentFile = file; + + for (int t = 0; t < Model.TextureNamesLength; t++) + Textures.Add(Model.TextureNames(t)); + + for (int s = 0; s < Model.ShaderNamesLength; s++) + Shaders.Add(Model.ShaderNames(s)); + + for (int m = 0; m < Model.MaterialsLength; m++) { + var mat = Model.Materials(m).Value; + GenericMaterials.Add(new GFLXMaterialData(this, mat)); + } + + List SkinningIndices = new List(); + + for (int b = 0; b < Model.BonesLength; b++) { + var bone = Model.Bones(b).Value; + Skeleton.bones.Add(new GFLXBone(this, bone)); + + if (bone.Type == BoneType.HasSkinning && bone.SkinCheck == null) + SkinningIndices.Add(b); + } + + Skeleton.reset(); + Skeleton.update(); + + for (int g = 0; g < Model.GroupsLength; g++) { + var group = Model.Groups(g).Value; + var mesh = Model.Meshes(g).Value; + + OpenTK.Matrix4 transform = OpenTK.Matrix4.Identity; + + GFLXMesh genericMesh = new GFLXMesh(this, group, mesh); + genericMesh.Checked = true; + genericMesh.ImageKey = "model"; + genericMesh.SelectedImageKey = "model"; + + int boneIndex = (int)group.BoneID; + if (boneIndex < Skeleton.bones.Count && boneIndex > 0) + { + genericMesh.BoneIndex = boneIndex; + transform = Skeleton.bones[boneIndex].Transform; + } + + genericMesh.Text = Skeleton.bones[(int)group.MeshID].Text; + Renderer.Meshes.Add(genericMesh); + GenericMeshes.Add(genericMesh); + + //Load the vertex data + genericMesh.vertices = GFLXMeshBufferHelper.LoadVertexData(mesh, transform, SkinningIndices); + genericMesh.FlipUvsVertical(); + + //Load faces + for (int p = 0; p < mesh.PolygonsLength; p++) + { + var poly = mesh.Polygons(p).Value; + + var polygonGroup = new STGenericPolygonGroup(); + polygonGroup.MaterialIndex = (int)poly.MaterialID; + genericMesh.PolygonGroups.Add(polygonGroup); + + for (int f = 0; f < poly.DataLength; f++) + polygonGroup.faces.Add((int)poly.Data(f)); + } + } + } + + + public void SaveFile(System.IO.Stream stream) + { + using (var writer = new FileWriter(stream)) { + writer.Write(Model.ByteBuffer.ToFullArray()); + } + } + } + + public class GFLXMaterialData : STGenericMaterial + { + private Material Material; + private GFLXModel ParentModel; + + public Dictionary SwitchParams = new Dictionary(); + public Dictionary ValueParams = new Dictionary(); + public Dictionary ColorParams = new Dictionary(); + + public override void OnClick(TreeView treeView) { + var editor = ParentModel.LoadEditor(); + editor.LoadMaterial(this); + } + + public GFLXMaterialData(GFLXModel parent, Material mat) + { + ParentModel = parent; + Material = mat; + + Text = mat.Name; + + for (int i = 0; i < Material.SwitchesLength; i++) { + var val = Material.Switches(i).Value; + SwitchParams.Add(val.Name, new GFLXSwitchParam(val)); + } + + for (int i = 0; i < Material.ValuesLength; i++) { + var val = Material.Values(i).Value; + ValueParams.Add(val.Name, new GFLXValueParam(val)); + } + + for (int i = 0; i < Material.ColorsLength; i++) { + var val = Material.Colors(i).Value; + ColorParams.Add(val.Name, new GFLXColorParam(val)); + } + + int textureUnit = 1; + for (int t = 0; t < Material.TexturesLength; t++) + { + var tex = Material.Textures(t).Value; + string name = ParentModel.Textures[tex.Index]; + + STGenericMatTexture matTexture = new STGenericMatTexture(); + matTexture.Name = name; + matTexture.SamplerName = tex.Name; + matTexture.textureUnit = textureUnit++; + matTexture.WrapModeS = STTextureWrapMode.Mirror; + matTexture.WrapModeT = STTextureWrapMode.Repeat; + TextureMaps.Add(matTexture); + + switch (tex.Name) + { + case "Col0Tex": + matTexture.Type = STGenericMatTexture.TextureType.Diffuse; + break; + case "EmissionMaskTex": + // matTexture.Type = STGenericMatTexture.TextureType.Emission; + break; + case "LyCol0Tex": + break; + case "NormalMapTex": + matTexture.WrapModeT = STTextureWrapMode.Repeat; + matTexture.WrapModeT = STTextureWrapMode.Repeat; + matTexture.Type = STGenericMatTexture.TextureType.Normal; + break; + case "AmbientTex": + break; + case "LightTblTex": + break; + case "SphereMapTex": + break; + case "EffectTex": + break; + } + } + } + } + + public class GFLXBone : STBone + { + private Bone Bone; + private GFLXModel ParentModel; + + public GFLXBone(GFLXModel parent, Bone bone) : base(parent.Skeleton) + { + ParentModel = parent; + Bone = bone; + + Text = bone.Name; + parentIndex = bone.Parent; + + if (bone.Translation != null) + { + position = new float[3] + { bone.Translation.Value.X, + bone.Translation.Value.Y, + bone.Translation.Value.Z + }; + } + + if (bone.Rotation != null) + { + rotation = new float[4] + { bone.Rotation.Value.X, + bone.Rotation.Value.Y, + bone.Rotation.Value.Z, + 1.0f, + }; + } + + if (bone.Scale != null) + { + scale = new float[3] + { bone.Scale.Value.X, + bone.Scale.Value.Y, + bone.Scale.Value.Z + }; + } + } + } + + public class GFLXColorParam + { + private MatColor Param; + + public GFLXColorParam(MatColor param) + { + Param = param; + } + + public string Name + { + get { return Param.Name; } + set + { + Param.ByteBuffer.PutStringUTF8(0, value); + } + } + + public OpenTK.Vector3 Value + { + get { return new OpenTK.Vector3( + Param.Color.Value.R, + Param.Color.Value.G, + Param.Color.Value.B); + } + set + { + var vec3 = value; + + Param.Color.Value.ByteBuffer.PutFloat(0, vec3.X); + Param.Color.Value.ByteBuffer.PutFloat(1, vec3.Y); + Param.Color.Value.ByteBuffer.PutFloat(2, vec3.Z); + } + } + } + + public class GFLXValueParam + { + private MatFloat Param; + + public GFLXValueParam(MatFloat param) { + Param = param; + } + + public string Name + { + get { return Param.Name; } + set { + Param.ByteBuffer.PutStringUTF8(0, value); + } + } + + public float Value + { + get { return Param.Value; } + set { + Param.ByteBuffer.PutFloat(1, value); + } + } + } + + public class GFLXSwitchParam + { + private MatSwitch Param; + + public GFLXSwitchParam(MatSwitch param) + { + Param = param; + } + + public string Name + { + get { return Param.Name; } + set + { + Param.ByteBuffer.PutStringUTF8(0, value); + } + } + + public bool Value + { + get { return Param.Value; } + set + { + Param.ByteBuffer.PutByte(1, value ? (byte)1 : (byte)0); + } + } + } +} diff --git a/File_Format_Library/FileFormats/Pokemon/PokemonTable.cs b/File_Format_Library/FileFormats/Pokemon/PokemonTable.cs new file mode 100644 index 00000000..76ed0eb6 --- /dev/null +++ b/File_Format_Library/FileFormats/Pokemon/PokemonTable.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace FirstPlugin +{ + public class PokemonTable + { + public Dictionary Gen8 = new Dictionary() + { + { 891,"Meltan" }, + { 892,"Melmetal" }, + }; + } +} diff --git a/File_Format_Library/GL/GFBMDL_Render.cs b/File_Format_Library/GL/GFBMDL_Render.cs index cac4515b..b1ab76f6 100644 --- a/File_Format_Library/GL/GFBMDL_Render.cs +++ b/File_Format_Library/GL/GFBMDL_Render.cs @@ -13,9 +13,9 @@ using OpenTK.Graphics.OpenGL; namespace FirstPlugin { - public class GFBMDL_Render : AbstractGlDrawable + public class GFBMDL_Render : AbstractGlDrawable, IMeshContainer { - public List Meshes = new List(); + public List Meshes { get; set; } = new List(); public Matrix4 ModelTransform = Matrix4.Identity; @@ -43,17 +43,17 @@ namespace FirstPlugin if (!Runtime.OpenTKInitialized) return; - GFBMesh.DisplayVertex[] Vertices; + GFLXMesh.DisplayVertex[] Vertices; int[] Faces; int poffset = 0; int voffset = 0; - List Vs = new List(); + List Vs = new List(); List Ds = new List(); - foreach (GFBMesh shape in Meshes) + foreach (GFLXMesh shape in Meshes) { - List pv = shape.CreateDisplayVertices(); + List pv = shape.CreateDisplayVertices(); Vs.AddRange(pv); int GroupOffset = 0; @@ -82,7 +82,7 @@ namespace FirstPlugin // Bind only once! GL.BindBuffer(BufferTarget.ArrayBuffer, vbo_position); - GL.BufferData(BufferTarget.ArrayBuffer, (IntPtr)(Vertices.Length * GFBMesh.DisplayVertex.Size), Vertices, BufferUsageHint.StaticDraw); + GL.BufferData(BufferTarget.ArrayBuffer, (IntPtr)(Vertices.Length * GFLXMesh.DisplayVertex.Size), Vertices, BufferUsageHint.StaticDraw); GL.BindBuffer(BufferTarget.ElementArrayBuffer, ibo_elements); GL.BufferData(BufferTarget.ElementArrayBuffer, (IntPtr)(Faces.Length * sizeof(int)), Faces, BufferUsageHint.StaticDraw); @@ -165,10 +165,10 @@ namespace FirstPlugin GL.Enable(EnableCap.CullFace); } - private static void SetBoneUniforms(GLControl control, ShaderProgram shader, GFBMesh mesh) + private static void SetBoneUniforms(GLControl control, ShaderProgram shader, GFLXMesh mesh) { int i = 0; - foreach (var bone in mesh.ParentModel.header.Skeleton.bones) + foreach (var bone in mesh.ParentModel.Skeleton.bones) { Matrix4 transform = bone.invert * bone.Transform; @@ -190,7 +190,7 @@ namespace FirstPlugin }*/ } - private void SetUniformBlocks(GFBMaterial mat, ShaderProgram shader, GFBMesh m, int id) + private void SetUniformBlocks(GFLXMaterialData mat, ShaderProgram shader, GFLXMesh m, int id) { /* shader.UniformBlockBinding("TexCoord1", 3); GL.GetActiveUniformBlock(shader.program, @@ -209,7 +209,7 @@ namespace FirstPlugin GL.BINDBUFFER*/ } - private static void SetUniforms(GFBMaterial mat, ShaderProgram shader, GFBMesh m, int id) + private static void SetUniforms(GFLXMaterialData mat, ShaderProgram shader, GFLXMesh m, int id) { // Texture Maps /* shader.SetBoolToInt("useColorTex", false); @@ -242,31 +242,26 @@ namespace FirstPlugin SetUniformData(mat, shader, "ColorUVTranslateV"); } - private static void SetUniformData(GFBMaterial mat, ShaderProgram shader, string propertyName) + private static void SetUniformData(GFLXMaterialData mat, ShaderProgram shader, string propertyName) { - if (mat.MaterialData.SwitchParams.ContainsKey(propertyName)) + if (mat.SwitchParams.ContainsKey(propertyName)) { - bool Value = (bool)mat.MaterialData.SwitchParams[propertyName].Value; + bool Value = (bool)mat.SwitchParams[propertyName].Value; shader.SetBoolToInt(propertyName, Value); } - if (mat.MaterialData.ValueParams.ContainsKey(propertyName)) + if (mat.ValueParams.ContainsKey(propertyName)) { - var Value = mat.MaterialData.ValueParams[propertyName].Value; - if (Value is float) - shader.SetFloat(propertyName, (float)Value); - if (Value is uint) - shader.SetFloat(propertyName, (uint)Value); - if (Value is int) - shader.SetFloat(propertyName, (int)Value); + var Value = mat.ValueParams[propertyName].Value; + shader.SetFloat(propertyName, (float)Value); } - if (mat.MaterialData.ColorParams.ContainsKey(propertyName)) + if (mat.ColorParams.ContainsKey(propertyName)) { - Vector3 Value = (Vector3)mat.MaterialData.ColorParams[propertyName].Value; + Vector3 Value = (Vector3)mat.ColorParams[propertyName].Value; shader.SetVector3(propertyName, Value); } } - private static void SetTextureUniforms(GFBMaterial mat, GFBMesh m, ShaderProgram shader) + private static void SetTextureUniforms(GFLXMaterialData mat, GFLXMesh m, ShaderProgram shader) { SetDefaultTextureAttributes(mat, shader); @@ -302,6 +297,11 @@ namespace FirstPlugin shader.SetBoolToInt("HasDiffuse", true); TextureUniform(shader, mat, true, "DiffuseMap", matex); } + if (matex.Type == STGenericMatTexture.TextureType.Normal) + { + shader.SetBoolToInt("HasNormalMap", true); + TextureUniform(shader, mat, true, "NormalMap", matex); + } } } @@ -322,7 +322,7 @@ namespace FirstPlugin shader.SetInt("brdfLUT", 27); } - private static void TextureUniform(ShaderProgram shader, GFBMaterial mat, bool hasTex, string name, STGenericMatTexture mattex) + private static void TextureUniform(ShaderProgram shader, GFLXMaterialData mat, bool hasTex, string name, STGenericMatTexture mattex) { if (mattex.textureState == STGenericMatTexture.TextureState.Binded) return; @@ -383,7 +383,7 @@ namespace FirstPlugin GL.TexParameter(TextureTarget.Texture2D, (TextureParameterName)ExtTextureFilterAnisotropic.TextureMaxAnisotropyExt, 0.0f); } - private static void SetDefaultTextureAttributes(GFBMaterial mat, ShaderProgram shader) + private static void SetDefaultTextureAttributes(GFLXMaterialData mat, ShaderProgram shader) { } @@ -397,7 +397,7 @@ namespace FirstPlugin private void DrawModels(ShaderProgram shader, GL_ControlModern control) { shader.EnableVertexAttributes(); - foreach (GFBMesh shp in Meshes) + foreach (GFLXMesh shp in Meshes) { if (shp.Checked) DrawModel(control, shp, shader); @@ -405,30 +405,30 @@ namespace FirstPlugin shader.DisableVertexAttributes(); } - private void SetVertexAttributes(GFBMesh m, ShaderProgram shader) + private void SetVertexAttributes(GFLXMesh m, ShaderProgram shader) { GL.BindBuffer(BufferTarget.ArrayBuffer, vbo_position); - GL.VertexAttribPointer(shader.GetAttribute("vPosition"), 3, VertexAttribPointerType.Float, false, GFBMesh.DisplayVertex.Size, 0); //+12 - GL.VertexAttribPointer(shader.GetAttribute("vNormal"), 3, VertexAttribPointerType.Float, false, GFBMesh.DisplayVertex.Size, 12); //+12 - GL.VertexAttribPointer(shader.GetAttribute("vTangent"), 3, VertexAttribPointerType.Float, false, GFBMesh.DisplayVertex.Size, 24); //+12 - GL.VertexAttribPointer(shader.GetAttribute("vUV0"), 2, VertexAttribPointerType.Float, false, GFBMesh.DisplayVertex.Size, 36); //+8 - GL.VertexAttribPointer(shader.GetAttribute("vColor"), 4, VertexAttribPointerType.Float, false, GFBMesh.DisplayVertex.Size, 44); //+16 - GL.VertexAttribIPointer(shader.GetAttribute("vBone"), 4, VertexAttribIntegerType.Int, GFBMesh.DisplayVertex.Size, new IntPtr(60)); //+16 - GL.VertexAttribPointer(shader.GetAttribute("vWeight"), 4, VertexAttribPointerType.Float, false, GFBMesh.DisplayVertex.Size, 76);//+16 - GL.VertexAttribPointer(shader.GetAttribute("vUV1"), 2, VertexAttribPointerType.Float, false, GFBMesh.DisplayVertex.Size, 92);//+8 - GL.VertexAttribPointer(shader.GetAttribute("vUV2"), 2, VertexAttribPointerType.Float, false, GFBMesh.DisplayVertex.Size, 100);//+8 - GL.VertexAttribPointer(shader.GetAttribute("vBinormal"), 3, VertexAttribPointerType.Float, false, GFBMesh.DisplayVertex.Size, 108); //+12 + GL.VertexAttribPointer(shader.GetAttribute("vPosition"), 3, VertexAttribPointerType.Float, false, GFLXMesh.DisplayVertex.Size, 0); //+12 + GL.VertexAttribPointer(shader.GetAttribute("vNormal"), 3, VertexAttribPointerType.Float, false, GFLXMesh.DisplayVertex.Size, 12); //+12 + GL.VertexAttribPointer(shader.GetAttribute("vTangent"), 3, VertexAttribPointerType.Float, false, GFLXMesh.DisplayVertex.Size, 24); //+12 + GL.VertexAttribPointer(shader.GetAttribute("vUV0"), 2, VertexAttribPointerType.Float, false, GFLXMesh.DisplayVertex.Size, 36); //+8 + GL.VertexAttribPointer(shader.GetAttribute("vColor"), 4, VertexAttribPointerType.Float, false, GFLXMesh.DisplayVertex.Size, 44); //+16 + GL.VertexAttribIPointer(shader.GetAttribute("vBone"), 4, VertexAttribIntegerType.Int, GFLXMesh.DisplayVertex.Size, new IntPtr(60)); //+16 + GL.VertexAttribPointer(shader.GetAttribute("vWeight"), 4, VertexAttribPointerType.Float, false, GFLXMesh.DisplayVertex.Size, 76);//+16 + GL.VertexAttribPointer(shader.GetAttribute("vUV1"), 2, VertexAttribPointerType.Float, false, GFLXMesh.DisplayVertex.Size, 92);//+8 + GL.VertexAttribPointer(shader.GetAttribute("vUV2"), 2, VertexAttribPointerType.Float, false, GFLXMesh.DisplayVertex.Size, 100);//+8 + GL.VertexAttribPointer(shader.GetAttribute("vBinormal"), 3, VertexAttribPointerType.Float, false, GFLXMesh.DisplayVertex.Size, 108); //+12 GL.BindBuffer(BufferTarget.ElementArrayBuffer, ibo_elements); } - private void DrawModel(GLControl control, GFBMesh m, ShaderProgram shader) + private void DrawModel(GLControl control, GFLXMesh m, ShaderProgram shader) { foreach (var group in m.PolygonGroups) { if (group.faces.Count <= 3) return; - var Material = m.ParentModel.header.Materials[group.MaterialIndex]; + var Material = m.ParentModel.GenericMaterials[group.MaterialIndex]; SetUniforms(m.GetMaterial(group), shader, m, m.DisplayId); SetUniformBlocks(m.GetMaterial(group), shader, m, m.DisplayId); diff --git a/File_Format_Library/GUI/GFBMDL/GFLXMaterialEditor.Designer.cs b/File_Format_Library/GUI/GFBMDL/GFLXMaterialEditor.Designer.cs new file mode 100644 index 00000000..82eff5e1 --- /dev/null +++ b/File_Format_Library/GUI/GFBMDL/GFLXMaterialEditor.Designer.cs @@ -0,0 +1,503 @@ +namespace FirstPlugin.Forms +{ + partial class GFLXMaterialEditor + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(GFLXMaterialEditor)); + this.stTabControl1 = new Toolbox.Library.Forms.STTabControl(); + this.tabPage1 = new System.Windows.Forms.TabPage(); + this.stPanel1 = new Toolbox.Library.Forms.STPanel(); + this.stFlowLayoutPanel1 = new Toolbox.Library.Forms.STFlowLayoutPanel(); + this.stDropDownPanel1 = new Toolbox.Library.Forms.STDropDownPanel(); + this.listViewCustom1 = new Toolbox.Library.Forms.ListViewCustom(); + this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.stDropDownPanel2 = new Toolbox.Library.Forms.STDropDownPanel(); + this.stLabel2 = new Toolbox.Library.Forms.STLabel(); + this.stTextBox2 = new Toolbox.Library.Forms.STTextBox(); + this.stLabel1 = new Toolbox.Library.Forms.STLabel(); + this.stTextBox1 = new Toolbox.Library.Forms.STTextBox(); + this.tabPage2 = new System.Windows.Forms.TabPage(); + this.pictureBoxCustom1 = new Toolbox.Library.Forms.PictureBoxCustom(); + this.stLabel3 = new Toolbox.Library.Forms.STLabel(); + this.stLabel4 = new Toolbox.Library.Forms.STLabel(); + this.stComboBox1 = new Toolbox.Library.Forms.STComboBox(); + this.stComboBox2 = new Toolbox.Library.Forms.STComboBox(); + this.barSlider1 = new BarSlider.BarSlider(); + this.barSlider2 = new BarSlider.BarSlider(); + this.barSlider3 = new BarSlider.BarSlider(); + this.barSlider4 = new BarSlider.BarSlider(); + this.stPanel2 = new Toolbox.Library.Forms.STPanel(); + this.stTabControl1.SuspendLayout(); + this.tabPage1.SuspendLayout(); + this.stPanel1.SuspendLayout(); + this.stFlowLayoutPanel1.SuspendLayout(); + this.stDropDownPanel1.SuspendLayout(); + this.stDropDownPanel2.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBoxCustom1)).BeginInit(); + this.stPanel2.SuspendLayout(); + this.SuspendLayout(); + // + // stTabControl1 + // + this.stTabControl1.Controls.Add(this.tabPage1); + this.stTabControl1.Controls.Add(this.tabPage2); + this.stTabControl1.Dock = System.Windows.Forms.DockStyle.Fill; + this.stTabControl1.Location = new System.Drawing.Point(0, 0); + this.stTabControl1.myBackColor = System.Drawing.Color.Empty; + this.stTabControl1.Name = "stTabControl1"; + this.stTabControl1.SelectedIndex = 0; + this.stTabControl1.Size = new System.Drawing.Size(575, 769); + this.stTabControl1.TabIndex = 0; + // + // tabPage1 + // + this.tabPage1.Controls.Add(this.stPanel1); + this.tabPage1.Location = new System.Drawing.Point(4, 25); + this.tabPage1.Name = "tabPage1"; + this.tabPage1.Padding = new System.Windows.Forms.Padding(3); + this.tabPage1.Size = new System.Drawing.Size(567, 740); + this.tabPage1.TabIndex = 0; + this.tabPage1.Text = "Texture Maps"; + this.tabPage1.UseVisualStyleBackColor = true; + // + // stPanel1 + // + this.stPanel1.Controls.Add(this.stFlowLayoutPanel1); + this.stPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.stPanel1.Location = new System.Drawing.Point(3, 3); + this.stPanel1.Name = "stPanel1"; + this.stPanel1.Size = new System.Drawing.Size(561, 734); + this.stPanel1.TabIndex = 0; + // + // stFlowLayoutPanel1 + // + this.stFlowLayoutPanel1.Controls.Add(this.stDropDownPanel1); + this.stFlowLayoutPanel1.Controls.Add(this.stDropDownPanel2); + this.stFlowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.stFlowLayoutPanel1.FixedHeight = false; + this.stFlowLayoutPanel1.FixedWidth = true; + this.stFlowLayoutPanel1.Location = new System.Drawing.Point(0, 0); + this.stFlowLayoutPanel1.Margin = new System.Windows.Forms.Padding(0); + this.stFlowLayoutPanel1.Name = "stFlowLayoutPanel1"; + this.stFlowLayoutPanel1.Size = new System.Drawing.Size(561, 734); + this.stFlowLayoutPanel1.TabIndex = 0; + // + // stDropDownPanel1 + // + this.stDropDownPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.stDropDownPanel1.Controls.Add(this.listViewCustom1); + this.stDropDownPanel1.ExpandedHeight = 0; + this.stDropDownPanel1.IsExpanded = true; + this.stDropDownPanel1.Location = new System.Drawing.Point(0, 0); + this.stDropDownPanel1.Margin = new System.Windows.Forms.Padding(0); + this.stDropDownPanel1.Name = "stDropDownPanel1"; + this.stDropDownPanel1.PanelName = "Textures"; + this.stDropDownPanel1.PanelValueName = ""; + this.stDropDownPanel1.SetIcon = null; + this.stDropDownPanel1.SetIconAlphaColor = System.Drawing.Color.Transparent; + this.stDropDownPanel1.SetIconColor = System.Drawing.Color.Transparent; + this.stDropDownPanel1.Size = new System.Drawing.Size(561, 207); + this.stDropDownPanel1.TabIndex = 0; + // + // listViewCustom1 + // + this.listViewCustom1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.listViewCustom1.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.listViewCustom1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.columnHeader1}); + this.listViewCustom1.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None; + this.listViewCustom1.HideSelection = false; + this.listViewCustom1.Location = new System.Drawing.Point(3, 22); + this.listViewCustom1.Name = "listViewCustom1"; + this.listViewCustom1.OwnerDraw = true; + this.listViewCustom1.Size = new System.Drawing.Size(570, 185); + this.listViewCustom1.TabIndex = 1; + this.listViewCustom1.UseCompatibleStateImageBehavior = false; + this.listViewCustom1.View = System.Windows.Forms.View.Details; + this.listViewCustom1.SelectedIndexChanged += new System.EventHandler(this.listViewCustom1_SelectedIndexChanged); + // + // columnHeader1 + // + this.columnHeader1.Text = "Name"; + this.columnHeader1.Width = 384; + // + // stDropDownPanel2 + // + this.stDropDownPanel2.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.stDropDownPanel2.Controls.Add(this.stPanel2); + this.stDropDownPanel2.Controls.Add(this.stComboBox2); + this.stDropDownPanel2.Controls.Add(this.stComboBox1); + this.stDropDownPanel2.Controls.Add(this.stLabel4); + this.stDropDownPanel2.Controls.Add(this.stLabel3); + this.stDropDownPanel2.Controls.Add(this.pictureBoxCustom1); + this.stDropDownPanel2.Controls.Add(this.stLabel2); + this.stDropDownPanel2.Controls.Add(this.stTextBox2); + this.stDropDownPanel2.Controls.Add(this.stLabel1); + this.stDropDownPanel2.Controls.Add(this.stTextBox1); + this.stDropDownPanel2.ExpandedHeight = 0; + this.stDropDownPanel2.IsExpanded = true; + this.stDropDownPanel2.Location = new System.Drawing.Point(0, 207); + this.stDropDownPanel2.Margin = new System.Windows.Forms.Padding(0); + this.stDropDownPanel2.Name = "stDropDownPanel2"; + this.stDropDownPanel2.PanelName = "Texture Params"; + this.stDropDownPanel2.PanelValueName = ""; + this.stDropDownPanel2.SetIcon = null; + this.stDropDownPanel2.SetIconAlphaColor = System.Drawing.Color.Transparent; + this.stDropDownPanel2.SetIconColor = System.Drawing.Color.Transparent; + this.stDropDownPanel2.Size = new System.Drawing.Size(561, 495); + this.stDropDownPanel2.TabIndex = 1; + // + // stLabel2 + // + this.stLabel2.AutoSize = true; + this.stLabel2.Location = new System.Drawing.Point(14, 62); + this.stLabel2.Name = "stLabel2"; + this.stLabel2.Size = new System.Drawing.Size(38, 13); + this.stLabel2.TabIndex = 4; + this.stLabel2.Text = "Effect:"; + // + // stTextBox2 + // + this.stTextBox2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.stTextBox2.Location = new System.Drawing.Point(67, 60); + this.stTextBox2.Name = "stTextBox2"; + this.stTextBox2.Size = new System.Drawing.Size(208, 20); + this.stTextBox2.TabIndex = 3; + // + // stLabel1 + // + this.stLabel1.AutoSize = true; + this.stLabel1.Location = new System.Drawing.Point(14, 36); + this.stLabel1.Name = "stLabel1"; + this.stLabel1.Size = new System.Drawing.Size(38, 13); + this.stLabel1.TabIndex = 2; + this.stLabel1.Text = "Name:"; + // + // stTextBox1 + // + this.stTextBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.stTextBox1.Location = new System.Drawing.Point(67, 34); + this.stTextBox1.Name = "stTextBox1"; + this.stTextBox1.Size = new System.Drawing.Size(208, 20); + this.stTextBox1.TabIndex = 1; + // + // tabPage2 + // + this.tabPage2.Location = new System.Drawing.Point(4, 25); + this.tabPage2.Name = "tabPage2"; + this.tabPage2.Padding = new System.Windows.Forms.Padding(3); + this.tabPage2.Size = new System.Drawing.Size(529, 525); + this.tabPage2.TabIndex = 1; + this.tabPage2.Text = "Params"; + this.tabPage2.UseVisualStyleBackColor = true; + // + // pictureBoxCustom1 + // + this.pictureBoxCustom1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.pictureBoxCustom1.BackColor = System.Drawing.Color.Transparent; + this.pictureBoxCustom1.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("pictureBoxCustom1.BackgroundImage"))); + this.pictureBoxCustom1.Location = new System.Drawing.Point(17, 133); + this.pictureBoxCustom1.Name = "pictureBoxCustom1"; + this.pictureBoxCustom1.Size = new System.Drawing.Size(508, 378); + this.pictureBoxCustom1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; + this.pictureBoxCustom1.TabIndex = 5; + this.pictureBoxCustom1.TabStop = false; + // + // stLabel3 + // + this.stLabel3.AutoSize = true; + this.stLabel3.Location = new System.Drawing.Point(292, 36); + this.stLabel3.Name = "stLabel3"; + this.stLabel3.Size = new System.Drawing.Size(74, 13); + this.stLabel3.TabIndex = 6; + this.stLabel3.Text = "Wrap Mode U"; + // + // stLabel4 + // + this.stLabel4.AutoSize = true; + this.stLabel4.Location = new System.Drawing.Point(292, 62); + this.stLabel4.Name = "stLabel4"; + this.stLabel4.Size = new System.Drawing.Size(73, 13); + this.stLabel4.TabIndex = 7; + this.stLabel4.Text = "Wrap Mode V"; + // + // stComboBox1 + // + this.stComboBox1.BorderColor = System.Drawing.Color.Empty; + this.stComboBox1.BorderStyle = System.Windows.Forms.ButtonBorderStyle.Solid; + this.stComboBox1.ButtonColor = System.Drawing.Color.Empty; + this.stComboBox1.FormattingEnabled = true; + this.stComboBox1.IsReadOnly = false; + this.stComboBox1.Location = new System.Drawing.Point(372, 33); + this.stComboBox1.Name = "stComboBox1"; + this.stComboBox1.Size = new System.Drawing.Size(153, 21); + this.stComboBox1.TabIndex = 8; + // + // stComboBox2 + // + this.stComboBox2.BorderColor = System.Drawing.Color.Empty; + this.stComboBox2.BorderStyle = System.Windows.Forms.ButtonBorderStyle.Solid; + this.stComboBox2.ButtonColor = System.Drawing.Color.Empty; + this.stComboBox2.FormattingEnabled = true; + this.stComboBox2.IsReadOnly = false; + this.stComboBox2.Location = new System.Drawing.Point(371, 60); + this.stComboBox2.Name = "stComboBox2"; + this.stComboBox2.Size = new System.Drawing.Size(154, 21); + this.stComboBox2.TabIndex = 9; + // + // barSlider1 + // + this.barSlider1.ActiveEditColor = System.Drawing.Color.FromArgb(((int)(((byte)(40)))), ((int)(((byte)(40)))), ((int)(((byte)(40))))); + this.barSlider1.BarInnerColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(80)))), ((int)(((byte)(80))))); + this.barSlider1.BarPenColorBottom = System.Drawing.Color.Empty; + this.barSlider1.BarPenColorMiddle = System.Drawing.Color.Empty; + this.barSlider1.BarPenColorTop = System.Drawing.Color.Empty; + this.barSlider1.BorderRoundRectSize = new System.Drawing.Size(32, 32); + this.barSlider1.DataType = null; + this.barSlider1.DrawSemitransparentThumb = false; + this.barSlider1.ElapsedInnerColor = System.Drawing.Color.FromArgb(((int)(((byte)(83)))), ((int)(((byte)(121)))), ((int)(((byte)(180))))); + this.barSlider1.ElapsedPenColorBottom = System.Drawing.Color.Empty; + this.barSlider1.ElapsedPenColorMiddle = System.Drawing.Color.Empty; + this.barSlider1.ElapsedPenColorTop = System.Drawing.Color.Empty; + this.barSlider1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F); + this.barSlider1.IncrementAmount = 0.01F; + this.barSlider1.InputName = "Param1"; + this.barSlider1.LargeChange = 5F; + this.barSlider1.Location = new System.Drawing.Point(6, 4); + this.barSlider1.Maximum = 100F; + this.barSlider1.Minimum = 0F; + this.barSlider1.Name = "barSlider1"; + this.barSlider1.Precision = 0.01F; + this.barSlider1.ScaleDivisions = 1; + this.barSlider1.ScaleSubDivisions = 2; + this.barSlider1.ShowDivisionsText = false; + this.barSlider1.ShowSmallScale = false; + this.barSlider1.Size = new System.Drawing.Size(122, 25); + this.barSlider1.SmallChange = 1F; + this.barSlider1.TabIndex = 1; + this.barSlider1.Text = "barSlider1"; + this.barSlider1.ThumbInnerColor = System.Drawing.Color.Empty; + this.barSlider1.ThumbPenColor = System.Drawing.Color.Empty; + this.barSlider1.ThumbRoundRectSize = new System.Drawing.Size(1, 1); + this.barSlider1.ThumbSize = new System.Drawing.Size(1, 1); + this.barSlider1.TickAdd = 0F; + this.barSlider1.TickColor = System.Drawing.Color.White; + this.barSlider1.TickDivide = 0F; + this.barSlider1.TickStyle = System.Windows.Forms.TickStyle.None; + this.barSlider1.UseInterlapsedBar = true; + this.barSlider1.Value = 30F; + // + // barSlider2 + // + this.barSlider2.ActiveEditColor = System.Drawing.Color.FromArgb(((int)(((byte)(40)))), ((int)(((byte)(40)))), ((int)(((byte)(40))))); + this.barSlider2.BarInnerColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(80)))), ((int)(((byte)(80))))); + this.barSlider2.BarPenColorBottom = System.Drawing.Color.Empty; + this.barSlider2.BarPenColorMiddle = System.Drawing.Color.Empty; + this.barSlider2.BarPenColorTop = System.Drawing.Color.Empty; + this.barSlider2.BorderRoundRectSize = new System.Drawing.Size(32, 32); + this.barSlider2.DataType = null; + this.barSlider2.DrawSemitransparentThumb = false; + this.barSlider2.ElapsedInnerColor = System.Drawing.Color.FromArgb(((int)(((byte)(83)))), ((int)(((byte)(121)))), ((int)(((byte)(180))))); + this.barSlider2.ElapsedPenColorBottom = System.Drawing.Color.Empty; + this.barSlider2.ElapsedPenColorMiddle = System.Drawing.Color.Empty; + this.barSlider2.ElapsedPenColorTop = System.Drawing.Color.Empty; + this.barSlider2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F); + this.barSlider2.IncrementAmount = 0.01F; + this.barSlider2.InputName = "Param2"; + this.barSlider2.LargeChange = 5F; + this.barSlider2.Location = new System.Drawing.Point(134, 4); + this.barSlider2.Maximum = 100F; + this.barSlider2.Minimum = 0F; + this.barSlider2.Name = "barSlider2"; + this.barSlider2.Precision = 0.01F; + this.barSlider2.ScaleDivisions = 1; + this.barSlider2.ScaleSubDivisions = 2; + this.barSlider2.ShowDivisionsText = false; + this.barSlider2.ShowSmallScale = false; + this.barSlider2.Size = new System.Drawing.Size(122, 25); + this.barSlider2.SmallChange = 1F; + this.barSlider2.TabIndex = 10; + this.barSlider2.Text = "barSlider2"; + this.barSlider2.ThumbInnerColor = System.Drawing.Color.Empty; + this.barSlider2.ThumbPenColor = System.Drawing.Color.Empty; + this.barSlider2.ThumbRoundRectSize = new System.Drawing.Size(1, 1); + this.barSlider2.ThumbSize = new System.Drawing.Size(1, 1); + this.barSlider2.TickAdd = 0F; + this.barSlider2.TickColor = System.Drawing.Color.White; + this.barSlider2.TickDivide = 0F; + this.barSlider2.TickStyle = System.Windows.Forms.TickStyle.None; + this.barSlider2.UseInterlapsedBar = true; + this.barSlider2.Value = 30F; + // + // barSlider3 + // + this.barSlider3.ActiveEditColor = System.Drawing.Color.FromArgb(((int)(((byte)(40)))), ((int)(((byte)(40)))), ((int)(((byte)(40))))); + this.barSlider3.BarInnerColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(80)))), ((int)(((byte)(80))))); + this.barSlider3.BarPenColorBottom = System.Drawing.Color.Empty; + this.barSlider3.BarPenColorMiddle = System.Drawing.Color.Empty; + this.barSlider3.BarPenColorTop = System.Drawing.Color.Empty; + this.barSlider3.BorderRoundRectSize = new System.Drawing.Size(32, 32); + this.barSlider3.DataType = null; + this.barSlider3.DrawSemitransparentThumb = false; + this.barSlider3.ElapsedInnerColor = System.Drawing.Color.FromArgb(((int)(((byte)(83)))), ((int)(((byte)(121)))), ((int)(((byte)(180))))); + this.barSlider3.ElapsedPenColorBottom = System.Drawing.Color.Empty; + this.barSlider3.ElapsedPenColorMiddle = System.Drawing.Color.Empty; + this.barSlider3.ElapsedPenColorTop = System.Drawing.Color.Empty; + this.barSlider3.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F); + this.barSlider3.IncrementAmount = 0.01F; + this.barSlider3.InputName = "Param4"; + this.barSlider3.LargeChange = 5F; + this.barSlider3.Location = new System.Drawing.Point(392, 5); + this.barSlider3.Maximum = 100F; + this.barSlider3.Minimum = 0F; + this.barSlider3.Name = "barSlider3"; + this.barSlider3.Precision = 0.01F; + this.barSlider3.ScaleDivisions = 1; + this.barSlider3.ScaleSubDivisions = 2; + this.barSlider3.ShowDivisionsText = false; + this.barSlider3.ShowSmallScale = false; + this.barSlider3.Size = new System.Drawing.Size(122, 25); + this.barSlider3.SmallChange = 1F; + this.barSlider3.TabIndex = 12; + this.barSlider3.Text = "barSlider3"; + this.barSlider3.ThumbInnerColor = System.Drawing.Color.Empty; + this.barSlider3.ThumbPenColor = System.Drawing.Color.Empty; + this.barSlider3.ThumbRoundRectSize = new System.Drawing.Size(1, 1); + this.barSlider3.ThumbSize = new System.Drawing.Size(1, 1); + this.barSlider3.TickAdd = 0F; + this.barSlider3.TickColor = System.Drawing.Color.White; + this.barSlider3.TickDivide = 0F; + this.barSlider3.TickStyle = System.Windows.Forms.TickStyle.None; + this.barSlider3.UseInterlapsedBar = true; + this.barSlider3.Value = 30F; + // + // barSlider4 + // + this.barSlider4.ActiveEditColor = System.Drawing.Color.FromArgb(((int)(((byte)(40)))), ((int)(((byte)(40)))), ((int)(((byte)(40))))); + this.barSlider4.BarInnerColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(80)))), ((int)(((byte)(80))))); + this.barSlider4.BarPenColorBottom = System.Drawing.Color.Empty; + this.barSlider4.BarPenColorMiddle = System.Drawing.Color.Empty; + this.barSlider4.BarPenColorTop = System.Drawing.Color.Empty; + this.barSlider4.BorderRoundRectSize = new System.Drawing.Size(32, 32); + this.barSlider4.DataType = null; + this.barSlider4.DrawSemitransparentThumb = false; + this.barSlider4.ElapsedInnerColor = System.Drawing.Color.FromArgb(((int)(((byte)(83)))), ((int)(((byte)(121)))), ((int)(((byte)(180))))); + this.barSlider4.ElapsedPenColorBottom = System.Drawing.Color.Empty; + this.barSlider4.ElapsedPenColorMiddle = System.Drawing.Color.Empty; + this.barSlider4.ElapsedPenColorTop = System.Drawing.Color.Empty; + this.barSlider4.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F); + this.barSlider4.IncrementAmount = 0.01F; + this.barSlider4.InputName = "Param3"; + this.barSlider4.LargeChange = 5F; + this.barSlider4.Location = new System.Drawing.Point(264, 5); + this.barSlider4.Maximum = 100F; + this.barSlider4.Minimum = 0F; + this.barSlider4.Name = "barSlider4"; + this.barSlider4.Precision = 0.01F; + this.barSlider4.ScaleDivisions = 1; + this.barSlider4.ScaleSubDivisions = 2; + this.barSlider4.ShowDivisionsText = false; + this.barSlider4.ShowSmallScale = false; + this.barSlider4.Size = new System.Drawing.Size(122, 25); + this.barSlider4.SmallChange = 1F; + this.barSlider4.TabIndex = 11; + this.barSlider4.Text = "barSlider4"; + this.barSlider4.ThumbInnerColor = System.Drawing.Color.Empty; + this.barSlider4.ThumbPenColor = System.Drawing.Color.Empty; + this.barSlider4.ThumbRoundRectSize = new System.Drawing.Size(1, 1); + this.barSlider4.ThumbSize = new System.Drawing.Size(1, 1); + this.barSlider4.TickAdd = 0F; + this.barSlider4.TickColor = System.Drawing.Color.White; + this.barSlider4.TickDivide = 0F; + this.barSlider4.TickStyle = System.Windows.Forms.TickStyle.None; + this.barSlider4.UseInterlapsedBar = true; + this.barSlider4.Value = 30F; + // + // stPanel2 + // + this.stPanel2.Controls.Add(this.barSlider2); + this.stPanel2.Controls.Add(this.barSlider1); + this.stPanel2.Controls.Add(this.barSlider3); + this.stPanel2.Controls.Add(this.barSlider4); + this.stPanel2.Location = new System.Drawing.Point(3, 87); + this.stPanel2.Name = "stPanel2"; + this.stPanel2.Size = new System.Drawing.Size(555, 40); + this.stPanel2.TabIndex = 13; + // + // GFLXMaterialEditor + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.stTabControl1); + this.Name = "GFLXMaterialEditor"; + this.Size = new System.Drawing.Size(575, 769); + this.stTabControl1.ResumeLayout(false); + this.tabPage1.ResumeLayout(false); + this.stPanel1.ResumeLayout(false); + this.stFlowLayoutPanel1.ResumeLayout(false); + this.stDropDownPanel1.ResumeLayout(false); + this.stDropDownPanel1.PerformLayout(); + this.stDropDownPanel2.ResumeLayout(false); + this.stDropDownPanel2.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBoxCustom1)).EndInit(); + this.stPanel2.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + + private Toolbox.Library.Forms.STTabControl stTabControl1; + private System.Windows.Forms.TabPage tabPage1; + private Toolbox.Library.Forms.STPanel stPanel1; + private System.Windows.Forms.TabPage tabPage2; + private Toolbox.Library.Forms.STFlowLayoutPanel stFlowLayoutPanel1; + private Toolbox.Library.Forms.STDropDownPanel stDropDownPanel1; + private Toolbox.Library.Forms.STDropDownPanel stDropDownPanel2; + private Toolbox.Library.Forms.ListViewCustom listViewCustom1; + private Toolbox.Library.Forms.STLabel stLabel2; + private Toolbox.Library.Forms.STTextBox stTextBox2; + private Toolbox.Library.Forms.STLabel stLabel1; + private Toolbox.Library.Forms.STTextBox stTextBox1; + private System.Windows.Forms.ColumnHeader columnHeader1; + private Toolbox.Library.Forms.PictureBoxCustom pictureBoxCustom1; + private Toolbox.Library.Forms.STComboBox stComboBox2; + private Toolbox.Library.Forms.STComboBox stComboBox1; + private Toolbox.Library.Forms.STLabel stLabel4; + private Toolbox.Library.Forms.STLabel stLabel3; + private BarSlider.BarSlider barSlider3; + private BarSlider.BarSlider barSlider4; + private BarSlider.BarSlider barSlider2; + private BarSlider.BarSlider barSlider1; + private Toolbox.Library.Forms.STPanel stPanel2; + } +} diff --git a/File_Format_Library/GUI/GFBMDL/GFLXMaterialEditor.cs b/File_Format_Library/GUI/GFBMDL/GFLXMaterialEditor.cs new file mode 100644 index 00000000..466c535f --- /dev/null +++ b/File_Format_Library/GUI/GFBMDL/GFLXMaterialEditor.cs @@ -0,0 +1,146 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading; +using System.Windows.Forms; +using Toolbox.Library.Forms; +using Toolbox.Library; + +namespace FirstPlugin.Forms +{ + public partial class GFLXMaterialEditor : STUserControl + { + private GFLXMaterialData MaterialData; + + private ImageList TextureIconList; + + public GFLXMaterialEditor() + { + InitializeComponent(); + + stTabControl1.myBackColor = FormThemes.BaseTheme.FormBackColor; + TextureIconList = new ImageList() + { + ColorDepth = ColorDepth.Depth32Bit, + ImageSize = new Size(22, 22), + }; + + listViewCustom1.LargeImageList = TextureIconList; + listViewCustom1.SmallImageList = TextureIconList; + + stDropDownPanel1.ResetColors(); + stDropDownPanel2.ResetColors(); + + ResetSliders(); + } + + private void ResetSliders() + { + barSlider1.SetTheme(); + barSlider2.SetTheme(); + barSlider3.SetTheme(); + barSlider4.SetTheme(); + + barSlider1.Value = 0; + barSlider2.Value = 0; + barSlider3.Value = 0; + barSlider4.Value = 0; + } + + public void LoadMaterial(GFLXMaterialData materialData) + { + MaterialData = materialData; + + GFLXMaterialParamEditor paramEditor = new GFLXMaterialParamEditor(); + paramEditor.Dock = DockStyle.Fill; + paramEditor.LoadParams(materialData); + tabPage2.Controls.Add(paramEditor); + + Thread Thread = new Thread((ThreadStart)(() => + { + foreach (var tex in materialData.TextureMaps) + { + Bitmap image = null; + + foreach (var bntx in PluginRuntime.bntxContainers) + { + if (bntx.Textures.ContainsKey(tex.Name)) { + try { + image = bntx.Textures[tex.Name].GetBitmap(); + } + catch { + image = Properties.Resources.TextureError; + } + } + } + + AddTexture(tex.Name, image); + } + })); + Thread.Start(); + } + + private void AddTexture(string name, Bitmap image) + { + if (listViewCustom1.InvokeRequired) + { + listViewCustom1.Invoke((MethodInvoker)delegate { + // Running on the UI thread + ListViewItem item = new ListViewItem(name); + listViewCustom1.Items.Add(item); + if (image != null) + { + item.ImageIndex = TextureIconList.Images.Count; + TextureIconList.Images.Add(image); + var dummy = listViewCustom1.Handle; + } + }); + } + } + + private void listViewCustom1_SelectedIndexChanged(object sender, EventArgs e) + { + if (listViewCustom1.SelectedIndices.Count > 0) { + int index = listViewCustom1.SelectedIndices[0]; + var tex = MaterialData.TextureMaps[index]; + stTextBox1.Text = tex.Name; + stTextBox2.Text = tex.SamplerName; + + foreach (var bntx in PluginRuntime.bntxContainers) { + if (bntx.Textures.ContainsKey(tex.Name)) + UpdateTexturePreview(bntx.Textures[tex.Name]); + } + } + else + { + ResetSliders(); + pictureBoxCustom1.Image = null; + } + } + + private void UpdateTexturePreview(STGenericTexture texture) + { + Thread Thread = new Thread((ThreadStart)(() => + { + Bitmap image = null; + + try { + image = texture.GetBitmap(); + } + catch { + image = Properties.Resources.TextureError; + } + + pictureBoxCustom1.Invoke((MethodInvoker)delegate { + // Running on the UI thread + pictureBoxCustom1.Image = image; + }); + })); + Thread.Start(); + } + } +} diff --git a/File_Format_Library/GUI/GFBMDL/GFLXMaterialEditor.resx b/File_Format_Library/GUI/GFBMDL/GFLXMaterialEditor.resx new file mode 100644 index 00000000..87e8cbc9 --- /dev/null +++ b/File_Format_Library/GUI/GFBMDL/GFLXMaterialEditor.resx @@ -0,0 +1,328 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + + iVBORw0KGgoAAAANSUhEUgAAAlgAAAJYCAMAAACJuGjuAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 + JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAADAFBMVEXMzMzNzc3Ozs7Pz8/Q0NDR0dHS + 0tLT09PU1NTV1dXW1tbX19fY2NjZ2dna2trb29vc3Nzd3d3e3t7f39/g4ODh4eHi4uLj4+Pk5OTl5eXm + 5ubn5+fo6Ojp6enq6urr6+vs7Ozt7e3u7u7v7+/w8PDx8fHy8vLz8/P09PT19fX29vb39/f4+Pj5+fn6 + +vr7+/v8/Pz9/f3+/v7///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACDTbOhAAAACXBIWXMAAA7DAAAOwwHHb6hkAAAAGXRF + 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 + + + \ No newline at end of file diff --git a/File_Format_Library/GUI/Pokemon/PokemonLoaderSwSh.Designer.cs b/File_Format_Library/GUI/Pokemon/PokemonLoaderSwSh.Designer.cs new file mode 100644 index 00000000..3bc72d7c --- /dev/null +++ b/File_Format_Library/GUI/Pokemon/PokemonLoaderSwSh.Designer.cs @@ -0,0 +1,64 @@ +namespace FirstPlugin.Forms +{ + partial class PokemonLoaderSwShForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.listViewCustom1 = new Toolbox.Library.Forms.ListViewCustom(); + this.SuspendLayout(); + // + // listViewCustom1 + // + this.listViewCustom1.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.listViewCustom1.Dock = System.Windows.Forms.DockStyle.Fill; + this.listViewCustom1.HideSelection = false; + this.listViewCustom1.Location = new System.Drawing.Point(0, 0); + this.listViewCustom1.Name = "listViewCustom1"; + this.listViewCustom1.OwnerDraw = true; + this.listViewCustom1.Size = new System.Drawing.Size(800, 450); + this.listViewCustom1.TabIndex = 0; + this.listViewCustom1.UseCompatibleStateImageBehavior = false; + this.listViewCustom1.DoubleClick += new System.EventHandler(this.listViewCustom1_DoubleClick); + // + // PokemonLoaderSwShForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.contentContainer.Controls.Add(this.listViewCustom1); + this.Name = "PokemonLoaderSwShForm"; + this.Text = "PokemonLoaderSwSh"; + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.PokemonLoaderSwShForm_FormClosing); + this.Load += new System.EventHandler(this.PokemonLoaderSwShForm_Load); + this.ResumeLayout(false); + + } + + #endregion + + private Toolbox.Library.Forms.ListViewCustom listViewCustom1; + } +} \ No newline at end of file diff --git a/File_Format_Library/GUI/Pokemon/PokemonLoaderSwSh.cs b/File_Format_Library/GUI/Pokemon/PokemonLoaderSwSh.cs new file mode 100644 index 00000000..c3f52168 --- /dev/null +++ b/File_Format_Library/GUI/Pokemon/PokemonLoaderSwSh.cs @@ -0,0 +1,114 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Threading; +using System.Drawing; +using System.Linq; +using System.Text; +using System.IO; +using System.Windows.Forms; +using Toolbox.Library; +using Toolbox.Library.IO; +using Toolbox.Library.Forms; + +namespace FirstPlugin.Forms +{ + public partial class PokemonLoaderSwShForm : STForm + { + private bool CancelOperation = false; + + public string SelectedPokemon = ""; + + ImageList ImageList; + + public PokemonLoaderSwShForm() + { + InitializeComponent(); + + ImageList = new ImageList() + { + ColorDepth = ColorDepth.Depth32Bit, + ImageSize = new Size(100, 100), + }; + + listViewCustom1.SmallImageList = ImageList; + listViewCustom1.LargeImageList = ImageList; + } + + + private void PokemonLoaderSwShForm_Load(object sender, EventArgs e) + { + string gamePath = Runtime.PkSwShGamePath; + if (Directory.Exists(gamePath)) + { + string IconPath = $"{gamePath}/bin/appli/icon_pokemon"; + if (!Directory.Exists(IconPath)) + return; + + Thread Thread = new Thread((ThreadStart)(() => + { + foreach (var file in Directory.GetFiles(IconPath)) + { + if (CancelOperation) + break; + + if (Utils.GetExtension(file) == ".bntx") + { + var bntx = (BNTX)STFileLoader.OpenFileFormat(file); + + string name = bntx.Text.Replace($"poke_icon_", string.Empty); + //All we need is the first 8 characters + name = name.Substring(0, 7); + + Bitmap bitmap = null; + try + { + var tex = bntx.Textures.Values.FirstOrDefault(); + bitmap = tex.GetBitmap(); + } + catch + { + bitmap = Properties.Resources.TextureError; + } + + AddTexture($"pm{name}.gfpak", bitmap); + } + } + })); Thread.Start(); + + } + } + + private void AddTexture(string name, Bitmap image) + { + if (listViewCustom1.Disposing || listViewCustom1.IsDisposed) return; + + if (listViewCustom1.InvokeRequired) + { + listViewCustom1.Invoke((MethodInvoker)delegate { + // Running on the UI thread + ListViewItem item = new ListViewItem(name); + listViewCustom1.Items.Add(item); + if (image != null) + { + item.ImageIndex = ImageList.Images.Count; + ImageList.Images.Add(image); + var dummy = listViewCustom1.Handle; + } + }); + } + } + + private void PokemonLoaderSwShForm_FormClosing(object sender, FormClosingEventArgs e) { + CancelOperation = true; + } + + private void listViewCustom1_DoubleClick(object sender, EventArgs e) { + if (listViewCustom1.SelectedItems.Count > 0) { + CancelOperation = true; + SelectedPokemon = listViewCustom1.SelectedItems[0].Text; + DialogResult = DialogResult.OK; + } + } + } +} diff --git a/File_Format_Library/GUI/Pokemon/PokemonLoaderSwSh.resx b/File_Format_Library/GUI/Pokemon/PokemonLoaderSwSh.resx new file mode 100644 index 00000000..1af7de15 --- /dev/null +++ b/File_Format_Library/GUI/Pokemon/PokemonLoaderSwSh.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/File_Format_Library/Main.cs b/File_Format_Library/Main.cs index 071045cc..dfeacb22 100644 --- a/File_Format_Library/Main.cs +++ b/File_Format_Library/Main.cs @@ -104,6 +104,51 @@ namespace FirstPlugin toolsExt[2] = new STToolStripItem("Breath Of The Wild"); toolsExt[2].DropDownItems.Add(new STToolStripItem("Actor Editor", ActorEditor)); + + toolsExt[1] = new STToolStripItem("Pokemon Sword/Shield"); + toolsExt[1].DropDownItems.Add(new STToolStripItem("Pokemon Loader", PokemonLoaderSwSh)); + } + + private void PokemonLoaderSwSh(object sender, EventArgs args) + { + if (!System.IO.Directory.Exists(Runtime.PkSwShGamePath)) + { + var result = MessageBox.Show("Please set your Pokemon Sword/Shield game path!"); + if (result == DialogResult.OK) + { + FolderSelectDialog ofd = new FolderSelectDialog(); + if (ofd.ShowDialog() == DialogResult.OK) + { + Runtime.PkSwShGamePath = ofd.SelectedPath; + Config.Save(); + } + } + } + + PokemonLoaderSwShForm form = new PokemonLoaderSwShForm(); + if (form.ShowDialog() == DialogResult.OK) { + if (form.SelectedPokemon != string.Empty) + { + string path = $"{Runtime.PkSwShGamePath}/bin/archive/pokemon/{form.SelectedPokemon}"; + if (System.IO.File.Exists(path)) { + var file = STFileLoader.OpenFileFormat(path); + + var currentForm = Runtime.MainForm.ActiveMdiChild; + if (currentForm != null && currentForm is ObjectEditor && + Runtime.AddFilesToActiveObjectEditor) + { + ObjectEditor editor = currentForm as ObjectEditor; + editor.AddIArchiveFile(file); + } + else + { + ObjectEditor editor = new ObjectEditor(); + editor.AddIArchiveFile(file); + LibraryGUI.CreateMdiWindow(editor); + } + } + } + } } private void ActorEditor(object sender, EventArgs args) @@ -347,7 +392,8 @@ namespace FirstPlugin Formats.Add(typeof(IGA_PAK)); Formats.Add(typeof(MKAGPDX_Model)); Formats.Add(typeof(GFBMDL)); - // Formats.Add(typeof(GFBANM)); + // Formats.Add(typeof(GFBANM)); + Formats.Add(typeof(GFBANMCFG)); Formats.Add(typeof(Turbo.Course_MapCamera_bin)); Formats.Add(typeof(SDF)); Formats.Add(typeof(IStorage)); diff --git a/Switch_Toolbox_Library/Config.cs b/Switch_Toolbox_Library/Config.cs index 423a93a8..754d86da 100644 --- a/Switch_Toolbox_Library/Config.cs +++ b/Switch_Toolbox_Library/Config.cs @@ -173,6 +173,9 @@ namespace Toolbox.Library case "TpGamePath": Runtime.TpGamePath = node.InnerText; break; + case "PkSwShGamePath": + Runtime.PkSwShGamePath = node.InnerText; + break; case "BotwGamePath": Runtime.BotwGamePath = node.InnerText; break; @@ -291,6 +294,7 @@ namespace Toolbox.Library case "TransformPaneChidlren": bool.TryParse(node.InnerText, out Runtime.LayoutEditor.TransformChidlren); break; + } } @@ -470,6 +474,7 @@ namespace Toolbox.Library PathsNode.AppendChild(createNode(doc, "BotwGamePath", Runtime.BotwGamePath.ToString())); PathsNode.AppendChild(createNode(doc, "SpecularCubeMapPath", Runtime.PBR.SpecularCubeMapPath.ToString())); PathsNode.AppendChild(createNode(doc, "DiffuseCubeMapPath", Runtime.PBR.DiffuseCubeMapPath.ToString())); + PathsNode.AppendChild(createNode(doc, "PkSwShGamePath", Runtime.PkSwShGamePath.ToString())); } private static void AppendSwitchKeyPathSettings(XmlDocument doc, XmlNode parentNode) diff --git a/Switch_Toolbox_Library/FileFormats/DAE/DAE.cs b/Switch_Toolbox_Library/FileFormats/DAE/DAE.cs index b157fc14..adeaaa9b 100644 --- a/Switch_Toolbox_Library/FileFormats/DAE/DAE.cs +++ b/Switch_Toolbox_Library/FileFormats/DAE/DAE.cs @@ -20,14 +20,11 @@ namespace Toolbox.Library public class ExportSettings { public bool SuppressConfirmDialog = false; - public bool OptmizeZeroWeights = true; - public bool UseOldExporter = false; - public bool UseVertexColors = true; - public bool FlipTexCoordsVertical = true; + public bool OnlyExportRiggedBones = false; public Version FileVersion = new Version(); @@ -191,8 +188,39 @@ namespace Toolbox.Library writer.WriteLibraryImages(); if (skeleton != null) { + //Search for bones with rigging first + List riggedBones = new List(); + if (settings.OnlyExportRiggedBones) + { + for (int i = 0; i < Meshes.Count; i++) + { + for (int v = 0; v < Meshes[i].vertices.Count; v++) + { + var vertex = Meshes[i].vertices[v]; + for (int j = 0; j < vertex.boneIds.Count; j++) + { + int id = -1; + if (NodeArray != null && NodeArray.Count > vertex.boneIds[j]) { + id = NodeArray[vertex.boneIds[j]]; + } + else + id = vertex.boneIds[j]; + + if (id < skeleton.bones.Count && id != -1) + riggedBones.Add(skeleton.bones[id].Text); + } + } + } + } + foreach (var bone in skeleton.bones) { + if (settings.OnlyExportRiggedBones && !riggedBones.Contains(bone.Text)) + { + Console.WriteLine("Skipping " + bone.Text); + continue; + } + //Set the inverse matrix var inverse = skeleton.GetBoneTransform(bone).Inverted(); var transform = bone.GetTransform(); @@ -322,6 +350,8 @@ namespace Toolbox.Library if (b > mesh.VertexSkinCount - 1) continue; + + if (vertex.boneWeights.Count > b) { if (vertex.boneWeights[b] == 0) diff --git a/Switch_Toolbox_Library/IO/FlatBuffer/FlatBufferParse.cs b/Switch_Toolbox_Library/IO/FlatBuffer/FlatBufferParse.cs new file mode 100644 index 00000000..5411b7b4 --- /dev/null +++ b/Switch_Toolbox_Library/IO/FlatBuffer/FlatBufferParse.cs @@ -0,0 +1,136 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.IO; +using System.Threading.Tasks; +using System.Reflection; +using Toolbox.Library.IO; +using OpenTK; + +namespace Toolbox.Library.IO.FlatBuffer +{ + public class FlatBufferParse + { + public static T ParseFlatTable(FileReader reader) + where T : FlatTable, new() + { + long origin = reader.Position; + + int vtableSOffset = reader.ReadInt32(); + var dataOffset = reader.ReadOffset(true, typeof(uint)); + + T section = new T(); + using (reader.TemporarySeek(origin - vtableSOffset, System.IO.SeekOrigin.Begin)) + { + ushort vTableSize = reader.ReadUInt16(); + ushort tableSize = reader.ReadUInt16(); + + Console.WriteLine($"vTableSize {vTableSize}"); + Console.WriteLine($"tableSize {tableSize}"); + + List pointers = new List(); + uint looper = 4; + while (looper < vTableSize) + { + pointers.Add(reader.ReadUInt16()); + looper += 2; + } + + section.LayoutPointers = pointers.ToArray(); + } + + using (reader.TemporarySeek(dataOffset, System.IO.SeekOrigin.Begin)) + { + section.Read(reader); + } + + return section; + } + + } + + public class FlatTableParse : Attribute { } + + public class FlatTable + { + public ushort LayoutSize { get; set; } + public ushort LayoutStride { get; set; } + + public ushort[] LayoutPointers { get; set; } + + public void Read(FileReader reader) + { + long origin = reader.Position; + + PropertyInfo[] types = new PropertyInfo[(int)LayoutPointers?.Length]; + + var sectionType = this.GetType(); + + int index = 0; + foreach (var prop in sectionType.GetProperties()) + { + if (!Attribute.IsDefined(prop, typeof(FlatTableParse))) + continue; + + types[index++] = prop; + } + + for (int i = 0; i < LayoutPointers?.Length; i++) + { + reader.SeekBegin(origin + LayoutPointers[i]); + if (types[i] != null) + { + var prop = types[i]; + var propertyType = prop.PropertyType; + + if (propertyType == typeof(uint)) + prop.SetValue(this, reader.ReadUInt32()); + else if (propertyType == typeof(int)) + prop.SetValue(this, reader.ReadInt32()); + else if (propertyType == typeof(byte)) + prop.SetValue(this, reader.ReadByte()); + else if (propertyType == typeof(sbyte)) + prop.SetValue(this, reader.ReadSByte()); + else if (propertyType == typeof(ushort)) + prop.SetValue(this, reader.ReadUInt16()); + else if (propertyType == typeof(short)) + prop.SetValue(this, reader.ReadInt16()); + if (propertyType == typeof(string)) + { + var offset = reader.ReadOffset(true, typeof(uint)); + reader.SeekBegin(offset); + prop.SetValue(this, reader.ReadString(Syroot.BinaryData.BinaryStringFormat.ByteLengthPrefix)); + } + else if (propertyType == typeof(Vector2)) + prop.SetValue(this, new Vector2( + reader.ReadSingle(), + reader.ReadSingle()) + ); + else if (propertyType == typeof(Vector3)) + prop.SetValue(this, new Vector3( + reader.ReadSingle(), + reader.ReadSingle(), + reader.ReadSingle()) + ); + else if (propertyType == typeof(Vector4)) + prop.SetValue(this, new Vector4( + reader.ReadSingle(), + reader.ReadSingle(), + reader.ReadSingle(), + reader.ReadSingle()) + ); + else if (propertyType == typeof(FlatTable)) + { + var offset = reader.ReadOffset(true, typeof(uint)); + reader.SeekBegin(offset); + } + else if (propertyType is IEnumerable) + { + + } + } + } + } + } + +} diff --git a/Switch_Toolbox_Library/IO/SyrootCommon/Half.cs b/Switch_Toolbox_Library/IO/SyrootCommon/Half.cs index d5c4ed1b..1570e8ed 100644 --- a/Switch_Toolbox_Library/IO/SyrootCommon/Half.cs +++ b/Switch_Toolbox_Library/IO/SyrootCommon/Half.cs @@ -63,7 +63,7 @@ namespace Syroot.IOExtension /// representation. /// /// The raw representation of the internally stored bits. - internal Half(ushort raw) + public Half(ushort raw) { Raw = raw; } diff --git a/Switch_Toolbox_Library/Runtime.cs b/Switch_Toolbox_Library/Runtime.cs index 2495eff2..dba3c6a1 100644 --- a/Switch_Toolbox_Library/Runtime.cs +++ b/Switch_Toolbox_Library/Runtime.cs @@ -31,6 +31,7 @@ namespace Toolbox.Library public static bool BotwTable = false; } + public static string PkSwShGamePath = ""; public static string Mk8GamePath = ""; public static string Mk8dGamePath = ""; public static string SmoGamePath = ""; diff --git a/Switch_Toolbox_Library/Toolbox_Library.csproj b/Switch_Toolbox_Library/Toolbox_Library.csproj index 1f0f0666..702e3f8e 100644 --- a/Switch_Toolbox_Library/Toolbox_Library.csproj +++ b/Switch_Toolbox_Library/Toolbox_Library.csproj @@ -345,12 +345,21 @@ GenericTextureImporterList.cs + + UserControl + + + UVEditorAdvanced.cs + Form UVEditorForm.cs + + UserControl + UserControl @@ -394,6 +403,7 @@ + @@ -1130,6 +1140,9 @@ UVEditor2.cs + + UVEditorAdvanced.cs + UVEditorForm.cs diff --git a/Toolbox/GUI/Settings.Designer.cs b/Toolbox/GUI/Settings.Designer.cs index 9e7d7cbc..6dd6237c 100644 --- a/Toolbox/GUI/Settings.Designer.cs +++ b/Toolbox/GUI/Settings.Designer.cs @@ -119,6 +119,8 @@ this.chkTpFileTable = new Toolbox.Library.Forms.STCheckBox(); this.stLabel17 = new Toolbox.Library.Forms.STLabel(); this.chkBotwFileTable = new Toolbox.Library.Forms.STCheckBox(); + this.stLabel18 = new Toolbox.Library.Forms.STLabel(); + this.pathPokemonSwShTB = new Toolbox.Library.Forms.STTextBox(); this.contentContainer.SuspendLayout(); this.panel2.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.cameraMaxSpeedUD)).BeginInit(); @@ -1027,6 +1029,8 @@ // // tabPage3 // + this.tabPage3.Controls.Add(this.stLabel18); + this.tabPage3.Controls.Add(this.pathPokemonSwShTB); this.tabPage3.Controls.Add(this.stLabel13); this.tabPage3.Controls.Add(this.botwGamePathTB); this.tabPage3.Controls.Add(this.stLabel14); @@ -1058,7 +1062,7 @@ // this.botwGamePathTB.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.botwGamePathTB.ContextMenuStrip = this.stContextMenuStrip1; - this.botwGamePathTB.Location = new System.Drawing.Point(112, 120); + this.botwGamePathTB.Location = new System.Drawing.Point(128, 120); this.botwGamePathTB.Name = "botwGamePathTB"; this.botwGamePathTB.Size = new System.Drawing.Size(258, 20); this.botwGamePathTB.TabIndex = 8; @@ -1091,7 +1095,7 @@ // this.tpGamePathTB.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.tpGamePathTB.ContextMenuStrip = this.stContextMenuStrip1; - this.tpGamePathTB.Location = new System.Drawing.Point(112, 94); + this.tpGamePathTB.Location = new System.Drawing.Point(128, 94); this.tpGamePathTB.Name = "tpGamePathTB"; this.tpGamePathTB.Size = new System.Drawing.Size(258, 20); this.tpGamePathTB.TabIndex = 6; @@ -1110,7 +1114,7 @@ // this.SMOPathTB.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.SMOPathTB.ContextMenuStrip = this.stContextMenuStrip1; - this.SMOPathTB.Location = new System.Drawing.Point(112, 68); + this.SMOPathTB.Location = new System.Drawing.Point(128, 68); this.SMOPathTB.Name = "SMOPathTB"; this.SMOPathTB.Size = new System.Drawing.Size(258, 20); this.SMOPathTB.TabIndex = 4; @@ -1129,7 +1133,7 @@ // this.mk8DPathTB.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.mk8DPathTB.ContextMenuStrip = this.stContextMenuStrip1; - this.mk8DPathTB.Location = new System.Drawing.Point(112, 42); + this.mk8DPathTB.Location = new System.Drawing.Point(128, 42); this.mk8DPathTB.Name = "mk8DPathTB"; this.mk8DPathTB.Size = new System.Drawing.Size(258, 20); this.mk8DPathTB.TabIndex = 2; @@ -1149,7 +1153,7 @@ this.mk8PathTB.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.mk8PathTB.ContextMenuStrip = this.stContextMenuStrip1; this.mk8PathTB.Cursor = System.Windows.Forms.Cursors.Default; - this.mk8PathTB.Location = new System.Drawing.Point(112, 16); + this.mk8PathTB.Location = new System.Drawing.Point(128, 16); this.mk8PathTB.Name = "mk8PathTB"; this.mk8PathTB.Size = new System.Drawing.Size(258, 20); this.mk8PathTB.TabIndex = 0; @@ -1280,6 +1284,26 @@ this.chkBotwFileTable.UseVisualStyleBackColor = true; this.chkBotwFileTable.CheckedChanged += new System.EventHandler(this.chkBotwFileTable_CheckedChanged); // + // stLabel18 + // + this.stLabel18.AutoSize = true; + this.stLabel18.Location = new System.Drawing.Point(6, 148); + this.stLabel18.Name = "stLabel18"; + this.stLabel18.Size = new System.Drawing.Size(119, 13); + this.stLabel18.TabIndex = 11; + this.stLabel18.Text = "Pokemon Sword/Shield"; + // + // pathPokemonSwShTB + // + this.pathPokemonSwShTB.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.pathPokemonSwShTB.ContextMenuStrip = this.stContextMenuStrip1; + this.pathPokemonSwShTB.Location = new System.Drawing.Point(128, 146); + this.pathPokemonSwShTB.Name = "pathPokemonSwShTB"; + this.pathPokemonSwShTB.Size = new System.Drawing.Size(258, 20); + this.pathPokemonSwShTB.TabIndex = 10; + this.pathPokemonSwShTB.Click += new System.EventHandler(this.pathPokemonSwShTB_Click); + this.pathPokemonSwShTB.TextChanged += new System.EventHandler(this.pathPokemonSwShTB_TextChanged); + // // Settings // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -1416,5 +1440,7 @@ private Toolbox.Library.Forms.STCheckBox chkBotwFileTable; private Toolbox.Library.Forms.STCheckBox chkFrameCamera; private Toolbox.Library.Forms.STCheckBox chkAlwaysCompressOnSave; + private Library.Forms.STLabel stLabel18; + private Library.Forms.STTextBox pathPokemonSwShTB; } } \ No newline at end of file diff --git a/Toolbox/GUI/Settings.cs b/Toolbox/GUI/Settings.cs index 0024d886..f3cac486 100644 --- a/Toolbox/GUI/Settings.cs +++ b/Toolbox/GUI/Settings.cs @@ -575,6 +575,10 @@ namespace Toolbox botwGamePathTB.Text = ""; Runtime.BotwGamePath = ""; break; + case "pathPokemonSwShTB": + pathPokemonSwShTB.Text = ""; + Runtime.PkSwShGamePath = ""; + break; } } } @@ -661,5 +665,31 @@ namespace Toolbox private void chkAlwaysCompressOnSave_CheckedChanged(object sender, EventArgs e) { Runtime.AlwaysCompressOnSave = chkAlwaysCompressOnSave.Checked; } + + private void pathPokemonSwShTB_TextChanged(object sender, EventArgs e) + { + + } + + private void pathPokemonSwShTB_Click(object sender, EventArgs e) { + FolderSelectDialog sfd = new FolderSelectDialog(); + if (sfd.ShowDialog() == DialogResult.OK) + { + if (!IsValidPokemonSwShDirectory(sfd.SelectedPath)) + throw new Exception("Invalid path choosen. You need Bin/appli/icon_pokemon atleast for pokemon icons"); + + pathPokemonSwShTB.Text = sfd.SelectedPath; + Runtime.PkSwShGamePath = pathPokemonSwShTB.Text; + } + } + + private bool IsValidPokemonSwShDirectory(string GamePath) + { + //Search for pokemon icons + string RstbPath = System.IO.Path.Combine($"{GamePath}", + "Bin", "appli", "icon_pokemon", "poke_icon_0000_00s_n.bntx"); + + return System.IO.File.Exists(RstbPath); + } } } diff --git a/Toolbox/Lib/FlatBufferTest.pdb b/Toolbox/Lib/FlatBufferTest.pdb new file mode 100644 index 00000000..4e0521c9 Binary files /dev/null and b/Toolbox/Lib/FlatBufferTest.pdb differ diff --git a/Toolbox/Lib/FlatBuffers.dll b/Toolbox/Lib/FlatBuffers.dll new file mode 100644 index 00000000..67a270ba Binary files /dev/null and b/Toolbox/Lib/FlatBuffers.dll differ diff --git a/Toolbox/Lib/FlatBuffers.pdb b/Toolbox/Lib/FlatBuffers.pdb new file mode 100644 index 00000000..4fa3b4cb Binary files /dev/null and b/Toolbox/Lib/FlatBuffers.pdb differ diff --git a/Toolbox/Lib/Licenses/FLATBUFFER LICENSE.txt b/Toolbox/Lib/Licenses/FLATBUFFER LICENSE.txt new file mode 100644 index 00000000..7a4a3ea2 --- /dev/null +++ b/Toolbox/Lib/Licenses/FLATBUFFER LICENSE.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. \ No newline at end of file diff --git a/Toolbox/Shader/Bfres/BFRES.vert b/Toolbox/Shader/Bfres/BFRES.vert index 985459d3..40a1eac9 100644 --- a/Toolbox/Shader/Bfres/BFRES.vert +++ b/Toolbox/Shader/Bfres/BFRES.vert @@ -134,7 +134,6 @@ void main() ivec4 index = ivec4(vBone); vec4 objPos = vec4(vPosition.xyz, 1.0); - if (vBone.x != -1.0) objPos = skin(objPos.xyz, index); diff --git a/Toolbox/Shader/GFBModel.frag b/Toolbox/Shader/GFBModel.frag index a0ec3464..23aceea3 100644 --- a/Toolbox/Shader/GFBModel.frag +++ b/Toolbox/Shader/GFBModel.frag @@ -63,6 +63,17 @@ uniform int GreenChannel; uniform int BlueChannel; uniform int AlphaChannel; +//Parameters +uniform float ColorUVScaleU; +uniform float ColorUVScaleV; +uniform float ColorUVTranslateU; +uniform float ColorUVTranslateV; + +uniform float NormalMapUVScaleU; +uniform float NormalMapUVScaleV; +uniform float NormalMapUVTranslateU; +uniform float NormalMapUVTranslateV; + uniform samplerCube irradianceMap; uniform samplerCube specularIbl; uniform sampler2D brdfLUT; @@ -127,7 +138,11 @@ void main() vec3 albedo = vec3(1); if (HasDiffuse == 1) { - vec4 DiffuseTex = pow(texture(DiffuseMap, f_texcoord0).rgba, vec4(gamma)); + vec2 colorUV = f_texcoord0; + colorUV.x *= ColorUVScaleU + ColorUVTranslateU; + colorUV.y *= ColorUVScaleV + ColorUVTranslateV; + + vec4 DiffuseTex = pow(texture(DiffuseMap, colorUV).rgba, vec4(gamma)); //Comp Selectors albedo.r = GetComponent(RedChannel, DiffuseTex); @@ -248,8 +263,12 @@ void main() } else if (renderType == 3) //DiffuseColor { + vec2 colorUV = displayTexCoord; + colorUV.x *= ColorUVScaleU + ColorUVTranslateU; + colorUV.y *= ColorUVScaleV + ColorUVTranslateV; + //Comp Selectors - vec4 diffuseMapColor = vec4(texture(DiffuseMap, displayTexCoord).rgb, 1); + vec4 diffuseMapColor = vec4(texture(DiffuseMap, colorUV).rgb, 1); diffuseMapColor.r = GetComponent(RedChannel, diffuseMapColor); diffuseMapColor.g = GetComponent(GreenChannel, diffuseMapColor); diffuseMapColor.b = GetComponent(BlueChannel, diffuseMapColor); @@ -257,7 +276,12 @@ void main() fragColor = vec4(diffuseMapColor.rgb, 1); } else if (renderType == 4) //Display Normal + { + if (HasNormalMap == 1) fragColor.rgb = texture(NormalMap, displayTexCoord).rgb; + else + fragColor.rgb = vec3(0); + } else if (renderType == 5) // vertexColor fragColor = vertexColor; else if (renderType == 6) //Display Ambient Occlusion diff --git a/Toolbox/Shader/GFBModel.vert b/Toolbox/Shader/GFBModel.vert index 67cda55e..fbca6f50 100644 --- a/Toolbox/Shader/GFBModel.vert +++ b/Toolbox/Shader/GFBModel.vert @@ -45,11 +45,6 @@ uniform int NoSkinning; uniform int RigidSkinning; uniform int SingleBoneIndex; -//Parameters -uniform float ColorUVScaleU; -uniform float ColorUVScaleV; -uniform float ColorUVTranslateU; -uniform float ColorUVTranslateV; vec4 skin(vec3 pos, ivec4 index) @@ -130,9 +125,6 @@ void main() f_texcoord2 = vUV2; tangent = vTangent; - f_texcoord0.x *= ColorUVScaleU + ColorUVTranslateU; - f_texcoord0.y *= ColorUVScaleV + ColorUVTranslateV; - gl_Position = position; objectPosition = position.xyz; diff --git a/Toolbox/Shader/GenericShader.frag b/Toolbox/Shader/GenericShader.frag index fd42e878..18e1ee3c 100644 --- a/Toolbox/Shader/GenericShader.frag +++ b/Toolbox/Shader/GenericShader.frag @@ -188,6 +188,8 @@ void main() fragColor = vec4(diffuseMapColor.rgb, 1); } + else if (renderType == 4) //Display Normal + fragColor.rgb = texture(NormalMap, displayTexCoord).rgb; else if (renderType == 5) // vertexColor fragColor = vertexColor; else if (renderType == 6) //Display Ambient Occlusion diff --git a/Toolbox/Toolbox.csproj b/Toolbox/Toolbox.csproj index fbe116ee..f3097a5b 100644 --- a/Toolbox/Toolbox.csproj +++ b/Toolbox/Toolbox.csproj @@ -403,6 +403,9 @@ PreserveNewest + + PreserveNewest + PreserveNewest