Skip to content

Commit b931a11

Browse files
Merge pull request #937 from Devsh-Graphics-Programming/material_compiler_v3
Mitsuba Loader Stub - Parsing only
2 parents 0243260 + 3d61b44 commit b931a11

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+3516
-4564
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ option(NBL_BUILD_DPL "Enable DPL (Dynamic Parallelism Library)" OFF)
173173
option(NBL_PCH "Enable pre-compiled header" ON)
174174
option(NBL_FAST_MATH "Enable fast low-precision math" OFF) # the reason OFF is by default now is the var controling it at build time was set AFTER BuildConfigOptions was generated - resulting in the feature being always OFF regardless the value xD - so just for sanity, keeping the same behaviour by default
175175
option(NBL_BUILD_EXAMPLES "Enable building examples" ON)
176-
option(NBL_BUILD_MITSUBA_LOADER "Enable nbl::ext::MitsubaLoader?" OFF) # TODO: once it compies turn this ON by default!
176+
option(NBL_BUILD_MITSUBA_LOADER "Enable nbl::ext::MitsubaLoader?" ON)
177177
option(NBL_BUILD_IMGUI "Enable nbl::ext::ImGui?" ON)
178178
option(NBL_BUILD_DEBUG_DRAW "Enable Nabla Debug Draw extension?" ON)
179179

CMakePresets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"NBL_UPDATE_GIT_SUBMODULE": "OFF",
1616
"NBL_COMPILE_WITH_CUDA": "OFF",
1717
"NBL_BUILD_OPTIX": "OFF",
18-
"NBL_BUILD_MITSUBA_LOADER": "OFF",
18+
"NBL_BUILD_MITSUBA_LOADER": "ON",
1919
"NBL_BUILD_RADEON_RAYS": "OFF",
2020
"_NBL_COMPILE_WITH_OPEN_EXR_": "ON",
2121
"NBL_EXPLICIT_MODULE_LOAD_LOG": "ON",

include/nbl/asset/IAsset.h

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -156,24 +156,24 @@ class IAsset : virtual public core::IReferenceCounted
156156
//!
157157
inline bool isMutable() const {return m_mutable;}
158158

159-
inline void visitDependents(std::function<bool(const IAsset*)> visit) const
160-
{
161-
visitDependents_impl([&visit](const IAsset* dep)->bool
162-
{
163-
if (dep)
164-
return visit(dep);
165-
return true;
166-
});
167-
}
168-
169-
inline void visitDependents(std::function<bool(IAsset*)> visit)
170-
{
171-
assert(isMutable());
172-
visitDependents([&](const IAsset* dependent) -> bool
173-
{
174-
return visit(const_cast<IAsset*>(dependent));
175-
});
176-
}
159+
inline void visitDependents(std::function<bool(const IAsset*)> visit) const
160+
{
161+
visitDependents_impl([&visit](const IAsset* dep)->bool
162+
{
163+
if (dep)
164+
return visit(dep);
165+
return true;
166+
});
167+
}
168+
169+
inline void visitDependents(std::function<bool(IAsset*)> visit)
170+
{
171+
assert(isMutable());
172+
visitDependents([&](const IAsset* dependent) -> bool
173+
{
174+
return visit(const_cast<IAsset*>(dependent));
175+
});
176+
}
177177

178178
virtual bool valid() const = 0;
179179

include/nbl/asset/ICPUMorphTargets.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class NBL_API2 ICPUMorphTargets : public IAsset, public IMorphTargets<ICPUGeomet
2323
inline E_TYPE getAssetType() const override {return AssetType;}
2424

