mirror of
https://github.com/SFML/SFML.git
synced 2024-11-28 22:31:09 +08:00
Make Shader::Type a scoped enumeration
This commit is contained in:
parent
b496877c90
commit
a019b5167b
@ -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);
|
||||
|
||||
|
@ -59,7 +59,7 @@ public:
|
||||
/// \brief Types of shaders
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
enum Type
|
||||
enum class Type
|
||||
{
|
||||
Vertex, //!< %Vertex shader
|
||||
Geometry, //!< Geometry shader
|
||||
|
@ -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());
|
||||
|
Loading…
Reference in New Issue
Block a user