Commit 8a053d63 authored by Oliver Bock's avatar Oliver Bock

Let beams start at center of pulsar (and reduce hardcoded values)

parent c9285573
...@@ -75,6 +75,7 @@ PulsarAnimationWidget::PulsarAnimationWidget(QWidget *parent) : ...@@ -75,6 +75,7 @@ PulsarAnimationWidget::PulsarAnimationWidget(QWidget *parent) :
m_pulsarRotationDelta = 0.0; m_pulsarRotationDelta = 0.0;
m_pulsarRotationAngle = 0.0; m_pulsarRotationAngle = 0.0;
m_pulsarRadius = 1.0;
m_pulsarBeamLength = 3.0f; m_pulsarBeamLength = 3.0f;
m_pulsarBeamRimSize = 0.1f; m_pulsarBeamRimSize = 0.1f;
setPulsarSpinAxisInclination(0); setPulsarSpinAxisInclination(0);
...@@ -260,13 +261,13 @@ void PulsarAnimationWidget::paintGL() ...@@ -260,13 +261,13 @@ void PulsarAnimationWidget::paintGL()
glColor3f(0.33f, 0.33f, 1.0f); glColor3f(0.33f, 0.33f, 1.0f);
glPushMatrix(); glPushMatrix();
{ {
glTranslatef(0.0, 0.0, 1.0); glTranslatef(0.0, 0.0, m_pulsarRadius);
gluCylinder(m_quadricLineOfSight, 0.025, 0.025, 4.01, 32, 1); gluCylinder(m_quadricLineOfSight, 0.025, 0.025, 4.01, 32, 1);
} }
glPopMatrix(); glPopMatrix();
glPushMatrix(); glPushMatrix();
{ {
glTranslatef(0.0, 0.0, 0.99); glTranslatef(0.0, 0.0, m_pulsarRadius - 0.01);
gluDisk(m_quadricLineOfSightTop1, 0, 0.025, 32, 8); gluDisk(m_quadricLineOfSightTop1, 0, 0.025, 32, 8);
} }
glPopMatrix(); glPopMatrix();
...@@ -315,7 +316,7 @@ void PulsarAnimationWidget::paintGL() ...@@ -315,7 +316,7 @@ void PulsarAnimationWidget::paintGL()
glMaterialfv(GL_FRONT, GL_AMBIENT, no_mat); glMaterialfv(GL_FRONT, GL_AMBIENT, no_mat);
glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse); glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse);
gluSphere(m_quadricPulsar, 1.0, 32, 32); gluSphere(m_quadricPulsar, m_pulsarRadius, 32, 32);
glDisable(GL_LIGHTING); glDisable(GL_LIGHTING);
} }
...@@ -361,7 +362,7 @@ void PulsarAnimationWidget::paintGL() ...@@ -361,7 +362,7 @@ void PulsarAnimationWidget::paintGL()
glPolygonMode(GL_FRONT_AND_BACK,GL_LINE); glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
} }
glTranslatef(0.0, 0.0, -4.0); glTranslatef(0.0, 0.0, -m_pulsarBeamLength);
glMaterialfv(GL_FRONT, GL_AMBIENT, coneAmbient); glMaterialfv(GL_FRONT, GL_AMBIENT, coneAmbient);
glMaterialfv(GL_FRONT, GL_DIFFUSE, coneDiffuse); glMaterialfv(GL_FRONT, GL_DIFFUSE, coneDiffuse);
...@@ -416,7 +417,7 @@ void PulsarAnimationWidget::paintGL() ...@@ -416,7 +417,7 @@ void PulsarAnimationWidget::paintGL()
glRotatef(-m_pulsarRotationAngle - 90.0, 0.0, 0.0, 1.0); glRotatef(-m_pulsarRotationAngle - 90.0, 0.0, 0.0, 1.0);
glRotatef(m_pulsarMagneticAxisInclination, 0.0, 1.0, 0.0); glRotatef(m_pulsarMagneticAxisInclination, 0.0, 1.0, 0.0);
glTranslatef(0.0, 0.0, -4.0); glTranslatef(0.0, 0.0, -m_pulsarBeamLength);
glMaterialfv(GL_FRONT, GL_AMBIENT, coneAmbient); glMaterialfv(GL_FRONT, GL_AMBIENT, coneAmbient);
glMaterialfv(GL_FRONT, GL_DIFFUSE, coneDiffuse); glMaterialfv(GL_FRONT, GL_DIFFUSE, coneDiffuse);
......
...@@ -93,6 +93,7 @@ private: ...@@ -93,6 +93,7 @@ private:
double m_pulsarRotationAngle; double m_pulsarRotationAngle;
double m_pulsarRotationDelta; double m_pulsarRotationDelta;
double m_pulsarRadius;
double m_pulsarSpinAxisInclination; double m_pulsarSpinAxisInclination;
double m_pulsarMagneticAxisInclination; double m_pulsarMagneticAxisInclination;
double m_pulsarBeamLength; double m_pulsarBeamLength;
......
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