28 using ProgramType = isf::parser::ShaderType;
35 : type{isf::parser::ShaderType::ISF}
43 SCORE_ASSERT(vec.size() == 2);
44 type = isf::parser::ShaderType::ISF;
48 ShaderSource(ProgramType tp,
const QString& vert,
const QString& frag)
55 ShaderSource(ProgramType tp,
const std::vector<QString>& vec)
57 SCORE_ASSERT(vec.size() == 2);
65 SCORE_ASSERT(vec.size() == 2);
67 fragment = std::move(vec[0]);
68 vertex = std::move(vec[1]);
82 const std::string_view language{};
85 static const inline std::array<MemberSpec, 2> specification{
86 MemberSpec{QObject::tr(
"Fragment"), &ShaderSource::fragment,
"GLSL"},
87 MemberSpec{QObject::tr(
"Vertex"), &ShaderSource::vertex,
"GLSL"},
90 friend QDebug& operator<<(QDebug& d,
const ShaderSource& sp)
92 return (d << sp.vertex << sp.fragment);
94 friend bool operator==(
const ShaderSource& lhs,
const ShaderSource& rhs)
noexcept
96 return lhs.vertex == rhs.vertex && lhs.fragment == rhs.fragment;
98 friend bool operator!=(
const ShaderSource& lhs,
const ShaderSource& rhs)
noexcept
100 return !(lhs == rhs);
104 operator==(
const std::vector<QString>& lhs,
const ShaderSource& rhs)
noexcept
106 SCORE_ASSERT(lhs.size() == 2);
107 return lhs[0] == rhs.*(ShaderSource::specification[0].pointer)
108 && lhs[1] == rhs.*(ShaderSource::specification[1].pointer);
111 operator!=(
const std::vector<QString>& lhs,
const ShaderSource& rhs)
noexcept
113 return !(lhs == rhs);
117ShaderSource programFromISFFragmentShaderPath(
const QString& fsFilename, QByteArray fsData);
119programFromVSAVertexShaderPath(
const QString& vertexFilename, QByteArray vertexData);