Add reverse and scalar for ColorByDistance
This commit is contained in:
@@ -28,6 +28,7 @@ struct ExplosionEffectJob : ModelJob
|
|||||||
ColorByDistance = (bool)explosionEffectComponent["ColorByDistance"];
|
ColorByDistance = (bool)explosionEffectComponent["ColorByDistance"];
|
||||||
ExponentialAccelaration = (bool)explosionEffectComponent["ExponentialAccelaration"];
|
ExponentialAccelaration = (bool)explosionEffectComponent["ExponentialAccelaration"];
|
||||||
Reverse = (bool)explosionEffectComponent["Reverse"];
|
Reverse = (bool)explosionEffectComponent["Reverse"];
|
||||||
|
ColorDistanceScalar = (double)explosionEffectComponent["ColorDistanceScalar"];
|
||||||
};
|
};
|
||||||
|
|
||||||
glm::vec3 ExplosionOrigin;
|
glm::vec3 ExplosionOrigin;
|
||||||
@@ -39,13 +40,14 @@ struct ExplosionEffectJob : ModelJob
|
|||||||
glm::vec4 EndColor;
|
glm::vec4 EndColor;
|
||||||
bool Randomness = false;
|
bool Randomness = false;
|
||||||
|
|
||||||
float RandomnessScalar = 1.f;
|
double RandomnessScalar = 1.f;
|
||||||
glm::vec2 Velocity;
|
glm::vec2 Velocity;
|
||||||
bool ColorByDistance = false;
|
bool ColorByDistance = false;
|
||||||
//bool ReverseAnimation = false;
|
//bool ReverseAnimation = false;
|
||||||
//bool Wireframe = false;
|
//bool Wireframe = false;
|
||||||
bool ExponentialAccelaration = false;
|
bool ExponentialAccelaration = false;
|
||||||
bool Reverse = false;
|
bool Reverse = false;
|
||||||
|
double ColorDistanceScalar = 1.f;
|
||||||
|
|
||||||
std::array<float, 50> RandomNumbers = {
|
std::array<float, 50> RandomNumbers = {
|
||||||
0.3257552917701f,
|
0.3257552917701f,
|
||||||
|
|||||||
@@ -11,9 +11,9 @@
|
|||||||
<RandomnessScalar>1</RandomnessScalar>
|
<RandomnessScalar>1</RandomnessScalar>
|
||||||
<Velocity X="2" Y="2"/>
|
<Velocity X="2" Y="2"/>
|
||||||
<ColorByDistance>0</ColorByDistance>
|
<ColorByDistance>0</ColorByDistance>
|
||||||
<!--<ReverseAnimation>0</ReverseAnimation>-->
|
|
||||||
<!--<Wireframe>0</Wireframe>-->
|
<!--<Wireframe>0</Wireframe>-->
|
||||||
<ExponentialAccelaration>0</ExponentialAccelaration>
|
<ExponentialAccelaration>0</ExponentialAccelaration>
|
||||||
<Pulsate>0</Pulsate>
|
<Pulsate>0</Pulsate>
|
||||||
<Reverse>0</Reverse>
|
<Reverse>0</Reverse>
|
||||||
|
<ColorDistanceScalar>1</ColorDistanceScalar>
|
||||||
</ExplosionEffect>
|
</ExplosionEffect>
|
||||||
@@ -42,9 +42,6 @@
|
|||||||
<xs:element name="ColorByDistance" type="t:bool" minOccurs="0">
|
<xs:element name="ColorByDistance" type="t:bool" minOccurs="0">
|
||||||
<xs:annotation><xs:documentation>Change the color by its moved distance instead of by its time</xs:documentation></xs:annotation>
|
<xs:annotation><xs:documentation>Change the color by its moved distance instead of by its time</xs:documentation></xs:annotation>
|
||||||
</xs:element>
|
</xs:element>
|
||||||
<!--<xs:element name="ReverseAnimation" type="t:bool" minOccurs="0">
|
|
||||||
<xs:annotation><xs:documentation>Implosions are cooler</xs:documentation></xs:annotation>
|
|
||||||
</xs:element>-->
|
|
||||||
<!--<xs:element name="Wireframe" type="t:bool" minOccurs="0">
|
<!--<xs:element name="Wireframe" type="t:bool" minOccurs="0">
|
||||||
<xs:annotation><xs:documentation>Enable/disable wireframe</xs:documentation></xs:annotation>
|
<xs:annotation><xs:documentation>Enable/disable wireframe</xs:documentation></xs:annotation>
|
||||||
</xs:element>-->
|
</xs:element>-->
|
||||||
@@ -57,6 +54,9 @@
|
|||||||
<xs:element name="Reverse" type="t:bool" minOccurs="0">
|
<xs:element name="Reverse" type="t:bool" minOccurs="0">
|
||||||
<xs:annotation><xs:documentation>Reverse the effect</xs:documentation></xs:annotation>
|
<xs:annotation><xs:documentation>Reverse the effect</xs:documentation></xs:annotation>
|
||||||
</xs:element>
|
</xs:element>
|
||||||
|
<xs:element name="ColorDistanceScalar" type="t:double" minOccurs="0">
|
||||||
|
<xs:annotation><xs:documentation>Scale the distance of the color change</xs:documentation></xs:annotation>
|
||||||
|
</xs:element>
|
||||||
</xs:all>
|
</xs:all>
|
||||||
</xs:complexType>
|
</xs:complexType>
|
||||||
</xs:element>
|
</xs:element>
|
||||||
|
|||||||
@@ -14,10 +14,10 @@ uniform vec2 Velocity;
|
|||||||
uniform bool ColorByDistance;
|
uniform bool ColorByDistance;
|
||||||
uniform bool ExponentialAccelaration;
|
uniform bool ExponentialAccelaration;
|
||||||
uniform bool Reverse;
|
uniform bool Reverse;
|
||||||
|
uniform float ColorDistanceScalar;
|
||||||
//uniform bool Gravity;
|
//uniform bool Gravity;
|
||||||
//uniform bool Rotation;
|
//uniform bool Rotation;
|
||||||
//uniform bool MaxRadius;
|
//uniform bool MaxRadius;
|
||||||
//uniform bool Pulsate;
|
|
||||||
|
|
||||||
in VertexData{
|
in VertexData{
|
||||||
vec3 Position;
|
vec3 Position;
|
||||||
@@ -146,7 +146,7 @@ void main()
|
|||||||
// if explosion color should be affected by distance instead of time...
|
// if explosion color should be affected by distance instead of time...
|
||||||
if (ColorByDistance == true)
|
if (ColorByDistance == true)
|
||||||
{
|
{
|
||||||
Output.ExplosionPercentageElapsed = (length(triangleCenter2ExplosionRadius) / maxDistance) * isInsideBlastRadius;
|
Output.ExplosionPercentageElapsed = (length(triangleCenter2ExplosionRadius) / maxDistance) * isInsideBlastRadius * ColorDistanceScalar;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -157,21 +157,8 @@ void main()
|
|||||||
for (int i = 0; i < gl_in.length(); i++)
|
for (int i = 0; i < gl_in.length(); i++)
|
||||||
{
|
{
|
||||||
// move the triangle to the blast radius
|
// move the triangle to the blast radius
|
||||||
//if(Reverse == false)
|
ExplodedPosition = Input[i].Position + (triangleCenter2ExplosionRadius * isInsideBlastRadius);
|
||||||
//{
|
|
||||||
ExplodedPosition = Input[i].Position + (triangleCenter2ExplosionRadius * isInsideBlastRadius);
|
|
||||||
//}
|
|
||||||
//else
|
|
||||||
//{
|
|
||||||
// // TODO:
|
|
||||||
// // Remove ifs
|
|
||||||
// // account for randomness
|
|
||||||
// // account for velocity
|
|
||||||
// // account for color
|
|
||||||
//
|
|
||||||
// ExplodedPosition = Input[i].Position + (triangleCenter2ExplosionRadius * maxDistance /** (ExplosionDuration - TimeSinceDeath)*/);
|
|
||||||
//}
|
|
||||||
|
|
||||||
// pass through vertex data
|
// pass through vertex data
|
||||||
PassThingsThrough(i);
|
PassThingsThrough(i);
|
||||||
|
|
||||||
|
|||||||
@@ -1047,7 +1047,12 @@ void DrawFinalPass::BindExplosionUniforms(GLuint shaderHandle, std::shared_ptr<E
|
|||||||
|
|
||||||
glUniform3fv(glGetUniformLocation(shaderHandle, "ExplosionOrigin"), 1, glm::value_ptr(job->ExplosionOrigin));
|
glUniform3fv(glGetUniformLocation(shaderHandle, "ExplosionOrigin"), 1, glm::value_ptr(job->ExplosionOrigin));
|
||||||
GLERROR("Bind 6 uniform");
|
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");
|
GLERROR("Bind 7 uniform");
|
||||||
glUniform1f(glGetUniformLocation(shaderHandle, "ExplosionDuration"), job->ExplosionDuration);
|
glUniform1f(glGetUniformLocation(shaderHandle, "ExplosionDuration"), job->ExplosionDuration);
|
||||||
GLERROR("Bind 8 uniform");
|
GLERROR("Bind 8 uniform");
|
||||||
@@ -1067,6 +1072,8 @@ void DrawFinalPass::BindExplosionUniforms(GLuint shaderHandle, std::shared_ptr<E
|
|||||||
GLERROR("Bind 15 uniform");
|
GLERROR("Bind 15 uniform");
|
||||||
glUniform1i(glGetUniformLocation(shaderHandle, "Reverse"), job->Reverse);
|
glUniform1i(glGetUniformLocation(shaderHandle, "Reverse"), job->Reverse);
|
||||||
GLERROR("Bind 15-2 uniform");
|
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));
|
glUniform4fv(glGetUniformLocation(shaderHandle, "Color"), 1, glm::value_ptr(job->Color));
|
||||||
GLERROR("Bind 16 uniform");
|
GLERROR("Bind 16 uniform");
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ void ExplosionEffectSystem::UpdateComponent(EntityWrapper& entity, ComponentWrap
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//((glm::vec2)component["Velocity"]).x = min(((glm::vec2)component["Velocity"]).x, ((glm::vec2)component["Velocity"]).y);
|
//((glm::vec2&)component["Velocity"]).x = glm::min(((glm::vec2)component["Velocity"]).x, ((glm::vec2)component["Velocity"]).y);
|
||||||
|
|
||||||
(double&)component["TimeSinceDeath"] += dt;
|
(double&)component["TimeSinceDeath"] += dt;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user