Add moar optimization thingies and some xml clarifications
This commit is contained in:
@@ -1,19 +1,19 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||||
<ExplosionEffect xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ExplosionEffect.xsd">
|
<ExplosionEffect xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ExplosionEffect.xsd">
|
||||||
<ExplosionOrigin X="0" Y="0" Z="0"/>
|
<ExplosionOrigin X="0" Y="0" Z="0"/>
|
||||||
<TimeSinceDeath>0</TimeSinceDeath>
|
<TimeSinceDeath>0.0</TimeSinceDeath>
|
||||||
<ExplosionDuration>2</ExplosionDuration>
|
<ExplosionDuration>2.0</ExplosionDuration>
|
||||||
<!--<Gravity>1</Gravity>-->
|
<!--<Gravity>1</Gravity>-->
|
||||||
<!--<GravityForce>1</GravityForce>-->
|
<!--<GravityForce>1</GravityForce>-->
|
||||||
<!--<ObjectRadius>2</ObjectRadius>-->
|
<!--<ObjectRadius>2</ObjectRadius>-->
|
||||||
<EndColor R="0" G="0" B="0" A="0"/>
|
<EndColor R="0" G="0" B="0" A="0"/>
|
||||||
<Randomness>0</Randomness>
|
<Randomness>false</Randomness>
|
||||||
<RandomnessScalar>1</RandomnessScalar>
|
<RandomnessScalar>1.0</RandomnessScalar>
|
||||||
<Velocity X="2" Y="2"/>
|
<Velocity X="2" Y="2"/>
|
||||||
<ColorByDistance>0</ColorByDistance>
|
<ColorByDistance>false</ColorByDistance>
|
||||||
<!--<Wireframe>0</Wireframe>-->
|
<!--<Wireframe>0</Wireframe>-->
|
||||||
<ExponentialAccelaration>0</ExponentialAccelaration>
|
<ExponentialAccelaration>false</ExponentialAccelaration>
|
||||||
<Pulsate>0</Pulsate>
|
<Pulsate>false</Pulsate>
|
||||||
<Reverse>0</Reverse>
|
<Reverse>false</Reverse>
|
||||||
<ColorDistanceScalar>1</ColorDistanceScalar>
|
<ColorDistanceScalar>1.0</ColorDistanceScalar>
|
||||||
</ExplosionEffect>
|
</ExplosionEffect>
|
||||||
@@ -42,27 +42,27 @@ out VertexData{
|
|||||||
layout(triangles) in;
|
layout(triangles) in;
|
||||||
layout(triangle_strip, max_vertices = 3) out;
|
layout(triangle_strip, max_vertices = 3) out;
|
||||||
|
|
||||||
vec3 EqualTo(vec3 x, vec3 y) {
|
float EqualTo(float x, float y) {
|
||||||
return 1.0 - abs(sign(x - y));
|
return 1.0 - abs(sign(x - y));
|
||||||
}
|
}
|
||||||
|
|
||||||
vec3 NotEqualTo(vec3 x, vec3 y) {
|
float NotEqualTo(float x, float y) {
|
||||||
return abs(sign(x - y));
|
return abs(sign(x - y));
|
||||||
}
|
}
|
||||||
|
|
||||||
vec3 GreaterThan(vec3 x, vec3 y) {
|
float GreaterThan(float x, float y) {
|
||||||
return max(sign(x - y), 0.0);
|
return max(sign(x - y), 0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
vec3 LessThan(vec3 x, vec3 y) {
|
float LessThan(float x, float y) {
|
||||||
return max(sign(y - x), 0.0);
|
return max(sign(y - x), 0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
vec3 GreaterEqualTo(vec3 x, vec3 y) {
|
float GreaterEqualTo(float x, float y) {
|
||||||
return 1.0 - LessThan(x, y);
|
return 1.0 - LessThan(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
vec3 LessEqualTo(vec3 x, vec3 y) {
|
float LessEqualTo(float x, float y) {
|
||||||
return 1.0 - GreaterThan(x, y);
|
return 1.0 - GreaterThan(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,7 +118,7 @@ void main()
|
|||||||
float timePercetage = TimeSinceDeath / ExplosionDuration;
|
float timePercetage = TimeSinceDeath / ExplosionDuration;
|
||||||
|
|
||||||
// get a random number if randomness is enabled, otherwise the random distance will be zero and won't affect the other algorithms
|
// get a random number if randomness is enabled, otherwise the random distance will be zero and won't affect the other algorithms
|
||||||
float randomDistance = GetRandomNumber(gl_PrimitiveIDIn) * RandomnessScalar * float(Randomness);
|
float randomDistance = float(Randomness) * GetRandomNumber(gl_PrimitiveIDIn) * RandomnessScalar;
|
||||||
|
|
||||||
vec2 randomVelocity = Velocity * (randomDistance + 1.0);
|
vec2 randomVelocity = Velocity * (randomDistance + 1.0);
|
||||||
|
|
||||||
@@ -137,7 +137,7 @@ void main()
|
|||||||
vec3 triangleCenter2ExplosionRadius = (normalizedOrigin2TriangleCenterVector * blastWave) - (normalizedOrigin2TriangleCenterVector * origin2TriangleCenterDistanceWithRandomness);
|
vec3 triangleCenter2ExplosionRadius = (normalizedOrigin2TriangleCenterVector * blastWave) - (normalizedOrigin2TriangleCenterVector * origin2TriangleCenterDistanceWithRandomness);
|
||||||
|
|
||||||
// if the triangle is inside the blast's radius...
|
// if the triangle is inside the blast's radius...
|
||||||
float isInsideBlastRadius = LessEqualTo(vec3(origin2TriangleCenterDistanceWithRandomness), vec3(blastWave)).x;
|
float isInsideBlastRadius = LessEqualTo(origin2TriangleCenterDistanceWithRandomness, blastWave);
|
||||||
|
|
||||||
// calculate the max distance (s) the triangle will move
|
// calculate the max distance (s) the triangle will move
|
||||||
float accelaration = (randomVelocity.y - randomVelocity.x) / ExplosionDuration;
|
float accelaration = (randomVelocity.y - randomVelocity.x) / ExplosionDuration;
|
||||||
|
|||||||
Reference in New Issue
Block a user