You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
Fix the packing of UV, make sure the temporary destination has enough indices to receive the new computed UVLightMap
#jira UE-71048 #rb none #ROBOMERGE-OWNER: ryan.gerleve #ROBOMERGE-AUTHOR: alexis.matte #ROBOMERGE-SOURCE: CL 5337966 in //UE4/Release-4.22/... via CL 5338978 #ROBOMERGE-BOT: ENGINE (Main -> Dev-Networking) [CL 5401309 by alexis matte in Dev-Networking branch]
This commit is contained in:
@@ -1446,6 +1446,15 @@ bool FMeshDescriptionOperations::GenerateUniqueUVsForStaticMesh(const FMeshDescr
|
||||
{
|
||||
// Create a copy of original mesh (only copy necessary data)
|
||||
FMeshDescription DuplicateMeshDescription(MeshDescription);
|
||||
|
||||
//Make sure we have a destination UV TextureCoordinnate
|
||||
{
|
||||
TVertexInstanceAttributesRef<FVector2D> DuplicateVertexInstanceUVs = DuplicateMeshDescription.VertexInstanceAttributes().GetAttributesRef<FVector2D>(MeshAttribute::VertexInstance::TextureCoordinate);
|
||||
if (DuplicateVertexInstanceUVs.GetNumIndices() < 2)
|
||||
{
|
||||
DuplicateVertexInstanceUVs.SetNumIndices(2);
|
||||
}
|
||||
}
|
||||
|
||||
TMap<FVertexInstanceID, FVertexInstanceID> RemapVertexInstance;
|
||||
//Remove the identical material
|
||||
@@ -1565,14 +1574,14 @@ bool FMeshDescriptionOperations::GenerateUniqueUVsForStaticMesh(const FMeshDescr
|
||||
TVertexInstanceAttributesConstRef<FVector2D> DupVertexInstanceUVs = DuplicateMeshDescription.VertexInstanceAttributes().GetAttributesRef<FVector2D>(MeshAttribute::VertexInstance::TextureCoordinate);
|
||||
TVertexInstanceAttributesConstRef<FVector2D> VertexInstanceUVs = MeshDescription.VertexInstanceAttributes().GetAttributesRef<FVector2D>(MeshAttribute::VertexInstance::TextureCoordinate);
|
||||
// Save generated UVs
|
||||
check(VertexInstanceUVs.GetNumIndices() > 1);
|
||||
check(DupVertexInstanceUVs.GetNumIndices() > 1);
|
||||
OutTexCoords.AddZeroed(VertexInstanceUVs.GetNumElements());
|
||||
int32 TextureCoordIndex = 0;
|
||||
for (const FVertexInstanceID& VertexInstanceID : MeshDescription.VertexInstances().GetElementIDs())
|
||||
{
|
||||
FVertexInstanceID RemapID = bMergeIdenticalMaterials ? RemapVertexInstance[VertexInstanceID] : VertexInstanceID;
|
||||
// Save generated UVs
|
||||
OutTexCoords[TextureCoordIndex] = VertexInstanceUVs.Get(RemapID, 1); // UV1
|
||||
OutTexCoords[TextureCoordIndex] = DupVertexInstanceUVs.Get(RemapID, 1); // UV1
|
||||
TextureCoordIndex++;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user