Skip to content

Commit 0e1d4c2

Browse files
author
devsh
committed
try to pick up where I left off
1 parent 51dc3aa commit 0e1d4c2

17 files changed

+164
-120
lines changed

include/nbl/ext/MitsubaLoader/CElementBSDF.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,10 @@ class CElementBSDF : public IElement
289289
CElementTexture::SpectrumOrTexture diffuseReflectance = 0.5f;
290290
};
291291

292+
//
293+
static AddPropertyMap<CElementBSDF> compAddPropertyMap();
294+
295+
//
292296
inline CElementBSDF(const char* id) : IElement(id), type(Type::INVALID)
293297
{
294298
}
@@ -369,14 +373,15 @@ class CElementBSDF : public IElement
369373
return *this;
370374
}
371375

372-
bool addProperty(SNamedPropertyElement&& _property, system::logger_opt_ptr logger) override;
373376
bool onEndTag(CMitsubaMetadata* globalMetadata, system::logger_opt_ptr logger) override;
374-
IElement::Type getType() const override { return IElement::Type::BSDF; }
377+
378+
constexpr static inline auto ElementType = IElement::Type::BSDF;
379+
inline IElement::Type getType() const override { return ElementType; }
375380
std::string getLogName() const override { return "bsdf"; }
376381

377382
bool processChildData(IElement* _child, const std::string& name) override;
378383

379-
bool isMeta() const
384+
inline bool isMeta() const
380385
{
381386
switch (type)
382387
{

include/nbl/ext/MitsubaLoader/CElementEmissionProfile.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ namespace nbl::ext::MitsubaLoader
1414

1515
struct CElementEmissionProfile final : public IElement
1616
{
17+
static AddPropertyMap<CElementEmissionProfile> compAddPropertyMap();
18+
1719
inline CElementEmissionProfile(const char* id) : IElement(id), normalization(EN_NONE), flatten(0.0) /*no blending by default*/ {}
1820
inline CElementEmissionProfile() : IElement(""), normalization(EN_NONE) {}
1921
inline CElementEmissionProfile(const CElementEmissionProfile& other) : IElement("")
@@ -24,6 +26,7 @@ struct CElementEmissionProfile final : public IElement
2426
{
2527
operator=(std::move(other));
2628
}
29+
inline ~CElementEmissionProfile() {}
2730

2831
inline CElementEmissionProfile& operator=(const CElementEmissionProfile& other)
2932
{
@@ -39,14 +42,12 @@ struct CElementEmissionProfile final : public IElement
3942
return *this;
4043
}
4144

42-
inline ~CElementEmissionProfile()
43-
{
44-
}
4545

46-
bool addProperty(SNamedPropertyElement&& _property, system::logger_opt_ptr logger) override;
4746
inline bool onEndTag(CMitsubaMetadata* globalMetadata, system::logger_opt_ptr logger) override {return true;}
4847
bool processChildData(IElement* _child, const std::string& name) override;
49-
inline IElement::Type getType() const override { return IElement::Type::EMISSION_PROFILE; }
48+
49+
constexpr static inline auto ElementType = IElement::Type::EMISSION_PROFILE;
50+
inline IElement::Type getType() const override { return ElementType; }
5051
inline std::string getLogName() const override { return "emissionprofile "; }
5152

5253
enum E_NORMALIZE : uint8_t

include/nbl/ext/MitsubaLoader/CElementEmitter.h

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,16 +97,19 @@ class CElementEmitter : public IElement
9797
core::vectorSIMDf radiance = core::vectorSIMDf(1.f); // Watts Meter^-2 Steradian^-1
9898
};
9999

100+
//
101+
static AddPropertyMap<CElementEmitter> compAddPropertyMap();
100102

101-
CElementEmitter(const char* id) : IElement(id), type(Type::INVALID), /*toWorldType(IElement::Type::TRANSFORM),*/ transform()
103+
//
104+
inline CElementEmitter(const char* id) : IElement(id), type(Type::INVALID), /*toWorldType(IElement::Type::TRANSFORM),*/ transform()
102105
{
103106
}
104-
CElementEmitter() : CElementEmitter("") {}
105-
CElementEmitter(const CElementEmitter& other) : IElement(""), transform()
107+
inline CElementEmitter() : CElementEmitter("") {}
108+
inline CElementEmitter(const CElementEmitter& other) : IElement(""), transform()
106109
{
107110
operator=(other);
108111
}
109-
CElementEmitter(CElementEmitter&& other) : IElement(""), transform()
112+
inline CElementEmitter(CElementEmitter&& other) : IElement(""), transform()
110113
{
111114
operator=(std::move(other));
112115
}
@@ -200,9 +203,10 @@ class CElementEmitter : public IElement
200203
return *this;
201204
}
202205

203-
bool addProperty(SNamedPropertyElement&& _property, system::logger_opt_ptr logger) override;
204206
bool onEndTag(CMitsubaMetadata* globalMetadata, system::logger_opt_ptr logger) override;
205-
IElement::Type getType() const override { return IElement::Type::EMITTER; }
207+
208+
constexpr static inline auto ElementType = IElement::Type::EMITTER;
209+
inline IElement::Type getType() const override { return ElementType; }
206210
std::string getLogName() const override { return "emitter"; }
207211

208212
bool processChildData(IElement* _child, const std::string& name) override

include/nbl/ext/MitsubaLoader/CElementFilm.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ class CElementFilm final : public IElement
9999
{
100100
hdrfilm = HDR();
101101
}
102-
virtual ~CElementFilm()
102+
virtual inline ~CElementFilm()
103103
{
104104
}
105105

@@ -124,9 +124,10 @@ class CElementFilm final : public IElement
124124
}
125125
}
126126

