public override void Read(HKX hkx, HKXSection section, HKXObject source, BinaryReaderEx br, HKXVariation variation) { Idx0 = br.ReadByte(); Idx1 = br.ReadByte(); Idx2 = br.ReadByte(); Idx3 = br.ReadByte(); }
public override void Read(HKX hkx, HKXSection section, BinaryReaderEx br, HKXVariation variation) { SectionOffset = (uint)br.Position; AssertPointer(hkx, br); AssertPointer(hkx, br); meshTree = new HKArray <CompressedMeshBVHNode>(hkx, section, this, br, variation); BoundingBoxMin = br.ReadVector4(); BoundingBoxMax = br.ReadVector4(); numPrimitiveKeys = br.ReadUInt32(); bitsPerKey = br.ReadUInt32(); maxKeyValue = br.ReadUInt32(); Unk4C = br.ReadUInt32(); sections = new HKArray <CollisionMeshChunk>(hkx, section, this, br, variation); primitives = new HKArray <MeshPrimitive>(hkx, section, this, br, variation); sharedVerticesIndex = new HKArray <HKUShort>(hkx, section, this, br, variation); packedVertices = new HKArray <SmallCompressedVertex>(hkx, section, this, br, variation); sharedVertices = new HKArray <LargeCompressedVertex>(hkx, section, this, br, variation); primitiveDataRuns = new HKArray <HKUInt>(hkx, section, this, br, variation); UnkB0 = br.ReadUInt64(); simdTree = new HKArray <UnknownStructure2>(hkx, section, this, br, variation); UnkC8 = br.AssertUInt64(0); DataSize = (uint)br.Position - SectionOffset; ResolveDestinations(hkx, section); }
protected List <GlobalFixup> FindGlobalFixupDestinations(HKX hkx, HKXSection section) { List <GlobalFixup> sources = new List <GlobalFixup>(); foreach (var gu in hkx.ClassSection.GlobalFixups) { if ((gu.DstSectionIndex == section.SectionID) && gu.Dst >= SectionOffset && gu.Dst < (SectionOffset + DataSize)) { sources.Add(gu); } } foreach (var gu in hkx.TypeSection.GlobalFixups) { if ((gu.DstSectionIndex == section.SectionID) && gu.Dst >= SectionOffset && gu.Dst < (SectionOffset + DataSize)) { sources.Add(gu); } } foreach (var gu in hkx.DataSection.GlobalFixups) { if ((gu.DstSectionIndex == section.SectionID) && gu.Dst >= SectionOffset && gu.Dst < (SectionOffset + DataSize)) { sources.Add(gu); } } return(sources); }
public override void Read(HKX hkx, HKXSection section, HKXObject source, BinaryReaderEx br, HKXVariation variation) { BBX = br.ReadByte(); BBY = br.ReadByte(); BBZ = br.ReadByte(); IDX = br.ReadByte(); }
public override void Write(HKX hkx, HKXSection section, BinaryWriterEx bw, uint sectionBaseOffset, HKXVariation variation) { bw.WriteByte(Idx0); bw.WriteByte(Idx1); bw.WriteByte(Idx2); bw.WriteByte(Idx3); }
public override void Write(HKX hkx, HKXSection section, BinaryWriterEx bw, uint sectionBaseOffset, HKXVariation variation) { bw.WriteUInt32(Unk0); bw.WriteUInt32(Unk4); bw.WriteUInt32(Unk8); bw.WriteUInt32(UnkC); bw.WriteUInt32(Unk10); bw.WriteUInt32(Unk14); bw.WriteUInt32(Unk18); bw.WriteUInt32(Unk1C); bw.WriteUInt32(Unk20); bw.WriteUInt32(Unk24); bw.WriteUInt32(Unk28); bw.WriteUInt32(Unk2C); bw.WriteUInt32(Unk30); bw.WriteUInt32(Unk34); bw.WriteUInt32(Unk38); bw.WriteUInt32(Unk3C); bw.WriteUInt32(Unk40); bw.WriteUInt32(Unk44); bw.WriteUInt32(Unk48); bw.WriteUInt32(Unk4C); bw.WriteUInt32(Unk50); bw.WriteUInt32(Unk54); bw.WriteUInt32(Unk58); bw.WriteUInt32(Unk5C); bw.WriteUInt32(Unk60); bw.WriteUInt32(Unk64); bw.WriteUInt32(Unk68); bw.WriteUInt32(Unk6C); }
public override void Read(HKX hkx, HKXSection section, BinaryReaderEx br, HKXVariation variation) { SectionOffset = (uint)br.Position; AssertPointer(hkx, br); AssertPointer(hkx, br); AssertPointer(hkx, br); AssertPointer(hkx, br); TransformTrackToBoneIndices = new HKArray <HKShort>(hkx, section, this, br, variation); FloatTrackToFloatSlotIndices = new HKArray <HKShort>(hkx, section, this, br, variation); if (variation != HKXVariation.HKXDS1) { //PartitionIndices = new HKArray<HKShort>(hkx, section, this, br, variation); PartitionIndices = new HKArray <HKShort>(hkx, section, this, br, variation); BlendHint = br.ReadEnum32 <AnimationBlendHint>(); } else { BlendHint = br.ReadEnum32 <AnimationBlendHint>(); OriginalSkeletonName = br.ReadShiftJIS(); br.Pad(16); } br.Pad(16); DataSize = (uint)br.Position - SectionOffset; ResolveDestinations(hkx, section); }
public override void Read(HKX hkx, HKXSection section, HKXObject source, BinaryReaderEx br, HKXVariation variation) { Unk0 = br.ReadUInt32(); Unk4 = br.ReadUInt32(); Unk8 = br.ReadUInt32(); UnkC = br.ReadUInt32(); Unk10 = br.ReadUInt32(); Unk14 = br.ReadUInt32(); Unk18 = br.ReadUInt32(); Unk1C = br.ReadUInt32(); Unk20 = br.ReadUInt32(); Unk24 = br.ReadUInt32(); Unk28 = br.ReadUInt32(); Unk2C = br.ReadUInt32(); Unk30 = br.ReadUInt32(); Unk34 = br.ReadUInt32(); Unk38 = br.ReadUInt32(); Unk3C = br.ReadUInt32(); Unk40 = br.ReadUInt32(); Unk44 = br.ReadUInt32(); Unk48 = br.ReadUInt32(); Unk4C = br.ReadUInt32(); Unk50 = br.ReadUInt32(); Unk54 = br.ReadUInt32(); Unk58 = br.ReadUInt32(); Unk5C = br.ReadUInt32(); Unk60 = br.ReadUInt32(); Unk64 = br.ReadUInt32(); Unk68 = br.ReadUInt32(); Unk6C = br.ReadUInt32(); }
public override void Read(HKX hkx, HKXSection section, HKXObject source, BinaryReaderEx br, HKXVariation variation) { CompressedBVH = new HKArray <CompressedChunkBVHNode>(hkx, section, source, br, variation); BoundingBoxMin = br.ReadVector4(); BoundingBoxMax = br.ReadVector4(); SmallVertexOffset = br.ReadVector3(); SmallVertexScale = br.ReadVector3(); SmallVerticesBase = br.ReadUInt32(); uint vertexIndices = br.ReadUInt32(); VertexIndicesIndex = (int)(vertexIndices >> 8); VertexIndicesLength = (byte)(vertexIndices & 0xFF); uint unk50 = br.ReadUInt32(); ByteIndicesIndex = (int)(unk50 >> 8); ByteIndicesLength = (byte)(unk50 & 0xFF); uint unk54 = br.ReadUInt32(); Unk54Index = (int)(unk54 >> 8); Unk54Length = (byte)(unk54 & 0xFF); Unk58 = br.ReadUInt32(); Unk5C = br.ReadUInt32(); }
// Call to serialize the actual data internal override void WriteReferenceData(HKX hkx, HKXSection section, BinaryWriterEx bw, uint sectionBaseOffset, HKXVariation variation) { if (Data != null) { GetArrayData().Write(hkx, section, bw, sectionBaseOffset, variation); } }
public override void Read(HKX hkx, HKXSection section, BinaryReaderEx br, HKXVariation variation) { SectionOffset = (uint)br.Position; AssertPointer(hkx, br); AssertPointer(hkx, br); Faces = new HKArray <NVMFace>(hkx, section, this, br, variation); Edges = new HKArray <NVMEdge>(hkx, section, this, br, variation); Vertices = new HKArray <HKVector4>(hkx, section, this, br, variation); br.ReadUInt64s(2); // hkaiStreamingSet seems unused FaceData = new HKArray <HKUInt>(hkx, section, this, br, variation); EdgeData = new HKArray <HKUInt>(hkx, section, this, br, variation); FaceDataStriding = br.ReadInt32(); EdgeDataStriding = br.ReadInt32(); Flags = br.ReadByte(); br.AssertByte(0); // Padding br.AssertUInt16(0); // Padding AABBMin = br.ReadVector4(); AABBMax = br.ReadVector4(); ErosionRadius = br.ReadSingle(); UserData = br.ReadUInt64(); br.ReadUInt64(); // Padding DataSize = (uint)br.Position - SectionOffset; ResolveDestinations(hkx, section); }
public override void Read(HKX hkx, HKXSection section, BinaryReaderEx br, HKXVariation variation) { SectionOffset = (uint)br.Position; AssertPointer(hkx, br); AssertPointer(hkx, br); CompressedBVH = new HKArray <CompressedMeshBVHNode>(hkx, section, this, br, variation); BoundingBoxMin = br.ReadVector4(); BoundingBoxMax = br.ReadVector4(); Unk40 = br.ReadUInt32(); Unk44 = br.ReadUInt32(); Unk48 = br.ReadUInt32(); Unk4C = br.ReadUInt32(); Chunks = new HKArray <CollisionMeshChunk>(hkx, section, this, br, variation); MeshIndices = new HKArray <MeshPrimitive>(hkx, section, this, br, variation); VertexIndices = new HKArray <HKUShort>(hkx, section, this, br, variation); SmallVertices = new HKArray <SmallCompressedVertex>(hkx, section, this, br, variation); LargeVertices = new HKArray <LargeCompressedVertex>(hkx, section, this, br, variation); UnkA0 = new HKArray <HKUInt>(hkx, section, this, br, variation); UnkB0 = br.ReadUInt64(); UnkB8 = new HKArray <UnknownStructure2>(hkx, section, this, br, variation); UnkC8 = br.AssertUInt64(0); DataSize = (uint)br.Position - SectionOffset; ResolveDestinations(hkx, section); }
public override void Write(HKX hkx, HKXSection section, BinaryWriterEx bw, uint sectionBaseOffset, HKXVariation variation) { bw.WriteByte(BBX); bw.WriteByte(BBY); bw.WriteByte(BBZ); bw.WriteByte(IDX); }
public void Read(HKX hkx, HKXSection section, BinaryReaderEx br, uint size, HKXVariation variation) { SectionOffset = (uint)br.Position; Bytes = br.ReadBytes((int)size); DataSize = size; // Resolve references where this object is a source var localSources = FindLocalFixupSources(section); LocalReferences = new List <HKXLocalReference>(); foreach (var src in localSources) { if (src.Reference == null) { var reference = new HKXLocalReference(); reference.Section = section; reference.SourceLocalOffset = src.Src - SectionOffset; reference.SourceObject = this; section.LocalReferences.Add(reference); src.Reference = reference; } else { var reference = src.Reference; reference.SourceLocalOffset = src.Src - SectionOffset; reference.SourceObject = this; } LocalReferences.Add(src.Reference); } // Resolve references where this object is a global source var globalSources = FindGlobalFixupSources(section); GlobalReferences = new List <HKXGlobalReference>(); foreach (var src in globalSources) { if (src.Reference == null) { var reference = new HKXGlobalReference(); reference.SrcSection = section; reference.SourceLocalOffset = src.Src - SectionOffset; reference.SourceObject = this; section.GlobalReferences.Add(reference); src.Reference = reference; } else { var reference = src.Reference; reference.SrcSection = section; reference.SourceLocalOffset = src.Src - SectionOffset; reference.SourceObject = this; section.GlobalReferences.Add(reference); } GlobalReferences.Add(src.Reference); } ResolveDestinations(hkx, section); }
public override void Read(HKX hkx, HKXSection section, HKXObject source, BinaryReaderEx br, HKXVariation variation) { StartEdgeIndex = br.ReadInt32(); StartUserEdgeIndex = br.ReadInt32(); NumEdges = br.ReadInt16(); NumUserEdges = br.ReadInt16(); ClusterIndex = br.ReadInt16(); br.ReadInt16(); // Padding }
public override void Read(HKX hkx, HKXSection section, HKXObject source, BinaryReaderEx br, HKXVariation variation) { Position = new HKVector4(); Position.Read(hkx, section, source, br, variation); Rotation = new HKVector4(); Rotation.Read(hkx, section, source, br, variation); Scale = new HKVector4(); Scale.Read(hkx, section, source, br, variation); }
public override void Write(HKX hkx, HKXSection section, BinaryWriterEx bw, uint sectionBaseOffset, HKXVariation variation) { SectionOffset = (uint)bw.Position - sectionBaseOffset; bw.WriteInt64(0); bw.WriteInt64(0); bw.WriteByte(Unk10); bw.WriteByte(Unk11); bw.WriteByte(Unk12); bw.WriteByte(Unk13); bw.WriteInt32(Unk14); bw.WriteInt64(0); bw.WriteInt64(0); if (variation == HKXVariation.HKXDS3) { bw.WriteInt64(0); } bw.WriteUInt32(0xFFFFFFFF); bw.WriteInt32(0); bw.WriteUInt64(0); bw.WriteUInt32(0); bw.WriteUInt32(0x80000000); bw.WriteUInt64(0); bw.WriteUInt32(0); bw.WriteUInt32(0x80000000); bw.WriteUInt32(0xFFFFFFFF); bw.WriteInt32(0); MeshShapeData.WritePlaceholder(bw, sectionBaseOffset); Unk68.Write(hkx, section, bw, sectionBaseOffset, variation); bw.WriteInt32(Unk78); bw.WriteInt32(0); Unk80.Write(hkx, section, bw, sectionBaseOffset, variation); bw.WriteInt32(Unk90); bw.WriteInt32(0); bw.WriteUInt64(0); CustomParam.WritePlaceholder(bw, sectionBaseOffset); UnkA8.Write(hkx, section, bw, sectionBaseOffset, variation); if (variation == HKXVariation.HKXDS3) { bw.WriteInt64(0); } DataSize = (uint)bw.Position - sectionBaseOffset - SectionOffset; Unk68.WriteReferenceData(hkx, section, bw, sectionBaseOffset, variation); Unk80.WriteReferenceData(hkx, section, bw, sectionBaseOffset, variation); UnkA8.WriteReferenceData(hkx, section, bw, sectionBaseOffset, variation); }
public override void Read(HKX hkx, HKXSection section, BinaryReaderEx br, HKXVariation variation) { SectionOffset = (uint)br.Position; br.AssertUInt64(0); br.AssertUInt64(0); Unk10 = br.ReadByte(); Unk11 = br.ReadByte(); Unk12 = br.ReadByte(); Unk13 = br.ReadByte(); Unk14 = br.ReadInt32(); br.AssertUInt64(0); br.AssertUInt64(0); if (variation == HKXVariation.HKXDS3) { br.AssertUInt64(0); } br.AssertUInt32(0xFFFFFFFF); br.AssertUInt32(0); // A seemingly empty array br.AssertUInt64(0); br.AssertUInt32(0); br.AssertUInt32(0x80000000); // A seemingly empty array br.AssertUInt64(0); br.AssertUInt32(0); br.AssertUInt32(0x80000000); br.AssertUInt32(0xFFFFFFFF); br.AssertUInt32(0); MeshShapeData = ResolveGlobalReference(hkx, section, br); Unk68 = new HKArray <HKUInt>(hkx, section, this, br, variation); Unk78 = br.ReadInt32(); br.AssertUInt32(0); Unk80 = new HKArray <HKUInt>(hkx, section, this, br, variation); Unk90 = br.ReadInt32(); br.AssertUInt32(0); br.AssertUInt64(0); CustomParam = ResolveGlobalReference(hkx, section, br); UnkA8 = new HKArray <HKUInt>(hkx, section, this, br, variation); if (variation == HKXVariation.HKXDS3) { br.AssertUInt64(0); } DataSize = (uint)br.Position - SectionOffset; ResolveDestinations(hkx, section); }
public override void Read(HKX hkx, HKXSection section, HKXObject source, BinaryReaderEx br, HKXVariation variation) { A = br.ReadInt32(); B = br.ReadInt32(); OppositeEdge = br.ReadUInt32(); OppositeFace = br.ReadUInt32(); Flags = br.ReadByte(); br.ReadByte(); // Padding UserEdgeCost = br.ReadInt16(); }
// Finds and resolves a local fixup representing a reference at an object relative offset internal GlobalFixup ResolveGlobalFixup(HKXSection section, uint offset) { foreach (var gu in section.GlobalFixups) { if (gu.Src == (SectionOffset + offset)) { return(gu); } } return(null); }
public override void Read(HKX hkx, HKXSection section, BinaryReaderEx br, HKXVariation variation) { SectionOffset = (uint)br.Position; CompressedTree = new HKArray <StaticAABBNode>(hkx, section, this, br, variation); AABBMin = br.ReadVector4(); AABBMax = br.ReadVector4(); DataSize = (uint)br.Position - SectionOffset; ResolveDestinations(hkx, section); }
public override void Read(HKX hkx, HKXSection section, HKXObject source, BinaryReaderEx br, HKXVariation variation) { //AssertPointer(hkx, br); //br.ReadUInt64s(1); // blah Name = new HKCString(hkx, section, source, br, variation); LockTranslation = br.ReadInt32(); if (variation != HKXVariation.HKXDS1) { br.ReadInt32(); // Padding? } }
// Finds and resolves a local fixup representing a reference at an object relative offset internal LocalFixup ResolveLocalFixup(HKXSection section, uint offset) { foreach (var fu in section.LocalFixups) { if (fu.Src == (SectionOffset + offset)) { return(fu); } } return(null); }
public void Read(HKX hkx, HKXSection section, BinaryReaderEx br, HKXVariation variation, uint elementCount) { SectionOffset = (uint)br.Position; Elements = new List <T>(); for (int i = 0; i < elementCount; i++) { var elem = new T(); elem.Read(hkx, section, this, br, variation); Elements.Add(elem); } DataSize = (uint)br.Position - SectionOffset; }
public void Write(HKX hkx, HKXSection section, BinaryWriterEx bw, uint sectionBaseOffset, HKX.HKXVariation variation) { foreach (var cls in ClassNames) { cls.Write(bw, sectionBaseOffset); } while ((bw.Position % 16) != 0) { // Write padding bytes to 16 byte align bw.WriteByte(0xFF); } }
protected List <LocalFixup> FindLocalFixupDestinations(HKXSection section) { List <LocalFixup> sources = new List <LocalFixup>(); foreach (var fu in section.LocalFixups) { if (fu.Dst >= SectionOffset && fu.Dst < (SectionOffset + DataSize)) { sources.Add(fu); } } return(sources); }
public void Read(HKX hkx, HKXSection section, BinaryReaderEx br, HKX.HKXVariation variation) { ClassNames = new List <HKXClassName>(); OffsetClassNamesMap = new Dictionary <uint, HKXClassName>(); while (br.ReadUInt16() != 0xFFFF) { br.Position -= 2; uint stringStart = (uint)br.Position + 5; var className = new HKXClassName(br); ClassNames.Add(className); OffsetClassNamesMap.Add(stringStart, className); } }
protected List <GlobalFixup> FindGlobalFixupSources(HKXSection section) { List <GlobalFixup> sources = new List <GlobalFixup>(); foreach (var gu in section.GlobalFixups) { if (gu.Src >= SectionOffset && gu.Src < (SectionOffset + DataSize)) { sources.Add(gu); } } return(sources); }
// Finds and resolves a global reference internal HKXGlobalReference ResolveGlobalReference(HKXSection section, uint offset) { GlobalFixup gu = ResolveGlobalFixup(section, offset); if (gu != null) { var reference = new HKXGlobalReference(); reference.SourceObject = this; reference.SourceLocalOffset = offset; reference.SrcSection = section; section.GlobalReferences.Add(reference); gu.Reference = reference; return(reference); } return(null); }
public override void Write(HKX hkx, HKXSection section, BinaryWriterEx bw, uint sectionBaseOffset, HKXVariation variation) { CompressedBVH.Write(hkx, section, bw, sectionBaseOffset, variation); bw.WriteVector4(BoundingBoxMin); bw.WriteVector4(BoundingBoxMax); bw.WriteVector3(SmallVertexOffset); bw.WriteVector3(SmallVertexScale); bw.WriteUInt32(SmallVerticesBase); bw.WriteUInt32(((uint)(VertexIndicesIndex) << 8) | (uint)(VertexIndicesLength)); bw.WriteUInt32(((uint)(ByteIndicesIndex) << 8) | (uint)(ByteIndicesLength)); bw.WriteUInt32(((uint)(Unk54Index) << 8) | (uint)(Unk54Length)); bw.WriteUInt32(Unk58); bw.WriteUInt32(Unk5C); }