Tech ENABLE_GLBEGIN_GLEND_REMOVAL - Use 2D vertices to render GLGizmoPainterBase circle

This commit is contained in:
enricoturri1966 2022-03-02 12:10:02 +01:00
parent b2fba940fe
commit 5193a15852

View file

@ -192,7 +192,7 @@ void GLGizmoPainterBase::render_cursor_circle()
GLModel::Geometry init_data;
static const unsigned int StepsCount = 32;
static const float StepSize = 2.0f * float(PI) / float(StepsCount);
init_data.format = { GLModel::Geometry::EPrimitiveType::LineLoop, GLModel::Geometry::EVertexLayout::P3, GLModel::Geometry::EIndexType::USHORT };
init_data.format = { GLModel::Geometry::EPrimitiveType::LineLoop, GLModel::Geometry::EVertexLayout::P2, GLModel::Geometry::EIndexType::USHORT };
init_data.color = { 0.0f, 1.0f, 0.3f, 1.0f };
init_data.reserve_vertices(StepsCount);
init_data.reserve_indices(StepsCount);
@ -200,7 +200,7 @@ void GLGizmoPainterBase::render_cursor_circle()
// vertices + indices
for (unsigned short i = 0; i < StepsCount; ++i) {
const float angle = float(i * StepSize);
init_data.add_vertex(Vec3f(center.x() + ::cos(angle) * m_cursor_radius, center.y() + ::sin(angle) * m_cursor_radius, 0.0f));
init_data.add_vertex(Vec2f(center.x() + ::cos(angle) * m_cursor_radius, center.y() + ::sin(angle) * m_cursor_radius));
init_data.add_ushort_index(i);
}