mirror of
https://github.com/Almamu/linux-wallpaperengine.git
synced 2025-07-16 22:32:25 +08:00
+ Added PKGV0015 support
+ Added basic support for mouse position on shaders (still needs to be adjusted for backgrounds that are too big for the screen) (this makes XRAY effects work) Signed-off-by: Alexis Maiquez <almamu@almamu.com>
This commit is contained in:
parent
d0572b257f
commit
b55f2e8bf4
@ -54,6 +54,9 @@ add_executable(
|
|||||||
src/WallpaperEngine/Core/Core.h
|
src/WallpaperEngine/Core/Core.h
|
||||||
src/WallpaperEngine/Core/Core.cpp
|
src/WallpaperEngine/Core/Core.cpp
|
||||||
|
|
||||||
|
src/WallpaperEngine/Input/CMouseInput.h
|
||||||
|
src/WallpaperEngine/Input/CMouseInput.cpp
|
||||||
|
|
||||||
src/WallpaperEngine/Render/Shaders/Variables/CShaderVariable.h
|
src/WallpaperEngine/Render/Shaders/Variables/CShaderVariable.h
|
||||||
src/WallpaperEngine/Render/Shaders/Variables/CShaderVariable.cpp
|
src/WallpaperEngine/Render/Shaders/Variables/CShaderVariable.cpp
|
||||||
src/WallpaperEngine/Render/Shaders/Variables/CShaderVariableFloat.h
|
src/WallpaperEngine/Render/Shaders/Variables/CShaderVariableFloat.h
|
||||||
|
14
main.cpp
14
main.cpp
@ -180,9 +180,6 @@ int main (int argc, char* argv[])
|
|||||||
auto project = WallpaperEngine::Core::CProject::fromFile ("project.json", containers);
|
auto project = WallpaperEngine::Core::CProject::fromFile ("project.json", containers);
|
||||||
WallpaperEngine::Render::CWallpaper* wallpaper;
|
WallpaperEngine::Render::CWallpaper* wallpaper;
|
||||||
|
|
||||||
// initialize custom context class
|
|
||||||
WallpaperEngine::Render::CContext* context = new WallpaperEngine::Render::CContext (screens);
|
|
||||||
|
|
||||||
// auto projection = project->getWallpaper ()->as <WallpaperEngine::Core::CScene> ()->getOrthogonalProjection ();
|
// auto projection = project->getWallpaper ()->as <WallpaperEngine::Core::CScene> ()->getOrthogonalProjection ();
|
||||||
// create the window!
|
// create the window!
|
||||||
// TODO: DO WE NEED TO PASS MONITOR HERE OR ANYTHING?
|
// TODO: DO WE NEED TO PASS MONITOR HERE OR ANYTHING?
|
||||||
@ -198,6 +195,11 @@ int main (int argc, char* argv[])
|
|||||||
|
|
||||||
glfwMakeContextCurrent (window);
|
glfwMakeContextCurrent (window);
|
||||||
|
|
||||||
|
// initialize inputs
|
||||||
|
CMouseInput* mouseInput = new CMouseInput (window);
|
||||||
|
// initialize custom context class
|
||||||
|
WallpaperEngine::Render::CContext* context = new WallpaperEngine::Render::CContext (screens, mouseInput);
|
||||||
|
|
||||||
// TODO: FIGURE THESE OUT BASED ON THE SCREEN
|
// TODO: FIGURE THESE OUT BASED ON THE SCREEN
|
||||||
int windowWidth = 1920;
|
int windowWidth = 1920;
|
||||||
int windowHeight = 1080;
|
int windowHeight = 1080;
|
||||||
@ -218,7 +220,7 @@ int main (int argc, char* argv[])
|
|||||||
if (project->getType () == "scene")
|
if (project->getType () == "scene")
|
||||||
{
|
{
|
||||||
WallpaperEngine::Core::CScene* scene = project->getWallpaper ()->as <WallpaperEngine::Core::CScene> ();
|
WallpaperEngine::Core::CScene* scene = project->getWallpaper ()->as <WallpaperEngine::Core::CScene> ();
|
||||||
wallpaper = new WallpaperEngine::Render::CScene (scene, containers);
|
wallpaper = new WallpaperEngine::Render::CScene (scene, containers, context);
|
||||||
}
|
}
|
||||||
else if (project->getType () == "video")
|
else if (project->getType () == "video")
|
||||||
{
|
{
|
||||||
@ -227,7 +229,7 @@ int main (int argc, char* argv[])
|
|||||||
chdir (path.c_str ());
|
chdir (path.c_str ());
|
||||||
|
|
||||||
WallpaperEngine::Core::CVideo* video = project->getWallpaper ()->as <WallpaperEngine::Core::CVideo> ();
|
WallpaperEngine::Core::CVideo* video = project->getWallpaper ()->as <WallpaperEngine::Core::CVideo> ();
|
||||||
wallpaper = new WallpaperEngine::Render::CVideo (video, containers);
|
wallpaper = new WallpaperEngine::Render::CVideo (video, containers, context);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -277,6 +279,8 @@ int main (int argc, char* argv[])
|
|||||||
g_Time = (float) glfwGetTime ();
|
g_Time = (float) glfwGetTime ();
|
||||||
// get the start time of the frame
|
// get the start time of the frame
|
||||||
startTime = clock ();
|
startTime = clock ();
|
||||||
|
// update our inputs first
|
||||||
|
mouseInput->update ();
|
||||||
// render the scene
|
// render the scene
|
||||||
context->render ();
|
context->render ();
|
||||||
// do buffer swapping
|
// do buffer swapping
|
||||||
|
@ -111,7 +111,8 @@ void CPackage::validateHeader (FILE* fp)
|
|||||||
strcmp ("PKGV0005", pointer) != 0 &&
|
strcmp ("PKGV0005", pointer) != 0 &&
|
||||||
strcmp ("PKGV0006", pointer) != 0 &&
|
strcmp ("PKGV0006", pointer) != 0 &&
|
||||||
strcmp ("PKGV0013", pointer) != 0 &&
|
strcmp ("PKGV0013", pointer) != 0 &&
|
||||||
strcmp ("PKGV0014", pointer) != 0)
|
strcmp ("PKGV0014", pointer) != 0 &&
|
||||||
|
strcmp ("PKGV0015", pointer) != 0)
|
||||||
{
|
{
|
||||||
delete[] pointer;
|
delete[] pointer;
|
||||||
throw std::runtime_error ("Unsupported package version");
|
throw std::runtime_error ("Unsupported package version");
|
||||||
|
14
src/WallpaperEngine/Input/CMouseInput.cpp
Normal file
14
src/WallpaperEngine/Input/CMouseInput.cpp
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#include <glm/common.hpp>
|
||||||
|
#include "CMouseInput.h"
|
||||||
|
|
||||||
|
using namespace WallpaperEngine::Input;
|
||||||
|
|
||||||
|
CMouseInput::CMouseInput (GLFWwindow* window) : position(0, 0), m_window (window) {}
|
||||||
|
|
||||||
|
void CMouseInput::update ()
|
||||||
|
{
|
||||||
|
// update current mouse position
|
||||||
|
glfwGetCursorPos (this->m_window, &this->m_mousePosition.x, &this->m_mousePosition.y);
|
||||||
|
// interpolate to the new position
|
||||||
|
this->position = glm::mix (this->position, this->m_mousePosition, 1.0);
|
||||||
|
}
|
37
src/WallpaperEngine/Input/CMouseInput.h
Normal file
37
src/WallpaperEngine/Input/CMouseInput.h
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <glm/vec2.hpp>
|
||||||
|
#include "GLFW/glfw3.h"
|
||||||
|
|
||||||
|
namespace WallpaperEngine::Input
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Handles mouse input for the background
|
||||||
|
*/
|
||||||
|
class CMouseInput
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CMouseInput(GLFWwindow* window);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Takes current mouse position and updates it
|
||||||
|
*/
|
||||||
|
void update ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The virtual pointer's position
|
||||||
|
*/
|
||||||
|
glm::dvec2 position;
|
||||||
|
private:
|
||||||
|
/**
|
||||||
|
* The GLFW window to get mouse position from
|
||||||
|
*/
|
||||||
|
GLFWwindow* m_window;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The current mouse position
|
||||||
|
*/
|
||||||
|
glm::dvec2 m_mousePosition;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
@ -6,15 +6,16 @@
|
|||||||
#include <GL/glx.h>
|
#include <GL/glx.h>
|
||||||
|
|
||||||
#include "CContext.h"
|
#include "CContext.h"
|
||||||
|
#include "CVideo.h"
|
||||||
|
|
||||||
using namespace WallpaperEngine::Render;
|
using namespace WallpaperEngine::Render;
|
||||||
|
|
||||||
CContext::CContext (std::vector <std::string> screens) :
|
CContext::CContext (std::vector <std::string> screens, CMouseInput* mouse) :
|
||||||
m_wallpaper (nullptr),
|
m_wallpaper (nullptr),
|
||||||
m_screens (std::move (screens)),
|
m_screens (std::move (screens)),
|
||||||
m_isRootWindow (m_screens.empty () == false),
|
m_isRootWindow (m_screens.empty () == false),
|
||||||
m_window (0),
|
m_defaultViewport ({0, 0, 1920, 1080}),
|
||||||
m_defaultViewport ({0, 0, 1920, 1080})
|
m_mouse (mouse)
|
||||||
{
|
{
|
||||||
this->initializeViewports ();
|
this->initializeViewports ();
|
||||||
}
|
}
|
||||||
@ -76,8 +77,6 @@ void CContext::initializeViewports ()
|
|||||||
|
|
||||||
XRRFreeScreenResources (screenResources);
|
XRRFreeScreenResources (screenResources);
|
||||||
|
|
||||||
// store the window
|
|
||||||
this->m_window = DefaultRootWindow (display);
|
|
||||||
// set the
|
// set the
|
||||||
glfwWindowHintPointer (GLFW_NATIVE_PARENT_HANDLE, reinterpret_cast <void*> (DefaultRootWindow (display)));
|
glfwWindowHintPointer (GLFW_NATIVE_PARENT_HANDLE, reinterpret_cast <void*> (DefaultRootWindow (display)));
|
||||||
}
|
}
|
||||||
@ -96,7 +95,9 @@ void CContext::render ()
|
|||||||
for (; cur != end; cur ++)
|
for (; cur != end; cur ++)
|
||||||
{
|
{
|
||||||
this->m_wallpaper->render (*cur, firstFrame);
|
this->m_wallpaper->render (*cur, firstFrame);
|
||||||
firstFrame = false;
|
// scenes need to render a new frame for each viewport as they produce different results
|
||||||
|
// but videos should only be rendered once per group of viewports
|
||||||
|
firstFrame = !this->m_wallpaper->is <CVideo> ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -112,3 +113,8 @@ void CContext::setDefaultViewport (glm::vec4 defaultViewport)
|
|||||||
{
|
{
|
||||||
this->m_defaultViewport = defaultViewport;
|
this->m_defaultViewport = defaultViewport;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CMouseInput* CContext::getMouse () const
|
||||||
|
{
|
||||||
|
return this->m_mouse;
|
||||||
|
}
|
@ -3,26 +3,31 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <glm/vec4.hpp>
|
#include <glm/vec4.hpp>
|
||||||
|
|
||||||
|
#include "WallpaperEngine/Input/CMouseInput.h"
|
||||||
#include "CWallpaper.h"
|
#include "CWallpaper.h"
|
||||||
|
|
||||||
|
using namespace WallpaperEngine::Input;
|
||||||
|
|
||||||
namespace WallpaperEngine::Render
|
namespace WallpaperEngine::Render
|
||||||
{
|
{
|
||||||
|
class CWallpaper;
|
||||||
|
|
||||||
class CContext
|
class CContext
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CContext (std::vector <std::string> screens);
|
CContext (std::vector <std::string> screens, CMouseInput* mouse);
|
||||||
|
|
||||||
void initializeViewports ();
|
void initializeViewports ();
|
||||||
void render ();
|
void render ();
|
||||||
void setWallpaper (CWallpaper* wallpaper);
|
void setWallpaper (CWallpaper* wallpaper);
|
||||||
void setDefaultViewport (glm::vec4 defaultViewport);
|
void setDefaultViewport (glm::vec4 defaultViewport);
|
||||||
|
CMouseInput* getMouse () const;
|
||||||
private:
|
private:
|
||||||
Window m_window;
|
|
||||||
std::vector <std::string> m_screens;
|
std::vector <std::string> m_screens;
|
||||||
std::vector <glm::vec4> m_viewports;
|
std::vector <glm::vec4> m_viewports;
|
||||||
glm::vec4 m_defaultViewport;
|
glm::vec4 m_defaultViewport;
|
||||||
CWallpaper* m_wallpaper;
|
CWallpaper* m_wallpaper;
|
||||||
|
CMouseInput* m_mouse;
|
||||||
bool m_isRootWindow;
|
bool m_isRootWindow;
|
||||||
};
|
};
|
||||||
}
|
}
|
@ -9,8 +9,8 @@
|
|||||||
using namespace WallpaperEngine;
|
using namespace WallpaperEngine;
|
||||||
using namespace WallpaperEngine::Render;
|
using namespace WallpaperEngine::Render;
|
||||||
|
|
||||||
CScene::CScene (Core::CScene* scene, CContainer* container) :
|
CScene::CScene (Core::CScene* scene, CContainer* container, CContext* context) :
|
||||||
CWallpaper (scene, Type, container)
|
CWallpaper (scene, Type, container, context)
|
||||||
{
|
{
|
||||||
// setup the scene camera
|
// setup the scene camera
|
||||||
this->m_camera = new CCamera (this, scene->getCamera ());
|
this->m_camera = new CCamera (this, scene->getCamera ());
|
||||||
@ -56,12 +56,15 @@ CCamera* CScene::getCamera () const
|
|||||||
return this->m_camera;
|
return this->m_camera;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CScene::renderFrame ()
|
void CScene::renderFrame (glm::vec4 viewport)
|
||||||
{
|
{
|
||||||
auto projection = this->getScene ()->getOrthogonalProjection ();
|
auto projection = this->getScene ()->getOrthogonalProjection ();
|
||||||
auto cur = this->m_objects.begin ();
|
auto cur = this->m_objects.begin ();
|
||||||
auto end = this->m_objects.end ();
|
auto end = this->m_objects.end ();
|
||||||
|
|
||||||
|
// ensure the virtual mouse position is up to date
|
||||||
|
this->updateMouse (viewport);
|
||||||
|
|
||||||
// clear screen
|
// clear screen
|
||||||
FloatColor clearColor = this->getScene ()->getClearColor ();
|
FloatColor clearColor = this->getScene ()->getClearColor ();
|
||||||
|
|
||||||
@ -79,9 +82,28 @@ void CScene::renderFrame ()
|
|||||||
glViewport (0, 0, projection->getWidth (), projection->getHeight ());
|
glViewport (0, 0, projection->getWidth (), projection->getHeight ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CScene::updateMouse (glm::vec4 viewport)
|
||||||
|
{
|
||||||
|
// projection also affects the mouse position
|
||||||
|
auto projection = this->getScene ()->getOrthogonalProjection ();
|
||||||
|
// update virtual mouse position first
|
||||||
|
CMouseInput* mouse = this->getContext ()->getMouse ();
|
||||||
|
// TODO: PROPERLY TRANSLATE THESE TO WHAT'S VISIBLE ON SCREEN (FOR BACKGROUNDS THAT DO NOT EXACTLY FIT ON SCREEN)
|
||||||
|
|
||||||
|
this->m_mousePosition.x = glm::clamp ((mouse->position.x - viewport.x) / viewport.z, 0.0, 1.0);
|
||||||
|
this->m_mousePosition.y = glm::clamp ((mouse->position.y - viewport.y) / viewport.w, 0.0, 1.0);
|
||||||
|
|
||||||
|
// screen-space positions have to be transposed to what the screen will actually show
|
||||||
|
}
|
||||||
|
|
||||||
Core::CScene* CScene::getScene ()
|
Core::CScene* CScene::getScene ()
|
||||||
{
|
{
|
||||||
return this->getWallpaperData ()->as<Core::CScene> ();
|
return this->getWallpaperData ()->as<Core::CScene> ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
glm::vec2* CScene::getMousePosition ()
|
||||||
|
{
|
||||||
|
return &this->m_mousePosition;
|
||||||
|
}
|
||||||
|
|
||||||
const std::string CScene::Type = "scene";
|
const std::string CScene::Type = "scene";
|
||||||
|
@ -15,14 +15,17 @@ namespace WallpaperEngine::Render
|
|||||||
class CScene : public CWallpaper
|
class CScene : public CWallpaper
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CScene (Core::CScene* scene, CContainer* container);
|
CScene (Core::CScene* scene, CContainer* container, CContext* context);
|
||||||
|
|
||||||
CCamera* getCamera () const;
|
CCamera* getCamera () const;
|
||||||
|
|
||||||
Core::CScene* getScene ();
|
Core::CScene* getScene ();
|
||||||
|
|
||||||
|
glm::vec2* getMousePosition ();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void renderFrame () override;
|
void renderFrame (glm::vec4 viewport) override;
|
||||||
|
void updateMouse (glm::vec4 viewport);
|
||||||
|
|
||||||
friend class CWallpaper;
|
friend class CWallpaper;
|
||||||
|
|
||||||
@ -31,5 +34,6 @@ namespace WallpaperEngine::Render
|
|||||||
private:
|
private:
|
||||||
CCamera* m_camera;
|
CCamera* m_camera;
|
||||||
std::vector<CObject*> m_objects;
|
std::vector<CObject*> m_objects;
|
||||||
|
glm::vec2 m_mousePosition;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
using namespace WallpaperEngine;
|
using namespace WallpaperEngine;
|
||||||
using namespace WallpaperEngine::Render;
|
using namespace WallpaperEngine::Render;
|
||||||
|
|
||||||
CVideo::CVideo (Core::CVideo* video, CContainer* container) :
|
CVideo::CVideo (Core::CVideo* video, CContainer* container, CContext* context) :
|
||||||
CWallpaper (video, Type, container)
|
CWallpaper (video, Type, container, context)
|
||||||
{
|
{
|
||||||
if (avformat_open_input (&m_formatCtx, video->getFilename ().c_str (), NULL, NULL) < 0)
|
if (avformat_open_input (&m_formatCtx, video->getFilename ().c_str (), NULL, NULL) < 0)
|
||||||
throw std::runtime_error ("Failed to open video file");
|
throw std::runtime_error ("Failed to open video file");
|
||||||
@ -115,7 +115,7 @@ void CVideo::setSize (int width, int height)
|
|||||||
SWS_BILINEAR, NULL, NULL, NULL);
|
SWS_BILINEAR, NULL, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CVideo::renderFrame ()
|
void CVideo::renderFrame (glm::vec4 viewport)
|
||||||
{
|
{
|
||||||
// do not render using the CWallpaper function, just use this one
|
// do not render using the CWallpaper function, just use this one
|
||||||
this->setSize (m_codecCtx->width, m_codecCtx->height);
|
this->setSize (m_codecCtx->width, m_codecCtx->height);
|
||||||
|
@ -17,7 +17,7 @@ namespace WallpaperEngine::Render
|
|||||||
class CVideo : public CWallpaper
|
class CVideo : public CWallpaper
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CVideo (Core::CVideo* video, CContainer* container);
|
CVideo (Core::CVideo* video, CContainer* container, CContext* context);
|
||||||
|
|
||||||
Core::CVideo* getVideo ();
|
Core::CVideo* getVideo ();
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ namespace WallpaperEngine::Render
|
|||||||
int getHeight ();
|
int getHeight ();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void renderFrame () override;
|
void renderFrame (glm::vec4 viewport) override;
|
||||||
|
|
||||||
friend class CWallpaper;
|
friend class CWallpaper;
|
||||||
|
|
||||||
|
@ -8,10 +8,11 @@
|
|||||||
|
|
||||||
using namespace WallpaperEngine::Render;
|
using namespace WallpaperEngine::Render;
|
||||||
|
|
||||||
CWallpaper::CWallpaper (Core::CWallpaper* wallpaperData, std::string type, CContainer* container) :
|
CWallpaper::CWallpaper (Core::CWallpaper* wallpaperData, std::string type, CContainer* container, CContext* context) :
|
||||||
m_container (container),
|
m_container (container),
|
||||||
m_wallpaperData (wallpaperData),
|
m_wallpaperData (wallpaperData),
|
||||||
m_type (std::move(type))
|
m_type (std::move(type)),
|
||||||
|
m_context (context)
|
||||||
{
|
{
|
||||||
this->setupShaders ();
|
this->setupShaders ();
|
||||||
|
|
||||||
@ -187,7 +188,7 @@ void CWallpaper::setupShaders ()
|
|||||||
void CWallpaper::render (glm::vec4 viewport, bool newFrame)
|
void CWallpaper::render (glm::vec4 viewport, bool newFrame)
|
||||||
{
|
{
|
||||||
if (newFrame == true)
|
if (newFrame == true)
|
||||||
this->renderFrame ();
|
this->renderFrame (viewport);
|
||||||
|
|
||||||
int windowWidth = 1920;
|
int windowWidth = 1920;
|
||||||
int windowHeight = 1080;
|
int windowHeight = 1080;
|
||||||
@ -310,6 +311,11 @@ void CWallpaper::setupFramebuffers ()
|
|||||||
this->m_sceneFBO = this->createFBO ("_rt_FullFrameBuffer", ITexture::TextureFormat::ARGB8888, 1.0, windowWidth, windowHeight, windowWidth, windowHeight);
|
this->m_sceneFBO = this->createFBO ("_rt_FullFrameBuffer", ITexture::TextureFormat::ARGB8888, 1.0, windowWidth, windowHeight, windowWidth, windowHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CContext* CWallpaper::getContext ()
|
||||||
|
{
|
||||||
|
return this->m_context;
|
||||||
|
}
|
||||||
|
|
||||||
CFBO* CWallpaper::createFBO (const std::string& name, ITexture::TextureFormat format, float scale, uint32_t realWidth, uint32_t realHeight, uint32_t textureWidth, uint32_t textureHeight)
|
CFBO* CWallpaper::createFBO (const std::string& name, ITexture::TextureFormat format, float scale, uint32_t realWidth, uint32_t realHeight, uint32_t textureWidth, uint32_t textureHeight)
|
||||||
{
|
{
|
||||||
CFBO* fbo = new CFBO (name, format, scale, realWidth, realHeight, textureWidth, textureHeight);
|
CFBO* fbo = new CFBO (name, format, scale, realWidth, realHeight, textureWidth, textureHeight);
|
||||||
|
@ -9,11 +9,14 @@
|
|||||||
|
|
||||||
#include "WallpaperEngine/Assets/CContainer.h"
|
#include "WallpaperEngine/Assets/CContainer.h"
|
||||||
#include "CFBO.h"
|
#include "CFBO.h"
|
||||||
|
#include "CContext.h"
|
||||||
|
|
||||||
using namespace WallpaperEngine::Assets;
|
using namespace WallpaperEngine::Assets;
|
||||||
|
|
||||||
namespace WallpaperEngine::Render
|
namespace WallpaperEngine::Render
|
||||||
{
|
{
|
||||||
|
class CContext;
|
||||||
|
|
||||||
class CWallpaper
|
class CWallpaper
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -22,7 +25,7 @@ namespace WallpaperEngine::Render
|
|||||||
|
|
||||||
template<class T> bool is () { return this->m_type == T::Type; }
|
template<class T> bool is () { return this->m_type == T::Type; }
|
||||||
|
|
||||||
CWallpaper (Core::CWallpaper* wallpaperData, std::string type, CContainer* container);
|
CWallpaper (Core::CWallpaper* wallpaperData, std::string type, CContainer* container, CContext* context);
|
||||||
~CWallpaper ();
|
~CWallpaper ();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -72,13 +75,18 @@ namespace WallpaperEngine::Render
|
|||||||
/**
|
/**
|
||||||
* Renders a frame of the wallpaper
|
* Renders a frame of the wallpaper
|
||||||
*/
|
*/
|
||||||
virtual void renderFrame () = 0;
|
virtual void renderFrame (glm::vec4 viewport) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setups OpenGL's framebuffers for ping-pong and scene rendering
|
* Setups OpenGL's framebuffers for ping-pong and scene rendering
|
||||||
*/
|
*/
|
||||||
void setupFramebuffers ();
|
void setupFramebuffers ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return The current context rendering this wallpaper
|
||||||
|
*/
|
||||||
|
CContext* getContext ();
|
||||||
|
|
||||||
CContainer* m_container;
|
CContainer* m_container;
|
||||||
Core::CWallpaper* m_wallpaperData;
|
Core::CWallpaper* m_wallpaperData;
|
||||||
|
|
||||||
@ -113,5 +121,9 @@ namespace WallpaperEngine::Render
|
|||||||
* List of FBOs registered for this wallpaper
|
* List of FBOs registered for this wallpaper
|
||||||
*/
|
*/
|
||||||
std::map<std::string, CFBO*> m_fbos;
|
std::map<std::string, CFBO*> m_fbos;
|
||||||
|
/**
|
||||||
|
* Context that is using this wallpaper
|
||||||
|
*/
|
||||||
|
CContext* m_context;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -470,6 +470,9 @@ void CPass::setupUniforms ()
|
|||||||
this->addUniform ("g_Time", &g_Time);
|
this->addUniform ("g_Time", &g_Time);
|
||||||
// add model-view-projection matrix
|
// add model-view-projection matrix
|
||||||
this->addUniform ("g_ModelViewProjectionMatrix", &this->m_modelViewProjectionMatrix);
|
this->addUniform ("g_ModelViewProjectionMatrix", &this->m_modelViewProjectionMatrix);
|
||||||
|
this->addUniform ("g_PointerPosition", this->m_material->getImage ()->getScene ()->getMousePosition ());
|
||||||
|
this->addUniform ("g_EffectTextureProjectionMatrix", glm::mat4(1.0));
|
||||||
|
this->addUniform ("g_EffectTextureProjectionMatrixInverse", glm::mat4(1.0));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPass::addAttribute (const std::string& name, GLint type, GLint elements, const GLuint* value)
|
void CPass::addAttribute (const std::string& name, GLint type, GLint elements, const GLuint* value)
|
||||||
|
Loading…
Reference in New Issue
Block a user