adding nice trace-fadeout.

This commit is contained in:
Andreas Ortmann 2016-09-29 09:32:56 +02:00
parent 1a3fd63250
commit b15cc1304d
5 changed files with 42 additions and 13 deletions

View file

@ -263,9 +263,13 @@ namespace endofthejedi {
glUseProgram(0);
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
glColor3f(0.0, 0.0, 1.0);
for (const game::Trace *trace : m_state->traces) {
float fade_out = 1.0;
if (trace->missile == nullptr) {
fade_out = 1.0 - (trace->age / trace->maxAge);
}
glColor3f(0.0, 0.3/fade_out, 1.0/fade_out);
glBegin(GL_LINE_STRIP);
for (const game::Trace::TracePoint &tp : trace->points) {
glVertex2f(tp.position.x, tp.position.y);