2525
//
26-
inline bool valid() const //override
26+
inline bool valid() const override
2727
{
2828
for (const auto& target : m_targets)
2929
if (!target || !target.geoCollection->valid())
@@ -55,7 +55,7 @@ class NBL_API2 ICPUMorphTargets : public IAsset, public IMorphTargets<ICPUGeomet
5555

5656
protected:
5757
//
58-
inline void visitDependents_impl(std::function<bool(const IAsset*)> visit) const //override
58+
inline void visitDependents_impl(std::function<bool(const IAsset*)> visit) const override
5959
{
6060
auto nonNullOnly = [&visit](const IAsset* dep)->bool
6161
{

include/nbl/asset/ICPUScene.h

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// Copyright (C) 2025-2025 - DevSH Graphics Programming Sp. z O.O.
2+
// This file is part of the "Nabla Engine".
3+
// For conditions of distribution and use, see copyright notice in nabla.h
4+
#ifndef _NBL_ASSET_I_CPU_SCENE_H_INCLUDED_
5+
#define _NBL_ASSET_I_CPU_SCENE_H_INCLUDED_
6+
7+
8+
#include "nbl/asset/IScene.h"
9+
// TODO: change to true IR later
10+
#include "nbl/asset/material_compiler3/CFrontendIR.h"
11+
12+
13+
namespace nbl::asset
14+
{
15+
//
16+
class NBL_API2 ICPUScene : public IAsset, public IScene
17+
{
18+
using base_t = IScene;
19+
20+
public:
21+
inline ICPUScene() = default;
22+
23+
constexpr static inline auto AssetType = ET_SCENE;
24+
inline E_TYPE getAssetType() const override { return AssetType; }
25+
26+
inline bool valid() const override
27+
{
28+
return true;
29+
}
30+
31+
inline core::smart_refctd_ptr<IAsset> clone(uint32_t _depth=~0u) const
32+
{
33+
const auto nextDepth = _depth ? (_depth-1):0;
34+
auto retval = core::smart_refctd_ptr<ICPUScene>();
35+
return retval;
36+
}
37+
38+
protected:
39+
//
40+
inline void visitDependents_impl(std::function<bool(const IAsset*)> visit) const override
41+
{
42+
}
43+
44+
45+
// suggested contents:
46+
// - morph target list
47+
// - material table
48+
// - instance list (morph target, keyframed transforms, material table indexings, FUTURE: reference skeleton)
49+
// - area light list (OBB decompositions, material table indexings)
50+
// - envlight data
51+
};
52+
}
53+
54+
#endif

include/nbl/asset/IScene.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Copyright (C) 2025-2025 - DevSH Graphics Programming Sp. z O.O.
2+
// This file is part of the "Nabla Engine".
3+
// For conditions of distribution and use, see copyright notice in nabla.h
4+
#ifndef _NBL_ASSET_I_SCENE_H_INCLUDED_
5+
#define _NBL_ASSET_I_SCENE_H_INCLUDED_
6+
7+
8+
#include "nbl/asset/IMorphTargets.h"
9+
10+
11+
namespace nbl::asset
12+
{
13+
// This is incredibly temporary, lots of things are going to change
14+
class NBL_API2 IScene : public virtual core::IReferenceCounted
15+
{
16+
public:
17+
18+
protected:
19+
virtual ~IScene() = default;
20+
};
21+
}
22+
23+
#endif

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: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@
44
#ifndef _NBL_ASSET_I_ASSET_LOADER_H_INCLUDED_
55
#define _NBL_ASSET_I_ASSET_LOADER_H_INCLUDED_
66

7+
78
#include "nbl/system/declarations.h"
89

910
#include "nbl/system/ISystem.h"
1011
#include "nbl/system/ILogger.h"
1112

1213
#include "nbl/asset/interchange/SAssetBundle.h"
1314

15+
1416
namespace nbl::asset
1517
{
1618

@@ -86,8 +88,8 @@ class NBL_API2 IAssetLoader : public virtual core::IReferenceCounted
8688
enum E_LOADER_PARAMETER_FLAGS : uint64_t
8789
{
8890
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
91+
/*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
92+
/*deprecated*/ELPF_DONT_COMPILE_GLSL = 0x2, //!< it states that GLSL won't be compiled to SPIR-V if it is loaded or generated
9193
ELPF_LOAD_METADATA_ONLY = 0x4 //!< it forces the loader to not load the entire scene for performance in special cases to fetch metadata.
9294
};
9395

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

0 commit comments

Comments
 (0)