Skip to content

New Geometry Asset classes and Mesh Loader replacements #882

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 81 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
f523ef3
initial examples_tests submodule change
May 27, 2025
87e11e5
clean up the `nbl::hlsl::shapes` namespace a bit
May 28, 2025
0824014
new classes to replace IMeshBuffer and IMesh
May 28, 2025
3cf9d25
add a general polygon geometry
May 28, 2025
3c5e81f
correct typos and allow different geometries in a collection
May 28, 2025
7f65993
add a set transform callback to `exportForBLAS` this lets us know the…
May 28, 2025
65e9b72
add important methods and metadata for the `SDataViewBase::encodedDat…
May 28, 2025
f37cca7
add all missing data streams from ICPUMeshBuffer to IPolygonGeometry
May 28, 2025
4c7fcb7
Move the requirement for the Position View to be formatted from `IGeo…
May 28, 2025
30adb9c
correct header name to `ICPUPolygonGeometry` and implement `IAsset` m…
May 28, 2025
a0a006c
implement visitor properly
May 28, 2025
30e3bed
add the element encode/decode functions for `IGeometry::SDataView`
May 28, 2025
57f8905
excise Mesh and MeshBuffer from the asset namespace, reassign Asset T…
May 28, 2025
3001e24
correct a slight encapsulation leak
May 28, 2025
07e7176
get rid of now useless metadata classes
May 28, 2025
c9e8ca8
start cleaning up the mesh manipulator into a geometry manipulator
May 28, 2025
6a64ede
remove the renderpass independent pipeline from nbl::asset::
May 28, 2025
fef2ebc
Mesh Packers don't make much sense anymore with programmable vertex p…
May 28, 2025
7f1302c
add ICPUGeometryCollection
May 29, 2025
18adf44
hoist most of the BLAS geometry export out of IGeometryCollection
May 29, 2025
40a8df3
implement ICPUMorphTargets
May 29, 2025
2c9b860
start removing unnecessary things from PolygonGeometryManipulator
May 29, 2025
c91f2d7
correct typos, get stuff compiling
May 29, 2025
0a37d24
fight for more compilation
May 29, 2025
fd87ce7
outline some ideas about dealing with indexing schemes
May 29, 2025
144299d
finalize my indexing abstraction logic
May 31, 2025
0215b88
cauterize more stuff, start working on the Geometry Creator
May 31, 2025
b5830e7
correct a bunch of typos
May 31, 2025
c077d6e
get one step closer to compiling
Jun 3, 2025
e217665
OBJ should really be a scene loader in the future (just no lights)
Jun 3, 2025
8f1564a
in thre interest of thread safety we should not have default manipula…
Jun 3, 2025
c0dffe3
get Nabla compiling
Jun 3, 2025
cb6d148
update submodule pointer
Jun 3, 2025
7077a04
remove last remnanst, and turn off STL /PLY writers for now to let CI…
Jun 3, 2025
99efe2a
fix include bug of beziers.hlsl tested with CAD playground example
Jun 3, 2025
1f51c33
Merge pull request #885 from Devsh-Graphics-Programming/master
devshgraphicsprogramming Jun 3, 2025
2aa2395
a cry for help to @AnastaZIuk
Jun 4, 2025
7f85f18
on road to rework examples PCH and cleaning build system a bit, updat…
AnastaZIuk Jun 11, 2025
2227505
wipe _NBL_APP_NAME_ define reference from nbl/application_templates/M…
AnastaZIuk Jun 11, 2025
afac36d
update examples_tests submodule
AnastaZIuk Jun 11, 2025
ef0f206
add missing EXCLUDE_FROM_ALL for examples_tests
AnastaZIuk Jun 11, 2025
c18c8ae
create NBL_ADJUST_FOLDERS and use for a few namespaces to group targe…
AnastaZIuk Jun 11, 2025
c02e5b1
add `Container – Build Examples` step to .github/workflows/build-nabl…
AnastaZIuk Jun 11, 2025
4dedfd6
EXCLUDE_FROM_ALL nite, correct building examples and installing targets
AnastaZIuk Jun 12, 2025
30eff84
implement cube geometry creation
Jun 16, 2025
d654a25
get stuff to compile
Jun 16, 2025
aae0623
remove cruft
Jun 16, 2025
bb6f9e5
add conversion operator from SBufferRange to SBufferBinding
Jun 16, 2025
fa02163
implement `fast_affine.hlsl`
Jun 16, 2025
5b066f8
get stuff to compile
Jun 16, 2025
16b7c53
fix geometry memory issues
Jun 16, 2025
8ed377a
implement rectangle and disk
Jun 16, 2025
65c2047
fix bad (reverse) implementation of checking validity of `SDataView`
Jun 16, 2025
569839e
add `IGPUPolygonGeometry` and attempt AssetConverter implementation f…
Jun 17, 2025
1403f33
improve `CAssetConverter` to take into account that not every `asset_…
Jun 17, 2025
4eef9f9
get assetConverter to work on `IGPUPolygonGeometry`
Jun 17, 2025
2798fba
sync validation TODO
Jun 17, 2025
f143d0b
add explicit constructors to `hlsl::matrix` which can cast between ma…
Jun 18, 2025
ad27a61
Implement allPreviousStages and allLaterStages
Jun 18, 2025
776fb12
Merge remote-tracking branch 'remotes/origin/master' into mesh_loaders
Jun 18, 2025
1f52d2f
bring new Assets in line with Stageless Shaders API change
Jun 18, 2025
b8c42b2
get as many examples working as possible after the merge
Jun 18, 2025
5462fe3
Ready for Arek to work his magic
Jun 19, 2025
3fa43e2
something should be on screen but my `fast_affine.hlsl` is busted
Jun 19, 2025
4c8c47b
Merge branch 'mesh_loaders' of github.com:Devsh-Graphics-Programming/…
Jun 19, 2025
1dc258e
Add itself as next stage and previous stage for all pipeline stages
Jun 19, 2025
c42afec
pull Matt and resolve conflicts
AnastaZIuk Jun 19, 2025
961cbdf
update examples_tests submodule
AnastaZIuk Jun 19, 2025
f2f5d01
Add -1 to maxVertex
Jun 20, 2025
1d9658e
fix bugs in geometry creator and Indexing callback for triangle Fan
Jun 20, 2025
3c75ba5
turns out `CGLSLCompiler::preprocessShader` didn't quite work right f…
Jun 21, 2025
101ffbc
Merge remote-tracking branch 'remotes/origin/mlBuildUpdates' into mes…
Jun 21, 2025
68bd6a9
document the `MonoAssetManagerAndBuiltinResourceApplication.hpp` conu…
Jun 21, 2025
7b0e90d
Split `MonoAssetManagerAndBuiltinResourceApplication.hpp` in two, add…
Jun 21, 2025
380fefd
update submodule pointer
Jun 21, 2025
aae6cd9
@yasinvolved can start testing now
Jun 22, 2025
2922244
update examples_tests submodule
Jun 23, 2025
5ba8711
add some more invalid usage validation so we don't crash as often
Jun 23, 2025
3357c41
get 61 kinda working again
Jun 23, 2025
b6be78f
fix phmap_deserialization.h and phmap_serialization.h after API chang…
Jun 25, 2025
5ad312c
make patch default constructors `constexpr`
Jun 25, 2025
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
6 changes: 3 additions & 3 deletions include/nbl/asset/IAsset.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,14 @@ class IAsset : virtual public core::IReferenceCounted
ET_ANIMATION_LIBRARY = 1ull<<8, //!< asset::ICPUAnimationLibrary
ET_PIPELINE_LAYOUT = 1ull<<9, //!< asset::ICPUPipelineLayout
ET_SHADER = 1ull<<10, //!< asset::ICPUShader
ET_RENDERPASS_INDEPENDENT_PIPELINE = 1ull<<12, //!< asset::ICPURenderpassIndependentPipeline
ET_GEOMETRY = 1ull<<12, //!< anything inheriting from asset::IGeometry<ICPUBuffer>
ET_RENDERPASS = 1ull<<13, //!< asset::ICPURenderpass
ET_FRAMEBUFFER = 1ull<<14, //!< asset::ICPUFramebuffer
ET_GRAPHICS_PIPELINE = 1ull<<15, //!< asset::ICPUGraphicsPipeline
ET_BOTOM_LEVEL_ACCELERATION_STRUCTURE = 1ull<<16, //!< asset::ICPUBottomLevelAccelerationStructure
ET_TOP_LEVEL_ACCELERATION_STRUCTURE = 1ull<<17, //!< asset::ICPUTopLevelAccelerationStructure
ET_SUB_MESH = 1ull<<18, //!< DEPRECATED asset::ICPUMeshBuffer
ET_MESH = 1ull<<19, //!< DEPRECATED asset::ICPUMesh
ET_GEOMETRY_COLLECTION = 1ull<<18, //!< asset::ICPUGeometryCollection
ET_MORPH_TARGETS = 1ull<<19, //!< asset::ICPUMorphTargets
ET_COMPUTE_PIPELINE = 1ull<<20, //!< asset::ICPUComputePipeline
ET_PIPELINE_CACHE = 1ull<<21, //!< asset::ICPUPipelineCache
ET_SCENE = 1ull<<22, //!< reserved, to implement later
Expand Down
137 changes: 137 additions & 0 deletions include/nbl/asset/ICPUGeometryCollection.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
// 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_GEOMETRY_COLLECTION_H_INCLUDED_
#define _NBL_ASSET_I_CPU_GEOMETRY_COLLECTION_H_INCLUDED_


#include "nbl/asset/IAsset.h"
#include "nbl/asset/ICPUBuffer.h"
#include "nbl/asset/IGeometryCollection.h"


namespace nbl::asset
{
//
class NBL_API2 ICPUGeometryCollection : public IAsset, public IGeometryCollection<ICPUBuffer>
{
using base_t = IGeometryCollection<ICPUBuffer>;

public:
inline ICPUGeometryCollection() = default;

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

//
inline bool valid() const //override
{
for (const auto& ref : m_geometries)
if (!ref.geometry->valid())
return false;
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<ICPUGeometryCollection>();
retval->m_aabb = m_aabb;
retval->m_inverseBindPoseView = m_inverseBindPoseView.clone(nextDepth);
retval->m_jointAABBView = m_jointAABBView.clone(nextDepth);
retval->m_geometries.reserve(m_geometries.size());
for (const auto& in : m_geometries)
{
auto& out = retval->m_geometries.emplace_back();
out.transform = in.transform;
out.geometry = core::smart_refctd_ptr_static_cast<IGeometry<ICPUBuffer>>(in.geometry->clone(nextDepth));
out.jointRedirectView = in.jointRedirectView.clone(nextDepth);
}
return retval;
}

// TODO: remove after https://github.com/Devsh-Graphics-Programming/Nabla/pull/871 merge
inline size_t getDependantCount() const override
{
size_t count = 0;
visitDependents([&current](const IAsset* dep)->bool
{
count++;
return true;
}
);
return count;
}

//
inline bool setAABB(const SAABBStorage& aabb)
{
if (isMutable())
{
m_aabb = aabb;
return true;
}
return false;
}

//
inline core::vector<SGeometryReference>* getGeometries()
{
if (isMutable())
return &m_geometries;
return nullptr;
}

//
inline bool setSkin(SDataView&& inverseBindPoseView, SDataView&& jointAABBView)
{
if (isMutable())
return setSkin(std::move(inverseBindPoseView),std::move(jointAABBView));
return false;
}

//
template<typename Iterator>// requires std::is_same_v<decltype(*declval<Iterator>()),decltype(ICPUBottomLevelAccelerationStructure::Triangles&)>
inline Iterator exportForBLAS(Iterator out, uint32_t* pWrittenOrdinals=nullptr) const
{
return exportForBLAS(std;:forward<Iterator>(out),[](const hlsl::float32_t3x4& lhs, const hlsl::float32_t3x4& rhs)->void
{
lhs = rhs;
if (pWrittenOrdinals)
*(pWrittenOrdinals++) = (ptrdiff_t(&rhs)-offsetof(SGeometryReference,transform)-ptrdiff_t(m_geoemtries.data()))/sizeof(SGeometryReference);
}
);
}

protected:
//
inline void visitDependents(std::function<bool(const IAsset*)> visit) const //override
{
auto nonNullOnly = [&visit](const IAsset* dep)->bool
{
if (dep)
return visit(dep);
return true;
};
if (!nonNullOnly(m_inverseBindPoseView.src.buffer.get())) return;
if (!nonNullOnly(m_jointAABBView.src.buffer.get())) return;
for (const auto& ref : m_geometries)
if (!nonNullOnly(ref.geometry.get())) return;
}
// TODO: remove after https://github.com/Devsh-Graphics-Programming/Nabla/pull/871 merge
inline IAsset* getDependant_impl(const size_t ix) override
{
const IAsset* retval = nullptr;
size_t current = 0;
visitDependents([&current](const IAsset* dep)->bool
{
retval = dep;
return ix<current++;
}
);
return const_cast<IAsset*>(retval);
}
};

}
#endif
97 changes: 0 additions & 97 deletions include/nbl/asset/ICPUMesh.h

This file was deleted.

Loading
Loading