merge + trace fade out fix
This commit is contained in:
commit
26e1d4fd19
4 changed files with 6 additions and 5 deletions
|
@ -75,7 +75,8 @@ namespace endofthejedi {
|
||||||
glm::vec3 c = glm::vec3(1.0, 1.0, 0.5);
|
glm::vec3 c = glm::vec3(1.0, 1.0, 0.5);
|
||||||
glUniform3f(m_shader.location("lightColor"), c.x, c.y, c.z);
|
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);
|
glUniform3f(m_shader.location("lightPosition"), p.x, p.y, p.z);
|
||||||
|
|
||||||
renderPlanets();
|
renderPlanets();
|
||||||
|
@ -161,6 +162,7 @@ namespace endofthejedi {
|
||||||
|
|
||||||
glm::vec3 c = planet->getColor();
|
glm::vec3 c = planet->getColor();
|
||||||
glUniform3f(m_shader.location("materialColor"), c.x, c.y, c.z);
|
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);
|
m_planetModel->render(m_shader);
|
||||||
}
|
}
|
||||||
|
@ -268,7 +270,7 @@ namespace endofthejedi {
|
||||||
fade_out = 1.0 - (trace->age / trace->maxAge);
|
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);
|
glBegin(GL_LINE_STRIP);
|
||||||
for (const game::Trace::TracePoint &tp : trace->points) {
|
for (const game::Trace::TracePoint &tp : trace->points) {
|
||||||
glVertex2f(tp.position.x, tp.position.y);
|
glVertex2f(tp.position.x, tp.position.y);
|
||||||
|
|
|
@ -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(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)
|
bool State::spawnShipForPlayer(Player *player)
|
||||||
|
|
|
@ -31,7 +31,7 @@ namespace game {
|
||||||
void Trace::addPointFromMissile(bool forceAdd)
|
void Trace::addPointFromMissile(bool forceAdd)
|
||||||
{
|
{
|
||||||
fidelityCounter++;
|
fidelityCounter++;
|
||||||
if (forceAdd || fidelityCounter >= 20) {
|
if (forceAdd || fidelityCounter >= 10) {
|
||||||
fidelityCounter = 0;
|
fidelityCounter = 0;
|
||||||
points.push_back(TracePoint(missile));
|
points.push_back(TracePoint(missile));
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ namespace game {
|
||||||
*/
|
*/
|
||||||
class Trace {
|
class Trace {
|
||||||
public:
|
public:
|
||||||
Trace(Missile *missile, float maxAge=5.0);
|
Trace(Missile *missile, float maxAge=3.0);
|
||||||
~Trace();
|
~Trace();
|
||||||
|
|
||||||
// Add the current position of the missile as a new point on the
|
// Add the current position of the missile as a new point on the
|
||||||
|
|
Loading…
Reference in a new issue