mirror of
https://github.com/Almamu/linux-wallpaperengine.git
synced 2025-09-14 13:56:48 +08:00
~ some cleanup of todos and dead code
Signed-off-by: Alexis Maiquez <almamu@almamu.com>
This commit is contained in:
parent
03c4660f5c
commit
2432ec9a36
@ -5,7 +5,6 @@ using namespace WallpaperEngine::Assets;
|
||||
CDirectory::CDirectory (std::string basepath) :
|
||||
m_basepath (std::move (basepath))
|
||||
{
|
||||
// TODO: ENSURE THE BASEPATH ENDS WITH A LEADING /
|
||||
}
|
||||
|
||||
CDirectory::~CDirectory ()
|
||||
|
@ -6,23 +6,6 @@ CEffect::CEffect (CImage* image, Core::Objects::CEffect* effect) :
|
||||
m_image (image),
|
||||
m_effect (effect)
|
||||
{
|
||||
// TODO: REWRITE THIS
|
||||
/*
|
||||
irr::core::dimension2du size = irr::core::dimension2du (
|
||||
this->m_image->getImage ()->getSize ().X,
|
||||
this->m_image->getImage ()->getSize ().Y
|
||||
);
|
||||
|
||||
this->m_outputTexture = this->m_context->getDevice ()->getVideoDriver ()->addRenderTargetTexture (
|
||||
size,
|
||||
(
|
||||
"_rt_WALLENGINELINUX_OUTPUT_" +
|
||||
std::to_string (image->getImage ()->getId ()) + "_" +
|
||||
std::to_string (this->m_image->getEffects ().size ()) +
|
||||
"_effect_output"
|
||||
).c_str ()
|
||||
);
|
||||
*/
|
||||
this->generateFBOs ();
|
||||
this->generatePasses ();
|
||||
}
|
||||
|
@ -163,99 +163,8 @@ void CImage::render ()
|
||||
|
||||
// render the main material
|
||||
this->m_material->render (this->getScene()->getWallpaperFramebuffer(), inputTexture);
|
||||
/*
|
||||
glBindFramebuffer (GL_FRAMEBUFFER, 0);
|
||||
// set the viewport, for now use the scene width/height but we might want to use image's size TODO: INVESTIGATE THAT
|
||||
glViewport (0, 0, projection->getWidth (), projection->getHeight ());
|
||||
// bind the texture to the first slot
|
||||
glActiveTexture (GL_TEXTURE0);
|
||||
glBindTexture (GL_TEXTURE_2D, inputTexture);
|
||||
// now render the last pass (to screen)
|
||||
glBindBuffer (GL_ARRAY_BUFFER, *this->m_material->getImage ()->getVertexBuffer ());
|
||||
glDrawArrays (GL_TRIANGLES, 0, 6);*/
|
||||
}
|
||||
|
||||
/*
|
||||
void CImage::generateMaterial (irr::video::ITexture* resultTexture)
|
||||
{
|
||||
this->m_irrlichtMaterial.setTexture (0, resultTexture);
|
||||
this->m_irrlichtMaterial.MaterialType = irr::video::EMT_TRANSPARENT_ALPHA_CHANNEL;
|
||||
this->m_irrlichtMaterial.setFlag (irr::video::EMF_LIGHTING, false);
|
||||
this->m_irrlichtMaterial.setFlag (irr::video::EMF_BLEND_OPERATION, true);
|
||||
this->m_irrlichtMaterial.Wireframe = false;
|
||||
this->m_irrlichtMaterial.Lighting = false;
|
||||
|
||||
/// TODO: XXXHACK: This material is used to flip textures upside down based on the amount of passes
|
||||
/// TODO: XXXHACK: This fixes an issue with opengl render that I had no better idea of how to solve
|
||||
/// TODO: XXXHACK: For the love of god, If you have a better fix, please LET ME KNOW!
|
||||
std::string vertex =
|
||||
"#define mul(x, y) (y * x)\n"
|
||||
"uniform mat4 g_ModelViewProjectionMatrix;\n"
|
||||
"// Pass to fragment shader with the same name\n"
|
||||
"varying vec2 v_texcoord;\n"
|
||||
"void main(void)\n"
|
||||
"{\n"
|
||||
" gl_Position = mul(vec4(gl_Vertex.xyz, 1.0), g_ModelViewProjectionMatrix);\n"
|
||||
" \n"
|
||||
" // The origin of the texture coordinates locates at bottom-left \n"
|
||||
" // corner rather than top-left corner as defined on screen quad.\n"
|
||||
" // Instead of using texture coordinates passed in by OpenGL, we\n"
|
||||
" // calculate TexCoords based on vertex position as follows.\n"
|
||||
" //\n"
|
||||
" // Vertex[0] (-1, -1) to (0, 0)\n"
|
||||
" // Vertex[1] (-1, 1) to (0, 1)\n"
|
||||
" // Vertex[2] ( 1, 1) to (1, 1)\n"
|
||||
" // Vertex[3] ( 1, -1) to (1, 0)\n"
|
||||
" // \n"
|
||||
" // Texture coordinate system in OpenGL operates differently from \n"
|
||||
" // DirectX 3D. It is not necessary to offset TexCoords to texel \n"
|
||||
" // center by adding 1.0 / TextureSize / 2.0\n"
|
||||
" \n"
|
||||
" v_texcoord = vec2(gl_MultiTexCoord0.x, gl_MultiTexCoord0.y);"
|
||||
"}";
|
||||
|
||||
std::string fragment =
|
||||
"// Texture sampler\n"
|
||||
"uniform sampler2D TextureSampler;\n"
|
||||
"\n"
|
||||
"// TexCoords from vertex shader\n"
|
||||
"varying vec2 v_texcoord;\n"
|
||||
"\n"
|
||||
"void main (void)\n"
|
||||
"{\n"
|
||||
" gl_FragColor = texture2D(TextureSampler, v_texcoord);\n"
|
||||
"}";
|
||||
|
||||
this->m_irrlichtMaterialInvert.setTexture (0, resultTexture);
|
||||
this->m_irrlichtMaterialInvert.setFlag (irr::video::EMF_LIGHTING, false);
|
||||
this->m_irrlichtMaterialInvert.setFlag (irr::video::EMF_BLEND_OPERATION, true);
|
||||
this->m_irrlichtMaterialInvert.Wireframe = false;
|
||||
this->m_irrlichtMaterialInvert.Lighting = false;
|
||||
this->m_irrlichtMaterialInvert.MaterialType = (irr::video::E_MATERIAL_TYPE)
|
||||
this->getScene ()->getContext ()->getDevice ()->getVideoDriver ()->getGPUProgrammingServices ()->addHighLevelShaderMaterial (
|
||||
vertex.c_str (), "main", irr::video::EVST_VS_2_0,
|
||||
fragment.c_str (), "main", irr::video::EPST_PS_2_0,
|
||||
this, irr::video::EMT_TRANSPARENT_ALPHA_CHANNEL, 0, irr::video::EGSL_DEFAULT
|
||||
);
|
||||
}
|
||||
|
||||
void CImage::OnSetConstants (irr::video::IMaterialRendererServices *services, int32_t userData)
|
||||
{
|
||||
irr::s32 g_Texture0 = 0;
|
||||
|
||||
irr::video::IVideoDriver* driver = services->getVideoDriver ();
|
||||
|
||||
irr::core::matrix4 worldViewProj;
|
||||
worldViewProj = driver->getTransform (irr::video::ETS_PROJECTION);
|
||||
worldViewProj *= driver->getTransform (irr::video::ETS_VIEW);
|
||||
worldViewProj *= driver->getTransform (irr::video::ETS_WORLD);
|
||||
|
||||
|
||||
services->setPixelShaderConstant ("TextureSampler", &g_Texture0, 1);
|
||||
services->setVertexShaderConstant ("g_ModelViewProjectionMatrix", worldViewProj.pointer(), 16);
|
||||
}
|
||||
*/
|
||||
|
||||
const CTexture* CImage::getTexture () const
|
||||
{
|
||||
return this->m_texture;
|
||||
|
@ -8,17 +8,6 @@ CMaterial::CMaterial (const Render::Objects::CImage* image, const Core::Objects:
|
||||
m_image (image),
|
||||
m_material (material)
|
||||
{
|
||||
// TODO: REWRITE THIS
|
||||
/*this->m_outputTexture = this->m_context->getDevice ()->getVideoDriver ()->addRenderTargetTexture (
|
||||
this->m_inputTexture->getSize (),
|
||||
(
|
||||
"_rt_WALLENGINELINUX_OUTPUT_" +
|
||||
std::to_string (this->m_image->getImage ()->getId ()) + "_" +
|
||||
std::to_string (this->m_image->getEffects ().size ()) +
|
||||
"_material_output"
|
||||
).c_str ()
|
||||
);*/
|
||||
|
||||
this->generatePasses ();
|
||||
}
|
||||
|
||||
|
@ -495,7 +495,6 @@ void CPass::setupShaderVariables ()
|
||||
CShaderVariable* var = vertexVar == nullptr ? pixelVar : vertexVar;
|
||||
|
||||
// ensure the shader's and the constant are of the same type
|
||||
// TODO: CHECK THIS, THERE'S SOME BACKGROUNDS WHERE THIS HAPPENS :/
|
||||
if ((*cur).second->getType () != var->getType ())
|
||||
{
|
||||
// there's situations where this type mismatch is actually expected
|
||||
|
@ -596,7 +596,6 @@ namespace WallpaperEngine::Render::Shaders
|
||||
|
||||
if (combo != data.end ())
|
||||
{
|
||||
// TODO: CHECK WHAT TEXTURE THIS REFERS TO
|
||||
// add the new combo to the list
|
||||
this->m_combos.insert (std::make_pair<std::string, int> (*combo, 1));
|
||||
// also ensure that the textureName is loaded and we know about it
|
||||
|
Loading…
Reference in New Issue
Block a user