-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Nicolas Dacquay
committed
Mar 25, 2024
1 parent
004e992
commit c2ac476
Showing
15 changed files
with
431 additions
and
272 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
lib/app/include/app/component/render/proxy_color_layout.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#ifndef __VTX_APP_COMPONENT_RENDER_PROXY_COLOR_LAYOUT__ | ||
#define __VTX_APP_COMPONENT_RENDER_PROXY_COLOR_LAYOUT__ | ||
|
||
#include "app/application/renderer/proxy_wrapper.hpp" | ||
#include <core/chemdb/color.hpp> | ||
#include <renderer/facade.hpp> | ||
#include <util/types.hpp> | ||
#include <vector> | ||
|
||
namespace VTX::App::Component::Render | ||
{ | ||
class ProxyColorLayout | ||
{ | ||
public: | ||
ProxyColorLayout(); | ||
~ProxyColorLayout(); | ||
|
||
void setup( Renderer::Facade & p_renderer ); | ||
Application::Renderer::ProxyWrapper<VTX::Renderer::Proxy::ColorLayout> & getProxy() { return _proxyWrapper; }; | ||
|
||
private: | ||
void _addInRenderer( Renderer::Facade & p_renderer ); | ||
void _setupCallbacks(); | ||
|
||
Application::Renderer::ProxyWrapper<VTX::Renderer::Proxy::ColorLayout> _proxyWrapper; | ||
}; | ||
|
||
} // namespace VTX::App::Component::Render | ||
#endif |
29 changes: 29 additions & 0 deletions
29
lib/app/include/app/component/representation/color_layout.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#ifndef __VTX_APP_COMPONENT_REPRESENTATION_COLOR_LAYOUT__ | ||
#define __VTX_APP_COMPONENT_REPRESENTATION_COLOR_LAYOUT__ | ||
|
||
#include "app/core/ecs/base_component.hpp" | ||
#include <core/chemdb/color.hpp> | ||
#include <util/callback.hpp> | ||
|
||
namespace VTX::App::Component::Representation | ||
{ | ||
|
||
class ColorLayout : public Core::ECS::BaseComponent | ||
{ | ||
public: | ||
ColorLayout() = default; | ||
|
||
const VTX::Core::ChemDB::Color::ColorLayout & getLayout() const { return _layout; } | ||
|
||
void setColor( const size_t p_index, const Util::Color::Rgba & p_color ); | ||
void setColors( const std::vector<Util::Color::Rgba> & p_colors ); | ||
|
||
Util::Callback<> onColorChange; | ||
|
||
private: | ||
VTX::Core::ChemDB::Color::ColorLayout _layout; | ||
}; | ||
|
||
} // namespace VTX::App::Component::Representation | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#include "app/component/render/proxy_color_layout.hpp" | ||
#include "app/application/system/ecs_system.hpp" | ||
#include "app/component/representation/color_layout.hpp" | ||
|
||
namespace VTX::App::Component::Render | ||
{ | ||
ProxyColorLayout::ProxyColorLayout() {} | ||
ProxyColorLayout::~ProxyColorLayout() {} | ||
void ProxyColorLayout::setup( Renderer::Facade & p_renderer ) | ||
{ | ||
_addInRenderer( p_renderer ); | ||
_setupCallbacks(); | ||
} | ||
|
||
void ProxyColorLayout::_addInRenderer( Renderer::Facade & p_renderer ) | ||
{ | ||
Component::Representation::ColorLayout & colorLayoutComp | ||
= MAIN_REGISTRY().getComponent<Component::Representation::ColorLayout>( *this ); | ||
|
||
colorLayoutComp.setColors( VTX::Core::ChemDB::Color::COLOR_LAYOUT_JMOL.layout ); | ||
|
||
std::unique_ptr<VTX::Renderer::Proxy::ColorLayout> proxyPtr | ||
= std::make_unique<VTX::Renderer::Proxy::ColorLayout>( VTX::Renderer::Proxy::ColorLayout { | ||
&colorLayoutComp.getLayout().layout } ); | ||
|
||
_proxyWrapper.setProxy( proxyPtr ); | ||
} | ||
void ProxyColorLayout::_setupCallbacks() {} | ||
|
||
} // namespace VTX::App::Component::Render |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#include "app/component/representation/color_layout.hpp" | ||
|
||
namespace VTX::App::Component::Representation | ||
{ | ||
void ColorLayout::setColor( const size_t p_index, const Util::Color::Rgba & p_color ) | ||
{ | ||
assert( p_index < VTX::Core::ChemDB::Color::ColorLayout::LAYOUT_SIZE ); | ||
|
||
_layout.layout[ p_index ] = p_color; | ||
onColorChange(); | ||
} | ||
void ColorLayout::setColors( const std::vector<Util::Color::Rgba> & p_colors ) | ||
{ | ||
assert( p_colors.size() == VTX::Core::ChemDB::Color::ColorLayout::LAYOUT_SIZE ); | ||
|
||
_layout.layout = p_colors; | ||
onColorChange(); | ||
} | ||
|
||
} // namespace VTX::App::Component::Representation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.