Tech ENABLE_GLBEGIN_GLEND_REMOVAL - Use 2D vertices to render GLGizmoPainterBase circle

(cherry picked from commit prusa3d/PrusaSlicer@5193a15852)
This commit is contained in:
enricoturri1966 2023-10-24 10:22:34 +08:00 committed by Noisyfox
parent 61ed6143e6
commit d8551d7a7d

View file

@ -201,7 +201,7 @@ void GLGizmoPainterBase::render_cursor_circle()
GLModel::Geometry init_data; GLModel::Geometry init_data;
static const unsigned int StepsCount = 32; static const unsigned int StepsCount = 32;
static const float StepSize = 2.0f * float(PI) / float(StepsCount); 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.color = { 0.0f, 1.0f, 0.3f, 1.0f };
init_data.reserve_vertices(StepsCount); init_data.reserve_vertices(StepsCount);
init_data.reserve_indices(StepsCount); init_data.reserve_indices(StepsCount);
@ -209,7 +209,7 @@ void GLGizmoPainterBase::render_cursor_circle()
// vertices + indices // vertices + indices
for (unsigned short i = 0; i < StepsCount; ++i) { for (unsigned short i = 0; i < StepsCount; ++i) {
const float angle = float(i * StepSize); 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); init_data.add_ushort_index(i);
} }