Skip to content

Commit

Permalink
added MaterialsConfig.ScalarParamsOverrides
Browse files Browse the repository at this point in the history
  • Loading branch information
rdeioris committed May 28, 2023
1 parent 9ae0621 commit 73b6001
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Source/glTFRuntime/Private/glTFRuntimeParserMaterials.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,15 @@ UMaterialInterface* FglTFRuntimeParser::BuildMaterial(const int32 Index, const F
ApplyMaterialFloatFactor(RuntimeMaterial.bKHR_materials_clearcoat, "clearcoatFactor", RuntimeMaterial.ClearCoatFactor);
ApplyMaterialFloatFactor(RuntimeMaterial.bKHR_materials_clearcoat, "clearcoatRoughnessFactor", RuntimeMaterial.ClearCoatRoughnessFactor);

for (const TPair<FString, float>& Pair : MaterialsConfig.ScalarParamsOverrides)
{
float ScalarValue = 0;
if (Material->GetScalarParameterValue(*Pair.Key, ScalarValue))
{
Material->SetScalarParameterValue(*Pair.Key, Pair.Value);
}
}

for (const TPair<FString, float>& Pair : MaterialsConfig.ParamsMultiplier)
{
float ScalarValue = 0;
Expand Down
3 changes: 3 additions & 0 deletions Source/glTFRuntime/Public/glTFRuntimeParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,9 @@ struct FglTFRuntimeMaterialsConfig
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "glTFRuntime")
UMaterialInterface* VertexColorOnlyMaterial;

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "glTFRuntime")
TMap<FString, float> ScalarParamsOverrides;

FglTFRuntimeMaterialsConfig()
{
CacheMode = EglTFRuntimeCacheMode::ReadWrite;
Expand Down

0 comments on commit 73b6001

Please sign in to comment.