particles are even nicer now.
This commit is contained in:
parent
3a30a20043
commit
c950d6a54d
5 changed files with 13 additions and 15 deletions
|
@ -15,7 +15,6 @@ vec3 hsv2rgb(vec3 c)
|
|||
|
||||
void main()
|
||||
{
|
||||
gl_FragColor = vec4(0.5+0.5*vertex.x, 0.5+0.5*vertex.y, 0.0, 1.0);
|
||||
float r = length(vertex);
|
||||
if (r > 1.0) {
|
||||
discard;
|
||||
|
@ -26,8 +25,6 @@ void main()
|
|||
float v = max(0.0, (1.0-log(d)));
|
||||
float s = max(0.0, min(30.0 * sqrt(decay) * explCenterDist, 1.0));
|
||||
|
||||
//v /= decay * 10.0*length(vertex-explCenter);
|
||||
//v /= 1.0+2.0*length(vertex-explCenter);
|
||||
//v /= 1.0 + max(0.0, min(35.0*(decay-0.2), 1.0)) + 10.0 * explCenterDist;
|
||||
v /= 1.0 + 10.0 * explCenterDist;
|
||||
|
||||
|
|
|
@ -22,11 +22,11 @@ void main()
|
|||
decay = age / halfAge;
|
||||
|
||||
// faster particles are smaller
|
||||
//float s = size * (1.0-length(in_velocity)/maxVelocity);
|
||||
float s = size;
|
||||
float speedScale = (1.0 - 0.8*length(in_velocity)/maxVelocity);
|
||||
float finalSize = size * speedScale;
|
||||
vec2 base = in_vertex;
|
||||
vec3 p = s*vec3(base, 0.0);
|
||||
vec3 offset = (0.1*age + log(1.0+age*5.0)) * in_velocity + in_position;
|
||||
vec3 p = finalSize*vec3(base, 0.0);
|
||||
vec3 offset = (0.2*age + log(1.0+age*5.0)) * in_velocity + in_position;
|
||||
p += offset;
|
||||
|
||||
gl_Position = vec4(p, 1.0);
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -139,7 +139,7 @@ namespace endofthejedi {
|
|||
glUniform1f(m_shader.location("maxVelocity"), m_maxVelocity);
|
||||
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();
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue