Files
UnrealEngineUWP/Engine/Plugins/Runtime/MeshModelingToolset/Source/ModelingComponents/Private/ModelingComponentsModule.cpp
Ryan Schmidt 422c289493 GeometryFramework: add support for configuring color and normal overrides on BaseDynamicMeshComponent & DynamicMeshComponent. This allows the user to configure a DynamicMeshComponent to display vertex colors, group colors, or a (configurable) custom color, as well as facet normals, in the Actor properties.
A new lit vertex color material is added and used if the ModelingComponents module is loaded (to avoid adding a new engine material, if only GeometryFramework is loaded, then the engine-default vertex color material is used). This class-wide vertex color material can be overridden via UBaseDynamicMeshComponent::SetDefaultVertexColorMaterial()

Facet Normals / Flat Shading is now separately configurable, this overrides the normals at the vertexbuffer setup level, so it works independently of material.

Support also added for configuring the wireframe material used for BaseDynamicMeshComponent, and also for setting the wireframe color.

#preflight 62aa2330a40a4dc3a04052c6
#rb tyson.brochu

[CL 20676782 by Ryan Schmidt in ue5-main branch]
2022-06-15 16:49:13 -04:00

36 lines
1.3 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "ModelingComponentsModule.h"
#include "Components/BaseDynamicMeshComponent.h"
#define LOCTEXT_NAMESPACE "FModelingComponentsModule"
void FModelingComponentsModule::StartupModule()
{
FCoreDelegates::OnPostEngineInit.AddRaw(this, &FModelingComponentsModule::OnPostEngineInit);
// Ensure that the GeometryFramework module is loaded so that UBaseDynamicMeshComponent materials are configured
FModuleManager::Get().LoadModule(TEXT("GeometryFramework"));
}
void FModelingComponentsModule::OnPostEngineInit()
{
// Replace the standard UBaseDynamicMeshComponent vertex color material with something higher quality.
// This is done in ModelingComponents module (ie part of MeshModelingToolset plugin) to avoid having to
// make this Material a special "engine material", which has various undesirable implication
UMaterial* VertexColorMaterial = LoadObject<UMaterial>(nullptr, TEXT("/MeshModelingToolset/Materials/M_DynamicMeshComponentVtxColor"));
if (ensure(VertexColorMaterial))
{
UBaseDynamicMeshComponent::SetDefaultVertexColorMaterial(VertexColorMaterial);
}
}
void FModelingComponentsModule::ShutdownModule()
{
FCoreDelegates::OnPostEngineInit.RemoveAll(this);
}
#undef LOCTEXT_NAMESPACE
IMPLEMENT_MODULE(FModelingComponentsModule, ModelingComponents)