@@ -29,27 +29,6 @@ namespace ext::MitsubaLoader
2929{
3030
3131#if 0 // old material compiler
32- _NBL_STATIC_INLINE_CONSTEXPR const char* FRAGMENT_SHADER_DEFINITIONS =
33- R"(
34- vec3 nbl_glsl_MC_getNormalizedWorldSpaceV()
35- {
36- vec3 campos = ....;
37- return normalize(campos - WorldPos);
38- }
39- vec3 nbl_glsl_MC_getNormalizedWorldSpaceN()
40- {
41- return normalize(Normal);
42- }
43-
44- mat2x3 nbl_glsl_perturbNormal_dPdSomething()
45- {
46- return mat2x3(dFdx(WorldPos),dFdy(WorldPos));
47- }
48- mat2 nbl_glsl_perturbNormal_dUVdSomething()
49- {
50- return mat2(dFdx(UV),dFdy(UV));
51- }
52- )";
5332_NBL_STATIC_INLINE_CONSTEXPR const char* FRAGMENT_SHADER_IMPL = R"(
5433#ifndef _NBL_BSDF_COS_EVAL_DEFINED_
5534#define _NBL_BSDF_COS_EVAL_DEFINED_
@@ -104,19 +83,6 @@ void main()
10483}
10584#endif
10685)";
107- static core::smart_refctd_ptr<asset::ICPUSpecializedShader> createFragmentShader(const asset::material_compiler::CMaterialCompilerGLSLBackendCommon::result_t& _mcRes, size_t _VTstorageViewCount)
108- {
109- std::string source =
110- FRAGMENT_SHADER_PROLOGUE +
111- _mcRes.fragmentShaderSource_declarations +
112- FRAGMENT_SHADER_INPUT_OUTPUT +
113- "#include <nbl/builtin/glsl/ext/MitsubaLoader/material_compiler_compatibility.glsl/" + std::to_string(_VTstorageViewCount) + ">" +
114- FRAGMENT_SHADER_DEFINITIONS +
115- _mcRes.fragmentShaderSource +
116- FRAGMENT_SHADER_IMPL;
117-
118- return createSpecShader(source.c_str(), asset::ISpecializedShader::ESS_FRAGMENT);
119- }
12086// TODO: move to IAssetLoader
12187static core::smart_refctd_ptr<asset::ICPUImage> createDerivMap(SContext& ctx, asset::ICPUImage* _heightMap, const ICPUSampler::SParams& _samplerParams, bool fromNormalMap)
12288{
@@ -142,11 +108,8 @@ static core::smart_refctd_ptr<asset::ICPUImage> createDerivMap(SContext& ctx, as
142108
143109 return derivmap_img;
144110}
145- static core::smart_refctd_ptr<asset::ICPUImage> createSingleChannelImage(const asset::ICPUImage* _img, const asset::ICPUImageView::SComponentMapping::E_SWIZZLE srcChannel)
146- {
147- // deprecated will be expressed in Material Compiler Frontend AST as a swizzle
148- }
149111#endif
112+
150113constexpr auto LoggerError = system::ILogger::ELL_ERROR;
151114
152115bool CMitsubaLoader::isALoadableFileFormat (system::IFile* _file, const system::logger_opt_ptr logger) const
@@ -216,7 +179,7 @@ void SContext::writeDot3File(system::ISystem* system, const system::path& filepa
216179 }
217180 if (!file)
218181 {
219- inner.params .logger .log (" Failed to Open \" %s\" for writing" ,system::ILogger::ELL_ERROR ,filepath.c_str ());
182+ inner.params .logger .log (" Failed to Open \" %s\" for writing" ,LoggerError ,filepath.c_str ());
220183 return ;
221184 }
222185 auto str = printer ();
@@ -304,7 +267,7 @@ SAssetBundle CMitsubaLoader::loadAsset(system::IFile* _file, const IAssetLoader:
304267 instances.resize (index+1 ,true );
305268 instances.getMorphTargets ()[index] = core::smart_refctd_ptr<ICPUMorphTargets>(const_cast <ICPUMorphTargets*>(targets.get ()));
306269 if (shape->transform .matrix [3 ]!=float32_t4 (0 ,0 ,0 ,1 ))
307- _params.logger .log (" Shape with id %s has Non-Affine transformation matrix, last row is not 0,0,0,1!" ,system::ILogger::ELL_ERROR ,shape->id .c_str ());
270+ _params.logger .log (" Shape with id %s has Non-Affine transformation matrix, last row is not 0,0,0,1!" ,LoggerError ,shape->id .c_str ());
308271 instances.getInitialTransforms ()[index] = shape->getTransform ();
309272 //
310273 const core::string debugName = shape->id .empty () ? std::format (" 0x{:x}" ,ptrdiff_t (shape)):shape->id ;
@@ -426,7 +389,7 @@ auto SContext::getMaterial(
426389 auto logger = inner.params .logger ;
427390 if (!success)
428391 {
429- logger.log (" Failed to add Material for %s" ,system::ILogger::ELL_ERROR ,debugName.c_str ());
392+ logger.log (" Failed to add Material for %s" ,LoggerError ,debugName.c_str ());
430393 return {};
431394 }
432395 else if (debugFileWriter)
@@ -509,10 +472,10 @@ parameter_t SContext::getTexture(const CElementTexture* const rootTex, hlsl::flo
509472 transform[1 ][2 ] = bitmap.voffset ;
510473 }
511474 else
512- inner.params .logger .log (" Failed to load bitmap texture for %p with id %s" ,system::ILogger::ELL_ERROR ,tex,tex ? tex->id .c_str ():" " );
475+ inner.params .logger .log (" Failed to load bitmap texture for %p with id %s" ,LoggerError ,tex,tex ? tex->id .c_str ():" " );
513476 }
514477 else
515- inner.params .logger .log (" Failed to unroll texture scale for %p with id %s" ,system::ILogger::ELL_ERROR ,rootTex,rootTex ? rootTex->id .c_str ():" " );
478+ inner.params .logger .log (" Failed to unroll texture scale for %p with id %s" ,LoggerError ,rootTex,rootTex ? rootTex->id .c_str ():" " );
516479 if (!retval.view ) // set a clear error value
517480 retval.scale = std::numeric_limits<decltype (retval.scale )>::signaling_NaN ();
518481 return retval;
@@ -623,7 +586,7 @@ auto SContext::genProfile(const CElementEmissionProfile* profile) -> frontend_ir
623586 iesMeta = meta->selfCast <const CIESProfileMetadata>();
624587 if (!iesMeta)
625588 {
626- inner.params .logger .log (" Could Load Emission Profile from \" %s\" or its not an IES profile!" ,system::ILogger::ELL_ERROR ,profile->filename );
589+ inner.params .logger .log (" Could Load Emission Profile from \" %s\" or its not an IES profile!" ,LoggerError ,profile->filename );
627590 return retval;
628591 }
629592 assert (assetLoaded.getAssetType ()==IAsset::ET_IMAGE_VIEW);
@@ -952,7 +915,7 @@ auto SContext::genMaterial(const CElementBSDF* bsdf, system::ISystem* debugFileW
952915 auto logger = inner.params .logger ;
953916 if (!success)
954917 {
955- logger.log (" Failed to add Material for %s" ,system::ILogger::ELL_ERROR ,debugName.c_str ());
918+ logger.log (" Failed to add Material for %s" ,LoggerError ,debugName.c_str ());
956919 return {};
957920 }
958921 else if (debugFileWriter)
@@ -1100,7 +1063,7 @@ auto SContext::loadShapeGroup(const CElementShape* shape) -> SContext::shape_ass
11001063
11011064 auto collection = core::make_smart_refctd_ptr<ICPUGeometryCollection>();
11021065 if (!collection)
1103- inner.params .logger .log (" Failed to create an ICPUGeometryCollection for Shape Group" ,system::ILogger::ELL_ERROR );
1066+ inner.params .logger .log (" Failed to create an ICPUGeometryCollection for Shape Group" ,LoggerError );
11041067 else
11051068 {
11061069 auto * geometries = collection->getGeometries ();
@@ -1302,6 +1265,7 @@ auto SContext::loadBasicShape(const CElementShape* shape) -> SContext::shape_ass
13021265 addGeometry ({.geometry =creator->createDisk (1 .f ,64 )});
13031266 break ;
13041267 case CElementShape::Type::OBJ:
1268+ assert (false );
13051269#if 0 // TODO: Arek
13061270 mesh = loadModel(shape->obj.filename);
13071271 flipNormals = flipNormals!=shape->obj.flipNormals;
@@ -1363,7 +1327,7 @@ auto SContext::loadBasicShape(const CElementShape* shape) -> SContext::shape_ass
13631327 // handle fail
13641328 if (pGeometries->empty ())
13651329 {
1366- inner.params .logger .log (" Failed to Load/Create Basic non-Instanced Shape with id %s" ,system::ILogger::ELL_ERROR ,shape->id .c_str ());
1330+ inner.params .logger .log (" Failed to Load/Create Basic non-Instanced Shape with id %s" ,LoggerError ,shape->id .c_str ());
13671331 return nullptr ;
13681332 }
13691333
0 commit comments