ShaderNode: Fix compilation
This commit is contained in:
parent
4f08e7d848
commit
87cb72217e
|
|
@ -33,7 +33,7 @@ class BinOp : public ShaderNode
|
|||
QString validationMessage() const override;
|
||||
|
||||
private:
|
||||
virtual void ApplyOp(const nzsl::Vector4f* left, const nzsl::Vector4f* right, nzsl::Vector4f* output, std::size_t pixelCount) = 0;
|
||||
virtual void ApplyOp(const nzsl::Vector4f32* left, const nzsl::Vector4f32* right, nzsl::Vector4f32* output, std::size_t pixelCount) = 0;
|
||||
|
||||
bool ComputePreview(QPixmap& pixmap) override;
|
||||
void UpdateOutput();
|
||||
|
|
@ -50,7 +50,7 @@ class BinAdd : public BinOp<DataType, nzsl::Ast::BinaryType::Add>
|
|||
public:
|
||||
using BinOp<DataType, nzsl::Ast::BinaryType::Add>::BinOp;
|
||||
|
||||
void ApplyOp(const nzsl::Vector4f* left, const nzsl::Vector4f* right, nzsl::Vector4f* output, std::size_t pixelCount) override;
|
||||
void ApplyOp(const nzsl::Vector4f32* left, const nzsl::Vector4f32* right, nzsl::Vector4f32* output, std::size_t pixelCount) override;
|
||||
QString GetOperationString() const final;
|
||||
};
|
||||
|
||||
|
|
@ -60,7 +60,7 @@ class BinMul : public BinOp<DataType, nzsl::Ast::BinaryType::Multiply>
|
|||
public:
|
||||
using BinOp<DataType, nzsl::Ast::BinaryType::Multiply>::BinOp;
|
||||
|
||||
void ApplyOp(const nzsl::Vector4f* left, const nzsl::Vector4f* right, nzsl::Vector4f* output, std::size_t pixelCount) override;
|
||||
void ApplyOp(const nzsl::Vector4f32* left, const nzsl::Vector4f32* right, nzsl::Vector4f32* output, std::size_t pixelCount) override;
|
||||
QString GetOperationString() const final;
|
||||
};
|
||||
|
||||
|
|
@ -70,7 +70,7 @@ class BinSub : public BinOp<DataType, nzsl::Ast::BinaryType::Subtract>
|
|||
public:
|
||||
using BinOp<DataType, nzsl::Ast::BinaryType::Subtract>::BinOp;
|
||||
|
||||
void ApplyOp(const nzsl::Vector4f* left, const nzsl::Vector4f* right, nzsl::Vector4f* output, std::size_t pixelCount) override;
|
||||
void ApplyOp(const nzsl::Vector4f32* left, const nzsl::Vector4f32* right, nzsl::Vector4f32* output, std::size_t pixelCount) override;
|
||||
QString GetOperationString() const final;
|
||||
};
|
||||
|
||||
|
|
@ -80,7 +80,7 @@ class BinDiv : public BinOp<DataType, nzsl::Ast::BinaryType::Divide>
|
|||
public:
|
||||
using BinOp<DataType, nzsl::Ast::BinaryType::Divide>::BinOp;
|
||||
|
||||
void ApplyOp(const nzsl::Vector4f* left, const nzsl::Vector4f* right, nzsl::Vector4f* output, std::size_t pixelCount) override;
|
||||
void ApplyOp(const nzsl::Vector4f32* left, const nzsl::Vector4f32* right, nzsl::Vector4f32* output, std::size_t pixelCount) override;
|
||||
QString GetOperationString() const final;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ void BinOp<DataType, Op>::UpdateOutput()
|
|||
m_output = std::make_shared<DataType>();
|
||||
|
||||
m_output->preview = PreviewValues(1, 1);
|
||||
m_output->preview.Fill(nzsl::Vector4f(0.f, 0.f, 0.f, 0.f));
|
||||
m_output->preview.Fill(nzsl::Vector4f32(0.f, 0.f, 0.f, 0.f));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -186,7 +186,7 @@ void BinOp<DataType, Op>::UpdateOutput()
|
|||
}
|
||||
|
||||
template<typename DataType>
|
||||
void BinAdd<DataType>::ApplyOp(const nzsl::Vector4f* left, const nzsl::Vector4f* right, nzsl::Vector4f* output, std::size_t pixelCount)
|
||||
void BinAdd<DataType>::ApplyOp(const nzsl::Vector4f32* left, const nzsl::Vector4f32* right, nzsl::Vector4f32* output, std::size_t pixelCount)
|
||||
{
|
||||
for (std::size_t i = 0; i < pixelCount; ++i)
|
||||
output[i] = left[i] + right[i];
|
||||
|
|
@ -199,7 +199,7 @@ QString BinAdd<DataType>::GetOperationString() const
|
|||
}
|
||||
|
||||
template<typename DataType>
|
||||
void BinMul<DataType>::ApplyOp(const nzsl::Vector4f* left, const nzsl::Vector4f* right, nzsl::Vector4f* output, std::size_t pixelCount)
|
||||
void BinMul<DataType>::ApplyOp(const nzsl::Vector4f32* left, const nzsl::Vector4f32* right, nzsl::Vector4f32* output, std::size_t pixelCount)
|
||||
{
|
||||
for (std::size_t i = 0; i < pixelCount; ++i)
|
||||
output[i] = left[i] * right[i];
|
||||
|
|
@ -212,7 +212,7 @@ QString BinMul<DataType>::GetOperationString() const
|
|||
}
|
||||
|
||||
template<typename DataType>
|
||||
void BinSub<DataType>::ApplyOp(const nzsl::Vector4f* left, const nzsl::Vector4f* right, nzsl::Vector4f* output, std::size_t pixelCount)
|
||||
void BinSub<DataType>::ApplyOp(const nzsl::Vector4f32* left, const nzsl::Vector4f32* right, nzsl::Vector4f32* output, std::size_t pixelCount)
|
||||
{
|
||||
for (std::size_t i = 0; i < pixelCount; ++i)
|
||||
output[i] = left[i] - right[i];
|
||||
|
|
@ -225,7 +225,7 @@ QString BinSub<DataType>::GetOperationString() const
|
|||
}
|
||||
|
||||
template<typename DataType>
|
||||
void BinDiv<DataType>::ApplyOp(const nzsl::Vector4f* left, const nzsl::Vector4f* right, nzsl::Vector4f* output, std::size_t pixelCount)
|
||||
void BinDiv<DataType>::ApplyOp(const nzsl::Vector4f32* left, const nzsl::Vector4f32* right, nzsl::Vector4f32* output, std::size_t pixelCount)
|
||||
{
|
||||
for (std::size_t i = 0; i < pixelCount; ++i)
|
||||
output[i] = left[i] / right[i];
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ std::shared_ptr<QtNodes::NodeData> BoolValue::outData(QtNodes::PortIndex port)
|
|||
float c = (m_value) ? 1.f : 0.f;
|
||||
|
||||
auto out = std::make_shared<BoolData>();
|
||||
out->preview(0, 0) = nzsl::Vector4f(c, c, c, 1.f);
|
||||
out->preview(0, 0) = nzsl::Vector4f32(c, c, c, 1.f);
|
||||
|
||||
return out;
|
||||
}
|
||||
|
|
@ -94,7 +94,7 @@ nzsl::Ast::NodePtr BoolValue::BuildNode(nzsl::Ast::ExpressionPtr* /*expressions*
|
|||
assert(count == 0);
|
||||
assert(outputIndex == 0);
|
||||
|
||||
return nzsl::ShaderBuilder::Constant(m_value);
|
||||
return nzsl::ShaderBuilder::ConstantValue(m_value);
|
||||
}
|
||||
|
||||
bool BoolValue::ComputePreview(QPixmap& pixmap)
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ nzsl::Ast::NodePtr CastVec<ToComponentCount>::BuildNode(nzsl::Ast::ExpressionPtr
|
|||
std::vector<nzsl::Ast::ExpressionPtr> params;
|
||||
params.emplace_back(std::move(expressions[0]));
|
||||
for (std::size_t i = 0; i < overflowComponentCount; ++i)
|
||||
params.emplace_back(nzsl::ShaderBuilder::Constant(m_overflowComponents[i]));
|
||||
params.emplace_back(nzsl::ShaderBuilder::ConstantValue(m_overflowComponents[i]));
|
||||
|
||||
return nzsl::ShaderBuilder::Cast(nzsl::Ast::ExpressionType{ nzsl::Ast::VectorType{ ToComponentCount, nzsl::Ast::PrimitiveType::Float32 } }, std::move(params));
|
||||
}
|
||||
|
|
@ -187,7 +187,7 @@ void CastVec<ToComponentCount>::UpdateOutput()
|
|||
if (!m_input)
|
||||
{
|
||||
m_output->preview = PreviewValues(1, 1);
|
||||
m_output->preview(0, 0) = nzsl::Vector4f(0.f, 0.f, 0.f, 0.f);
|
||||
m_output->preview(0, 0) = nzsl::Vector4f32(0.f, 0.f, 0.f, 0.f);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -208,7 +208,7 @@ void CastVec<ToComponentCount>::UpdateOutput()
|
|||
{
|
||||
for (std::size_t x = 0; x < inputWidth; ++x)
|
||||
{
|
||||
nzsl::Vector4f color = input(x, y);
|
||||
nzsl::Vector4f32 color = input(x, y);
|
||||
|
||||
float* colorPtr = &color[0];
|
||||
for (std::size_t i = 0; i < overflowComponentCount; ++i)
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class CompOp : public ShaderNode
|
|||
QString validationMessage() const override;
|
||||
|
||||
private:
|
||||
virtual void ApplyOp(const nzsl::Vector4f* left, const nzsl::Vector4f* right, nzsl::Vector4f* output, std::size_t pixelCount) = 0;
|
||||
virtual void ApplyOp(const nzsl::Vector4f32* left, const nzsl::Vector4f32* right, nzsl::Vector4f32* output, std::size_t pixelCount) = 0;
|
||||
|
||||
bool ComputePreview(QPixmap& pixmap) override;
|
||||
void UpdateOutput();
|
||||
|
|
@ -51,7 +51,7 @@ class CompEq : public CompOp<DataType, nzsl::Ast::BinaryType::CompEq>
|
|||
public:
|
||||
using CompOp<DataType, nzsl::Ast::BinaryType::CompEq>::CompOp;
|
||||
|
||||
void ApplyOp(const nzsl::Vector4f* left, const nzsl::Vector4f* right, nzsl::Vector4f* output, std::size_t pixelCount) override;
|
||||
void ApplyOp(const nzsl::Vector4f32* left, const nzsl::Vector4f32* right, nzsl::Vector4f32* output, std::size_t pixelCount) override;
|
||||
QString GetOperationString() const final;
|
||||
};
|
||||
|
||||
|
|
@ -61,7 +61,7 @@ class CompGe : public CompOp<DataType, nzsl::Ast::BinaryType::CompGe>
|
|||
public:
|
||||
using CompOp<DataType, nzsl::Ast::BinaryType::CompGe>::CompOp;
|
||||
|
||||
void ApplyOp(const nzsl::Vector4f* left, const nzsl::Vector4f* right, nzsl::Vector4f* output, std::size_t pixelCount) override;
|
||||
void ApplyOp(const nzsl::Vector4f32* left, const nzsl::Vector4f32* right, nzsl::Vector4f32* output, std::size_t pixelCount) override;
|
||||
QString GetOperationString() const final;
|
||||
};
|
||||
|
||||
|
|
@ -71,7 +71,7 @@ class CompGt : public CompOp<DataType, nzsl::Ast::BinaryType::CompGt>
|
|||
public:
|
||||
using CompOp<DataType, nzsl::Ast::BinaryType::CompGt>::CompOp;
|
||||
|
||||
void ApplyOp(const nzsl::Vector4f* left, const nzsl::Vector4f* right, nzsl::Vector4f* output, std::size_t pixelCount) override;
|
||||
void ApplyOp(const nzsl::Vector4f32* left, const nzsl::Vector4f32* right, nzsl::Vector4f32* output, std::size_t pixelCount) override;
|
||||
QString GetOperationString() const final;
|
||||
};
|
||||
|
||||
|
|
@ -81,7 +81,7 @@ class CompLe : public CompOp<DataType, nzsl::Ast::BinaryType::CompLe>
|
|||
public:
|
||||
using CompOp<DataType, nzsl::Ast::BinaryType::CompLe>::CompOp;
|
||||
|
||||
void ApplyOp(const nzsl::Vector4f* left, const nzsl::Vector4f* right, nzsl::Vector4f* output, std::size_t pixelCount) override;
|
||||
void ApplyOp(const nzsl::Vector4f32* left, const nzsl::Vector4f32* right, nzsl::Vector4f32* output, std::size_t pixelCount) override;
|
||||
QString GetOperationString() const final;
|
||||
};
|
||||
|
||||
|
|
@ -91,7 +91,7 @@ class CompLt : public CompOp<DataType, nzsl::Ast::BinaryType::CompLt>
|
|||
public:
|
||||
using CompOp<DataType, nzsl::Ast::BinaryType::CompLt>::CompOp;
|
||||
|
||||
void ApplyOp(const nzsl::Vector4f* left, const nzsl::Vector4f* right, nzsl::Vector4f* output, std::size_t pixelCount) override;
|
||||
void ApplyOp(const nzsl::Vector4f32* left, const nzsl::Vector4f32* right, nzsl::Vector4f32* output, std::size_t pixelCount) override;
|
||||
QString GetOperationString() const final;
|
||||
};
|
||||
|
||||
|
|
@ -101,7 +101,7 @@ class CompNe : public CompOp<DataType, nzsl::Ast::BinaryType::CompNe>
|
|||
public:
|
||||
using CompOp<DataType, nzsl::Ast::BinaryType::CompNe>::CompOp;
|
||||
|
||||
void ApplyOp(const nzsl::Vector4f* left, const nzsl::Vector4f* right, nzsl::Vector4f* output, std::size_t pixelCount) override;
|
||||
void ApplyOp(const nzsl::Vector4f32* left, const nzsl::Vector4f32* right, nzsl::Vector4f32* output, std::size_t pixelCount) override;
|
||||
QString GetOperationString() const final;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ void CompOp<DataType, Op>::UpdateOutput()
|
|||
{
|
||||
m_output = std::make_shared<BoolData>();
|
||||
m_output->preview = PreviewValues(1, 1);
|
||||
m_output->preview.Fill(nzsl::Vector4f(0.f, 0.f, 0.f, 0.f));
|
||||
m_output->preview.Fill(nzsl::Vector4f32(0.f, 0.f, 0.f, 0.f));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -195,12 +195,12 @@ void CompOp<DataType, Op>::UpdateOutput()
|
|||
}
|
||||
|
||||
template<typename DataType>
|
||||
void CompEq<DataType>::ApplyOp(const nzsl::Vector4f* left, const nzsl::Vector4f* right, nzsl::Vector4f* output, std::size_t pixelCount)
|
||||
void CompEq<DataType>::ApplyOp(const nzsl::Vector4f32* left, const nzsl::Vector4f32* right, nzsl::Vector4f32* output, std::size_t pixelCount)
|
||||
{
|
||||
for (std::size_t i = 0; i < pixelCount; ++i)
|
||||
{
|
||||
float r = (left[i] == right[i]) ? 1.f : 0.f;
|
||||
output[i] = nzsl::Vector4f(r, r, r, r);
|
||||
output[i] = nzsl::Vector4f32(r, r, r, r);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -211,12 +211,12 @@ QString CompEq<DataType>::GetOperationString() const
|
|||
}
|
||||
|
||||
template<typename DataType>
|
||||
void CompGe<DataType>::ApplyOp(const nzsl::Vector4f* left, const nzsl::Vector4f* right, nzsl::Vector4f* output, std::size_t pixelCount)
|
||||
void CompGe<DataType>::ApplyOp(const nzsl::Vector4f32* left, const nzsl::Vector4f32* right, nzsl::Vector4f32* output, std::size_t pixelCount)
|
||||
{
|
||||
for (std::size_t i = 0; i < pixelCount; ++i)
|
||||
{
|
||||
float r = (left[i][0] >= right[i][0]) ? 1.f : 0.f;
|
||||
output[i] = nzsl::Vector4f(r, r, r, r);
|
||||
output[i] = nzsl::Vector4f32(r, r, r, r);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -227,12 +227,12 @@ QString CompGe<DataType>::GetOperationString() const
|
|||
}
|
||||
|
||||
template<typename DataType>
|
||||
void CompGt<DataType>::ApplyOp(const nzsl::Vector4f* left, const nzsl::Vector4f* right, nzsl::Vector4f* output, std::size_t pixelCount)
|
||||
void CompGt<DataType>::ApplyOp(const nzsl::Vector4f32* left, const nzsl::Vector4f32* right, nzsl::Vector4f32* output, std::size_t pixelCount)
|
||||
{
|
||||
for (std::size_t i = 0; i < pixelCount; ++i)
|
||||
{
|
||||
float r = (left[i][0] > right[i][0]) ? 1.f : 0.f;
|
||||
output[i] = nzsl::Vector4f(r, r, r, r);
|
||||
output[i] = nzsl::Vector4f32(r, r, r, r);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -243,12 +243,12 @@ QString CompGt<DataType>::GetOperationString() const
|
|||
}
|
||||
|
||||
template<typename DataType>
|
||||
void CompLe<DataType>::ApplyOp(const nzsl::Vector4f* left, const nzsl::Vector4f* right, nzsl::Vector4f* output, std::size_t pixelCount)
|
||||
void CompLe<DataType>::ApplyOp(const nzsl::Vector4f32* left, const nzsl::Vector4f32* right, nzsl::Vector4f32* output, std::size_t pixelCount)
|
||||
{
|
||||
for (std::size_t i = 0; i < pixelCount; ++i)
|
||||
{
|
||||
float r = (left[i][0] <= right[i][0]) ? 1.f : 0.f;
|
||||
output[i] = nzsl::Vector4f(r, r, r, r);
|
||||
output[i] = nzsl::Vector4f32(r, r, r, r);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -259,12 +259,12 @@ QString CompLe<DataType>::GetOperationString() const
|
|||
}
|
||||
|
||||
template<typename DataType>
|
||||
void CompLt<DataType>::ApplyOp(const nzsl::Vector4f* left, const nzsl::Vector4f* right, nzsl::Vector4f* output, std::size_t pixelCount)
|
||||
void CompLt<DataType>::ApplyOp(const nzsl::Vector4f32* left, const nzsl::Vector4f32* right, nzsl::Vector4f32* output, std::size_t pixelCount)
|
||||
{
|
||||
for (std::size_t i = 0; i < pixelCount; ++i)
|
||||
{
|
||||
float r = (left[i][0] < right[i][0]) ? 1.f : 0.f;
|
||||
output[i] = nzsl::Vector4f(r, r, r, r);
|
||||
output[i] = nzsl::Vector4f32(r, r, r, r);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -275,12 +275,12 @@ QString CompLt<DataType>::GetOperationString() const
|
|||
}
|
||||
|
||||
template<typename DataType>
|
||||
void CompNe<DataType>::ApplyOp(const nzsl::Vector4f* left, const nzsl::Vector4f* right, nzsl::Vector4f* output, std::size_t pixelCount)
|
||||
void CompNe<DataType>::ApplyOp(const nzsl::Vector4f32* left, const nzsl::Vector4f32* right, nzsl::Vector4f32* output, std::size_t pixelCount)
|
||||
{
|
||||
for (std::size_t i = 0; i < pixelCount; ++i)
|
||||
{
|
||||
float r = (left[i] != right[i]) ? 1.f : 0.f;
|
||||
output[i] = nzsl::Vector4f(r, r, r, r);
|
||||
output[i] = nzsl::Vector4f32(r, r, r, r);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ nzsl::Ast::NodePtr Discard::BuildNode(nzsl::Ast::ExpressionPtr* expressions, std
|
|||
|
||||
using namespace nzsl;
|
||||
|
||||
auto condition = ShaderBuilder::Binary(nzsl::Ast::BinaryType::CompEq, std::move(expressions[0]), ShaderBuilder::Constant(true));
|
||||
auto condition = ShaderBuilder::Binary(nzsl::Ast::BinaryType::CompEq, std::move(expressions[0]), ShaderBuilder::ConstantValue(true));
|
||||
return ShaderBuilder::Branch(std::move(condition), ShaderBuilder::Discard());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ std::shared_ptr<QtNodes::NodeData> FloatValue::outData(QtNodes::PortIndex port)
|
|||
assert(port == 0);
|
||||
|
||||
auto out = std::make_shared<FloatData>();
|
||||
out->preview(0, 0) = nzsl::Vector4f(m_value, m_value, m_value, 1.f);
|
||||
out->preview(0, 0) = nzsl::Vector4f32(m_value, m_value, m_value, 1.f);
|
||||
|
||||
return out;
|
||||
}
|
||||
|
|
@ -94,7 +94,7 @@ nzsl::Ast::NodePtr FloatValue::BuildNode(nzsl::Ast::ExpressionPtr* expressions,
|
|||
assert(count == 0);
|
||||
assert(outputIndex == 0);
|
||||
|
||||
return nzsl::ShaderBuilder::Constant(m_value);
|
||||
return nzsl::ShaderBuilder::ConstantValue(m_value);
|
||||
}
|
||||
|
||||
bool FloatValue::ComputePreview(QPixmap& pixmap)
|
||||
|
|
|
|||
|
|
@ -148,13 +148,13 @@ void Mat4VecMul::UpdateOutput()
|
|||
{
|
||||
m_output = std::make_shared<VecData>(4);
|
||||
m_output->preview = PreviewValues(1, 1);
|
||||
m_output->preview.Fill(nzsl::Vector4f(0.f, 0.f, 0.f, 0.f));
|
||||
m_output->preview.Fill(nzsl::Vector4f32(0.f, 0.f, 0.f, 0.f));
|
||||
return;
|
||||
}
|
||||
|
||||
m_output = std::make_shared<VecData>(4);
|
||||
m_output->preview = PreviewValues(1, 1);
|
||||
m_output->preview.Fill(nzsl::Vector4f(0.f, 0.f, 0.f, 0.f));
|
||||
m_output->preview.Fill(nzsl::Vector4f32(0.f, 0.f, 0.f, 0.f));
|
||||
|
||||
/*m_output = std::make_shared<VecData>(m_rhs->componentCount);
|
||||
|
||||
|
|
@ -174,9 +174,9 @@ void Mat4VecMul::UpdateOutput()
|
|||
|
||||
m_output->preview = PreviewValues(maxWidth, maxHeight);
|
||||
|
||||
const nzsl::Vector4f* left = leftResized.GetData();
|
||||
const nzsl::Vector4f* right = rightPreview.GetData();
|
||||
nzsl::Vector4f* output = m_output->preview.GetData();
|
||||
const nzsl::Vector4f32* left = leftResized.GetData();
|
||||
const nzsl::Vector4f32* right = rightPreview.GetData();
|
||||
nzsl::Vector4f32* output = m_output->preview.GetData();
|
||||
|
||||
std::size_t pixelCount = maxWidth * maxHeight;
|
||||
for (std::size_t i = 0; i < pixelCount; ++i)
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ void SampleTexture::UpdateOutput()
|
|||
if (!m_texture || !m_uv)
|
||||
{
|
||||
output = PreviewValues(1, 1);
|
||||
output.Fill(nzsl::Vector4f(0.f, 0.f, 0.f, 0.f));
|
||||
output.Fill(nzsl::Vector4f32(0.f, 0.f, 0.f, 0.f));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -48,12 +48,12 @@ void SampleTexture::UpdateOutput()
|
|||
{
|
||||
for (std::size_t x = 0; x < uvWidth; ++x)
|
||||
{
|
||||
nzsl::Vector4f uvValue = uv(x, y);
|
||||
nzsl::Vector4f32 uvValue = uv(x, y);
|
||||
|
||||
if (textureWidth > 0 && textureHeight > 0)
|
||||
output(x, y) = texturePreview.Sample(uvValue.x(), uvValue.y());
|
||||
else
|
||||
output(x, y) = nzsl::Vector4f(0.f, 0.f, 0.f, 1.f);
|
||||
output(x, y) = nzsl::Vector4f32(0.f, 0.f, 0.f, 1.f);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ std::shared_ptr<QtNodes::NodeData> TextureValue::outData(QtNodes::PortIndex port
|
|||
{
|
||||
QColor pixelColor = previewImage.pixelColor(int(x), int(y));
|
||||
|
||||
textureData->preview(x, y) = nzsl::Vector4f(pixelColor.redF(), pixelColor.greenF(), pixelColor.blueF(), pixelColor.alphaF());
|
||||
textureData->preview(x, y) = nzsl::Vector4f32(pixelColor.redF(), pixelColor.greenF(), pixelColor.blueF(), pixelColor.alphaF());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ void VecComposition<ComponentCount>::UpdateOutput()
|
|||
if (validationState() != QtNodes::NodeValidationState::Valid)
|
||||
{
|
||||
m_output->preview = PreviewValues(1, 1);
|
||||
m_output->preview(0, 0) = nzsl::Vector4f(0.f, 0.f, 0.f, 0.f);
|
||||
m_output->preview(0, 0) = nzsl::Vector4f32(0.f, 0.f, 0.f, 0.f);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -177,7 +177,7 @@ void VecComposition<ComponentCount>::UpdateOutput()
|
|||
{
|
||||
for (std::size_t x = 0; x < maxInputWidth; ++x)
|
||||
{
|
||||
nzsl::Vector4f color(0.f, 0.f, 0.f, 1.f);
|
||||
nzsl::Vector4f32 color(0.f, 0.f, 0.f, 1.f);
|
||||
for (std::size_t i = 0; i < ComponentCount; ++i)
|
||||
color[i] = previewResized[i](x, y)[0];
|
||||
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ void VecDecomposition::UpdateOutputs()
|
|||
{
|
||||
auto dummy = std::make_shared<FloatData>();
|
||||
dummy->preview = PreviewValues(1, 1);
|
||||
dummy->preview.Fill(nzsl::Vector4f(0.f, 0.f, 0.f, 0.f));
|
||||
dummy->preview.Fill(nzsl::Vector4f32(0.f, 0.f, 0.f, 0.f));
|
||||
|
||||
m_outputs.fill(dummy);
|
||||
return;
|
||||
|
|
@ -154,13 +154,13 @@ void VecDecomposition::UpdateOutputs()
|
|||
m_outputs[i] = std::make_shared<FloatData>();
|
||||
m_outputs[i]->preview = PreviewValues(previewWidth, previewHeight);
|
||||
|
||||
const nzsl::Vector4f* inputData = m_input->preview.GetData();
|
||||
nzsl::Vector4f* outputData = m_outputs[i]->preview.GetData();
|
||||
const nzsl::Vector4f32* inputData = m_input->preview.GetData();
|
||||
nzsl::Vector4f32* outputData = m_outputs[i]->preview.GetData();
|
||||
for (std::size_t j = 0; j < pixelCount; ++j)
|
||||
{
|
||||
const nzsl::Vector4f& input = *inputData++;
|
||||
const nzsl::Vector4f32& input = *inputData++;
|
||||
|
||||
*outputData++ = nzsl::Vector4f(input[i], input[i], input[i], input[i]);
|
||||
*outputData++ = nzsl::Vector4f32(input[i], input[i], input[i], input[i]);
|
||||
}
|
||||
|
||||
Q_EMIT dataUpdated(i);
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ void VecDot::UpdateOutput()
|
|||
if (validationState() != QtNodes::NodeValidationState::Valid)
|
||||
{
|
||||
m_output->preview = PreviewValues(1, 1);
|
||||
m_output->preview.Fill(nzsl::Vector4f(0.f, 0.f, 0.f, 0.f));
|
||||
m_output->preview.Fill(nzsl::Vector4f32(0.f, 0.f, 0.f, 0.f));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -146,9 +146,9 @@ void VecDot::UpdateOutput()
|
|||
|
||||
m_output->preview = PreviewValues(maxWidth, maxHeight);
|
||||
|
||||
const nzsl::Vector4f* left = leftResized.GetData();
|
||||
const nzsl::Vector4f* right = rightPreview.GetData();
|
||||
nzsl::Vector4f* output = m_output->preview.GetData();
|
||||
const nzsl::Vector4f32* left = leftResized.GetData();
|
||||
const nzsl::Vector4f32* right = rightPreview.GetData();
|
||||
nzsl::Vector4f32* output = m_output->preview.GetData();
|
||||
|
||||
std::size_t pixelCount = maxWidth * maxHeight;
|
||||
for (std::size_t i = 0; i < pixelCount; ++i)
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ void VecFloatMul::UpdateOutput()
|
|||
{
|
||||
m_output = std::make_shared<VecData>(4);
|
||||
m_output->preview = PreviewValues(1, 1);
|
||||
m_output->preview.Fill(nzsl::Vector4f(0.f, 0.f, 0.f, 0.f));
|
||||
m_output->preview.Fill(nzsl::Vector4f32(0.f, 0.f, 0.f, 0.f));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -164,9 +164,9 @@ void VecFloatMul::UpdateOutput()
|
|||
|
||||
m_output->preview = PreviewValues(maxWidth, maxHeight);
|
||||
|
||||
const nzsl::Vector4f* left = leftResized.GetData();
|
||||
const nzsl::Vector4f* right = rightPreview.GetData();
|
||||
nzsl::Vector4f* output = m_output->preview.GetData();
|
||||
const nzsl::Vector4f32* left = leftResized.GetData();
|
||||
const nzsl::Vector4f32* right = rightPreview.GetData();
|
||||
nzsl::Vector4f32* output = m_output->preview.GetData();
|
||||
|
||||
std::size_t pixelCount = maxWidth * maxHeight;
|
||||
for (std::size_t i = 0; i < pixelCount; ++i)
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ std::shared_ptr<QtNodes::NodeData> VecValue<ComponentCount>::outData(QtNodes::Po
|
|||
values[i] = m_value[i];
|
||||
|
||||
out->preview = PreviewValues(1, 1);
|
||||
out->preview(0, 0) = nzsl::Vector4f(values[0], values[1], values[2], values[3]);
|
||||
out->preview(0, 0) = nzsl::Vector4f32(values[0], values[1], values[2], values[3]);
|
||||
|
||||
return out;
|
||||
}
|
||||
|
|
@ -128,7 +128,7 @@ nzsl::Ast::NodePtr VecValue<ComponentCount>::BuildNode(nzsl::Ast::ExpressionPtr*
|
|||
assert(count == 0);
|
||||
assert(outputIndex == 0);
|
||||
|
||||
return nzsl::ShaderBuilder::Constant(m_value);
|
||||
return nzsl::ShaderBuilder::ConstantValue(m_value);
|
||||
}
|
||||
|
||||
template<std::size_t ComponentCount>
|
||||
|
|
|
|||
|
|
@ -3,5 +3,5 @@
|
|||
inline BoolData::BoolData() :
|
||||
preview(1, 1)
|
||||
{
|
||||
preview(0, 0) = nzsl::Vector4f(1.f, 1.f, 1.f, 0.f);
|
||||
preview(0, 0) = nzsl::Vector4f32(1.f, 1.f, 1.f, 0.f);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,5 +3,5 @@
|
|||
inline FloatData::FloatData() :
|
||||
preview(1, 1)
|
||||
{
|
||||
preview(0, 0) = nzsl::Vector4f(1.f, 1.f, 1.f, 0.f);
|
||||
preview(0, 0) = nzsl::Vector4f32(1.f, 1.f, 1.f, 0.f);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,5 +3,5 @@
|
|||
inline TextureData::TextureData() :
|
||||
preview(64, 64)
|
||||
{
|
||||
preview.Fill(nzsl::Vector4f(1.f, 1.f, 1.f, 0.f));
|
||||
preview.Fill(nzsl::Vector4f32(1.f, 1.f, 1.f, 0.f));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ inline VecData::VecData(std::size_t ComponentCount) :
|
|||
componentCount(ComponentCount),
|
||||
preview(64, 64)
|
||||
{
|
||||
preview.Fill(nzsl::Vector4f(1.f, 1.f, 1.f, 0.f));
|
||||
preview.Fill(nzsl::Vector4f32(1.f, 1.f, 1.f, 0.f));
|
||||
}
|
||||
|
||||
inline QtNodes::NodeDataType VecData::type() const
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ m_width(width)
|
|||
m_values.resize(m_width * m_height); //< RGBA
|
||||
}
|
||||
|
||||
void PreviewValues::Fill(const nzsl::Vector4f& value)
|
||||
void PreviewValues::Fill(const nzsl::Vector4f32& value)
|
||||
{
|
||||
std::fill(m_values.begin(), m_values.end(), value);
|
||||
}
|
||||
|
|
@ -24,7 +24,7 @@ QImage PreviewValues::GenerateImage() const
|
|||
|
||||
Nz::UInt8* ptr = preview.bits();
|
||||
|
||||
const nzsl::Vector4f* src = m_values.data();
|
||||
const nzsl::Vector4f32* src = m_values.data();
|
||||
for (std::size_t i = 0; i < m_values.size(); ++i)
|
||||
{
|
||||
for (std::size_t y = 0; y < 4; ++y)
|
||||
|
|
@ -52,7 +52,7 @@ PreviewValues PreviewValues::Resized(std::size_t newWidth, std::size_t newHeight
|
|||
return resizedPreview;
|
||||
}
|
||||
|
||||
nzsl::Vector4f PreviewValues::Sample(float u, float v) const
|
||||
nzsl::Vector4f32 PreviewValues::Sample(float u, float v) const
|
||||
{
|
||||
// Bilinear filtering
|
||||
float x = std::clamp(u * m_width, 0.f, m_width - 1.f);
|
||||
|
|
@ -64,7 +64,7 @@ nzsl::Vector4f PreviewValues::Sample(float u, float v) const
|
|||
float dX = x - iX;
|
||||
float dY = y - iY;
|
||||
|
||||
auto ColorAt = [&](std::size_t x, std::size_t y) -> nzsl::Vector4f
|
||||
auto ColorAt = [&](std::size_t x, std::size_t y) -> nzsl::Vector4f32
|
||||
{
|
||||
x = std::min(x, m_width - 1);
|
||||
y = std::min(y, m_height - 1);
|
||||
|
|
@ -72,22 +72,22 @@ nzsl::Vector4f PreviewValues::Sample(float u, float v) const
|
|||
return m_values[y * m_width + x];
|
||||
};
|
||||
|
||||
nzsl::Vector4f d00 = ColorAt(iX, iY);
|
||||
nzsl::Vector4f d10 = ColorAt(iX + 1, iY);
|
||||
nzsl::Vector4f d01 = ColorAt(iX, iY + 1);
|
||||
nzsl::Vector4f d11 = ColorAt(iX + 1, iY + 1);
|
||||
nzsl::Vector4f32 d00 = ColorAt(iX, iY);
|
||||
nzsl::Vector4f32 d10 = ColorAt(iX + 1, iY);
|
||||
nzsl::Vector4f32 d01 = ColorAt(iX, iY + 1);
|
||||
nzsl::Vector4f32 d11 = ColorAt(iX + 1, iY + 1);
|
||||
|
||||
return Nz::Lerp(Nz::Lerp(d00, d10, dX), Nz::Lerp(d01, d11, dX), dY);
|
||||
}
|
||||
|
||||
nzsl::Vector4f& PreviewValues::operator()(std::size_t x, std::size_t y)
|
||||
nzsl::Vector4f32& PreviewValues::operator()(std::size_t x, std::size_t y)
|
||||
{
|
||||
assert(x < m_width);
|
||||
assert(y < m_height);
|
||||
return m_values[y * m_width + x];
|
||||
}
|
||||
|
||||
nzsl::Vector4f PreviewValues::operator()(std::size_t x, std::size_t y) const
|
||||
nzsl::Vector4f32 PreviewValues::operator()(std::size_t x, std::size_t y) const
|
||||
{
|
||||
assert(x < m_width);
|
||||
assert(y < m_height);
|
||||
|
|
|
|||
|
|
@ -20,21 +20,21 @@ class PreviewValues
|
|||
PreviewValues(PreviewValues&&) = default;
|
||||
~PreviewValues() = default;
|
||||
|
||||
void Fill(const nzsl::Vector4f& value);
|
||||
void Fill(const nzsl::Vector4f32& value);
|
||||
|
||||
QImage GenerateImage() const;
|
||||
|
||||
inline nzsl::Vector4f* GetData();
|
||||
inline const nzsl::Vector4f* GetData() const;
|
||||
inline nzsl::Vector4f32* GetData();
|
||||
inline const nzsl::Vector4f32* GetData() const;
|
||||
inline std::size_t GetHeight() const;
|
||||
inline std::size_t GetWidth() const;
|
||||
|
||||
PreviewValues Resized(std::size_t newWidth, std::size_t newHeight) const;
|
||||
|
||||
nzsl::Vector4f Sample(float u, float v) const;
|
||||
nzsl::Vector4f32 Sample(float u, float v) const;
|
||||
|
||||
nzsl::Vector4f& operator()(std::size_t x, std::size_t y);
|
||||
nzsl::Vector4f operator()(std::size_t x, std::size_t y) const;
|
||||
nzsl::Vector4f32& operator()(std::size_t x, std::size_t y);
|
||||
nzsl::Vector4f32 operator()(std::size_t x, std::size_t y) const;
|
||||
|
||||
PreviewValues& operator=(const PreviewValues&) = default;
|
||||
PreviewValues& operator=(PreviewValues&&) = default;
|
||||
|
|
@ -42,7 +42,7 @@ class PreviewValues
|
|||
private:
|
||||
std::size_t m_height;
|
||||
std::size_t m_width;
|
||||
std::vector<nzsl::Vector4f> m_values;
|
||||
std::vector<nzsl::Vector4f32> m_values;
|
||||
};
|
||||
|
||||
#include <ShaderNode/Previews/PreviewValues.inl>
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
#include <ShaderNode/Previews/PreviewValues.hpp>
|
||||
|
||||
inline nzsl::Vector4f* PreviewValues::GetData()
|
||||
inline nzsl::Vector4f32* PreviewValues::GetData()
|
||||
{
|
||||
return m_values.data();
|
||||
}
|
||||
|
||||
inline const nzsl::Vector4f* PreviewValues::GetData() const
|
||||
inline const nzsl::Vector4f32* PreviewValues::GetData() const
|
||||
{
|
||||
return m_values.data();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ PreviewValues QuadPreview::GetPreview(InputRole role, std::size_t roleIndex) con
|
|||
if (role != InputRole::TexCoord)
|
||||
{
|
||||
PreviewValues dummy(1, 1);
|
||||
dummy(0, 0) = nzsl::Vector4f(0.f, 0.f, 0.f, 0.f);
|
||||
dummy(0, 0) = nzsl::Vector4f32(0.f, 0.f, 0.f, 0.f);
|
||||
|
||||
return dummy;
|
||||
}
|
||||
|
|
@ -19,7 +19,7 @@ PreviewValues QuadPreview::GetPreview(InputRole role, std::size_t roleIndex) con
|
|||
for (std::size_t y = 0; y < uv.GetHeight(); ++y)
|
||||
{
|
||||
for (std::size_t x = 0; x < uv.GetWidth(); ++x)
|
||||
uv(x, y) = nzsl::Vector4f(x * invWidth, y * invHeight, 0.f, 1.f);
|
||||
uv(x, y) = nzsl::Vector4f32(x * invWidth, y * invHeight, 0.f, 1.f);
|
||||
}
|
||||
|
||||
return uv;
|
||||
|
|
|
|||
Loading…
Reference in New Issue