| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- #include "CEffect.h"
- using namespace WallpaperEngine::Render::Objects;
- using namespace WallpaperEngine::Render;
- CEffect::CEffect (CImage* image, Core::Objects::CEffect* effect) :
- m_image (image),
- m_effect (effect)
- {
- this->generateFBOs ();
- this->generatePasses ();
- }
- CImage* CEffect::getImage () const
- {
- return this->m_image;
- }
- const std::vector<Effects::CMaterial*>& CEffect::getMaterials () const
- {
- return this->m_materials;
- }
- const CFBO* CEffect::findFBO (const std::string& name) const
- {
- auto cur = this->m_fbos.begin ();
- auto end = this->m_fbos.end ();
- for (; cur != end; cur ++)
- {
- if ((*cur)->getName () == name)
- {
- return *cur;
- }
- }
- return nullptr;
- }
- void CEffect::generatePasses ()
- {
- auto cur = this->m_effect->getMaterials ().begin ();
- auto end = this->m_effect->getMaterials ().end ();
- for (; cur != end; cur ++)
- this->m_materials.emplace_back (new Effects::CMaterial (this, *cur));
- }
- void CEffect::generateFBOs ()
- {
- auto cur = this->m_effect->getFbos ().begin ();
- auto end = this->m_effect->getFbos ().end ();
- for (; cur != end; cur ++)
- {
- this->m_fbos.push_back (
- new CFBO (
- (*cur)->getName (),
- ITexture::TextureFormat::ARGB8888, // TODO: CHANGE
- this->m_image->getTexture ()->getFlags (), // TODO: CHANGE
- (*cur)->getScale (),
- this->m_image->getSize ().x / (*cur)->getScale (),
- this->m_image->getSize ().y / (*cur)->getScale (),
- this->m_image->getSize ().x / (*cur)->getScale (),
- this->m_image->getSize ().y / (*cur)->getScale ()
- )
- );
- }
- }
- bool CEffect::isVisible () const
- {
- return this->m_effect->isVisible ();
- }
|