From 17a8b1c702402d192ffe1c290e212b2e375f4605 Mon Sep 17 00:00:00 2001 From: Oliver Bock <oliver.bock@aei.mpg.de> Date: Thu, 7 Sep 2017 08:00:18 +0200 Subject: [PATCH] Always show normal --- src/pulsaranimationwidget.cpp | 80 +++++++++++++++++------------------ 1 file changed, 39 insertions(+), 41 deletions(-) diff --git a/src/pulsaranimationwidget.cpp b/src/pulsaranimationwidget.cpp index baa1553..2f4851b 100644 --- a/src/pulsaranimationwidget.cpp +++ b/src/pulsaranimationwidget.cpp @@ -332,53 +332,51 @@ void PulsarAnimationWidget::paintGL() glRotatef(m_pulsarSpinAxisInclination, 1.0, 0.0, 0.0); glRotatef(-45, 1.0, 0.0, 0.0); - // draw spin axis - if(m_showRotationAxes) { - glColor3f(1.0f, 0.0f, 0.0f); - glPushMatrix(); - { - glTranslatef(0.0, 0.0, -2.0); - gluCylinder(m_quadricPulsarSpinAxis, 0.020, 0.020, 4.0, 32, 1); - } - glPopMatrix(); - glPushMatrix(); - { - glTranslatef(0.0, 0.0, -2.0); - gluDisk(m_quadricPulsarSpinAxisTop1, 0, 0.020, 32, 8); - } - glPopMatrix(); - glPushMatrix(); - { - glTranslatef(0.0, 0.0, 2.0); - gluDisk(m_quadricPulsarSpinAxisTop2, 0, 0.020, 32, 8); - } - glPopMatrix(); + // draw source plane normal + glColor3f(1.0f, 0.0f, 0.0f); + glPushMatrix(); + { + glTranslatef(0.0, 0.0, -2.0); + gluCylinder(m_quadricPulsarSpinAxis, 0.020, 0.020, 4.0, 32, 1); + } + glPopMatrix(); + glPushMatrix(); + { + glTranslatef(0.0, 0.0, -2.0); + gluDisk(m_quadricPulsarSpinAxisTop1, 0, 0.020, 32, 8); + } + glPopMatrix(); + glPushMatrix(); + { + glTranslatef(0.0, 0.0, 2.0); + gluDisk(m_quadricPulsarSpinAxisTop2, 0, 0.020, 32, 8); + } + glPopMatrix(); - glPushMatrix(); + glPushMatrix(); + { + glTranslatef(0.0, 0.0, 2.0f - 0.75f); + glBegin(GL_TRIANGLE_FAN); { - glTranslatef(0.0, 0.0, 2.0f - 0.75f); - glBegin(GL_TRIANGLE_FAN); + // Pinnacle of cone is shared vertex for fan, moved up z-axis + // to produce a cone instead of a circle + glVertex3f(0.0f, 0.0f, 0.75f); + + // Loop around in a circle and specify even points along the circle + // as the vertices of the triangle fan (32 sections) + for(angle = 0.0f; angle < (2.0f*PI); angle += (PI/32.0f)) { - // Pinnacle of cone is shared vertex for fan, moved up z-axis - // to produce a cone instead of a circle - glVertex3f(0.0f, 0.0f, 0.75f); - - // Loop around in a circle and specify even points along the circle - // as the vertices of the triangle fan (32 sections) - for(angle = 0.0f; angle < (2.0f*PI); angle += (PI/32.0f)) - { - // Calculate x and y position of the next vertex - x = 0.25f * sin(angle); - y = 0.25f * cos(angle); - - // Specify the next vertex for the triangle fan - glVertex2f(x, y); - } + // Calculate x and y position of the next vertex + x = 0.25f * sin(angle); + y = 0.25f * cos(angle); + + // Specify the next vertex for the triangle fan + glVertex2f(x, y); } - glEnd(); } - glPopMatrix(); + glEnd(); } + glPopMatrix(); // draw disc glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, translucent); -- GitLab