Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| bdcb33d992 |
@@ -27,8 +27,6 @@ struct ExplosionEffectJob : ModelJob
|
|||||||
Velocity = (glm::vec2)explosionEffectComponent["Velocity"];
|
Velocity = (glm::vec2)explosionEffectComponent["Velocity"];
|
||||||
ColorByDistance = (bool)explosionEffectComponent["ColorByDistance"];
|
ColorByDistance = (bool)explosionEffectComponent["ColorByDistance"];
|
||||||
ExponentialAccelaration = (bool)explosionEffectComponent["ExponentialAccelaration"];
|
ExponentialAccelaration = (bool)explosionEffectComponent["ExponentialAccelaration"];
|
||||||
Reverse = (bool)explosionEffectComponent["Reverse"];
|
|
||||||
ColorDistanceScalar = (double)explosionEffectComponent["ColorDistanceScalar"];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
glm::vec3 ExplosionOrigin;
|
glm::vec3 ExplosionOrigin;
|
||||||
@@ -40,14 +38,12 @@ struct ExplosionEffectJob : ModelJob
|
|||||||
glm::vec4 EndColor;
|
glm::vec4 EndColor;
|
||||||
bool Randomness = false;
|
bool Randomness = false;
|
||||||
|
|
||||||
double RandomnessScalar = 1.f;
|
float 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;
|
|
||||||
double ColorDistanceScalar = 1.f;
|
|
||||||
|
|
||||||
std::array<float, 50> RandomNumbers = {
|
std::array<float, 50> RandomNumbers = {
|
||||||
0.3257552917701f,
|
0.3257552917701f,
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
#include "Core/System.h"
|
#include "Core/System.h"
|
||||||
#include "Engine/GLM.h"
|
|
||||||
|
|
||||||
class ExplosionEffectSystem : public PureSystem
|
class ExplosionEffectSystem : public PureSystem
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include "Core/System.h"
|
#include "Core/System.h"
|
||||||
#include "Input/EInputCommand.h"
|
#include "Input/EInputCommand.h"
|
||||||
|
#include "Network/EPlayerDisconnected.h"
|
||||||
|
|
||||||
class SpectatorCameraSystem : public ImpureSystem
|
class SpectatorCameraSystem : public ImpureSystem
|
||||||
{
|
{
|
||||||
@@ -17,6 +18,8 @@ private:
|
|||||||
|
|
||||||
EventRelay<SpectatorCameraSystem, Events::InputCommand> m_EInputCommand;
|
EventRelay<SpectatorCameraSystem, Events::InputCommand> m_EInputCommand;
|
||||||
bool OnInputCommand(const Events::InputCommand& e);
|
bool OnInputCommand(const Events::InputCommand& e);
|
||||||
|
EventRelay<SpectatorCameraSystem, Events::PlayerDisconnected> m_EDisconnect;
|
||||||
|
bool OnDisconnect(const Events::PlayerDisconnected& e);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -29,4 +29,6 @@ K=TakeDamage,1500
|
|||||||
F2=PerformanceTimingResetAllTimers
|
F2=PerformanceTimingResetAllTimers
|
||||||
F3=PerformanceTimingCreateExcelData
|
F3=PerformanceTimingCreateExcelData
|
||||||
Comma=SwapToClassPick
|
Comma=SwapToClassPick
|
||||||
Period=SwapToTeamPick
|
Period=SwapToTeamPick
|
||||||
|
Enter=PickClass,1
|
||||||
|
F5=DisconnectFromServer
|
||||||
@@ -1,21 +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.0</TimeSinceDeath>
|
<TimeSinceDeath>0</TimeSinceDeath>
|
||||||
<ExplosionDuration>2.0</ExplosionDuration>
|
<ExplosionDuration>2</ExplosionDuration>
|
||||||
<Speed>1</Speed>
|
<Speed>1</Speed>
|
||||||
<Delay>0</Delay>
|
<Delay>0</Delay>
|
||||||
<!--<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>false</Randomness>
|
<Randomness>0</Randomness>
|
||||||
<RandomnessScalar>1.0</RandomnessScalar>
|
<RandomnessScalar>1</RandomnessScalar>
|
||||||
<Velocity X="2" Y="2"/>
|
<Velocity X="2" Y="2"/>
|
||||||
<ColorByDistance>false</ColorByDistance>
|
<ColorByDistance>0</ColorByDistance>
|
||||||
|
<!--<ReverseAnimation>0</ReverseAnimation>-->
|
||||||
<!--<Wireframe>0</Wireframe>-->
|
<!--<Wireframe>0</Wireframe>-->
|
||||||
<ExponentialAccelaration>false</ExponentialAccelaration>
|
<ExponentialAccelaration>0</ExponentialAccelaration>
|
||||||
<Pulsate>false</Pulsate>
|
|
||||||
<Reverse>false</Reverse>
|
|
||||||
<ColorDistanceScalar>1.0</ColorDistanceScalar>
|
|
||||||
</ExplosionEffect>
|
</ExplosionEffect>
|
||||||
@@ -44,21 +44,15 @@
|
|||||||
<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>-->
|
||||||
<xs:element name="ExponentialAccelaration" type="t:bool" minOccurs="0">
|
<xs:element name="ExponentialAccelaration" type="t:bool" minOccurs="0">
|
||||||
<xs:annotation><xs:documentation>Linear/Exponential accelaration</xs:documentation></xs:annotation>
|
<xs:annotation><xs:documentation>Linear/Exponential accelaration</xs:documentation></xs:annotation>
|
||||||
</xs:element>
|
</xs:element>
|
||||||
<xs:element name="Pulsate" type="t:bool" minOccurs="0">
|
|
||||||
<xs:annotation><xs:documentation>Pulsate the effect</xs:documentation></xs:annotation>
|
|
||||||
</xs:element>
|
|
||||||
<xs:element name="Reverse" type="t:bool" minOccurs="0">
|
|
||||||
<xs:annotation><xs:documentation>Reverse the effect</xs:documentation></xs:annotation>
|
|
||||||
</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>
|
||||||
|
|||||||
@@ -15,11 +15,6 @@ uniform float RandomnessScalar;
|
|||||||
uniform vec2 Velocity;
|
uniform vec2 Velocity;
|
||||||
uniform bool ColorByDistance;
|
uniform bool ColorByDistance;
|
||||||
uniform bool ExponentialAccelaration;
|
uniform bool ExponentialAccelaration;
|
||||||
uniform bool Reverse;
|
|
||||||
uniform float ColorDistanceScalar;
|
|
||||||
//uniform bool Gravity;
|
|
||||||
//uniform bool Rotation;
|
|
||||||
//uniform bool MaxRadius;
|
|
||||||
|
|
||||||
in VertexData{
|
in VertexData{
|
||||||
vec3 Position;
|
vec3 Position;
|
||||||
@@ -46,136 +41,169 @@ out VertexData{
|
|||||||
layout(triangles) in;
|
layout(triangles) in;
|
||||||
layout(triangle_strip, max_vertices = 3) out;
|
layout(triangle_strip, max_vertices = 3) out;
|
||||||
|
|
||||||
float EqualTo(float x, float y) {
|
|
||||||
return 1.0 - abs(sign(x - y));
|
|
||||||
}
|
|
||||||
|
|
||||||
float NotEqualTo(float x, float y) {
|
|
||||||
return abs(sign(x - y));
|
|
||||||
}
|
|
||||||
|
|
||||||
float GreaterThan(float x, float y) {
|
|
||||||
return max(sign(x - y), 0.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
float LessThan(float x, float y) {
|
|
||||||
return max(sign(y - x), 0.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
float GreaterEqualTo(float x, float y) {
|
|
||||||
return 1.0 - LessThan(x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
float LessEqualTo(float x, float y) {
|
|
||||||
return 1.0 - GreaterThan(x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
// returns a "random" number based on input parameter
|
// returns a "random" number based on input parameter
|
||||||
float GetRandomNumber(int polygon_index)
|
float GetRandomNumber(int polygon_index)
|
||||||
{
|
{
|
||||||
return RandomNumbers[int(mod(polygon_index, 50))];
|
int randomIndex = int(mod(polygon_index, 50));
|
||||||
|
|
||||||
|
return RandomNumbers[randomIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
vec3 CalcCenterOfTriangle(vec3 vertex0, vec3 vertex1, vec3 vertex2)
|
float randomNumber = 0.0;
|
||||||
|
float randomDistance = 0.0;
|
||||||
|
|
||||||
|
void main()
|
||||||
{
|
{
|
||||||
// calculate middle of vectors
|
// calculate middle of vectors
|
||||||
vec3 dir1 = normalize(vertex1 - vertex0);
|
vec3 v1 = Input[1].Position - Input[0].Position;
|
||||||
vec3 dir2 = normalize(vertex2 - vertex0);
|
vec3 v2 = Input[2].Position - Input[0].Position;
|
||||||
|
vec3 v3 = Input[2].Position - (v1 / 2);
|
||||||
|
vec3 v4 = Input[1].Position - (v2 / 2);
|
||||||
|
|
||||||
vec3 vecA = vertex2 - vertex1; //o2 - o1
|
// calculate intersection
|
||||||
|
|
||||||
|
// normalize direction
|
||||||
|
vec3 dir1 = normalize(v1);
|
||||||
|
vec3 dir2 = normalize(v2);
|
||||||
|
|
||||||
|
vec3 vecA = Input[2].Position - Input[1].Position; //o2 - o1
|
||||||
vec3 vecB = cross(dir1, dir2);
|
vec3 vecB = cross(dir1, dir2);
|
||||||
|
|
||||||
mat3 matrisA = mat3(vecA, dir2, vecB);
|
mat3 matrisA = mat3(vecA, dir2, vecB);
|
||||||
|
|
||||||
float lengthA = length(vecB);
|
float lengthA = length(vecB);
|
||||||
lengthA = lengthA * lengthA;
|
lengthA = lengthA * lengthA;
|
||||||
|
|
||||||
float s = determinant(matrisA) / lengthA;
|
float s = determinant(matrisA) / lengthA;
|
||||||
|
|
||||||
// center position of triangle
|
// center position of triangle
|
||||||
return vertex1 + (s * dir1);
|
vec3 centerOfTriangle = Input[1].Position + (s * dir1);
|
||||||
}
|
|
||||||
|
|
||||||
void PassThingsThrough(int index)
|
|
||||||
{
|
|
||||||
// pass through vertex data
|
|
||||||
Output.Normal = Input[index].Normal;
|
|
||||||
Output.Position = Input[index].Position;
|
|
||||||
Output.TextureCoordinate = Input[index].TextureCoordinate;
|
|
||||||
Output.Tangent = Input[index].Tangent;
|
|
||||||
Output.BiTangent = Input[index].BiTangent;
|
|
||||||
Output.ExplosionColor = EndColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
vec3 centerOfTriangle = CalcCenterOfTriangle(Input[0].Position, Input[1].Position, Input[2].Position);
|
|
||||||
|
|
||||||
// center position of triangle to origin vector
|
// center position of triangle to origin vector
|
||||||
vec3 origin2TriangleCenterVector = centerOfTriangle - ExplosionOrigin;
|
vec3 origin2TriangleCenterVector = centerOfTriangle - ExplosionOrigin;
|
||||||
vec3 normalizedOrigin2TriangleCenterVector = normalize(origin2TriangleCenterVector);
|
vec3 normalizedOrigin2TriangleCenterVector = normalize(origin2TriangleCenterVector);
|
||||||
|
|
||||||
// distance between origin and the center of the current triangle
|
|
||||||
float origin2TriangleCenterDistance = length(origin2TriangleCenterVector);
|
|
||||||
|
|
||||||
// time percentage until end of explosion (0.0-1.0)
|
// time percentage until end of explosion (0.0-1.0)
|
||||||
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 number will be zero and won't affect the other algorithms
|
||||||
float randomDistance = float(Randomness) * GetRandomNumber(gl_PrimitiveIDIn) * RandomnessScalar;
|
if (Randomness == true)
|
||||||
|
{
|
||||||
|
randomDistance = GetRandomNumber(gl_PrimitiveIDIn) * RandomnessScalar;
|
||||||
|
}
|
||||||
|
|
||||||
vec2 randomVelocity = Velocity * (randomDistance + 1.0);
|
vec2 randomVelocity = Velocity * (randomDistance + 1.0);
|
||||||
|
|
||||||
// accelaration to use on current frame. is a interpolation between start and end value
|
// accelaration to use on current frame. is a interpolation between start and end value
|
||||||
float currentVelocity = mix(randomVelocity.x, randomVelocity.y, timePercetage);
|
float currentVelocity = mix(randomVelocity.x, randomVelocity.y, timePercetage);
|
||||||
|
|
||||||
// if the accelaration should be exponential
|
if (ExponentialAccelaration == true)
|
||||||
currentVelocity = currentVelocity * max(currentVelocity * float(ExponentialAccelaration), 1.0);
|
{
|
||||||
|
currentVelocity = pow(currentVelocity, 2) / 2.0;
|
||||||
|
}
|
||||||
|
|
||||||
// the distance the blast has moved since the beginning, i.e. its radius
|
// distance between origin and the center of the current triangle
|
||||||
float blastWave = TimeSinceDeath * currentVelocity;
|
float origin2TriangleCenterDistance = length(origin2TriangleCenterVector);
|
||||||
|
|
||||||
// the distance from origin to the triangle center with eventual randomness added
|
// the distance from origin to the triangle center with eventual randomness added
|
||||||
float origin2TriangleCenterDistanceWithRandomness = origin2TriangleCenterDistance + randomDistance;
|
float fullDistanceWithRandomness = origin2TriangleCenterDistance + randomDistance;
|
||||||
|
|
||||||
vec3 triangleCenter2ExplosionRadius = (normalizedOrigin2TriangleCenterVector * blastWave) - (normalizedOrigin2TriangleCenterVector * origin2TriangleCenterDistanceWithRandomness);
|
|
||||||
|
|
||||||
// if the triangle is inside the blast's radius...
|
// vector from the triangle center to the explosion's shockwave
|
||||||
float isInsideBlastRadius = LessEqualTo(origin2TriangleCenterDistanceWithRandomness, blastWave);
|
vec3 triangleCenter2ExplosionRadius = (normalizedOrigin2TriangleCenterVector * (TimeSinceDeath * currentVelocity)) - (normalizedOrigin2TriangleCenterVector * fullDistanceWithRandomness);
|
||||||
|
|
||||||
// calculate the max distance (s) the triangle will move
|
// if the triangle is inside the blast radius...
|
||||||
float accelaration = (randomVelocity.y - randomVelocity.x) / ExplosionDuration;
|
if (fullDistanceWithRandomness <= (TimeSinceDeath * currentVelocity))
|
||||||
float maxDistance = (randomVelocity.x * ExplosionDuration) + (0.5 * accelaration * ExplosionDuration * ExplosionDuration);
|
|
||||||
|
|
||||||
// if explosion color should be affected by distance instead of time...
|
|
||||||
if (ColorByDistance == true)
|
|
||||||
{
|
{
|
||||||
Output.ExplosionPercentageElapsed = (length(triangleCenter2ExplosionRadius) / maxDistance) * isInsideBlastRadius * ColorDistanceScalar;
|
float maxRadius = max(TimeSinceDeath * currentVelocity, (ExplosionDuration * currentVelocity));
|
||||||
|
|
||||||
|
float a = (randomVelocity.y - randomVelocity.x) / ExplosionDuration;
|
||||||
|
//float t = sqrt((2 * origin2TriangleCenterDistance) / a);
|
||||||
|
|
||||||
|
// if explosion color should be affected by distance instead of time...
|
||||||
|
if (ColorByDistance == true)
|
||||||
|
{
|
||||||
|
// calculate the max distance (s) the triangle will move
|
||||||
|
float s = (randomVelocity.x * ExplosionDuration) + (0.5 * a * pow(ExplosionDuration, 2));
|
||||||
|
float te = (length(triangleCenter2ExplosionRadius) / s);
|
||||||
|
|
||||||
|
Output.ExplosionColor = EndColor;
|
||||||
|
Output.ExplosionPercentageElapsed = te;
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Output.ExplosionColor = EndColor;
|
||||||
|
Output.ExplosionPercentageElapsed = timePercetage;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// for every vertex on the triangle...
|
||||||
|
for (int i = 0; i < gl_in.length(); i++)
|
||||||
|
{
|
||||||
|
// move the triangle to the blast radius
|
||||||
|
vec3 ExplodedPosition = Input[i].Position + triangleCenter2ExplosionRadius;
|
||||||
|
|
||||||
|
// pass through vertex data
|
||||||
|
Output.Normal = Input[i].Normal;
|
||||||
|
Output.Position = Input[i].Position;
|
||||||
|
Output.TextureCoordinate = Input[i].TextureCoordinate;
|
||||||
|
Output.Tangent = Input[i].Tangent;
|
||||||
|
Output.BiTangent = Input[i].BiTangent;
|
||||||
|
for (int j = 0; j < MAX_SPLITS; j++)
|
||||||
|
{
|
||||||
|
Output.PositionLightSpace[j] = Input[i].PositionLightSpace[j];
|
||||||
|
}
|
||||||
|
|
||||||
|
// convert to model space for the gravity to always be in -y
|
||||||
|
vec4 ExplodedPositionInModelSpace = M * vec4(ExplodedPosition, 1.0);
|
||||||
|
|
||||||
|
// if there is gravity, apply it
|
||||||
|
//if (Gravity == true)
|
||||||
|
//{
|
||||||
|
// // ---DO THIS----> //ExplodedPositionInModelSpace.y = ExplodedPositionInModelSpace.y - TimeSinceHit;
|
||||||
|
//
|
||||||
|
// ExplodedPositionInModelSpace.y = ExplodedPositionInModelSpace.y - pow(TimeSinceDeath, 2);
|
||||||
|
//}
|
||||||
|
|
||||||
|
// convert to screen space
|
||||||
|
gl_Position = P*V * ExplodedPositionInModelSpace;
|
||||||
|
EmitVertex();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Output.ExplosionPercentageElapsed = timePercetage;
|
// if explosion color should be affected by distance instead of time...
|
||||||
|
if (ColorByDistance == true)
|
||||||
|
{
|
||||||
|
Output.ExplosionColor = EndColor;
|
||||||
|
Output.ExplosionPercentageElapsed = 0.0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Output.ExplosionColor = EndColor;
|
||||||
|
Output.ExplosionPercentageElapsed = timePercetage;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// for every vertex on the triangle...
|
||||||
|
for(int i = 0; i < gl_in.length(); i++)
|
||||||
|
{
|
||||||
|
// pass through vertex data
|
||||||
|
Output.Normal = Input[i].Normal;
|
||||||
|
Output.Position = Input[i].Position;
|
||||||
|
Output.TextureCoordinate = Input[i].TextureCoordinate;
|
||||||
|
Output.Tangent = Input[i].Tangent;
|
||||||
|
Output.BiTangent = Input[i].BiTangent;
|
||||||
|
for (int j = 0; j < MAX_SPLITS; j++)
|
||||||
|
{
|
||||||
|
Output.PositionLightSpace[j] = Input[i].PositionLightSpace[j];
|
||||||
|
}
|
||||||
|
|
||||||
|
// no change in position, pass through vertex
|
||||||
|
gl_Position = gl_in[i].gl_Position;
|
||||||
|
EmitVertex();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
vec3 ExplodedPosition;
|
//EndPrimitive();
|
||||||
for (int i = 0; i < gl_in.length(); i++)
|
}
|
||||||
{
|
|
||||||
// move the triangle to the blast radius
|
|
||||||
ExplodedPosition = Input[i].Position + (triangleCenter2ExplosionRadius * isInsideBlastRadius);
|
|
||||||
|
|
||||||
// pass through vertex data
|
|
||||||
PassThingsThrough(i);
|
|
||||||
for (int j = 0; j < MAX_SPLITS; j++)
|
|
||||||
{
|
|
||||||
Output.PositionLightSpace[j] = Input[i].PositionLightSpace[j];
|
|
||||||
}
|
|
||||||
for (int j = 0; j < MAX_SPLITS; j++)
|
|
||||||
{
|
|
||||||
Output.PositionLightSpace[j] = Input[i].PositionLightSpace[j];
|
|
||||||
}
|
|
||||||
|
|
||||||
// convert to window space
|
|
||||||
gl_Position = P * V * M * vec4(ExplodedPosition, 1.0);
|
|
||||||
EmitVertex();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ EditorSystem::EditorSystem(SystemParams params, IRenderer* renderer, RenderFrame
|
|||||||
Enable();
|
Enable();
|
||||||
} else {
|
} else {
|
||||||
Disable();
|
Disable();
|
||||||
|
m_EventBroker->Publish(Events::UnlockMouse());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "Network/Client.h"
|
#include "Network/Client.h"
|
||||||
|
#include "Network/EPlayerDisconnected.h"
|
||||||
using namespace boost::asio::ip;
|
using namespace boost::asio::ip;
|
||||||
|
|
||||||
Client::Client(World* world, EventBroker* eventBroker)
|
Client::Client(World* world, EventBroker* eventBroker)
|
||||||
@@ -224,7 +225,7 @@ void Client::parseServerlist(Packet& packet)
|
|||||||
void Client::parseKick()
|
void Client::parseKick()
|
||||||
{
|
{
|
||||||
LOG_WARNING("You have been kicked from the server.");
|
LOG_WARNING("You have been kicked from the server.");
|
||||||
m_IsConnected = false;
|
disconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::parseSpawnEvents()
|
void Client::parseSpawnEvents()
|
||||||
@@ -464,6 +465,10 @@ void Client::disconnect()
|
|||||||
Packet packet(MessageType::Disconnect, m_SendPacketID);
|
Packet packet(MessageType::Disconnect, m_SendPacketID);
|
||||||
m_Reliable.Send(packet);
|
m_Reliable.Send(packet);
|
||||||
m_Reliable.Disconnect();
|
m_Reliable.Disconnect();
|
||||||
|
Events::PlayerDisconnected e;
|
||||||
|
e.Entity = m_LocalPlayer.ID;
|
||||||
|
e.PlayerID = -1;
|
||||||
|
m_EventBroker->Publish(e);
|
||||||
createMainMenu();
|
createMainMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1319,12 +1319,7 @@ 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");
|
||||||
if (job->Reverse == false) {
|
glUniform1f(glGetUniformLocation(shaderHandle, "TimeSinceDeath"), job->TimeSinceDeath);
|
||||||
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");
|
||||||
@@ -1342,10 +1337,6 @@ void DrawFinalPass::BindExplosionUniforms(GLuint shaderHandle, std::shared_ptr<E
|
|||||||
GLERROR("Bind 14 uniform");
|
GLERROR("Bind 14 uniform");
|
||||||
glUniform1i(glGetUniformLocation(shaderHandle, "ExponentialAccelaration"), job->ExponentialAccelaration);
|
glUniform1i(glGetUniformLocation(shaderHandle, "ExponentialAccelaration"), job->ExponentialAccelaration);
|
||||||
GLERROR("Bind 15 uniform");
|
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));
|
glUniform4fv(glGetUniformLocation(shaderHandle, "Color"), 1, glm::value_ptr(job->Color));
|
||||||
GLERROR("Bind 16 uniform");
|
GLERROR("Bind 16 uniform");
|
||||||
|
|||||||
@@ -7,15 +7,12 @@ void ExplosionEffectSystem::UpdateComponent(EntityWrapper& entity, ComponentWrap
|
|||||||
delay = std::max(0.0, delay - dt);
|
delay = std::max(0.0, delay - dt);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (delay <= 0) {
|
if (delay <= 0) {
|
||||||
double& timeSinceDeath = component["TimeSinceDeath"];
|
double& timeSinceDeath = component["TimeSinceDeath"];
|
||||||
timeSinceDeath += (double)component["Speed"] * dt;
|
timeSinceDeath += (double)component["Speed"] * dt;
|
||||||
if (timeSinceDeath < 0) {
|
if (timeSinceDeath < 0 || timeSinceDeath > (double)component["ExplosionDuration"]) {
|
||||||
timeSinceDeath = 0.0;
|
timeSinceDeath = 0.0;
|
||||||
}
|
}
|
||||||
else if (timeSinceDeath >(double)component["ExplosionDuration"]) {
|
}
|
||||||
timeSinceDeath = (double)component["ExplosionDuration"];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ SpectatorCameraSystem::SpectatorCameraSystem(SystemParams params)
|
|||||||
, m_PickedTeam(-1)
|
, m_PickedTeam(-1)
|
||||||
{
|
{
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EInputCommand, &SpectatorCameraSystem::OnInputCommand);
|
EVENT_SUBSCRIBE_MEMBER(m_EInputCommand, &SpectatorCameraSystem::OnInputCommand);
|
||||||
|
EVENT_SUBSCRIBE_MEMBER(m_EDisconnect, &SpectatorCameraSystem::OnDisconnect);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpectatorCameraSystem::Update(double dt)
|
void SpectatorCameraSystem::Update(double dt)
|
||||||
@@ -87,4 +88,17 @@ bool SpectatorCameraSystem::OnInputCommand(const Events::InputCommand& e)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SpectatorCameraSystem::OnDisconnect(const Events::PlayerDisconnected& e)
|
||||||
|
{
|
||||||
|
// If local player gets disconnected, they should be set to
|
||||||
|
// the spectator camera next time a map loads that has one.
|
||||||
|
if (e.Entity == LocalPlayer.ID) {
|
||||||
|
m_CamSetToTeamPick = false;
|
||||||
|
// They will also be set to menu, so unlock mouse just in case they were in game with locked mouse.
|
||||||
|
Events::UnlockMouse unlock;
|
||||||
|
m_EventBroker->Publish(unlock);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user