Skip to content

Commit c3a5f4f

Browse files
fix BSDF mixing.
1 parent fcfb253 commit c3a5f4f

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/nbl/ext/MitsubaLoader/CElementBSDF.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ bool CElementBSDF::addProperty(SNamedPropertyElement&& _property)
512512

513513
if constexpr (std::is_same<state_type,MixtureBSDF>::value)
514514
{
515-
if (_property.type == SPropertyElementData::Type::STRING)
515+
if (_property.type!=SPropertyElementData::Type::STRING)
516516
{
517517
error = true;
518518
return;

src/nbl/ext/MitsubaLoader/CMitsubaMaterialCompilerFrontend.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,8 +341,9 @@ namespace MitsubaLoader
341341
auto* node = static_cast<IR::CBSDFMixNode*>(ir_node);
342342
const size_t cnt = _bsdf->mixturebsdf.childCount;
343343
ir_node->children.count = cnt;
344-
for (int32_t i = cnt-1u; i >= 0; --i)
345-
node->weights[i] = _bsdf->mixturebsdf.weights[i];
344+
const auto* weightIt = _bsdf->mixturebsdf.weights;
345+
for (int32_t i=cnt-1u; i>=0; --i) // need to add weights in reverse, because children are added using a stack
346+
node->weights[i] = *(weightIt++);
346347
}
347348
break;
348349
}

0 commit comments

Comments
 (0)