@@ -653,11 +653,19 @@ SContext::shape_ass_type CMitsubaLoader::loadBasicShape(SContext& ctx, uint32_t
653
653
{
654
654
constexpr uint32_t UV_ATTRIB_ID = 2U ;
655
655
656
- auto addInstance = [shape,&ctx,&relTform,this ](SContext::shape_ass_type& mesh) {
657
- assert (shape-> bsdf );
656
+ auto addInstance = [shape,&ctx,&relTform,this ](SContext::shape_ass_type& mesh)
657
+ {
658
658
auto bsdf = getBSDFtreeTraversal (ctx, shape->bsdf );
659
659
core::matrix3x4SIMD tform = core::concatenateBFollowedByA (relTform, shape->getAbsoluteTransform ());
660
- SContext::SInstanceData instance (tform, bsdf, shape->bsdf ->id , shape->obtainEmitter (), CElementEmitter{});
660
+ SContext::SInstanceData instance (
661
+ tform,
662
+ bsdf,
663
+ #if defined(_NBL_DEBUG) || defined(_NBL_RELWITHDEBINFO)
664
+ shape->bsdf ? shape->bsdf ->id :" " ,
665
+ #endif
666
+ shape->obtainEmitter (),
667
+ CElementEmitter{} // TODO: does enabling a twosided BRDF make the emitter twosided?
668
+ );
661
669
ctx.mapMesh2instanceData .insert ({ mesh.get (), instance });
662
670
};
663
671
@@ -1164,6 +1172,9 @@ SContext::tex_ass_type CMitsubaLoader::cacheTexture(SContext& ctx, uint32_t hier
1164
1172
1165
1173
auto CMitsubaLoader::getBSDFtreeTraversal (SContext& ctx, const CElementBSDF* bsdf) -> SContext::bsdf_type
1166
1174
{
1175
+ if (!bsdf)
1176
+ return {nullptr ,nullptr };
1177
+
1167
1178
auto found = ctx.instrStreamCache .find (bsdf);
1168
1179
if (found!=ctx.instrStreamCache .end ())
1169
1180
return found->second ;
0 commit comments