From b4a9a604ddd7ec0c1156cf60527a476a1d772c67 Mon Sep 17 00:00:00 2001 From: sguionni Date: Fri, 20 Dec 2024 04:06:55 +0100 Subject: [PATCH] Specializations for templated setValue() --- .../private/renderer/context/opengl_45.hpp | 3 +- .../include/public/renderer/facade.hpp | 11 ++++- lib/renderer/src/renderer/facade.cpp | 45 ++++++++++++++++--- 3 files changed, 52 insertions(+), 7 deletions(-) diff --git a/lib/renderer/include/private/renderer/context/opengl_45.hpp b/lib/renderer/include/private/renderer/context/opengl_45.hpp index 786b74d73..01676e551 100644 --- a/lib/renderer/include/private/renderer/context/opengl_45.hpp +++ b/lib/renderer/include/private/renderer/context/opengl_45.hpp @@ -67,9 +67,10 @@ namespace VTX::Renderer::Context * @tparam T the data type to store. * @param p_size the number of items to store. * @param p_key the buffer name. + * @param p_dummy a dummy value to infer the data type for concept deduction. */ template - inline void reserveData( const size_t p_size, const Key & p_key, const T = T() ) + inline void reserveData( const size_t p_size, const Key & p_key, const T p_dummy = T() ) { assert( _buffers.contains( p_key ) ); diff --git a/lib/renderer/include/public/renderer/facade.hpp b/lib/renderer/include/public/renderer/facade.hpp index c60125563..5e1f0c855 100644 --- a/lib/renderer/include/public/renderer/facade.hpp +++ b/lib/renderer/include/public/renderer/facade.hpp @@ -34,7 +34,7 @@ namespace VTX::Renderer void clean(); bool hasContext() const; void render( const float p_deltaTime, const float p_elapsedTime ); - void setValue( const std::any & p_value, const std::string & p_key, const size_t p_index = 0 ); + void setOutput( const uint p_output ); void addProxySystem( Proxy::System & p_proxy ); void removeProxySystem( Proxy::System & p_proxy ); @@ -85,6 +85,15 @@ namespace VTX::Renderer const InstructionsDurationRanges & getInstructionsDurationRanges() const; const std::vector & getAvailablePasses() const; + void setValue( const float p_value, const std::string & p_key, const size_t p_index = 0 ); + void setValue( const int p_value, const std::string & p_key, const size_t p_index = 0 ); + void setValue( const uint p_value, const std::string & p_key, const size_t p_index = 0 ); + void setValue( const bool p_value, const std::string & p_key, const size_t p_index = 0 ); + void setValue( const Vec2f & p_value, const std::string & p_key, const size_t p_index = 0 ); + void setValue( const Vec2i & p_value, const std::string & p_key, const size_t p_index = 0 ); + void setValue( const Vec3f & p_value, const std::string & p_key, const size_t p_index = 0 ); + void setValue( const Vec4f & p_value, const std::string & p_key, const size_t p_index = 0 ); + // TODO: accessors. bool * showAtoms; bool * showBonds; diff --git a/lib/renderer/src/renderer/facade.cpp b/lib/renderer/src/renderer/facade.cpp index 1413c683e..a91ee53fe 100644 --- a/lib/renderer/src/renderer/facade.cpp +++ b/lib/renderer/src/renderer/facade.cpp @@ -36,11 +36,6 @@ namespace VTX::Renderer _renderer->render( p_deltaTime, p_elapsedTime ); } - void Facade::setValue( const std::any & p_value, const std::string & p_key, const size_t p_index ) - { - _renderer->setValue( p_value, p_key, p_index ); - } - void Facade::setOutput( const uint p_output ) { _renderer->setOutput( p_output ); } void Facade::addProxySystem( Proxy::System & p_proxy ) { _renderer->addProxySystem( p_proxy ); } @@ -154,4 +149,44 @@ namespace VTX::Renderer Util::Callback<> & Facade::onReady() { return _renderer->onReady; } + void Facade::setValue( const float p_value, const std::string & p_key, const size_t p_index ) + { + _renderer->setValue( p_value, p_key, p_index ); + } + + void Facade::setValue( const uint p_value, const std::string & p_key, const size_t p_index ) + { + _renderer->setValue( p_value, p_key, p_index ); + } + + void Facade::setValue( const int p_value, const std::string & p_key, const size_t p_index ) + { + _renderer->setValue( p_value, p_key, p_index ); + } + + void Facade::setValue( const bool p_value, const std::string & p_key, const size_t p_index ) + { + _renderer->setValue( p_value, p_key, p_index ); + } + + void Facade::setValue( const Vec2f & p_value, const std::string & p_key, const size_t p_index ) + { + _renderer->setValue( p_value, p_key, p_index ); + } + + void Facade::setValue( const Vec2i & p_value, const std::string & p_key, const size_t p_index ) + { + _renderer->setValue( p_value, p_key, p_index ); + } + + void Facade::setValue( const Vec3f & p_value, const std::string & p_key, const size_t p_index ) + { + _renderer->setValue( p_value, p_key, p_index ); + } + + void Facade::setValue( const Vec4f & p_value, const std::string & p_key, const size_t p_index ) + { + _renderer->setValue( p_value, p_key, p_index ); + } + } // namespace VTX::Renderer