Files
UnrealEngineUWP/Engine/Source/Developer/MeshUtilitiesCommon/Public/MeshUtilitiesCommon.h
yujiang wang e651bd3a97 Fix various issues related to lightmap 2-texel padding not being considered
* UVs in lightmap density view were shifting after building lighting. Fixed by considering the padding even if lightmap data is invalid
* Auto generated lightmap UV was snapping charts to the whole padded lightmap instead of the actual valid center region. Fixed by subtracing 2 texels from the packing resolution
* Also fixed some merging conflicts of auto gen

#rb none
[FYI] brian.karis, daniel.wright
#jira UE-64923

#ROBOMERGE-OWNER: ryan.vance
#ROBOMERGE-AUTHOR: yujiang.wang
#ROBOMERGE-SOURCE: CL 5320218 in //UE4/Release-4.22/... via CL 5337165
#ROBOMERGE-BOT: DEVVR (Main -> Dev-VR)

[CL 5387469 by yujiang wang in Dev-VR branch]
2019-03-13 14:51:50 -04:00

55 lines
1.1 KiB
C

// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
enum class ELightmapUVVersion : int32
{
BitByBit = 0,
Segments = 1,
SmallChartPacking = 2,
ScaleChartsOrderingFix = 3,
ChartJoiningLFix = 4,
Allocator2DFlipFix = 5,
ConsiderLightmapPadding = 6,
Latest = ConsiderLightmapPadding
};
/** Helper struct for building acceleration structures. */
struct FIndexAndZ
{
float Z;
int32 Index;
/** Default constructor. */
FIndexAndZ() {}
/** Initialization constructor. */
FIndexAndZ(int32 InIndex, FVector V)
{
Z = 0.30f * V.X + 0.33f * V.Y + 0.37f * V.Z;
Index = InIndex;
}
};
/** Sorting function for vertex Z/index pairs. */
struct FCompareIndexAndZ
{
FORCEINLINE bool operator()(FIndexAndZ const& A, FIndexAndZ const& B) const { return A.Z < B.Z; }
};
/**
* Returns true if the specified points are about equal
*/
inline bool PointsEqual(const FVector& V1, const FVector& V2, float ComparisonThreshold)
{
if (FMath::Abs(V1.X - V2.X) > ComparisonThreshold
|| FMath::Abs(V1.Y - V2.Y) > ComparisonThreshold
|| FMath::Abs(V1.Z - V2.Z) > ComparisonThreshold)
{
return false;
}
return true;
}