Skip to content

Commit 99c1b8a

Browse files
author
devsh
committed
start the loader
1 parent ab9e7b8 commit 99c1b8a

File tree

12 files changed

+103
-307
lines changed

12 files changed

+103
-307
lines changed

include/nbl/asset/asset.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
#include "nbl/asset/interchange/IAssetLoader.h"
6262
#include "nbl/asset/interchange/IImageLoader.h"
6363
#include "nbl/asset/interchange/IGeometryLoader.h"
64+
#include "nbl/asset/interchange/ISceneLoader.h"
6465
#include "nbl/asset/interchange/IAssetWriter.h"
6566
#include "nbl/asset/interchange/IImageWriter.h"
6667
#include "nbl/asset/metadata/COpenEXRMetadata.h"

include/nbl/asset/interchange/IAssetLoader.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ class NBL_API2 IAssetLoader : public virtual core::IReferenceCounted
8686
enum E_LOADER_PARAMETER_FLAGS : uint64_t
8787
{
8888
ELPF_NONE = 0, //!< default value, it doesn't do anything
89-
ELPF_RIGHT_HANDED_MESHES = 0x1, //!< specifies that a mesh will be flipped in such a way that it'll look correctly in right-handed camera system
90-
ELPF_DONT_COMPILE_GLSL = 0x2, //!< it states that GLSL won't be compiled to SPIR-V if it is loaded or generated
89+
/*deprecated*/ELPF_RIGHT_HANDED_MESHES = 0x1, //!< specifies that a mesh will be flipped in such a way that it'll look correctly in right-handed camera system
90+
/*deprecated*/ELPF_DONT_COMPILE_GLSL = 0x2, //!< it states that GLSL won't be compiled to SPIR-V if it is loaded or generated
9191
ELPF_LOAD_METADATA_ONLY = 0x4 //!< it forces the loader to not load the entire scene for performance in special cases to fetch metadata.
9292
};
9393

include/nbl/asset/interchange/IImageLoader.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
// Copyright (C) 2018-2020 - DevSH Graphics Programming Sp. z O.O.
22
// This file is part of the "Nabla Engine".
33
// For conditions of distribution and use, see copyright notice in nabla.h
4-
5-
#ifndef __NBL_ASSET_I_IMAGE_LOADER_H_INCLUDED__
6-
#define __NBL_ASSET_I_IMAGE_LOADER_H_INCLUDED__
4+
#ifndef _NBL_ASSET_I_IMAGE_LOADER_H_INCLUDED_
5+
#define _NBL_ASSET_I_IMAGE_LOADER_H_INCLUDED_
76

87
#include "nbl/core/declarations.h"
98

include/nbl/ext/MitsubaLoader/CMitsubaLoader.h

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,15 @@ struct nbl_glsl_ext_Mitsuba_Loader_instance_data_t
4646
#undef mat4x3
4747
#undef nbl_glsl_MC_material_data_t
4848
using instance_data_t = nbl_glsl_ext_Mitsuba_Loader_instance_data_t;
49-
49+
#endif
5050

5151
class CMitsubaLoader : public asset::ISceneLoader
5252
{
53-
friend class CMitsubaMaterialCompilerFrontend;
53+
// friend class CMitsubaMaterialCompilerFrontend;
5454
public:
5555
//! Constructor
56-
CMitsubaLoader(asset::IAssetManager* _manager, io::IFileSystem* _fs);
57-
58-
void initialize() override;
59-
56+
inline CMitsubaLoader() = default;
57+
#if 0
6058
protected:
6159
io::IFileSystem* m_filesystem;
6260

@@ -78,24 +76,18 @@ class CMitsubaLoader : public asset::ISceneLoader
7876
core::smart_refctd_ptr<asset::ICPUDescriptorSet> createDS0(const SContext& _ctx, asset::ICPUPipelineLayout* _layout, const asset::material_compiler::CMaterialCompilerGLSLBackendCommon::result_t& _compResult, Iter meshBegin, Iter meshEnd);
7977

8078
public:
81-
//! Check if the file might be loaded by this class
82-
/** Check might look into the file.
83-
\param file File handle to check.
84-
\return True if file seems to be loadable. */
85-
bool isALoadableFileFormat(io::IReadFile* _file) const override;
86-
87-
//! Returns an array of string literals terminated by nullptr
88-
const char** getAssociatedFileExtensions() const override;
79+
#endif
80+
bool isALoadableFileFormat(system::IFile* _file, const system::logger_opt_ptr logger=nullptr) const override;
8981

90-
//! Returns the assets loaded by the loader
91-
/** Bits of the returned value correspond to each IAsset::E_TYPE
92-
enumeration member, and the return value cannot be 0. */
93-
uint64_t getSupportedAssetTypesBitfield() const override { return asset::IAsset::ET_MESH/*|asset::IAsset::ET_SCENE|asset::IAsset::ET_IMPLEMENTATION_SPECIFIC_METADATA*/; }
82+
inline const char** getAssociatedFileExtensions() const override
83+
{
84+
static const char* ext[]{ "xml", nullptr };
85+
return ext;
86+
}
9487

9588
//! Loads an asset from an opened file, returns nullptr in case of failure.
96-
asset::SAssetBundle loadAsset(io::IReadFile* _file, const asset::IAssetLoader::SAssetLoadParams& _params, asset::IAssetLoader::IAssetLoaderOverride* _override = nullptr, uint32_t _hierarchyLevel = 0u) override;
89+
asset::SAssetBundle loadAsset(system::IFile* _file, const asset::IAssetLoader::SAssetLoadParams& _params, asset::IAssetLoader::IAssetLoaderOverride* _override=nullptr, uint32_t _hierarchyLevel=0u) override;
9790
};
98-
#endif
9991

