Hello! I have some strange problems with procedural mesh lighting? What could it be?
Code for generating static maesh:
TArray<FVector> vertices;
TArray<int32> triangles;
vertices.Add(FVector(986.384277f, 924.700989f, 0));
vertices.Add(FVector(1024.00000, 921.248535, 0));
vertices.Add(FVector(965.699890, 938.674500, 0));
triangles.Add(0);
triangles.Add(1);
triangles.Add(2);
TArray<FVector> normals;
normals.Push(FVector(0, 0, 1));
normals.Push(FVector(0, 0, 1));
normals.Push(FVector(0, 0, 1));
TArray<FProcMeshTangent> tangents;
TArray<FLinearColor> vertexColors;
TArray<FVector2D> uvs;
float LeftestX = std::numeric_limits<float>().infinity();
float RightestX = -std::numeric_limits<float>().infinity();
float LowestY = std::numeric_limits<float>().infinity();
float HighestY = -std::numeric_limits<float>().infinity();
for (const auto& Vertex : vertices)
{
LeftestX = FMath::Min(LeftestX, Vertex.X);
RightestX = FMath::Max(RightestX, Vertex.X);
LowestY = FMath::Min(LeftestX, Vertex.Y);
HighestY = FMath::Max(RightestX, Vertex.Y);
}
float DeltaX = RightestX - LeftestX;
float DeltaY = HighestY - LowestY;
for (const auto& Vertex : vertices)
{
uvs.Add(FVector2D(Vertex.X / DeltaX, Vertex.Y / DeltaY));
}
LandscapeMesh->CreateMeshSection_LinearColor(0, vertices, triangles, normals, uvs, vertexColors, tangents, true);