Skip to content

Commit f850ce7

Browse files
author
devsh
committed
enable a few elements and get stuff parsing (with unhandled element errors)
1 parent 36c6aa6 commit f850ce7

21 files changed

+186
-193
lines changed

include/nbl/core/hash/blake.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,13 @@
44
#ifndef _NBL_CORE_HASH_BLAKE3_H_INCLUDED_
55
#define _NBL_CORE_HASH_BLAKE3_H_INCLUDED_
66

7+
8+
#include "nbl/config/BuildConfigOptions.h"
79
#include "blake3.h"
810

911
#include <span>
1012

13+
1114
namespace nbl::core
1215
{
1316
struct blake3_hash_t final

include/nbl/ext/MitsubaLoader/CElementBSDF.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ class CElementBSDF : public IElement
369369
return *this;
370370
}
371371

372-
bool addProperty(SNamedPropertyElement&& _property) override;
372+
bool addProperty(SNamedPropertyElement&& _property, system::logger_opt_ptr logger) override;
373373
bool onEndTag(asset::IAssetLoader::IAssetLoaderOverride* _override, CMitsubaMetadata* globalMetadata) override;
374374
IElement::Type getType() const override { return IElement::Type::BSDF; }
375375
std::string getLogName() const override { return "bsdf"; }

