You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
Context: - Nanite meshes distance fields are generated using the original mesh data instead of the coarse representation generated by Nanite, however that code path was not checking section data such as blend mode, two sided, etc. Fix: - Modified FStaticMeshBuilder::BuildMeshVertexPositions(...) to also output a FStaticMeshSectionArray. - Updated MeshRepresentation::SetupEmbreeScene(...) to check section flags when using SourceMeshData.IsValid() code path. #prelight #rb Krzysztof.Narkowicz [CL 26160411 by tiago costa in ue5-main branch]
75 lines
2.0 KiB
C++
75 lines
2.0 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "IMeshBuilderModule.h"
|
|
#include "Modules/ModuleManager.h"
|
|
|
|
#include "StaticMeshBuilder.h"
|
|
#include "Engine/StaticMesh.h"
|
|
#include "SkeletalMeshBuilder.h"
|
|
#include "Engine/SkeletalMesh.h"
|
|
|
|
class FMeshBuilderModule : public IMeshBuilderModule
|
|
{
|
|
public:
|
|
|
|
FMeshBuilderModule()
|
|
{
|
|
}
|
|
|
|
virtual void StartupModule() override
|
|
{
|
|
// Register any modular features here
|
|
}
|
|
|
|
virtual void ShutdownModule() override
|
|
{
|
|
// Unregister any modular features here
|
|
}
|
|
|
|
virtual bool BuildMesh(FStaticMeshRenderData& OutRenderData, UObject* Mesh, const FStaticMeshLODGroup& LODGroup, bool bGenerateCoarseMeshStreamingLODs, bool bAllowNanite) override;
|
|
|
|
virtual bool BuildMeshVertexPositions(
|
|
UObject* StaticMesh,
|
|
TArray<uint32>& Indices,
|
|
TArray<FVector3f>& Vertices,
|
|
FStaticMeshSectionArray& Sections) override;
|
|
|
|
virtual bool BuildSkeletalMesh(const FSkeletalMeshBuildParameters& SkeletalMeshBuildParameters) override;
|
|
|
|
private:
|
|
|
|
};
|
|
|
|
IMPLEMENT_MODULE(FMeshBuilderModule, MeshBuilder );
|
|
|
|
bool FMeshBuilderModule::BuildMesh(FStaticMeshRenderData& OutRenderData, class UObject* Mesh, const FStaticMeshLODGroup& LODGroup, bool bGenerateCoarseMeshStreamingLODs, bool bAllowNanite)
|
|
{
|
|
UStaticMesh* StaticMesh = Cast<UStaticMesh>(Mesh);
|
|
if (StaticMesh != nullptr)
|
|
{
|
|
//Call the static mesh builder
|
|
return FStaticMeshBuilder().Build(OutRenderData, StaticMesh, LODGroup, bGenerateCoarseMeshStreamingLODs, bAllowNanite);
|
|
}
|
|
return false;
|
|
}
|
|
|
|
bool FMeshBuilderModule::BuildMeshVertexPositions(
|
|
UObject* Mesh,
|
|
TArray<uint32>& Indices,
|
|
TArray<FVector3f>& Vertices,
|
|
FStaticMeshSectionArray& Sections)
|
|
{
|
|
UStaticMesh* StaticMesh = Cast< UStaticMesh >(Mesh);
|
|
if (StaticMesh)
|
|
{
|
|
//Call the static mesh builder
|
|
return FStaticMeshBuilder().BuildMeshVertexPositions(StaticMesh, Indices, Vertices, Sections);
|
|
}
|
|
return false;
|
|
}
|
|
|
|
bool FMeshBuilderModule::BuildSkeletalMesh(const FSkeletalMeshBuildParameters& SkeletalMeshBuildParameters)
|
|
{
|
|
//Call the skeletal mesh builder
|
|
return FSkeletalMeshBuilder().Build(SkeletalMeshBuildParameters);
|
|
} |