10092
}
10193
#endif

include/nbl/ext/MitsubaLoader/CMitsubaMaterialCompilerFrontend.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
// Copyright (C) 2018-2020 - DevSH Graphics Programming Sp. z O.O.
22
// This file is part of the "Nabla Engine".
33
// For conditions of distribution and use, see copyright notice in nabla.h
4+
#ifndef _C_MITSUBA_MATERIAL_COMPILER_FRONTEND_H_INCLUDED_
5+
#define _C_MITSUBA_MATERIAL_COMPILER_FRONTEND_H_INCLUDED_
46

5-
#ifndef __C_MITSUBA_MATERIAL_COMPILER_FRONTEND_H_INCLUDED__
6-
#define __C_MITSUBA_MATERIAL_COMPILER_FRONTEND_H_INCLUDED__
77

8-
#include "nbl/core/Types.h"
9-
10-
#include "nbl/asset/material_compiler/IR.h"
8+
//#include "nbl/asset/material_compiler/IR.h"
119

1210
#include "nbl/ext/MitsubaLoader/CElementBSDF.h"
1311
#include "nbl/ext/MitsubaLoader/CElementEmitter.h"
@@ -23,6 +21,7 @@ struct SContext;
2321
class CMitsubaMaterialCompilerFrontend
2422
{
2523
public:
24+
#ifdef 0
2625
using IRNode = asset::material_compiler::IR::INode;
2726
using EmitterNode = asset::material_compiler::IR::CEmitterNode;
2827
enum E_IMAGE_VIEW_SEMANTIC : uint8_t
@@ -60,8 +59,8 @@ class CMitsubaMaterialCompilerFrontend
6059
tex_ass_type getErrorTexture(const E_IMAGE_VIEW_SEMANTIC semantic) const;
6160

6261
IRNode* createIRNode(asset::material_compiler::IR* ir, const CElementBSDF* _bsdf);
62+
#endif
6363
};
6464

6565
}
66-
6766
#endif

include/nbl/ext/MitsubaLoader/CSerializedLoader.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class CSerializedLoader final : public asset::IGeometryLoader
2121
public:
2222
inline CSerializedLoader() = default;
2323

24-
inline bool isALoadableFileFormat(system::IFile* _file, const system::logger_opt_ptr logger = nullptr) const override
24+
inline bool isALoadableFileFormat(system::IFile* _file, const system::logger_opt_ptr logger=nullptr) const override
2525
{
2626
FileHeader header;
2727

include/nbl/ext/MitsubaLoader/ParserUtil.h

Lines changed: 17 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,39 @@
11
// Copyright (C) 2018-2020 - DevSH Graphics Programming Sp. z O.O.
22
// This file is part of the "Nabla Engine".
33
// For conditions of distribution and use, see copyright notice in nabla.h
4+
#ifndef _NBL_EXT_MISTUBA_LOADER_I_PARSER_UTIL_H_INCLUDED_
5+
#define _NBL_EXT_MISTUBA_LOADER_I_PARSER_UTIL_H_INCLUDED_
46

5-
#ifndef __I_PARSER_UTIL_H_INCLUDED__
6-
#define __I_PARSER_UTIL_H_INCLUDED__
7-
8-
//#include "nbl/core/core.h"
9-
10-
//#include "IFileSystem.h"
117

128
#include "nbl/asset/interchange/IAssetLoader.h"
139

14-
#include "nbl/ext/MitsubaLoader/CElementFactory.h"
15-
#include "nbl/ext/MitsubaLoader/CMitsubaMetadata.h"
10+
//#include "nbl/ext/MitsubaLoader/CElementFactory.h"
11+
//#include "nbl/ext/MitsubaLoader/CMitsubaMetadata.h"
1612

1713
#include "expat/lib/expat.h"
1814

1915
#include <stack>
2016

2117

22-
namespace nbl
23-
{
24-
namespace ext
25-
{
26-
namespace MitsubaLoader
18+
namespace nbl::ext::MitsubaLoader
2719
{
28-
29-
30-
3120
class ParserLog
3221
{
33-
public:
34-
static inline void setLogger(const system::logger_opt_ptr& logger) { ParserLog::logger = logger; };
22+
public:
23+
static inline void setLogger(const system::logger_opt_ptr& _logger) {logger=_logger;}
3524

36-
/*prints this message:
37-
Mitsuba loader error:
38-
Invalid .xml file structure: message */
39-
static void invalidXMLFileStructure(const std::string& errorMessage);
25+
/*prints this message:
26+
Mitsuba loader error:
27+
Invalid .xml file structure: message */
28+
static void invalidXMLFileStructure(const std::string& errorMessage);
4029

41-
private:
42-
static system::logger_opt_ptr logger;
30+
private:
31+
static system::logger_opt_ptr logger;
4332
};
4433

4534

4635
template<typename... types>
47-
class ElementPool // : public std::tuple<core::vector<types>...>
36+
class ElementPool // similar to : public std::tuple<core::vector<types>...>
4837
{
4938
core::SimpleBlockBasedAllocator<core::LinearAddressAllocator<uint32_t>,core::aligned_allocator> poolAllocator;
5039
public:
@@ -68,7 +57,9 @@ class ParserManager
6857
XML_Parser parser;
6958
system::path currentXMLDir;
7059
};
60+
7161
public:
62+
#if 0
7263
//! Constructor
7364
ParserManager(system::ISystem* _system, asset::IAssetLoader::IAssetLoaderOverride* _override) :
7465
m_system(_system), m_override(_override), m_sceneDeclCount(0),
@@ -127,12 +118,9 @@ class ParserManager
127118
each element of index N is parent of the element of index N+1
128119
the scene element is a parent of all elements of index 0 */
129120
core::stack<std::pair<IElement*,std::string> > elements;
130-
121+
#endif
131122
friend class CElementFactory;
132123
};
133124

134125
}
135-
}
136-
}
137-
138126
#endif

