@@ -180,47 +180,60 @@ struct FStaticMeshVertexBuffer4
180
180
181
181
if (!StripFlags.IsDataStrippedForServer ())
182
182
{
183
- #if JEDI
184
- if (Ar.Game == GAME_Jedi)
185
- {
186
- int32 unk;
187
- Ar << unk;
188
- }
189
- #endif // JEDI
190
-
191
183
GNumStaticUVSets = S.NumTexCoords ;
192
184
GUseStaticFloatUVs = S.bUseFullPrecisionUVs ;
185
+
193
186
if (Ar.Game < GAME_UE4 (19 ))
194
187
{
195
188
S.UV .BulkSerialize (Ar);
196
189
}
197
190
else
198
191
{
199
192
// In 4.19 tangents and texture coordinates are stored in separate vertex streams
200
- int32 ItemSize, ItemCount;
201
- S.UV .AddUninitialized (S.NumVertices );
202
-
203
- // Tangents
204
- Ar << ItemSize << ItemCount;
205
- DBG_MESH (" ... tangents: %d items by %d bytes\n " , ItemCount, ItemSize);
206
- assert (ItemCount == S.NumVertices );
207
- int Pos = Ar.Tell ();
208
- for (int i = 0 ; i < S.NumVertices ; i++)
193
+ S.UV .AddZeroed (S.NumVertices );
194
+
195
+ #if JEDI
196
+ if (Ar.Game == GAME_Jedi)
209
197
{
210
- FStaticMeshUVItem4::SerializeTangents (Ar, S.UV [i]);
198
+ int32 bDropNormals;
199
+ Ar << bDropNormals;
200
+ assert (bDropNormals == 0 || bDropNormals == 1 ); // todo: replace with bool
201
+ if (bDropNormals)
202
+ {
203
+ // !! todo: no tangents, should indicate that tangents should be recreated
204
+ goto texcoords;
205
+ }
206
+ }
207
+ #endif // JEDI
208
+
209
+ {
210
+ // Tangents: simulate TArray::BulkSerialize()
211
+ int32 ItemSize, ItemCount;
212
+ Ar << ItemSize << ItemCount;
213
+ DBG_MESH (" ... tangents: %d items by %d bytes\n " , ItemCount, ItemSize);
214
+ assert (ItemCount == S.NumVertices );
215
+ int Pos = Ar.Tell ();
216
+ for (int i = 0 ; i < S.NumVertices ; i++)
217
+ {
218
+ FStaticMeshUVItem4::SerializeTangents (Ar, S.UV [i]);
219
+ }
220
+ assert (Ar.Tell () - Pos == ItemCount * ItemSize);
211
221
}
212
- assert (Ar.Tell () - Pos == ItemCount * ItemSize);
213
-
214
- // Texture coordinates
215
- Ar << ItemSize << ItemCount;
216
- DBG_MESH (" ... texcoords: %d items by %d bytes\n " , ItemCount, ItemSize);
217
- assert (ItemCount == S.NumVertices * S.NumTexCoords );
218
- Pos = Ar.Tell ();
219
- for (int i = 0 ; i < S.NumVertices ; i++)
222
+
220
223
{
221
- FStaticMeshUVItem4::SerializeTexcoords (Ar, S.UV [i]);
224
+ texcoords:
225
+ // Texture coordinates: simulate TArray::BulkSerialize()
226
+ int32 ItemSize, ItemCount;
227
+ Ar << ItemSize << ItemCount;
228
+ DBG_MESH (" ... texcoords: %d items by %d bytes\n " , ItemCount, ItemSize);
229
+ assert (ItemCount == S.NumVertices * S.NumTexCoords );
230
+ int Pos = Ar.Tell ();
231
+ for (int i = 0 ; i < S.NumVertices ; i++)
232
+ {
233
+ FStaticMeshUVItem4::SerializeTexcoords (Ar, S.UV [i]);
234
+ }
235
+ assert (Ar.Tell () - Pos == ItemCount * ItemSize);
222
236
}
223
- assert (Ar.Tell () - Pos == ItemCount * ItemSize);
224
237
}
225
238
}
226
239
0 commit comments