// Pre-UE4.23 code public void SerializeBuffersLegacy(FAssetArchive Ar, FStripDataFlags stripDataFlags) { PositionVertexBuffer = new FPositionVertexBuffer(Ar); VertexBuffer = new FStaticMeshVertexBuffer(Ar); if (Ar.Game == EGame.GAME_Borderlands3) { var numColorStreams = Ar.Read <int>(); if (numColorStreams != 0) { ColorVertexBuffer = new FColorVertexBuffer(Ar); for (var i = 0; i < numColorStreams - 1; i++) { var _ = new FColorVertexBuffer(Ar); } } } else { ColorVertexBuffer = new FColorVertexBuffer(Ar); } IndexBuffer = new FRawStaticIndexBuffer(Ar); if (Ar.Game != EGame.GAME_PlayerUnknownsBattlegrounds || !stripDataFlags.IsClassDataStripped((byte)EClassDataStripFlag.CDSF_StripIndexBuffers)) { if (Ar.Ver >= EUnrealEngineObjectUE4Version.SOUND_CONCURRENCY_PACKAGE && !stripDataFlags.IsClassDataStripped((byte)EClassDataStripFlag.CDSF_ReversedIndexBuffer)) { ReversedIndexBuffer = new FRawStaticIndexBuffer(Ar); DepthOnlyIndexBuffer = new FRawStaticIndexBuffer(Ar); ReversedDepthOnlyIndexBuffer = new FRawStaticIndexBuffer(Ar); } else { // UE4.8 or older, or when has CDSF_ReversedIndexBuffer DepthOnlyIndexBuffer = new FRawStaticIndexBuffer(Ar); } if (Ar.Ver >= EUnrealEngineObjectUE4Version.FTEXT_HISTORY && Ar.Ver < EUnrealEngineObjectUE4Version.RENAME_CROUCHMOVESCHARACTERDOWN) { var _ = new FDistanceFieldVolumeData(Ar); // distanceFieldData } if (!stripDataFlags.IsEditorDataStripped()) { WireframeIndexBuffer = new FRawStaticIndexBuffer(Ar); } if (!stripDataFlags.IsClassDataStripped((byte)EClassDataStripFlag.CDSF_AdjacencyData)) { AdjacencyIndexBuffer = new FRawStaticIndexBuffer(Ar); } } if (Ar.Game > EGame.GAME_UE4_16) { for (var i = 0; i < Sections.Length; i++) { var _ = new FWeightedRandomSampler(Ar); } _ = new FWeightedRandomSampler(Ar); } }
public FStaticMeshRenderData(FAssetArchive Ar, bool bCooked) { if (!bCooked) { return; } // TODO Read minMobileLODIdx only when platform is desktop and CVar r.StaticMesh.KeepMobileMinLODSettingOnDesktop is nonzero if (Ar.Versions["StaticMesh.KeepMobileMinLODSettingOnDesktop"]) { var minMobileLODIdx = Ar.Read <int>(); } LODs = Ar.ReadArray(() => new FStaticMeshLODResources(Ar)); if (Ar.Game >= EGame.GAME_UE4_23) { var numInlinedLODs = Ar.Read <byte>(); } if (Ar.Game >= EGame.GAME_UE5_0) { NaniteResources = new FNaniteResources(Ar); SerializeInlineDataRepresentations(Ar); } if (Ar.Ver >= EUnrealEngineObjectUE4Version.RENAME_CROUCHMOVESCHARACTERDOWN) { var stripped = false; if (Ar.Ver >= EUnrealEngineObjectUE4Version.RENAME_WIDGET_VISIBILITY) { var stripDataFlags = Ar.Read <FStripDataFlags>(); stripped = stripDataFlags.IsDataStrippedForServer(); if (Ar.Game >= EGame.GAME_UE4_21) { stripped |= stripDataFlags.IsClassDataStripped(0x01); } } if (!stripped) { for (var i = 0; i < LODs.Length; i++) { var bValid = Ar.ReadBoolean(); if (bValid) { if (Ar.Game >= EGame.GAME_UE5_0) { var _ = new FDistanceFieldVolumeData5(Ar); } else { var _ = new FDistanceFieldVolumeData(Ar); } } } } } Bounds = Ar.Read <FBoxSphereBounds>(); if (Ar.Versions["StaticMesh.HasLODsShareStaticLighting"]) { bLODsShareStaticLighting = Ar.ReadBoolean(); } if (Ar.Game < EGame.GAME_UE4_14) { var bReducedBySimplygon = Ar.ReadBoolean(); } if (FRenderingObjectVersion.Get(Ar) < FRenderingObjectVersion.Type.TextureStreamingMeshUVChannelData) { Ar.Position += 4 * MAX_STATIC_UV_SETS_UE4; // StreamingTextureFactor for each UV set Ar.Position += 4; // MaxStreamingTextureFactor } ScreenSize = new float[Ar.Game >= EGame.GAME_UE4_9 ? MAX_STATIC_LODS_UE4 : 4]; for (var i = 0; i < ScreenSize.Length; i++) { if (Ar.Game >= EGame.GAME_UE4_20) // FPerPlatformProperty { var bFloatCooked = Ar.ReadBoolean(); } ScreenSize[i] = Ar.Read <float>(); } if (Ar.Game == EGame.GAME_Borderlands3) { var count = Ar.Read <int>(); for (var i = 0; i < count; i++) { var count2 = Ar.Read <byte>(); Ar.Position += count2 * 12; // bool, bool, float } } }