ShaderNode: Move VecData to DataTypes folder
This commit is contained in:
@@ -8,8 +8,7 @@
|
||||
#include <QtWidgets/QLabel>
|
||||
#include <ShaderNode/ShaderGraph.hpp>
|
||||
#include <ShaderNode/DataModels/ShaderNode.hpp>
|
||||
#include <ShaderNode/DataModels/VecValue.hpp>
|
||||
#include <array>
|
||||
#include <ShaderNode/DataTypes/VecData.hpp>
|
||||
|
||||
template<typename From, typename To>
|
||||
class CastVec : public ShaderNode
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include <ShaderNode/DataModels/Cast.hpp>
|
||||
#include <Nazara/Renderer/ShaderBuilder.hpp>
|
||||
#include <QtWidgets/QDoubleSpinBox>
|
||||
#include <QtWidgets/QFormLayout>
|
||||
#include <stdexcept>
|
||||
|
||||
template<typename From, typename To>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include <ShaderNode/DataModels/FragmentOutput.hpp>
|
||||
#include <Nazara/Renderer/ShaderBuilder.hpp>
|
||||
#include <ShaderNode/DataModels/VecValue.hpp>
|
||||
#include <ShaderNode/DataTypes/VecData.hpp>
|
||||
|
||||
Nz::ShaderAst::ExpressionPtr FragmentOutput::GetExpression(Nz::ShaderAst::ExpressionPtr* expressions, std::size_t count) const
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#define NAZARA_SHADERNODES_FRAGMENTOUTPUT_HPP
|
||||
|
||||
#include <ShaderNode/DataModels/ShaderNode.hpp>
|
||||
#include <ShaderNode/DataModels/VecValue.hpp>
|
||||
#include <ShaderNode/DataTypes/VecData.hpp>
|
||||
#include <QtWidgets/QDoubleSpinBox>
|
||||
#include <QtWidgets/QFormLayout>
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#include <ShaderNode/ShaderGraph.hpp>
|
||||
#include <ShaderNode/DataModels/InputValue.hpp>
|
||||
#include <ShaderNode/DataModels/VecValue.hpp>
|
||||
#include <ShaderNode/DataTypes/VecData.hpp>
|
||||
#include <Nazara/Renderer/ShaderBuilder.hpp>
|
||||
#include <QtWidgets/QFormLayout>
|
||||
|
||||
InputValue::InputValue(ShaderGraph& graph) :
|
||||
ShaderNode(graph)
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#include <ShaderNode/ShaderGraph.hpp>
|
||||
#include <ShaderNode/DataModels/SampleTexture.hpp>
|
||||
#include <ShaderNode/DataModels/VecValue.hpp>
|
||||
#include <Nazara/Renderer/ShaderBuilder.hpp>
|
||||
|
||||
SampleTexture::SampleTexture(ShaderGraph& graph) :
|
||||
|
||||
@@ -8,8 +8,7 @@
|
||||
#include <QtWidgets/QLabel>
|
||||
#include <ShaderNode/ShaderGraph.hpp>
|
||||
#include <ShaderNode/DataModels/ShaderNode.hpp>
|
||||
#include <ShaderNode/DataModels/VecValue.hpp>
|
||||
#include <array>
|
||||
#include <ShaderNode/DataTypes/VecData.hpp>
|
||||
|
||||
class SampleTexture : public ShaderNode
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#define NAZARA_SHADERNODES_VECBINOP_HPP
|
||||
|
||||
#include <ShaderNode/DataModels/ShaderNode.hpp>
|
||||
#include <ShaderNode/DataModels/VecValue.hpp>
|
||||
#include <ShaderNode/DataTypes/VecData.hpp>
|
||||
|
||||
template<typename Data, Nz::ShaderAst::BinaryType BinOp>
|
||||
class VecBinOp : public ShaderNode
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
#include <ShaderNode/DataModels/VecData.hpp>
|
||||
@@ -1,106 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_SHADERNODES_VECDATA_HPP
|
||||
#define NAZARA_SHADERNODES_VECDATA_HPP
|
||||
|
||||
#include <Nazara/Renderer/ShaderAst.hpp>
|
||||
#include <nodes/NodeData>
|
||||
#include <QtGui/QImage>
|
||||
|
||||
struct VecData : public QtNodes::NodeData
|
||||
{
|
||||
inline VecData();
|
||||
|
||||
QImage preview;
|
||||
};
|
||||
|
||||
struct Vec2Data : public VecData
|
||||
{
|
||||
static constexpr std::size_t ComponentCount = 2;
|
||||
static constexpr Nz::ShaderAst::ExpressionType ExpressionType = Nz::ShaderAst::ExpressionType::Float2;
|
||||
|
||||
QtNodes::NodeDataType type() const override
|
||||
{
|
||||
return Type();
|
||||
}
|
||||
|
||||
static QtNodes::NodeDataType Type()
|
||||
{
|
||||
return { "vec2", "Vec2" };
|
||||
}
|
||||
};
|
||||
|
||||
struct Vec3Data : public VecData
|
||||
{
|
||||
static constexpr std::size_t ComponentCount = 3;
|
||||
static constexpr Nz::ShaderAst::ExpressionType ExpressionType = Nz::ShaderAst::ExpressionType::Float3;
|
||||
|
||||
QtNodes::NodeDataType type() const override
|
||||
{
|
||||
return Type();
|
||||
}
|
||||
|
||||
static QtNodes::NodeDataType Type()
|
||||
{
|
||||
return { "vec3", "Vec3" };
|
||||
}
|
||||
};
|
||||
|
||||
struct Vec4Data : public VecData
|
||||
{
|
||||
static constexpr std::size_t ComponentCount = 4;
|
||||
static constexpr Nz::ShaderAst::ExpressionType ExpressionType = Nz::ShaderAst::ExpressionType::Float4;
|
||||
|
||||
QtNodes::NodeDataType type() const override
|
||||
{
|
||||
return Type();
|
||||
}
|
||||
|
||||
static QtNodes::NodeDataType Type()
|
||||
{
|
||||
return { "vec4", "Vec4" };
|
||||
}
|
||||
};
|
||||
|
||||
struct VecTypeDummy {};
|
||||
|
||||
template<std::size_t N>
|
||||
struct VecTypeHelper;
|
||||
|
||||
template<>
|
||||
struct VecTypeHelper<0>
|
||||
{
|
||||
using Type = VecTypeDummy;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct VecTypeHelper<1>
|
||||
{
|
||||
using Type = std::array<float, 1>;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct VecTypeHelper<2>
|
||||
{
|
||||
using Type = Nz::Vector2f;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct VecTypeHelper<3>
|
||||
{
|
||||
using Type = Nz::Vector3f;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct VecTypeHelper<4>
|
||||
{
|
||||
using Type = Nz::Vector4f;
|
||||
};
|
||||
|
||||
template<std::size_t N> using VecType = typename VecTypeHelper<N>::template Type;
|
||||
|
||||
constexpr std::array<char, 4> s_vectorComponents = { 'X', 'Y', 'Z', 'W' };
|
||||
|
||||
#include <ShaderNode/DataModels/VecData.inl>
|
||||
|
||||
#endif
|
||||
@@ -1,7 +0,0 @@
|
||||
#include <ShaderNode/DataModels/VecData.hpp>
|
||||
|
||||
inline VecData::VecData() :
|
||||
preview(64, 64, QImage::Format_RGBA8888)
|
||||
{
|
||||
preview.fill(QColor::fromRgb(255, 255, 255, 0));
|
||||
}
|
||||
@@ -8,7 +8,7 @@
|
||||
#include <QtWidgets/QFormLayout>
|
||||
#include <QtWidgets/QLabel>
|
||||
#include <ShaderNode/DataModels/ShaderNode.hpp>
|
||||
#include <ShaderNode/DataModels/VecData.hpp>
|
||||
#include <ShaderNode/DataTypes/VecData.hpp>
|
||||
#include <array>
|
||||
|
||||
template<typename Data>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include <ShaderNode/DataModels/VecValue.hpp>
|
||||
#include <Nazara/Core/Algorithm.hpp>
|
||||
#include <Nazara/Renderer/ShaderBuilder.hpp>
|
||||
#include <ShaderNode/DataModels/VecValue.hpp>
|
||||
#include <ShaderNode/DataTypes/VecData.hpp>
|
||||
#include <array>
|
||||
#include <tuple>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user