-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
223 changed files
with
33,585 additions
and
1,621 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#version 400 core | ||
|
||
uniform sampler2D particleColorSampler; | ||
|
||
out vec4 f_color; | ||
|
||
in vec2 v_uv; | ||
flat in ivec2 v_particleCoord; | ||
in vec4 v_dynamicParticleData; | ||
|
||
void main() | ||
{ | ||
float zz = 1.0 - dot(v_uv, v_uv); | ||
float lifeTime = v_dynamicParticleData.z; | ||
if(zz < 0 || lifeTime <= 0) | ||
discard; | ||
|
||
//smoothly fade out the particles at the end of their lifetime | ||
float alpha = zz * smoothstep(0.0, 0.3, lifeTime); | ||
|
||
vec4 color = texelFetch(particleColorSampler, v_particleCoord, 0); | ||
|
||
f_color = vec4(color.rgb, color.a * alpha); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#version 400 core | ||
|
||
uniform sampler2D dynamicDataSampler; | ||
uniform uint particleTextureSize; | ||
|
||
uniform vec2 cameraPosition; | ||
uniform vec2 cameraSize; | ||
|
||
layout (location = 0) in vec2 basePosition; | ||
layout (location = 1) in vec2 uv; | ||
|
||
out vec2 v_uv; | ||
flat out ivec2 v_particleCoord; | ||
out vec4 v_dynamicParticleData; | ||
|
||
void main() | ||
{ | ||
v_uv = uv; | ||
|
||
ivec2 particleCoord = ivec2(gl_InstanceID / particleTextureSize, mod(gl_InstanceID, particleTextureSize)); | ||
v_particleCoord = particleCoord; | ||
vec4 dynamicParticleData = texelFetch(dynamicDataSampler, particleCoord, 0); | ||
v_dynamicParticleData = dynamicParticleData; | ||
|
||
float lifeTime = dynamicParticleData.z; | ||
if(lifeTime <= 0.0) | ||
{ | ||
gl_Position = vec4(0, 0, 0, 1); | ||
return; | ||
} | ||
|
||
vec2 offset = dynamicParticleData.xy; | ||
vec2 position = basePosition + offset; | ||
position = (position - cameraPosition) / cameraSize; | ||
gl_Position = vec4(position, 0.5, 1); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#version 400 core | ||
|
||
layout (location = 0) in vec2 position; | ||
|
||
void main() | ||
{ | ||
/*vec2 positions[6] = vec2[]( | ||
vec2(-1, -1), | ||
vec2(1, -1), | ||
vec2(1, 1), | ||
vec2(-1, -1), | ||
vec2(1, 1), | ||
vec2(-1, 1) | ||
);*/ | ||
gl_Position = vec4(position, 1, 1.0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#version 400 core | ||
|
||
uniform sampler2D particleSampler; | ||
uniform sampler2D staticDataSampler; | ||
uniform float deltaTime; | ||
|
||
layout(pixel_center_integer) in vec4 gl_FragCoord; | ||
|
||
layout (location = 0) out vec4 particleData; | ||
|
||
void main() | ||
{ | ||
ivec2 textureCoords = ivec2(gl_FragCoord.xy); | ||
vec4 currentData = texelFetch(particleSampler, textureCoords, 0); | ||
float lifeTime = currentData.z; | ||
if(lifeTime <= 0.0) | ||
{ | ||
particleData = vec4(0, 0, 0, 0); | ||
return; | ||
} | ||
|
||
vec2 position = currentData.xy; | ||
|
||
vec4 staticData = texelFetch(staticDataSampler, textureCoords, 0); | ||
vec2 velocity = staticData.xy; | ||
|
||
particleData = vec4(position + velocity * deltaTime, lifeTime - deltaTime, 0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#version 400 core | ||
|
||
uniform sampler2D textureSampler; | ||
|
||
in vec4 v_color; | ||
in float v_distanceToCenter; | ||
|
||
out vec4 outputColor; | ||
|
||
float calculateAlpha() | ||
{ | ||
float commandsAlpha = (-40 * pow(v_distanceToCenter - 0.9, 2) + 1.5) * v_color.a; | ||
//float circleAlpha = max(-128 * pow(v_distanceToCenter - 1.0, 2) + 0.5, 0.0); | ||
//return min(commandsAlpha + circleAlpha, 1.0); | ||
return commandsAlpha; | ||
//float curveValue = sin(2.5 * pow(v_distanceToCenter, 2)); | ||
//return curveValue * pow(mix(v_color.a, 1.0, curveValue), 10); | ||
} | ||
|
||
void main(void) | ||
{ | ||
float alpha = calculateAlpha(); | ||
if(alpha <= 0) | ||
discard; | ||
|
||
outputColor = vec4(v_color.rgb, alpha); | ||
} | ||
|
||
|
||
/*float restoredAlpha() | ||
{ | ||
return v_color.a / v_distanceToCenter; | ||
} | ||
float calculateAlpha() | ||
{ | ||
float alpha = restoredAlpha(); | ||
float circleRadius = 0.7; | ||
float circleAlpha; | ||
if(v_distanceToCenter <= circleRadius) | ||
circleAlpha = max(-64 * pow(v_distanceToCenter - circleRadius, 2) + 0.5, 0.0); | ||
else | ||
circleAlpha = 1 - step(alpha, (v_distanceToCenter - circleRadius)/(1-circleRadius)); | ||
return circleAlpha; | ||
} | ||
void main(void) | ||
{ | ||
if(v_distanceToCenter == 0) | ||
discard; | ||
float alpha = calculateAlpha(); | ||
if(alpha <= 0) | ||
discard; | ||
outputColor = vec4(v_color.rgb, alpha); | ||
}*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#version 400 core | ||
|
||
layout (location = 0) in vec3 position; | ||
layout (location = 1) in vec4 color; | ||
layout (location = 2) in float distanceToCenter; | ||
|
||
out vec4 v_color; | ||
out float v_distanceToCenter; | ||
|
||
uniform vec2 camPosition; | ||
uniform vec2 camSize; | ||
|
||
void main(void) | ||
{ | ||
v_color = color; | ||
v_distanceToCenter = distanceToCenter; | ||
vec3 screenPosition = vec3((position.xy - camPosition) / camSize, position.z); | ||
gl_Position = vec4(screenPosition, 1.0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#pragma once | ||
#include <events/Event.h> | ||
|
||
#include <vector> | ||
#include <glm/vec2.hpp> | ||
|
||
struct AccumulatedCommands { | ||
uint32_t ID; | ||
std::vector<glm::vec2> attackDirections; | ||
std::vector<glm::vec2> moveDirections; | ||
}; | ||
|
||
class AccumulatedCommandsEvent : public Event | ||
{ | ||
public: | ||
AccumulatedCommandsEvent() = default; | ||
virtual ~AccumulatedCommandsEvent() = default; | ||
|
||
std::vector<AccumulatedCommands> commands; | ||
|
||
size_t numberOfGivenCommands = 0; | ||
size_t maxNumberOfCommands = 1; | ||
protected: | ||
|
||
private: | ||
}; |
Oops, something went wrong.