Refactor specular lighting to properly map specular as reflectance in BRDF
Reference: https://google.github.io/filament/Filament.md.html #1492
This commit is contained in:
@@ -106,7 +106,7 @@ void MaterialGenerator::ProcessGroupMaterial(Box* box, Node* node, Value& value)
|
||||
Value values[OutputsMax];
|
||||
for (int32 i = 0; i < OutputsMax; i++)
|
||||
{
|
||||
const auto outputBox = node->GetBox(Output0BoxID + i);
|
||||
const auto outputBox = node->TryGetBox(Output0BoxID + i);
|
||||
if (outputBox && outputBox->HasConnection())
|
||||
{
|
||||
values[i] = writeLocal(VariantType::Float4, node);
|
||||
@@ -119,7 +119,7 @@ void MaterialGenerator::ProcessGroupMaterial(Box* box, Node* node, Value& value)
|
||||
for (int32 i = 0; i < InputsMax; i++)
|
||||
{
|
||||
auto inputName = TEXT("Input") + StringUtils::ToString(i);
|
||||
const auto inputBox = node->GetBox(Input0BoxID + i);
|
||||
const auto inputBox = node->TryGetBox(Input0BoxID + i);
|
||||
if (inputBox && inputBox->HasConnection())
|
||||
{
|
||||
auto inputValue = tryGetValue(inputBox, Value::Zero);
|
||||
@@ -131,7 +131,7 @@ void MaterialGenerator::ProcessGroupMaterial(Box* box, Node* node, Value& value)
|
||||
for (int32 i = 0; i < OutputsMax; i++)
|
||||
{
|
||||
auto outputName = TEXT("Output") + StringUtils::ToString(i);
|
||||
const auto outputBox = node->GetBox(Output0BoxID + i);
|
||||
const auto outputBox = node->TryGetBox(Output0BoxID + i);
|
||||
if (outputBox && outputBox->HasConnection())
|
||||
{
|
||||
code.Replace(*outputName, *values[i].Value, StringSearchCase::CaseSensitive);
|
||||
@@ -146,7 +146,7 @@ void MaterialGenerator::ProcessGroupMaterial(Box* box, Node* node, Value& value)
|
||||
// Link output values to boxes
|
||||
for (int32 i = 0; i < OutputsMax; i++)
|
||||
{
|
||||
const auto outputBox = node->GetBox(Output0BoxID + i);
|
||||
const auto outputBox = node->TryGetBox(Output0BoxID + i);
|
||||
if (outputBox && outputBox->HasConnection())
|
||||
{
|
||||
outputBox->Cache = values[i];
|
||||
|
||||
Reference in New Issue
Block a user