include/nbl/ext/MitsubaLoader/SContext.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
namespace nbl::ext::MitsubaLoader
1616
{
1717

18+
class CMitsubaMetadata;
19+
1820
struct SContext
1921
{
2022
public:
@@ -23,14 +25,14 @@ struct SContext
2325
// const asset::IMeshManipulator* _manipulator,
2426
const asset::IAssetLoader::SAssetLoadContext& _params,
2527
asset::IAssetLoader::IAssetLoaderOverride* _override,
26-
// CMitsubaMetadata* _metadata
28+
CMitsubaMetadata* _metadata
2729
);
2830

2931
// const asset::IGeometryCreator* creator;
3032
// const asset::IMeshManipulator* manipulator;
3133
const asset::IAssetLoader::SAssetLoadContext inner;
3234
asset::IAssetLoader::IAssetLoaderOverride* override_;
33-
// CMitsubaMetadata* meta;
35+
CMitsubaMetadata* meta;
3436

3537
#if 0
3638
//
@@ -192,8 +194,8 @@ struct SContext
192194
core::unordered_map<SPipelineCacheKey, core::smart_refctd_ptr<asset::ICPURenderpassIndependentPipeline>, SPipelineCacheKey::hash> pipelineCache;
193195
#endif
194196
//material compiler
195-
core::smart_refctd_ptr<asset::material_compiler::IR> ir;
196-
CMitsubaMaterialCompilerFrontend frontend;
197+
// core::smart_refctd_ptr<asset::material_compiler::IR> ir;
198+
// CMitsubaMaterialCompilerFrontend frontend;
197199

198200
private:
199201
};

src/nbl/asset/interchange/CIESProfileLoader.h

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
// Copyright (C) 2018-2023 - DevSH Graphics Programming Sp. z O.O.
22
// This file is part of the "Nabla Engine".
33
// For conditions of distribution and use, see copyright notice in nabla.h
4-
#ifndef __NBL_ASSET_C_IES_PROFILE_LOADER_H_INCLUDED__
5-
#define __NBL_ASSET_C_IES_PROFILE_LOADER_H_INCLUDED__
4+
#ifndef _NBL_ASSET_C_IES_PROFILE_LOADER_H_INCLUDED_
5+
#define _NBL_ASSET_C_IES_PROFILE_LOADER_H_INCLUDED_
66

77
#include "nbl/asset/ICPUImage.h"
8-
#include "nbl/asset/ICPUShader.h"
98

109
#include "nbl/asset/IAssetManager.h"
11-
1210
#include "nbl/asset/interchange/IAssetLoader.h"
13-
#include "nbl/asset/utils/CIESProfileParser.h"
11+
12+
#if 0 // TODO: Arek
13+
14+
#include "nbl/asset/utils/CIESProfileParser.h" // TODO: move to `src/asset/interchange`
1415
#include "nbl/asset/metadata/CIESProfileMetadata.h"
1516

1617
namespace nbl::asset
@@ -62,4 +63,6 @@ class CIESProfileLoader final : public asset::IAssetLoader
6263
uint32_t _hierarchyLevel = 0u) override;
6364
};
6465
} // namespace nbl::asset
66+
#endif // end TODO: Arek
67+
6568
#endif // __NBL_ASSET_C_IES_PROFILE_LOADER_H_INCLUDED__

0 commit comments

Comments
 (0)