Use enum class instead of plain enum for PrimitiveType (#2286)
Co-authored-by: Jean Tampon <jean.tampon@gmail.com>
This commit is contained in:
parent
8e3efab09d
commit
510068d501
@ -99,7 +99,7 @@ int main()
|
||||
sf::Text statusText;
|
||||
sf::Shader terrainShader;
|
||||
sf::RenderStates terrainStates(&terrainShader);
|
||||
sf::VertexBuffer terrain(sf::Triangles, sf::VertexBuffer::Static);
|
||||
sf::VertexBuffer terrain(sf::PrimitiveType::Triangles, sf::VertexBuffer::Static);
|
||||
|
||||
// Set up our text drawables
|
||||
statusText.setFont(font);
|
||||
|
@ -140,7 +140,7 @@ public:
|
||||
std::uniform_int_distribution<std::uint16_t> color_distribution(0, 255);
|
||||
|
||||
// Create the points
|
||||
m_points.setPrimitiveType(sf::Points);
|
||||
m_points.setPrimitiveType(sf::PrimitiveType::Points);
|
||||
for (int i = 0; i < 40000; ++i)
|
||||
{
|
||||
auto x = x_distribution(rng);
|
||||
@ -270,7 +270,7 @@ private:
|
||||
class Geometry : public Effect
|
||||
{
|
||||
public:
|
||||
Geometry() : Effect("Geometry Shader Billboards"), m_pointCloud(sf::Points, 10000)
|
||||
Geometry() : Effect("Geometry Shader Billboards"), m_pointCloud(sf::PrimitiveType::Points, 10000)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ namespace sf
|
||||
/// and view.
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
enum PrimitiveType
|
||||
enum class PrimitiveType
|
||||
{
|
||||
Points, //!< List of individual points
|
||||
Lines, //!< List of individual lines
|
||||
|
@ -725,7 +725,7 @@ void RenderTarget::drawPrimitives(PrimitiveType type, std::size_t firstVertex, s
|
||||
{
|
||||
// Find the OpenGL primitive type
|
||||
static constexpr GLenum modes[] = {GL_POINTS, GL_LINES, GL_LINE_STRIP, GL_TRIANGLES, GL_TRIANGLE_STRIP, GL_TRIANGLE_FAN};
|
||||
GLenum mode = modes[type];
|
||||
GLenum mode = modes[static_cast<std::size_t>(type)];
|
||||
|
||||
// Draw the primitives
|
||||
glCheck(glDrawArrays(mode, static_cast<GLint>(firstVertex), static_cast<GLsizei>(vertexCount)));
|
||||
|
@ -155,8 +155,8 @@ m_textureRect(),
|
||||
m_fillColor(255, 255, 255),
|
||||
m_outlineColor(255, 255, 255),
|
||||
m_outlineThickness(0),
|
||||
m_vertices(TriangleFan),
|
||||
m_outlineVertices(TriangleStrip),
|
||||
m_vertices(PrimitiveType::TriangleFan),
|
||||
m_outlineVertices(PrimitiveType::TriangleStrip),
|
||||
m_insideBounds(),
|
||||
m_bounds()
|
||||
{
|
||||
|
@ -141,7 +141,7 @@ void Sprite::draw(RenderTarget& target, const RenderStates& states) const
|
||||
|
||||
statesCopy.transform *= getTransform();
|
||||
statesCopy.texture = m_texture;
|
||||
target.draw(m_vertices, 4, TriangleStrip, statesCopy);
|
||||
target.draw(m_vertices, 4, PrimitiveType::TriangleStrip, statesCopy);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -104,8 +104,8 @@ m_style(Regular),
|
||||
m_fillColor(255, 255, 255),
|
||||
m_outlineColor(0, 0, 0),
|
||||
m_outlineThickness(0),
|
||||
m_vertices(Triangles),
|
||||
m_outlineVertices(Triangles),
|
||||
m_vertices(PrimitiveType::Triangles),
|
||||
m_outlineVertices(PrimitiveType::Triangles),
|
||||
m_bounds(),
|
||||
m_geometryNeedUpdate(false),
|
||||
m_fontTextureId(0)
|
||||
@ -124,8 +124,8 @@ m_style(Regular),
|
||||
m_fillColor(255, 255, 255),
|
||||
m_outlineColor(0, 0, 0),
|
||||
m_outlineThickness(0),
|
||||
m_vertices(Triangles),
|
||||
m_outlineVertices(Triangles),
|
||||
m_vertices(PrimitiveType::Triangles),
|
||||
m_outlineVertices(PrimitiveType::Triangles),
|
||||
m_bounds(),
|
||||
m_geometryNeedUpdate(true),
|
||||
m_fontTextureId(0)
|
||||
|
@ -32,7 +32,7 @@
|
||||
namespace sf
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
VertexArray::VertexArray() : m_vertices(), m_primitiveType(Points)
|
||||
VertexArray::VertexArray() : m_vertices(), m_primitiveType(PrimitiveType::Points)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,7 @@ GLenum usageToGlEnum(sf::VertexBuffer::Usage usage)
|
||||
namespace sf
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
VertexBuffer::VertexBuffer() : m_buffer(0), m_size(0), m_primitiveType(Points), m_usage(Stream)
|
||||
VertexBuffer::VertexBuffer() : m_buffer(0), m_size(0), m_primitiveType(PrimitiveType::Points), m_usage(Stream)
|
||||
{
|
||||
}
|
||||
|
||||
@ -75,7 +75,11 @@ VertexBuffer::VertexBuffer(PrimitiveType type) : m_buffer(0), m_size(0), m_primi
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
VertexBuffer::VertexBuffer(VertexBuffer::Usage usage) : m_buffer(0), m_size(0), m_primitiveType(Points), m_usage(usage)
|
||||
VertexBuffer::VertexBuffer(VertexBuffer::Usage usage) :
|
||||
m_buffer(0),
|
||||
m_size(0),
|
||||
m_primitiveType(PrimitiveType::Points),
|
||||
m_usage(usage)
|
||||
{
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user