mirror of
https://github.com/Almamu/linux-wallpaperengine.git
synced 2025-07-15 13:52:23 +08:00
+ added vector3 support for shader constants (looks like strings were vector3 after all)
Signed-off-by: Alexis Maiquez <almamu@almamu.com>
This commit is contained in:
parent
4358e7c173
commit
318a99d5ca
@ -102,6 +102,8 @@ add_executable(
|
||||
src/WallpaperEngine/Core/Objects/Effects/CShaderConstant.cpp
|
||||
src/WallpaperEngine/Core/Objects/Effects/CShaderConstantFloat.h
|
||||
src/WallpaperEngine/Core/Objects/Effects/CShaderConstantFloat.cpp
|
||||
src/WallpaperEngine/Core/Objects/Effects/CShaderConstantVector3.h
|
||||
src/WallpaperEngine/Core/Objects/Effects/CShaderConstantVector3.cpp
|
||||
src/WallpaperEngine/Core/Objects/Effects/CShaderConstantInteger.h
|
||||
src/WallpaperEngine/Core/Objects/Effects/CShaderConstantInteger.cpp
|
||||
|
||||
|
@ -2,10 +2,13 @@
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "WallpaperEngine/Core/Core.h"
|
||||
#include "WallpaperEngine/Core/Objects/CImage.h"
|
||||
#include "WallpaperEngine/Core/Objects/Effects/CShaderConstant.h"
|
||||
#include "WallpaperEngine/Core/Objects/Effects/CShaderConstantFloat.h"
|
||||
#include "WallpaperEngine/Core/Objects/Effects/CShaderConstantVector3.h"
|
||||
#include "WallpaperEngine/Core/Objects/Effects/CShaderConstantInteger.h"
|
||||
|
||||
#include "WallpaperEngine/FileSystem/FileSystem.h"
|
||||
|
||||
using namespace WallpaperEngine;
|
||||
@ -136,7 +139,7 @@ CEffect* CEffect::fromJSON (json data, Core::CObject* object)
|
||||
}
|
||||
else if ((*constantCur).is_string () == true)
|
||||
{
|
||||
throw std::runtime_error ("String constants not supported yet");
|
||||
constant = new Effects::CShaderConstantVector3 (WallpaperEngine::Core::ato3vf (*constantCur));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -0,0 +1,17 @@
|
||||
#include "CShaderConstantVector3.h"
|
||||
|
||||
using namespace WallpaperEngine::Core::Objects::Effects;
|
||||
|
||||
|
||||
CShaderConstantVector3::CShaderConstantVector3 (irr::core::vector3df value) :
|
||||
CShaderConstant (Type),
|
||||
m_value (value)
|
||||
{
|
||||
}
|
||||
|
||||
irr::core::vector3df* CShaderConstantVector3::getValue ()
|
||||
{
|
||||
return &this->m_value;
|
||||
}
|
||||
|
||||
const std::string CShaderConstantVector3::Type = "vector3";
|
@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
|
||||
#include "CShaderConstant.h"
|
||||
|
||||
#include <string>
|
||||
#include <irrlicht/irrlicht.h>
|
||||
|
||||
namespace WallpaperEngine::Core::Objects::Effects
|
||||
{
|
||||
class CShaderConstantVector3 : public CShaderConstant
|
||||
{
|
||||
public:
|
||||
CShaderConstantVector3 (irr::core::vector3df value);
|
||||
|
||||
irr::core::vector3df* getValue ();
|
||||
|
||||
static const std::string Type;
|
||||
protected:
|
||||
irr::core::vector3df m_value;
|
||||
};
|
||||
}
|
@ -13,6 +13,7 @@
|
||||
#include "WallpaperEngine/Core/Objects/Effects/CShaderConstant.h"
|
||||
#include "WallpaperEngine/Core/Objects/Effects/CShaderConstantFloat.h"
|
||||
#include "WallpaperEngine/Core/Objects/Effects/CShaderConstantInteger.h"
|
||||
#include "WallpaperEngine/Core/Objects/Effects/CShaderConstantVector3.h"
|
||||
|
||||
using namespace WallpaperEngine;
|
||||
|
||||
@ -194,6 +195,10 @@ void CImage::generatePass (Core::Objects::Images::Materials::CPassess* pass, Cor
|
||||
{
|
||||
pixelVar->as <CShaderVariableInteger> ()->setValue (*(*cur).second->as <CShaderConstantInteger> ()->getValue ());
|
||||
}
|
||||
else if (pixelVar->is <CShaderVariableVector3> () && (*cur).second->is <CShaderConstantVector3> ())
|
||||
{
|
||||
pixelVar->as <CShaderVariableVector3> ()->setValue (*(*cur).second->as <CShaderConstantVector3> ()->getValue ());
|
||||
}
|
||||
}
|
||||
|
||||
if (vertexVar)
|
||||
@ -206,6 +211,10 @@ void CImage::generatePass (Core::Objects::Images::Materials::CPassess* pass, Cor
|
||||
{
|
||||
vertexVar->as <CShaderVariableInteger> ()->setValue (*(*cur).second->as <CShaderConstantInteger> ()->getValue ());
|
||||
}
|
||||
else if (vertexVar->is <CShaderVariableVector3> () && (*cur).second->is <CShaderConstantVector3> ())
|
||||
{
|
||||
vertexVar->as <CShaderVariableVector3> ()->setValue (*(*cur).second->as <CShaderConstantVector3> ()->getValue ());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user