merge + trace fade out fix

This commit is contained in:
Andreas Ortmann 2016-09-29 11:43:00 +02:00
commit 26e1d4fd19
4 changed files with 6 additions and 5 deletions

View file

@ -75,7 +75,8 @@ namespace endofthejedi {
glm::vec3 c = glm::vec3(1.0, 1.0, 0.5);
glUniform3f(m_shader.location("lightColor"), c.x, c.y, c.z);
glm::vec3 p = glm::vec3(1.0, 0.0, 0.0);
//glm::vec3 p = glm::vec3(1.0, 0.0, 0.0);
glm::vec3 p = glm::vec3(0.5f, 0.5f, -4.0f);
glUniform3f(m_shader.location("lightPosition"), p.x, p.y, p.z);
renderPlanets();
@ -161,6 +162,7 @@ namespace endofthejedi {
glm::vec3 c = planet->getColor();
glUniform3f(m_shader.location("materialColor"), c.x, c.y, c.z);
glUniform3f(m_shader.location("color"), c.x, c.y, c.z);
m_planetModel->render(m_shader);
}
@ -268,7 +270,7 @@ namespace endofthejedi {
fade_out = 1.0 - (trace->age / trace->maxAge);
}
glColor3f(0.0, 0.0, 1.0/fade_out);
glColor3f(0.0, 0.0, 1.0*fade_out);
glBegin(GL_LINE_STRIP);
for (const game::Trace::TracePoint &tp : trace->points) {
glVertex2f(tp.position.x, tp.position.y);

View file

@ -50,7 +50,6 @@ namespace game {
planets.push_back(new Planet(pos, i, 0.03 + 0.07*util::randf_0_1()));
}
planets.push_back(new Planet(glm::vec2(0.0f, 0.0f), 0, 0.1f));
}
bool State::spawnShipForPlayer(Player *player)

View file

@ -31,7 +31,7 @@ namespace game {
void Trace::addPointFromMissile(bool forceAdd)
{
fidelityCounter++;
if (forceAdd || fidelityCounter >= 20) {
if (forceAdd || fidelityCounter >= 10) {
fidelityCounter = 0;
points.push_back(TracePoint(missile));
}

View file

@ -13,7 +13,7 @@ namespace game {
*/
class Trace {
public:
Trace(Missile *missile, float maxAge=5.0);
Trace(Missile *missile, float maxAge=3.0);
~Trace();
// Add the current position of the missile as a new point on the