include/nbl/ext/MitsubaLoader/CElementEmissionProfile.h

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@
1212
namespace nbl::ext::MitsubaLoader
1313
{
1414

15-
struct CElementEmissionProfile : public IElement {
16-
17-
CElementEmissionProfile(const char* id) : IElement(id), normalization(EN_NONE), flatten(0.0) /*no blending by default*/ {}
18-
CElementEmissionProfile() : IElement(""), normalization(EN_NONE) {}
19-
CElementEmissionProfile(const CElementEmissionProfile& other) : IElement("")
15+
struct CElementEmissionProfile final : public IElement
16+
{
17+
inline CElementEmissionProfile(const char* id) : IElement(id), normalization(EN_NONE), flatten(0.0) /*no blending by default*/ {}
18+
inline CElementEmissionProfile() : IElement(""), normalization(EN_NONE) {}
19+
inline CElementEmissionProfile(const CElementEmissionProfile& other) : IElement("")
2020
{
2121
operator=(other);
2222
}
23-
CElementEmissionProfile(CElementEmissionProfile&& other) : IElement("")
23+
inline CElementEmissionProfile(CElementEmissionProfile&& other) : IElement("")
2424
{
2525
operator=(std::move(other));
2626
}
@@ -39,30 +39,30 @@ struct CElementEmissionProfile : public IElement {
3939
return *this;
4040
}
4141

42-
virtual ~CElementEmissionProfile()
42+
inline ~CElementEmissionProfile()
4343
{
4444
}
4545

46-
bool addProperty(SNamedPropertyElement&& _property) override;
47-
bool onEndTag(asset::IAssetLoader::IAssetLoaderOverride* _override, CMitsubaMetadata* globalMetadata) override {
46+
bool addProperty(SNamedPropertyElement&& _property, system::logger_opt_ptr logger) override;
47+
inline bool onEndTag(asset::IAssetLoader::IAssetLoaderOverride* _override, CMitsubaMetadata* globalMetadata) override {
4848
return true;
4949
}
5050
bool processChildData(IElement* _child, const std::string& name) override;
51-
IElement::Type getType() const override { return IElement::Type::EMISSION_PROFILE; }
52-
std::string getLogName() const override { return "emissionprofile "; }
51+
inline IElement::Type getType() const override { return IElement::Type::EMISSION_PROFILE; }
52+
inline std::string getLogName() const override { return "emissionprofile "; }
5353

54-
enum E_NORMALIZE
54+
enum E_NORMALIZE : uint8_t
5555
{
5656
EN_UNIT_MAX, //! normalize the intensity by dividing out the maximum intensity
57-
EN_UNIT_AVERAGE_OVER_IMPLIED_DOMAIN, //! normlize by energy - integrate the profile over the hemisphere as well as the solid angles where the profile has emission above 0.
57+
EN_UNIT_AVERAGE_OVER_IMPLIED_DOMAIN, //! normalize by energy - integrate the profile over the hemisphere as well as the solid angles where the profile has emission above 0.
5858
EN_UNIT_AVERAGE_OVER_FULL_DOMAIN, //! similar to UNIT_AVERAGE_OVER_IMPLIED_DOMAIN but in this case we presume the soild angle of the domain is (CIESProfile::vAngles.front()-CIESProfile::vAngles.back())*4.f
5959
EN_NONE //! no normalization
6060

6161
};
6262

6363
std::string filename;
6464
E_NORMALIZE normalization;
65-
float flatten;
65+
float flatten; // TODO: why is this named this way?
6666
};
6767

6868
}

include/nbl/ext/MitsubaLoader/CElementEmitter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ class CElementEmitter : public IElement
200200
return *this;
201201
}
202202

203-
bool addProperty(SNamedPropertyElement&& _property) override;
203+
bool addProperty(SNamedPropertyElement&& _property, system::logger_opt_ptr logger) override;
204204
bool onEndTag(asset::IAssetLoader::IAssetLoaderOverride* _override, CMitsubaMetadata* globalMetadata) override;
205205
IElement::Type getType() const override { return IElement::Type::EMITTER; }
206206
std::string getLogName() const override { return "emitter"; }

include/nbl/ext/MitsubaLoader/CElementFilm.h

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,24 @@
55
#define _NBL_EXT_MISTUBA_LOADER_C_ELEMENT_FILM_H_INCLUDED_
66

77

8-
#include "nbl/macros.h"
98
#include "nbl/ext/MitsubaLoader/CElementRFilter.h"
109

1110

1211
namespace nbl::ext::MitsubaLoader
1312
{
1413

15-
class CElementFilm : public IElement
14+
class CElementFilm final : public IElement
1615
{
1716
public:
18-
enum Type
17+
enum Type : uint8_t
1918
{
2019
INVALID,
2120
HDR_FILM,
2221
TILED_HDR,
2322
LDR_FILM,
2423
MFILM
2524
};
26-
enum PixelFormat
25+
enum PixelFormat : uint8_t
2726
{
2827
LUMINANCE,
2928
LUMINANCE_ALPHA,
@@ -34,7 +33,7 @@ class CElementFilm : public IElement
3433
SPECTRUM,
3534
SPECTRUM_ALPHA
3635
};
37-
enum FileFormat
36+
enum FileFormat : uint8_t
3837
{
3938
OPENEXR,
4039
RGBE,
@@ -45,7 +44,7 @@ class CElementFilm : public IElement
4544
MATHEMATICA,
4645
NUMPY
4746
};
48-
enum ComponentFormat
47+
enum ComponentFormat : uint8_t
4948
{
5049
FLOAT16,
5150
FLOAT32,
@@ -79,11 +78,11 @@ class CElementFilm : public IElement
7978
variable[4] = 0;
8079
}
8180
int32_t digits;
82-
_NBL_STATIC_INLINE_CONSTEXPR size_t MaxVarNameLen = 63; // matlab
81+
constexpr static inline size_t MaxVarNameLen = 63; // matlab
8382
char variable[MaxVarNameLen+1];
8483
};
8584

86-
CElementFilm(const char* id) : IElement(id), type(Type::HDR_FILM),
85+
inline CElementFilm(const char* id) : IElement(id), type(Type::HDR_FILM),
8786
width(768), height(576), cropOffsetX(0), cropOffsetY(0), cropWidth(INT_MAX), cropHeight(INT_MAX),
8887
fileFormat(OPENEXR), pixelFormat(RGB), componentFormat(FLOAT16),
8988
banner(true), highQualityEdges(false), rfilter("")
@@ -94,10 +93,10 @@ class CElementFilm : public IElement
9493
{
9594
}
9695

97-
bool addProperty(SNamedPropertyElement&& _property) override;
96+
bool addProperty(SNamedPropertyElement&& _property, system::logger_opt_ptr logger) override;
9897
bool onEndTag(asset::IAssetLoader::IAssetLoaderOverride* _override, CMitsubaMetadata* globalMetadata) override;
99-
IElement::Type getType() const override { return IElement::Type::FILM; }
100-
std::string getLogName() const override { return "film"; }
98+
inline IElement::Type getType() const override { return IElement::Type::FILM; }
99+
inline std::string getLogName() const override { return "film"; }
101100

102101
inline bool processChildData(IElement* _child, const std::string& name) override
103102
{
@@ -129,15 +128,15 @@ class CElementFilm : public IElement
129128
M mfilm;
130129
};
131130

132-
_NBL_STATIC_INLINE_CONSTEXPR size_t MaxPathLen = 256;
131+
constexpr static inline size_t MaxPathLen = 256;
133132
char outputFilePath[MaxPathLen+1] = {0};
134133
char denoiserBloomFilePath[MaxPathLen+1] = {0};
135134
int32_t cascadeCount = 1;
136135
float cascadeLuminanceBase = core::nan<float>();
137136
float cascadeLuminanceStart = core::nan<float>();
138137
float denoiserBloomScale = 0.0f;
139138
float denoiserBloomIntensity = 0.0f;
140-
_NBL_STATIC_INLINE_CONSTEXPR size_t MaxTonemapperArgsLen = 128;
139+
constexpr static inline size_t MaxTonemapperArgsLen = 128;
141140
char denoiserTonemapperArgs[MaxTonemapperArgsLen+1] = {0};
142141
float envmapRegularizationFactor = 0.5f; // 1.0f means based envmap luminance, 0.0f means uniform
143142
};

include/nbl/ext/MitsubaLoader/CElementIntegrator.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace nbl::ext::MitsubaLoader
1212
{
1313

1414

15-
class CElementIntegrator : public IElement
15+
class CElementIntegrator final : public IElement
1616
{
1717
public:
1818
enum Type
@@ -191,10 +191,10 @@ class CElementIntegrator : public IElement
191191
{
192192
};
193193

194-
CElementIntegrator(const char* id) : IElement(id), type(Type::INVALID)
194+
inline CElementIntegrator(const char* id) : IElement(id), type(Type::INVALID)
195195
{
196196
}
197-
virtual ~CElementIntegrator()
197+
inline ~CElementIntegrator()
198198
{
199199
}
200200

@@ -264,12 +264,12 @@ class CElementIntegrator : public IElement
264264
return *this;
265265
}
266266

267-
bool addProperty(SNamedPropertyElement&& _property) override;
267+
bool addProperty(SNamedPropertyElement&& _property, system::logger_opt_ptr logger) override;
268268
bool onEndTag(asset::IAssetLoader::IAssetLoaderOverride* _override, CMitsubaMetadata* globalMetadata) override;
269-
IElement::Type getType() const override { return IElement::Type::INTEGRATOR; }
270-
std::string getLogName() const override { return "integrator"; }
269+
inline IElement::Type getType() const override { return IElement::Type::INTEGRATOR; }
270+
inline std::string getLogName() const override { return "integrator"; }
271271

272-
bool processChildData(IElement* _child, const std::string& name) override
272+
inline bool processChildData(IElement* _child, const std::string& name) override
273273
{
274274
if (!_child)
275275
return true;

include/nbl/ext/MitsubaLoader/CElementRFilter.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ namespace nbl::ext::MitsubaLoader
1313
{
1414

1515

16-
class CElementRFilter : public IElement
16+
class CElementRFilter final : public IElement
1717
{
1818
public:
19-
enum Type
19+
enum Type : uint8_t
2020
{
2121
INVALID,
2222
BOX,
@@ -40,16 +40,16 @@ class CElementRFilter : public IElement
4040
int32_t lobes = 3;
4141
};
4242

43-
CElementRFilter(const char* id) : IElement(id), type(GAUSSIAN)
43+
inline CElementRFilter(const char* id) : IElement(id), type(GAUSSIAN)
4444
{
4545
gaussian = Gaussian();
4646
}
47-
virtual ~CElementRFilter() {}
47+
inline ~CElementRFilter() {}
4848

49-
bool addProperty(SNamedPropertyElement&& _property) override;
49+
bool addProperty(SNamedPropertyElement&& _property, system::logger_opt_ptr logger) override;
5050
bool onEndTag(asset::IAssetLoader::IAssetLoaderOverride* _override, CMitsubaMetadata* globalMetadata) override;
51-
IElement::Type getType() const override { return IElement::Type::RFILTER; }
52-
std::string getLogName() const override { return "rfilter"; }
51+
inline IElement::Type getType() const override { return IElement::Type::RFILTER; }
52+
inline std::string getLogName() const override { return "rfilter"; }
5353

5454
// make these public
5555
Type type;

include/nbl/ext/MitsubaLoader/CElementSampler.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class CGlobalMitsubaMetadata;
1515
class CElementSampler : public IElement
1616
{
1717
public:
18-
enum Type
18+
enum Type : uint8_t
1919
{
2020
INVALID,
2121
INDEPENDENT,
@@ -26,13 +26,13 @@ class CElementSampler : public IElement
2626
SOBOL
2727
};
2828

29-
CElementSampler(const char* id) : IElement(id), type(INVALID), sampleCount(4) {}
30-
virtual ~CElementSampler() {}
29+
inline CElementSampler(const char* id) : IElement(id), type(INVALID), sampleCount(4) {}
30+
inline ~CElementSampler() {}
3131

32-
bool addProperty(SNamedPropertyElement&& _property) override;
32+
bool addProperty(SNamedPropertyElement&& _property, system::logger_opt_ptr logger) override;
3333
bool onEndTag(asset::IAssetLoader::IAssetLoaderOverride* _override, CMitsubaMetadata* globalMetadata) override;
34-
IElement::Type getType() const override { return IElement::Type::SAMPLER; }
35-
std::string getLogName() const override { return "sampler"; }
34+
inline IElement::Type getType() const override { return IElement::Type::SAMPLER; }
35+
inline std::string getLogName() const override { return "sampler"; }
3636

3737
// make these public
3838
Type type;

include/nbl/ext/MitsubaLoader/CElementSensor.h

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414
namespace nbl::ext::MitsubaLoader
1515
{
1616

17-
18-
class CElementSensor : public IElement
17+
class CElementSensor final : public IElement
1918
{
2019
public:
2120
enum Type
@@ -35,8 +34,8 @@ class CElementSensor : public IElement
3534

3635
struct ShutterSensor
3736
{
38-
core::vectorSIMDf up = core::vectorSIMDf(0,1,0);
39-
core::vectorSIMDf clipPlanes[MaxClipPlanes] = {};
37+
hlsl::float32_t3 up = hlsl::float32_t3(0,1,0);
38+
hlsl::float32_t3 clipPlanes[MaxClipPlanes] = {};
4039
float moveSpeed = core::nan<float>();
4140
float zoomSpeed = core::nan<float>();
4241
float rotateSpeed = core::nan<float>();
@@ -101,14 +100,14 @@ class CElementSensor : public IElement
101100
kc;
102101
};*/
103102

104-
CElementSensor(const char* id) : IElement(id), type(Type::INVALID), /*toWorldType(IElement::Type::TRANSFORM),*/ transform(), film(""), sampler("")
103+
inline CElementSensor(const char* id) : IElement(id), type(Type::INVALID), /*toWorldType(IElement::Type::TRANSFORM),*/ transform(), film(""), sampler("")
105104
{
106105
}
107-
CElementSensor(const CElementSensor& other) : IElement(""), transform(), film(""), sampler("")
106+
inline CElementSensor(const CElementSensor& other) : IElement(""), transform(), film(""), sampler("")
108107
{
109108
operator=(other);
110109
}
111-
virtual ~CElementSensor()
110+
inline ~CElementSensor()
112111
{
113112
}
114113

@@ -151,12 +150,12 @@ class CElementSensor : public IElement
151150
return *this;
152151
}
153152

154-
bool addProperty(SNamedPropertyElement&& _property) override;
153+
bool addProperty(SNamedPropertyElement&& _property, system::logger_opt_ptr logger) override;
155154
bool onEndTag(asset::IAssetLoader::IAssetLoaderOverride* _override, CMitsubaMetadata* globalMetadata) override;
156-
IElement::Type getType() const override { return IElement::Type::SENSOR; }
157-
std::string getLogName() const override { return "sensor"; }
155+
inline IElement::Type getType() const override { return IElement::Type::SENSOR; }
156+
inline std::string getLogName() const override { return "sensor"; }
158157

159-
bool processChildData(IElement* _child, const std::string& name) override
158+
inline bool processChildData(IElement* _child, const std::string& name) override
160159
{
161160
if (!_child)
162161
return true;

0 commit comments

Comments
 (0)