mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 13:18:38 +02:00
Added red 'laser pointer' to hand
This commit is contained in:
parent
4203fddb88
commit
f98f64e8f7
3 changed files with 21 additions and 4 deletions
|
@ -24,6 +24,7 @@ Hand::Hand(glm::vec3 initcolor)
|
||||||
scale.x = 0.07;
|
scale.x = 0.07;
|
||||||
scale.y = scale.x * 5.0;
|
scale.y = scale.x * 5.0;
|
||||||
scale.z = scale.y * 1.0;
|
scale.z = scale.y * 1.0;
|
||||||
|
renderPointer = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Hand::reset()
|
void Hand::reset()
|
||||||
|
@ -41,6 +42,7 @@ void Hand::reset()
|
||||||
|
|
||||||
void Hand::render()
|
void Hand::render()
|
||||||
{
|
{
|
||||||
|
const float POINTER_LENGTH = 10.0;
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glTranslatef(position.x, position.y, position.z);
|
glTranslatef(position.x, position.y, position.z);
|
||||||
glRotatef(yaw, 0, 1, 0);
|
glRotatef(yaw, 0, 1, 0);
|
||||||
|
@ -50,6 +52,15 @@ void Hand::render()
|
||||||
glScalef(scale.x, scale.y, scale.z);
|
glScalef(scale.x, scale.y, scale.z);
|
||||||
//glutSolidSphere(1.5, 20, 20);
|
//glutSolidSphere(1.5, 20, 20);
|
||||||
glutSolidCube(1.0);
|
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();
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@ public:
|
||||||
void setTarget(glm::vec3 t) { target = t; };
|
void setTarget(glm::vec3 t) { target = t; };
|
||||||
void processTransmitterData(char * packetData, int numBytes);
|
void processTransmitterData(char * packetData, int numBytes);
|
||||||
float getTransmitterHz() { return transmitterHz; };
|
float getTransmitterHz() { return transmitterHz; };
|
||||||
|
void setRenderPointer(bool p) { renderPointer = p; };
|
||||||
private:
|
private:
|
||||||
glm::vec3 position, target, velocity, color, scale;
|
glm::vec3 position, target, velocity, color, scale;
|
||||||
float pitch, yaw, roll, pitchRate, yawRate, rollRate;
|
float pitch, yaw, roll, pitchRate, yawRate, rollRate;
|
||||||
|
@ -37,6 +38,7 @@ private:
|
||||||
timeval transmitterTimer;
|
timeval transmitterTimer;
|
||||||
float transmitterHz;
|
float transmitterHz;
|
||||||
int transmitterPackets;
|
int transmitterPackets;
|
||||||
|
bool renderPointer;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -101,7 +101,7 @@ ParticleSystem balls(0,
|
||||||
0.0 // Gravity
|
0.0 // Gravity
|
||||||
);
|
);
|
||||||
|
|
||||||
Cloud cloud(0, // Particles
|
Cloud cloud(20000, // Particles
|
||||||
box, // Bounding Box
|
box, // Bounding Box
|
||||||
false // Wrap
|
false // Wrap
|
||||||
);
|
);
|
||||||
|
@ -540,8 +540,9 @@ void display(void)
|
||||||
glEnable (GL_DEPTH_TEST);
|
glEnable (GL_DEPTH_TEST);
|
||||||
glEnable(GL_LIGHTING);
|
glEnable(GL_LIGHTING);
|
||||||
glEnable(GL_LINE_SMOOTH);
|
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);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
|
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
|
|
||||||
|
@ -569,6 +570,7 @@ void display(void)
|
||||||
glColor3f(1,0,0);
|
glColor3f(1,0,0);
|
||||||
glutSolidSphere(0.25, 15, 15);
|
glutSolidSphere(0.25, 15, 15);
|
||||||
|
|
||||||
|
|
||||||
// Draw cloud of dots
|
// Draw cloud of dots
|
||||||
glDisable( GL_POINT_SPRITE_ARB );
|
glDisable( GL_POINT_SPRITE_ARB );
|
||||||
glDisable( GL_TEXTURE_2D );
|
glDisable( GL_TEXTURE_2D );
|
||||||
|
@ -615,6 +617,7 @@ void display(void)
|
||||||
//glm::vec3 test(0.5, 0.5, 0.5);
|
//glm::vec3 test(0.5, 0.5, 0.5);
|
||||||
//render_vector(&test);
|
//render_vector(&test);
|
||||||
|
|
||||||
|
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
|
||||||
// Render 2D overlay: I/O level bar graphs and text
|
// Render 2D overlay: I/O level bar graphs and text
|
||||||
|
@ -683,6 +686,7 @@ void display(void)
|
||||||
|
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
|
||||||
|
|
||||||
glutSwapBuffers();
|
glutSwapBuffers();
|
||||||
framecount++;
|
framecount++;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue