Merge branch 'master' into CPArrow
# Conflicts: # resources/Schema/Entities/Player.xml # resources/Schema/Entities/PlayerRed.xml
This commit is contained in:
@@ -105,6 +105,11 @@ protected:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
if (io.WantCaptureMouse || io.WantCaptureKeyboard) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
m_SpeedMultiplier += e.DeltaY * (0.1 * m_SpeedMultiplier);
|
m_SpeedMultiplier += e.DeltaY * (0.1 * m_SpeedMultiplier);
|
||||||
m_Config->Set("Editor.CameraSpeed", m_SpeedMultiplier);
|
m_Config->Set("Editor.CameraSpeed", m_SpeedMultiplier);
|
||||||
m_Config->SaveToDisk();
|
m_Config->SaveToDisk();
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ public:
|
|||||||
virtual bool OnCommand(const Events::InputCommand& e) override;
|
virtual bool OnCommand(const Events::InputCommand& e) override;
|
||||||
virtual void Reset();
|
virtual void Reset();
|
||||||
|
|
||||||
void AssaultDashCheck(double dt, bool isJumping, double assaultDashCoolDownMaxTimer);
|
void AssaultDashCheck(double dt, bool isJumping, double assaultDashCoolDownMaxTimer, double& assaultDashCoolDownTimer);
|
||||||
virtual bool AssaultDashDoubleTapped() const { return m_AssaultDashDoubleTapped; }
|
virtual bool AssaultDashDoubleTapped() const { return m_AssaultDashDoubleTapped; }
|
||||||
virtual bool PlayerIsDashing() const { return m_PlayerIsDashing; }
|
virtual bool PlayerIsDashing() const { return m_PlayerIsDashing; }
|
||||||
|
|
||||||
@@ -41,7 +41,6 @@ protected:
|
|||||||
bool m_Crouching = false;
|
bool m_Crouching = false;
|
||||||
//assault dash membervariables - needed to calculate the doubletap- and dashlogic
|
//assault dash membervariables - needed to calculate the doubletap- and dashlogic
|
||||||
double m_AssaultDashDoubleTapDeltaTime = 0.0;
|
double m_AssaultDashDoubleTapDeltaTime = 0.0;
|
||||||
double m_AssaultDashCoolDownTimer = 0.0;
|
|
||||||
//i will let m_AssaultDashDoubleTapSensitivityTimer stay hardcoded, its not really a gamevariable (more an inputvariable),
|
//i will let m_AssaultDashDoubleTapSensitivityTimer stay hardcoded, its not really a gamevariable (more an inputvariable),
|
||||||
//and its very unlikely that someone wants to change that value
|
//and its very unlikely that someone wants to change that value
|
||||||
const float m_AssaultDashDoubleTapSensitivityTimer = 0.25f;
|
const float m_AssaultDashDoubleTapSensitivityTimer = 0.25f;
|
||||||
@@ -191,21 +190,21 @@ bool FirstPersonInputController<EventContext>::OnLockMouse(const Events::LockMou
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename EventContext>
|
template <typename EventContext>
|
||||||
void FirstPersonInputController<EventContext>::AssaultDashCheck(double dt, bool isJumping, double assaultDashCoolDownMaxTimer) {
|
void FirstPersonInputController<EventContext>::AssaultDashCheck(double dt, bool isJumping, double assaultDashCoolDownMaxTimer, double& assaultDashCoolDownTimer) {
|
||||||
m_AssaultDashDoubleTapDeltaTime += dt;
|
m_AssaultDashDoubleTapDeltaTime += dt;
|
||||||
m_AssaultDashCoolDownTimer -= dt;
|
assaultDashCoolDownTimer -= dt;
|
||||||
//cooldown = assaultDashCoolDownMaxTimer sec, pretend the dash lasts 0.25 sec (for friction to do its work)
|
//cooldown = assaultDashCoolDownMaxTimer sec, pretend the dash lasts 0.25 sec (for friction to do its work)
|
||||||
if (m_AssaultDashCoolDownTimer > (assaultDashCoolDownMaxTimer - 0.25f)) {
|
if (assaultDashCoolDownTimer > (assaultDashCoolDownMaxTimer - 0.25f)) {
|
||||||
m_PlayerIsDashing = true;
|
m_PlayerIsDashing = true;
|
||||||
} else {
|
} else {
|
||||||
m_PlayerIsDashing = false;
|
m_PlayerIsDashing = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//dashing with shift
|
//dashing with shift
|
||||||
if (m_ShiftDashing && m_AssaultDashCoolDownTimer <= 0.0f) {
|
if (m_ShiftDashing && assaultDashCoolDownTimer <= 0.0f) {
|
||||||
//player is dashing with shift
|
//player is dashing with shift
|
||||||
//the wanted-direction is set in playermovement already so we dont need to check what direction we want to dash in!
|
//the wanted-direction is set in playermovement already so we dont need to check what direction we want to dash in!
|
||||||
m_AssaultDashCoolDownTimer = assaultDashCoolDownMaxTimer;
|
assaultDashCoolDownTimer = assaultDashCoolDownMaxTimer;
|
||||||
m_AssaultDashDoubleTapped = true;
|
m_AssaultDashDoubleTapped = true;
|
||||||
m_AssaultDashDoubleTapDeltaTime = 0.f;
|
m_AssaultDashDoubleTapDeltaTime = 0.f;
|
||||||
return;
|
return;
|
||||||
@@ -227,7 +226,7 @@ void FirstPersonInputController<EventContext>::AssaultDashCheck(double dt, bool
|
|||||||
}
|
}
|
||||||
m_ValidDoubleTap = false;
|
m_ValidDoubleTap = false;
|
||||||
|
|
||||||
if (!(m_AssaultDashCoolDownTimer <= 0.0f)) {
|
if (!(assaultDashCoolDownTimer <= 0.0f)) {
|
||||||
//if we cant dash at the moment, then just reset the tap-sensitivity-timer
|
//if we cant dash at the moment, then just reset the tap-sensitivity-timer
|
||||||
m_AssaultDashDoubleTapDeltaTime = 0.f;
|
m_AssaultDashDoubleTapDeltaTime = 0.f;
|
||||||
return;
|
return;
|
||||||
@@ -235,7 +234,7 @@ void FirstPersonInputController<EventContext>::AssaultDashCheck(double dt, bool
|
|||||||
//ok, we have a valid tap, lets do it
|
//ok, we have a valid tap, lets do it
|
||||||
m_AssaultDashDoubleTapped = true;
|
m_AssaultDashDoubleTapped = true;
|
||||||
m_AssaultDashDoubleTapDeltaTime = 0.f;
|
m_AssaultDashDoubleTapDeltaTime = 0.f;
|
||||||
m_AssaultDashCoolDownTimer = assaultDashCoolDownMaxTimer;
|
assaultDashCoolDownTimer = assaultDashCoolDownMaxTimer;
|
||||||
|
|
||||||
Events::DashAbility e;
|
Events::DashAbility e;
|
||||||
m_EventBroker->Publish(e);
|
m_EventBroker->Publish(e);
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
#include "Network/EInterpolate.h"
|
#include "Network/EInterpolate.h"
|
||||||
#include "Network/SnapshotFilter.h"
|
#include "Network/SnapshotFilter.h"
|
||||||
#include "Core/EPlayerSpawned.h"
|
#include "Core/EPlayerSpawned.h"
|
||||||
|
#include "Core/EAmmoPickup.h"
|
||||||
#include "Network/ESearchForServers.h"
|
#include "Network/ESearchForServers.h"
|
||||||
|
|
||||||
struct ServerInfo
|
struct ServerInfo
|
||||||
@@ -106,7 +107,8 @@ private:
|
|||||||
void parsePlayerDamage(Packet& packet);
|
void parsePlayerDamage(Packet& packet);
|
||||||
void parseComponentDeletion(Packet& packet);
|
void parseComponentDeletion(Packet& packet);
|
||||||
void parseDoubleJump(Packet& packet);
|
void parseDoubleJump(Packet& packet);
|
||||||
void InterpolateFields(Packet & packet, const ComponentInfo & componentInfo, const EntityID & entityID, const std::string & componentType);
|
void parseAmmoPickup(Packet& packet);
|
||||||
|
void InterpolateFields(Packet& packet, const ComponentInfo & componentInfo, const EntityID & entityID, const std::string & componentType);
|
||||||
void parseSnapshot(Packet& packet);
|
void parseSnapshot(Packet& packet);
|
||||||
void identifyPacketLoss();
|
void identifyPacketLoss();
|
||||||
void hasServerTimedOut();
|
void hasServerTimedOut();
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ enum class MessageType
|
|||||||
PlayerTransform,
|
PlayerTransform,
|
||||||
OnDoubleJump,
|
OnDoubleJump,
|
||||||
ServerlistRequest,
|
ServerlistRequest,
|
||||||
|
AmmoPickup,
|
||||||
Invalid
|
Invalid
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#include "../Game/Events/EDoubleJump.h"
|
#include "../Game/Events/EDoubleJump.h"
|
||||||
#include "Core/EEntityDeleted.h"
|
#include "Core/EEntityDeleted.h"
|
||||||
#include "Core/EComponentDeleted.h"
|
#include "Core/EComponentDeleted.h"
|
||||||
|
#include "Core/EAmmoPickup.h"
|
||||||
|
|
||||||
class Server : public Network
|
class Server : public Network
|
||||||
{
|
{
|
||||||
@@ -88,7 +89,7 @@ private:
|
|||||||
void parseServerlistRequest(boost::asio::ip::udp::endpoint endpoint);
|
void parseServerlistRequest(boost::asio::ip::udp::endpoint endpoint);
|
||||||
bool shouldSendToClient(EntityWrapper childEntity);
|
bool shouldSendToClient(EntityWrapper childEntity);
|
||||||
|
|
||||||
// Debug event
|
// Events
|
||||||
EventRelay<Server, Events::InputCommand> m_EInputCommand;
|
EventRelay<Server, Events::InputCommand> m_EInputCommand;
|
||||||
bool OnInputCommand(const Events::InputCommand& e);
|
bool OnInputCommand(const Events::InputCommand& e);
|
||||||
EventRelay<Server, Events::PlayerSpawned> m_EPlayerSpawned;
|
EventRelay<Server, Events::PlayerSpawned> m_EPlayerSpawned;
|
||||||
@@ -99,6 +100,8 @@ private:
|
|||||||
bool OnComponentDeleted(const Events::ComponentDeleted& e);
|
bool OnComponentDeleted(const Events::ComponentDeleted& e);
|
||||||
EventRelay<Server, Events::PlayerDamage> m_EPlayerDamage;
|
EventRelay<Server, Events::PlayerDamage> m_EPlayerDamage;
|
||||||
bool OnPlayerDamage(const Events::PlayerDamage& e);
|
bool OnPlayerDamage(const Events::PlayerDamage& e);
|
||||||
|
EventRelay<Server, Events::AmmoPickup> m_EAmmoPickup;
|
||||||
|
bool OnAmmoPickup(const Events::AmmoPickup& e);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ public:
|
|||||||
void InitializeFrameBuffers();
|
void InitializeFrameBuffers();
|
||||||
void InitializeShaderPrograms();
|
void InitializeShaderPrograms();
|
||||||
|
|
||||||
void Draw(GLuint sceneTexture, GLuint bloomTexture, GLuint sceneTextureLowRes, GLuint bloomTextureLowRes, GLfloat gamma, GLfloat exposure);
|
void Draw(GLuint sceneTexture, GLuint bloomTexture, GLfloat gamma, GLfloat exposure);
|
||||||
private:
|
private:
|
||||||
const IRenderer* m_Renderer;
|
const IRenderer* m_Renderer;
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
class DrawFinalPass
|
class DrawFinalPass
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DrawFinalPass(IRenderer* renderer, LightCullingPass* lightCullingPass, CubeMapPass* cubeMapPass, SSAOPass* ssaoPass, GLuint* depthBuffer);
|
DrawFinalPass(IRenderer* renderer, LightCullingPass* lightCullingPass, CubeMapPass* cubeMapPass, SSAOPass* ssaoPass);
|
||||||
~DrawFinalPass() { }
|
~DrawFinalPass() { }
|
||||||
void InitializeTextures();
|
void InitializeTextures();
|
||||||
void InitializeFrameBuffers();
|
void InitializeFrameBuffers();
|
||||||
@@ -26,20 +26,17 @@ public:
|
|||||||
|
|
||||||
//Return the texture that is used in later stages to apply the bloom effect
|
//Return the texture that is used in later stages to apply the bloom effect
|
||||||
GLuint BloomTexture() const { return m_BloomTexture; }
|
GLuint BloomTexture() const { return m_BloomTexture; }
|
||||||
GLuint BloomTextureLowRes() const { return m_BloomTextureLowRes; }
|
|
||||||
//Return the texture with diffuse and lighting of the scene.
|
//Return the texture with diffuse and lighting of the scene.
|
||||||
GLuint SceneTexture() const { return m_SceneTexture; }
|
GLuint SceneTexture() const { return m_SceneTexture; }
|
||||||
GLuint SceneTextureLowRes() const { return m_SceneTextureLowRes; }
|
|
||||||
//Return the framebuffer used in the scene rendering stage.
|
//Return the framebuffer used in the scene rendering stage.
|
||||||
FrameBuffer* FinalPassFrameBuffer() { return &m_FinalPassFrameBuffer; }
|
FrameBuffer* FinalPassFrameBuffer() { return &m_FinalPassFrameBuffer; }
|
||||||
FrameBuffer* FinalPassFrameBufferLowRes() { return &m_FinalPassFrameBufferLowRes; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void DrawSprites(std::list<std::shared_ptr<RenderJob>>&jobs, RenderScene& scene);
|
void DrawSprites(std::list<std::shared_ptr<RenderJob>>&jobs, RenderScene& scene);
|
||||||
void DrawModelRenderQueues(std::list<std::shared_ptr<RenderJob>>& jobs, RenderScene& scene);
|
void DrawModelRenderQueues(std::list<std::shared_ptr<RenderJob>>& jobs, RenderScene& scene);
|
||||||
void DrawShieldToStencilBuffer(std::list<std::shared_ptr<RenderJob>>& jobs, RenderScene& scene);
|
void DrawModelRenderQueuesWithShieldCheck(std::list<std::shared_ptr<RenderJob>>& jobs, RenderScene& scene);
|
||||||
void DrawShieldedModelRenderQueue(std::list<std::shared_ptr<RenderJob>>& jobs, RenderScene& scene);
|
void DrawShieldedModelRenderQueue(std::list<std::shared_ptr<RenderJob>>& jobs, RenderScene& scene);
|
||||||
void DrawToDepthBuffer(std::list<std::shared_ptr<RenderJob>>& jobs, RenderScene& scene);
|
void DrawToDepthStencilBuffer(std::list<std::shared_ptr<RenderJob>>& jobs, RenderScene& scene);
|
||||||
|
|
||||||
void BindExplosionUniforms(GLuint shaderHandle, std::shared_ptr<ExplosionEffectJob>& job, RenderScene& scene);
|
void BindExplosionUniforms(GLuint shaderHandle, std::shared_ptr<ExplosionEffectJob>& job, RenderScene& scene);
|
||||||
void BindModelUniforms(GLuint shaderHandle, std::shared_ptr<ModelJob>& job, RenderScene& scene);
|
void BindModelUniforms(GLuint shaderHandle, std::shared_ptr<ModelJob>& job, RenderScene& scene);
|
||||||
@@ -54,13 +51,11 @@ private:
|
|||||||
Texture* m_ErrorTexture;
|
Texture* m_ErrorTexture;
|
||||||
|
|
||||||
FrameBuffer m_FinalPassFrameBuffer;
|
FrameBuffer m_FinalPassFrameBuffer;
|
||||||
FrameBuffer m_FinalPassFrameBufferLowRes;
|
FrameBuffer m_ShieldDepthFrameBuffer;
|
||||||
GLuint m_BloomTexture;
|
GLuint m_BloomTexture;
|
||||||
GLuint m_SceneTexture;
|
GLuint m_SceneTexture;
|
||||||
GLuint m_BloomTextureLowRes;
|
GLuint m_DepthBuffer;
|
||||||
GLuint m_SceneTextureLowRes;
|
GLuint m_ShieldBuffer;
|
||||||
GLuint* m_DepthBuffer;
|
|
||||||
GLuint m_DepthBufferLowRes;
|
|
||||||
GLuint m_CubeMapTexture;
|
GLuint m_CubeMapTexture;
|
||||||
|
|
||||||
//maqke this component based i guess?
|
//maqke this component based i guess?
|
||||||
@@ -76,16 +71,27 @@ private:
|
|||||||
ShaderProgram* m_ExplosionEffectSplatMapProgram;
|
ShaderProgram* m_ExplosionEffectSplatMapProgram;
|
||||||
ShaderProgram* m_SpriteProgram;
|
ShaderProgram* m_SpriteProgram;
|
||||||
ShaderProgram* m_ForwardPlusSplatMapProgram;
|
ShaderProgram* m_ForwardPlusSplatMapProgram;
|
||||||
ShaderProgram* m_ShieldToStencilProgram;
|
ShaderProgram* m_FillDepthStencilBufferProgram;
|
||||||
ShaderProgram* m_FillDepthBufferProgram;
|
|
||||||
|
ShaderProgram* m_ForwardPlusShieldCheckProgram;
|
||||||
|
ShaderProgram* m_ExplosionEffectShieldCheckProgram;
|
||||||
|
ShaderProgram* m_ExplosionEffectSplatMapShieldCheckProgram;
|
||||||
|
ShaderProgram* m_SpriteShieldCheckProgram;
|
||||||
|
ShaderProgram* m_ForwardPlusSplatMapShieldCheckProgram;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ShaderProgram* m_ForwardPlusSkinnedProgram;
|
ShaderProgram* m_ForwardPlusSkinnedProgram;
|
||||||
ShaderProgram* m_ExplosionEffectSkinnedProgram;
|
ShaderProgram* m_ExplosionEffectSkinnedProgram;
|
||||||
ShaderProgram* m_ExplosionEffectSplatMapSkinnedProgram;
|
ShaderProgram* m_ExplosionEffectSplatMapSkinnedProgram;
|
||||||
ShaderProgram* m_ForwardPlusSplatMapSkinnedProgram;
|
ShaderProgram* m_ForwardPlusSplatMapSkinnedProgram;
|
||||||
ShaderProgram* m_ShieldToStencilSkinnedProgram;
|
ShaderProgram* m_FillDepthStencilBufferSkinnedProgram;
|
||||||
ShaderProgram* m_FillDepthBufferSkinnedProgram;
|
|
||||||
|
ShaderProgram* m_ForwardPlusSkinnedShieldCheckProgram;
|
||||||
|
ShaderProgram* m_ExplosionEffectSkinnedShieldCheckProgram;
|
||||||
|
ShaderProgram* m_ExplosionEffectSplatMapSkinnedShieldCheckProgram;
|
||||||
|
ShaderProgram* m_ForwardPlusSplatMapSkinnedShieldCheckProgram;
|
||||||
|
ShaderProgram* m_FillDepthBufferSkinnedShieldCheckProgram;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -15,8 +15,8 @@
|
|||||||
|
|
||||||
struct ExplosionEffectJob : ModelJob
|
struct ExplosionEffectJob : ModelJob
|
||||||
{
|
{
|
||||||
ExplosionEffectJob(ComponentWrapper explosionEffectComponent, ::Model* model, Camera* camera, glm::mat4 matrix, ::RawModel::MaterialProperties matGroup, ComponentWrapper modelComponent, ::World* world, glm::vec4 fillColor, float fillPercentage)
|
ExplosionEffectJob(ComponentWrapper explosionEffectComponent, ::Model* model, Camera* camera, glm::mat4 matrix, ::RawModel::MaterialProperties matGroup, ComponentWrapper modelComponent, ::World* world, glm::vec4 fillColor, float fillPercentage, bool isShielded)
|
||||||
: ModelJob(model, camera, matrix, matGroup, modelComponent, world, fillColor, fillPercentage)
|
: ModelJob(model, camera, matrix, matGroup, modelComponent, world, fillColor, fillPercentage, isShielded)
|
||||||
{
|
{
|
||||||
ExplosionOrigin = (glm::vec3)explosionEffectComponent["ExplosionOrigin"];
|
ExplosionOrigin = (glm::vec3)explosionEffectComponent["ExplosionOrigin"];
|
||||||
TimeSinceDeath = (double)explosionEffectComponent["TimeSinceDeath"];
|
TimeSinceDeath = (double)explosionEffectComponent["TimeSinceDeath"];
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
struct ModelJob : RenderJob
|
struct ModelJob : RenderJob
|
||||||
{
|
{
|
||||||
ModelJob(Model* model, Camera* camera, glm::mat4 matrix, ::RawModel::MaterialProperties matProp, ComponentWrapper modelComponent, World* world, glm::vec4 fillColor, float fillPercentage)
|
ModelJob(Model* model, Camera* camera, glm::mat4 matrix, ::RawModel::MaterialProperties matProp, ComponentWrapper modelComponent, World* world, glm::vec4 fillColor, float fillPercentage, bool isShielded)
|
||||||
: RenderJob()
|
: RenderJob()
|
||||||
{
|
{
|
||||||
Model = model;
|
Model = model;
|
||||||
@@ -117,7 +117,7 @@ struct ModelJob : RenderJob
|
|||||||
|
|
||||||
FillColor = fillColor;
|
FillColor = fillColor;
|
||||||
FillPercentage = fillPercentage;
|
FillPercentage = fillPercentage;
|
||||||
|
IsShielded = isShielded;
|
||||||
|
|
||||||
if (model->IsSkinned()) {
|
if (model->IsSkinned()) {
|
||||||
Skeleton = Model->m_RawModel->m_Skeleton;
|
Skeleton = Model->m_RawModel->m_Skeleton;
|
||||||
@@ -181,7 +181,7 @@ struct ModelJob : RenderJob
|
|||||||
|
|
||||||
glm::vec4 FillColor = glm::vec4(0);
|
glm::vec4 FillColor = glm::vec4(0);
|
||||||
float FillPercentage = 0.0;
|
float FillPercentage = 0.0;
|
||||||
|
bool IsShielded;
|
||||||
void CalculateHash() override
|
void CalculateHash() override
|
||||||
{
|
{
|
||||||
Hash = ShaderID << 20 + ModelID << 10 + TextureID;
|
Hash = ShaderID << 20 + ModelID << 10 + TextureID;
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ struct RenderScene
|
|||||||
std::list<std::shared_ptr<RenderJob>> OpaqueObjects;
|
std::list<std::shared_ptr<RenderJob>> OpaqueObjects;
|
||||||
std::list<std::shared_ptr<RenderJob>> TransparentObjects;
|
std::list<std::shared_ptr<RenderJob>> TransparentObjects;
|
||||||
std::list<std::shared_ptr<RenderJob>> OpaqueShieldedObjects;
|
std::list<std::shared_ptr<RenderJob>> OpaqueShieldedObjects;
|
||||||
std::list<std::shared_ptr<RenderJob>> TransparentShieldedObjects;
|
|
||||||
std::list<std::shared_ptr<RenderJob>> ShieldObjects;
|
std::list<std::shared_ptr<RenderJob>> ShieldObjects;
|
||||||
std::list<std::shared_ptr<RenderJob>> SpriteJob;
|
std::list<std::shared_ptr<RenderJob>> SpriteJob;
|
||||||
std::list<std::shared_ptr<RenderJob>> PointLight;
|
std::list<std::shared_ptr<RenderJob>> PointLight;
|
||||||
@@ -41,7 +40,6 @@ struct RenderScene
|
|||||||
Jobs.OpaqueObjects.clear();
|
Jobs.OpaqueObjects.clear();
|
||||||
Jobs.TransparentObjects.clear();
|
Jobs.TransparentObjects.clear();
|
||||||
Jobs.OpaqueShieldedObjects.clear();
|
Jobs.OpaqueShieldedObjects.clear();
|
||||||
Jobs.TransparentShieldedObjects.clear();
|
|
||||||
Jobs.ShieldObjects.clear();
|
Jobs.ShieldObjects.clear();
|
||||||
Jobs.SpriteJob.clear();
|
Jobs.SpriteJob.clear();
|
||||||
Jobs.DirectionalLight.clear();
|
Jobs.DirectionalLight.clear();
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ public:
|
|||||||
private:
|
private:
|
||||||
EventRelay<AmmoPickupSystem, Events::TriggerTouch> m_ETriggerTouch;
|
EventRelay<AmmoPickupSystem, Events::TriggerTouch> m_ETriggerTouch;
|
||||||
bool OnTriggerTouch(Events::TriggerTouch& e);
|
bool OnTriggerTouch(Events::TriggerTouch& e);
|
||||||
|
EventRelay<AmmoPickupSystem, Events::AmmoPickup> m_EAmmoPickup;
|
||||||
|
bool OnAmmoPickup(Events::AmmoPickup& e);
|
||||||
|
|
||||||
struct NewAmmoPickup {
|
struct NewAmmoPickup {
|
||||||
glm::vec3 Pos;
|
glm::vec3 Pos;
|
||||||
|
|||||||
@@ -68,5 +68,17 @@ Contrast=1.5
|
|||||||
Intensity=1.0
|
Intensity=1.0
|
||||||
NumSamples=24
|
NumSamples=24
|
||||||
NumTurns=17
|
NumTurns=17
|
||||||
NumIterations=13
|
NumIterations=9
|
||||||
TextureQuality=0
|
TextureQuality=0
|
||||||
|
|
||||||
|
[GLOW]
|
||||||
|
Quality=3;
|
||||||
|
|
||||||
|
[GLOW1]
|
||||||
|
NumIterations=5
|
||||||
|
|
||||||
|
[GLOW2]
|
||||||
|
NumIterations=9
|
||||||
|
|
||||||
|
[GLOW3]
|
||||||
|
NumIterations=13
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||||
<DashAbility xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="DashAbility.xsd">
|
<DashAbility xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="DashAbility.xsd">
|
||||||
<CoolDownMaxTimer>2.0</CoolDownMaxTimer>
|
<CoolDownMaxTimer>2.0</CoolDownMaxTimer>
|
||||||
|
<CoolDownTimer>0.0</CoolDownTimer>
|
||||||
</DashAbility>
|
</DashAbility>
|
||||||
@@ -10,7 +10,10 @@
|
|||||||
<xs:complexType>
|
<xs:complexType>
|
||||||
<xs:all>
|
<xs:all>
|
||||||
<xs:element name="CoolDownMaxTimer" type="t:double" minOccurs="0">
|
<xs:element name="CoolDownMaxTimer" type="t:double" minOccurs="0">
|
||||||
<xs:annotation><xs:documentation>This is the cooldown on dash</xs:documentation></xs:annotation>
|
<xs:annotation><xs:documentation>This is the max cooldown on dash</xs:documentation></xs:annotation>
|
||||||
|
</xs:element>
|
||||||
|
<xs:element name="CoolDownTimer" type="t:double" minOccurs="0">
|
||||||
|
<xs:annotation><xs:documentation>This is the current cooldown on dash</xs:documentation></xs:annotation>
|
||||||
</xs:element>
|
</xs:element>
|
||||||
</xs:all>
|
</xs:all>
|
||||||
</xs:complexType>
|
</xs:complexType>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
</c:AssaultWeapon>
|
</c:AssaultWeapon>
|
||||||
<c:Collidable/>
|
<c:Collidable/>
|
||||||
<c:DefenderWeapon>
|
<c:DefenderWeapon>
|
||||||
<TimeSinceLastFire>23.911064541134579</TimeSinceLastFire>
|
<TimeSinceLastFire>52.867678870419283</TimeSinceLastFire>
|
||||||
</c:DefenderWeapon>
|
</c:DefenderWeapon>
|
||||||
<c:DoubleJump/>
|
<c:DoubleJump/>
|
||||||
<c:Health/>
|
<c:Health/>
|
||||||
@@ -37,7 +37,10 @@
|
|||||||
<Children>
|
<Children>
|
||||||
<Entity name="Camera">
|
<Entity name="Camera">
|
||||||
<Components>
|
<Components>
|
||||||
<c:Camera/>
|
<c:Camera>
|
||||||
|
<NearClip>0.10000000149011612</NearClip>
|
||||||
|
<FarClip>300</FarClip>
|
||||||
|
</c:Camera>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="1.27700007" Z="0"/>
|
<Position X="0" Y="1.27700007" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
@@ -193,6 +196,7 @@
|
|||||||
<CapturePointNumber>3</CapturePointNumber>
|
<CapturePointNumber>3</CapturePointNumber>
|
||||||
</c:CapturePointHUD>
|
</c:CapturePointHUD>
|
||||||
<c:Fill>
|
<c:Fill>
|
||||||
|
<Percentage>0.80222018197612788</Percentage>
|
||||||
<Color A="0.699999988" B="1" G="0.200000003" R="0"/>
|
<Color A="0.699999988" B="1" G="0.200000003" R="0"/>
|
||||||
</c:Fill>
|
</c:Fill>
|
||||||
<c:Sprite>
|
<c:Sprite>
|
||||||
@@ -227,7 +231,6 @@
|
|||||||
<CapturePointNumber>4</CapturePointNumber>
|
<CapturePointNumber>4</CapturePointNumber>
|
||||||
</c:CapturePointHUD>
|
</c:CapturePointHUD>
|
||||||
<c:Fill>
|
<c:Fill>
|
||||||
<Percentage>1</Percentage>
|
|
||||||
<Color A="0.699999988" B="1" G="0.200000003" R="0"/>
|
<Color A="0.699999988" B="1" G="0.200000003" R="0"/>
|
||||||
</c:Fill>
|
</c:Fill>
|
||||||
<c:Sprite>
|
<c:Sprite>
|
||||||
@@ -283,7 +286,7 @@
|
|||||||
<c:Sprite>
|
<c:Sprite>
|
||||||
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
|
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
|
||||||
<GlowMap></GlowMap>
|
<GlowMap></GlowMap>
|
||||||
<Color A="0.699999988" B="0" G="0" R="1"/>
|
<Color A="0.699999988" B="0" G="0.200000003" R="1"/>
|
||||||
</c:Sprite>
|
</c:Sprite>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="-1.58304751" Y="0.919596612" Z="0"/>
|
<Position X="-1.58304751" Y="0.919596612" Z="0"/>
|
||||||
@@ -294,8 +297,7 @@
|
|||||||
<Components>
|
<Components>
|
||||||
<c:CapturePointHUD/>
|
<c:CapturePointHUD/>
|
||||||
<c:Fill>
|
<c:Fill>
|
||||||
<Percentage>1</Percentage>
|
<Color A="0.699999988" B="1" G="0.200000003" R="0"/>
|
||||||
<Color A="0.699999988" B="0" G="0" R="1"/>
|
|
||||||
</c:Fill>
|
</c:Fill>
|
||||||
<c:Sprite>
|
<c:Sprite>
|
||||||
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
|
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
|
||||||
@@ -304,7 +306,7 @@
|
|||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="0" Z="0.00999999978"/>
|
<Position X="0" Y="0" Z="0.00999999978"/>
|
||||||
<Scale X="0.800000012" Y="0.800000012" Z="0.800000012"/>
|
<Scale X="0.800000012" Y="0.800000012" Z="0.800000012"/>
|
||||||
<Orientation X="0" Y="0" Z="4.71238899"/>
|
<Orientation X="0" Y="0" Z="1.57079637"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children/>
|
<Children/>
|
||||||
@@ -373,7 +375,7 @@
|
|||||||
<Components>
|
<Components>
|
||||||
<c:Animation>
|
<c:Animation>
|
||||||
<AnimationName1>Idle</AnimationName1>
|
<AnimationName1>Idle</AnimationName1>
|
||||||
<Time1>0.22110820884665827</Time1>
|
<Time1>1.9408570429715581</Time1>
|
||||||
<Speed1>1</Speed1>
|
<Speed1>1</Speed1>
|
||||||
<AnimationName2></AnimationName2>
|
<AnimationName2></AnimationName2>
|
||||||
<AnimationName3></AnimationName3>
|
<AnimationName3></AnimationName3>
|
||||||
@@ -411,30 +413,14 @@
|
|||||||
</Entity>
|
</Entity>
|
||||||
</Children>
|
</Children>
|
||||||
</Entity>
|
</Entity>
|
||||||
<Entity name="CapturePointIndicator">
|
|
||||||
<Components>
|
|
||||||
<c:CapturePointArrowHUD/>
|
|
||||||
<c:Model>
|
|
||||||
<Resource>Models/Widgets/Arrows/Arrow10.mesh</Resource>
|
|
||||||
</c:Model>
|
|
||||||
<c:Team>
|
|
||||||
<Team>
|
|
||||||
<Blue/>
|
|
||||||
</Team>
|
|
||||||
</c:Team>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="0" Y="0.118000008" Z="-0.354000002"/>
|
|
||||||
<Scale X="0.200000003" Y="0.200000003" Z="0.200000003"/>
|
|
||||||
<Orientation X="-0.0286321267" Y="-1.85983479" Z="0"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
</Children>
|
</Children>
|
||||||
</Entity>
|
</Entity>
|
||||||
<Entity name="ThirdPersonCamera">
|
<Entity name="ThirdPersonCamera">
|
||||||
<Components>
|
<Components>
|
||||||
<c:Camera/>
|
<c:Camera>
|
||||||
|
<NearClip>0.10000000149011612</NearClip>
|
||||||
|
<FarClip>300</FarClip>
|
||||||
|
</c:Camera>
|
||||||
<c:Model>
|
<c:Model>
|
||||||
<Resource>Models/Widgets/Camera.mesh</Resource>
|
<Resource>Models/Widgets/Camera.mesh</Resource>
|
||||||
<Visible>false</Visible>
|
<Visible>false</Visible>
|
||||||
@@ -450,7 +436,7 @@
|
|||||||
<Components>
|
<Components>
|
||||||
<c:Animation>
|
<c:Animation>
|
||||||
<AnimationName1>Idle</AnimationName1>
|
<AnimationName1>Idle</AnimationName1>
|
||||||
<Time1>1.6993789132803556</Time1>
|
<Time1>1.5631122524686134</Time1>
|
||||||
<Speed1>1</Speed1>
|
<Speed1>1</Speed1>
|
||||||
<AnimationName2></AnimationName2>
|
<AnimationName2></AnimationName2>
|
||||||
<AnimationName3></AnimationName3>
|
<AnimationName3></AnimationName3>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
</c:AssaultWeapon>
|
</c:AssaultWeapon>
|
||||||
<c:Collidable/>
|
<c:Collidable/>
|
||||||
<c:DefenderWeapon>
|
<c:DefenderWeapon>
|
||||||
<TimeSinceLastFire>384.13256760035051</TimeSinceLastFire>
|
<TimeSinceLastFire>22.22055262342397</TimeSinceLastFire>
|
||||||
</c:DefenderWeapon>
|
</c:DefenderWeapon>
|
||||||
<c:DoubleJump/>
|
<c:DoubleJump/>
|
||||||
<c:Health/>
|
<c:Health/>
|
||||||
@@ -30,14 +30,17 @@
|
|||||||
</Team>
|
</Team>
|
||||||
</c:Team>
|
</c:Team>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="-3.10689902" Y="0.755898118" Z="8.34500504"/>
|
<Position X="0" Y="0.0288832653" Z="3.63052702"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
|
|
||||||
<Children>
|
<Children>
|
||||||
<Entity name="Camera">
|
<Entity name="Camera">
|
||||||
<Components>
|
<Components>
|
||||||
<c:Camera/>
|
<c:Camera>
|
||||||
|
<NearClip>0.10000000149011612</NearClip>
|
||||||
|
<FarClip>300</FarClip>
|
||||||
|
</c:Camera>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="1.27700007" Z="0"/>
|
<Position X="0" Y="1.27700007" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
@@ -193,6 +196,7 @@
|
|||||||
<CapturePointNumber>3</CapturePointNumber>
|
<CapturePointNumber>3</CapturePointNumber>
|
||||||
</c:CapturePointHUD>
|
</c:CapturePointHUD>
|
||||||
<c:Fill>
|
<c:Fill>
|
||||||
|
<Percentage>0.80222018197612788</Percentage>
|
||||||
<Color A="0.699999988" B="1" G="0.200000003" R="0"/>
|
<Color A="0.699999988" B="1" G="0.200000003" R="0"/>
|
||||||
</c:Fill>
|
</c:Fill>
|
||||||
<c:Sprite>
|
<c:Sprite>
|
||||||
@@ -227,7 +231,6 @@
|
|||||||
<CapturePointNumber>4</CapturePointNumber>
|
<CapturePointNumber>4</CapturePointNumber>
|
||||||
</c:CapturePointHUD>
|
</c:CapturePointHUD>
|
||||||
<c:Fill>
|
<c:Fill>
|
||||||
<Percentage>1</Percentage>
|
|
||||||
<Color A="0.699999988" B="1" G="0.200000003" R="0"/>
|
<Color A="0.699999988" B="1" G="0.200000003" R="0"/>
|
||||||
</c:Fill>
|
</c:Fill>
|
||||||
<c:Sprite>
|
<c:Sprite>
|
||||||
@@ -283,7 +286,7 @@
|
|||||||
<c:Sprite>
|
<c:Sprite>
|
||||||
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
|
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
|
||||||
<GlowMap></GlowMap>
|
<GlowMap></GlowMap>
|
||||||
<Color A="0.699999988" B="0" G="0" R="1"/>
|
<Color A="0.699999988" B="0" G="0.200000003" R="1"/>
|
||||||
</c:Sprite>
|
</c:Sprite>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="-1.58304751" Y="0.919596612" Z="0"/>
|
<Position X="-1.58304751" Y="0.919596612" Z="0"/>
|
||||||
@@ -294,8 +297,7 @@
|
|||||||
<Components>
|
<Components>
|
||||||
<c:CapturePointHUD/>
|
<c:CapturePointHUD/>
|
||||||
<c:Fill>
|
<c:Fill>
|
||||||
<Percentage>1</Percentage>
|
<Color A="0.699999988" B="1" G="0.200000003" R="0"/>
|
||||||
<Color A="0.699999988" B="0" G="0" R="1"/>
|
|
||||||
</c:Fill>
|
</c:Fill>
|
||||||
<c:Sprite>
|
<c:Sprite>
|
||||||
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
|
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
|
||||||
@@ -304,7 +306,7 @@
|
|||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="0" Z="0.00999999978"/>
|
<Position X="0" Y="0" Z="0.00999999978"/>
|
||||||
<Scale X="0.800000012" Y="0.800000012" Z="0.800000012"/>
|
<Scale X="0.800000012" Y="0.800000012" Z="0.800000012"/>
|
||||||
<Orientation X="0" Y="0" Z="4.71238899"/>
|
<Orientation X="0" Y="0" Z="1.57079637"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children/>
|
<Children/>
|
||||||
@@ -373,7 +375,7 @@
|
|||||||
<Components>
|
<Components>
|
||||||
<c:Animation>
|
<c:Animation>
|
||||||
<AnimationName1>Idle</AnimationName1>
|
<AnimationName1>Idle</AnimationName1>
|
||||||
<Time1>0.75626404186195373</Time1>
|
<Time1>1.1978087298230946</Time1>
|
||||||
<Speed1>1</Speed1>
|
<Speed1>1</Speed1>
|
||||||
<AnimationName2></AnimationName2>
|
<AnimationName2></AnimationName2>
|
||||||
<AnimationName3></AnimationName3>
|
<AnimationName3></AnimationName3>
|
||||||
@@ -411,30 +413,14 @@
|
|||||||
</Entity>
|
</Entity>
|
||||||
</Children>
|
</Children>
|
||||||
</Entity>
|
</Entity>
|
||||||
<Entity name="CapturePointTargetIndicator">
|
|
||||||
<Components>
|
|
||||||
<c:CapturePointArrowHUD/>
|
|
||||||
<c:Model>
|
|
||||||
<Resource>Models/Weapons/Blue/AssaultWeaponBlue.mesh</Resource>
|
|
||||||
</c:Model>
|
|
||||||
<c:Team>
|
|
||||||
<Team>
|
|
||||||
<Red/>
|
|
||||||
</Team>
|
|
||||||
</c:Team>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="-0.200000003" Y="0.150000006" Z="-0.5"/>
|
|
||||||
<Scale X="0.300000012" Y="0.300000012" Z="0.300000012"/>
|
|
||||||
<Orientation X="-0.0344330445" Y="-0.486859739" Z="0"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
</Children>
|
</Children>
|
||||||
</Entity>
|
</Entity>
|
||||||
<Entity name="ThirdPersonCamera">
|
<Entity name="ThirdPersonCamera">
|
||||||
<Components>
|
<Components>
|
||||||
<c:Camera/>
|
<c:Camera>
|
||||||
|
<NearClip>0.10000000149011612</NearClip>
|
||||||
|
<FarClip>300</FarClip>
|
||||||
|
</c:Camera>
|
||||||
<c:Model>
|
<c:Model>
|
||||||
<Resource>Models/Widgets/Camera.mesh</Resource>
|
<Resource>Models/Widgets/Camera.mesh</Resource>
|
||||||
<Visible>false</Visible>
|
<Visible>false</Visible>
|
||||||
@@ -450,7 +436,7 @@
|
|||||||
<Components>
|
<Components>
|
||||||
<c:Animation>
|
<c:Animation>
|
||||||
<AnimationName1>Idle</AnimationName1>
|
<AnimationName1>Idle</AnimationName1>
|
||||||
<Time1>1.1511986314122282</Time1>
|
<Time1>0.69274608502888668</Time1>
|
||||||
<Speed1>1</Speed1>
|
<Speed1>1</Speed1>
|
||||||
<AnimationName2></AnimationName2>
|
<AnimationName2></AnimationName2>
|
||||||
<AnimationName3></AnimationName3>
|
<AnimationName3></AnimationName3>
|
||||||
|
|||||||
@@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
layout (binding = 0) uniform sampler2D SceneTexture;
|
layout (binding = 0) uniform sampler2D SceneTexture;
|
||||||
layout (binding = 1) uniform sampler2D BloomTexture;
|
layout (binding = 1) uniform sampler2D BloomTexture;
|
||||||
layout (binding = 2) uniform sampler2D SceneTextureLowRes;
|
|
||||||
layout (binding = 3) uniform sampler2D BloomTextureLowRes;
|
|
||||||
uniform float Exposure;
|
uniform float Exposure;
|
||||||
uniform float Gamma;
|
uniform float Gamma;
|
||||||
|
|
||||||
@@ -17,21 +15,12 @@ void main()
|
|||||||
{
|
{
|
||||||
vec4 hdrColor = texture(SceneTexture, Input.TextureCoordinate);
|
vec4 hdrColor = texture(SceneTexture, Input.TextureCoordinate);
|
||||||
vec4 bloomColor = texture(BloomTexture, Input.TextureCoordinate);
|
vec4 bloomColor = texture(BloomTexture, Input.TextureCoordinate);
|
||||||
vec4 hdrColorLowRes = texture(SceneTextureLowRes, Input.TextureCoordinate);
|
|
||||||
vec4 bloomColorLowRes = texture(BloomTextureLowRes, Input.TextureCoordinate);
|
|
||||||
|
|
||||||
//hdrColor = hdrColor * SSAO;
|
//hdrColor = hdrColor * SSAO;
|
||||||
hdrColor += bloomColor;
|
hdrColor += bloomColor;
|
||||||
hdrColorLowRes;
|
|
||||||
|
|
||||||
float hdrColorsum = hdrColorLowRes.r + hdrColorLowRes.g + hdrColorLowRes.b;
|
|
||||||
//Toon mapping thingy
|
//Toon mapping thingy
|
||||||
vec3 result;
|
vec3 result = vec3(1.0) - exp(-hdrColor.rgb * Exposure);
|
||||||
if(hdrColorsum > 0.0) {
|
|
||||||
result = vec3(1.0) - exp(-hdrColorLowRes.rgb * Exposure);
|
|
||||||
} else {
|
|
||||||
result = vec3(1.0) - exp(-hdrColor.rgb * Exposure);
|
|
||||||
}
|
|
||||||
|
|
||||||
//gamme correction
|
//gamme correction
|
||||||
result = pow(result, vec3(1.0 / Gamma));
|
result = pow(result, vec3(1.0 / Gamma));
|
||||||
|
|||||||
@@ -0,0 +1,207 @@
|
|||||||
|
#version 430
|
||||||
|
|
||||||
|
#define MIN_AMBIENT_LIGHT 0.3
|
||||||
|
|
||||||
|
uniform mat4 M;
|
||||||
|
uniform mat4 V;
|
||||||
|
uniform mat4 P;
|
||||||
|
uniform vec4 Color;
|
||||||
|
uniform vec4 DiffuseColor;
|
||||||
|
uniform vec2 ScreenDimensions;
|
||||||
|
uniform vec4 FillColor;
|
||||||
|
uniform vec4 AmbientColor;
|
||||||
|
uniform float FillPercentage;
|
||||||
|
uniform float GlowIntensity = 10;
|
||||||
|
uniform vec3 CameraPosition;
|
||||||
|
uniform int SSAOQuality;
|
||||||
|
|
||||||
|
uniform vec2 DiffuseUVRepeat;
|
||||||
|
uniform vec2 NormalUVRepeat;
|
||||||
|
uniform vec2 SpecularUVRepeat;
|
||||||
|
uniform vec2 GlowUVRepeat;
|
||||||
|
layout (binding = 0) uniform sampler2D AOTexture;
|
||||||
|
layout (binding = 1) uniform sampler2D DiffuseTexture;
|
||||||
|
layout (binding = 2) uniform sampler2D NormalMapTexture;
|
||||||
|
layout (binding = 3) uniform sampler2D SpecularMapTexture;
|
||||||
|
layout (binding = 4) uniform sampler2D GlowMapTexture;
|
||||||
|
layout (binding = 5) uniform samplerCube CubeMap;
|
||||||
|
layout (binding = 31) uniform sampler2D ShieldBuffer;
|
||||||
|
|
||||||
|
#define TILE_SIZE 16
|
||||||
|
|
||||||
|
struct LightSource {
|
||||||
|
vec4 Position;
|
||||||
|
vec4 Direction;
|
||||||
|
vec4 Color;
|
||||||
|
float Radius;
|
||||||
|
float Intensity;
|
||||||
|
float Falloff;
|
||||||
|
int Type;
|
||||||
|
};
|
||||||
|
|
||||||
|
layout (std430, binding = 1) buffer LightBuffer
|
||||||
|
{
|
||||||
|
LightSource List[];
|
||||||
|
} LightSources;
|
||||||
|
|
||||||
|
struct LightGrid {
|
||||||
|
float Start;
|
||||||
|
float Amount;
|
||||||
|
vec2 Padding;
|
||||||
|
};
|
||||||
|
|
||||||
|
layout (std430, binding = 2) buffer LightGridBuffer
|
||||||
|
{
|
||||||
|
LightGrid Data[];
|
||||||
|
} LightGrids;
|
||||||
|
|
||||||
|
layout (std430, binding = 4) buffer LightIndexBuffer
|
||||||
|
{
|
||||||
|
float LightIndex[];
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
in VertexData{
|
||||||
|
vec3 Position;
|
||||||
|
vec3 Normal;
|
||||||
|
vec3 Tangent;
|
||||||
|
vec3 BiTangent;
|
||||||
|
vec2 TextureCoordinate;
|
||||||
|
vec4 ExplosionColor;
|
||||||
|
float ExplosionPercentageElapsed;
|
||||||
|
}Input;
|
||||||
|
|
||||||
|
out vec4 sceneColor;
|
||||||
|
out vec4 bloomColor;
|
||||||
|
|
||||||
|
struct LightResult {
|
||||||
|
vec4 Diffuse;
|
||||||
|
vec4 Specular;
|
||||||
|
};
|
||||||
|
|
||||||
|
float CalcAttenuation(float radius, float dist, float falloff) {
|
||||||
|
return 1.0 - smoothstep(radius * falloff, radius, dist);
|
||||||
|
}
|
||||||
|
|
||||||
|
vec4 CalcSpecular(vec4 lightColor, vec4 viewVec, vec4 lightVec, vec4 normal) {
|
||||||
|
vec4 R = normalize( reflect(-lightVec, normal));
|
||||||
|
float RdotV = max( dot(R, viewVec), 0.0);
|
||||||
|
return lightColor * pow(RdotV, 90.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
vec4 CalcDiffuse(vec4 lightColor, vec4 lightVec, vec4 normal) {
|
||||||
|
float power = max( dot(normal, lightVec), 0.0);
|
||||||
|
return lightColor * power;
|
||||||
|
}
|
||||||
|
|
||||||
|
LightResult CalcPointLightSource(vec4 lightPos, float lightRadius, vec4 lightColor, float intensity, vec4 viewVec, vec4 position, vec4 normal, float falloff)
|
||||||
|
{
|
||||||
|
vec4 L = lightPos - position;
|
||||||
|
float dist = length(L);
|
||||||
|
L = normalize(L);
|
||||||
|
|
||||||
|
float attenuation = CalcAttenuation(lightRadius, dist, falloff);
|
||||||
|
|
||||||
|
LightResult result;
|
||||||
|
result.Diffuse = CalcDiffuse(lightColor, L, normal) * attenuation * intensity;
|
||||||
|
result.Specular = CalcSpecular(lightColor, viewVec, L, normal) * attenuation * intensity;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
LightResult CalcDirectionalLightSource(vec4 direction, vec4 color, float intensity, vec4 viewVec, vec4 vertNormal)
|
||||||
|
{
|
||||||
|
vec4 L = normalize( -vec4(direction.xyz, 0) );
|
||||||
|
|
||||||
|
LightResult result;
|
||||||
|
result.Diffuse = CalcDiffuse(color, L, vertNormal) * intensity;
|
||||||
|
result.Specular = CalcSpecular(color, viewVec, L, vertNormal) * intensity;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
vec4 CalcNormalMappedValue(vec3 normal, vec3 tangent, vec3 bitangent, vec2 textureCoordinate, sampler2D normalMap)
|
||||||
|
{
|
||||||
|
mat3 TBN = mat3(tangent, bitangent, normal);
|
||||||
|
vec3 NormalMap = texture(normalMap, textureCoordinate).xyz * 2.0 - vec3(1.0);
|
||||||
|
return vec4(TBN * normalize(NormalMap), 0.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
float shieldDepthValue = texelFetch(ShieldBuffer, ivec2(gl_FragCoord.xy), 0).r;
|
||||||
|
|
||||||
|
if(shieldDepthValue < gl_FragCoord.z){
|
||||||
|
discard;
|
||||||
|
}
|
||||||
|
|
||||||
|
float ao = texelFetch(AOTexture, ivec2(gl_FragCoord.xy) >> int(SSAOQuality), 0).r;
|
||||||
|
ao = (clamp(1.0 - (1.0 - ao), 0.0, 1.0) + MIN_AMBIENT_LIGHT) / (1.0 + MIN_AMBIENT_LIGHT);
|
||||||
|
vec4 diffuseTexel = texture2D(DiffuseTexture, Input.TextureCoordinate * DiffuseUVRepeat);
|
||||||
|
vec4 glowTexel = texture2D(GlowMapTexture, Input.TextureCoordinate * GlowUVRepeat);
|
||||||
|
vec4 specularTexel = texture2D(SpecularMapTexture, Input.TextureCoordinate * SpecularUVRepeat);
|
||||||
|
vec4 position = V * M * vec4(Input.Position, 1.0);
|
||||||
|
vec4 normal = V * CalcNormalMappedValue(Input.Normal, Input.Tangent, Input.BiTangent, Input.TextureCoordinate * NormalUVRepeat, NormalMapTexture);
|
||||||
|
normal = normalize(normal);
|
||||||
|
//vec4 normal = normalize(V * vec4(Input.Normal, 0.0));
|
||||||
|
vec4 viewVec = normalize(-position);
|
||||||
|
vec3 I = normalize(vec3(M * vec4(Input.Position, 1.0)) - CameraPosition);
|
||||||
|
vec3 R = reflect(-I, Input.Normal);
|
||||||
|
//R = vec3(P * vec4(R, 1.0));
|
||||||
|
vec4 reflectionColor = texture(CubeMap, R);
|
||||||
|
|
||||||
|
vec2 tilePos;
|
||||||
|
tilePos.x = int(gl_FragCoord.x/TILE_SIZE);
|
||||||
|
tilePos.y = int(gl_FragCoord.y/TILE_SIZE);
|
||||||
|
|
||||||
|
LightResult totalLighting;
|
||||||
|
totalLighting.Diffuse = vec4(AmbientColor.rgb * ao, 1.0);
|
||||||
|
int currentTile = int(floor(gl_FragCoord.x/TILE_SIZE) + (floor(gl_FragCoord.y/TILE_SIZE) * int(ScreenDimensions.x/TILE_SIZE)));
|
||||||
|
|
||||||
|
int start = int(LightGrids.Data[currentTile].Start);
|
||||||
|
int amount = int(LightGrids.Data[currentTile].Amount);
|
||||||
|
|
||||||
|
for(int i = start; i < start + amount; i++) {
|
||||||
|
|
||||||
|
int l = int(LightIndex[i]);
|
||||||
|
LightSource light = LightSources.List[l];
|
||||||
|
|
||||||
|
LightResult light_result;
|
||||||
|
//These if statements should be removed.
|
||||||
|
if(light.Type == 1) { // point
|
||||||
|
light_result = CalcPointLightSource(V * light.Position, light.Radius, light.Color, light.Intensity, viewVec, position, normal, light.Falloff);
|
||||||
|
} else if (light.Type == 2) { //Directional
|
||||||
|
light_result = CalcDirectionalLightSource(V * light.Direction, light.Color, light.Intensity, viewVec, normal);
|
||||||
|
}
|
||||||
|
totalLighting.Diffuse += vec4(light_result.Diffuse.rgb * ao, light_result.Diffuse.a);
|
||||||
|
totalLighting.Specular += vec4(light_result.Specular.rgb * ao, light_result.Specular.a);
|
||||||
|
}
|
||||||
|
|
||||||
|
vec4 color_result = mix((Color * diffuseTexel * DiffuseColor), Input.ExplosionColor, Input.ExplosionPercentageElapsed);
|
||||||
|
color_result = color_result * (totalLighting.Diffuse + (totalLighting.Specular * specularTexel));
|
||||||
|
float specularResult = (specularTexel.r + specularTexel.g + specularTexel.b)/3.0;
|
||||||
|
vec4 reflectionTotal = reflectionColor * (1-specularTexel.a) * color_result.a;
|
||||||
|
color_result = color_result * clamp(1/specularTexel.a, 0, 1) + reflectionTotal;
|
||||||
|
//vec4 color_result = (DiffuseColor + Input.ExplosionColor) * (totalLighting.Diffuse + (totalLighting.Specular * specularTexel)) * diffuseTexel * Color;
|
||||||
|
|
||||||
|
|
||||||
|
float pos = ((P * vec4(Input.Position, 1)).y + 1.0)/2.0;
|
||||||
|
|
||||||
|
if(pos <= FillPercentage) {
|
||||||
|
color_result += FillColor;
|
||||||
|
}
|
||||||
|
sceneColor = vec4(color_result.xyz, clamp(color_result.a, 0, 1));
|
||||||
|
//sceneColor = vec4(reflectionColor.xyz, 1);
|
||||||
|
color_result.xyz += glowTexel.xyz*GlowIntensity;
|
||||||
|
|
||||||
|
bloomColor = vec4(max(color_result.xyz - 1.0, 0.0), clamp(color_result.a, 0, 1));
|
||||||
|
|
||||||
|
//Tiled Debug Code
|
||||||
|
/*
|
||||||
|
if(int(gl_FragCoord.x)%16 == 0 || int(gl_FragCoord.y)%16 == 0 ) {
|
||||||
|
sceneColor += vec4(0.5, 0, 0, 0);
|
||||||
|
} else {
|
||||||
|
sceneColor += vec4(LightGrids.Data[int(tilePos.x + tilePos.y*80)].Amount/LightSources.List.length(), 0, 0, 1);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,254 @@
|
|||||||
|
#version 430
|
||||||
|
|
||||||
|
#define MIN_AMBIENT_LIGHT 0.3
|
||||||
|
|
||||||
|
uniform mat4 M;
|
||||||
|
uniform mat4 V;
|
||||||
|
uniform mat4 P;
|
||||||
|
uniform vec2 ScreenDimensions;
|
||||||
|
uniform float FillPercentage;
|
||||||
|
uniform vec4 DiffuseColor;
|
||||||
|
uniform vec4 FillColor;
|
||||||
|
uniform vec4 Color;
|
||||||
|
uniform vec4 AmbientColor;
|
||||||
|
uniform int SSAOQuality;
|
||||||
|
|
||||||
|
//Get bineded at the same time as the textures
|
||||||
|
uniform vec2 DiffuseUVRepeat1;
|
||||||
|
uniform vec2 DiffuseUVRepeat2;
|
||||||
|
uniform vec2 DiffuseUVRepeat3;
|
||||||
|
uniform vec2 NormalUVRepeat1;
|
||||||
|
uniform vec2 NormalUVRepeat2;
|
||||||
|
uniform vec2 NormalUVRepeat3;
|
||||||
|
uniform vec2 SpecularUVRepeat1;
|
||||||
|
uniform vec2 SpecularUVRepeat2;
|
||||||
|
uniform vec2 SpecularUVRepeat3;
|
||||||
|
uniform vec2 GlowUVRepeat1;
|
||||||
|
uniform vec2 GlowUVRepeat2;
|
||||||
|
uniform vec2 GlowUVRepeat3;
|
||||||
|
layout (binding = 0) uniform sampler2D AOTexture;
|
||||||
|
layout (binding = 1) uniform sampler2D SplatMapTexture;
|
||||||
|
layout (binding = 2) uniform sampler2D DiffuseTexture1;
|
||||||
|
layout (binding = 3) uniform sampler2D DiffuseTexture2;
|
||||||
|
layout (binding = 4) uniform sampler2D DiffuseTexture3;
|
||||||
|
layout (binding = 5) uniform sampler2D NormalMapTexture1;
|
||||||
|
layout (binding = 6) uniform sampler2D NormalMapTexture2;
|
||||||
|
layout (binding = 7) uniform sampler2D NormalMapTexture3;
|
||||||
|
layout (binding = 8) uniform sampler2D SpecularMapTexture1;
|
||||||
|
layout (binding = 9) uniform sampler2D SpecularMapTexture2;
|
||||||
|
layout (binding = 10) uniform sampler2D SpecularMapTexture3;
|
||||||
|
layout (binding = 11) uniform sampler2D GlowMapTexture1;
|
||||||
|
layout (binding = 12) uniform sampler2D GlowMapTexture2;
|
||||||
|
layout (binding = 13) uniform sampler2D GlowMapTexture3;
|
||||||
|
layout (binding = 13) uniform sampler2D GlowMapTexture3;
|
||||||
|
layout (binding = 31) uniform samplerCube ShieldBuffer;
|
||||||
|
|
||||||
|
#define TILE_SIZE 16
|
||||||
|
|
||||||
|
struct LightSource {
|
||||||
|
vec4 Position;
|
||||||
|
vec4 Direction;
|
||||||
|
vec4 Color;
|
||||||
|
float Radius;
|
||||||
|
float Intensity;
|
||||||
|
float Falloff;
|
||||||
|
int Type;
|
||||||
|
};
|
||||||
|
|
||||||
|
layout (std430, binding = 1) buffer LightBuffer
|
||||||
|
{
|
||||||
|
LightSource List[];
|
||||||
|
} LightSources;
|
||||||
|
|
||||||
|
struct LightGrid {
|
||||||
|
float Start;
|
||||||
|
float Amount;
|
||||||
|
vec2 Padding;
|
||||||
|
};
|
||||||
|
|
||||||
|
layout (std430, binding = 2) buffer LightGridBuffer
|
||||||
|
{
|
||||||
|
LightGrid Data[];
|
||||||
|
} LightGrids;
|
||||||
|
|
||||||
|
layout (std430, binding = 4) buffer LightIndexBuffer
|
||||||
|
{
|
||||||
|
float LightIndex[];
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
in VertexData{
|
||||||
|
vec3 Position;
|
||||||
|
vec3 Normal;
|
||||||
|
vec3 Tangent;
|
||||||
|
vec3 BiTangent;
|
||||||
|
vec2 TextureCoordinate;
|
||||||
|
vec4 ExplosionColor;
|
||||||
|
float ExplosionPercentageElapsed;
|
||||||
|
}Input;
|
||||||
|
|
||||||
|
out vec4 sceneColor;
|
||||||
|
out vec4 bloomColor;
|
||||||
|
|
||||||
|
struct LightResult {
|
||||||
|
vec4 Diffuse;
|
||||||
|
vec4 Specular;
|
||||||
|
};
|
||||||
|
|
||||||
|
float CalcAttenuation(float radius, float dist, float falloff) {
|
||||||
|
return 1.0 - smoothstep(radius * 0.3, radius, dist);
|
||||||
|
}
|
||||||
|
|
||||||
|
vec4 CalcSpecular(vec4 lightColor, vec4 viewVec, vec4 lightVec, vec4 normal) {
|
||||||
|
vec4 R = normalize( reflect(-lightVec, normal));
|
||||||
|
float RdotV = max( dot(R, viewVec), 0.0);
|
||||||
|
return lightColor * pow(RdotV, 90.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
vec4 CalcDiffuse(vec4 lightColor, vec4 lightVec, vec4 normal) {
|
||||||
|
float power = max( dot(normal, lightVec), 0.0);
|
||||||
|
return lightColor * power;
|
||||||
|
}
|
||||||
|
|
||||||
|
LightResult CalcPointLightSource(vec4 lightPos, float lightRadius, vec4 lightColor, float intensity, vec4 viewVec, vec4 position, vec4 normal, float falloff)
|
||||||
|
{
|
||||||
|
vec4 L = lightPos - position;
|
||||||
|
float dist = length(L);
|
||||||
|
L = normalize(L);
|
||||||
|
|
||||||
|
float attenuation = CalcAttenuation(lightRadius, dist, falloff);
|
||||||
|
|
||||||
|
LightResult result;
|
||||||
|
result.Diffuse = CalcDiffuse(lightColor, L, normal) * attenuation * intensity;
|
||||||
|
result.Specular = CalcSpecular(lightColor, viewVec, L, normal) * attenuation * intensity;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
LightResult CalcDirectionalLightSource(vec4 direction, vec4 color, float intensity, vec4 viewVec, vec4 vertNormal)
|
||||||
|
{
|
||||||
|
vec4 L = normalize( -vec4(direction.xyz, 0) );
|
||||||
|
|
||||||
|
LightResult result;
|
||||||
|
result.Diffuse = CalcDiffuse(color, L, vertNormal) * intensity;
|
||||||
|
result.Specular = CalcSpecular(color, viewVec, L, vertNormal) * intensity;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
vec4 CalcNormalMappedValue(vec3 normal, vec3 tangent, vec3 bitangent, vec2 textureCoordinate, sampler2D normalMap)
|
||||||
|
{
|
||||||
|
mat3 TBN = mat3(tangent, bitangent, normal);
|
||||||
|
vec3 NormalMap = texture(normalMap, textureCoordinate).xyz * 2.0 - vec3(1.0);
|
||||||
|
return vec4(TBN * normalize(NormalMap), 0.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
vec4 CalcBlendedTexel(vec4 blendValue, sampler2D R, sampler2D G, sampler2D B,
|
||||||
|
vec2 R_TileValues, vec2 G_TileValues, vec2 B_TileValues){
|
||||||
|
vec4 R_Channel = texture2D(R, Input.TextureCoordinate * R_TileValues);
|
||||||
|
vec4 G_Channel = texture2D(G, Input.TextureCoordinate * G_TileValues);
|
||||||
|
vec4 B_Channel = texture2D(B, Input.TextureCoordinate * B_TileValues);
|
||||||
|
|
||||||
|
float total = blendValue.r + blendValue.g + blendValue.b;
|
||||||
|
float totalDiv = 1.0f / total;
|
||||||
|
blendValue.r = blendValue.r * totalDiv;
|
||||||
|
blendValue.g = blendValue.g * totalDiv;
|
||||||
|
blendValue.b = blendValue.b * totalDiv;
|
||||||
|
|
||||||
|
return blendValue.r * R_Channel
|
||||||
|
+ blendValue.g * G_Channel
|
||||||
|
+ blendValue.b * B_Channel;
|
||||||
|
}
|
||||||
|
|
||||||
|
vec4 CalcBlendedNormal(vec4 blendValue, sampler2D R, sampler2D G, sampler2D B,
|
||||||
|
vec2 R_TileValues, vec2 G_TileValues, vec2 B_TileValues){
|
||||||
|
mat3 TBN = mat3(Input.Tangent, Input.BiTangent, Input.Normal);
|
||||||
|
vec3 R_Channel = texture(R, Input.TextureCoordinate * R_TileValues).xyz * 2.0 - vec3(1.0);
|
||||||
|
vec3 G_Channel = texture(G, Input.TextureCoordinate * G_TileValues).xyz * 2.0 - vec3(1.0);
|
||||||
|
vec3 B_Channel = texture(B, Input.TextureCoordinate * B_TileValues).xyz * 2.0 - vec3(1.0);
|
||||||
|
|
||||||
|
float total = blendValue.r + blendValue.g + blendValue.b + blendValue.a;
|
||||||
|
float totalDiv = 1 / total;
|
||||||
|
blendValue.r = blendValue.r * totalDiv;
|
||||||
|
blendValue.g = blendValue.g * totalDiv;
|
||||||
|
blendValue.b = blendValue.b * totalDiv;
|
||||||
|
|
||||||
|
vec3 Normal_result = blendValue.r * R_Channel
|
||||||
|
+ blendValue.g * G_Channel
|
||||||
|
+ blendValue.b * B_Channel;
|
||||||
|
|
||||||
|
return vec4(TBN * normalize(Normal_result), 0.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
float ao = texelFetch(AOTexture, ivec2(gl_FragCoord.xy) >> int(SSAOQuality), 0).r;
|
||||||
|
ao = (clamp(1.0 - (1.0 - ao), 0.0, 1.0) + MIN_AMBIENT_LIGHT) / (1.0 + MIN_AMBIENT_LIGHT);
|
||||||
|
|
||||||
|
vec4 splatTexel = texture2D(SplatMapTexture, Input.TextureCoordinate);
|
||||||
|
|
||||||
|
vec4 diffuseTexel = CalcBlendedTexel(splatTexel, DiffuseTexture1, DiffuseTexture2, DiffuseTexture3,
|
||||||
|
DiffuseUVRepeat1, DiffuseUVRepeat2, DiffuseUVRepeat3);
|
||||||
|
vec4 glowTexel = CalcBlendedTexel(splatTexel, GlowMapTexture1, GlowMapTexture2, GlowMapTexture3,
|
||||||
|
GlowUVRepeat1, GlowUVRepeat2, GlowUVRepeat3);
|
||||||
|
vec4 specularTexel = CalcBlendedTexel(splatTexel, SpecularMapTexture1, SpecularMapTexture2, SpecularMapTexture3,
|
||||||
|
SpecularUVRepeat1, SpecularUVRepeat2, SpecularUVRepeat3);
|
||||||
|
vec4 position = V * M * vec4(Input.Position, 1.0);
|
||||||
|
//vec4 normal = V * CalcNormalMappedValue(Input.Normal, Input.Tangent, Input.BiTangent, Input.TextureCoordinate, SplatMapTexture);
|
||||||
|
vec4 normal = V * CalcBlendedNormal(splatTexel, NormalMapTexture1, NormalMapTexture2, NormalMapTexture3,
|
||||||
|
NormalUVRepeat1, NormalUVRepeat2, NormalUVRepeat3);
|
||||||
|
normal = normalize(normal);
|
||||||
|
//vec4 normal = normalize(V * vec4(Input.Normal, 0.0));
|
||||||
|
vec4 viewVec = normalize(-position);
|
||||||
|
|
||||||
|
vec2 tilePos;
|
||||||
|
tilePos.x = int(gl_FragCoord.x/TILE_SIZE);
|
||||||
|
tilePos.y = int(gl_FragCoord.y/TILE_SIZE);
|
||||||
|
|
||||||
|
LightResult totalLighting;
|
||||||
|
totalLighting.Diffuse = vec4(AmbientColor.rgb * ao, 1.0);
|
||||||
|
int currentTile = int(floor(gl_FragCoord.x/TILE_SIZE) + (floor(gl_FragCoord.y/TILE_SIZE) * int(ScreenDimensions.x/TILE_SIZE)));
|
||||||
|
|
||||||
|
int start = int(LightGrids.Data[currentTile].Start);
|
||||||
|
int amount = int(LightGrids.Data[currentTile].Amount);
|
||||||
|
|
||||||
|
for(int i = start; i < start + amount; i++) {
|
||||||
|
|
||||||
|
int l = int(LightIndex[i]);
|
||||||
|
LightSource light = LightSources.List[l];
|
||||||
|
|
||||||
|
LightResult light_result;
|
||||||
|
//These if statements should be removed.
|
||||||
|
if(light.Type == 1) { // point
|
||||||
|
light_result = CalcPointLightSource(V * light.Position, light.Radius, light.Color, light.Intensity, viewVec, position, normal, light.Falloff);
|
||||||
|
} else if (light.Type == 2) { //Directional
|
||||||
|
light_result = CalcDirectionalLightSource(V * light.Direction, light.Color, light.Intensity, viewVec, normal);
|
||||||
|
}
|
||||||
|
totalLighting.Diffuse += vec4(light_result.Diffuse.rgb * ao, light_result.Diffuse.a);
|
||||||
|
totalLighting.Specular += vec4(light_result.Specular.rgb * ao, light_result.Specular.a);
|
||||||
|
}
|
||||||
|
|
||||||
|
vec4 color_result = mix((Color * diffuseTexel * DiffuseColor), Input.ExplosionColor, Input.ExplosionPercentageElapsed);
|
||||||
|
color_result = color_result * (totalLighting.Diffuse + (totalLighting.Specular * specularTexel));
|
||||||
|
//vec4 color_result = (DiffuseColor + Input.ExplosionColor) * (totalLighting.Diffuse + (totalLighting.Specular * specularTexel)) * diffuseTexel * Color;
|
||||||
|
|
||||||
|
|
||||||
|
float pos = ((P * vec4(Input.Position, 1)).y + 1.0)/2.0;
|
||||||
|
|
||||||
|
if(pos <= FillPercentage) {
|
||||||
|
color_result += FillColor;
|
||||||
|
}
|
||||||
|
sceneColor = vec4(color_result.xyz, clamp(color_result.a, 0, 1));
|
||||||
|
color_result += glowTexel*3;
|
||||||
|
|
||||||
|
bloomColor = vec4(clamp(color_result.xyz - 1.0, 0, 100), 1.0);
|
||||||
|
|
||||||
|
//Tiled Debug Code
|
||||||
|
/*
|
||||||
|
if(int(gl_FragCoord.x)%16 == 0 || int(gl_FragCoord.y)%16 == 0 ) {
|
||||||
|
sceneColor += vec4(0.5, 0, 0, 0);
|
||||||
|
} else {
|
||||||
|
sceneColor += vec4(LightGrids.Data[int(tilePos.x + tilePos.y*80)].Amount/LightSources.List.length(), 0, 0, 1);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
#version 430
|
||||||
|
|
||||||
|
uniform vec4 Color;
|
||||||
|
uniform vec4 FillColor;
|
||||||
|
uniform float FillPercentage;
|
||||||
|
uniform mat4 M;
|
||||||
|
uniform mat4 V;
|
||||||
|
uniform mat4 P;
|
||||||
|
|
||||||
|
layout (binding = 1) uniform sampler2D DiffuseTexture;
|
||||||
|
layout (binding = 2) uniform sampler2D GlowMapTexture;
|
||||||
|
|
||||||
|
|
||||||
|
in VertexData{
|
||||||
|
vec3 Position;
|
||||||
|
vec3 Normal;
|
||||||
|
vec2 TextureCoordinate;
|
||||||
|
}Input;
|
||||||
|
|
||||||
|
|
||||||
|
out vec4 sceneColor;
|
||||||
|
out vec4 bloomColor;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
vec4 diffuseTexel = texture2D(DiffuseTexture, Input.TextureCoordinate);
|
||||||
|
vec4 glowTexel = texture2D(GlowMapTexture, Input.TextureCoordinate);
|
||||||
|
|
||||||
|
vec4 color_result = Color * diffuseTexel;
|
||||||
|
|
||||||
|
float pos = ((P * vec4(Input.Position, 1)).y + 1.0)/2.0;
|
||||||
|
if(pos <= FillPercentage) {
|
||||||
|
color_result = FillColor*diffuseTexel.a;
|
||||||
|
}
|
||||||
|
sceneColor = vec4(color_result.xyz, clamp(color_result.a, 0, 1));
|
||||||
|
|
||||||
|
//bloomColor = vec4(clamp((glowTexel.xyz*3) - 1.0, 0, 100), 1.0);
|
||||||
|
bloomColor = vec4(1.0, 1.0, 1.0, 0.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -54,7 +54,7 @@ void EditorRenderSystem::Update(double dt)
|
|||||||
EntityWrapper entity(m_World, cModel.EntityID);
|
EntityWrapper entity(m_World, cModel.EntityID);
|
||||||
glm::mat4 modelMatrix = Transform::ModelMatrix(entity.ID, entity.World);
|
glm::mat4 modelMatrix = Transform::ModelMatrix(entity.ID, entity.World);
|
||||||
for (auto matGroup : model->MaterialGroups()) {
|
for (auto matGroup : model->MaterialGroups()) {
|
||||||
std::shared_ptr<ModelJob> modelJob = std::make_shared<ModelJob>(model, scene.Camera, modelMatrix, matGroup, cModel, entity.World, glm::vec4(0), 0.f);
|
std::shared_ptr<ModelJob> modelJob = std::make_shared<ModelJob>(model, scene.Camera, modelMatrix, matGroup, cModel, entity.World, glm::vec4(0), 0.f, false);
|
||||||
if (cModel["Transparent"]) {
|
if (cModel["Transparent"]) {
|
||||||
scene.Jobs.TransparentObjects.push_back(modelJob);
|
scene.Jobs.TransparentObjects.push_back(modelJob);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -101,8 +101,7 @@ void Client::Update()
|
|||||||
|
|
||||||
void Client::parseMessageType(Packet& packet)
|
void Client::parseMessageType(Packet& packet)
|
||||||
{
|
{
|
||||||
// Pop packetSize which is used by TCP Client to
|
// Pop packetSize
|
||||||
// create a packet of the correct size
|
|
||||||
packet.ReadPrimitive<int>();
|
packet.ReadPrimitive<int>();
|
||||||
int messageType = packet.ReadPrimitive<int>();
|
int messageType = packet.ReadPrimitive<int>();
|
||||||
if (messageType == -1)
|
if (messageType == -1)
|
||||||
@@ -144,6 +143,9 @@ void Client::parseMessageType(Packet& packet)
|
|||||||
case MessageType::OnDoubleJump:
|
case MessageType::OnDoubleJump:
|
||||||
parseDoubleJump(packet);
|
parseDoubleJump(packet);
|
||||||
break;
|
break;
|
||||||
|
case MessageType::AmmoPickup:
|
||||||
|
parseAmmoPickup(packet);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -233,7 +235,6 @@ void Client::parseSpawnEvents()
|
|||||||
m_EventBroker->Publish(e);
|
m_EventBroker->Publish(e);
|
||||||
}
|
}
|
||||||
m_PlayerSpawnEvents = tempSpawn;
|
m_PlayerSpawnEvents = tempSpawn;
|
||||||
// m_PlayerSpawnEvents.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::parsePlayersSpawned(Packet& packet)
|
void Client::parsePlayersSpawned(Packet& packet)
|
||||||
@@ -296,6 +297,14 @@ void Client::parseDoubleJump(Packet & packet)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Client::parseAmmoPickup(Packet & packet)
|
||||||
|
{
|
||||||
|
Events::AmmoPickup e;
|
||||||
|
e.AmmoGain = packet.ReadPrimitive<int>();
|
||||||
|
e.Player = m_LocalPlayer;
|
||||||
|
m_EventBroker->Publish(e);
|
||||||
|
}
|
||||||
|
|
||||||
void Client::updateFields(Packet& packet, const ComponentInfo& componentInfo, const EntityID& entityID)
|
void Client::updateFields(Packet& packet, const ComponentInfo& componentInfo, const EntityID& entityID)
|
||||||
{
|
{
|
||||||
for (auto field : componentInfo.FieldsInOrder) {
|
for (auto field : componentInfo.FieldsInOrder) {
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ Server::Server(World* world, EventBroker* eventBroker, int port)
|
|||||||
EVENT_SUBSCRIBE_MEMBER(m_EEntityDeleted, &Server::OnEntityDeleted);
|
EVENT_SUBSCRIBE_MEMBER(m_EEntityDeleted, &Server::OnEntityDeleted);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EComponentDeleted, &Server::OnComponentDeleted);
|
EVENT_SUBSCRIBE_MEMBER(m_EComponentDeleted, &Server::OnComponentDeleted);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EPlayerDamage, &Server::OnPlayerDamage);
|
EVENT_SUBSCRIBE_MEMBER(m_EPlayerDamage, &Server::OnPlayerDamage);
|
||||||
|
EVENT_SUBSCRIBE_MEMBER(m_EAmmoPickup, &Server::OnAmmoPickup);
|
||||||
// BindWW
|
// BindWW
|
||||||
if (port == 0) {
|
if (port == 0) {
|
||||||
port = config->Get<float>("Networking.Port", 27666);
|
port = config->Get<float>("Networking.Port", 27666);
|
||||||
@@ -510,6 +510,19 @@ bool Server::OnPlayerDamage(const Events::PlayerDamage& e)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Server::OnAmmoPickup(const Events::AmmoPickup & e)
|
||||||
|
{
|
||||||
|
for (auto& kv : m_ConnectedPlayers) {
|
||||||
|
if (e.Player.ID == kv.second.EntityID) {
|
||||||
|
Packet packet(MessageType::AmmoPickup);
|
||||||
|
// We dont send playerID as it will be set at client to local
|
||||||
|
packet.WritePrimitive(e.AmmoGain);
|
||||||
|
m_Reliable.Send(packet, kv.second);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void Server::parseClientPing()
|
void Server::parseClientPing()
|
||||||
{
|
{
|
||||||
LOG_INFO("%i: Parsing ping", m_PacketID);
|
LOG_INFO("%i: Parsing ping", m_PacketID);
|
||||||
@@ -604,12 +617,14 @@ bool Server::shouldSendToClient(EntityWrapper childEntity)
|
|||||||
auto children = m_World->GetDirectChildren(childEntity.ID);
|
auto children = m_World->GetDirectChildren(childEntity.ID);
|
||||||
for (auto it = children.first; it != children.second; it++) {
|
for (auto it = children.first; it != children.second; it++) {
|
||||||
EntityWrapper child(m_World, it->second);
|
EntityWrapper child(m_World, it->second);
|
||||||
if(child.HasComponent("CapturePoint")) {
|
if (child.HasComponent("CapturePoint") || child.HasComponent("HealthPickup")
|
||||||
|
|| child.HasComponent("AmmoPickup")) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return childEntity.HasComponent("Player") || childEntity.FirstParentWithComponent("Player").Valid()
|
return childEntity.HasComponent("Player") || childEntity.FirstParentWithComponent("Player").Valid()
|
||||||
|| childEntity.HasComponent("CapturePoint");
|
|| childEntity.HasComponent("CapturePoint") || childEntity.HasComponent("HealthPickup")
|
||||||
|
|| childEntity.HasComponent("AmmoPickup");
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayerID Server::GetPlayerIDFromEndpoint()
|
PlayerID Server::GetPlayerIDFromEndpoint()
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ void DrawColorCorrectionPass::InitializeShaderPrograms()
|
|||||||
m_ColorCorrectionProgram->Link();
|
m_ColorCorrectionProgram->Link();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawColorCorrectionPass::Draw(GLuint sceneTexture, GLuint bloomTexture, GLuint sceneTextureLowRes, GLuint bloomTextureLowRes, GLfloat gamma, GLfloat exposure)
|
void DrawColorCorrectionPass::Draw(GLuint sceneTexture, GLuint bloomTexture, GLfloat gamma, GLfloat exposure)
|
||||||
{
|
{
|
||||||
//glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
//glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||||
GLERROR("DrawScreenQuadPass::Draw: Pre");
|
GLERROR("DrawScreenQuadPass::Draw: Pre");
|
||||||
@@ -33,10 +33,6 @@ void DrawColorCorrectionPass::Draw(GLuint sceneTexture, GLuint bloomTexture, GLu
|
|||||||
glBindTexture(GL_TEXTURE_2D, sceneTexture);
|
glBindTexture(GL_TEXTURE_2D, sceneTexture);
|
||||||
glActiveTexture(GL_TEXTURE1);
|
glActiveTexture(GL_TEXTURE1);
|
||||||
glBindTexture(GL_TEXTURE_2D, bloomTexture);
|
glBindTexture(GL_TEXTURE_2D, bloomTexture);
|
||||||
glActiveTexture(GL_TEXTURE2);
|
|
||||||
glBindTexture(GL_TEXTURE_2D, sceneTextureLowRes);
|
|
||||||
glActiveTexture(GL_TEXTURE3);
|
|
||||||
glBindTexture(GL_TEXTURE_2D, bloomTextureLowRes);
|
|
||||||
|
|
||||||
glBindVertexArray(m_ScreenQuad->VAO);
|
glBindVertexArray(m_ScreenQuad->VAO);
|
||||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_ScreenQuad->ElementBuffer);
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_ScreenQuad->ElementBuffer);
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -8,13 +8,12 @@ DrawFinalPassState::DrawFinalPassState(GLuint frameBuffer)
|
|||||||
Enable(GL_BLEND);
|
Enable(GL_BLEND);
|
||||||
BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
Enable(GL_DEPTH_TEST);
|
Enable(GL_DEPTH_TEST);
|
||||||
DepthMask(GL_FALSE);
|
DepthMask(GL_TRUE);
|
||||||
DepthFunc(GL_LEQUAL);
|
|
||||||
Enable(GL_CULL_FACE);
|
Enable(GL_CULL_FACE);
|
||||||
Enable(GL_STENCIL_TEST);
|
// Enable(GL_STENCIL_TEST);
|
||||||
StencilFunc(GL_NOTEQUAL, 1, 0xFF);
|
// StencilFunc(GL_NOTEQUAL, 1, 0xFF);
|
||||||
StencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
|
// StencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
|
||||||
StencilMask(0xFF);
|
// StencilMask(0xFF);
|
||||||
ClearColor(glm::vec4(0.f, 0.f, 0.f, 0.f));
|
ClearColor(glm::vec4(0.f, 0.f, 0.f, 0.f));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -26,11 +25,9 @@ DrawFinalPassState::~DrawFinalPassState()
|
|||||||
DrawStencilState::DrawStencilState(GLuint frameBuffer)
|
DrawStencilState::DrawStencilState(GLuint frameBuffer)
|
||||||
{
|
{
|
||||||
BindFramebuffer(frameBuffer);
|
BindFramebuffer(frameBuffer);
|
||||||
Enable(GL_STENCIL_TEST);
|
|
||||||
StencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
|
|
||||||
StencilFunc(GL_ALWAYS, 1, 0xFF);
|
|
||||||
StencilMask(0xFF);
|
|
||||||
Enable(GL_DEPTH_TEST);
|
Enable(GL_DEPTH_TEST);
|
||||||
|
DepthMask(GL_TRUE);
|
||||||
|
Enable(GL_CULL_FACE);
|
||||||
ClearColor(glm::vec4(0.f));
|
ClearColor(glm::vec4(0.f));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,11 +23,12 @@ void PickingPass::InitializeTextures()
|
|||||||
glm::vec2(m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height), GL_RG8, GL_RG, GL_UNSIGNED_BYTE);
|
glm::vec2(m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height), GL_RG8, GL_RG, GL_UNSIGNED_BYTE);
|
||||||
|
|
||||||
CommonFunctions::GenerateTexture(&m_DepthBuffer, GL_CLAMP_TO_BORDER, GL_NEAREST,
|
CommonFunctions::GenerateTexture(&m_DepthBuffer, GL_CLAMP_TO_BORDER, GL_NEAREST,
|
||||||
glm::vec2(m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height), GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8);
|
glm::vec2(m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height), GL_DEPTH_COMPONENT32, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PickingPass::InitializeFrameBuffers()
|
void PickingPass::InitializeFrameBuffers()
|
||||||
{
|
{
|
||||||
|
|
||||||
m_PickingBuffer.AddResource(std::shared_ptr<BufferResource>(new Texture2D(&m_DepthBuffer, GL_DEPTH_ATTACHMENT)));
|
m_PickingBuffer.AddResource(std::shared_ptr<BufferResource>(new Texture2D(&m_DepthBuffer, GL_DEPTH_ATTACHMENT)));
|
||||||
m_PickingBuffer.AddResource(std::shared_ptr<BufferResource>(new Texture2D(&m_PickingTexture, GL_COLOR_ATTACHMENT0)));
|
m_PickingBuffer.AddResource(std::shared_ptr<BufferResource>(new Texture2D(&m_PickingTexture, GL_COLOR_ATTACHMENT0)));
|
||||||
m_PickingBuffer.Generate();
|
m_PickingBuffer.Generate();
|
||||||
|
|||||||
@@ -240,6 +240,8 @@ void RenderSystem::fillModels(RenderScene::Queues &Jobs)
|
|||||||
fillColor = (glm::vec4)fillComponent["Color"];
|
fillColor = (glm::vec4)fillComponent["Color"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isShielded = m_World->HasComponent(cModel.EntityID, "Shielded") || m_World->HasComponent(cModel.EntityID, "Player");
|
||||||
|
|
||||||
glm::mat4 modelMatrix = Transform::ModelMatrix(cModel.EntityID, m_World);
|
glm::mat4 modelMatrix = Transform::ModelMatrix(cModel.EntityID, m_World);
|
||||||
//Loop through all materialgroups of a model
|
//Loop through all materialgroups of a model
|
||||||
for (auto matGroup : model->MaterialGroups()) {
|
for (auto matGroup : model->MaterialGroups()) {
|
||||||
@@ -255,20 +257,19 @@ void RenderSystem::fillModels(RenderScene::Queues &Jobs)
|
|||||||
cModel,
|
cModel,
|
||||||
m_World,
|
m_World,
|
||||||
fillColor,
|
fillColor,
|
||||||
fillPercentage
|
fillPercentage,
|
||||||
|
isShielded
|
||||||
));
|
));
|
||||||
if (m_World->HasComponent(cModel.EntityID, "Shield")){
|
if (m_World->HasComponent(cModel.EntityID, "Shield")){
|
||||||
explosionEffectJob->CalculateHash();
|
explosionEffectJob->CalculateHash();
|
||||||
Jobs.ShieldObjects.push_back(explosionEffectJob);
|
Jobs.ShieldObjects.push_back(explosionEffectJob);
|
||||||
} else if (m_World->HasComponent(cModel.EntityID, "Shielded")
|
} else if (isShielded) {
|
||||||
|| m_World->HasComponent(cModel.EntityID, "Player")) {
|
|
||||||
|
|
||||||
if (explosionEffectJob->Color.a != 1.f || explosionEffectJob->EndColor.a != 1.f || explosionEffectJob->DiffuseColor.a != 1.f) {
|
if (explosionEffectJob->Color.a != 1.f || explosionEffectJob->EndColor.a != 1.f || explosionEffectJob->DiffuseColor.a != 1.f) {
|
||||||
cModel["Transparent"] = true;
|
cModel["Transparent"] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cModel["Transparent"]) {
|
if (cModel["Transparent"]) {
|
||||||
Jobs.TransparentShieldedObjects.push_back(explosionEffectJob);
|
Jobs.TransparentObjects.push_back(explosionEffectJob);
|
||||||
} else {
|
} else {
|
||||||
explosionEffectJob->CalculateHash();
|
explosionEffectJob->CalculateHash();
|
||||||
Jobs.OpaqueShieldedObjects.push_back(explosionEffectJob);
|
Jobs.OpaqueShieldedObjects.push_back(explosionEffectJob);
|
||||||
@@ -294,20 +295,20 @@ void RenderSystem::fillModels(RenderScene::Queues &Jobs)
|
|||||||
cModel,
|
cModel,
|
||||||
m_World,
|
m_World,
|
||||||
fillColor,
|
fillColor,
|
||||||
fillPercentage
|
fillPercentage,
|
||||||
|
isShielded
|
||||||
));
|
));
|
||||||
if (m_World->HasComponent(cModel.EntityID, "Shield")) {
|
if (m_World->HasComponent(cModel.EntityID, "Shield")) {
|
||||||
modelJob->CalculateHash();
|
modelJob->CalculateHash();
|
||||||
Jobs.ShieldObjects.push_back(modelJob);
|
Jobs.ShieldObjects.push_back(modelJob);
|
||||||
} else if (m_World->HasComponent(cModel.EntityID, "Shielded")
|
} else if (isShielded) {
|
||||||
|| m_World->HasComponent(cModel.EntityID, "Player")) {
|
|
||||||
|
|
||||||
if (modelJob->Color.a != 1.f || modelJob->DiffuseColor.a != 1.f) {
|
if (modelJob->Color.a != 1.f || modelJob->DiffuseColor.a != 1.f) {
|
||||||
cModel["Transparent"] = true;
|
cModel["Transparent"] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cModel["Transparent"]) {
|
if (cModel["Transparent"]) {
|
||||||
Jobs.TransparentShieldedObjects.push_back(modelJob);
|
Jobs.TransparentObjects.push_back(modelJob);
|
||||||
} else {
|
} else {
|
||||||
modelJob->CalculateHash();
|
modelJob->CalculateHash();
|
||||||
Jobs.OpaqueShieldedObjects.push_back(modelJob);
|
Jobs.OpaqueShieldedObjects.push_back(modelJob);
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ void Renderer::Draw(RenderFrame& frame)
|
|||||||
{
|
{
|
||||||
GLERROR("PRE");
|
GLERROR("PRE");
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||||
ImGui::Combo("Draw textures", &m_DebugTextureToDraw, "Final\0Scene\0Bloom\0SceneLowRes\0BloomLowRes\0Gaussian\0Picking\0Ambient Occlusion");
|
ImGui::Combo("Draw textures", &m_DebugTextureToDraw, "Final\0Scene\0Bloom\0Gaussian\0Picking\0Ambient Occlusion");
|
||||||
ImGui::Combo("CubeMap", &m_CubeMapTexture, "Nevada(512)\0Sky(1024)");
|
ImGui::Combo("CubeMap", &m_CubeMapTexture, "Nevada(512)\0Sky(1024)");
|
||||||
if(m_CubeMapTexture == 0) {
|
if(m_CubeMapTexture == 0) {
|
||||||
m_CubeMapPass->LoadTextures("Nevada");
|
m_CubeMapPass->LoadTextures("Nevada");
|
||||||
@@ -174,7 +174,7 @@ void Renderer::Draw(RenderFrame& frame)
|
|||||||
|
|
||||||
if (m_DebugTextureToDraw == 0) {
|
if (m_DebugTextureToDraw == 0) {
|
||||||
PerformanceTimer::StartTimer("Renderer-Color Correction Pass");
|
PerformanceTimer::StartTimer("Renderer-Color Correction Pass");
|
||||||
m_DrawColorCorrectionPass->Draw(m_DrawFinalPass->SceneTexture(), m_DrawBloomPass->GaussianTexture(), m_DrawFinalPass->SceneTextureLowRes(), m_DrawFinalPass->BloomTextureLowRes(), frame.Gamma, frame.Exposure);
|
m_DrawColorCorrectionPass->Draw(m_DrawFinalPass->SceneTexture(), m_DrawBloomPass->GaussianTexture(), frame.Gamma, frame.Exposure);
|
||||||
PerformanceTimer::StopTimer("Renderer-Color Correction Pass");
|
PerformanceTimer::StopTimer("Renderer-Color Correction Pass");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -186,18 +186,12 @@ void Renderer::Draw(RenderFrame& frame)
|
|||||||
m_DrawScreenQuadPass->Draw(m_DrawFinalPass->BloomTexture());
|
m_DrawScreenQuadPass->Draw(m_DrawFinalPass->BloomTexture());
|
||||||
}
|
}
|
||||||
if (m_DebugTextureToDraw == 3) {
|
if (m_DebugTextureToDraw == 3) {
|
||||||
m_DrawScreenQuadPass->Draw(m_DrawFinalPass->SceneTextureLowRes());
|
|
||||||
}
|
|
||||||
if (m_DebugTextureToDraw == 4) {
|
|
||||||
m_DrawScreenQuadPass->Draw(m_DrawFinalPass->BloomTextureLowRes());
|
|
||||||
}
|
|
||||||
if (m_DebugTextureToDraw == 5) {
|
|
||||||
m_DrawScreenQuadPass->Draw(m_DrawBloomPass->GaussianTexture());
|
m_DrawScreenQuadPass->Draw(m_DrawBloomPass->GaussianTexture());
|
||||||
}
|
}
|
||||||
if (m_DebugTextureToDraw == 6) {
|
if (m_DebugTextureToDraw == 4) {
|
||||||
m_DrawScreenQuadPass->Draw(m_PickingPass->PickingTexture());
|
m_DrawScreenQuadPass->Draw(m_PickingPass->PickingTexture());
|
||||||
}
|
}
|
||||||
if (m_DebugTextureToDraw == 7) {
|
if (m_DebugTextureToDraw == 5) {
|
||||||
m_DrawScreenQuadPass->Draw(m_SSAOPass->SSAOTexture());
|
m_DrawScreenQuadPass->Draw(m_SSAOPass->SSAOTexture());
|
||||||
}
|
}
|
||||||
PerformanceTimer::StopTimer("Renderer-Misc Debug Draws");
|
PerformanceTimer::StopTimer("Renderer-Misc Debug Draws");
|
||||||
@@ -250,7 +244,7 @@ void Renderer::InitializeRenderPasses()
|
|||||||
m_LightCullingPass = new LightCullingPass(this);
|
m_LightCullingPass = new LightCullingPass(this);
|
||||||
m_CubeMapPass = new CubeMapPass(this);
|
m_CubeMapPass = new CubeMapPass(this);
|
||||||
m_SSAOPass = new SSAOPass(this, m_Config);
|
m_SSAOPass = new SSAOPass(this, m_Config);
|
||||||
m_DrawFinalPass = new DrawFinalPass(this, m_LightCullingPass, m_CubeMapPass, m_SSAOPass, m_PickingPass->DepthBuffer());
|
m_DrawFinalPass = new DrawFinalPass(this, m_LightCullingPass, m_CubeMapPass, m_SSAOPass);
|
||||||
m_DrawScreenQuadPass = new DrawScreenQuadPass(this);
|
m_DrawScreenQuadPass = new DrawScreenQuadPass(this);
|
||||||
m_DrawBloomPass = new DrawBloomPass(this, m_Config);
|
m_DrawBloomPass = new DrawBloomPass(this, m_Config);
|
||||||
m_DrawColorCorrectionPass = new DrawColorCorrectionPass(this);
|
m_DrawColorCorrectionPass = new DrawColorCorrectionPass(this);
|
||||||
|
|||||||
@@ -3,37 +3,43 @@
|
|||||||
AmmoPickupSystem::AmmoPickupSystem(SystemParams params)
|
AmmoPickupSystem::AmmoPickupSystem(SystemParams params)
|
||||||
: System(params)
|
: System(params)
|
||||||
{
|
{
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_ETriggerTouch, &AmmoPickupSystem::OnTriggerTouch);
|
if (IsServer) {
|
||||||
|
EVENT_SUBSCRIBE_MEMBER(m_ETriggerTouch, &AmmoPickupSystem::OnTriggerTouch);
|
||||||
|
}
|
||||||
|
if (IsClient) {
|
||||||
|
EVENT_SUBSCRIBE_MEMBER(m_EAmmoPickup, &AmmoPickupSystem::OnAmmoPickup);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AmmoPickupSystem::Update(double dt)
|
void AmmoPickupSystem::Update(double dt)
|
||||||
{
|
{
|
||||||
for (auto it = m_ETriggerTouchVector.begin(); it != m_ETriggerTouchVector.end(); ++it)
|
if (IsServer) {
|
||||||
{
|
for (auto it = m_ETriggerTouchVector.begin(); it != m_ETriggerTouchVector.end(); ++it) {
|
||||||
auto& ammoPickupPosition = *it;
|
auto& ammoPickupPosition = *it;
|
||||||
//set the double timer value (value 3)
|
//set the double timer value (value 3)
|
||||||
ammoPickupPosition.DecreaseThisRespawnTimer -= dt;
|
ammoPickupPosition.DecreaseThisRespawnTimer -= dt;
|
||||||
if (ammoPickupPosition.DecreaseThisRespawnTimer < 0.0) {
|
if (ammoPickupPosition.DecreaseThisRespawnTimer < 0.0) {
|
||||||
//spawn and delete the vector item
|
//spawn and delete the vector item
|
||||||
auto entityFile = ResourceManager::Load<EntityFile>("Schema/Entities/AmmoPickup.xml");
|
auto entityFile = ResourceManager::Load<EntityFile>("Schema/Entities/AmmoPickup.xml");
|
||||||
EntityFileParser parser(entityFile);
|
EntityFileParser parser(entityFile);
|
||||||
EntityID ammoPickupID = parser.MergeEntities(m_World);
|
EntityID ammoPickupID = parser.MergeEntities(m_World);
|
||||||
|
|
||||||
//let the world know a pickup has spawned (graphics effects, etc)
|
//let the world know a pickup has spawned (graphics effects, etc)
|
||||||
Events::PickupSpawned ePickupSpawned;
|
Events::PickupSpawned ePickupSpawned;
|
||||||
ePickupSpawned.Pickup = EntityWrapper(m_World, ammoPickupID);
|
ePickupSpawned.Pickup = EntityWrapper(m_World, ammoPickupID);
|
||||||
m_EventBroker->Publish(ePickupSpawned);
|
m_EventBroker->Publish(ePickupSpawned);
|
||||||
|
|
||||||
//set values from the old entity to the new entity
|
//set values from the old entity to the new entity
|
||||||
auto& newAmmoPickupEntity = EntityWrapper(m_World, ammoPickupID);
|
auto& newAmmoPickupEntity = EntityWrapper(m_World, ammoPickupID);
|
||||||
newAmmoPickupEntity["Transform"]["Position"] = ammoPickupPosition.Pos;
|
newAmmoPickupEntity["Transform"]["Position"] = ammoPickupPosition.Pos;
|
||||||
newAmmoPickupEntity["AmmoPickup"]["AmmoGain"] = ammoPickupPosition.AmmoGain;
|
newAmmoPickupEntity["AmmoPickup"]["AmmoGain"] = ammoPickupPosition.AmmoGain;
|
||||||
newAmmoPickupEntity["AmmoPickup"]["RespawnTimer"] = ammoPickupPosition.RespawnTimer;
|
newAmmoPickupEntity["AmmoPickup"]["RespawnTimer"] = ammoPickupPosition.RespawnTimer;
|
||||||
m_World->SetParent(newAmmoPickupEntity.ID, ammoPickupPosition.parentID);
|
m_World->SetParent(newAmmoPickupEntity.ID, ammoPickupPosition.parentID);
|
||||||
|
|
||||||
//erase the current element (AmmoPickupPosition)
|
//erase the current element (AmmoPickupPosition)
|
||||||
m_ETriggerTouchVector.erase(it);
|
m_ETriggerTouchVector.erase(it);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -41,7 +47,11 @@ void AmmoPickupSystem::Update(double dt)
|
|||||||
|
|
||||||
bool AmmoPickupSystem::OnTriggerTouch(Events::TriggerTouch& e)
|
bool AmmoPickupSystem::OnTriggerTouch(Events::TriggerTouch& e)
|
||||||
{
|
{
|
||||||
if (e.Entity != LocalPlayer) {
|
/*if (e.Entity != LocalPlayer) {
|
||||||
|
return false;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
if (!e.Entity.Valid()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
//TODO: add other weapontypes
|
//TODO: add other weapontypes
|
||||||
@@ -66,7 +76,7 @@ bool AmmoPickupSystem::OnTriggerTouch(Events::TriggerTouch& e)
|
|||||||
ePlayerAmmoPickup.Player = e.Entity;
|
ePlayerAmmoPickup.Player = e.Entity;
|
||||||
m_EventBroker->Publish(ePlayerAmmoPickup);
|
m_EventBroker->Publish(ePlayerAmmoPickup);
|
||||||
//immediately give the player the ammo
|
//immediately give the player the ammo
|
||||||
currentAmmo = std::min(currentAmmo + ammoGiven, maxWeaponAmmo);
|
//currentAmmo = std::min(currentAmmo + ammoGiven, maxWeaponAmmo);
|
||||||
|
|
||||||
//copy position, ammogain, respawntimer (twice since one of the values will be counted down to 0, the other will be set in the new object)
|
//copy position, ammogain, respawntimer (twice since one of the values will be counted down to 0, the other will be set in the new object)
|
||||||
//we need to copy all values since each value can be different for each ammoPickup
|
//we need to copy all values since each value can be different for each ammoPickup
|
||||||
@@ -77,3 +87,23 @@ bool AmmoPickupSystem::OnTriggerTouch(Events::TriggerTouch& e)
|
|||||||
m_World->DeleteEntity(e.Trigger.ID);
|
m_World->DeleteEntity(e.Trigger.ID);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool AmmoPickupSystem::OnAmmoPickup(Events::AmmoPickup & e)
|
||||||
|
{
|
||||||
|
if (!e.Player.Valid()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
//TODO: add other weapontypes
|
||||||
|
if (!e.Player.HasComponent("AssaultWeapon")) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
int maxWeaponAmmo = (int)e.Player["AssaultWeapon"]["MaxAmmo"];
|
||||||
|
int& currentAmmo = (int)e.Player["AssaultWeapon"]["Ammo"];
|
||||||
|
//cant pick up ammopacks if you are already at MaxAmmo
|
||||||
|
if (currentAmmo >= maxWeaponAmmo) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
currentAmmo = std::min(currentAmmo + e.AmmoGain, maxWeaponAmmo);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|||||||
@@ -3,37 +3,40 @@
|
|||||||
PickupSpawnSystem::PickupSpawnSystem(SystemParams params)
|
PickupSpawnSystem::PickupSpawnSystem(SystemParams params)
|
||||||
: System(params)
|
: System(params)
|
||||||
{
|
{
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_ETriggerTouch, &PickupSpawnSystem::OnTriggerTouch);
|
if (IsServer) {
|
||||||
|
EVENT_SUBSCRIBE_MEMBER(m_ETriggerTouch, &PickupSpawnSystem::OnTriggerTouch);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PickupSpawnSystem::Update(double dt)
|
void PickupSpawnSystem::Update(double dt)
|
||||||
{
|
{
|
||||||
for (auto it = m_ETriggerTouchVector.begin(); it != m_ETriggerTouchVector.end(); ++it)
|
if (IsServer) {
|
||||||
{
|
for (auto it = m_ETriggerTouchVector.begin(); it != m_ETriggerTouchVector.end(); ++it) {
|
||||||
auto& healthPickupPosition = *it;
|
auto& healthPickupPosition = *it;
|
||||||
//set the double timer value (value 3)
|
//set the double timer value (value 3)
|
||||||
healthPickupPosition.DecreaseThisRespawnTimer -= dt;
|
healthPickupPosition.DecreaseThisRespawnTimer -= dt;
|
||||||
if (healthPickupPosition.DecreaseThisRespawnTimer < 0) {
|
if (healthPickupPosition.DecreaseThisRespawnTimer < 0) {
|
||||||
//spawn and delete the vector item
|
//spawn and delete the vector item
|
||||||
auto entityFile = ResourceManager::Load<EntityFile>("Schema/Entities/HealthPickup.xml");
|
auto entityFile = ResourceManager::Load<EntityFile>("Schema/Entities/HealthPickup.xml");
|
||||||
EntityFileParser parser(entityFile);
|
EntityFileParser parser(entityFile);
|
||||||
EntityID healthPickupID = parser.MergeEntities(m_World);
|
EntityID healthPickupID = parser.MergeEntities(m_World);
|
||||||
|
|
||||||
//let the world know a pickup has spawned (graphics effects, etc)
|
//let the world know a pickup has spawned (graphics effects, etc)
|
||||||
Events::PickupSpawned ePickupSpawned;
|
Events::PickupSpawned ePickupSpawned;
|
||||||
ePickupSpawned.Pickup = EntityWrapper(m_World, healthPickupID);
|
ePickupSpawned.Pickup = EntityWrapper(m_World, healthPickupID);
|
||||||
m_EventBroker->Publish(ePickupSpawned);
|
m_EventBroker->Publish(ePickupSpawned);
|
||||||
|
|
||||||
//set values from the old entity to the new entity
|
//set values from the old entity to the new entity
|
||||||
auto& newHealthPickupEntity = EntityWrapper(m_World, healthPickupID);
|
auto& newHealthPickupEntity = EntityWrapper(m_World, healthPickupID);
|
||||||
newHealthPickupEntity["Transform"]["Position"] = healthPickupPosition.Pos;
|
newHealthPickupEntity["Transform"]["Position"] = healthPickupPosition.Pos;
|
||||||
newHealthPickupEntity["HealthPickup"]["HealthGain"] = healthPickupPosition.HealthGain;
|
newHealthPickupEntity["HealthPickup"]["HealthGain"] = healthPickupPosition.HealthGain;
|
||||||
newHealthPickupEntity["HealthPickup"]["RespawnTimer"] = healthPickupPosition.RespawnTimer;
|
newHealthPickupEntity["HealthPickup"]["RespawnTimer"] = healthPickupPosition.RespawnTimer;
|
||||||
m_World->SetParent(newHealthPickupEntity.ID, healthPickupPosition.parentID);
|
m_World->SetParent(newHealthPickupEntity.ID, healthPickupPosition.parentID);
|
||||||
|
|
||||||
//erase the current element (healthPickupPosition)
|
//erase the current element (healthPickupPosition)
|
||||||
m_ETriggerTouchVector.erase(it);
|
m_ETriggerTouchVector.erase(it);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -58,8 +61,8 @@ bool PickupSpawnSystem::OnTriggerTouch(Events::TriggerTouch& e)
|
|||||||
|
|
||||||
//copy position, healthgain, respawntimer (twice since one of the values will be counted down to 0, the other will be set in the new object)
|
//copy position, healthgain, respawntimer (twice since one of the values will be counted down to 0, the other will be set in the new object)
|
||||||
//we need to copy all values since each value can be different for each healthPickup
|
//we need to copy all values since each value can be different for each healthPickup
|
||||||
m_ETriggerTouchVector.push_back({ (glm::vec3)e.Trigger["Transform"]["Position"] ,e.Trigger["HealthPickup"]["HealthGain"],
|
m_ETriggerTouchVector.push_back({ (glm::vec3)e.Trigger["Transform"]["Position"], e.Trigger["HealthPickup"]["HealthGain"],
|
||||||
e.Trigger["HealthPickup"]["RespawnTimer"],e.Trigger["HealthPickup"]["RespawnTimer"], m_World->GetParent(e.Trigger.ID) });
|
e.Trigger["HealthPickup"]["RespawnTimer"], e.Trigger["HealthPickup"]["RespawnTimer"], m_World->GetParent(e.Trigger.ID) });
|
||||||
|
|
||||||
//delete the healthpickup
|
//delete the healthpickup
|
||||||
m_World->DeleteEntity(e.Trigger.ID);
|
m_World->DeleteEntity(e.Trigger.ID);
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ void PlayerMovementSystem::updateMovementControllers(double dt)
|
|||||||
EntityWrapper playerModel = player.FirstChildByName("PlayerModel");
|
EntityWrapper playerModel = player.FirstChildByName("PlayerModel");
|
||||||
if (playerModel.Valid()) {
|
if (playerModel.Valid()) {
|
||||||
ComponentWrapper cAnimationOffset = playerModel["AnimationOffset"];
|
ComponentWrapper cAnimationOffset = playerModel["AnimationOffset"];
|
||||||
float pitch = cameraOrientation.x + 0.2;
|
float pitch = cameraOrientation.x + 0.2f;
|
||||||
double time = (pitch + glm::half_pi<float>()) / glm::pi<float>();
|
double time = (pitch + glm::half_pi<float>()) / glm::pi<float>();
|
||||||
cAnimationOffset["Time"] = time;
|
cAnimationOffset["Time"] = time;
|
||||||
}
|
}
|
||||||
@@ -66,7 +66,7 @@ void PlayerMovementSystem::updateMovementControllers(double dt)
|
|||||||
ComponentWrapper cPhysics = player["Physics"];
|
ComponentWrapper cPhysics = player["Physics"];
|
||||||
//Assault Dash Check
|
//Assault Dash Check
|
||||||
if (player.HasComponent("DashAbility")) {
|
if (player.HasComponent("DashAbility")) {
|
||||||
controller->AssaultDashCheck(dt, ((glm::vec3)cPhysics["Velocity"]).y != 0.0f, player["DashAbility"]["CoolDownMaxTimer"]);
|
controller->AssaultDashCheck(dt, ((glm::vec3)cPhysics["Velocity"]).y != 0.0f, player["DashAbility"]["CoolDownMaxTimer"], player["DashAbility"]["CoolDownTimer"]);
|
||||||
}
|
}
|
||||||
wishDirection = controller->Movement() * glm::inverse(glm::quat(ori));
|
wishDirection = controller->Movement() * glm::inverse(glm::quat(ori));
|
||||||
//this makes sure you can only dash in the 4 directions: forw,backw,left,right
|
//this makes sure you can only dash in the 4 directions: forw,backw,left,right
|
||||||
@@ -311,6 +311,7 @@ bool PlayerMovementSystem::OnDoubleJump(Events::DoubleJump & e)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
spawnHexagon(EntityWrapper(m_World, e.entityID));
|
spawnHexagon(EntityWrapper(m_World, e.entityID));
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayerMovementSystem::spawnHexagon(EntityWrapper target)
|
void PlayerMovementSystem::spawnHexagon(EntityWrapper target)
|
||||||
|
|||||||
Reference in New Issue
Block a user