127-
bool addProperty(SNamedPropertyElement&& _property, system::logger_opt_ptr logger) override;
128127
bool onEndTag(CMitsubaMetadata* globalMetadata, system::logger_opt_ptr logger) override;
129-
inline IElement::Type getType() const override { return IElement::Type::FILM; }
128+
129+
constexpr static inline auto ElementType = IElement::Type::FILM;
130+
inline IElement::Type getType() const override { return ElementType; }
130131
inline std::string getLogName() const override { return "film"; }
131132

132133
inline bool processChildData(IElement* _child, const std::string& name) override

include/nbl/ext/MitsubaLoader/CElementIntegrator.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,10 @@ class CElementIntegrator final : public IElement
215215
{
216216
};
217217

218+
//
219+
static AddPropertyMap<CElementIntegrator> compAddPropertyMap();
220+
221+
//
218222
inline CElementIntegrator(const char* id) : IElement(id), type(Type::INVALID)
219223
{
220224
}
@@ -303,9 +307,10 @@ class CElementIntegrator final : public IElement
303307
return *this;
304308
}
305309

306-
bool addProperty(SNamedPropertyElement&& _property, system::logger_opt_ptr logger) override;
307310
bool onEndTag(CMitsubaMetadata* globalMetadata, system::logger_opt_ptr logger) override;
308-
inline IElement::Type getType() const override { return IElement::Type::INTEGRATOR; }
311+
312+
constexpr static inline auto ElementType = IElement::Type::INTEGRATOR;
313+
inline IElement::Type getType() const override { return ElementType; }
309314
inline std::string getLogName() const override { return "integrator"; }
310315

311316
inline bool processChildData(IElement* _child, const std::string& name) override

include/nbl/ext/MitsubaLoader/CElementRFilter.h

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,6 @@ class CElementRFilter final : public IElement
2626
CATMULLROM,
2727
LANCZOS
2828
};
29-
static inline core::unordered_map<core::string,Type,core::CaseInsensitiveHash,core::CaseInsensitiveEquals> compStringToTypeMap()
30-
{
31-
return {
32-
std::make_pair("box", Type::BOX),
33-
std::make_pair("tent", Type::TENT),
34-
std::make_pair("gaussian", Type::GAUSSIAN),
35-
std::make_pair("mitchell", Type::MITCHELL),
36-
std::make_pair("catmullrom", Type::CATMULLROM),
37-
std::make_pair("lanczos", Type::LANCZOS)
38-
};
39-
}
4029

4130
struct Gaussian
4231
{
@@ -52,6 +41,24 @@ class CElementRFilter final : public IElement
5241
int32_t lobes = 3;
5342
};
5443

44+
using variant_list_t = core::type_list<
45+
Gaussian,
46+
MitchellNetravali,
47+
LanczosSinc
48+
>;
49+
static inline core::unordered_map<core::string,Type,core::CaseInsensitiveHash,core::CaseInsensitiveEquals> compStringToTypeMap()
50+
{
51+
return {
52+
std::make_pair("box", Type::BOX),
53+
std::make_pair("tent", Type::TENT),
54+
std::make_pair("gaussian", Type::GAUSSIAN),
55+
std::make_pair("mitchell", Type::MITCHELL),
56+
std::make_pair("catmullrom", Type::CATMULLROM),
57+
std::make_pair("lanczos", Type::LANCZOS)
58+
};
59+
}
60+
static AddPropertyMap<CElementRFilter> compAddPropertyMap();
61+
5562
inline CElementRFilter(const char* id) : IElement(id), type(GAUSSIAN)
5663
{
5764
gaussian = Gaussian();
@@ -93,9 +100,10 @@ class CElementRFilter final : public IElement
93100
);
94101
}
95102

