Skip to content

Commit c077d6e

Browse files
author
devsh
committed
get one step closer to compiling
1 parent b5830e7 commit c077d6e

26 files changed

+176
-229
lines changed

include/nbl/asset/IAssetManager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ class NBL_API2 IAssetManager : public core::IReferenceCounted
113113
friend class IAssetLoader;
114114
friend class IAssetLoader::IAssetLoaderOverride; // for access to non-const findAssets
115115

116-
core::smart_refctd_ptr<IGeometryCreator> m_geometryCreator;
116+
core::smart_refctd_ptr<CGeometryCreator> m_geometryCreator;
117117
core::smart_refctd_ptr<CPolygonGeometryManipulator> m_meshManipulator;
118118
core::smart_refctd_ptr<CCompilerSet> m_compilerSet;
119119
// called as a part of constructor only

include/nbl/asset/ICPUGeometryCollection.h

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class NBL_API2 ICPUGeometryCollection : public IAsset, public IGeometryCollectio
5454
inline size_t getDependantCount() const override
5555
{
5656
size_t count = 0;
57-
visitDependents([&current](const IAsset* dep)->bool
57+
visitDependents([&count](const IAsset* dep)->bool
5858
{
5959
count++;
6060
return true;
@@ -64,7 +64,7 @@ class NBL_API2 ICPUGeometryCollection : public IAsset, public IGeometryCollectio
6464
}
6565

6666
//
67-
inline bool setAABB(const base_t::SAABBStorage& aabb)
67+
inline bool setAABB(const IGeometryBase::SAABBStorage& aabb)
6868
{
6969
if (isMutable())
7070
{
@@ -98,7 +98,7 @@ class NBL_API2 ICPUGeometryCollection : public IAsset, public IGeometryCollectio
9898
{
9999
lhs = rhs;
100100
if (pWrittenOrdinals)
101-
*(pWrittenOrdinals++) = (ptrdiff_t(&rhs)-offsetof(SGeometryReference,transform)-ptrdiff_t(m_geoemtries.data()))/sizeof(SGeometryReference);
101+
*(pWrittenOrdinals++) = (ptrdiff_t(&rhs)-offsetof(SGeometryReference,transform)-ptrdiff_t(base_t::m_geometries.data()))/sizeof(SGeometryReference);
102102
}
103103
);
104104
}
@@ -116,14 +116,17 @@ class NBL_API2 ICPUGeometryCollection : public IAsset, public IGeometryCollectio
116116
if (!nonNullOnly(m_inverseBindPoseView.src.buffer.get())) return;
117117
if (!nonNullOnly(m_jointAABBView.src.buffer.get())) return;
118118
for (const auto& ref : m_geometries)
119-
if (!nonNullOnly(ref.geometry.get())) return;
119+
{
120+
const auto* geometry = static_cast<const IAsset*>(ref.geometry.get());
121+
if (!nonNullOnly(geometry)) return;
122+
}
120123
}
121124
// TODO: remove after https://github.com/Devsh-Graphics-Programming/Nabla/pull/871 merge
122125
inline IAsset* getDependant_impl(const size_t ix) override
123126
{
124127
const IAsset* retval = nullptr;
125128
size_t current = 0;
126-
visitDependents([&current](const IAsset* dep)->bool
129+
visitDependents([&](const IAsset* dep)->bool
127130
{
128131
retval = dep;
129132
return ix<current++;

include/nbl/asset/ICPUMorphTargets.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace nbl::asset
1414
//
1515
class NBL_API2 ICPUMorphTargets : public IAsset, public IMorphTargets<ICPUGeometryCollection>
1616
{
17-
using base_t = IMorphTargets<ICPUBuffer>;
17+
using base_t = IMorphTargets<ICPUGeometryCollection>;
1818

1919
public:
2020
inline ICPUMorphTargets() = default;
@@ -38,9 +38,9 @@ class NBL_API2 ICPUMorphTargets : public IAsset, public IMorphTargets<ICPUGeomet
3838
retval->m_targets.reserve(m_targets.size());
3939
for (const auto& in : m_targets)
4040
{
41-
auto& out = retval->m_targets.push_back();
41+
auto& out = retval->m_targets.emplace_back();
4242
out.geoCollection = core::smart_refctd_ptr_static_cast<ICPUGeometryCollection>(in.geoCollection->clone(nextDepth));
43-
out.jointRedirectView = in.jointRedirectView.clone(nextDepth));
43+
out.jointRedirectView = in.jointRedirectView.clone(nextDepth);
4444
}
4545
return retval;
4646
}
@@ -49,7 +49,7 @@ class NBL_API2 ICPUMorphTargets : public IAsset, public IMorphTargets<ICPUGeomet
4949
inline size_t getDependantCount() const override
5050
{
5151
size_t count = 0;
52-
visitDependents([&current](const IAsset* dep)->bool
52+
visitDependents([&count](const IAsset* dep)->bool
5353
{
5454
count++;
5555
return true;
@@ -59,7 +59,7 @@ class NBL_API2 ICPUMorphTargets : public IAsset, public IMorphTargets<ICPUGeomet
5959
}
6060

6161
//
62-
inline core::vector<SGeometryReference>* getTargets()
62+
inline core::vector<base_t::STarget>* getTargets()
6363
{
6464
if (isMutable())
6565
return &m_targets;
@@ -84,7 +84,7 @@ class NBL_API2 ICPUMorphTargets : public IAsset, public IMorphTargets<ICPUGeomet
8484
{
8585
const IAsset* retval = nullptr;
8686
size_t current = 0;
87-
visitDependents([&current](const IAsset* dep)->bool
87+
visitDependents([&](const IAsset* dep)->bool
8888
{
8989
retval = dep;
9090
return ix<current++;

include/nbl/asset/ICPUPolygonGeometry.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
namespace nbl::asset
1414
{
1515
//
16-
class NBL_API2 ICPUPolygonGeometry final : public IAsset, public IPolygonGeometry<ICPUBuffer>
16+
class NBL_API2 ICPUPolygonGeometry final : public IPolygonGeometry<ICPUBuffer>
1717
{
1818
using base_t = IPolygonGeometry<ICPUBuffer>;
1919

include/nbl/asset/IGeometry.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,15 @@ class IGeometryBase : public virtual core::IReferenceCounted
194194
virtual inline ~IGeometryBase() = default;
195195
};
196196

197+
// a thing to expose `clone()` conditionally via inheritance and `conditional_t`
198+
namespace impl
199+
{
200+
class NBL_FORCE_EBO NBL_NO_VTABLE INotCloneable {};
201+
}
202+
197203
// A geometry should map 1:1 to a BLAS geometry, Meshlet or a Drawcall in API terms
198204
template<class BufferType>
199-
class NBL_API2 IGeometry : public IGeometryBase
205+
class NBL_API2 IGeometry : public std::conditional_t<std::is_same_v<BufferType,ICPUBuffer>,IAsset,impl::INotCloneable>, public IGeometryBase
200206
{
201207
public:
202208
//

include/nbl/asset/IMorphTargets.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class NBL_API2 IMorphTargets : public virtual core::IReferenceCounted
2828

2929
inline uint32_t getTargetCount() const
3030
{
31-
return static_cast<uint32_t>(m_morphGeometries.size());
31+
return static_cast<uint32_t>(m_targets.size());
3232
}
3333

3434
template<typename Scalar, uint16_t Degree> requires std::is_floating_point_v<Scalar>
@@ -39,10 +39,10 @@ class NBL_API2 IMorphTargets : public virtual core::IReferenceCounted
3939
};
4040

4141
template<typename Scalar> requires std::is_floating_point_v<Scalar>
42-
inline SInterpolants<Scalar> getLinearBlend(const Scalar blend) const
42+
inline SInterpolants<Scalar,2> getLinearBlend(const Scalar blend) const
4343
{
44-
SInterpolants<Scalar> retval;
45-
if (!m_morphGeometries.empty())
44+
SInterpolants<Scalar,2> retval;
45+
if (!m_targets.empty())
4646
{
4747
const Scalar maxMorph = getTargetCount();
4848
retval.indices[0] = index_t(hlsl::clamp<Scalar>(blend,Scalar(0),maxMorph));

include/nbl/asset/IPolygonGeometry.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,8 @@ class NBL_API2 IPolygonGeometry : public IIndexableGeometry<BufferType>, public
249249
{
250250
if (view)
251251
{
252-
if (!view.isFormattedScalarInteger() || view.format == EF_R64_UINT || view.format == EF_R64_SINT)
252+
const auto format = view.composed.format;
253+
if (!view.composed.isFormattedScalarInteger() || format == EF_R64_UINT || format == EF_R64_SINT)
253254
return false;
254255
if (view.getElementCount()>(1u<<31))
255256
return false;

include/nbl/asset/asset.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@
6868
#include "nbl/asset/interchange/IImageWriter.h"
6969
#include "nbl/asset/metadata/COpenEXRMetadata.h"
7070
#include "nbl/asset/metadata/CMTLMetadata.h"
71-
#include "nbl/asset/metadata/COBJMetadata.h"
7271
#include "nbl/asset/metadata/CPLYMetadata.h"
7372
#include "nbl/asset/metadata/CSTLMetadata.h"
7473

include/nbl/asset/interchange/IAssetWriter.h

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
1-
// Copyright (C) 2018-2020 - DevSH Graphics Programming Sp. z O.O.
1+
// Copyright (C) 2018-2025 - 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_I_ASSET_WRITER_H_INCLUDED_
5+
#define _NBL_ASSET_I_ASSET_WRITER_H_INCLUDED_
46

5-
#ifndef __NBL_ASSET_I_ASSET_WRITER_H_INCLUDED__
6-
#define __NBL_ASSET_I_ASSET_WRITER_H_INCLUDED__
77

88
#include "nbl/system/IFile.h"
99
#include "nbl/system/ILogger.h"
1010

1111
#include "nbl/asset/IAsset.h"
1212

13-
namespace nbl
14-
{
15-
namespace asset
13+
14+
namespace nbl::asset
1615
{
1716

1817
//! Writing flags
@@ -192,6 +191,5 @@ class IAssetWriter : public virtual core::IReferenceCounted
192191
static void getDefaultOverride(IAssetWriterOverride*& _out) { _out = &s_defaultOverride; }
193192
};
194193

195-
}} //nbl::asset
196-
194+
} //nbl::asset
197195
#endif
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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_GEOMETRY_WRITER_H_INCLUDED_
5+
#define _NBL_ASSET_I_GEOMETRY_WRITER_H_INCLUDED_
6+
7+
8+
#include "nbl/core/declarations.h"
9+
10+
#include "nbl/asset/ICPUPolygonGeometry.h"
11+
#include "nbl/asset/interchange/IAssetWriter.h"
12+
13+
14+
namespace nbl::asset
15+
{
16+
17+
class IGeometryWriter : public IAssetWriter
18+
{
19+
public:
20+
virtual inline uint64_t getSupportedAssetTypesBitfield() const override {return IAsset::ET_GEOMETRY;}
21+
22+
protected:
23+
IGeometryWriter() {}
24+
virtual ~IGeometryWriter() = 0;
25+
26+
private:
27+
};
28+
29+
}
30+
31+
#endif

0 commit comments

Comments
 (0)