Add shadernode (big WIP)

This commit is contained in:
Lynix
2020-05-18 19:55:12 +02:00
parent 8c0d34313e
commit c26f3b9b71
12 changed files with 410 additions and 1 deletions

View File

@@ -0,0 +1,44 @@
#include <DataModels/FragmentOutput.hpp>
#include <Nazara/Renderer/ShaderBuilder.hpp>
#include <DataModels/VecValue.hpp>
Nz::ShaderAst::ExpressionPtr FragmentOutput::GetExpression(Nz::ShaderAst::ExpressionPtr* expressions, std::size_t count) const
{
using namespace Nz::ShaderAst;
using namespace Nz::ShaderBuilder;
assert(count == 1);
auto output = Nz::ShaderBuilder::Output("RenderTarget0", ExpressionType::Float4);
return Nz::ShaderBuilder::Assign(output, *expressions);
}
QtNodes::NodeDataType FragmentOutput::dataType(QtNodes::PortType portType, QtNodes::PortIndex portIndex) const
{
assert(portType == QtNodes::PortType::In);
assert(portIndex == 0);
return Vec4Data::Type();
}
QWidget* FragmentOutput::embeddedWidget()
{
return nullptr;
}
unsigned int FragmentOutput::nPorts(QtNodes::PortType portType) const
{
switch (portType)
{
case QtNodes::PortType::In: return 1;
case QtNodes::PortType::Out: return 0;
}
return 0;
}
std::shared_ptr<QtNodes::NodeData> FragmentOutput::outData(QtNodes::PortIndex /*port*/)
{
return {};
}