96-
bool addProperty(SNamedPropertyElement&& _property, system::logger_opt_ptr logger) override;
97103
bool onEndTag(CMitsubaMetadata* globalMetadata, system::logger_opt_ptr logger) override;
98-
inline IElement::Type getType() const override { return IElement::Type::RFILTER; }
104+
105+
constexpr static inline auto ElementType = IElement::Type::RFILTER;
106+
inline IElement::Type getType() const override { return ElementType; }
99107
inline std::string getLogName() const override { return "rfilter"; }
100108

101109
// make these public

include/nbl/ext/MitsubaLoader/CElementSampler.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ class CElementSampler : public IElement
3636
{"sobol", Type::SOBOL}
3737
};
3838
}
39+
static AddPropertyMap<CElementSampler> compAddPropertyMap();
3940

4041
inline CElementSampler(const char* id) : IElement(id), type(INVALID), sampleCount(4) {}
4142
inline ~CElementSampler() {}
@@ -63,9 +64,10 @@ class CElementSampler : public IElement
6364
}
6465
}
6566

66-
bool addProperty(SNamedPropertyElement&& _property, system::logger_opt_ptr logger) override;
6767
bool onEndTag(CMitsubaMetadata* globalMetadata, system::logger_opt_ptr logger) override;
68-
inline IElement::Type getType() const override { return IElement::Type::SAMPLER; }
68+
69+
constexpr static inline auto ElementType = IElement::Type::SAMPLER;
70+
inline IElement::Type getType() const override { return ElementType; }
6971
inline std::string getLogName() const override { return "sampler"; }
7072

7173
// make these public

include/nbl/ext/MitsubaLoader/CElementSensor.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,6 @@ class CElementSensor final : public IElement
201201
return *this;
202202
}
203203

204-
bool addProperty(SNamedPropertyElement&& _property, system::logger_opt_ptr logger) override;
205204
bool onEndTag(CMitsubaMetadata* globalMetadata, system::logger_opt_ptr logger) override;
206205

207206
constexpr static inline auto ElementType = IElement::Type::SENSOR;

include/nbl/ext/MitsubaLoader/CElementShape.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ class CElementShape final : public IElement
9999
CElementTexture* texture;
100100
};*/
101101

102+
static AddPropertyMap<CElementShape> compAddPropertyMap();
103+
102104
inline CElementShape(const char* id) : IElement(id), type(Type::INVALID), /*toWorldType(IElement::Type::TRANSFORM),*/ transform(), bsdf(nullptr), emitter(nullptr)
103105
{
104106
}
@@ -215,9 +217,10 @@ class CElementShape final : public IElement
215217
return *this;
216218
}
217219

218-
bool addProperty(SNamedPropertyElement&& _property, system::logger_opt_ptr logger) override;
219220
bool onEndTag(CMitsubaMetadata* globalMetadata, system::logger_opt_ptr logger) override;
220-
inline IElement::Type getType() const override { return IElement::Type::SHAPE; }
221+
222+
constexpr static inline auto ElementType = IElement::Type::SHAPE;
223+
inline IElement::Type getType() const override { return ElementType; }
221224
inline std::string getLogName() const override { return "shape"; }
222225

223226

include/nbl/ext/MitsubaLoader/CElementTexture.h

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -155,18 +155,22 @@ class CElementTexture : public IElement
155155
float scale;
156156
};
157157

158-
CElementTexture(const char* id) : IElement(id), type(Type::INVALID)
158+
//
159+
static AddPropertyMap<CElementTexture> compAddPropertyMap();
160+
161+
//
162+
inline CElementTexture(const char* id) : IElement(id), type(Type::INVALID)
159163
{
160164
}
161-
CElementTexture(const CElementTexture& other) : CElementTexture("")
165+
inline CElementTexture(const CElementTexture& other) : CElementTexture("")
162166
{
163167
operator=(other);
164168
}
165-
CElementTexture(CElementTexture&& other) : CElementTexture("")
169+
inline CElementTexture(CElementTexture&& other) : CElementTexture("")
166170
{
167171
operator=(std::move(other));
168172
}
169-
virtual ~CElementTexture()
173+
inline virtual ~CElementTexture()
170174
{
171175
}
172176

@@ -235,10 +239,10 @@ class CElementTexture : public IElement
235239
return *this;
236240
}
237241

238-
bool addProperty(SNamedPropertyElement&& _property, system::logger_opt_ptr logger) override;
239242
bool onEndTag(CMitsubaMetadata* globalMetadata, system::logger_opt_ptr logger) override;
240243

241-
inline IElement::Type getType() const override { return IElement::Type::TEXTURE; }
244+
constexpr static inline auto ElementType = IElement::Type::TEXTURE;
245+
inline IElement::Type getType() const override { return ElementType; }
242246
inline std::string getLogName() const override { return "texture"; }
243247

244248
bool processChildData(IElement* _child, const std::string& name) override;

0 commit comments

Comments
 (0)