#pragma once #ifndef NAZARA_SHADERNODES_VECBINOP_HPP #define NAZARA_SHADERNODES_VECBINOP_HPP #include #include template class VecBinOp : public ShaderNode { public: VecBinOp(ShaderGraph& graph); ~VecBinOp() = default; Nz::ShaderNodes::ExpressionPtr GetExpression(Nz::ShaderNodes::ExpressionPtr* expressions, std::size_t count) const override; unsigned int nPorts(QtNodes::PortType portType) const override; QtNodes::NodeDataType dataType(QtNodes::PortType portType, QtNodes::PortIndex portIndex) const override; std::shared_ptr outData(QtNodes::PortIndex port) override; void setInData(std::shared_ptr value, int index) override; QtNodes::NodeValidationState validationState() const override; QString validationMessage() const override; private: virtual void ApplyOp(const Nz::Vector4f* left, const Nz::Vector4f* right, Nz::Vector4f* output, std::size_t pixelCount) = 0; bool ComputePreview(QPixmap& pixmap) override; void UpdateOutput(); std::shared_ptr m_lhs; std::shared_ptr m_rhs; std::shared_ptr m_output; }; class VecAdd : public VecBinOp { public: using VecBinOp::VecBinOp; QString caption() const override; QString name() const override; void ApplyOp(const Nz::Vector4f* left, const Nz::Vector4f* right, Nz::Vector4f* output, std::size_t pixelCount) override; }; class VecMul : public VecBinOp { public: using VecBinOp::VecBinOp; QString caption() const override; QString name() const override; void ApplyOp(const Nz::Vector4f* left, const Nz::Vector4f* right, Nz::Vector4f* output, std::size_t pixelCount) override; }; class VecSub : public VecBinOp { public: using VecBinOp::VecBinOp; QString caption() const override; QString name() const override; void ApplyOp(const Nz::Vector4f* left, const Nz::Vector4f* right, Nz::Vector4f* output, std::size_t pixelCount) override; }; class VecDiv : public VecBinOp { public: using VecBinOp::VecBinOp; QString caption() const override; QString name() const override; void ApplyOp(const Nz::Vector4f* left, const Nz::Vector4f* right, Nz::Vector4f* output, std::size_t pixelCount) override; }; #include #endif