public FRawStaticIndexBuffer(FArchive Ar) : this() { if (Ar.Ver < EUnrealEngineObjectUE4Version.SUPPORT_32BIT_STATIC_MESH_INDICES) { Indices16 = Ar.ReadBulkArray <ushort>(); } else { var is32bit = Ar.ReadBoolean(); var data = Ar.ReadBulkArray <byte>(); var tempAr = new FByteArchive("IndicesReader", data, Ar.Versions); if (Ar.Versions["RawIndexBuffer.HasShouldExpandTo32Bit"]) { var bShouldExpandTo32Bit = Ar.ReadBoolean(); } if (tempAr.Length == 0) { tempAr.Dispose(); return; } if (is32bit) { var count = (int)tempAr.Length / 4; Indices32 = tempAr.ReadArray <uint>(count); } else { var count = (int)tempAr.Length / 2; Indices16 = tempAr.ReadArray <ushort>(count); } tempAr.Dispose(); } }
public FRawStaticIndexBuffer(FArchive Ar) : this() { if (Ar.Ver < UE4Version.VER_UE4_SUPPORT_32BIT_STATIC_MESH_INDICES) { Indices16 = Ar.ReadBulkArray <ushort>(); } else { var is32bit = Ar.ReadBoolean(); var data = Ar.ReadBulkArray <byte>(); var tempAr = new FByteArchive("IndicesReader", data, Ar.Versions); if (Ar.Game >= EGame.GAME_UE4_25) { Ar.Position += 4; } if (tempAr.Length == 0) { tempAr.Dispose(); return; } if (is32bit) { var count = (int)tempAr.Length / 4; Indices32 = tempAr.ReadArray <uint>(count); } else { var count = (int)tempAr.Length / 2; Indices16 = tempAr.ReadArray <ushort>(count); } tempAr.Dispose(); } }
public FStaticMeshLODResources(FAssetArchive Ar) { var stripDataFlags = Ar.Read <FStripDataFlags>(); Sections = Ar.ReadArray(() => new FStaticMeshSection(Ar)); MaxDeviation = Ar.Read <float>(); if (Ar.Game < EGame.GAME_UE4_23) { if (!stripDataFlags.IsDataStrippedForServer() && !stripDataFlags.IsClassDataStripped((byte)EClassDataStripFlag.CDSF_MinLodData)) { SerializeBuffersLegacy(Ar, stripDataFlags); } return; } var bIsLODCookedOut = Ar.ReadBoolean(); var bInlined = Ar.ReadBoolean(); if (Ar.Game == EGame.GAME_ROGUECOMPANY) { bInlined = true; } if (!stripDataFlags.IsDataStrippedForServer() && !bIsLODCookedOut) { if (bInlined) { SerializeBuffers(Ar); if (Ar.Game == EGame.GAME_ROGUECOMPANY) { Ar.Position += 10; } } else { var bulkData = new FByteBulkData(Ar); if (bulkData.Header.ElementCount > 0) { var tempAr = new FByteArchive("StaticMeshBufferReader", bulkData.Data, Ar.Versions); SerializeBuffers(tempAr); tempAr.Dispose(); } // https://github.com/EpicGames/UnrealEngine/blob/4.27/Engine/Source/Runtime/Engine/Private/StaticMesh.cpp#L560 Ar.Position += 8; // DepthOnlyNumTriangles + Packed Ar.Position += 4 * 4 + 2 * 4 + 2 * 4 + 5 * 2 * 4; // StaticMeshVertexBuffer = 2x int32, 2x bool // PositionVertexBuffer = 2x int32 // ColorVertexBuffer = 2x int32 // IndexBuffer = int32 + bool // ReversedIndexBuffer // DepthOnlyIndexBuffer // ReversedDepthOnlyIndexBuffer // WireframeIndexBuffer if (FUE5ReleaseStreamObjectVersion.Get(Ar) < FUE5ReleaseStreamObjectVersion.Type.RemovingTessellation) { Ar.Position += 2 * 4; // AdjacencyIndexBuffer } } } // FStaticMeshBuffersSize // uint32 SerializedBuffersSize = 0; // uint32 DepthOnlyIBSize = 0; // uint32 ReversedIBsSize = 0; Ar.Position += 12; }