particles are even nicer now.

This commit is contained in:
Andreas Ortmann 2016-09-30 22:04:14 +02:00
parent 3a30a20043
commit c950d6a54d
5 changed files with 13 additions and 15 deletions

View file

@ -77,7 +77,8 @@ int main(int argc, char *argv[])
asio::io_service io_service;
Server s(io_service, game.state(), atoi(port) );
GameWindow window(500, 500, &game);
//GameWindow window(500, 500, &game);
GameWindow window(750, 750, &game);
window.set_maxfps(60.0);
window.open();

View file

@ -137,9 +137,9 @@ namespace endofthejedi {
glUniform1f(m_shader.location("age"), m_age);
glUniform1f(m_shader.location("maxVelocity"), m_maxVelocity);
glUniform1f(m_shader.location("halfAge"), m_halfAge);
glUniform1f(m_shader.location("halfAge"), m_halfAge);
glUniform1f(m_shader.location("size"), m_particleRadius);
glUniform3f(m_shader.location("center"), m_center.x, m_center.y, m_center.z);
glUniform3f(m_shader.location("explCenter"), m_center.x, m_center.y, m_center.z);
bind();

View file

@ -95,7 +95,7 @@ namespace endofthejedi {
{
//float particleRadius = 0.005;
//float particleRadius = 0.003;
float particleRadius = 0.01;
float particleRadius = 0.007;
// TODO: use this as shader input too and make the area 2x around this
// so that it stays hot/yellow for 2/3 of the time
@ -119,7 +119,7 @@ namespace endofthejedi {
//glm::vec3 v = 0.5f*glm::vec3(sin(t), cos(t), util::randf_m1_1());
glm::vec3 v = glm::ballRand(maxVelocity);
v *= util::randf_0_1() * util::randf_0_1();
v *= util::randf_0_1() * util::randf_0_1() * util::randf_0_1();
batch->setParticle(i, glm::vec3(pos, 0.0) + glm::ballRand(explSize), v);
}
@ -141,12 +141,12 @@ namespace endofthejedi {
}
if (!gotIt) {
addExplosionEffect(expl->id, expl->position, 500, 5.0);
addExplosionEffect(expl->id, expl->position, 1000, 2.0);
}
}
if (m_particles.size() == 0) {
addExplosionEffect(0, glm::vec2(0.0, 0.0), 1000, 5.0);
addExplosionEffect(0, glm::vec2(0.0, 0.0), 1000, 2.0);
}
std::vector<ParticleBatch*> rm;
@ -284,7 +284,7 @@ namespace endofthejedi {
fade_out = 1.0 - (trace->age / trace->maxAge);
}
glColor3f(0.0, 0.0, 1.0*fade_out);
glColor3f(0.0, 0.5*fade_out, 0.5*fade_out);
glBegin(GL_LINE_STRIP);
for (const game::Trace::TracePoint &tp : trace->points) {
glVertex2f(tp.position.x, tp.position.y);