Ejemplo n.º 1
0
 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();
 }
Ejemplo n.º 2
0
            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);
            }
Ejemplo n.º 3
0
            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);
            }
Ejemplo n.º 4
0
 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();
 }
Ejemplo n.º 5
0
 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);
 }
Ejemplo n.º 6
0
            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);
            }
Ejemplo n.º 7
0
 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);
 }
Ejemplo n.º 8
0
            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();
            }
Ejemplo n.º 9
0
 // 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);
     }
 }
Ejemplo n.º 10
0
 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();
 }
Ejemplo n.º 11
0
 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);
 }
Ejemplo n.º 12
0
            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);
            }
Ejemplo n.º 13
0
            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);
            }
            // Only use for a classnames structure after preliminary deserialization
            internal void ReadClassnames(HKX hkx)
            {
                BinaryReaderEx br         = new BinaryReaderEx(false, SectionData);
                var            classnames = new HKXClassNames();

                classnames.Read(hkx, this, br, HKX.HKXVariation.HKXDS3);
            }
Ejemplo n.º 15
0
            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);
            }
Ejemplo n.º 16
0
 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
 }
Ejemplo n.º 17
0
 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);
 }
Ejemplo n.º 18
0
            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);
            }
Ejemplo n.º 19
0
            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);
            }
Ejemplo n.º 20
0
 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();
 }
Ejemplo n.º 21
0
 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?
     }
 }
Ejemplo n.º 22
0
            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 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);
     }
 }
Ejemplo n.º 24
0
            // Should be used on a data section after initial reading for object deserialization
            internal void ReadDataObjects(HKX hkx, HKXVariation variation, bool deserializeObjects)
            {
                BinaryReaderEx br = new BinaryReaderEx((hkx.Header.Endian == 0) ? true : false, SectionData);

                // Virtual fixup table defines the hkx class instances
                for (int i = 0; i < VirtualFixups.Count; i++)
                {
                    var reference = new HKXVirtualReference();
                    reference.DestSection = hkx.ClassSection; // A bit of an assumption that better hold
                    reference.ClassName   = ((HKXClassNames)hkx.ClassSection.Objects[0]).Lookup(VirtualFixups[i].NameOffset);

                    br.Position = VirtualFixups[i].Src;
                    var       length = (i + 1 < VirtualFixups.Count) ? VirtualFixups[i + 1].Src - VirtualFixups[i].Src : LocalFixupsOffset - VirtualFixups[i].Src;
                    HKXObject hkobject;
                    if (deserializeObjects)
                    {
                        if (reference.ClassName.ClassName == "fsnpCustomParamCompressedMeshShape")
                        {
                            hkobject = new FSNPCustomParamCompressedMeshShape();
                            hkobject.Read(hkx, this, br, variation);
                        }
                        else if (reference.ClassName.ClassName == "hknpCompressedMeshShapeData")
                        {
                            hkobject = new HKNPCompressedMeshShapeData();
                            hkobject.Read(hkx, this, br, variation);
                        }
                        else if (reference.ClassName.ClassName == "hkpStorageExtendedMeshShapeMeshSubpartStorage")
                        {
                            hkobject = new HKPStorageExtendedMeshShapeMeshSubpartStorage();
                            hkobject.Read(hkx, this, br, variation);
                        }
                        else if (reference.ClassName.ClassName == "hknpPhysicsSystemData")
                        {
                            hkobject = new HKNPPhysicsSystemData();
                            hkobject.Read(hkx, this, br, variation);
                        }
                        else
                        {
                            hkobject = new HKXGenericObject();
                            ((HKXGenericObject)hkobject).Read(hkx, this, br, length, variation);
                        }
                    }
                    else
                    {
                        hkobject = new HKXGenericObject();
                        ((HKXGenericObject)hkobject).Read(hkx, this, br, length, variation);
                    }
                    Objects.Add(hkobject);
                    reference.SourceObject = hkobject;

                    VirtualReferences.Add(reference);
                }
            }
Ejemplo n.º 25
0
 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 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);
     }
 }
Ejemplo n.º 27
0
            public override void Write(HKX hkx, HKXSection section, BinaryWriterEx bw, uint sectionBaseOffset, HKXVariation variation)
            {
                nodes.Write(hkx, section, bw, sectionBaseOffset, variation);
                bw.WriteVector4(BoundingBoxMin);
                bw.WriteVector4(BoundingBoxMax);
                bw.WriteVector3(SmallVertexOffset);
                bw.WriteVector3(SmallVertexScale);
                bw.WriteUInt32(firstPackedVertex);

                bw.WriteUInt32(((uint)(sharedVerticesIndex) << 8) | (uint)(sharedVerticesLength));
                bw.WriteUInt32(((uint)(primitivesIndex) << 8) | (uint)(primitivesLength));
                bw.WriteUInt32(((uint)(dataRunsIndex) << 8) | (uint)(dataRunsLendth));

                bw.WriteUInt32(Unk58);
                bw.WriteUInt32(Unk5C);
            }
Ejemplo n.º 28
0
            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);
            }
Ejemplo n.º 29
0
            public void WriteData(BinaryWriterEx bw, HKX hkx, HKXVariation variation)
            {
                uint absoluteOffset = (uint)bw.Position;

                bw.FillUInt32("absoffset" + SectionID, absoluteOffset);
                foreach (var obj in Objects)
                {
                    obj.Write(hkx, this, bw, absoluteOffset, variation);
                }

                // Local fixups
                bw.FillUInt32("locoffset" + SectionID, (uint)bw.Position - absoluteOffset);
                foreach (var loc in LocalReferences)
                {
                    loc.Write(bw);
                }
                while ((bw.Position % 16) != 0)
                {
                    bw.WriteByte(0xFF); // 16 byte align
                }

                // Global fixups
                bw.FillUInt32("globoffset" + SectionID, (uint)bw.Position - absoluteOffset);
                foreach (var glob in GlobalReferences)
                {
                    glob.Write(bw);
                }
                while ((bw.Position % 16) != 0)
                {
                    bw.WriteByte(0xFF); // 16 byte align
                }

                // Virtual fixups
                bw.FillUInt32("virtoffset" + SectionID, (uint)bw.Position - absoluteOffset);
                foreach (var virt in VirtualReferences)
                {
                    virt.Write(bw);
                }
                while ((bw.Position % 16) != 0)
                {
                    bw.WriteByte(0xFF); // 16 byte align
                }

                bw.FillUInt32("expoffset" + SectionID, (uint)bw.Position - absoluteOffset);
                bw.FillUInt32("impoffset" + SectionID, (uint)bw.Position - absoluteOffset);
                bw.FillUInt32("endoffset" + SectionID, (uint)bw.Position - absoluteOffset);
            }
Ejemplo n.º 30
0
            public override void Read(HKX hkx, HKXSection section, BinaryReaderEx br, HKXVariation variation)
            {
                SectionOffset = (uint)br.Position;

                AssertPointer(hkx, br);
                AssertPointer(hkx, br);

                Positions = new HKArray <HKVector4>(hkx, section, this, br, variation);
                Nodes     = new HKArray <CostGraphNode>(hkx, section, this, br, variation);
                Edges     = new HKArray <CostGraphEdge>(hkx, section, this, br, variation);
                br.ReadUInt64s(2); // unused array
                br.ReadUInt64s(2); // unused array
                br.ReadUInt64s(4); // padding

                DataSize = (uint)br.Position - SectionOffset;
                ResolveDestinations(hkx, section);
            }