From f5c631cecb6602ae31287b0eadd699002175cc74 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sat, 6 Feb 2021 23:36:55 +0200 Subject: [PATCH] Rename Material::LoaderBase to PropertyLoader --- source/basicmaterial.cpp | 4 ++-- source/basicmaterial.h | 2 +- source/material.h | 40 ++++++++++++++++++++-------------------- source/pbrmaterial.cpp | 4 ++-- source/pbrmaterial.h | 2 +- 5 files changed, 26 insertions(+), 26 deletions(-) diff --git a/source/basicmaterial.cpp b/source/basicmaterial.cpp index 9c7714dc..708c8a5b 100644 --- a/source/basicmaterial.cpp +++ b/source/basicmaterial.cpp @@ -126,13 +126,13 @@ void BasicMaterial::set_receive_shadows(bool s) DataFile::Loader::ActionMap BasicMaterial::Loader::shared_actions; BasicMaterial::Loader::Loader(BasicMaterial &m): - DerivedObjectLoader >(m) + DerivedObjectLoader >(m) { set_actions(shared_actions); } BasicMaterial::Loader::Loader(BasicMaterial &m, Collection &c): - DerivedObjectLoader >(m, c) + DerivedObjectLoader >(m, c) { set_actions(shared_actions); } diff --git a/source/basicmaterial.h b/source/basicmaterial.h index 5d8d96ae..73bb38e9 100644 --- a/source/basicmaterial.h +++ b/source/basicmaterial.h @@ -9,7 +9,7 @@ namespace GL { class BasicMaterial: public Material { public: - class Loader: public DataFile::DerivedObjectLoader > + class Loader: public DataFile::DerivedObjectLoader > { private: static ActionMap shared_actions; diff --git a/source/material.h b/source/material.h index 5515f29e..3b9321fe 100644 --- a/source/material.h +++ b/source/material.h @@ -26,11 +26,11 @@ protected: }; template - class LoaderBase: public DataFile::CollectionObjectLoader + class PropertyLoader: public DataFile::CollectionObjectLoader { protected: - LoaderBase(C &m): CollectionObjectLoader(m, 0) { } - LoaderBase(C &m, Collection &c): CollectionObjectLoader(m, &c) { } + PropertyLoader(C &m): CollectionObjectLoader(m, 0) { } + PropertyLoader(C &m, Collection &c): CollectionObjectLoader(m, c) { } void add_property(const std::string &, void (C::*)(float), void (C::*)(const Texture *)); void add_property(const std::string &, void (C::*)(const Color &), void (C::*)(const Texture *), bool); @@ -110,63 +110,63 @@ void Material::register_type(const std::string &kw) template -void Material::LoaderBase::add_property(const std::string &kw, void (C::*set_value)(float), void (C::*set_texture)(const Texture *)) +void Material::PropertyLoader::add_property(const std::string &kw, void (C::*set_value)(float), void (C::*set_texture)(const Texture *)) { - add(kw, &LoaderBase::property_value_scalar, set_value); - add(kw+"_map", &LoaderBase::property_texture, set_texture); + add(kw, &PropertyLoader::property_value_scalar, set_value); + add(kw+"_map", &PropertyLoader::property_texture, set_texture); } template -void Material::LoaderBase::add_property(const std::string &kw, void (C::*set_value)(const Color &), void (C::*set_texture)(const Texture *), bool allow_alpha) +void Material::PropertyLoader::add_property(const std::string &kw, void (C::*set_value)(const Color &), void (C::*set_texture)(const Texture *), bool allow_alpha) { - add(kw, &LoaderBase::property_value_rgb, set_value); - add(kw+"_srgb", &LoaderBase::property_value_srgb, set_value); + add(kw, &PropertyLoader::property_value_rgb, set_value); + add(kw+"_srgb", &PropertyLoader::property_value_srgb, set_value); if(allow_alpha) { - add(kw, &LoaderBase::property_value_rgba, set_value); - add(kw+"_srgb", &LoaderBase::property_value_srgb_alpha, set_value); + add(kw, &PropertyLoader::property_value_rgba, set_value); + add(kw+"_srgb", &PropertyLoader::property_value_srgb_alpha, set_value); } - add(kw+"_map", &LoaderBase::property_texture, set_texture); + add(kw+"_map", &PropertyLoader::property_texture, set_texture); } template -void Material::LoaderBase::add_property(const std::string &kw, void (C::*set_texture)(const Texture *)) +void Material::PropertyLoader::add_property(const std::string &kw, void (C::*set_texture)(const Texture *)) { - add(kw+"_map", &LoaderBase::property_texture, set_texture); + add(kw+"_map", &PropertyLoader::property_texture, set_texture); } template -void Material::LoaderBase::property_value_scalar(void (C::*set_value)(float), float value) +void Material::PropertyLoader::property_value_scalar(void (C::*set_value)(float), float value) { (static_cast(obj).*set_value)(value); } template -void Material::LoaderBase::property_value_rgb(void (C::*set_value)(const Color &), float r, float g, float b) +void Material::PropertyLoader::property_value_rgb(void (C::*set_value)(const Color &), float r, float g, float b) { (static_cast(obj).*set_value)(Color(r, g, b)); } template -void Material::LoaderBase::property_value_rgba(void (C::*set_value)(const Color &), float r, float g, float b, float a) +void Material::PropertyLoader::property_value_rgba(void (C::*set_value)(const Color &), float r, float g, float b, float a) { (static_cast(obj).*set_value)(Color(r, g, b, a)); } template -void Material::LoaderBase::property_value_srgb(void (C::*set_value)(const Color &), float r, float g, float b) +void Material::PropertyLoader::property_value_srgb(void (C::*set_value)(const Color &), float r, float g, float b) { (static_cast(obj).*set_value)(Color(r, g, b).to_linear()); } template -void Material::LoaderBase::property_value_srgb_alpha(void (C::*set_value)(const Color &), float r, float g, float b, float a) +void Material::PropertyLoader::property_value_srgb_alpha(void (C::*set_value)(const Color &), float r, float g, float b, float a) { (static_cast(obj).*set_value)(Color(r, g, b, a).to_linear()); } template -void Material::LoaderBase::property_texture(void (C::*set_texture)(const Texture *), const std::string &name) +void Material::PropertyLoader::property_texture(void (C::*set_texture)(const Texture *), const std::string &name) { /* The static_cast around get_collection is needed because otherwise Android SDK's g++ 4.9 fails to parse get as a template function call */ diff --git a/source/pbrmaterial.cpp b/source/pbrmaterial.cpp index 8406d4e2..7eaa56f1 100644 --- a/source/pbrmaterial.cpp +++ b/source/pbrmaterial.cpp @@ -111,13 +111,13 @@ void PbrMaterial::set_receive_shadows(bool s) DataFile::Loader::ActionMap PbrMaterial::Loader::shared_actions; PbrMaterial::Loader::Loader(PbrMaterial &m): - DerivedObjectLoader >(m) + DerivedObjectLoader >(m) { set_actions(shared_actions); } PbrMaterial::Loader::Loader(PbrMaterial &m, Collection &c): - DerivedObjectLoader >(m, c) + DerivedObjectLoader >(m, c) { set_actions(shared_actions); } diff --git a/source/pbrmaterial.h b/source/pbrmaterial.h index 0002888b..2a0eef35 100644 --- a/source/pbrmaterial.h +++ b/source/pbrmaterial.h @@ -9,7 +9,7 @@ namespace GL { class PbrMaterial: public Material { public: - class Loader: public DataFile::DerivedObjectLoader > + class Loader: public DataFile::DerivedObjectLoader > { private: static ActionMap shared_actions; -- 2.45.2