Skip to content
Snippets Groups Projects
Commit 84bb731f authored by Oliver Bock's avatar Oliver Bock
Browse files

Fixed indentation (using blocks for gl[Push|Pop]Matrix and gl[Begin|End] to aid formatter)

parent 32563bde
No related branches found
No related tags found
No related merge requests found
...@@ -259,9 +259,12 @@ void PulsarAnimationWidget::paintGL() ...@@ -259,9 +259,12 @@ void PulsarAnimationWidget::paintGL()
// let's draw everything as wireframe model // let's draw everything as wireframe model
glPolygonMode(GL_FRONT_AND_BACK,GL_LINE); glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
// draw pulsar // draw scence
glPushMatrix(); glPushMatrix();
{
// draw pulsar
glPushMatrix(); glPushMatrix();
{
glRotatef(-m_pulsarSpinAxisInclination, 1.0, 0.0, 0.0); glRotatef(-m_pulsarSpinAxisInclination, 1.0, 0.0, 0.0);
glRotatef(m_pulsarRotationAngle, 0.0, 0.0, 1.0); glRotatef(m_pulsarRotationAngle, 0.0, 0.0, 1.0);
...@@ -270,16 +273,22 @@ void PulsarAnimationWidget::paintGL() ...@@ -270,16 +273,22 @@ void PulsarAnimationWidget::paintGL()
glPolygonMode(GL_FRONT_AND_BACK,GL_FILL); glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
glColor3f(1.0f, 1.0f, 1.0f); glColor3f(1.0f, 1.0f, 1.0f);
glPushMatrix(); glPushMatrix();
{
glTranslatef(0.0, 0.0, -5.0); glTranslatef(0.0, 0.0, -5.0);
gluCylinder(m_quadricPulsarSpinAxis, 0.025, 0.025, 10.0, 32, 1); gluCylinder(m_quadricPulsarSpinAxis, 0.025, 0.025, 10.0, 32, 1);
}
glPopMatrix(); glPopMatrix();
glPushMatrix(); glPushMatrix();
{
glTranslatef(0.0, 0.0, -5.0); glTranslatef(0.0, 0.0, -5.0);
gluDisk(m_quadricPulsarSpinAxisTop1, 0, 0.025, 32, 8); gluDisk(m_quadricPulsarSpinAxisTop1, 0, 0.025, 32, 8);
}
glPopMatrix(); glPopMatrix();
glPushMatrix(); glPushMatrix();
{
glTranslatef(0.0, 0.0, 5.0); glTranslatef(0.0, 0.0, 5.0);
gluDisk(m_quadricPulsarSpinAxisTop2, 0, 0.025, 32, 8); gluDisk(m_quadricPulsarSpinAxisTop2, 0, 0.025, 32, 8);
}
glPopMatrix(); glPopMatrix();
glPolygonMode(GL_FRONT_AND_BACK,GL_LINE); glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
} }
...@@ -292,6 +301,7 @@ void PulsarAnimationWidget::paintGL() ...@@ -292,6 +301,7 @@ void PulsarAnimationWidget::paintGL()
gluSphere(m_quadricPulsar, 1.0, 32, 32); gluSphere(m_quadricPulsar, 1.0, 32, 32);
glDisable(GL_LIGHTING); glDisable(GL_LIGHTING);
}
glPopMatrix(); glPopMatrix();
// TODO: should be located elsewhere // TODO: should be located elsewhere
...@@ -303,6 +313,7 @@ void PulsarAnimationWidget::paintGL() ...@@ -303,6 +313,7 @@ void PulsarAnimationWidget::paintGL()
// first cone // first cone
glPushMatrix(); glPushMatrix();
{
glRotatef(-m_pulsarSpinAxisInclination, 1.0, 0.0, 0.0); glRotatef(-m_pulsarSpinAxisInclination, 1.0, 0.0, 0.0);
glRotatef(m_pulsarRotationAngle - 90.0, 0.0, 0.0, 1.0); glRotatef(m_pulsarRotationAngle - 90.0, 0.0, 0.0, 1.0);
...@@ -313,16 +324,22 @@ void PulsarAnimationWidget::paintGL() ...@@ -313,16 +324,22 @@ void PulsarAnimationWidget::paintGL()
glPolygonMode(GL_FRONT_AND_BACK,GL_FILL); glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
glColor3f(1.0f, 1.0f, 0.0f); glColor3f(1.0f, 1.0f, 0.0f);
glPushMatrix(); glPushMatrix();
{
glTranslatef(0.0, 0.0, -5.0); glTranslatef(0.0, 0.0, -5.0);
gluCylinder(m_quadricPulsarMagneticAxis, 0.025, 0.025, 10.0, 32, 1); gluCylinder(m_quadricPulsarMagneticAxis, 0.025, 0.025, 10.0, 32, 1);
}
glPopMatrix(); glPopMatrix();
glPushMatrix(); glPushMatrix();
{
glTranslatef(0.0, 0.0, -5.0); glTranslatef(0.0, 0.0, -5.0);
gluDisk(m_quadricPulsarSpinAxisTop1, 0, 0.025, 32, 8); gluDisk(m_quadricPulsarSpinAxisTop1, 0, 0.025, 32, 8);
}
glPopMatrix(); glPopMatrix();
glPushMatrix(); glPushMatrix();
{
glTranslatef(0.0, 0.0, 5.0); glTranslatef(0.0, 0.0, 5.0);
gluDisk(m_quadricPulsarSpinAxisTop2, 0, 0.025, 32, 8); gluDisk(m_quadricPulsarSpinAxisTop2, 0, 0.025, 32, 8);
}
glPopMatrix(); glPopMatrix();
glPolygonMode(GL_FRONT_AND_BACK,GL_LINE); glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
} }
...@@ -334,7 +351,7 @@ void PulsarAnimationWidget::paintGL() ...@@ -334,7 +351,7 @@ void PulsarAnimationWidget::paintGL()
// draw first cone's outer layer // draw first cone's outer layer
glBegin(GL_TRIANGLE_FAN); glBegin(GL_TRIANGLE_FAN);
{
// Pinnacle of cone is shared vertex for fan, moved up z-axis // Pinnacle of cone is shared vertex for fan, moved up z-axis
// to produce a cone instead of a circle // to produce a cone instead of a circle
glColor3f(1.0f, 1.0f, 0.0f); glColor3f(1.0f, 1.0f, 0.0f);
...@@ -351,11 +368,12 @@ void PulsarAnimationWidget::paintGL() ...@@ -351,11 +368,12 @@ void PulsarAnimationWidget::paintGL()
// Specify the next vertex for the triangle fan // Specify the next vertex for the triangle fan
glVertex2f(x, y); glVertex2f(x, y);
} }
}
glEnd(); glEnd();
// draw first cone's inner layer (do we need/want this?) // draw first cone's inner layer (do we need/want this?)
glBegin(GL_TRIANGLE_FAN); glBegin(GL_TRIANGLE_FAN);
{
glColor3f(0.66f, 0.66f, 0.0f); glColor3f(0.66f, 0.66f, 0.0f);
glVertex3f(0.0f, 0.0f, m_pulsarBeamLength); glVertex3f(0.0f, 0.0f, m_pulsarBeamLength);
for(angle = 0.0f; angle < (2.0f*GL_PI); angle += (GL_PI/32.0f)) { for(angle = 0.0f; angle < (2.0f*GL_PI); angle += (GL_PI/32.0f)) {
...@@ -363,16 +381,18 @@ void PulsarAnimationWidget::paintGL() ...@@ -363,16 +381,18 @@ void PulsarAnimationWidget::paintGL()
y = m_pulsarBeamInnerRadius * cos(angle); y = m_pulsarBeamInnerRadius * cos(angle);
glVertex2f(x, y); glVertex2f(x, y);
} }
}
glEnd(); glEnd();
// draw first cone's "rim" (disk topping gap between both cones) // draw first cone's "rim" (disk topping gap between both cones)
glColor3f(1.0f, 1.0f, 0.5f); glColor3f(1.0f, 1.0f, 0.5f);
gluDisk(m_quadricPulsarConeRim1, m_pulsarBeamInnerRadius, m_pulsarBeamOuterRadius, 32, 8); gluDisk(m_quadricPulsarConeRim1, m_pulsarBeamInnerRadius, m_pulsarBeamOuterRadius, 32, 8);
}
glPopMatrix(); glPopMatrix();
// second cone // second cone
glPushMatrix(); glPushMatrix();
{
glRotatef(180.0, 1.0, 0.0, 0.0); glRotatef(180.0, 1.0, 0.0, 0.0);
glRotatef(-m_pulsarSpinAxisInclination, 1.0, 0.0, 0.0); glRotatef(-m_pulsarSpinAxisInclination, 1.0, 0.0, 0.0);
...@@ -386,7 +406,7 @@ void PulsarAnimationWidget::paintGL() ...@@ -386,7 +406,7 @@ void PulsarAnimationWidget::paintGL()
// draw first cone's outer layer // draw first cone's outer layer
glBegin(GL_TRIANGLE_FAN); glBegin(GL_TRIANGLE_FAN);
{
// Pinnacle of cone is shared vertex for fan, moved up z-axis // Pinnacle of cone is shared vertex for fan, moved up z-axis
// to produce a cone instead of a circle // to produce a cone instead of a circle
glColor3f(1.0f, 1.0f, 0.0f); glColor3f(1.0f, 1.0f, 0.0f);
...@@ -403,11 +423,12 @@ void PulsarAnimationWidget::paintGL() ...@@ -403,11 +423,12 @@ void PulsarAnimationWidget::paintGL()
// Specify the next vertex for the triangle fan // Specify the next vertex for the triangle fan
glVertex2f(x, y); glVertex2f(x, y);
} }
}
glEnd(); glEnd();
// draw first cone's inner layer (do we need/want this?) // draw first cone's inner layer (do we need/want this?)
glBegin(GL_TRIANGLE_FAN); glBegin(GL_TRIANGLE_FAN);
{
glColor3f(0.66f, 0.66f, 0.0f); glColor3f(0.66f, 0.66f, 0.0f);
glVertex3f(0.0f, 0.0f, 3.0f); glVertex3f(0.0f, 0.0f, 3.0f);
for(angle = 0.0f; angle < (2.0f*GL_PI); angle += (GL_PI/32.0f)) { for(angle = 0.0f; angle < (2.0f*GL_PI); angle += (GL_PI/32.0f)) {
...@@ -415,14 +436,15 @@ void PulsarAnimationWidget::paintGL() ...@@ -415,14 +436,15 @@ void PulsarAnimationWidget::paintGL()
y = m_pulsarBeamInnerRadius * cos(angle); y = m_pulsarBeamInnerRadius * cos(angle);
glVertex2f(x, y); glVertex2f(x, y);
} }
}
glEnd(); glEnd();
// draw first cone's "rim" (disk topping gap between both cones) // draw first cone's "rim" (disk topping gap between both cones)
glColor3f(1.0f, 1.0f, 0.5f); glColor3f(1.0f, 1.0f, 0.5f);
gluDisk(m_quadricPulsarConeRim2, m_pulsarBeamInnerRadius, m_pulsarBeamOuterRadius, 32, 8); gluDisk(m_quadricPulsarConeRim2, m_pulsarBeamInnerRadius, m_pulsarBeamOuterRadius, 32, 8);
}
glPopMatrix(); glPopMatrix();
}
glPopMatrix(); glPopMatrix();
glPolygonMode(GL_FRONT_AND_BACK,GL_FILL); glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
...@@ -430,10 +452,12 @@ void PulsarAnimationWidget::paintGL() ...@@ -430,10 +452,12 @@ void PulsarAnimationWidget::paintGL()
// save current state // save current state
glMatrixMode(GL_PROJECTION); glMatrixMode(GL_PROJECTION);
glPushMatrix(); glPushMatrix();
{
glLoadIdentity(); glLoadIdentity();
glOrtho(0, width(), 0, height(), 0.1, 501.0); glOrtho(0, width(), 0, height(), 0.1, 501.0);
glMatrixMode(GL_MODELVIEW); glMatrixMode(GL_MODELVIEW);
glPushMatrix(); glPushMatrix();
{
glLoadIdentity(); glLoadIdentity();
// draw backdrop (independent parallel projection) // draw backdrop (independent parallel projection)
...@@ -444,8 +468,10 @@ void PulsarAnimationWidget::paintGL() ...@@ -444,8 +468,10 @@ void PulsarAnimationWidget::paintGL()
// restore original state // restore original state
glMatrixMode(GL_PROJECTION); glMatrixMode(GL_PROJECTION);
}
glPopMatrix(); glPopMatrix();
glMatrixMode(GL_MODELVIEW); glMatrixMode(GL_MODELVIEW);
}
glPopMatrix(); glPopMatrix();
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment