Make Shader::Type a scoped enumeration

This commit is contained in:
kimci86 2024-01-27 15:36:42 +01:00 committed by Chris Thrasher
parent b496877c90
commit a019b5167b
3 changed files with 9 additions and 9 deletions

View File

@ -33,7 +33,7 @@ public:
m_sprite.emplace(m_texture);
// Load the shader
if (!m_shader.loadFromFile("resources/pixelate.frag", sf::Shader::Fragment))
if (!m_shader.loadFromFile("resources/pixelate.frag", sf::Shader::Type::Fragment))
return false;
m_shader.setUniform("texture", sf::Shader::CurrentTexture);
@ -209,7 +209,7 @@ public:
}
// Load the shader
if (!m_shader.loadFromFile("resources/edge.frag", sf::Shader::Fragment))
if (!m_shader.loadFromFile("resources/edge.frag", sf::Shader::Type::Fragment))
return false;
m_shader.setUniform("texture", sf::Shader::CurrentTexture);

View File

@ -59,7 +59,7 @@ public:
/// \brief Types of shaders
///
////////////////////////////////////////////////////////////
enum Type
enum class Type
{
Vertex, //!< %Vertex shader
Geometry, //!< Geometry shader

View File

@ -281,9 +281,9 @@ bool Shader::loadFromFile(const std::filesystem::path& filename, Type type)
}
// Compile the shader program
if (type == Vertex)
if (type == Type::Vertex)
return compile(shader.data(), nullptr, nullptr);
else if (type == Geometry)
else if (type == Type::Geometry)
return compile(nullptr, shader.data(), nullptr);
else
return compile(nullptr, nullptr, shader.data());
@ -353,9 +353,9 @@ bool Shader::loadFromFile(const std::filesystem::path& vertexShaderFilename,
bool Shader::loadFromMemory(const std::string& shader, Type type)
{
// Compile the shader program
if (type == Vertex)
if (type == Type::Vertex)
return compile(shader.c_str(), nullptr, nullptr);
else if (type == Geometry)
else if (type == Type::Geometry)
return compile(nullptr, shader.c_str(), nullptr);
else
return compile(nullptr, nullptr, shader.c_str());
@ -390,9 +390,9 @@ bool Shader::loadFromStream(InputStream& stream, Type type)
}
// Compile the shader program
if (type == Vertex)
if (type == Type::Vertex)
return compile(shader.data(), nullptr, nullptr);
else if (type == Geometry)
else if (type == Type::Geometry)
return compile(nullptr, shader.data(), nullptr);
else
return compile(nullptr, nullptr, shader.data());