public static Formats.Meshes.MeshAttribute ParseMeshAttribute(this SsbhParser parser) { var result = new Formats.Meshes.MeshAttribute(); result.Index = parser.ReadInt32(); result.DataType = (Formats.Meshes.MeshAttribute.AttributeDataType)parser.ReadUInt32(); result.BufferIndex = parser.ReadInt32(); result.BufferOffset = parser.ReadInt32(); result.Unk4 = parser.ReadInt32(); result.Unk5 = parser.ReadInt32(); result.Name = parser.ReadOffsetReadString(); { // TODO: Extract this code to a method? long absoluteOffset = parser.ReadRelativeGetAbsoluteOffset(); long elementCount = parser.ReadInt64(); long previousPosition = parser.Position; parser.Seek(absoluteOffset); result.AttributeStrings = new Formats.SsbhString[elementCount]; for (int i = 0; i < elementCount; i++) { result.AttributeStrings[i] = parser.ParseSsbhString(); } parser.Seek(previousPosition); } return(result); }
public static Formats.HlpbRotateAim ParseHlpbRotateAim(this SsbhParser parser) { var result = new Formats.HlpbRotateAim(); result.Name = parser.ReadOffsetReadString(); result.AimBoneName1 = parser.ReadOffsetReadString(); result.AimBoneName2 = parser.ReadOffsetReadString(); result.AimType1 = parser.ReadOffsetReadString(); result.AimType2 = parser.ReadOffsetReadString(); result.TargetBoneName1 = parser.ReadOffsetReadString(); result.TargetBoneName2 = parser.ReadOffsetReadString(); result.Unknown1 = parser.ReadInt32(); result.Unknown2 = parser.ReadInt32(); result.Unknown3 = parser.ReadSingle(); result.Unknown4 = parser.ReadSingle(); result.Unknown5 = parser.ReadSingle(); result.Unknown6 = parser.ReadSingle(); result.Unknown7 = parser.ReadSingle(); result.Unknown8 = parser.ReadSingle(); result.Unknown9 = parser.ReadSingle(); result.Unknown10 = parser.ReadSingle(); result.Unknown11 = parser.ReadSingle(); result.Unknown12 = parser.ReadSingle(); result.Unknown13 = parser.ReadSingle(); result.Unknown14 = parser.ReadSingle(); result.Unknown15 = parser.ReadSingle(); result.Unknown16 = parser.ReadSingle(); result.Unknown17 = parser.ReadSingle(); result.Unknown18 = parser.ReadSingle(); result.Unknown19 = parser.ReadSingle(); result.Unknown20 = parser.ReadSingle(); result.Unknown21 = parser.ReadSingle(); result.Unknown22 = parser.ReadSingle(); return(result); }
/// <summary> /// Reads direct information from track /// </summary> /// <param name="reader"></param> /// <param name="flags"></param> /// <returns></returns> private object ReadDirect(SsbhParser reader, uint flags) { if (CheckFlag(flags, 0x00FF, AnimTrackFlags.Transform)) { var transform = new AnimTrackTransform() { Sx = reader.ReadSingle(), Sy = reader.ReadSingle(), Sz = reader.ReadSingle(), Rx = reader.ReadSingle(), Ry = reader.ReadSingle(), Rz = reader.ReadSingle(), Rw = reader.ReadSingle(), X = reader.ReadSingle(), Y = reader.ReadSingle(), Z = reader.ReadSingle(), CompensateScale = reader.ReadInt32() }; return(transform); } if (CheckFlag(flags, 0x00FF, AnimTrackFlags.Texture)) { return(new AnimTrackTexture() { UnkFloat1 = reader.ReadSingle(), UnkFloat2 = reader.ReadSingle(), UnkFloat3 = reader.ReadSingle(), UnkFloat4 = reader.ReadSingle(), Unknown = reader.ReadInt32() }); } if (CheckFlag(flags, 0x00FF, AnimTrackFlags.Float)) { return(reader.ReadSingle()); } if (CheckFlag(flags, 0x00FF, AnimTrackFlags.PatternIndex)) { return(reader.ReadInt32()); } if (CheckFlag(flags, 0x00FF, AnimTrackFlags.Boolean)) { return(reader.ReadByte() == 1); } if (CheckFlag(flags, 0x00FF, AnimTrackFlags.Vector4)) { return(new AnimTrackCustomVector4(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle())); } return(null); }
public static Formats.Materials.MatlAttribute.MatlRasterizerState ParseMatlRasterizerState(this SsbhParser parser) { var result = new Formats.Materials.MatlAttribute.MatlRasterizerState(); result.FillMode = (Formats.Materials.MatlFillMode)parser.ReadInt32(); result.CullMode = (Formats.Materials.MatlCullMode)parser.ReadInt32(); result.DepthBias = parser.ReadSingle(); result.Unk4 = parser.ReadSingle(); result.Unk5 = parser.ReadSingle(); result.Unk6 = parser.ReadInt32(); result.Unk7 = parser.ReadInt32(); result.Unk8 = parser.ReadSingle(); return(result); }
public static Formats.Materials.MatlAttribute.MatlBlendState ParseMatlBlendState(this SsbhParser parser) { var result = new Formats.Materials.MatlAttribute.MatlBlendState(); result.SourceColor = (Formats.Materials.MatlBlendFactor)parser.ReadInt32(); result.Unk2 = parser.ReadInt32(); result.DestinationColor = (Formats.Materials.MatlBlendFactor)parser.ReadInt32(); result.Unk4 = parser.ReadInt32(); result.Unk5 = parser.ReadInt32(); result.Unk6 = parser.ReadInt32(); result.EnableAlphaSampleToCoverage = parser.ReadInt32(); result.Unk8 = parser.ReadInt32(); result.Unk9 = parser.ReadInt32(); result.Unk10 = parser.ReadInt32(); return(result); }
public static Formats.SkelBoneEntry ParseSkelBoneEntry(this SsbhParser parser) { var result = new Formats.SkelBoneEntry(); result.Name = parser.ReadOffsetReadString(); result.Id = parser.ReadInt16(); result.ParentId = parser.ReadInt16(); result.Type = parser.ReadInt32(); return(result); }
public static Formats.Materials.MatlAttribute.MatlSampler ParseMatlSampler(this SsbhParser parser) { var result = new Formats.Materials.MatlAttribute.MatlSampler(); result.WrapS = (Formats.Materials.MatlWrapMode)parser.ReadInt32(); result.WrapT = (Formats.Materials.MatlWrapMode)parser.ReadInt32(); result.WrapR = (Formats.Materials.MatlWrapMode)parser.ReadInt32(); result.MinFilter = (Formats.Materials.MatlMinFilter)parser.ReadInt32(); result.MagFilter = (Formats.Materials.MatlMagFilter)parser.ReadInt32(); result.TextureFilteringType = (Formats.Materials.FilteringType)parser.ReadInt32(); result.BorderColor = parser.ParseMatlVector4(); result.Unk11 = parser.ReadInt32(); result.Unk12 = parser.ReadInt32(); result.LodBias = parser.ReadSingle(); result.MaxAnisotropy = parser.ReadInt32(); return(result); }
public static Formats.Meshes.MeshObject ParseMeshObject(this SsbhParser parser) { var result = new Formats.Meshes.MeshObject(); result.Name = parser.ReadOffsetReadString(); result.SubIndex = parser.ReadInt64(); result.ParentBoneName = parser.ReadOffsetReadString(); result.VertexCount = parser.ReadInt32(); result.IndexCount = parser.ReadInt32(); result.Unk2 = parser.ReadUInt32(); result.VertexOffset = parser.ReadInt32(); result.VertexOffset2 = parser.ReadInt32(); result.FinalBufferOffset = parser.ReadInt32(); result.BufferIndex = parser.ReadInt32(); result.Stride = parser.ReadInt32(); result.Stride2 = parser.ReadInt32(); result.Unk6 = parser.ReadInt32(); result.Unk7 = parser.ReadInt32(); result.ElementOffset = parser.ReadUInt32(); result.Unk8 = parser.ReadInt32(); result.DrawElementType = (Formats.Meshes.DrawElementType)parser.ReadInt32(); result.RiggingType = (Formats.Meshes.RiggingType)parser.ReadInt32(); result.Unk11 = parser.ReadInt32(); result.Unk12 = parser.ReadInt32(); result.BoundingSphereCenter = parser.ReadVector3(); result.BoundingSphereRadius = parser.ReadSingle(); result.BoundingBoxMin = parser.ReadVector3(); result.BoundingBoxMax = parser.ReadVector3(); result.OrientedBoundingBoxCenter = parser.ReadVector3(); result.OrientedBoundingBoxTransform = parser.ReadMatrix3x3(); result.OrientedBoundingBoxSize = parser.ReadVector3(); { // TODO: Extract this code to a method? long absoluteOffset = parser.ReadRelativeGetAbsoluteOffset(); long elementCount = parser.ReadInt64(); long previousPosition = parser.Position; parser.Seek(absoluteOffset); result.Attributes = new Formats.Meshes.MeshAttribute[elementCount]; for (int i = 0; i < elementCount; i++) { result.Attributes[i] = parser.ParseMeshAttribute(); } parser.Seek(previousPosition); } return(result); }
public static Formats.Rendering.NrpdSampler ParseNrpdSampler(this SsbhParser parser) { var result = new Formats.Rendering.NrpdSampler(); result.Name = parser.ReadOffsetReadString(); result.WrapS = parser.ReadInt32(); result.WrapT = parser.ReadInt32(); result.WrapR = parser.ReadInt32(); result.Unk4 = parser.ReadInt32(); result.Unk5 = parser.ReadInt32(); result.Unk6 = parser.ReadInt32(); result.Unk7 = parser.ReadInt32(); result.Unk8 = parser.ReadInt32(); result.Unk9 = parser.ReadInt32(); result.Unk10 = parser.ReadInt32(); result.Unk11 = parser.ReadInt32(); result.Unk12 = parser.ReadInt32(); result.Unk13 = parser.ReadSingle(); result.Unk14 = parser.ReadInt32(); result.Unk15 = parser.ReadInt32(); result.Unk16 = parser.ReadInt32(); return(result); }
public static Formats.Materials.MatlAttribute.MatlSampler ParseMatlSampler(this SsbhParser parser) { var result = new Formats.Materials.MatlAttribute.MatlSampler(); result.WrapS = (Formats.Materials.MatlWrapMode)parser.ReadInt32(); result.WrapT = (Formats.Materials.MatlWrapMode)parser.ReadInt32(); result.WrapR = (Formats.Materials.MatlWrapMode)parser.ReadInt32(); result.MinFilter = parser.ReadInt32(); result.MagFilter = parser.ReadInt32(); result.Unk6 = parser.ReadInt32(); result.Unk7 = parser.ReadInt32(); result.Unk8 = parser.ReadInt32(); result.Unk9 = parser.ReadInt32(); result.Unk10 = parser.ReadInt32(); result.Unk11 = parser.ReadInt32(); result.Unk12 = parser.ReadInt32(); result.LodBias = parser.ReadSingle(); result.MaxAnisotropy = parser.ReadInt32(); return(result); }
public static Formats.Materials.MatlAttribute.MatlBlendState ParseMatlBlendState(this SsbhParser parser) { var result = new Formats.Materials.MatlAttribute.MatlBlendState(); result.Unk1 = parser.ReadInt32(); result.Unk2 = parser.ReadInt32(); result.BlendFactor1 = parser.ReadInt32(); result.Unk4 = parser.ReadInt32(); result.Unk5 = parser.ReadInt32(); result.BlendFactor2 = parser.ReadInt32(); result.Unk7 = parser.ReadInt32(); result.Unk8 = parser.ReadInt32(); result.Unk9 = parser.ReadInt32(); result.Unk10 = parser.ReadInt32(); result.Unk11 = parser.ReadInt32(); result.Unk12 = parser.ReadInt32(); return(result); }