Merge pull request #173 from teamfisk/ExplosionEffectV2
Explosion effect v2
This commit is contained in:
@@ -1333,7 +1333,12 @@ void DrawFinalPass::BindExplosionUniforms(GLuint shaderHandle, std::shared_ptr<E
|
||||
|
||||
glUniform3fv(glGetUniformLocation(shaderHandle, "ExplosionOrigin"), 1, glm::value_ptr(job->ExplosionOrigin));
|
||||
GLERROR("Bind 6 uniform");
|
||||
glUniform1f(glGetUniformLocation(shaderHandle, "TimeSinceDeath"), job->TimeSinceDeath);
|
||||
if (job->Reverse == false) {
|
||||
glUniform1f(glGetUniformLocation(shaderHandle, "TimeSinceDeath"), job->TimeSinceDeath);
|
||||
}
|
||||
else {
|
||||
glUniform1f(glGetUniformLocation(shaderHandle, "TimeSinceDeath"), (job->ExplosionDuration - job->TimeSinceDeath));
|
||||
}
|
||||
GLERROR("Bind 7 uniform");
|
||||
glUniform1f(glGetUniformLocation(shaderHandle, "ExplosionDuration"), job->ExplosionDuration);
|
||||
GLERROR("Bind 8 uniform");
|
||||
@@ -1351,6 +1356,10 @@ void DrawFinalPass::BindExplosionUniforms(GLuint shaderHandle, std::shared_ptr<E
|
||||
GLERROR("Bind 14 uniform");
|
||||
glUniform1i(glGetUniformLocation(shaderHandle, "ExponentialAccelaration"), job->ExponentialAccelaration);
|
||||
GLERROR("Bind 15 uniform");
|
||||
glUniform1i(glGetUniformLocation(shaderHandle, "Reverse"), job->Reverse);
|
||||
GLERROR("Bind 15-2 uniform");
|
||||
glUniform1f(glGetUniformLocation(shaderHandle, "ColorDistanceScalar"), job->ColorDistanceScalar);
|
||||
GLERROR("Bind 15-3 uniform");
|
||||
|
||||
glUniform4fv(glGetUniformLocation(shaderHandle, "Color"), 1, glm::value_ptr(job->Color));
|
||||
GLERROR("Bind 16 uniform");
|
||||
|
||||
@@ -7,12 +7,15 @@ void ExplosionEffectSystem::UpdateComponent(EntityWrapper& entity, ComponentWrap
|
||||
delay = std::max(0.0, delay - dt);
|
||||
}
|
||||
|
||||
if (delay <= 0) {
|
||||
double& timeSinceDeath = component["TimeSinceDeath"];
|
||||
timeSinceDeath += (double)component["Speed"] * dt;
|
||||
if (timeSinceDeath < 0 || timeSinceDeath > (double)component["ExplosionDuration"]) {
|
||||
timeSinceDeath = 0.0;
|
||||
}
|
||||
}
|
||||
if (delay <= 0) {
|
||||
double& timeSinceDeath = component["TimeSinceDeath"];
|
||||
timeSinceDeath += (double)component["Speed"] * dt;
|
||||
if (timeSinceDeath < 0) {
|
||||
timeSinceDeath = 0.0;
|
||||
}
|
||||
else if (timeSinceDeath >(double)component["ExplosionDuration"]) {
|
||||
timeSinceDeath = (double)component["ExplosionDuration"];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user