Commit 84bb731f authored by Oliver Bock's avatar Oliver Bock

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

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