fine tuned explosion parameters.
This commit is contained in:
parent
c950d6a54d
commit
03998dc74a
2 changed files with 19 additions and 12 deletions
|
@ -17,9 +17,13 @@ varying float explCenterDist;
|
|||
// TODO: rotate to face the user!
|
||||
void main()
|
||||
{
|
||||
// add a bit variation to the decay compution by adding part of the initial
|
||||
// position to the age
|
||||
float ageMod = age + mod(20.0*in_position.z + 10.0*in_position.x + in_position.y, 0.5);
|
||||
|
||||
//decay = min(1.0, age+5.0*length(velocity)) / halfAge;
|
||||
//decay = max(decay*decay, sqrt(decay));
|
||||
decay = age / halfAge;
|
||||
decay = ageMod / halfAge;
|
||||
|
||||
// faster particles are smaller
|
||||
float speedScale = (1.0 - 0.8*length(in_velocity)/maxVelocity);
|
||||
|
|
|
@ -51,7 +51,9 @@ namespace endofthejedi {
|
|||
// TODO: add dust particles
|
||||
// TODO: add little rocks flying around
|
||||
|
||||
glClearColor(0.0, 0.0, 0.0, 1.0);
|
||||
//glClearColor(0.0, 0.0, 0.0, 1.0);
|
||||
float s = 0.1;
|
||||
glClearColor(s, s, s, 1.0);
|
||||
|
||||
m_shader.bind();
|
||||
|
||||
|
@ -70,7 +72,7 @@ namespace endofthejedi {
|
|||
|
||||
renderParticles();
|
||||
|
||||
renderTraces();
|
||||
//renderTraces();
|
||||
|
||||
//glColor3f(1.0, 0.0, 0.0);
|
||||
//glBegin(GL_QUADS);
|
||||
|
@ -99,9 +101,8 @@ namespace endofthejedi {
|
|||
|
||||
// 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
|
||||
float explSize = 0.01f;
|
||||
|
||||
float maxVelocity = 0.2f;
|
||||
float explCoreSize = 0.02f;
|
||||
float maxVelocity = 0.4f;
|
||||
|
||||
ParticleBatch *batch = new ParticleBatch(id, n, particleRadius, duration);
|
||||
batch->setCenter(glm::vec3(pos, 0.0));
|
||||
|
@ -121,7 +122,7 @@ namespace endofthejedi {
|
|||
glm::vec3 v = glm::ballRand(maxVelocity);
|
||||
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);
|
||||
batch->setParticle(i, glm::vec3(pos, 0.0) + glm::ballRand(explCoreSize), v);
|
||||
}
|
||||
|
||||
batch->upload();
|
||||
|
@ -141,13 +142,13 @@ namespace endofthejedi {
|
|||
}
|
||||
|
||||
if (!gotIt) {
|
||||
addExplosionEffect(expl->id, expl->position, 1000, 2.0);
|
||||
addExplosionEffect(expl->id, expl->position, 500, 0.5);
|
||||
}
|
||||
}
|
||||
|
||||
if (m_particles.size() == 0) {
|
||||
addExplosionEffect(0, glm::vec2(0.0, 0.0), 1000, 2.0);
|
||||
}
|
||||
//if (m_particles.size() == 0) {
|
||||
// addExplosionEffect(0, glm::vec2(0.0, 0.0), 1000, 2.0);
|
||||
//}
|
||||
|
||||
std::vector<ParticleBatch*> rm;
|
||||
|
||||
|
@ -246,7 +247,9 @@ namespace endofthejedi {
|
|||
glm::mat4 RendererPolygon3d::computeModelMatrix(const game::Ship *ship)
|
||||
{
|
||||
// TODO: rotate them before shooting, that looks better
|
||||
glm::mat4 mat = computeModelMatrix(ship->position, m_state->shipRadius());
|
||||
//glm::mat4 mat = computeModelMatrix(ship->position, m_state->shipRadius());
|
||||
glm::mat4 mat = computeModelMatrix(ship->position, 5.0*m_state->shipRadius());
|
||||
|
||||
// XXX model is flipped
|
||||
//glm::mat4 mat = computeModelMatrix(ship->position, 0.3);
|
||||
mat = glm::rotate(mat, (float) M_PI, glm::vec3(0.0f, 1.0f, 0.0f));
|
||||
|
|
Loading…
Reference in a new issue