Added red 'laser pointer' to hand

This commit is contained in:
Philip Rosedale 2013-03-06 14:40:24 -08:00
parent 4203fddb88
commit f98f64e8f7
3 changed files with 21 additions and 4 deletions

View file

@ -24,6 +24,7 @@ Hand::Hand(glm::vec3 initcolor)
scale.x = 0.07;
scale.y = scale.x * 5.0;
scale.z = scale.y * 1.0;
renderPointer = true;
}
void Hand::reset()
@ -41,6 +42,7 @@ void Hand::reset()
void Hand::render()
{
const float POINTER_LENGTH = 10.0;
glPushMatrix();
glTranslatef(position.x, position.y, position.z);
glRotatef(yaw, 0, 1, 0);
@ -50,6 +52,15 @@ void Hand::render()
glScalef(scale.x, scale.y, scale.z);
//glutSolidSphere(1.5, 20, 20);
glutSolidCube(1.0);
if (renderPointer) {
glBegin(GL_TRIANGLES);
glColor3f(1,0,0);
glNormal3f(0,-1,0);
glVertex3f(-0.4,0,0);
glVertex3f(0.4,0,0);
glVertex3f(0,0,-POINTER_LENGTH);
glEnd();
}
glPopMatrix();
}

View file

@ -30,6 +30,7 @@ public:
void setTarget(glm::vec3 t) { target = t; };
void processTransmitterData(char * packetData, int numBytes);
float getTransmitterHz() { return transmitterHz; };
void setRenderPointer(bool p) { renderPointer = p; };
private:
glm::vec3 position, target, velocity, color, scale;
float pitch, yaw, roll, pitchRate, yawRate, rollRate;
@ -37,6 +38,7 @@ private:
timeval transmitterTimer;
float transmitterHz;
int transmitterPackets;
bool renderPointer;
};

View file

@ -98,10 +98,10 @@ ParticleSystem balls(0,
false, // Wrap?
0.02, // Noise
0.3, // Size scale
0.0 // Gravity
0.0 // Gravity
);
Cloud cloud(0, // Particles
Cloud cloud(20000, // Particles
box, // Bounding Box
false // Wrap
);
@ -540,8 +540,9 @@ void display(void)
glEnable (GL_DEPTH_TEST);
glEnable(GL_LIGHTING);
glEnable(GL_LINE_SMOOTH);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
//glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
@ -569,6 +570,7 @@ void display(void)
glColor3f(1,0,0);
glutSolidSphere(0.25, 15, 15);
// Draw cloud of dots
glDisable( GL_POINT_SPRITE_ARB );
glDisable( GL_TEXTURE_2D );
@ -614,7 +616,8 @@ void display(void)
//glm::vec3 test(0.5, 0.5, 0.5);
//render_vector(&test);
glPopMatrix();
// Render 2D overlay: I/O level bar graphs and text
@ -683,6 +686,7 @@ void display(void)
glPopMatrix();
glutSwapBuffers();
framecount++;
}