diff --git a/assets b/assets index d48c77c8..2bf82ffb 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit d48c77c854317333e38917a2be76069df969426d +Subproject commit 2bf82ffb6efb5f7f93c6c7bd32bbbbeae1eff44a diff --git a/include/Engine/Network/Client.h b/include/Engine/Network/Client.h index 715c5370..3033542d 100644 --- a/include/Engine/Network/Client.h +++ b/include/Engine/Network/Client.h @@ -17,6 +17,7 @@ #include "Network/TCPClient.h" #include "Network/SnapshotDefinitions.h" #include "Core/World.h" +#include "Core/EntityFile.h" #include "Core/EventBroker.h" #include "Core/ConfigFile.h" #include "Core/EPlayerDeath.h" @@ -30,7 +31,7 @@ #include "Network/ESearchForServers.h" #include "../Game/Events/EDashAbility.h" #include "Network/EDisplayServerlist.h" - +#include "Network/EConnectRequest.h" class Client : public Network { public: @@ -108,6 +109,8 @@ private: void sendLocalPlayerTransform(); void becomePlayer(); void displayServerlist(); + void removeWorld(); + void createMainMenu(); // Mapping Logic // Returns if local EntityID exist in map bool clientServerMapsHasEntity(EntityID clientEntityID); @@ -128,6 +131,8 @@ private: bool OnDoubleJump(Events::DoubleJump & e); EventRelay m_EDashAbility; bool OnDashAbility(const Events::DashAbility& e); + EventRelay m_EConnectRequest; + bool OnConnectRequest(const Events::ConnectRequest& e); bool OnSearchForServers(const Events::SearchForServers& e); UDPClient m_ServerlistRequest; diff --git a/include/Engine/Network/NetworkClient.h b/include/Engine/Network/NetworkClient.h index 4adc68f5..1b6af2ea 100644 --- a/include/Engine/Network/NetworkClient.h +++ b/include/Engine/Network/NetworkClient.h @@ -11,7 +11,7 @@ class NetworkClient public: NetworkClient(); virtual ~NetworkClient(); - virtual void Connect(std::string playerName, std::string address, int port) = 0; + virtual bool Connect(std::string playerName, std::string address, int port) = 0; virtual void Disconnect() = 0; virtual void Receive(Packet& packet) = 0; virtual void Send(Packet & packet) = 0; diff --git a/include/Engine/Network/Server.h b/include/Engine/Network/Server.h index 48b7bcfa..f96a4a7d 100644 --- a/include/Engine/Network/Server.h +++ b/include/Engine/Network/Server.h @@ -60,6 +60,7 @@ private: std::vector m_InputCommandsToBroadcast; //Timers std::clock_t m_StartPingTime; + std::string m_ServerName = ""; // Packet loss logic PacketID m_PacketID = 0; diff --git a/include/Engine/Network/TCPClient.h b/include/Engine/Network/TCPClient.h index 2108fa3d..13bd2db5 100644 --- a/include/Engine/Network/TCPClient.h +++ b/include/Engine/Network/TCPClient.h @@ -10,7 +10,7 @@ public: TCPClient(); ~TCPClient(); - void Connect(std::string playerName, std::string address, int port); + bool Connect(std::string playerName, std::string address, int port); void Disconnect(); void Receive(Packet& packet); void Send(Packet & packet); diff --git a/include/Engine/Network/UDPClient.h b/include/Engine/Network/UDPClient.h index 42c27783..0550b152 100644 --- a/include/Engine/Network/UDPClient.h +++ b/include/Engine/Network/UDPClient.h @@ -10,7 +10,7 @@ public: UDPClient(); ~UDPClient(); - void Connect(std::string playerName, std::string address, int port); + bool Connect(std::string playerName, std::string address, int port); void Disconnect(); void Receive(Packet& packet); void Send(Packet & packet); diff --git a/include/Engine/Rendering/BlurHUD.h b/include/Engine/Rendering/BlurHUD.h index ca3b7270..783e8a2f 100644 --- a/include/Engine/Rendering/BlurHUD.h +++ b/include/Engine/Rendering/BlurHUD.h @@ -48,7 +48,7 @@ private: //const LightCullingPass* m_LightCullingPass int m_Iterations = 3; int m_Quality = 0; - float m_BlurQuality = 2.f; + float m_BlurQuality = 4.f; GLuint m_GaussianTexture_horiz = 0; GLuint m_GaussianTexture_vert = 0; diff --git a/include/Engine/Rendering/CubeMapPass.h b/include/Engine/Rendering/CubeMapPass.h index 3cda8cad..02e8e7ba 100644 --- a/include/Engine/Rendering/CubeMapPass.h +++ b/include/Engine/Rendering/CubeMapPass.h @@ -15,7 +15,7 @@ public: void GenerateCubeMapTexture(); //GLuint CubeMapTexture() const { return m_CubeMapTexture; } - GLuint m_CubeMapTexture = -1; + GLuint m_CubeMapTexture = 0; private: IRenderer* m_Renderer; diff --git a/include/Engine/Rendering/DrawBloomPass.h b/include/Engine/Rendering/DrawBloomPass.h index ee3a8489..e6a87c11 100644 --- a/include/Engine/Rendering/DrawBloomPass.h +++ b/include/Engine/Rendering/DrawBloomPass.h @@ -13,7 +13,7 @@ class DrawBloomPass { public: DrawBloomPass(IRenderer* renderer, ConfigFile* config); - ~DrawBloomPass() { } + ~DrawBloomPass(); void InitializeTextures(); void InitializeFrameBuffers(); void InitializeShaderPrograms(); diff --git a/include/Engine/Rendering/DrawFinalPass.h b/include/Engine/Rendering/DrawFinalPass.h index 5d741256..1b2771b5 100644 --- a/include/Engine/Rendering/DrawFinalPass.h +++ b/include/Engine/Rendering/DrawFinalPass.h @@ -17,7 +17,7 @@ class DrawFinalPass { public: DrawFinalPass(IRenderer* renderer, LightCullingPass* lightCullingPass, CubeMapPass* cubeMapPass, SSAOPass* ssaoPass); - ~DrawFinalPass() { } + ~DrawFinalPass(); void InitializeTextures(); void InitializeFrameBuffers(); void InitializeShaderPrograms(); @@ -57,11 +57,11 @@ private: FrameBuffer m_FinalPassFrameBuffer; FrameBuffer m_ShieldDepthFrameBuffer; - GLuint m_BloomTexture; - GLuint m_SceneTexture; - GLuint m_DepthBuffer; - GLuint m_ShieldBuffer; - GLuint m_CubeMapTexture; + GLuint m_BloomTexture = 0; + GLuint m_SceneTexture = 0; + GLuint m_DepthBuffer = 0; + GLuint m_ShieldBuffer = 0; + GLuint m_CubeMapTexture = 0; GLuint m_FullBlurredTexture; GLuint m_CombinedTexture; //This can be removed for less memory usage, just set m_sceneTexture to the return from m_BlurHUDPass.CombineTextures diff --git a/include/Engine/Rendering/ModelJob.h b/include/Engine/Rendering/ModelJob.h index 05a4e5b0..22a4614d 100644 --- a/include/Engine/Rendering/ModelJob.h +++ b/include/Engine/Rendering/ModelJob.h @@ -111,7 +111,7 @@ struct ModelJob : RenderJob Color = modelComponent["Color"]; GlowIntensity = ((double)modelComponent["GlowIntensity"]); Entity = modelComponent.EntityID; - glm::vec3 abspos = Transform::AbsolutePosition(world, modelComponent.EntityID); + glm::vec3 abspos = glm::vec3(matrix[3][0], matrix[3][1], matrix[3][2]); glm::vec3 worldpos = glm::vec3(camera->ViewMatrix() * glm::vec4(abspos, 1)); Depth = worldpos.z; World = world; @@ -164,7 +164,9 @@ struct ModelJob : RenderJob bool IsShielded; void CalculateHash() override { - Hash = ShaderID << 20 + ModelID << 10 + TextureID; + Hash = TextureID; + Hash += ModelID << 10; + Hash += ShaderID << 20; } }; diff --git a/include/Engine/Rendering/PickingPass.h b/include/Engine/Rendering/PickingPass.h index df99a615..14ce26ab 100644 --- a/include/Engine/Rendering/PickingPass.h +++ b/include/Engine/Rendering/PickingPass.h @@ -52,8 +52,8 @@ private: std::unordered_map m_PickingColorsToEntity; - GLuint m_PickingTexture; - GLuint m_DepthBuffer; + GLuint m_PickingTexture = 0; + GLuint m_DepthBuffer = 0; FrameBuffer m_PickingBuffer; diff --git a/include/Engine/Rendering/RenderJob.h b/include/Engine/Rendering/RenderJob.h index bcffc4a5..6fd8963e 100644 --- a/include/Engine/Rendering/RenderJob.h +++ b/include/Engine/Rendering/RenderJob.h @@ -16,16 +16,15 @@ struct RenderJob public: float Depth; + bool operator<(const RenderJob& rhs) + { + return this->Hash < rhs.Hash; + } + protected: uint64_t Hash; virtual void CalculateHash() = 0; - - bool operator<(const RenderJob& rhs) - { - return this->Hash < rhs.Hash; - } - }; #endif \ No newline at end of file diff --git a/include/Engine/Rendering/Renderer.h b/include/Engine/Rendering/Renderer.h index 9983bae9..220b7679 100644 --- a/include/Engine/Rendering/Renderer.h +++ b/include/Engine/Rendering/Renderer.h @@ -37,6 +37,7 @@ public: : m_EventBroker(eventBroker) , m_Config(config) { } + ~Renderer(); virtual void Initialize() override; virtual void Update(double dt) override; diff --git a/include/Engine/Rendering/SSAOPass.h b/include/Engine/Rendering/SSAOPass.h index 1cb28009..ba92b6dc 100644 --- a/include/Engine/Rendering/SSAOPass.h +++ b/include/Engine/Rendering/SSAOPass.h @@ -14,7 +14,7 @@ class SSAOPass { public: SSAOPass(IRenderer* renderer, ConfigFile* config); - ~SSAOPass() { }; + ~SSAOPass(); void ChangeQuality(int quality); diff --git a/include/Engine/Rendering/ShaderProgram.h b/include/Engine/Rendering/ShaderProgram.h index ad01c029..af90ff78 100644 --- a/include/Engine/Rendering/ShaderProgram.h +++ b/include/Engine/Rendering/ShaderProgram.h @@ -21,6 +21,8 @@ public: std::string GetFileName() const; GLuint GetHandle() const; bool IsCompiled() const; + static std::string ReadFile(std::string fileName); +private: protected: GLenum m_ShaderType; std::string m_FileName; diff --git a/include/Engine/Rendering/SpriteJob.h b/include/Engine/Rendering/SpriteJob.h index 2533d4d4..c323fa06 100644 --- a/include/Engine/Rendering/SpriteJob.h +++ b/include/Engine/Rendering/SpriteJob.h @@ -7,6 +7,7 @@ #include "../GLM.h" #include "../Core/ComponentWrapper.h" #include "Texture.h" +#include "TextureSprite.h" #include "Model.h" #include "RenderJob.h" #include "../Core/ResourceManager.h" @@ -24,9 +25,9 @@ struct SpriteJob : RenderJob ::RawModel::MaterialProperties matProp = Model->MaterialGroups().front(); TextureID = 0; - DiffuseTexture = CommonFunctions::LoadTexture(cSprite["DiffuseTexture"], true); + DiffuseTexture = CommonFunctions::TryLoadResource(cSprite["DiffuseTexture"]); - IncandescenceTexture = CommonFunctions::LoadTexture(cSprite["GlowMap"], true); + IncandescenceTexture = CommonFunctions::TryLoadResource(cSprite["GlowMap"]); StartIndex = matProp.material->StartIndex; EndIndex = matProp.material->EndIndex; diff --git a/include/Engine/Rendering/Texture.h b/include/Engine/Rendering/Texture.h index d159e636..030a4b65 100644 --- a/include/Engine/Rendering/Texture.h +++ b/include/Engine/Rendering/Texture.h @@ -9,7 +9,7 @@ class Texture : public BaseTexture { friend class ResourceManager; -private: +protected: Texture(std::string path); public: diff --git a/include/Engine/Rendering/TextureSprite.h b/include/Engine/Rendering/TextureSprite.h new file mode 100644 index 00000000..f8527664 --- /dev/null +++ b/include/Engine/Rendering/TextureSprite.h @@ -0,0 +1,26 @@ +#ifndef TextureSprite_h__ +#define TextureSprite_h__ + +#include "../OpenGL.h" +#include "BaseTexture.h" +#include "Texture.h" +#include "PNG.h" + +class TextureSprite : public Texture +{ + friend class ResourceManager; + +protected: + TextureSprite(std::string path); + +public: + ~TextureSprite(); + + void Bind(GLenum textureUnit = GL_TEXTURE0); + + GLuint m_Texture = 0; + unsigned char* Data = nullptr; + +}; + +#endif diff --git a/include/Engine/Rendering/Util/CommonFunctions.h b/include/Engine/Rendering/Util/CommonFunctions.h index 1ed3d82a..94cf8683 100644 --- a/include/Engine/Rendering/Util/CommonFunctions.h +++ b/include/Engine/Rendering/Util/CommonFunctions.h @@ -8,7 +8,23 @@ namespace CommonFunctions { -Texture* LoadTexture(std::string path, bool threaded); + +//Loads Texture/SpriteTexture and return null if it fails +template +Texture* TryLoadResource(std::string path) +{ + Texture* img; + try { + img = ResourceManager::Load(path); + } catch (const Resource::StillLoadingException&) { + img = ResourceManager::Load("Textures/Core/ErrorTexture.png"); + } catch (const std::exception&) { + img = nullptr; + } + + return img; +} + void GenerateTexture(GLuint* texture, GLenum wrapping, GLenum filtering, glm::vec2 dimensions, GLint internalFormat, GLint format, GLenum type); void GenerateMultiSampleTexture(GLuint* texture, int numSamples, glm::vec2 dimensions, GLint internalFormat); void GenerateMipMapTexture(GLuint* texture, GLenum wrapping, glm::vec2 dimensions, GLint format, GLenum type, GLint numMipMaps); diff --git a/include/Game/Systems/StartSystem.h b/include/Game/Systems/StartSystem.h new file mode 100644 index 00000000..fb2231e9 --- /dev/null +++ b/include/Game/Systems/StartSystem.h @@ -0,0 +1,23 @@ +#ifndef StartSystem_h__ +#define StartSystem_h__ + +#include "Core/System.h" +#include "Core/ResourceManager.h" +#include "Core/Event.h" +#include "Core/EventBroker.h" +#include "Rendering/ESetCamera.h" + +class StartSystem : public ImpureSystem +{ +public: + StartSystem(SystemParams params); + virtual void Update(double dt) override; + +private: + EntityWrapper m_ActiveCamera = EntityWrapper::Invalid; + + EventRelay m_ECameraActivated; + bool OnCameraActivated(const Events::SetCamera& e); +}; + +#endif \ No newline at end of file diff --git a/include/Game/Systems/Weapon/WeaponBehaviour.h b/include/Game/Systems/Weapon/WeaponBehaviour.h index 3f3b6559..cd067f36 100644 --- a/include/Game/Systems/Weapon/WeaponBehaviour.h +++ b/include/Game/Systems/Weapon/WeaponBehaviour.h @@ -293,10 +293,8 @@ private: firstPersonWeapon = SpawnerSystem::Spawn(firstPersonAttachment, firstPersonAttachment); } } - if (IsServer) { - if (thirdPersonAttachment.Valid()) { - thirdPersonWeapon = SpawnerSystem::Spawn(thirdPersonAttachment, thirdPersonAttachment); - } + if (thirdPersonAttachment.Valid()) { + thirdPersonWeapon = SpawnerSystem::Spawn(thirdPersonAttachment, thirdPersonAttachment); } WeaponInfo& wi = m_ActiveWeapons[player]; diff --git a/resources/Schema/Entities/MainMenu.xml b/resources/Schema/Entities/MainMenu.xml index cefb25e2..e6cc6ef4 100644 --- a/resources/Schema/Entities/MainMenu.xml +++ b/resources/Schema/Entities/MainMenu.xml @@ -12,52 +12,11 @@ - - + + - - - - - - - - - - - - Textures/Core/White.png - true - - - - - - - - - - - - - Credits - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - - - @@ -70,7 +29,8 @@ Textures/Core/White.png true - + false + Play @@ -87,18 +47,126 @@ Play Fonts/DroidSans.ttf,64 - - + - + + + + + + + + + + Textures/HUD/ButtonCorner_16.png + + + + + + + + + + + + + Textures/HUD/ButtonCorner_16.png + + + + + + + + + + + + + + + + + + + + + + + + + + Textures/Core/White.png + true + + false + + + + + + + + + + + + Credits + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + + + + + + Textures/HUD/ButtonCorner_16.png + + + + + + + + + + + + + Textures/HUD/ButtonCorner_16.png + + + + + + + + + + + + @@ -115,7 +183,8 @@ Textures/Core/White.png true - + false + @@ -128,18 +197,51 @@ Option Fonts/DroidSans.ttf,64 - - + - + + + + + + + + + + Textures/HUD/ButtonCorner_16.png + + + + + + + + + + + + + Textures/HUD/ButtonCorner_16.png + + + + + + + + + + + + @@ -156,7 +258,8 @@ Textures/Core/White.png true - + false + @@ -169,18 +272,51 @@ Quit Fonts/DroidSans.ttf,64 - - + - + + + + + + + + + + Textures/HUD/ButtonCorner_16.png + + + + + + + + + + + + + Textures/HUD/ButtonCorner_16.png + + + + + + + + + + + + diff --git a/resources/Schema/Entities/ServerList.xml b/resources/Schema/Entities/ServerList.xml index 68c10bf7..f9a601f5 100644 --- a/resources/Schema/Entities/ServerList.xml +++ b/resources/Schema/Entities/ServerList.xml @@ -36,7 +36,7 @@ Textures/Core/White.png true - + diff --git a/resources/Schema/Entities/StartMenu.xml b/resources/Schema/Entities/StartMenu.xml new file mode 100644 index 00000000..2ad8f377 --- /dev/null +++ b/resources/Schema/Entities/StartMenu.xml @@ -0,0 +1,9190 @@ + + + + + + + + + + + + + + + + + Schema/Entities/NewMap2version5NEW.xml + + + + + + + + 7.0999304984909202 + + + + + + + + + + + + + + 2 + Models/Props/GroundTest.mesh + + + + + + + + Models/Props/Walls/SciFiWallTop.mesh + + + + + + + + + Models/Props/Walls/SciFiWallBig.mesh + true + + + + + + + + + + Models/Props/Walls/SciFiWallMedium.mesh + + + + + + + + + + Models/Props/Walls/SciFiWallSmall1.mesh + + + + + + + + + + Models/Props/Walls/SciFiWallSmall2.mesh + + + + + + + + + + Models/Props/Walls/SciFiWallBig.mesh + + + + + + + + + + + + Models/Props/Walls/SciFiWallMedium.mesh + + + + + + + + + + + + Models/Props/Walls/SciFiWallSmall3.mesh + + + + + + + + + + Models/Props/Walls/SciFiWallSmall4.mesh + + + + + + + + + + + + Models/Highgrounds/Highground1.mesh + + + + + + + + + + Models/Highgrounds/Highground2.mesh + + + + + + + + + + + Models/Highgrounds/Highground3.mesh + + + + + + + + + + + Models/Highgrounds/Highground24.mesh + + + + + + + + + + + Models/Highgrounds/Hg13.mesh + + + + + + + + + + + + + Models/Highgrounds/Hg25.mesh + + + + + + + + + + + + Models/Highgrounds/Hg26.mesh + + + + + + + + + + + + Models/Highgrounds/Hg9.mesh + + + + + + + + + + + + + Models/Highgrounds/Hg4.mesh + + + + + + + + + + + + + + Models/Highgrounds/Hg10.mesh + + + + + + + + + + + + + + Models/Highgrounds/Hg19.mesh + + + + + + + + + + + + + + Models/Highgrounds/Hg19.mesh + + + + + + + + + + + + + + + Models/Highgrounds/Highground12.mesh + + + + + + + + + + + + + Models/Highgrounds/Hg16.mesh + + + + + + + + + + + + Models/Highgrounds/Hg15.mesh + + + + + + + + + + + + Models/Highgrounds/Hg14.mesh + + + + + + + + + + + + + Models/Highgrounds/Hg13.mesh + + + + + + + + + + + + Models/Highgrounds/Hg11.mesh + + + + + + + + + + + + Models/Highgrounds/Hg20.mesh + + + + + + + + + + + + Models/Highgrounds/Hg18.mesh + + + + + + + + + + + + Models/Highgrounds/Hg19.mesh + + + + + + + + + + + + + Models/Highgrounds/Hg17.mesh + + + + + + + + + + + + + + + Models/Highgrounds/Hg8.mesh + + + + + + + + + + + + + Models/Highgrounds/Hg7.mesh + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + Models/Highgrounds/Hg3.mesh + + + + + + + + + + + + + + + Models/Highgrounds/Highground3.mesh + + + + + + + + + + + + Models/Highgrounds/Highground1.mesh + + + + + + + + + + + Models/Highgrounds/Highground2.mesh + + + + + + + + + + + + + + Models/Highgrounds/Hg1.mesh + + + + + + + + + + + Models/Highgrounds/Hg2.mesh + + + + + + + + + + + + + + Models/Highgrounds/Highground5.mesh + + + + + + + + + + + + Models/Highgrounds/Hg6.mesh + + + + + + + + + + + + Models/Highgrounds/Hg8.mesh + + + + + + + + + + + + Models/Highgrounds/Hg10.mesh + + + + + + + + + + + + Models/Highgrounds/Hg4.mesh + + + + + + + + + + + + Models/Highgrounds/Hg7.mesh + + + + + + + + + + + + Models/Highgrounds/Hg17.mesh + + + + + + + + + + + + + Models/Highgrounds/Hg19.mesh + + + + + + + + + + + + Models/Highgrounds/Hg18.mesh + + + + + + + + + + + + + Models/Highgrounds/Hg20.mesh + + + + + + + + + + + + + Models/Highgrounds/Hg16.mesh + + + + + + + + + + + + + Models/Highgrounds/Hg9.mesh + + + + + + + + + + + + Models/Highgrounds/Hg3.mesh + + + + + + + + + + + + + Models/Highgrounds/Hg19.mesh + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + + Models/Highgrounds/Hg10.mesh + + + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + + + + + + + + + + + + + + Models/Highgrounds/Highground22.mesh + + + + + + + + + + + + Models/Highgrounds/Hg8.mesh + + + + + + + + + + + + + Models/Highgrounds/Hg19.mesh + + + + + + + + + + + + + Models/Highgrounds/Hg21.mesh + + + + + + + + + + + + Models/Highgrounds/Hg11.mesh + + + + + + + + + + + + Models/Highgrounds/Hg3.mesh + + + + + + + + + + + + + Models/Highgrounds/Hg17.mesh + + + + + + + + + + + + + Models/Highgrounds/Hg8.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + + + + Models/Highgrounds/Hg28.mesh + + + + + + + + + + + Models/Highgrounds/Hg10.mesh + + + + + + + + + + + + + Models/Highgrounds/Hg27.mesh + + + + + + + + + + + + + Models/Highgrounds/Hg15.mesh + + + + + + + + + + + + + + Models/Highgrounds/Hg13.mesh + + + + + + + + + + + + + + + Models/Highgrounds/Hg27.mesh + + + + + + + + + + + + Models/Highgrounds/Hg23.mesh + + + + + + + + + + + + + + + Models/Highgrounds/Hg27.mesh + + + + + + + + + + + + + Models/Highgrounds/Hg23.mesh + + + + + + + + + + + + + + + Models/Highgrounds/Hg28.mesh + + + + + + + + + + + + Models/Highgrounds/Hg10.mesh + + + + + + + + + + + + + Models/Highgrounds/Hg27.mesh + + + + + + + + + + + + + Models/Highgrounds/Hg15.mesh + + + + + + + + + + + + + + Models/Highgrounds/Hg13.mesh + + + + + + + + + + + + + + + Models/Highgrounds/Hg1.mesh + + + + + + + + + + + + Models/Highgrounds/Hg2.mesh + + + + + + + + + + + + + + + + + + + + + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + Models/Props/SciFiHolder1.mesh + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar1Blue.mesh + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + + + + + + + + + + + 6 + Models/Props/Pillars/SciFiPillar1Red.mesh + + + + + + + + + + + + + 4 + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + + 4 + Models/Props/Pillars/SciFiPillar1Red.mesh + + + + + + + + + + + + + + 4 + Models/Props/Pillars/SciFiPillar3Red.mesh + + + + + + + + + + + + + + 6 + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + + 4 + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + + 6 + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + 6 + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + + 6 + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + + 6 + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + 6 + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + + 6 + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + + 4 + Models/Props/Pillars/SciFiPillar3Red.mesh + + + + + + + + + + + + + + + + + + + + + + + + + + Models/Props/Flora/SpecialRoot.mesh + + + + + + + + + + + + + + Models/Props/Flora/SpecialRoot.mesh + + + + + + + + + + + + + + Models/Props/Flora/SpecialRoot.mesh + + + + + + + + + + + + + + Models/Props/Flora/SpecialRoot.mesh + + + + + + + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 2 + + + + + + + + + + + + + + 5 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + 2 + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + 4 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + 2 + + + + + + + + + + + + 3 + + + + + + + + + + + + 2 + 1 + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + 4 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridge1Red.mesh + + + + + + + + + + + + Models/Props/Bridges/SciFiBridge1Red.mesh + + + + + + + + + + + + Models/Props/Pillars/SciFiBridgePillar1.mesh + + + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + Models/Props/Pillars/SciFiBridgePillar1.mesh + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + + + Models/Props/Pillars/SciFiBridgePillar1.mesh + + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridge1Red.mesh + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridge1Red.mesh + + + + + + + + + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + 6 + Models/Props/Pillars/SciFiPillar1Red.mesh + + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/HealthPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/HealthPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/AmmoPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/AmmoPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/HealthPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/HealthPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/AmmoPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/HealthPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/HealthPickUp.mesh + + + + + + + + + + + + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/mediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/mediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/mediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/mediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/mediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/mediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/mediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Core/UnitPlane.mesh + + true + + + + + + + + + + + + + + + + + + + Models/Props/SciFiHolder1.mesh + + + + + + + + + + + + + Models/Props/SciFiHolder1.mesh + + + + + + + + + + + + + Models/Props/SciFiHolder1.mesh + + + + + + + + + + + + + Models/Props/SciFiHolder1.mesh + + + + + + + + + + + + + Models/Props/SciFiHolder1.mesh + + + + + + + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + + + + + + + + + + + + Models/Props/Walls/BigWallBlue.mesh + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + + + + + + + + + + + + + + + + + + Models/Props/Walls/SpecialWall1.mesh + + + + + + + + + + + + + + Models/Props/Walls/SpecialWall1.mesh + + + + + + + + + + + + + + Models/Props/Walls/SpecialWall1.mesh + + + + + + + + + + + + + + Models/Props/Walls/SpecialWall1.mesh + + + + + + + + + + + + + + + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + + + + + + + Models/Props/Walls/BigWallBlue.mesh + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + + + + + + + + + + + Models/Props/Walls/smallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + + + + + + + + + + + Models/Props/Walls/BigWallBlue.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/AmmoPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/HealthPickUp.mesh + + + + + + + + + + + + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/mediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 2 + + + + + + + + + + + + + + 5 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + 2 + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + 4 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + 2 + + + + + + + + + + + + 3 + + + + + + + + + + + + 2 + 1 + + + + + + + + + + + + + + 4 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/mediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/AmmoPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/HealthPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/AmmoPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/HealthPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/AmmoPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/HealthPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/HealthPickUp.mesh + + + + + + + + + + + + + + + + + + + + + + + + + Models/Props/Walls/SpecialWall1.mesh + + + + + + + + + + + + + + Models/Props/Walls/SpecialWall1.mesh + + + + + + + + + + + + + + Models/Props/Walls/SpecialWall1.mesh + + + + + + + + + + + + + + Models/Props/Walls/SpecialWall1.mesh + + + + + + + + + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + + 6 + Models/Props/Pillars/SciFiPillar1Blue.mesh + + + + + + + + + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridge1Blue.mesh + + + + + + + + + + + + Models/Props/Bridges/SciFiBridge1Blue.mesh + + + + + + + + + + + + Models/Props/Pillars/SciFiBridgePillar1.mesh + + + + + + + + + + + + + + + Models/Props/Pillars/SciFiBridgePillar1.mesh + + + + + + + + + + + + + + + Models/Props/Pillars/SciFiBridgePillar1.mesh + + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridge1Blue.mesh + + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridge1Blue.mesh + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + + + + + + + + + + + + + + + Models/Props/SciFiHolder1.mesh + + + + + + + + + + + + + Models/Props/SciFiHolder1.mesh + + + + + + + + + + + + + Models/Props/SciFiHolder1.mesh + + + + + + + + + + + + + Models/Props/SciFiHolder1.mesh + + + + + + + + + + + + + + + + + + + + Models/Props/Flora/SpecialRoot.mesh + + + + + + + + + + + + + + Models/Props/Flora/SpecialRoot.mesh + + + + + + + + + + + + + Models/Props/Flora/SpecialRoot.mesh + + + + + + + + + + + + + + Models/Props/Flora/SpecialRoot.mesh + + + + + + + + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/BigWallBlue.mesh + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/BigWallBlue.mesh + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/BigWallBlue.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/BigWallBlue.mesh + + + + + + + + + + + + + + Models/Props/Walls/BigWallBlue.mesh + + + + + + + + + + + Models/Props/Walls/BigWallBlue.mesh + + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + + Models/Core/UnitPlane.mesh + + true + + + + + + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + + + + + + + + + + + + + + 6 + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + + 4 + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + + 6 + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + 6 + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + + 4 + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + + 6 + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + 4 + Models/Props/Pillars/SciFiPillar3Blue.mesh + + + + + + + + + + + + + + 6 + Models/Props/Pillars/SciFiPillar1Blue.mesh + + + + + + + + + + + + + 6 + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + 6 + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + + 6 + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + + 4 + Models/Props/Pillars/SciFiPillar3Blue.mesh + + + + + + + + + + + + + + + + + + + + + + 10 + + + + + + + + + + + 10 + + + + + + + + + + + 10 + + + + + + + + + + + + 10 + + + + + + + + + + + 1 + + + + + + + + + + + + 10 + + + + + + + + + + + 1 + + + + + + + + + + + + + + + + + Schema/Entities/PlayerAssaultRed.xml + + + + + + + + + + + Models/Characters/Assault/AssaultTPose.mesh + false + + + + + + + + + + + + Models/Characters/Assault/AssaultTPose.mesh + false + + + + + + + + + + + + Models/Characters/Assault/AssaultTPose.mesh + false + + + + + + + + + + + + Models/Characters/Assault/AssaultTPose.mesh + false + + + + + + + + + + + + + + + + + + + Models/Props/CapturePoint/CapturePointNeutral.mesh + + + + + + + + + + 3 + + + + + Models/Core/UnitCylinder.mesh + + true + + + + + + + + + + + + + + + Models/Props/CapturePoint/CapturePointNeutral.mesh + + + + + + + + + + 15 + 1 + + + + + + + + + Models/Core/UnitCylinder.mesh + + true + + + + + + + + + + + + + + + Models/Props/CapturePoint/CapturePointBlue.mesh + + + + + + + + + + -15 + + + + 4 + + + + + + + + + Models/Core/UnitCylinder.mesh + + true + + + + + + + + + + + + + + + Models/Props/CapturePoint/CapturePointNeutral.mesh + + + + + + + + + + 15 + 2 + + + + + + + + + Models/Core/UnitCylinder.mesh + + true + + + + + + + + + + + + + + + Models/Props/CapturePoint/CapturePointRed.mesh + + + + + + + + + + 15 + + + + + + + + + + + + Models/Core/UnitCylinder.mesh + + true + + + + + + + + + + + + + + + + + + + + + + Schema/Entities/PlayerAssaultBlue.xml + + + + + + + + + + + Models/Core/UnitCube.mesh + + + + + + + + + + + + Models/Core/UnitCube.mesh + + + + + + + + + + Models/Core/UnitCube.mesh + + + + + + + + + + + + Models/Core/UnitCube.mesh + + + + + + + + + + + + + + + + + + + + + + + + 0.10000000149011612 + + + + + + + + + + + 0.20000000298023224 + + + + + + + + + + + + + + + + + + + + + + + + + Schema/Entities/MainMenu.xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Textures/Core/White.png + true + + false + + + + Play + 1 + + + + + + + + + + + Play + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + + + + + + Textures/HUD/ButtonCorner_16.png + + + + + + + + + + + + + Textures/HUD/ButtonCorner_16.png + + + + + + + + + + + + + + + + + + + + + + + + + + Textures/Core/White.png + true + + false + + + + + + + + + + + + Credits + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + + + + + + Textures/HUD/ButtonCorner_16.png + + + + + + + + + + + + + Textures/HUD/ButtonCorner_16.png + + + + + + + + + + + + + + + + + + + + + + + + + + Textures/Core/White.png + true + + false + + + + + + + + + + + + Option + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + + + + + + Textures/HUD/ButtonCorner_16.png + + + + + + + + + + + + + Textures/HUD/ButtonCorner_16.png + + + + + + + + + + + + + + + + + + + + + + + + + + Textures/Core/White.png + true + + false + + + + + + + + + + + + Quit + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + + + + + + Textures/HUD/ButtonCorner_16.png + + + + + + + + + + + + + Textures/HUD/ButtonCorner_16.png + + + + + + + + + + + + + + + + + + + + + + + + + + + Schema/Entities/ServerList.xml + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/Shaders/FillDepthBuffer.vert.glsl b/resources/Shaders/FillDepthBuffer.vert.glsl index ff849790..e8f6838d 100644 --- a/resources/Shaders/FillDepthBuffer.vert.glsl +++ b/resources/Shaders/FillDepthBuffer.vert.glsl @@ -1,8 +1,6 @@ #version 430 -uniform mat4 M; -uniform mat4 V; -uniform mat4 P; +uniform mat4 PVM; layout(location = 0) in vec3 Position; layout(location = 5) in vec4 BoneIndices; @@ -15,7 +13,7 @@ out VertexData{ void main() { - gl_Position = P * V * M * vec4(Position, 1.0); + gl_Position = PVM * vec4(Position, 1.0); Output.Position = Position; } \ No newline at end of file diff --git a/resources/Shaders/FillDepthBufferSkinned.vert.glsl b/resources/Shaders/FillDepthBufferSkinned.vert.glsl index ce2a142d..a1ad5c14 100644 --- a/resources/Shaders/FillDepthBufferSkinned.vert.glsl +++ b/resources/Shaders/FillDepthBufferSkinned.vert.glsl @@ -1,8 +1,6 @@ #version 430 -uniform mat4 M; -uniform mat4 V; -uniform mat4 P; +uniform mat4 PVM; uniform mat4 Bones[100]; @@ -27,7 +25,7 @@ void main() + BoneWeights[3] * Bones[int(BoneIndices[3])]; } - gl_Position = P*V*M*boneTransform * vec4(Position, 1.0); + gl_Position = PVM*boneTransform * vec4(Position, 1.0); Output.Position = vec3(0.0); } \ No newline at end of file diff --git a/resources/Shaders/ForwardPlus.frag.glsl b/resources/Shaders/ForwardPlus.frag.glsl index 8f0f7deb..91d362c0 100644 --- a/resources/Shaders/ForwardPlus.frag.glsl +++ b/resources/Shaders/ForwardPlus.frag.glsl @@ -2,6 +2,7 @@ #define MIN_AMBIENT_LIGHT 0.3 +uniform mat4 VM; uniform mat4 M; uniform mat4 V; uniform mat4 P; @@ -11,7 +12,7 @@ uniform vec2 ScreenDimensions; uniform vec4 FillColor; uniform vec4 AmbientColor; uniform float FillPercentage; -uniform float GlowIntensity = 10; +uniform float GlowIntensity; uniform vec3 CameraPosition; uniform int SSAOQuality; @@ -131,7 +132,7 @@ void main() 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 position = VM * 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)); @@ -182,6 +183,7 @@ void main() color_result += FillColor; } sceneColor = vec4(color_result.xyz, clamp(color_result.a, 0, 1)); + //sceneColor = CommonUniforms.testColour; //sceneColor = vec4(reflectionColor.xyz, 1); color_result.xyz += glowTexel.xyz*GlowIntensity; diff --git a/resources/Shaders/ForwardPlus.vert.glsl b/resources/Shaders/ForwardPlus.vert.glsl index 26686222..ce251c00 100644 --- a/resources/Shaders/ForwardPlus.vert.glsl +++ b/resources/Shaders/ForwardPlus.vert.glsl @@ -1,5 +1,6 @@ #version 430 - +uniform mat4 PVM; +uniform mat4 TIM; uniform mat4 M; uniform mat4 V; uniform mat4 P; @@ -22,8 +23,8 @@ out VertexData{ void main() { - gl_Position = P*V*M * vec4(Position, 1.0); - mat4 TIM = transpose(inverse(M)); + gl_Position = PVM * vec4(Position, 1.0); + //mat4 TIM = transpose(inverse(M)); Output.Position = Position; Output.TextureCoordinate = TextureCoords; Output.Normal = vec3(TIM * vec4(Normal, 0.0)); diff --git a/resources/Shaders/ForwardPlusShieldCheck.frag.glsl b/resources/Shaders/ForwardPlusShieldCheck.frag.glsl index 5995facb..6fcbf881 100644 --- a/resources/Shaders/ForwardPlusShieldCheck.frag.glsl +++ b/resources/Shaders/ForwardPlusShieldCheck.frag.glsl @@ -2,6 +2,7 @@ #define MIN_AMBIENT_LIGHT 0.3 +uniform mat4 VM; uniform mat4 M; uniform mat4 V; uniform mat4 P; @@ -11,7 +12,7 @@ uniform vec2 ScreenDimensions; uniform vec4 FillColor; uniform vec4 AmbientColor; uniform float FillPercentage; -uniform float GlowIntensity = 10; +uniform float GlowIntensity; uniform vec3 CameraPosition; uniform int SSAOQuality; @@ -138,7 +139,7 @@ void main() 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 position = VM * 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)); diff --git a/resources/Shaders/ForwardPlusSkinned.vert.glsl b/resources/Shaders/ForwardPlusSkinned.vert.glsl index 5fd55a8c..0d959caa 100644 --- a/resources/Shaders/ForwardPlusSkinned.vert.glsl +++ b/resources/Shaders/ForwardPlusSkinned.vert.glsl @@ -1,5 +1,7 @@ #version 430 +uniform mat4 PVM; +uniform mat4 TIM; uniform mat4 M; uniform mat4 V; uniform mat4 P; @@ -34,7 +36,7 @@ void main() + BoneWeights[3] * Bones[int(BoneIndices[3])]; } - gl_Position = P*V*M*boneTransform * vec4(Position, 1.0); + gl_Position = PVM*boneTransform * vec4(Position, 1.0); Output.Position = (boneTransform * vec4(Position, 1.0)).xyz; Output.TextureCoordinate = TextureCoords; diff --git a/resources/Shaders/ForwardPlusSplatMapRGB.frag.glsl b/resources/Shaders/ForwardPlusSplatMapRGB.frag.glsl index c67a9c99..e0c73e70 100644 --- a/resources/Shaders/ForwardPlusSplatMapRGB.frag.glsl +++ b/resources/Shaders/ForwardPlusSplatMapRGB.frag.glsl @@ -2,6 +2,7 @@ #define MIN_AMBIENT_LIGHT 0.3 +uniform mat4 VM; uniform mat4 M; uniform mat4 V; uniform mat4 P; @@ -189,7 +190,7 @@ void main() GlowUVRepeat1, GlowUVRepeat2, GlowUVRepeat3); vec4 specularTexel = CalcBlendedTexel(splatTexel, SpecularMapTexture1, SpecularMapTexture2, SpecularMapTexture3, SpecularUVRepeat1, SpecularUVRepeat2, SpecularUVRepeat3); - vec4 position = V * M * vec4(Input.Position, 1.0); + vec4 position = VM * 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); diff --git a/resources/Shaders/ForwardPlusSplatMapRGBShieldCheck.frag.glsl b/resources/Shaders/ForwardPlusSplatMapRGBShieldCheck.frag.glsl index d61726fe..a26d85f5 100644 --- a/resources/Shaders/ForwardPlusSplatMapRGBShieldCheck.frag.glsl +++ b/resources/Shaders/ForwardPlusSplatMapRGBShieldCheck.frag.glsl @@ -2,6 +2,7 @@ #define MIN_AMBIENT_LIGHT 0.3 +uniform mat4 VM; uniform mat4 M; uniform mat4 V; uniform mat4 P; @@ -190,7 +191,7 @@ void main() GlowUVRepeat1, GlowUVRepeat2, GlowUVRepeat3); vec4 specularTexel = CalcBlendedTexel(splatTexel, SpecularMapTexture1, SpecularMapTexture2, SpecularMapTexture3, SpecularUVRepeat1, SpecularUVRepeat2, SpecularUVRepeat3); - vec4 position = V * M * vec4(Input.Position, 1.0); + vec4 position = VM * 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); diff --git a/resources/Shaders/Picking.vert.glsl b/resources/Shaders/Picking.vert.glsl index f888cd16..00013383 100644 --- a/resources/Shaders/Picking.vert.glsl +++ b/resources/Shaders/Picking.vert.glsl @@ -1,8 +1,5 @@ #version 430 - -uniform mat4 M; -uniform mat4 V; -uniform mat4 P; +uniform mat4 PVM; layout(location = 0) in vec3 Position; layout(location = 1) in vec3 Normal; @@ -16,6 +13,6 @@ out VertexData{ void main() { - gl_Position = P*V*M * vec4(Position, 1.0); + gl_Position = PVM * vec4(Position, 1.0); Output.Position = Position, 1.0; } \ No newline at end of file diff --git a/resources/Shaders/PickingSkinned.vert.glsl b/resources/Shaders/PickingSkinned.vert.glsl index 205a8fdd..4d72fa49 100644 --- a/resources/Shaders/PickingSkinned.vert.glsl +++ b/resources/Shaders/PickingSkinned.vert.glsl @@ -1,8 +1,5 @@ #version 430 - -uniform mat4 M; -uniform mat4 V; -uniform mat4 P; +uniform mat4 PVM; uniform mat4 Bones[100]; layout(location = 0) in vec3 Position; @@ -27,6 +24,6 @@ void main() + BoneWeights[3] * Bones[int(BoneIndices[3])]; } - gl_Position = P*V*M*boneTransform * vec4(Position, 1.0); + gl_Position = PVM*boneTransform * vec4(Position, 1.0); Output.Position = (boneTransform * vec4(Position, 1.0)).xyz; } \ No newline at end of file diff --git a/resources/Shaders/Sprite.frag.glsl b/resources/Shaders/Sprite.frag.glsl index 266398da..abad7df1 100644 --- a/resources/Shaders/Sprite.frag.glsl +++ b/resources/Shaders/Sprite.frag.glsl @@ -3,8 +3,6 @@ uniform vec4 Color; uniform vec4 FillColor; uniform float FillPercentage; -uniform mat4 M; -uniform mat4 V; uniform mat4 P; layout (binding = 1) uniform sampler2D DiffuseTexture; diff --git a/resources/Shaders/Sprite.vert.glsl b/resources/Shaders/Sprite.vert.glsl index c09d745b..82c4c9bb 100644 --- a/resources/Shaders/Sprite.vert.glsl +++ b/resources/Shaders/Sprite.vert.glsl @@ -1,8 +1,6 @@ #version 430 -uniform mat4 M; -uniform mat4 V; -uniform mat4 P; +uniform mat4 PVM; layout(location = 0) in vec3 Position; layout(location = 1) in vec3 Normal; @@ -17,7 +15,7 @@ out VertexData{ void main() { - gl_Position = P * V * M * vec4(Position, 1.0); + gl_Position = PVM* vec4(Position, 1.0); Output.Position = Position; Output.TextureCoordinate = TextureCoords; diff --git a/resources/Shaders/Util/CommonUniforms.glsl b/resources/Shaders/Util/CommonUniforms.glsl new file mode 100644 index 00000000..de6700ae --- /dev/null +++ b/resources/Shaders/Util/CommonUniforms.glsl @@ -0,0 +1,6 @@ +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); +} \ No newline at end of file diff --git a/src/Engine/Network/Client.cpp b/src/Engine/Network/Client.cpp index f1155c3b..b4eafbcb 100644 --- a/src/Engine/Network/Client.cpp +++ b/src/Engine/Network/Client.cpp @@ -35,6 +35,7 @@ void Client::Connect(std::string address, int port) EVENT_SUBSCRIBE_MEMBER(m_EDoubleJump, &Client::OnDoubleJump); EVENT_SUBSCRIBE_MEMBER(m_EDashAbility, &Client::OnDashAbility); EVENT_SUBSCRIBE_MEMBER(m_ESearchForServers, &Client::OnSearchForServers); + EVENT_SUBSCRIBE_MEMBER(m_EConnectRequest, &Client::OnConnectRequest); auto config = ResourceManager::Load("Config.ini"); m_Address = address; if (address.empty()) { @@ -180,8 +181,8 @@ void Client::parseTCPConnect(Packet& packet) Packet UnreliablePacket(MessageType::Connect, m_SendPacketID); // Add player id and other stuff packet.WritePrimitive(m_PlayerID); - // m_Unreliable.Send(packet); - // LOG_INFO("Sent UDP Connect Server"); + // m_Unreliable.Send(packet); + // LOG_INFO("Sent UDP Connect Server"); } void Client::parsePlayerConnected(Packet & packet) @@ -456,12 +457,14 @@ void Client::parseSnapshot(Packet& packet) void Client::disconnect() { + removeWorld(); m_IsConnected = false; m_PreviousPacketID = 0; m_PacketID = 0; Packet packet(MessageType::Disconnect, m_SendPacketID); m_Reliable.Send(packet); m_Reliable.Disconnect(); + createMainMenu(); } bool Client::OnInputCommand(const Events::InputCommand & e) @@ -472,7 +475,7 @@ bool Client::OnInputCommand(const Events::InputCommand & e) if (e.Command == "ConnectToServer") { // Connect for now if (e.Value > 0) { - m_Reliable.Connect(m_PlayerName, m_Address, m_Port); + //m_Reliable.Connect(m_PlayerName, m_Address, m_Port); // m_Unreliable.Connect(m_PlayerName, m_Address, m_Port); } //LOG_DEBUG("Client::OnInputCommand: Command is %s. Value is %f. PlayerID is %i.", e.Command.c_str(), e.Value, e.PlayerID); @@ -545,6 +548,23 @@ bool Client::OnDashAbility(const Events::DashAbility& e) return true; } + +bool Client::OnConnectRequest(const Events::ConnectRequest& e) +{ + removeWorld(); + if (m_Reliable.Connect(m_PlayerName, e.IP, e.Port)) { + // The client sent a successful connect message + return true; + + } else { + // The client could not send a successful connect message + createMainMenu(); + // Load the main menu again ? + return false; + } + return false; +} + bool Client::OnSearchForServers(const Events::SearchForServers& e) { m_SearchingForServers = true; @@ -671,6 +691,26 @@ void Client::displayServerlist() } } + +void Client::removeWorld() +{ + std::vector childrenToBeDeleted; + auto rootEntites = m_World->GetDirectChildren(EntityID_Invalid); + for (auto it = rootEntites.first; it != rootEntites.second; it++) { + childrenToBeDeleted.push_back(it->second); + } + for (int i = 0; i < childrenToBeDeleted.size(); ++i) { + m_World->DeleteEntity(childrenToBeDeleted[i]); + } +} + + +void Client::createMainMenu() +{ + auto entityFile = ResourceManager::Load("Schema/Entities/StartMenu.xml"); + entityFile->MergeInto(m_World); +} + bool Client::clientServerMapsHasEntity(EntityID clientEntityID) { if (m_ClientIDToServerID.find(clientEntityID) != m_ClientIDToServerID.end()) { diff --git a/src/Engine/Network/Server.cpp b/src/Engine/Network/Server.cpp index 94afcbe8..0dd761a0 100644 --- a/src/Engine/Network/Server.cpp +++ b/src/Engine/Network/Server.cpp @@ -7,6 +7,8 @@ Server::Server(World* world, EventBroker* eventBroker, int port) ConfigFile* config = ResourceManager::Load("Config.ini"); snapshotInterval = 1000 * config->Get("Networking.SnapshotInterval", 0.05f); pingIntervalMs = config->Get("Networking.PingIntervalMs", 1000); + m_ServerName = config->Get("Networking.Name", "Unnamed"); + // Subscribe to events EVENT_SUBSCRIBE_MEMBER(m_EInputCommand, &Server::OnInputCommand); EVENT_SUBSCRIBE_MEMBER(m_EPlayerSpawned, &Server::OnPlayerSpawned); @@ -410,7 +412,7 @@ void Server::parseServerlistRequest(boost::asio::ip::udp::endpoint endpoint) Packet packet(MessageType::ServerlistRequest); packet.WriteString(m_Reliable.Address()); packet.WritePrimitive(m_Reliable.Port()); - packet.WriteString("SERVERNAME"); + packet.WriteString(m_ServerName); packet.WritePrimitive(m_ConnectedPlayers.size()); m_ServerlistRequest.Send(packet); } diff --git a/src/Engine/Network/TCPClient.cpp b/src/Engine/Network/TCPClient.cpp index b3aa7d1b..df9c159a 100644 --- a/src/Engine/Network/TCPClient.cpp +++ b/src/Engine/Network/TCPClient.cpp @@ -10,7 +10,7 @@ TCPClient::~TCPClient() { } -void TCPClient::Connect(std::string playerName, std::string address, int port) +bool TCPClient::Connect(std::string playerName, std::string address, int port) { if (m_Socket) { if (m_IsConnected) { @@ -19,6 +19,7 @@ void TCPClient::Connect(std::string playerName, std::string address, int port) Send(packet); LOG_INFO("Connect message sent again!"); } + return true; } else if (!m_IsConnected) { boost::system::error_code error = boost::asio::error::host_not_found; @@ -34,11 +35,13 @@ void TCPClient::Connect(std::string playerName, std::string address, int port) packet.WriteString(playerName); Send(packet); LOG_INFO("Connect message sent!"); + return true; } // If error else { m_Socket->close(); m_Socket = nullptr; + return false; } } } diff --git a/src/Engine/Network/UDPClient.cpp b/src/Engine/Network/UDPClient.cpp index 1d71c155..15682000 100644 --- a/src/Engine/Network/UDPClient.cpp +++ b/src/Engine/Network/UDPClient.cpp @@ -10,14 +10,15 @@ UDPClient::~UDPClient() { } -void UDPClient::Connect(std::string playerName, std::string address, int port) +bool UDPClient::Connect(std::string playerName, std::string address, int port) { if (m_Socket) { - return; + return false; } m_ReceiverEndpoint = udp::endpoint(boost::asio::ip::address().from_string(address), port); m_Socket = boost::shared_ptr(new boost::asio::ip::udp::socket(m_IOService)); m_Socket->open(boost::asio::ip::udp::v4()); + return true; } void UDPClient::Disconnect() diff --git a/src/Engine/Rendering/BlurHUD.cpp b/src/Engine/Rendering/BlurHUD.cpp index 422b9ec4..8fdb7f1a 100644 --- a/src/Engine/Rendering/BlurHUD.cpp +++ b/src/Engine/Rendering/BlurHUD.cpp @@ -10,7 +10,7 @@ BlurHUD::BlurHUD(IRenderer* renderer) void BlurHUD::InitializeTextures() { - m_BlackTexture = CommonFunctions::LoadTexture("Textures/Core/Black.png", false); + m_BlackTexture = CommonFunctions::TryLoadResource("Textures/Core/Black.png"); m_ScreenQuad = ResourceManager::Load("Models/Core/ScreenQuad.mesh"); } diff --git a/src/Engine/Rendering/DrawBloomPass.cpp b/src/Engine/Rendering/DrawBloomPass.cpp index 73f73cc4..4172118c 100644 --- a/src/Engine/Rendering/DrawBloomPass.cpp +++ b/src/Engine/Rendering/DrawBloomPass.cpp @@ -9,9 +9,14 @@ DrawBloomPass::DrawBloomPass(IRenderer* renderer, ConfigFile* config) ChangeQuality(m_Config->Get("GLOW.Quality", 2)); } +DrawBloomPass::~DrawBloomPass() { + CommonFunctions::DeleteTexture(&m_GaussianTexture_horiz); + CommonFunctions::DeleteTexture(&m_GaussianTexture_vert); +} + void DrawBloomPass::InitializeTextures() { - m_BlackTexture = CommonFunctions::LoadTexture("Textures/Core/Black.png", false); + m_BlackTexture = CommonFunctions::TryLoadResource("Textures/Core/Black.png"); } void DrawBloomPass::ChangeQuality(int quality) diff --git a/src/Engine/Rendering/DrawFinalPass.cpp b/src/Engine/Rendering/DrawFinalPass.cpp index edde3ef5..82e78437 100644 --- a/src/Engine/Rendering/DrawFinalPass.cpp +++ b/src/Engine/Rendering/DrawFinalPass.cpp @@ -12,13 +12,21 @@ DrawFinalPass::DrawFinalPass(IRenderer* renderer, LightCullingPass* lightCulling InitializeFrameBuffers(); } +DrawFinalPass::~DrawFinalPass(){ + CommonFunctions::DeleteTexture(&m_BloomTexture); + CommonFunctions::DeleteTexture(&m_SceneTexture); + CommonFunctions::DeleteTexture(&m_DepthBuffer); + CommonFunctions::DeleteTexture(&m_ShieldBuffer); + CommonFunctions::DeleteTexture(&m_CubeMapTexture); +} + void DrawFinalPass::InitializeTextures() { - m_WhiteTexture = CommonFunctions::LoadTexture("Textures/Core/White.png", false); - m_BlackTexture = CommonFunctions::LoadTexture("Textures/Core/Black.png", false); - m_NeutralNormalTexture = CommonFunctions::LoadTexture("Textures/Core/NeutralNormalMap.png", false); - m_GreyTexture = CommonFunctions::LoadTexture("Textures/Core/Grey.png", false); - m_ErrorTexture = CommonFunctions::LoadTexture("Textures/Core/ErrorTexture.png", false); + m_WhiteTexture = CommonFunctions::TryLoadResource("Textures/Core/White.png"); + m_BlackTexture = CommonFunctions::TryLoadResource("Textures/Core/Black.png"); + m_NeutralNormalTexture = CommonFunctions::TryLoadResource("Textures/Core/NeutralNormalMap.png"); + m_GreyTexture = CommonFunctions::TryLoadResource("Textures/Core/Grey.png"); + m_ErrorTexture = CommonFunctions::TryLoadResource("Textures/Core/ErrorTexture.png"); } void DrawFinalPass::InitializeFrameBuffers() @@ -351,6 +359,8 @@ void DrawFinalPass::DrawModelRenderQueues(std::list>& GLuint explosionSkinnedHandle = m_ExplosionEffectSkinnedProgram->GetHandle(); GLuint explosionSplatMapSkinnedHandle = m_ExplosionEffectSplatMapSkinnedProgram->GetHandle(); GLuint forwardSplatMapSkinnedHandle = m_ForwardPlusSplatMapSkinnedProgram->GetHandle(); + GLuint lastShader = 0; + unsigned int lastModel = 0; glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 1, m_LightCullingPass->LightSSBO()); glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 2, m_LightCullingPass->LightGridSSBO()); @@ -367,9 +377,17 @@ void DrawFinalPass::DrawModelRenderQueues(std::list>& case RawModel::MaterialType::SingleTextures: { if (explosionEffectJob->Model->IsSkinned()) { - - m_ExplosionEffectSkinnedProgram->Bind(); - GLERROR("Bind ExplosionEffectSkinned program"); + if (lastShader != m_ExplosionEffectSkinnedProgram->GetHandle()) { + m_ExplosionEffectSkinnedProgram->Bind(); + lastShader = m_ExplosionEffectSkinnedProgram->GetHandle(); + GLERROR("Bind ExplosionEffectSkinned program"); + glUniform1i(glGetUniformLocation(explosionSkinnedHandle, "SSAOQuality"), m_SSAOPass->TextureQuality()); + glUniformMatrix4fv(glGetUniformLocation(explosionSkinnedHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix())); + glUniformMatrix4fv(glGetUniformLocation(explosionSkinnedHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix())); + glUniform2f(glGetUniformLocation(explosionSkinnedHandle, "ScreenDimensions"), m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height); + glUniform4fv(glGetUniformLocation(explosionSkinnedHandle, "AmbientColor"), 1, glm::value_ptr(scene.AmbientColor)); + GLERROR("Bind ExplosionEffectSkinned Uniforms"); + } //bind uniforms BindExplosionUniforms(explosionSkinnedHandle, explosionEffectJob, scene); //bind textures @@ -389,8 +407,17 @@ void DrawFinalPass::DrawModelRenderQueues(std::list>& } else { - m_ExplosionEffectProgram->Bind(); - GLERROR("Bind ExplosionEffect program"); + if (lastShader != m_ExplosionEffectProgram->GetHandle()) { + m_ExplosionEffectProgram->Bind(); + lastShader = m_ExplosionEffectProgram->GetHandle(); + GLERROR("Bind ExplosionEffect program"); + glUniform1i(glGetUniformLocation(explosionHandle, "SSAOQuality"), m_SSAOPass->TextureQuality()); + glUniformMatrix4fv(glGetUniformLocation(explosionHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix())); + glUniformMatrix4fv(glGetUniformLocation(explosionHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix())); + glUniform2f(glGetUniformLocation(explosionHandle, "ScreenDimensions"), m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height); + glUniform4fv(glGetUniformLocation(explosionHandle, "AmbientColor"), 1, glm::value_ptr(scene.AmbientColor)); + GLERROR("Bind ExplosionEffect Uniforms"); + } //bind uniforms BindExplosionUniforms(explosionHandle, explosionEffectJob, scene); //bind textures @@ -404,8 +431,17 @@ void DrawFinalPass::DrawModelRenderQueues(std::list>& case RawModel::MaterialType::SplatMapping: { if (explosionEffectJob->Model->IsSkinned()) { - m_ExplosionEffectSplatMapSkinnedProgram->Bind(); - GLERROR("Bind ExplosionEffectSplatMapSkinned program"); + if (lastShader != m_ExplosionEffectSplatMapSkinnedProgram->GetHandle()) { + m_ExplosionEffectSplatMapSkinnedProgram->Bind(); + lastShader = m_ExplosionEffectSplatMapSkinnedProgram->GetHandle(); + GLERROR("Bind ExplosionEffectSplatMapSkinned program"); + glUniform1i(glGetUniformLocation(explosionSplatMapSkinnedHandle, "SSAOQuality"), m_SSAOPass->TextureQuality()); + glUniformMatrix4fv(glGetUniformLocation(explosionSplatMapSkinnedHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix())); + glUniformMatrix4fv(glGetUniformLocation(explosionSplatMapSkinnedHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix())); + glUniform2f(glGetUniformLocation(explosionSplatMapSkinnedHandle, "ScreenDimensions"), m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height); + glUniform4fv(glGetUniformLocation(explosionSplatMapSkinnedHandle, "AmbientColor"), 1, glm::value_ptr(scene.AmbientColor)); + GLERROR("Bind ExplosionEffectSplatMapSkinned Uniforms"); + } //bind uniforms BindExplosionUniforms(explosionSplatMapSkinnedHandle, explosionEffectJob, scene); //bind textures @@ -421,9 +457,17 @@ void DrawFinalPass::DrawModelRenderQueues(std::list>& } else { - m_ExplosionEffectSplatMapProgram->Bind(); - GLERROR("Bind ExplosionEffectSplatMap program"); - //bind uniforms + if (lastShader != m_ExplosionEffectSplatMapProgram->GetHandle()) { + m_ExplosionEffectSplatMapProgram->Bind(); + lastShader = m_ExplosionEffectSplatMapProgram->GetHandle(); + GLERROR("Bind ExplosionEffectSplatMap program"); + glUniform1i(glGetUniformLocation(explosionSplatMapHandle, "SSAOQuality"), m_SSAOPass->TextureQuality()); + glUniformMatrix4fv(glGetUniformLocation(explosionSplatMapHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix())); + glUniformMatrix4fv(glGetUniformLocation(explosionSplatMapHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix())); + glUniform2f(glGetUniformLocation(explosionSplatMapHandle, "ScreenDimensions"), m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height); + glUniform4fv(glGetUniformLocation(explosionSplatMapHandle, "AmbientColor"), 1, glm::value_ptr(scene.AmbientColor)); + GLERROR("Bind ExplosionEffectSplatMap Uniforms"); + } //bind uniforms BindExplosionUniforms(explosionSplatMapHandle, explosionEffectJob, scene); //bind textures @@ -436,8 +480,11 @@ void DrawFinalPass::DrawModelRenderQueues(std::list>& glDisable(GL_CULL_FACE); //draw - glBindVertexArray(explosionEffectJob->Model->VAO); - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, explosionEffectJob->Model->ElementBuffer); + if (lastModel != explosionEffectJob->ModelID) { + glBindVertexArray(explosionEffectJob->Model->VAO); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, explosionEffectJob->Model->ElementBuffer); + lastModel = explosionEffectJob->ModelID; + } glDrawElements(GL_TRIANGLES, explosionEffectJob->EndIndex - explosionEffectJob->StartIndex + 1, GL_UNSIGNED_INT, (void*)(explosionEffectJob->StartIndex*sizeof(unsigned int))); glEnable(GL_CULL_FACE); GLERROR("explosion effect end"); @@ -451,8 +498,17 @@ void DrawFinalPass::DrawModelRenderQueues(std::list>& case RawModel::MaterialType::SingleTextures: { if (modelJob->Model->IsSkinned()) { - m_ForwardPlusSkinnedProgram->Bind(); - GLERROR("Bind ForwardPlusSkinnedProgram"); + if (lastShader != m_ForwardPlusSkinnedProgram->GetHandle()) { + m_ForwardPlusSkinnedProgram->Bind(); + lastShader = m_ForwardPlusSkinnedProgram->GetHandle(); + GLERROR("Bind ForwardPlusSkinnedProgram program"); + glUniform1i(glGetUniformLocation(forwardSkinnedHandle, "SSAOQuality"), m_SSAOPass->TextureQuality()); + glUniformMatrix4fv(glGetUniformLocation(forwardSkinnedHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix())); + glUniformMatrix4fv(glGetUniformLocation(forwardSkinnedHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix())); + glUniform2f(glGetUniformLocation(forwardSkinnedHandle, "ScreenDimensions"), m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height); + glUniform4fv(glGetUniformLocation(forwardSkinnedHandle, "AmbientColor"), 1, glm::value_ptr(scene.AmbientColor)); + GLERROR("Bind ForwardPlusSkinnedProgram Uniforms"); + } //bind uniforms BindModelUniforms(forwardSkinnedHandle, modelJob, scene); //bind textures @@ -470,8 +526,17 @@ void DrawFinalPass::DrawModelRenderQueues(std::list>& glUniformMatrix4fv(glGetUniformLocation(forwardSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); } else { - m_ForwardPlusProgram->Bind(); - GLERROR("Bind ForwardPlusProgram"); + if (lastShader != m_ForwardPlusProgram->GetHandle()) { + m_ForwardPlusProgram->Bind(); + lastShader = m_ForwardPlusProgram->GetHandle(); + GLERROR("Bind ForwardPlusProgram program"); + glUniform1i(glGetUniformLocation(forwardHandle, "SSAOQuality"), m_SSAOPass->TextureQuality()); + glUniformMatrix4fv(glGetUniformLocation(forwardHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix())); + glUniformMatrix4fv(glGetUniformLocation(forwardHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix())); + glUniform2f(glGetUniformLocation(forwardHandle, "ScreenDimensions"), m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height); + glUniform4fv(glGetUniformLocation(forwardHandle, "AmbientColor"), 1, glm::value_ptr(scene.AmbientColor)); + GLERROR("Bind ForwardPlusProgram Uniforms"); + } //bind uniforms BindModelUniforms(forwardHandle, modelJob, scene); //bind textures @@ -485,8 +550,17 @@ void DrawFinalPass::DrawModelRenderQueues(std::list>& case RawModel::MaterialType::SplatMapping: { if (modelJob->Model->IsSkinned()) { - m_ForwardPlusSplatMapSkinnedProgram->Bind(); - GLERROR("Bind SplatMap program"); + if (lastShader != m_ForwardPlusSplatMapSkinnedProgram->GetHandle()) { + m_ForwardPlusSplatMapSkinnedProgram->Bind(); + lastShader = m_ForwardPlusSplatMapSkinnedProgram->GetHandle(); + GLERROR("Bind SkinnedSplatMapProgram program"); + glUniform1i(glGetUniformLocation(forwardSplatMapSkinnedHandle, "SSAOQuality"), m_SSAOPass->TextureQuality()); + glUniformMatrix4fv(glGetUniformLocation(forwardSplatMapSkinnedHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix())); + glUniformMatrix4fv(glGetUniformLocation(forwardSplatMapSkinnedHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix())); + glUniform2f(glGetUniformLocation(forwardSplatMapSkinnedHandle, "ScreenDimensions"), m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height); + glUniform4fv(glGetUniformLocation(forwardSplatMapSkinnedHandle, "AmbientColor"), 1, glm::value_ptr(scene.AmbientColor)); + GLERROR("Bind SkinnedSplatMapProgram Uniforms"); + } //bind uniforms BindModelUniforms(forwardSplatMapSkinnedHandle, modelJob, scene); //bind textures @@ -502,8 +576,17 @@ void DrawFinalPass::DrawModelRenderQueues(std::list>& } else { - m_ForwardPlusSplatMapProgram->Bind(); - GLERROR("Bind SplatMap program"); + if (lastShader != m_ForwardPlusSplatMapProgram->GetHandle()) { + m_ForwardPlusSplatMapProgram->Bind(); + lastShader = m_ForwardPlusSplatMapProgram->GetHandle(); + GLERROR("Bind SplatMap program"); + glUniform1i(glGetUniformLocation(forwardSplatMapHandle, "SSAOQuality"), m_SSAOPass->TextureQuality()); + glUniformMatrix4fv(glGetUniformLocation(forwardSplatMapHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix())); + glUniformMatrix4fv(glGetUniformLocation(forwardSplatMapHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix())); + glUniform2f(glGetUniformLocation(forwardSplatMapHandle, "ScreenDimensions"), m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height); + glUniform4fv(glGetUniformLocation(forwardSplatMapHandle, "AmbientColor"), 1, glm::value_ptr(scene.AmbientColor)); + GLERROR("Bind SplatMap Uniforms"); + } //bind uniforms BindModelUniforms(forwardSplatMapHandle, modelJob, scene); //bind textures @@ -514,8 +597,11 @@ void DrawFinalPass::DrawModelRenderQueues(std::list>& } } //draw - glBindVertexArray(modelJob->Model->VAO); - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, modelJob->Model->ElementBuffer); + if (lastModel != modelJob->ModelID) { + glBindVertexArray(modelJob->Model->VAO); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, modelJob->Model->ElementBuffer); + lastModel = modelJob->ModelID; + } glDrawElements(GL_TRIANGLES, modelJob->EndIndex - modelJob->StartIndex + 1, GL_UNSIGNED_INT, (void*)(modelJob->StartIndex*sizeof(unsigned int))); if (GLERROR("models end")) { continue; @@ -544,6 +630,8 @@ void DrawFinalPass::DrawModelRenderQueuesWithShieldCheck(std::listGetHandle(); GLuint explosionSplatMapSkinnedShieldCheckHandle = m_ExplosionEffectSplatMapSkinnedShieldCheckProgram->GetHandle(); GLuint forwardSplatMapSkinnedShieldCheckHandle = m_ForwardPlusSplatMapSkinnedShieldCheckProgram->GetHandle(); + GLuint lastShader = 0; + unsigned int lastModel = 0; glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 1, m_LightCullingPass->LightSSBO()); glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 2, m_LightCullingPass->LightGridSSBO()); @@ -564,9 +652,17 @@ void DrawFinalPass::DrawModelRenderQueuesWithShieldCheck(std::listModel->IsSkinned()) { - - m_ExplosionEffectSkinnedShieldCheckProgram->Bind(); - GLERROR("Bind ExplosionEffectSkinned program"); + if (lastShader != m_ExplosionEffectSkinnedShieldCheckProgram->GetHandle()) { + m_ExplosionEffectSkinnedShieldCheckProgram->Bind(); + lastShader = m_ExplosionEffectSkinnedShieldCheckProgram->GetHandle(); + GLERROR("Bind ExplosionEffectSkinned program"); + glUniform1i(glGetUniformLocation(explosionSkinnedShieldCheckHandle, "SSAOQuality"), m_SSAOPass->TextureQuality()); + glUniformMatrix4fv(glGetUniformLocation(explosionSkinnedShieldCheckHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix())); + glUniformMatrix4fv(glGetUniformLocation(explosionSkinnedShieldCheckHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix())); + glUniform2f(glGetUniformLocation(explosionSkinnedShieldCheckHandle, "ScreenDimensions"), m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height); + glUniform4fv(glGetUniformLocation(explosionSkinnedShieldCheckHandle, "AmbientColor"), 1, glm::value_ptr(scene.AmbientColor)); + GLERROR("Bind ExplosionEffectSkinned Uniforms"); + } //bind uniforms BindExplosionUniforms(explosionSkinnedShieldCheckHandle, explosionEffectJob, scene); //bind textures @@ -585,8 +681,17 @@ void DrawFinalPass::DrawModelRenderQueuesWithShieldCheck(std::listBind(); - GLERROR("Bind ExplosionEffect program"); + if (lastShader != m_ExplosionEffectShieldCheckProgram->GetHandle()) { + m_ExplosionEffectShieldCheckProgram->Bind(); + lastShader = m_ExplosionEffectShieldCheckProgram->GetHandle(); + GLERROR("Bind ExplosionEffect program"); + glUniform1i(glGetUniformLocation(explosionShieldCheckHandle, "SSAOQuality"), m_SSAOPass->TextureQuality()); + glUniformMatrix4fv(glGetUniformLocation(explosionShieldCheckHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix())); + glUniformMatrix4fv(glGetUniformLocation(explosionShieldCheckHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix())); + glUniform2f(glGetUniformLocation(explosionShieldCheckHandle, "ScreenDimensions"), m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height); + glUniform4fv(glGetUniformLocation(explosionShieldCheckHandle, "AmbientColor"), 1, glm::value_ptr(scene.AmbientColor)); + GLERROR("Bind ExplosionEffect Uniforms"); + } //bind uniforms BindExplosionUniforms(explosionShieldCheckHandle, explosionEffectJob, scene); //bind textures @@ -601,8 +706,17 @@ void DrawFinalPass::DrawModelRenderQueuesWithShieldCheck(std::listModel->IsSkinned()) { - m_ExplosionEffectSplatMapSkinnedShieldCheckProgram->Bind(); - GLERROR("Bind ExplosionEffectSplatMapSkinned program"); + if (lastShader != m_ExplosionEffectSplatMapSkinnedShieldCheckProgram->GetHandle()) { + m_ExplosionEffectSplatMapSkinnedShieldCheckProgram->Bind(); + lastShader = m_ExplosionEffectSplatMapSkinnedShieldCheckProgram->GetHandle(); + GLERROR("Bind ExplosionEffectSplatMapSkinned program"); + glUniform1i(glGetUniformLocation(explosionSplatMapSkinnedShieldCheckHandle, "SSAOQuality"), m_SSAOPass->TextureQuality()); + glUniformMatrix4fv(glGetUniformLocation(explosionSplatMapSkinnedShieldCheckHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix())); + glUniformMatrix4fv(glGetUniformLocation(explosionSplatMapSkinnedShieldCheckHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix())); + glUniform2f(glGetUniformLocation(explosionSplatMapSkinnedShieldCheckHandle, "ScreenDimensions"), m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height); + glUniform4fv(glGetUniformLocation(explosionSplatMapSkinnedShieldCheckHandle, "AmbientColor"), 1, glm::value_ptr(scene.AmbientColor)); + GLERROR("Bind ExplosionEffectSplatMapSkinned Uniforms"); + } //bind uniforms BindExplosionUniforms(explosionSplatMapSkinnedShieldCheckHandle, explosionEffectJob, scene); //bind textures @@ -619,9 +733,17 @@ void DrawFinalPass::DrawModelRenderQueuesWithShieldCheck(std::listBind(); - GLERROR("Bind ExplosionEffectSplatMap program"); - //bind uniforms + if (lastShader != m_ExplosionEffectSplatMapShieldCheckProgram->GetHandle()) { + m_ExplosionEffectSplatMapShieldCheckProgram->Bind(); + lastShader = m_ExplosionEffectSplatMapShieldCheckProgram->GetHandle(); + GLERROR("Bind ExplosionEffectSplatMap program"); + glUniform1i(glGetUniformLocation(explosionSplatMapShieldCheckHandle, "SSAOQuality"), m_SSAOPass->TextureQuality()); + glUniformMatrix4fv(glGetUniformLocation(explosionSplatMapShieldCheckHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix())); + glUniformMatrix4fv(glGetUniformLocation(explosionSplatMapShieldCheckHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix())); + glUniform2f(glGetUniformLocation(explosionSplatMapShieldCheckHandle, "ScreenDimensions"), m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height); + glUniform4fv(glGetUniformLocation(explosionSplatMapShieldCheckHandle, "AmbientColor"), 1, glm::value_ptr(scene.AmbientColor)); + GLERROR("Bind ExplosionEffectSplatMap Uniforms"); + } //bind uniforms BindExplosionUniforms(explosionSplatMapShieldCheckHandle, explosionEffectJob, scene); //bind textures @@ -637,9 +759,17 @@ void DrawFinalPass::DrawModelRenderQueuesWithShieldCheck(std::listModel->IsSkinned()) { - - m_ExplosionEffectSkinnedProgram->Bind(); - GLERROR("Bind ExplosionEffectSkinned program"); + if (lastShader != m_ExplosionEffectSkinnedProgram->GetHandle()) { + m_ExplosionEffectSkinnedProgram->Bind(); + lastShader = m_ExplosionEffectSkinnedProgram->GetHandle(); + GLERROR("Bind ExplosionEffectSkinned program"); + glUniform1i(glGetUniformLocation(explosionSkinnedHandle, "SSAOQuality"), m_SSAOPass->TextureQuality()); + glUniformMatrix4fv(glGetUniformLocation(explosionSkinnedHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix())); + glUniformMatrix4fv(glGetUniformLocation(explosionSkinnedHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix())); + glUniform2f(glGetUniformLocation(explosionSkinnedHandle, "ScreenDimensions"), m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height); + glUniform4fv(glGetUniformLocation(explosionSkinnedHandle, "AmbientColor"), 1, glm::value_ptr(scene.AmbientColor)); + GLERROR("Bind ExplosionEffectSkinned Uniforms"); + } //bind uniforms BindExplosionUniforms(explosionSkinnedHandle, explosionEffectJob, scene); //bind textures @@ -657,8 +787,17 @@ void DrawFinalPass::DrawModelRenderQueuesWithShieldCheck(std::listBind(); - GLERROR("Bind ExplosionEffect program"); + if (lastShader != m_ExplosionEffectProgram->GetHandle()) { + m_ExplosionEffectProgram->Bind(); + lastShader = m_ExplosionEffectProgram->GetHandle(); + GLERROR("Bind ExplosionEffect program"); + glUniform1i(glGetUniformLocation(explosionHandle, "SSAOQuality"), m_SSAOPass->TextureQuality()); + glUniformMatrix4fv(glGetUniformLocation(explosionHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix())); + glUniformMatrix4fv(glGetUniformLocation(explosionHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix())); + glUniform2f(glGetUniformLocation(explosionHandle, "ScreenDimensions"), m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height); + glUniform4fv(glGetUniformLocation(explosionHandle, "AmbientColor"), 1, glm::value_ptr(scene.AmbientColor)); + GLERROR("Bind ExplosionEffect Uniforms"); + } //bind uniforms BindExplosionUniforms(explosionHandle, explosionEffectJob, scene); //bind textures @@ -672,8 +811,17 @@ void DrawFinalPass::DrawModelRenderQueuesWithShieldCheck(std::listModel->IsSkinned()) { - m_ExplosionEffectSplatMapSkinnedProgram->Bind(); - GLERROR("Bind ExplosionEffectSplatMapSkinned program"); + if (lastShader != m_ExplosionEffectSplatMapSkinnedProgram->GetHandle()) { + m_ExplosionEffectSplatMapSkinnedProgram->Bind(); + lastShader = m_ExplosionEffectSplatMapSkinnedProgram->GetHandle(); + GLERROR("Bind ExplosionEffectSkinnedSplatMap program"); + glUniform1i(glGetUniformLocation(explosionSplatMapSkinnedHandle, "SSAOQuality"), m_SSAOPass->TextureQuality()); + glUniformMatrix4fv(glGetUniformLocation(explosionSplatMapSkinnedHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix())); + glUniformMatrix4fv(glGetUniformLocation(explosionSplatMapSkinnedHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix())); + glUniform2f(glGetUniformLocation(explosionSplatMapSkinnedHandle, "ScreenDimensions"), m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height); + glUniform4fv(glGetUniformLocation(explosionSplatMapSkinnedHandle, "AmbientColor"), 1, glm::value_ptr(scene.AmbientColor)); + GLERROR("Bind ExplosionEffectSkinnedSplatMap Uniforms"); + } //bind uniforms BindExplosionUniforms(explosionSplatMapSkinnedHandle, explosionEffectJob, scene); //bind textures @@ -689,9 +837,17 @@ void DrawFinalPass::DrawModelRenderQueuesWithShieldCheck(std::listBind(); - GLERROR("Bind ExplosionEffectSplatMap program"); - //bind uniforms + if (lastShader != m_ExplosionEffectSplatMapProgram->GetHandle()) { + m_ExplosionEffectSplatMapProgram->Bind(); + lastShader = m_ExplosionEffectSplatMapProgram->GetHandle(); + GLERROR("Bind ExplosionEffectSplatMap program"); + glUniform1i(glGetUniformLocation(explosionSplatMapHandle, "SSAOQuality"), m_SSAOPass->TextureQuality()); + glUniformMatrix4fv(glGetUniformLocation(explosionSplatMapHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix())); + glUniformMatrix4fv(glGetUniformLocation(explosionSplatMapHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix())); + glUniform2f(glGetUniformLocation(explosionSplatMapHandle, "ScreenDimensions"), m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height); + glUniform4fv(glGetUniformLocation(explosionSplatMapHandle, "AmbientColor"), 1, glm::value_ptr(scene.AmbientColor)); + GLERROR("Bind ExplosionEffectSplatMap Uniforms"); + } //bind uniforms BindExplosionUniforms(explosionSplatMapHandle, explosionEffectJob, scene); //bind textures @@ -705,8 +861,11 @@ void DrawFinalPass::DrawModelRenderQueuesWithShieldCheck(std::listModel->VAO); - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, explosionEffectJob->Model->ElementBuffer); + if (lastModel != explosionEffectJob->ModelID) { + glBindVertexArray(explosionEffectJob->Model->VAO); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, explosionEffectJob->Model->ElementBuffer); + lastModel = explosionEffectJob->ModelID; + } glDrawElements(GL_TRIANGLES, explosionEffectJob->EndIndex - explosionEffectJob->StartIndex + 1, GL_UNSIGNED_INT, (void*)(explosionEffectJob->StartIndex*sizeof(unsigned int))); glEnable(GL_CULL_FACE); GLERROR("explosion effect end"); @@ -721,8 +880,17 @@ void DrawFinalPass::DrawModelRenderQueuesWithShieldCheck(std::listModel->IsSkinned()) { - m_ForwardPlusSkinnedShieldCheckProgram->Bind(); - GLERROR("Bind ForwardPlusSkinnedProgram"); + if (lastShader != m_ForwardPlusSkinnedShieldCheckProgram->GetHandle()) { + m_ForwardPlusSkinnedShieldCheckProgram->Bind(); + lastShader = m_ForwardPlusSkinnedShieldCheckProgram->GetHandle(); + GLERROR("Bind ForwardPlusSkinnedProgram program"); + glUniform1i(glGetUniformLocation(forwardSkinnedShieldCheckHandle, "SSAOQuality"), m_SSAOPass->TextureQuality()); + glUniformMatrix4fv(glGetUniformLocation(forwardSkinnedShieldCheckHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix())); + glUniformMatrix4fv(glGetUniformLocation(forwardSkinnedShieldCheckHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix())); + glUniform2f(glGetUniformLocation(forwardSkinnedShieldCheckHandle, "ScreenDimensions"), m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height); + glUniform4fv(glGetUniformLocation(forwardSkinnedShieldCheckHandle, "AmbientColor"), 1, glm::value_ptr(scene.AmbientColor)); + GLERROR("Bind ForwardPlusSkinnedProgram Uniforms"); + } //bind uniforms BindModelUniforms(forwardSkinnedShieldCheckHandle, modelJob, scene); //bind textures @@ -741,8 +909,17 @@ void DrawFinalPass::DrawModelRenderQueuesWithShieldCheck(std::listBind(); - GLERROR("Bind ForwardPlusProgram"); + if (lastShader != m_ForwardPlusShieldCheckProgram->GetHandle()) { + m_ForwardPlusShieldCheckProgram->Bind(); + lastShader = m_ForwardPlusShieldCheckProgram->GetHandle(); + GLERROR("Bind ForwardPlusProgram program"); + glUniform1i(glGetUniformLocation(forwardShieldCheckHandle, "SSAOQuality"), m_SSAOPass->TextureQuality()); + glUniformMatrix4fv(glGetUniformLocation(forwardShieldCheckHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix())); + glUniformMatrix4fv(glGetUniformLocation(forwardShieldCheckHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix())); + glUniform2f(glGetUniformLocation(forwardShieldCheckHandle, "ScreenDimensions"), m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height); + glUniform4fv(glGetUniformLocation(forwardShieldCheckHandle, "AmbientColor"), 1, glm::value_ptr(scene.AmbientColor)); + GLERROR("Bind ForwardPlusProgram Uniforms"); + } //bind uniforms BindModelUniforms(forwardShieldCheckHandle, modelJob, scene); //bind textures @@ -756,8 +933,17 @@ void DrawFinalPass::DrawModelRenderQueuesWithShieldCheck(std::listModel->IsSkinned()) { - m_ForwardPlusSplatMapSkinnedShieldCheckProgram->Bind(); - GLERROR("Bind SplatMap program"); + if (lastShader != m_ForwardPlusSplatMapSkinnedShieldCheckProgram->GetHandle()) { + m_ForwardPlusSplatMapSkinnedShieldCheckProgram->Bind(); + lastShader = m_ForwardPlusSplatMapSkinnedShieldCheckProgram->GetHandle(); + GLERROR("Bind ForwardPlusProgramSplatMapSkinned program"); + glUniform1i(glGetUniformLocation(forwardSplatMapSkinnedShieldCheckHandle, "SSAOQuality"), m_SSAOPass->TextureQuality()); + glUniformMatrix4fv(glGetUniformLocation(forwardSplatMapSkinnedShieldCheckHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix())); + glUniformMatrix4fv(glGetUniformLocation(forwardSplatMapSkinnedShieldCheckHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix())); + glUniform2f(glGetUniformLocation(forwardSplatMapSkinnedShieldCheckHandle, "ScreenDimensions"), m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height); + glUniform4fv(glGetUniformLocation(forwardSplatMapSkinnedShieldCheckHandle, "AmbientColor"), 1, glm::value_ptr(scene.AmbientColor)); + GLERROR("Bind ForwardPlusProgramSplatMapSkinned Uniforms"); + } //bind uniforms BindModelUniforms(forwardSplatMapSkinnedShieldCheckHandle, modelJob, scene); //bind textures @@ -773,8 +959,17 @@ void DrawFinalPass::DrawModelRenderQueuesWithShieldCheck(std::listBind(); - GLERROR("Bind SplatMap program"); + if (lastShader != m_ForwardPlusSplatMapShieldCheckProgram->GetHandle()) { + m_ForwardPlusSplatMapShieldCheckProgram->Bind(); + lastShader = m_ForwardPlusSplatMapShieldCheckProgram->GetHandle(); + GLERROR("Bind SplatMap program"); + glUniform1i(glGetUniformLocation(forwardSplatShieldCheckHandle, "SSAOQuality"), m_SSAOPass->TextureQuality()); + glUniformMatrix4fv(glGetUniformLocation(forwardSplatShieldCheckHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix())); + glUniformMatrix4fv(glGetUniformLocation(forwardSplatShieldCheckHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix())); + glUniform2f(glGetUniformLocation(forwardSplatShieldCheckHandle, "ScreenDimensions"), m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height); + glUniform4fv(glGetUniformLocation(forwardSplatShieldCheckHandle, "AmbientColor"), 1, glm::value_ptr(scene.AmbientColor)); + GLERROR("Bind SplatMap Uniforms"); + } //bind uniforms BindModelUniforms(forwardSplatShieldCheckHandle, modelJob, scene); //bind textures @@ -790,8 +985,17 @@ void DrawFinalPass::DrawModelRenderQueuesWithShieldCheck(std::listModel->IsSkinned()) { - m_ForwardPlusSkinnedProgram->Bind(); - GLERROR("Bind ForwardPlusSkinnedProgram"); + if (lastShader != m_ForwardPlusSkinnedProgram->GetHandle()) { + m_ForwardPlusSkinnedProgram->Bind(); + lastShader = m_ForwardPlusSkinnedProgram->GetHandle(); + GLERROR("Bind ForwardPlusSkinnedProgram program"); + glUniform1i(glGetUniformLocation(forwardSkinnedHandle, "SSAOQuality"), m_SSAOPass->TextureQuality()); + glUniformMatrix4fv(glGetUniformLocation(forwardSkinnedHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix())); + glUniformMatrix4fv(glGetUniformLocation(forwardSkinnedHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix())); + glUniform2f(glGetUniformLocation(forwardSkinnedHandle, "ScreenDimensions"), m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height); + glUniform4fv(glGetUniformLocation(forwardSkinnedHandle, "AmbientColor"), 1, glm::value_ptr(scene.AmbientColor)); + GLERROR("Bind ForwardPlusSkinnedProgram Uniforms"); + } //bind uniforms BindModelUniforms(forwardSkinnedHandle, modelJob, scene); //bind textures @@ -810,8 +1014,17 @@ void DrawFinalPass::DrawModelRenderQueuesWithShieldCheck(std::listBind(); - GLERROR("Bind ForwardPlusProgram"); + if (lastShader != m_ForwardPlusProgram->GetHandle()) { + m_ForwardPlusProgram->Bind(); + lastShader = m_ForwardPlusProgram->GetHandle(); + GLERROR("Bind ForwardPlusProgram program"); + glUniform1i(glGetUniformLocation(forwardHandle, "SSAOQuality"), m_SSAOPass->TextureQuality()); + glUniformMatrix4fv(glGetUniformLocation(forwardHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix())); + glUniformMatrix4fv(glGetUniformLocation(forwardHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix())); + glUniform2f(glGetUniformLocation(forwardHandle, "ScreenDimensions"), m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height); + glUniform4fv(glGetUniformLocation(forwardHandle, "AmbientColor"), 1, glm::value_ptr(scene.AmbientColor)); + GLERROR("Bind ForwardPlusProgram Uniforms"); + } //bind uniforms BindModelUniforms(forwardHandle, modelJob, scene); //bind textures @@ -825,8 +1038,17 @@ void DrawFinalPass::DrawModelRenderQueuesWithShieldCheck(std::listModel->IsSkinned()) { - m_ForwardPlusSplatMapSkinnedProgram->Bind(); - GLERROR("Bind SplatMap program"); + if (lastShader != m_ForwardPlusSplatMapSkinnedProgram->GetHandle()) { + m_ForwardPlusSplatMapSkinnedProgram->Bind(); + lastShader = m_ForwardPlusSplatMapSkinnedProgram->GetHandle(); + GLERROR("Bind SplatMap program"); + glUniform1i(glGetUniformLocation(forwardSplatMapSkinnedHandle, "SSAOQuality"), m_SSAOPass->TextureQuality()); + glUniformMatrix4fv(glGetUniformLocation(forwardSplatMapSkinnedHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix())); + glUniformMatrix4fv(glGetUniformLocation(forwardSplatMapSkinnedHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix())); + glUniform2f(glGetUniformLocation(forwardSplatMapSkinnedHandle, "ScreenDimensions"), m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height); + glUniform4fv(glGetUniformLocation(forwardSplatMapSkinnedHandle, "AmbientColor"), 1, glm::value_ptr(scene.AmbientColor)); + GLERROR("Bind SplatMap Uniforms"); + } //bind uniforms BindModelUniforms(forwardSplatMapSkinnedHandle, modelJob, scene); //bind textures @@ -842,8 +1064,17 @@ void DrawFinalPass::DrawModelRenderQueuesWithShieldCheck(std::listBind(); - GLERROR("Bind SplatMap program"); + if (lastShader != m_ForwardPlusSplatMapProgram->GetHandle()) { + m_ForwardPlusSplatMapProgram->Bind(); + lastShader = m_ForwardPlusSplatMapProgram->GetHandle(); + GLERROR("Bind SplatMap program"); + glUniform1i(glGetUniformLocation(forwardSplatMapHandle, "SSAOQuality"), m_SSAOPass->TextureQuality()); + glUniformMatrix4fv(glGetUniformLocation(forwardSplatMapHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix())); + glUniformMatrix4fv(glGetUniformLocation(forwardSplatMapHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix())); + glUniform2f(glGetUniformLocation(forwardSplatMapHandle, "ScreenDimensions"), m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height); + glUniform4fv(glGetUniformLocation(forwardSplatMapHandle, "AmbientColor"), 1, glm::value_ptr(scene.AmbientColor)); + GLERROR("Bind SplatMap Uniforms"); + } //bind uniforms BindModelUniforms(forwardSplatMapHandle, modelJob, scene); //bind textures @@ -855,8 +1086,11 @@ void DrawFinalPass::DrawModelRenderQueuesWithShieldCheck(std::listModel->VAO); - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, modelJob->Model->ElementBuffer); + if (lastModel != modelJob->ModelID) { + glBindVertexArray(modelJob->Model->VAO); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, modelJob->Model->ElementBuffer); + lastModel = modelJob->ModelID; + } glDrawElements(GL_TRIANGLES, modelJob->EndIndex - modelJob->StartIndex + 1, GL_UNSIGNED_INT, (void*)(modelJob->StartIndex*sizeof(unsigned int))); if (GLERROR("models end")) { continue; @@ -961,17 +1195,26 @@ void DrawFinalPass::DrawShieldedModelRenderQueue(std::list>& jobs, RenderScene& scene) { - - + GLuint shaderSkinnedHandle = m_FillDepthStencilBufferSkinnedProgram->GetHandle(); + GLuint shaderHandle = m_FillDepthStencilBufferProgram->GetHandle(); + GLuint lastShader = 0; for (auto &job : jobs) { auto modelJob = std::dynamic_pointer_cast(job); if(modelJob->Model->IsSkinned()) { - m_FillDepthStencilBufferSkinnedProgram->Bind(); - GLuint shaderHandle = m_FillDepthStencilBufferSkinnedProgram->GetHandle(); - glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix())); - glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix())); - glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix)); + if (lastShader != m_FillDepthStencilBufferSkinnedProgram->GetHandle()) { + m_FillDepthStencilBufferSkinnedProgram->Bind(); + lastShader = m_FillDepthStencilBufferSkinnedProgram->GetHandle(); + glUniform1i(glGetUniformLocation(shaderSkinnedHandle, "SSAOQuality"), m_SSAOPass->TextureQuality()); + glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix())); + glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix())); + glUniform2f(glGetUniformLocation(shaderSkinnedHandle, "ScreenDimensions"), m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height); + glUniform4fv(glGetUniformLocation(shaderSkinnedHandle, "AmbientColor"), 1, glm::value_ptr(scene.AmbientColor)); + GLERROR("Bind Uniforms 1"); + } + + glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "PVM"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix() * scene.Camera->ViewMatrix() * modelJob->Matrix)); + GLERROR("Bind PVM uniform"); std::vector frameBones; if (modelJob->BlendTree != nullptr) { @@ -982,11 +1225,19 @@ void DrawFinalPass::DrawToDepthStencilBuffer(std::listBind(); - GLuint shaderHandle = m_FillDepthStencilBufferProgram->GetHandle(); - glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix())); - glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix())); - glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix)); + if (lastShader != m_FillDepthStencilBufferProgram->GetHandle()) { + m_FillDepthStencilBufferProgram->Bind(); + lastShader = m_FillDepthStencilBufferProgram->GetHandle(); + glUniform1i(glGetUniformLocation(shaderHandle, "SSAOQuality"), m_SSAOPass->TextureQuality()); + glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix())); + glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix())); + glUniform2f(glGetUniformLocation(shaderHandle, "ScreenDimensions"), m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height); + glUniform4fv(glGetUniformLocation(shaderHandle, "AmbientColor"), 1, glm::value_ptr(scene.AmbientColor)); + GLERROR("Bind Uniforms 2"); + } + + glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "PVM"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix() * scene.Camera->ViewMatrix() * modelJob->Matrix)); + GLERROR("Bind PVM uniform"); } @@ -1008,6 +1259,9 @@ void DrawFinalPass::DrawSprites(std::list>&jobs, Rend GLuint shaderHandle = m_SpriteProgram->GetHandle(); + glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix())); + glUniform3fv(glGetUniformLocation(shaderHandle, "CameraPos"), 1, glm::value_ptr(scene.Camera->Position())); + for(auto& job : jobs) { auto spriteJob = std::dynamic_pointer_cast(job); RenderState jobState; @@ -1016,10 +1270,7 @@ void DrawFinalPass::DrawSprites(std::list>&jobs, Rend if(spriteJob->Depth == 0) { jobState.Disable(GL_DEPTH_TEST); } - glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(spriteJob->Matrix)); - glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix())); - glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix())); - glUniform3fv(glGetUniformLocation(shaderHandle, "CameraPos"), 1, glm::value_ptr(scene.Camera->Position())); + glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "PVM"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix() * scene.Camera->ViewMatrix() * spriteJob->Matrix)); glUniform4fv(glGetUniformLocation(shaderHandle, "Color"), 1, glm::value_ptr(spriteJob->Color)); glUniform4fv(glGetUniformLocation(shaderHandle, "FillColor"), 1, glm::value_ptr(spriteJob->FillColor)); glUniform1f(glGetUniformLocation(shaderHandle, "FillPercentage"), spriteJob->FillPercentage); @@ -1049,17 +1300,14 @@ void DrawFinalPass::DrawSprites(std::list>&jobs, Rend void DrawFinalPass::BindExplosionUniforms(GLuint shaderHandle, std::shared_ptr& job, RenderScene& scene) { - glUniform1i(glGetUniformLocation(shaderHandle, "SSAOQuality"), m_SSAOPass->TextureQuality()); - GLERROR("Bind 1 uniform"); glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(job->Matrix)); GLERROR("Bind 2 uniform"); - glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix())); - GLERROR("Bind 3 uniform"); - glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix())); - GLERROR("Bind 4 uniform"); - - glUniform2f(glGetUniformLocation(shaderHandle, "ScreenDimensions"), m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height); - GLERROR("Bind 5 uniform"); + glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "PVM"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix() * scene.Camera->ViewMatrix() * job->Matrix)); + GLERROR("Bind PVM uniform"); + glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "VM"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix() * job->Matrix)); + GLERROR("Bind VM uniform"); + glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "TIM"), 1, GL_FALSE, glm::value_ptr(glm::transpose(glm::inverse(job->Matrix)))); + GLERROR("Bind TIM uniform"); glUniform3fv(glGetUniformLocation(shaderHandle, "ExplosionOrigin"), 1, glm::value_ptr(job->ExplosionOrigin)); GLERROR("Bind 6 uniform"); @@ -1090,29 +1338,21 @@ void DrawFinalPass::BindExplosionUniforms(GLuint shaderHandle, std::shared_ptrFillPercentage); GLERROR("Bind 19 uniform"); - glUniform4fv(glGetUniformLocation(shaderHandle, "AmbientColor"), 1, glm::value_ptr(scene.AmbientColor)); - GLERROR("Bind 20 uniform"); glUniform1f(glGetUniformLocation(shaderHandle, "GlowIntensity"), job->GlowIntensity); GLERROR("END"); } void DrawFinalPass::BindModelUniforms(GLuint shaderHandle, std::shared_ptr& job, RenderScene& scene) { - glUniform1i(glGetUniformLocation(shaderHandle, "SSAOQuality"), m_SSAOPass->TextureQuality()); - GLERROR("Bind 1 uniform"); GLint Location_M = glGetUniformLocation(shaderHandle, "M"); glUniformMatrix4fv(Location_M, 1, GL_FALSE, glm::value_ptr(job->Matrix)); GLERROR("Bind 2 uniform"); - GLint Location_V = glGetUniformLocation(shaderHandle, "V"); - glUniformMatrix4fv(Location_V, 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix())); - GLERROR("Bind 3 uniform"); - GLint Location_P = glGetUniformLocation(shaderHandle, "P"); - glUniformMatrix4fv(Location_P, 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix())); - GLERROR("Bind 4 uniform"); - - GLint Location_ScreenDimensions = glGetUniformLocation(shaderHandle, "ScreenDimensions"); - glUniform2f(Location_ScreenDimensions, m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height); - GLERROR("Bind 5 uniform"); + glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "PVM"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix() * scene.Camera->ViewMatrix() * job->Matrix)); + GLERROR("Bind PVM uniform"); + glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "VM"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix() * job->Matrix)); + GLERROR("Bind VM uniform"); + glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "TIM"), 1, GL_FALSE, glm::value_ptr(glm::transpose(glm::inverse(job->Matrix)))); + GLERROR("Bind TIM uniform"); GLint Location_FillPercentage = glGetUniformLocation(shaderHandle, "FillPercentage"); glUniform1f(Location_FillPercentage, job->FillPercentage); @@ -1125,11 +1365,6 @@ void DrawFinalPass::BindModelUniforms(GLuint shaderHandle, std::shared_ptrColor)); - GLERROR("Bind 9 uniform"); - GLint Location_AmbientColor = glGetUniformLocation(shaderHandle, "AmbientColor"); - glUniform4fv(Location_AmbientColor, 1, glm::value_ptr(scene.AmbientColor)); - - GLERROR("Bind 10 uniform"); GLint Location_GlowIntensity = glGetUniformLocation(shaderHandle, "GlowIntensity"); glUniform1f(Location_GlowIntensity, job->GlowIntensity); diff --git a/src/Engine/Rendering/Model.cpp b/src/Engine/Rendering/Model.cpp index 3f8e20e1..d34ce809 100644 --- a/src/Engine/Rendering/Model.cpp +++ b/src/Engine/Rendering/Model.cpp @@ -10,31 +10,31 @@ Model::Model(std::string fileName) case RawModel::MaterialType::SingleTextures: { RawModel::MaterialSingleTextures* materialSingleTexture = static_cast(materialProperty.material); - materialSingleTexture->ColorMap.Texture = CommonFunctions::LoadTexture(materialSingleTexture->ColorMap.TexturePath, false); - materialSingleTexture->NormalMap.Texture = CommonFunctions::LoadTexture(materialSingleTexture->NormalMap.TexturePath, false); - materialSingleTexture->SpecularMap.Texture = CommonFunctions::LoadTexture(materialSingleTexture->SpecularMap.TexturePath, false); - materialSingleTexture->IncandescenceMap.Texture = CommonFunctions::LoadTexture(materialSingleTexture->IncandescenceMap.TexturePath, false); + materialSingleTexture->ColorMap.Texture = CommonFunctions::TryLoadResource(materialSingleTexture->ColorMap.TexturePath); + materialSingleTexture->NormalMap.Texture = CommonFunctions::TryLoadResource(materialSingleTexture->NormalMap.TexturePath); + materialSingleTexture->SpecularMap.Texture = CommonFunctions::TryLoadResource(materialSingleTexture->SpecularMap.TexturePath); + materialSingleTexture->IncandescenceMap.Texture = CommonFunctions::TryLoadResource(materialSingleTexture->IncandescenceMap.TexturePath); } break; case RawModel::MaterialType::SplatMapping: { RawModel::MaterialSplatMapping* materialSplatMapping = static_cast(materialProperty.material); - materialSplatMapping->SplatMap.Texture = CommonFunctions::LoadTexture(materialSplatMapping->SplatMap.TexturePath, false); + materialSplatMapping->SplatMap.Texture = CommonFunctions::TryLoadResource(materialSplatMapping->SplatMap.TexturePath); for (auto& texture : materialSplatMapping->ColorMaps) { - texture.Texture = CommonFunctions::LoadTexture(texture.TexturePath, false); + texture.Texture = CommonFunctions::TryLoadResource(texture.TexturePath); } for (auto& texture : materialSplatMapping->NormalMaps) { - texture.Texture = CommonFunctions::LoadTexture(texture.TexturePath, false); + texture.Texture = CommonFunctions::TryLoadResource(texture.TexturePath); } for (auto& texture : materialSplatMapping->SpecularMaps) { - texture.Texture = CommonFunctions::LoadTexture(texture.TexturePath, false); + texture.Texture = CommonFunctions::TryLoadResource(texture.TexturePath); } for (auto& texture : materialSplatMapping->IncandescenceMaps) { - texture.Texture = CommonFunctions::LoadTexture(texture.TexturePath, false); + texture.Texture = CommonFunctions::TryLoadResource(texture.TexturePath); } } break; diff --git a/src/Engine/Rendering/PickingPass.cpp b/src/Engine/Rendering/PickingPass.cpp index 57e10aff..b5162e72 100644 --- a/src/Engine/Rendering/PickingPass.cpp +++ b/src/Engine/Rendering/PickingPass.cpp @@ -12,7 +12,8 @@ PickingPass::PickingPass(IRenderer* renderer, EventBroker* eb) PickingPass::~PickingPass() { - + CommonFunctions::DeleteTexture(&m_PickingTexture); + CommonFunctions::DeleteTexture(&m_DepthBuffer); } @@ -61,8 +62,9 @@ void PickingPass::Draw(RenderScene& scene) //TODO: Render: Add code for more jobs than modeljobs. GLuint shaderHandle = m_PickingProgram->GetHandle(); GLuint shaderSkinnedHandle = m_PickingSkinnedProgram->GetHandle(); + GLuint lastShader = 0; + unsigned int lastModel = 0; m_PickingProgram->Bind(); - if (scene.ClearDepth) { //glClear(GL_DEPTH_BUFFER_BIT); state->Disable(GL_DEPTH_TEST); @@ -98,10 +100,11 @@ void PickingPass::Draw(RenderScene& scene) m_PickingColorsToEntity[glm::ivec2(pickColor[0], pickColor[1])] = pickInfo; if (modelJob->Model->IsSkinned()) { - m_PickingSkinnedProgram->Bind(); - glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix)); - glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix())); - glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix())); + if (lastShader != m_PickingSkinnedProgram->GetHandle()) { + m_PickingSkinnedProgram->Bind(); + lastShader = m_PickingSkinnedProgram->GetHandle(); + } + glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "PVM"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix() * scene.Camera->ViewMatrix() * modelJob->Matrix)); glUniform2fv(glGetUniformLocation(shaderSkinnedHandle, "PickingColor"), 1, glm::value_ptr(glm::vec2(pickColor[0], pickColor[1]))); std::vector frameBones; @@ -114,15 +117,19 @@ void PickingPass::Draw(RenderScene& scene) } else { - m_PickingProgram->Bind(); - glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix)); - glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix())); - glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix())); + if (lastShader != m_PickingProgram->GetHandle()) { + m_PickingProgram->Bind(); + lastShader = m_PickingProgram->GetHandle(); + } + glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "PVM"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix() * scene.Camera->ViewMatrix() * modelJob->Matrix)); glUniform2fv(glGetUniformLocation(shaderHandle, "PickingColor"), 1, glm::value_ptr(glm::vec2(pickColor[0], pickColor[1]))); } - glBindVertexArray(modelJob->Model->VAO); - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, modelJob->Model->ElementBuffer); + if (lastModel != modelJob->ModelID) { + glBindVertexArray(modelJob->Model->VAO); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, modelJob->Model->ElementBuffer); + lastModel = modelJob->ModelID; + } glDrawElements(GL_TRIANGLES, modelJob->EndIndex - modelJob->StartIndex + 1, GL_UNSIGNED_INT, (void*)(modelJob->StartIndex * sizeof(unsigned int))); } } @@ -208,10 +215,11 @@ void PickingPass::Draw(RenderScene& scene) m_PickingColorsToEntity[glm::ivec2(pickColor[0], pickColor[1])] = pickInfo; if (modelJob->Model->IsSkinned()) { - m_PickingSkinnedProgram->Bind(); - glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix)); - glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix())); - glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix())); + if (lastShader != m_PickingSkinnedProgram->GetHandle()) { + m_PickingSkinnedProgram->Bind(); + lastShader = m_PickingSkinnedProgram->GetHandle(); + } + glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "PVM"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix() * scene.Camera->ViewMatrix() * modelJob->Matrix)); glUniform2fv(glGetUniformLocation(shaderSkinnedHandle, "PickingColor"), 1, glm::value_ptr(glm::vec2(pickColor[0], pickColor[1]))); std::vector frameBones; @@ -224,19 +232,24 @@ void PickingPass::Draw(RenderScene& scene) glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); } else { - m_PickingProgram->Bind(); - glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix)); - glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix())); - glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix())); + if (lastShader != m_PickingProgram->GetHandle()) { + m_PickingProgram->Bind(); + lastShader = m_PickingProgram->GetHandle(); + } + glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "PVM"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix() * scene.Camera->ViewMatrix() * modelJob->Matrix)); glUniform2fv(glGetUniformLocation(shaderHandle, "PickingColor"), 1, glm::value_ptr(glm::vec2(pickColor[0], pickColor[1]))); } - glBindVertexArray(modelJob->Model->VAO); - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, modelJob->Model->ElementBuffer); + if (lastModel != modelJob->ModelID) { + glBindVertexArray(modelJob->Model->VAO); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, modelJob->Model->ElementBuffer); + lastModel = modelJob->ModelID; + } glDrawElements(GL_TRIANGLES, modelJob->EndIndex - modelJob->StartIndex + 1, GL_UNSIGNED_INT, (void*)(modelJob->StartIndex * sizeof(unsigned int))); } } + m_PickingProgram->Bind(); for (auto& job : scene.Jobs.SpriteJob) { auto spriteJob = std::dynamic_pointer_cast(job); if (!spriteJob->Pickable) { @@ -271,14 +284,11 @@ void PickingPass::Draw(RenderScene& scene) m_PickingColorsToEntity[glm::ivec2(pickColor[0], pickColor[1])] = pickInfo; - m_PickingProgram->Bind(); - glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(spriteJob->Matrix)); - glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix())); - glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix())); + glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "PVM"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix() * scene.Camera->ViewMatrix() * spriteJob->Matrix)); glUniform2fv(glGetUniformLocation(shaderHandle, "PickingColor"), 1, glm::value_ptr(glm::vec2(pickColor[0], pickColor[1]))); - glBindVertexArray(spriteJob->Model->VAO); - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, spriteJob->Model->ElementBuffer); + glBindVertexArray(spriteJob->Model->VAO); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, spriteJob->Model->ElementBuffer); glDrawElements(GL_TRIANGLES, spriteJob->EndIndex - spriteJob->StartIndex + 1, GL_UNSIGNED_INT, (void*)(spriteJob->StartIndex * sizeof(unsigned int))); } } diff --git a/src/Engine/Rendering/RenderSystem.cpp b/src/Engine/Rendering/RenderSystem.cpp index 114f432b..05de7fbe 100644 --- a/src/Engine/Rendering/RenderSystem.cpp +++ b/src/Engine/Rendering/RenderSystem.cpp @@ -449,7 +449,7 @@ void RenderSystem::Update(double dt) fillModels(scene.Jobs); fillPointLights(scene.Jobs.PointLight, m_World); //TODO: Make sure all objects needed are also sorted. - scene.Jobs.OpaqueObjects.sort(); + scene.Jobs.OpaqueObjects.sort([](auto& a, auto& b) {return *a < *b; }); fillSprites(scene.Jobs.SpriteJob, m_World); fillDirectionalLights(scene.Jobs.DirectionalLight, m_World); fillText(scene.Jobs.Text, m_World); diff --git a/src/Engine/Rendering/Renderer.cpp b/src/Engine/Rendering/Renderer.cpp index f58e6208..fdfcf235 100644 --- a/src/Engine/Rendering/Renderer.cpp +++ b/src/Engine/Rendering/Renderer.cpp @@ -2,6 +2,19 @@ std::unordered_map Renderer::m_WindowToRenderer; +Renderer::~Renderer() { + delete m_PickingPass; + delete m_LightCullingPass; + delete m_ImGuiRenderPass; + delete m_DrawFinalPass; + delete m_DrawScreenQuadPass; + delete m_DrawBloomPass; + delete m_DrawColorCorrectionPass; + delete m_SSAOPass; + delete m_CubeMapPass; + delete m_TextPass; +} + void Renderer::Initialize() { m_SSAO_Quality = m_Config->Get("SSAO.Quality", 0); @@ -220,8 +233,8 @@ PickData Renderer::Pick(glm::vec2 screenCoord) void Renderer::InitializeTextures() { - m_ErrorTexture = CommonFunctions::LoadTexture("Textures/Core/ErrorTexture.png", false); - m_WhiteTexture = CommonFunctions::LoadTexture("Textures/Core/White.png", false); + m_ErrorTexture = CommonFunctions::TryLoadResource("Textures/Core/ErrorTexture.png"); + m_WhiteTexture = CommonFunctions::TryLoadResource("Textures/Core/White.png"); } diff --git a/src/Engine/Rendering/SSAOPass.cpp b/src/Engine/Rendering/SSAOPass.cpp index 3b11535f..f3c7f74c 100644 --- a/src/Engine/Rendering/SSAOPass.cpp +++ b/src/Engine/Rendering/SSAOPass.cpp @@ -4,12 +4,19 @@ SSAOPass::SSAOPass(IRenderer* renderer, ConfigFile* config) : m_Renderer(renderer) , m_Config(config) { - m_WhiteTexture = CommonFunctions::LoadTexture("Textures/Core/White.png", false); + m_WhiteTexture = CommonFunctions::TryLoadResource("Textures/Core/White.png"); ChangeQuality(m_Config->Get("SSAO.Quality", 0)); } +SSAOPass::~SSAOPass() { + CommonFunctions::DeleteTexture(&m_SSAOTexture); + CommonFunctions::DeleteTexture(&m_SSAOViewSpaceZTexture); + CommonFunctions::DeleteTexture(&m_Gaussian_horiz); + CommonFunctions::DeleteTexture(&m_Gaussian_vert); +} + void SSAOPass::ChangeQuality(int quality) { if (m_Quality == quality) { diff --git a/src/Engine/Rendering/ShaderProgram.cpp b/src/Engine/Rendering/ShaderProgram.cpp index ae536bc0..d2a45888 100644 --- a/src/Engine/Rendering/ShaderProgram.cpp +++ b/src/Engine/Rendering/ShaderProgram.cpp @@ -4,22 +4,32 @@ GLuint Shader::CompileShader(GLenum shaderType, std::string fileName) { LOG_INFO("Compiling shader \"%s\"", fileName.c_str()); - std::string shaderFile; - std::ifstream in(fileName, std::ios::in); - if (!in) { - LOG_ERROR("Error: Failed to open shader file \"%s\"", fileName.c_str()); - return 0; - } - in.seekg(0, std::ios::end); - shaderFile.resize((int)in.tellg()); - in.seekg(0, std::ios::beg); - in.read(&shaderFile[0], shaderFile.size()); - in.close(); + std::string shaderFile = ReadFile(fileName); GLuint shader = glCreateShader(shaderType); if (GLERROR("glCreateShader")) return 0; + std::size_t startPos = 0; + std::size_t SEofNewFile[2]; + std::string key = "#include"; + while((startPos = shaderFile.find(key, startPos)) != std::string::npos) + { + SEofNewFile[0] = shaderFile.find('"', startPos+key.length())+1; + SEofNewFile[1] = shaderFile.find('"', SEofNewFile[0]); + if (SEofNewFile[0] == std::string::npos || SEofNewFile[1] == std::string::npos) + return 0; + + std::string replacementFileName = shaderFile.substr(SEofNewFile[0], SEofNewFile[1] - SEofNewFile[0]); + std::string replacementString = ReadFile(replacementFileName); + size_t firstof = replacementString.find_first_of((char)0); + replacementString.erase(firstof, replacementString.size() - firstof); + if (replacementString.length() <= 0) + return 0; + shaderFile.replace(startPos, SEofNewFile[1]+2 - startPos, replacementString + "\n"); + startPos += replacementString.length(); //This might not be wanted. + } + const GLchar* shaderFiles = shaderFile.c_str(); const GLint length = static_cast(shaderFile.length()); glShaderSource(shader, 1, &shaderFiles, &length); @@ -46,6 +56,24 @@ GLuint Shader::CompileShader(GLenum shaderType, std::string fileName) return shader; } +std::string Shader::ReadFile(std::string fileName) +{ + std::string shaderFile; + std::ifstream in(fileName, std::ios::in); + if (!in) { + LOG_ERROR("Error: Failed to open shader file \"%s\"", fileName.c_str()); + return ""; + } + + in.seekg(0, std::ios::end); + shaderFile.resize((int)in.tellg()); + in.seekg(0, std::ios::beg); + in.read(&shaderFile[0], shaderFile.size()); + in.close(); + return shaderFile; +} + + Shader::Shader(GLenum shaderType, std::string fileName) : m_ShaderType(shaderType), m_FileName(fileName) { m_ShaderHandle = 0; diff --git a/src/Engine/Rendering/Texture.cpp b/src/Engine/Rendering/Texture.cpp index 03347044..fdf387c2 100644 --- a/src/Engine/Rendering/Texture.cpp +++ b/src/Engine/Rendering/Texture.cpp @@ -4,18 +4,6 @@ Texture::Texture(std::string path) { PNG* img = ResourceManager::Load(path); //TODO: Make this threaded. Catch exeptions in all other load places. - //PNG image(path); - - //if (img->Width == 0 && img->Height == 0 || img->Format == Image::ImageFormat::Unknown) { - // //image = PNG("Textures/Core/ErrorTexture.png"); - // //return; // Temporary fix to remove crash - - // if (img->Width == 0 && img->Height == 0 || img->Format == Image::ImageFormat::Unknown) { - // LOG_ERROR("Couldn't even load the error texture. This is a dark day indeed."); - // return; - // } - //} - this->Width = img->Width; this->Height = img->Height; this->Data = img->Data; @@ -29,9 +17,9 @@ Texture::Texture(std::string path) format = GL_RGBA; break; } - - + // Construct the OpenGL texture + glGenTextures(1, &m_Texture); glBindTexture(GL_TEXTURE_2D, m_Texture); glPixelStorei(GL_UNPACK_ALIGNMENT, 1); diff --git a/src/Engine/Rendering/TextureSprite.cpp b/src/Engine/Rendering/TextureSprite.cpp new file mode 100644 index 00000000..178aebf0 --- /dev/null +++ b/src/Engine/Rendering/TextureSprite.cpp @@ -0,0 +1,11 @@ +#include "Rendering/TextureSprite.h" + +TextureSprite::TextureSprite(std::string path) + :Texture(path) +{ + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST_MIPMAP_NEAREST); + GLERROR("Texture load"); +} \ No newline at end of file diff --git a/src/Engine/Rendering/Util/CommonFunctions.cpp b/src/Engine/Rendering/Util/CommonFunctions.cpp index 913e005e..e1344928 100644 --- a/src/Engine/Rendering/Util/CommonFunctions.cpp +++ b/src/Engine/Rendering/Util/CommonFunctions.cpp @@ -1,23 +1,5 @@ #include "Rendering/Util/CommonFunctions.h" -Texture* CommonFunctions::LoadTexture(std::string path, bool threaded) -{ - Texture* img; - try { - if(threaded) { - img = ResourceManager::Load(path); - } else { - img = ResourceManager::Load(path); - } - } catch (const Resource::StillLoadingException&) { - img = ResourceManager::Load("Textures/Core/ErrorTexture.png"); - } catch (const std::exception&) { - img = nullptr; - } - - return img; -} - void CommonFunctions::GenerateTexture(GLuint* texture, GLenum wrapping, GLenum filtering, glm::vec2 dimensions, GLint internalFormat, GLint format, GLenum type) { glDeleteTextures(1, texture); diff --git a/src/Engine/Rendering/Util/ScreenCoords.cpp b/src/Engine/Rendering/Util/ScreenCoords.cpp index 8b7768c8..a858524d 100644 --- a/src/Engine/Rendering/Util/ScreenCoords.cpp +++ b/src/Engine/Rendering/Util/ScreenCoords.cpp @@ -37,7 +37,7 @@ ScreenCoords::PixelData ScreenCoords::ToPixelData(float x, float y, FrameBuffer* glReadPixels(x, y, 1, 1, GL_RGB, GL_UNSIGNED_BYTE, &pdata); GLERROR("glReadPixels(pdata) Error"); PickDataBuffer->Unbind(); - + GLERROR("Unbind Error"); glBindFramebuffer(GL_FRAMEBUFFER, DepthBuffer); GLERROR("glBindFramebuffer(DepthBuffer) Error"); float depthData; diff --git a/src/Game/Game.cpp b/src/Game/Game.cpp index 32d42e31..7b80727e 100644 --- a/src/Game/Game.cpp +++ b/src/Game/Game.cpp @@ -39,6 +39,8 @@ #include "GUI/ButtonSystem.h" #include "Game/Systems/MainMenuSystem.h" #include "Game/Systems/ServerListSystem.h" +#include "Game/Systems/StartSystem.h" +#include "Rendering/TextureSprite.h" Game::Game(int argc, char* argv[]) @@ -50,6 +52,7 @@ Game::Game(int argc, char* argv[]) ResourceManager::RegisterType("Model"); ResourceManager::RegisterType("RawModel"); ResourceManager::RegisterType("Texture"); + ResourceManager::RegisterType("TextureSprite"); ResourceManager::RegisterType("Png"); ResourceManager::RegisterType("ShaderProgram"); ResourceManager::RegisterType("EntityFile"); @@ -153,6 +156,7 @@ Game::Game(int argc, char* argv[]) m_SystemPipeline->AddSystem(updateOrderLevel); m_SystemPipeline->AddSystem(updateOrderLevel); m_SystemPipeline->AddSystem(updateOrderLevel, m_Renderer); + m_SystemPipeline->AddSystem(updateOrderLevel); // Populate Octree with collidables ++updateOrderLevel; m_SystemPipeline->AddSystem(updateOrderLevel, m_OctreeCollision, "Collidable"); diff --git a/src/Game/Systems/DamageIndicatorSystem.cpp b/src/Game/Systems/DamageIndicatorSystem.cpp index 7e22a0d6..c4de21ff 100644 --- a/src/Game/Systems/DamageIndicatorSystem.cpp +++ b/src/Game/Systems/DamageIndicatorSystem.cpp @@ -8,7 +8,7 @@ DamageIndicatorSystem::DamageIndicatorSystem(SystemParams params) EVENT_SUBSCRIBE_MEMBER(m_ESetCamera, &DamageIndicatorSystem::OnSetCamera); //load texture to cache - auto texture = CommonFunctions::LoadTexture("Textures/DamageIndicator.png", false); + auto texture = CommonFunctions::TryLoadResource("Textures/DamageIndicator.png"); auto entityFile = ResourceManager::Load("Schema/Entities/DamageIndicator.xml"); m_NetworkEnabled = ResourceManager::Load("Config.ini")->Get("Networking.StartNetwork", false); } diff --git a/src/Game/Systems/MainMenuSystem.cpp b/src/Game/Systems/MainMenuSystem.cpp index fcb04b4f..848070b4 100644 --- a/src/Game/Systems/MainMenuSystem.cpp +++ b/src/Game/Systems/MainMenuSystem.cpp @@ -23,8 +23,8 @@ bool MainMenuSystem::OnButtonClick(const Events::ButtonClicked& e) EntityWrapper serverIdentityEntity = entity.FirstParentWithComponent("ServerIdentity"); if(serverIdentityEntity.Valid()) { Events::ConnectRequest event; - event.IP = (std::string)entity["ServerIdentity"]["IP"]; - event.Port = (int)entity["ServerIdentity"]["Port"]; + event.IP = (std::string)serverIdentityEntity["ServerIdentity"]["IP"]; + event.Port = (int)serverIdentityEntity["ServerIdentity"]["Port"]; printf("\n ----Request Server Connect----\nIP: %s\nPort: %i\n ------------------------------", event.IP, event.Port); m_EventBroker->Publish(event); } @@ -82,7 +82,6 @@ bool MainMenuSystem::OnInputCommand(const Events::InputCommand& e) } } else { //Serverlist submenu is open, close it. - printf("\n\nMenuShit\n\n"); m_World->DeleteEntity(m_OpenSubMenu.ID); m_OpenSubMenu = EntityWrapper::Invalid; } diff --git a/src/Game/Systems/ServerListSystem.cpp b/src/Game/Systems/ServerListSystem.cpp index f2813b64..ad575e3f 100644 --- a/src/Game/Systems/ServerListSystem.cpp +++ b/src/Game/Systems/ServerListSystem.cpp @@ -37,17 +37,17 @@ bool ServerListSystem::OnServerListRecieved(const Events::DisplayServerlist& e) for (int i = 0; i < e.Serverlist.size(); i++) { //Create Identities for each server and place them on the right position. EntityWrapper newIdentity = SpawnerSystem::Spawn(identitySpawner, identitySpawner); + EntityWrapper serverIdentityEntity = newIdentity.FirstChildByName("ServerIdentity"); glm::vec3 offset = (glm::vec3)serverListEntity["ServerList"]["Offset"]; - (glm::vec3&)newIdentity["Transform"]["Position"] = offset * (float)i; + (glm::vec3&)serverIdentityEntity["Transform"]["Position"] = offset * (float)i; - auto& cIdentity = newIdentity["ServerIdentity"]; + auto& cIdentity = serverIdentityEntity["ServerIdentity"]; (std::string&)cIdentity["IP"] = e.Serverlist[i].Address; (std::string&)cIdentity["ServerName"] = e.Serverlist[i].Name; (int&)cIdentity["Port"] = e.Serverlist[i].Port; (int&)cIdentity["PlayersConnected"] = e.Serverlist[i].PlayersConnected; } } - return 1; } diff --git a/src/Game/Systems/StartSystem.cpp b/src/Game/Systems/StartSystem.cpp new file mode 100644 index 00000000..3efc2ec3 --- /dev/null +++ b/src/Game/Systems/StartSystem.cpp @@ -0,0 +1,33 @@ +#include "../Game/Systems/StartSystem.h" + +StartSystem::StartSystem(SystemParams params) + : System(params) + , ImpureSystem() +{ + EVENT_SUBSCRIBE_MEMBER(m_ECameraActivated, &StartSystem::OnCameraActivated); +} + +void StartSystem::Update(double dt) +{ + auto cameras = m_World->GetComponents("Camera"); + if(cameras == nullptr) { + return; + } + for(auto& cCamera: *cameras) { + EntityWrapper cameraEntity = EntityWrapper(m_World, cCamera.EntityID); + if(cameraEntity == m_ActiveCamera){ + return; + } + if(cameraEntity.Name() == "Overview_Camera_Start_Menu") { + Events::SetCamera event; + event.CameraEntity = cameraEntity; + m_EventBroker->Publish(event); + } + } +} + +bool StartSystem::OnCameraActivated(const Events::SetCamera& e) +{ + m_ActiveCamera = e.CameraEntity; + return 1; +}