mirror of https://github.com/skeeto/pixelcity.git
Car tail lights now dimmer, shorter, and look better. Code cleanup.
This commit is contained in:
parent
624cca9826
commit
ba38e19c04
34
Car.cpp
34
Car.cpp
|
@ -269,15 +269,19 @@ void CCar::Render ()
|
||||||
GLvector pos;
|
GLvector pos;
|
||||||
int angle;
|
int angle;
|
||||||
int turn;
|
int turn;
|
||||||
|
float top;
|
||||||
|
|
||||||
if (!m_ready)
|
if (!m_ready)
|
||||||
return;
|
return;
|
||||||
if (!Visible (m_drive_position))
|
if (!Visible (m_drive_position))
|
||||||
return;
|
return;
|
||||||
if (m_front)
|
if (m_front) {
|
||||||
glColor3f (1, 1, 0.8f);
|
glColor3f (1, 1, 0.8f);
|
||||||
else
|
top = CAR_SIZE;
|
||||||
glColor3f (1, 0.2f, 0);
|
} else {
|
||||||
|
glColor3f (0.5, 0.2f, 0);
|
||||||
|
top = 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
glBegin (GL_QUADS);
|
glBegin (GL_QUADS);
|
||||||
|
|
||||||
|
@ -289,34 +293,14 @@ void CCar::Render ()
|
||||||
m_drive_angle += SIGN (turn);
|
m_drive_angle += SIGN (turn);
|
||||||
pos += glVector (0.5f, 0.0f, 0.5f);
|
pos += glVector (0.5f, 0.0f, 0.5f);
|
||||||
|
|
||||||
|
|
||||||
glTexCoord2f (0, 0);
|
glTexCoord2f (0, 0);
|
||||||
glVertex3f (pos.x + angles[angle].x, -CAR_SIZE, pos.z + angles[angle].y);
|
glVertex3f (pos.x + angles[angle].x, -CAR_SIZE, pos.z + angles[angle].y);
|
||||||
glTexCoord2f (1, 0);
|
glTexCoord2f (1, 0);
|
||||||
glVertex3f (pos.x - angles[angle].x, -CAR_SIZE, pos.z - angles[angle].y);
|
glVertex3f (pos.x - angles[angle].x, -CAR_SIZE, pos.z - angles[angle].y);
|
||||||
glTexCoord2f (1, 1);
|
glTexCoord2f (1, 1);
|
||||||
glVertex3f (pos.x - angles[angle].x, CAR_SIZE, pos.z - angles[angle].y);
|
glVertex3f (pos.x - angles[angle].x, top, pos.z - angles[angle].y);
|
||||||
glTexCoord2f (0, 1);
|
glTexCoord2f (0, 1);
|
||||||
glVertex3f (pos.x + angles[angle].x, CAR_SIZE, pos.z + angles[angle].y);
|
glVertex3f (pos.x + angles[angle].x, top, pos.z + angles[angle].y);
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
glVertex3f (m_position.x, m_position.y, m_position.z);
|
|
||||||
glVertex3f (m_position.x, m_position.y, m_position.z + 1);
|
|
||||||
glVertex3f (m_position.x + 1, m_position.y, m_position.z + 1);
|
|
||||||
glVertex3f (m_position.x + 1, m_position.y, m_position.z);
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
glTexCoord2f (0, 0);
|
|
||||||
glVertex3f (m_position.x, m_position.y, m_position.z + 0.2f);
|
|
||||||
glTexCoord2f (0, 2);
|
|
||||||
glVertex3f (m_position.x, m_position.y, m_position.z + 1 - 0.2f);
|
|
||||||
glTexCoord2f (1, 2);
|
|
||||||
glVertex3f (m_position.x + 1, m_position.y, m_position.z + 1 - 0.2f);
|
|
||||||
glTexCoord2f (1, 0);
|
|
||||||
glVertex3f (m_position.x + 1, m_position.y, m_position.z + 0.2f);
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
glEnd ();
|
glEnd ();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue