glpp::core::object::shader_factory_t class

helper class for preprocessing shader code

shader_factory_t is a helper class for the generation of GLSL shader code. It's man use is text substitution for values that shall be compiled into the shader code. It also helps you with the generation of shader code to with texture atlases, since there is no standard GLSL feature for it.

Constructors, destructors, conversion operators

shader_factory_t(std::ifstream& file) explicit
constructor
shader_factory_t(std::ifstream&& file) explicit
constructor
shader_factory_t(const std::stringstream& sstream) explicit
constructor
shader_factory_t(std::string code_template) explicit
constructor
shader_factory_t(const shader_factory_t& cpy) defaulted
copy constructor
shader_factory_t(shader_factory_t&& mov) defaulted noexcept
move constructor

Public functions

auto code() const -> std::string
get processed code back
auto operator=(const shader_factory_t& cpy) -> shader_factory_t& defaulted
copy assignment operator
auto operator=(shader_factory_t&& mov) -> shader_factory_t& defaulted noexcept
move assignment operator
template<class T>
auto set(std::string_view key, const T& value) -> shader_factory_t&
overwrite substring in code
auto set(std::string_view key, const char* value) -> shader_factory_t&
overwrite substring in code

Function documentation

glpp::core::object::shader_factory_t::shader_factory_t(std::ifstream& file) explicit

constructor

Construct shader_factory_t from file with a istream handle.

glpp::core::object::shader_factory_t::shader_factory_t(std::ifstream&& file) explicit

constructor

Construct shader_factory_t from file with a istream handle.

glpp::core::object::shader_factory_t::shader_factory_t(const std::stringstream& sstream) explicit

constructor

Construct shader_factory_t from file with a stringstream.

glpp::core::object::shader_factory_t::shader_factory_t(std::string code_template) explicit

constructor

Construct shader_factory_t from file with a string.

glpp::core::object::shader_factory_t::shader_factory_t(const shader_factory_t& cpy) defaulted

copy constructor

shader_factory_t is copy constructible.

glpp::core::object::shader_factory_t::shader_factory_t(shader_factory_t&& mov) defaulted noexcept

move constructor

shader_factory_t is move constructible.

std::string glpp::core::object::shader_factory_t::code() const

get processed code back

Returns generated code

Returns the resulting code after all replacements happend.

shader_factory_t& glpp::core::object::shader_factory_t::operator=(const shader_factory_t& cpy) defaulted

copy assignment operator

shader_factory_t is copy assignable.

shader_factory_t& glpp::core::object::shader_factory_t::operator=(shader_factory_t&& mov) defaulted noexcept

move assignment operator

shader_factory_t is move assignable.

template<class T>
shader_factory_t& glpp::core::object::shader_factory_t::set(std::string_view key, const T& value)

overwrite substring in code

Parameters
key [in] key that shall be replaced
value [in] value that is transformed into a string and then replaces the key in the code
Returns reference to the shader_factory_t

This method is used to overwrite a substring of the code with a value.

shader_factory_t& glpp::core::object::shader_factory_t::set(std::string_view key, const char* value)

overwrite substring in code

Parameters
key [in] key that shall be replaced
value [in] value that replaces the key in the code
Returns reference to the shader_factory_t

This method is used to overwrite a substring of the code with a string.