Skip to content

Commit

Permalink
Specializations for templated setValue()
Browse files Browse the repository at this point in the history
  • Loading branch information
sguionni committed Dec 20, 2024
1 parent a50c998 commit b4a9a60
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 7 deletions.
3 changes: 2 additions & 1 deletion lib/renderer/include/private/renderer/context/opengl_45.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<typename T>
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 ) );

Expand Down
11 changes: 10 additions & 1 deletion lib/renderer/include/public/renderer/facade.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down Expand Up @@ -85,6 +85,15 @@ namespace VTX::Renderer
const InstructionsDurationRanges & getInstructionsDurationRanges() const;
const std::vector<Pass *> & 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;
Expand Down
45 changes: 40 additions & 5 deletions lib/renderer/src/renderer/facade.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 ); }
Expand Down Expand Up @@ -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

0 comments on commit b4a9a60

Please sign in to comment.