Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ option(NBL_BUILD_DPL "Enable DPL (Dynamic Parallelism Library)" OFF)
option(NBL_PCH "Enable pre-compiled header" ON)
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
option(NBL_BUILD_EXAMPLES "Enable building examples" ON)
option(NBL_BUILD_MITSUBA_LOADER "Enable nbl::ext::MitsubaLoader?" OFF) # TODO: once it compies turn this ON by default!
option(NBL_BUILD_MITSUBA_LOADER "Enable nbl::ext::MitsubaLoader?" ON)
option(NBL_BUILD_IMGUI "Enable nbl::ext::ImGui?" ON)

option(NBL_BUILD_OPTIX "Enable nbl::ext::OptiX?" OFF)
Expand Down
2 changes: 1 addition & 1 deletion CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"NBL_UPDATE_GIT_SUBMODULE": "OFF",
"NBL_COMPILE_WITH_CUDA": "OFF",
"NBL_BUILD_OPTIX": "OFF",
"NBL_BUILD_MITSUBA_LOADER": "OFF",
"NBL_BUILD_MITSUBA_LOADER": "ON",
"NBL_BUILD_RADEON_RAYS": "OFF",
"_NBL_COMPILE_WITH_OPEN_EXR_": "ON",
"NBL_EXPLICIT_MODULE_LOAD_LOG": "ON",
Expand Down
2 changes: 1 addition & 1 deletion examples_tests
36 changes: 18 additions & 18 deletions include/nbl/asset/IAsset.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,24 +156,24 @@ class IAsset : virtual public core::IReferenceCounted
//!
inline bool isMutable() const {return m_mutable;}

inline void visitDependents(std::function<bool(const IAsset*)> visit) const
{
visitDependents_impl([&visit](const IAsset* dep)->bool
{
if (dep)
return visit(dep);
return true;
});
}

inline void visitDependents(std::function<bool(IAsset*)> visit)
{
assert(isMutable());
visitDependents([&](const IAsset* dependent) -> bool
{
return visit(const_cast<IAsset*>(dependent));
});
}
inline void visitDependents(std::function<bool(const IAsset*)> visit) const
{
visitDependents_impl([&visit](const IAsset* dep)->bool
{
if (dep)
return visit(dep);
return true;
});
}

inline void visitDependents(std::function<bool(IAsset*)> visit)
{
assert(isMutable());
visitDependents([&](const IAsset* dependent) -> bool
{
return visit(const_cast<IAsset*>(dependent));
});
}

virtual bool valid() const = 0;

Expand Down
4 changes: 2 additions & 2 deletions include/nbl/asset/ICPUMorphTargets.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class NBL_API2 ICPUMorphTargets : public IAsset, public IMorphTargets<ICPUGeomet
inline E_TYPE getAssetType() const override {return AssetType;}

