ShaderNodes/InputValue: Fix output type when using Float1

This commit is contained in:
Jérôme Leclercq 2020-07-19 21:08:25 +02:00
parent 5258f0b61a
commit e342c88e64
2 changed files with 14 additions and 5 deletions

View File

@ -1,5 +1,5 @@
#include <ShaderNode/ShaderGraph.hpp>
#include <ShaderNode/DataModels/InputValue.hpp>
#include <ShaderNode/ShaderGraph.hpp>
#include <ShaderNode/DataTypes/FloatData.hpp>
#include <ShaderNode/DataTypes/VecData.hpp>
#include <Nazara/Renderer/ShaderBuilder.hpp>
@ -170,10 +170,20 @@ std::shared_ptr<QtNodes::NodeData> InputValue::outData(QtNodes::PortIndex port)
const auto& inputEntry = graph.GetInput(*m_currentInputIndex);
const auto& preview = graph.GetPreviewModel();
auto vecData = std::make_shared<VecData>(GetComponentCount(inputEntry.type));
vecData->preview = preview.GetPreview(inputEntry.role, inputEntry.roleIndex);
if (inputEntry.type == PrimitiveType::Float1)
{
auto fData = std::make_shared<FloatData>();
fData->preview = preview.GetPreview(inputEntry.role, inputEntry.roleIndex);
return vecData;
return fData;
}
else
{
auto vecData = std::make_shared<VecData>(GetComponentCount(inputEntry.type));
vecData->preview = preview.GetPreview(inputEntry.role, inputEntry.roleIndex);
return vecData;
}
}
QtNodes::NodeValidationState InputValue::validationState() const

View File

@ -1,2 +1 @@
#include <ShaderNode/DataModels/InputValue.hpp>
#include <array>