Skip to content

Commit aebaa24

Browse files
Correct the worst typo in the universe
1 parent 75009e8 commit aebaa24

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

include/nbl/asset/utils/IMeshManipulator.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,8 +324,6 @@ class IMeshManipulator : public virtual core::IReferenceCounted
324324
{
325325
const uint32_t indexCount = meshbuffer->getIndexCount();
326326
if (indexPtr)
327-
vertexCount = indexCount;
328-
else
329327
{
330328
for (uint32_t j=0ull; j<indexCount; j++)
331329
{
@@ -336,6 +334,8 @@ class IMeshManipulator : public virtual core::IReferenceCounted
336334
if (indexCount)
337335
vertexCount++;
338336
}
337+
else
338+
vertexCount = indexCount;
339339
};
340340

341341
const void* indices = meshbuffer->getIndices();

src/nbl/ext/MitsubaLoader/CMitsubaLoader.cpp

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -653,11 +653,19 @@ SContext::shape_ass_type CMitsubaLoader::loadBasicShape(SContext& ctx, uint32_t
653653
{
654654
constexpr uint32_t UV_ATTRIB_ID = 2U;
655655

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+
{
658658
auto bsdf = getBSDFtreeTraversal(ctx, shape->bsdf);
659659
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+
);
661669
ctx.mapMesh2instanceData.insert({ mesh.get(), instance });
662670
};
663671

@@ -1164,6 +1172,9 @@ SContext::tex_ass_type CMitsubaLoader::cacheTexture(SContext& ctx, uint32_t hier
11641172

11651173
auto CMitsubaLoader::getBSDFtreeTraversal(SContext& ctx, const CElementBSDF* bsdf) -> SContext::bsdf_type
11661174
{
1175+
if (!bsdf)
1176+
return {nullptr,nullptr};
1177+
11671178
auto found = ctx.instrStreamCache.find(bsdf);
11681179
if (found!=ctx.instrStreamCache.end())
11691180
return found->second;

0 commit comments

Comments
 (0)