//
inline bool valid() const //override
inline bool valid() const override
{
for (const auto& target : m_targets)
if (!target || !target.geoCollection->valid())
Expand Down Expand Up @@ -55,7 +55,7 @@ class NBL_API2 ICPUMorphTargets : public IAsset, public IMorphTargets<ICPUGeomet

protected:
//
inline void visitDependents_impl(std::function<bool(const IAsset*)> visit) const //override
inline void visitDependents_impl(std::function<bool(const IAsset*)> visit) const override
{
auto nonNullOnly = [&visit](const IAsset* dep)->bool
{
Expand Down
54 changes: 54 additions & 0 deletions include/nbl/asset/ICPUScene.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// Copyright (C) 2025-2025 - DevSH Graphics Programming Sp. z O.O.
// This file is part of the "Nabla Engine".
// For conditions of distribution and use, see copyright notice in nabla.h
#ifndef _NBL_ASSET_I_CPU_SCENE_H_INCLUDED_
#define _NBL_ASSET_I_CPU_SCENE_H_INCLUDED_


#include "nbl/asset/IScene.h"
// TODO: change to true IR later
#include "nbl/asset/material_compiler3/CFrontendIR.h"


namespace nbl::asset
{
//
class NBL_API2 ICPUScene : public IAsset, public IScene
{
using base_t = IScene;

public:
inline ICPUScene() = default;

constexpr static inline auto AssetType = ET_SCENE;
inline E_TYPE getAssetType() const override { return AssetType; }

inline bool valid() const override
{
return true;
}

inline core::smart_refctd_ptr<IAsset> clone(uint32_t _depth=~0u) const
{
const auto nextDepth = _depth ? (_depth-1):0;
auto retval = core::smart_refctd_ptr<ICPUScene>();
return retval;
}

protected:
//
inline void visitDependents_impl(std::function<bool(const IAsset*)> visit) const override
{
}


// suggested contents:
// - morph target list
// - material table
// - instance list (morph target, keyframed transforms, material table indexings, FUTURE: reference skeleton)
// - area light list (OBB decompositions, material table indexings)
// - envlight data
};
}

#endif
23 changes: 23 additions & 0 deletions include/nbl/asset/IScene.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright (C) 2025-2025 - DevSH Graphics Programming Sp. z O.O.
// This file is part of the "Nabla Engine".
// For conditions of distribution and use, see copyright notice in nabla.h
#ifndef _NBL_ASSET_I_SCENE_H_INCLUDED_
#define _NBL_ASSET_I_SCENE_H_INCLUDED_


#include "nbl/asset/IMorphTargets.h"


namespace nbl::asset
{
// This is incredibly temporary, lots of things are going to change
class NBL_API2 IScene : public virtual core::IReferenceCounted
{
public:

protected:
virtual ~IScene() = default;
};
}

#endif
30 changes: 30 additions & 0 deletions include/nbl/asset/interchange/ISceneLoader.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Copyright (C) 2025-2025 - DevSH Graphics Programming Sp. z O.O.
// This file is part of the "Nabla Engine".
// For conditions of distribution and use, see copyright notice in nabla.h
#ifndef _NBL_ASSET_I_SCENE_LOADER_H_INCLUDED_
#define _NBL_ASSET_I_SCENE_LOADER_H_INCLUDED_


#include "nbl/core/declarations.h"

#include "nbl/asset/ICPUScene.h"
#include "nbl/asset/interchange/IAssetLoader.h"


namespace nbl::asset
{

class ISceneLoader : public IAssetLoader
{
public:
virtual inline uint64_t getSupportedAssetTypesBitfield() const override {return IAsset::ET_SCENE;}

protected:
inline ISceneLoader() {}

private:
};

}

#endif
19 changes: 7 additions & 12 deletions include/nbl/ext/MitsubaLoader/CMitsubaLoader.h
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
// Copyright (C) 2018-2020 - DevSH Graphics Programming Sp. z O.O.
// This file is part of the "Nabla Engine".
// For conditions of distribution and use, see copyright notice in nabla.h
#ifndef _NBL_EXT_MISTUBA_LOADER_C_MITSUBA_LOADER_H_INCLUDED_
#define _NBL_EXT_MISTUBA_LOADER_C_MITSUBA_LOADER_H_INCLUDED_

#ifndef __C_MITSUBA_LOADER_H_INCLUDED__
#define __C_MITSUBA_LOADER_H_INCLUDED__

#include "nbl/asset/asset.h"

#include "IFileSystem.h"
#include "nbl/asset/utils/ICPUVirtualTexture.h"

#include "nbl/ext/MitsubaLoader/CSerializedLoader.h"
#include "nbl/ext/MitsubaLoader/CMitsubaMetadata.h"
#include "nbl/ext/MitsubaLoader/CElementShape.h"
//#include "nbl/ext/MitsubaLoader/CMitsubaMetadata.h"
//#include "nbl/ext/MitsubaLoader/CElementShape.h"
#include "nbl/ext/MitsubaLoader/SContext.h"


Expand All @@ -23,8 +20,7 @@ namespace nbl::ext::MitsubaLoader
class CElementBSDF;
class CMitsubaMaterialCompilerFrontend;


// TODO: we need a GLSL to C++ compatibility wrapper
#if 0 // TODO
//#include "nbl/builtin/glsl/ext/MitsubaLoader/instance_data_struct.glsl"
#define uint uint32_t
#define uvec2 uint64_t
Expand Down Expand Up @@ -52,7 +48,7 @@ struct nbl_glsl_ext_Mitsuba_Loader_instance_data_t
using instance_data_t = nbl_glsl_ext_Mitsuba_Loader_instance_data_t;


class CMitsubaLoader : public asset::IRenderpassIndependentPipelineLoader
class CMitsubaLoader : public asset::ISceneLoader
{
friend class CMitsubaMaterialCompilerFrontend;
public:
Expand All @@ -67,8 +63,6 @@ class CMitsubaLoader : public asset::IRenderpassIndependentPipelineLoader
//! Destructor
virtual ~CMitsubaLoader() = default;

static core::smart_refctd_ptr<asset::ICPUPipelineLayout> createPipelineLayout(asset::IAssetManager* _manager, const asset::ICPUVirtualTexture* _vt);

//
core::vector<SContext::shape_ass_type> getMesh(SContext& ctx, uint32_t hierarchyLevel, CElementShape* shape);
core::vector<SContext::shape_ass_type> loadShapeGroup(SContext& ctx, uint32_t hierarchyLevel, const CElementShape::ShapeGroup* shapegroup, const core::matrix3x4SIMD& relTform);
Expand Down Expand Up @@ -101,6 +95,7 @@ class CMitsubaLoader : public asset::IRenderpassIndependentPipelineLoader
//! Loads an asset from an opened file, returns nullptr in case of failure.
asset::SAssetBundle loadAsset(io::IReadFile* _file, const asset::IAssetLoader::SAssetLoadParams& _params, asset::IAssetLoader::IAssetLoaderOverride* _override = nullptr, uint32_t _hierarchyLevel = 0u) override;
};
#endif

}
#endif
Loading
Loading