Commit a8b4d0a2 authored by Oliver Bock's avatar Oliver Bock

Added line of sight (of observer)

* Will be used to determine pulse profile (instead of freely moveable camera)
* Slightly reduced spin/magnetic axes to allow line of sight to overlap
parent cdb9b42c
...@@ -61,6 +61,9 @@ PulsarAnimationWidget::PulsarAnimationWidget(QWidget *parent) : ...@@ -61,6 +61,9 @@ PulsarAnimationWidget::PulsarAnimationWidget(QWidget *parent) :
m_quadricPulsarMagneticAxis = NULL; m_quadricPulsarMagneticAxis = NULL;
m_quadricPulsarConeRim1 = NULL; m_quadricPulsarConeRim1 = NULL;
m_quadricPulsarConeRim2 = NULL; m_quadricPulsarConeRim2 = NULL;
m_quadricLineOfSight = NULL;
m_quadricLineOfSightTop1 = NULL;
m_quadricLineOfSightTop2 = NULL;
// initialize texture pointers // initialize texture pointers
m_pulsarTexture = 0; m_pulsarTexture = 0;
...@@ -106,7 +109,13 @@ PulsarAnimationWidget::~PulsarAnimationWidget() ...@@ -106,7 +109,13 @@ PulsarAnimationWidget::~PulsarAnimationWidget()
if(m_quadricPulsarSpinAxis) gluDeleteQuadric(m_quadricPulsarSpinAxis); if(m_quadricPulsarSpinAxis) gluDeleteQuadric(m_quadricPulsarSpinAxis);
if(m_quadricPulsarSpinAxisTop1) gluDeleteQuadric(m_quadricPulsarSpinAxisTop1); if(m_quadricPulsarSpinAxisTop1) gluDeleteQuadric(m_quadricPulsarSpinAxisTop1);
if(m_quadricPulsarSpinAxisTop2) gluDeleteQuadric(m_quadricPulsarSpinAxisTop2); if(m_quadricPulsarSpinAxisTop2) gluDeleteQuadric(m_quadricPulsarSpinAxisTop2);
if(m_quadricPulsarSpinAxis) gluDeleteQuadric(m_quadricPulsarSpinAxis);
if(m_quadricPulsarSpinAxisTop1) gluDeleteQuadric(m_quadricPulsarSpinAxisTop1);
if(m_quadricPulsarSpinAxisTop2) gluDeleteQuadric(m_quadricPulsarSpinAxisTop2);
if(m_quadricPulsarMagneticAxis) gluDeleteQuadric(m_quadricPulsarMagneticAxis); if(m_quadricPulsarMagneticAxis) gluDeleteQuadric(m_quadricPulsarMagneticAxis);
if(m_quadricPulsarSpinAxis) gluDeleteQuadric(m_quadricLineOfSight);
if(m_quadricPulsarSpinAxisTop1) gluDeleteQuadric(m_quadricLineOfSightTop1);
if(m_quadricPulsarSpinAxisTop2) gluDeleteQuadric(m_quadricLineOfSightTop2);
if(m_pulsarTexture) deleteTexture(m_pulsarTexture); if(m_pulsarTexture) deleteTexture(m_pulsarTexture);
if(m_backgroundTexture) deleteTexture(m_backgroundTexture); if(m_backgroundTexture) deleteTexture(m_backgroundTexture);
} }
...@@ -149,6 +158,9 @@ void PulsarAnimationWidget::initializeGL() ...@@ -149,6 +158,9 @@ void PulsarAnimationWidget::initializeGL()
m_quadricPulsarSpinAxisTop1 = gluNewQuadric(); m_quadricPulsarSpinAxisTop1 = gluNewQuadric();
m_quadricPulsarSpinAxisTop2 = gluNewQuadric(); m_quadricPulsarSpinAxisTop2 = gluNewQuadric();
m_quadricPulsarMagneticAxis = gluNewQuadric(); m_quadricPulsarMagneticAxis = gluNewQuadric();
m_quadricLineOfSight = gluNewQuadric();
m_quadricLineOfSightTop1 = gluNewQuadric();
m_quadricLineOfSightTop2 = gluNewQuadric();
gluQuadricNormals(m_quadricPulsar, GLU_SMOOTH); gluQuadricNormals(m_quadricPulsar, GLU_SMOOTH);
gluQuadricNormals(m_quadricPulsarConeRim1, GLU_SMOOTH); gluQuadricNormals(m_quadricPulsarConeRim1, GLU_SMOOTH);
...@@ -157,6 +169,9 @@ void PulsarAnimationWidget::initializeGL() ...@@ -157,6 +169,9 @@ void PulsarAnimationWidget::initializeGL()
gluQuadricNormals(m_quadricPulsarSpinAxisTop1, GLU_SMOOTH); gluQuadricNormals(m_quadricPulsarSpinAxisTop1, GLU_SMOOTH);
gluQuadricNormals(m_quadricPulsarSpinAxisTop2, GLU_SMOOTH); gluQuadricNormals(m_quadricPulsarSpinAxisTop2, GLU_SMOOTH);
gluQuadricNormals(m_quadricPulsarMagneticAxis, GLU_SMOOTH); gluQuadricNormals(m_quadricPulsarMagneticAxis, GLU_SMOOTH);
gluQuadricNormals(m_quadricLineOfSight, GLU_SMOOTH);
gluQuadricNormals(m_quadricLineOfSightTop1, GLU_SMOOTH);
gluQuadricNormals(m_quadricLineOfSightTop2, GLU_SMOOTH);
// query max texture size (estimate) // query max texture size (estimate)
...@@ -262,6 +277,31 @@ void PulsarAnimationWidget::paintGL() ...@@ -262,6 +277,31 @@ void PulsarAnimationWidget::paintGL()
// draw scence // draw scence
glPushMatrix(); glPushMatrix();
{ {
//draw line of sight (observer)
if(m_showRotationAxes) {
glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
glColor3f(0.33f, 0.33f, 1.0f);
glPushMatrix();
{
glTranslatef(0.0, 0.0, -5.0);
gluCylinder(m_quadricLineOfSight, 0.025, 0.025, 10.0, 32, 1);
}
glPopMatrix();
glPushMatrix();
{
glTranslatef(0.0, 0.0, -5.0);
gluDisk(m_quadricLineOfSightTop1, 0, 0.025, 32, 8);
}
glPopMatrix();
glPushMatrix();
{
glTranslatef(0.0, 0.0, 5.0);
gluDisk(m_quadricLineOfSightTop2, 0, 0.025, 32, 8);
}
glPopMatrix();
glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
}
// draw pulsar // draw pulsar
glPushMatrix(); glPushMatrix();
{ {
...@@ -275,19 +315,19 @@ void PulsarAnimationWidget::paintGL() ...@@ -275,19 +315,19 @@ void PulsarAnimationWidget::paintGL()
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.020, 0.020, 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.020, 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.020, 32, 8);
} }
glPopMatrix(); glPopMatrix();
glPolygonMode(GL_FRONT_AND_BACK,GL_LINE); glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
...@@ -326,19 +366,19 @@ void PulsarAnimationWidget::paintGL() ...@@ -326,19 +366,19 @@ void PulsarAnimationWidget::paintGL()
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.020, 0.020, 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.020, 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.020, 32, 8);
} }
glPopMatrix(); glPopMatrix();
glPolygonMode(GL_FRONT_AND_BACK,GL_LINE); glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
......
...@@ -81,6 +81,9 @@ private: ...@@ -81,6 +81,9 @@ private:
GLUquadricObj *m_quadricPulsarSpinAxisTop1; GLUquadricObj *m_quadricPulsarSpinAxisTop1;
GLUquadricObj *m_quadricPulsarSpinAxisTop2; GLUquadricObj *m_quadricPulsarSpinAxisTop2;
GLUquadricObj *m_quadricPulsarMagneticAxis; GLUquadricObj *m_quadricPulsarMagneticAxis;
GLUquadricObj *m_quadricLineOfSight;
GLUquadricObj *m_quadricLineOfSightTop1;
GLUquadricObj *m_quadricLineOfSightTop2;
GLuint m_pulsarTexture; GLuint m_pulsarTexture;
GLuint m_backgroundTexture; GLuint m_backgroundTexture;
......
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