From 97cbc55223c7a12be33f13c13500031c949b06c7 Mon Sep 17 00:00:00 2001 From: Tleety Date: Wed, 27 Jan 2016 17:21:00 +0100 Subject: [PATCH 01/19] Some debug features for color corrections and glow strength fix. --- .../Rendering/DrawColorCorrectionPass.h | 4 +- resources/Schema/Entities/EditorTestWorld.xml | 149 ++++++++++-------- .../Shaders/DrawColorCorrection.frag.glsl | 4 +- resources/Shaders/ForwardPlus.frag.glsl | 2 +- .../Rendering/DrawColorCorrectionPass.cpp | 6 +- 5 files changed, 92 insertions(+), 73 deletions(-) diff --git a/include/Engine/Rendering/DrawColorCorrectionPass.h b/include/Engine/Rendering/DrawColorCorrectionPass.h index e9a7e281..f507b53c 100644 --- a/include/Engine/Rendering/DrawColorCorrectionPass.h +++ b/include/Engine/Rendering/DrawColorCorrectionPass.h @@ -7,6 +7,7 @@ #include "ShaderProgram.h" //#include "Util/UnorderedMapVec2.h" #include "Texture.h" +#include "imgui/imgui.h" class DrawColorCorrectionPass { @@ -23,7 +24,8 @@ private: ShaderProgram* m_ColorCorrectionProgram; Model* m_ScreenQuad; - GLfloat m_Exposure; + GLfloat m_Exposure = 1; + GLfloat m_Gamma = 2.2; }; #endif \ No newline at end of file diff --git a/resources/Schema/Entities/EditorTestWorld.xml b/resources/Schema/Entities/EditorTestWorld.xml index 9565e2d4..b7baea28 100755 --- a/resources/Schema/Entities/EditorTestWorld.xml +++ b/resources/Schema/Entities/EditorTestWorld.xml @@ -43,7 +43,7 @@ - + @@ -85,7 +85,7 @@ Run - + 1 @@ -101,7 +101,7 @@ Walk - + 1 @@ -147,70 +147,6 @@ - - - - Models/NormalMapSphere.mesh - - - - - - - - - - - Models/SpecularMapSphere.mesh - - - - - - - - - - 1 - - - - - - - - - - - Models/Core/UnitSphere.mesh - - - - 3 - 1.1399998664855957 - - - - - - - - - - - - - - - - Models/IncandescenceMapSphere.mesh - - - - - - - @@ -227,7 +163,7 @@ - + @@ -284,6 +220,83 @@ + + + + 1 + + + + + + + + + + + Models/NormalMapSphere.mesh + + + + + + + + + + + Models/SpecularMapSphere.mesh + + + + + + + + + + 1 + + + + + + + + + + + Models/Core/UnitSphere.mesh + + + + 3 + 1.1399998664855957 + + + + + + + + + + + + + + + + Models/IncandescenceMapSphere.mesh + + + + + + + + + diff --git a/resources/Shaders/DrawColorCorrection.frag.glsl b/resources/Shaders/DrawColorCorrection.frag.glsl index 8d13992a..91ace0c7 100644 --- a/resources/Shaders/DrawColorCorrection.frag.glsl +++ b/resources/Shaders/DrawColorCorrection.frag.glsl @@ -3,6 +3,7 @@ layout (binding = 0) uniform sampler2D SceneTexture; layout (binding = 1) uniform sampler2D BloomTexture; uniform float Exposure; +uniform float Gamma; in VertexData{ vec2 TextureCoordinate; @@ -12,7 +13,6 @@ out vec4 fragmentColor; void main() { - const float gamma = 2.2; vec4 hdrColor = texture(SceneTexture, Input.TextureCoordinate); vec4 bloomColor = texture(BloomTexture, Input.TextureCoordinate); hdrColor += bloomColor; @@ -21,7 +21,7 @@ void main() vec3 result = vec3(1.0) - exp(-hdrColor.rgb * Exposure); //gamme correction - result = pow(result, vec3(1.0 / gamma)); + result = pow(result, vec3(1.0 / Gamma)); fragmentColor = vec4(result, 1.0); //fragmentColor = hdrColor; diff --git a/resources/Shaders/ForwardPlus.frag.glsl b/resources/Shaders/ForwardPlus.frag.glsl index de672dd1..16dca034 100644 --- a/resources/Shaders/ForwardPlus.frag.glsl +++ b/resources/Shaders/ForwardPlus.frag.glsl @@ -160,7 +160,7 @@ void main() color_result += FillColor; } sceneColor = vec4(color_result.xyz, clamp(color_result.a, 0, 1)); - color_result += glowTexel; + color_result += glowTexel*3; bloomColor = vec4(clamp(color_result.xyz - 1.0, 0, 100), 1.0); diff --git a/src/Engine/Rendering/DrawColorCorrectionPass.cpp b/src/Engine/Rendering/DrawColorCorrectionPass.cpp index ba9efe3e..0e3d3db5 100644 --- a/src/Engine/Rendering/DrawColorCorrectionPass.cpp +++ b/src/Engine/Rendering/DrawColorCorrectionPass.cpp @@ -5,7 +5,8 @@ DrawColorCorrectionPass::DrawColorCorrectionPass(IRenderer* renderer) m_Renderer = renderer; m_ScreenQuad = ResourceManager::Load("Models/Core/ScreenQuad.mesh"); - m_Exposure = 0.4; //TODO: Renderer: Fixa så att denna går att ändra på genom komponent eller setting. + + //m_Exposure = 0.4; //TODO: Renderer: Fixa så att denna går att ändra på genom komponent eller setting. InitializeShaderPrograms(); } @@ -21,6 +22,8 @@ void DrawColorCorrectionPass::InitializeShaderPrograms() void DrawColorCorrectionPass::Draw(GLuint sceneTexture, GLuint bloomTexture) { + ImGui::DragFloat("Exposure", &m_Exposure, 0.01f, 0.f, 10.f, "%.2f", 1.f); + ImGui::DragFloat("Gamma", &m_Gamma, 0.01f, 0.f, 50.f, "%.2f", 1.f); //glBindFramebuffer(GL_FRAMEBUFFER, 0); GLERROR("DrawScreenQuadPass::Draw: Pre"); @@ -28,6 +31,7 @@ void DrawColorCorrectionPass::Draw(GLuint sceneTexture, GLuint bloomTexture) m_ColorCorrectionProgram->Bind(); glClear(GL_COLOR_BUFFER_BIT); glUniform1f(glGetUniformLocation(m_ColorCorrectionProgram->GetHandle(), "Exposure"), m_Exposure); + glUniform1f(glGetUniformLocation(m_ColorCorrectionProgram->GetHandle(), "Gamma"), m_Gamma); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, sceneTexture); From 8bcafc1151d786b3fdedcb477e660cae8cbf204b Mon Sep 17 00:00:00 2001 From: Tleety Date: Wed, 27 Jan 2016 18:07:05 +0100 Subject: [PATCH 02/19] WIP --- include/Engine/Rendering/IRenderer.h | 3 --- resources/Schema/Components.xsd | 1 + resources/Schema/Components/SceneLight.xml | 7 ++++++ resources/Schema/Components/SceneLight.xsd | 25 +++++++++++++++++++ resources/Schema/Types/Entity.xsd | 1 + .../Rendering/DrawColorCorrectionPass.cpp | 2 -- src/Engine/Rendering/RenderSystem.cpp | 10 ++++++++ 7 files changed, 44 insertions(+), 5 deletions(-) create mode 100644 resources/Schema/Components/SceneLight.xml create mode 100644 resources/Schema/Components/SceneLight.xsd diff --git a/include/Engine/Rendering/IRenderer.h b/include/Engine/Rendering/IRenderer.h index 811ecd28..708b87a6 100644 --- a/include/Engine/Rendering/IRenderer.h +++ b/include/Engine/Rendering/IRenderer.h @@ -40,9 +40,6 @@ public: virtual void Draw(RenderFrame& rq) = 0; virtual PickData Pick(glm::vec2 screenCord) = 0; - - World* m_World; //Temp world, untill viktor merge. - protected: Rectangle m_Resolution = Rectangle::Rectangle(1280, 720); Rectangle m_ViewPortWidth = Rectangle::Rectangle(1280, 720); diff --git a/resources/Schema/Components.xsd b/resources/Schema/Components.xsd index ab46b0ea..bb1fd770 100644 --- a/resources/Schema/Components.xsd +++ b/resources/Schema/Components.xsd @@ -11,6 +11,7 @@ + diff --git a/resources/Schema/Components/SceneLight.xml b/resources/Schema/Components/SceneLight.xml new file mode 100644 index 00000000..80b6b9f4 --- /dev/null +++ b/resources/Schema/Components/SceneLight.xml @@ -0,0 +1,7 @@ + + + + true + 2.2 + 1 + \ No newline at end of file diff --git a/resources/Schema/Components/SceneLight.xsd b/resources/Schema/Components/SceneLight.xsd new file mode 100644 index 00000000..9f8a9705 --- /dev/null +++ b/resources/Schema/Components/SceneLight.xsd @@ -0,0 +1,25 @@ + + + + + + Some settings for the scene lighting + + + + + Color of the ambient light + + + Wether the ambient light should be applied or not + + + Gamma correction for the scene + + + The exposure of the camera + + + + + \ No newline at end of file diff --git a/resources/Schema/Types/Entity.xsd b/resources/Schema/Types/Entity.xsd index 99b90caa..028af9e6 100644 --- a/resources/Schema/Types/Entity.xsd +++ b/resources/Schema/Types/Entity.xsd @@ -31,6 +31,7 @@ + diff --git a/src/Engine/Rendering/DrawColorCorrectionPass.cpp b/src/Engine/Rendering/DrawColorCorrectionPass.cpp index 0e3d3db5..9b9e2236 100644 --- a/src/Engine/Rendering/DrawColorCorrectionPass.cpp +++ b/src/Engine/Rendering/DrawColorCorrectionPass.cpp @@ -22,8 +22,6 @@ void DrawColorCorrectionPass::InitializeShaderPrograms() void DrawColorCorrectionPass::Draw(GLuint sceneTexture, GLuint bloomTexture) { - ImGui::DragFloat("Exposure", &m_Exposure, 0.01f, 0.f, 10.f, "%.2f", 1.f); - ImGui::DragFloat("Gamma", &m_Gamma, 0.01f, 0.f, 50.f, "%.2f", 1.f); //glBindFramebuffer(GL_FRAMEBUFFER, 0); GLERROR("DrawScreenQuadPass::Draw: Pre"); diff --git a/src/Engine/Rendering/RenderSystem.cpp b/src/Engine/Rendering/RenderSystem.cpp index a0912a45..98373a61 100644 --- a/src/Engine/Rendering/RenderSystem.cpp +++ b/src/Engine/Rendering/RenderSystem.cpp @@ -244,6 +244,16 @@ void RenderSystem::Update(double dt) RenderScene scene; scene.Camera = m_Camera; scene.Viewport = Rectangle(1280, 720); + + //auto cSceneLight = m_Renderer->m_World->GetComponents("SceneLight"); + //if (cSceneLight != nullptr) { + // m_Gamma = (double)(*cSceneLight->begin())["Gamma"]; + // m_Exposure = (double)(*cSceneLight->begin())["Exposure"]; + //} + + //scene.ambient + //scene.gamma + //scene.exponent fillModels(scene.OpaqueObjects, scene.TransparentObjects); fillPointLights(scene.PointLightJobs, m_World); fillDirectionalLights(scene.DirectionalLightJobs, m_World); From 0c97ce7a4a29d84c2ec87d0ea8a29008757d0c40 Mon Sep 17 00:00:00 2001 From: verysecrethero Date: Fri, 29 Jan 2016 10:12:49 +0100 Subject: [PATCH 03/19] You can now DoubleJump! --- include/Game/Systems/PlayerMovementSystem.h | 2 ++ src/Game/Systems/PlayerMovementSystem.cpp | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/include/Game/Systems/PlayerMovementSystem.h b/include/Game/Systems/PlayerMovementSystem.h index f39740ec..4fbb2c79 100644 --- a/include/Game/Systems/PlayerMovementSystem.h +++ b/include/Game/Systems/PlayerMovementSystem.h @@ -20,4 +20,6 @@ private: EventRelay m_EPlayerSpawned; bool OnPlayerSpawned(Events::PlayerSpawned& e); + + bool m_DoubleJumped = false; }; \ No newline at end of file diff --git a/src/Game/Systems/PlayerMovementSystem.cpp b/src/Game/Systems/PlayerMovementSystem.cpp index 6eab02c5..868751f7 100644 --- a/src/Game/Systems/PlayerMovementSystem.cpp +++ b/src/Game/Systems/PlayerMovementSystem.cpp @@ -76,7 +76,13 @@ void PlayerMovementSystem::Update(double dt) ImGui::Text("velocity: (%f, %f, %f) |%f|", velocity.x, velocity.y, velocity.z, glm::length(velocity)); } - if (controller->Jumping() && !controller->Crouching() && velocity.y == 0.f) { + if (controller->Jumping() && !controller->Crouching() && (velocity.y == 0.f || !m_DoubleJumped)) { + if (velocity.y == 0.f) { + m_DoubleJumped = false; + } + else { + m_DoubleJumped = true; + } velocity.y += 4.f; } From 7054822be20f1ff83f0693e2c944aaa82df0f18a Mon Sep 17 00:00:00 2001 From: Tleety Date: Mon, 1 Feb 2016 11:12:03 +0100 Subject: [PATCH 04/19] SceneLight component now working --- .../Rendering/DrawColorCorrectionPass.h | 4 +--- include/Engine/Rendering/RenderQueue.h | 4 ++++ resources/Schema/Entities/EditorTestWorld.xml | 21 ++++++++++++------- resources/Shaders/ForwardPlus.frag.glsl | 5 ++--- .../Rendering/DrawColorCorrectionPass.cpp | 6 +++--- src/Engine/Rendering/DrawFinalPass.cpp | 9 ++++++++ src/Engine/Rendering/RenderSystem.cpp | 15 ++++++------- src/Engine/Rendering/Renderer.cpp | 4 ++-- 8 files changed, 41 insertions(+), 27 deletions(-) diff --git a/include/Engine/Rendering/DrawColorCorrectionPass.h b/include/Engine/Rendering/DrawColorCorrectionPass.h index f507b53c..fcde73d7 100644 --- a/include/Engine/Rendering/DrawColorCorrectionPass.h +++ b/include/Engine/Rendering/DrawColorCorrectionPass.h @@ -17,15 +17,13 @@ public: void InitializeFrameBuffers(); void InitializeShaderPrograms(); - void Draw(GLuint sceneTexture, GLuint bloomTexture); + void Draw(GLuint sceneTexture, GLuint bloomTexture, GLfloat gamma, GLfloat exposure); private: const IRenderer* m_Renderer; ShaderProgram* m_ColorCorrectionProgram; Model* m_ScreenQuad; - GLfloat m_Exposure = 1; - GLfloat m_Gamma = 2.2; }; #endif \ No newline at end of file diff --git a/include/Engine/Rendering/RenderQueue.h b/include/Engine/Rendering/RenderQueue.h index 57371146..af9d928e 100644 --- a/include/Engine/Rendering/RenderQueue.h +++ b/include/Engine/Rendering/RenderQueue.h @@ -26,6 +26,7 @@ struct RenderScene std::list> DirectionalLightJobs; Rectangle Viewport; bool ClearDepth = false; + glm::vec4 AmbientColor; void Clear() { @@ -40,6 +41,9 @@ struct RenderScene struct RenderFrame { public: + //TODO: Getters + GLfloat Gamma = 2.2f; + GLfloat Exposure = 1.f; void Add(RenderScene &scene) { diff --git a/resources/Schema/Entities/EditorTestWorld.xml b/resources/Schema/Entities/EditorTestWorld.xml index b7baea28..de65f736 100755 --- a/resources/Schema/Entities/EditorTestWorld.xml +++ b/resources/Schema/Entities/EditorTestWorld.xml @@ -18,7 +18,7 @@ - + @@ -43,7 +43,7 @@ - + @@ -85,7 +85,7 @@ Run - + 1 @@ -101,7 +101,7 @@ Walk - + 1 @@ -163,7 +163,7 @@ - + @@ -227,7 +227,7 @@ - + @@ -259,7 +259,7 @@ - + @@ -299,6 +299,13 @@ + + + + + + + diff --git a/resources/Shaders/ForwardPlus.frag.glsl b/resources/Shaders/ForwardPlus.frag.glsl index 16dca034..d9a2f7d5 100644 --- a/resources/Shaders/ForwardPlus.frag.glsl +++ b/resources/Shaders/ForwardPlus.frag.glsl @@ -7,6 +7,7 @@ uniform vec4 Color; uniform vec4 DiffuseColor; uniform vec2 ScreenDimensions; uniform vec4 FillColor; +uniform vec4 AmbientColor; uniform float FillPercentage; layout (binding = 0) uniform sampler2D DiffuseTexture; layout (binding = 1) uniform sampler2D NormalMapTexture; @@ -60,8 +61,6 @@ in VertexData{ out vec4 sceneColor; out vec4 bloomColor; -vec4 scene_ambient = vec4(0.3,0.3,0.3,1); - struct LightResult { vec4 Diffuse; vec4 Specular; @@ -128,7 +127,7 @@ void main() tilePos.y = int(gl_FragCoord.y/TILE_SIZE); LightResult totalLighting; - totalLighting.Diffuse = scene_ambient; + totalLighting.Diffuse = AmbientColor; int currentTile = int(floor(gl_FragCoord.x/TILE_SIZE) + (floor(gl_FragCoord.y/TILE_SIZE) * int(ScreenDimensions.x/TILE_SIZE))); int start = int(LightGrids.Data[currentTile].Start); diff --git a/src/Engine/Rendering/DrawColorCorrectionPass.cpp b/src/Engine/Rendering/DrawColorCorrectionPass.cpp index 9b9e2236..95de26e2 100644 --- a/src/Engine/Rendering/DrawColorCorrectionPass.cpp +++ b/src/Engine/Rendering/DrawColorCorrectionPass.cpp @@ -20,7 +20,7 @@ void DrawColorCorrectionPass::InitializeShaderPrograms() m_ColorCorrectionProgram->Link(); } -void DrawColorCorrectionPass::Draw(GLuint sceneTexture, GLuint bloomTexture) +void DrawColorCorrectionPass::Draw(GLuint sceneTexture, GLuint bloomTexture, GLfloat gamma, GLfloat exposure) { //glBindFramebuffer(GL_FRAMEBUFFER, 0); GLERROR("DrawScreenQuadPass::Draw: Pre"); @@ -28,8 +28,8 @@ void DrawColorCorrectionPass::Draw(GLuint sceneTexture, GLuint bloomTexture) DrawScreenQuadPassState state = DrawScreenQuadPassState(); m_ColorCorrectionProgram->Bind(); glClear(GL_COLOR_BUFFER_BIT); - glUniform1f(glGetUniformLocation(m_ColorCorrectionProgram->GetHandle(), "Exposure"), m_Exposure); - glUniform1f(glGetUniformLocation(m_ColorCorrectionProgram->GetHandle(), "Gamma"), m_Gamma); + glUniform1f(glGetUniformLocation(m_ColorCorrectionProgram->GetHandle(), "Exposure"), exposure); + glUniform1f(glGetUniformLocation(m_ColorCorrectionProgram->GetHandle(), "Gamma"), gamma); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, sceneTexture); diff --git a/src/Engine/Rendering/DrawFinalPass.cpp b/src/Engine/Rendering/DrawFinalPass.cpp index 48ea4144..89538c9a 100644 --- a/src/Engine/Rendering/DrawFinalPass.cpp +++ b/src/Engine/Rendering/DrawFinalPass.cpp @@ -141,18 +141,22 @@ void DrawFinalPass::DrawModelRenderQueues(std::list>& glBindVertexArray(explosionEffectJob->Model->VAO); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, explosionEffectJob->Model->ElementBuffer); glDrawElements(GL_TRIANGLES, explosionEffectJob->EndIndex - explosionEffectJob->StartIndex + 1, GL_UNSIGNED_INT, (void*)(explosionEffectJob->StartIndex*sizeof(unsigned int))); + GLERROR("DrawFinalPass::Model: 1"); } else { auto modelJob = std::dynamic_pointer_cast(job); if (modelJob) { //bind forward program m_ForwardPlusProgram->Bind(); + GLERROR("DrawFinalPass::Model: 2"); //bind uniforms BindModelUniforms(forwardHandle, modelJob, scene); + GLERROR("DrawFinalPass::Model: 3"); //bind textures BindModelTextures(modelJob); + GLERROR("DrawFinalPass::Model: 4"); if (modelJob->Model->m_RawModel->m_Skeleton != nullptr) { @@ -161,6 +165,7 @@ void DrawFinalPass::DrawModelRenderQueues(std::list>& glUniformMatrix4fv(glGetUniformLocation(forwardHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); } } + GLERROR("DrawFinalPass::Model: 5"); //draw glBindVertexArray(modelJob->Model->VAO); @@ -175,6 +180,7 @@ void DrawFinalPass::DrawModelRenderQueues(std::list>& void DrawFinalPass::BindExplosionUniforms(GLuint shaderHandle, std::shared_ptr& job, RenderScene& scene) { + glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "AmbientColor"), 1, GL_FALSE, glm::value_ptr(scene.AmbientColor)); 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->Resolution().Width, m_Renderer->Resolution().Height); @@ -196,8 +202,10 @@ void DrawFinalPass::BindExplosionUniforms(GLuint shaderHandle, std::shared_ptr& job, RenderScene& scene) { + glUniform4fv(glGetUniformLocation(shaderHandle, "AmbientColor"), 1, glm::value_ptr(scene.AmbientColor)); 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->Resolution().Width, m_Renderer->Resolution().Height); glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(job->Matrix)); @@ -205,6 +213,7 @@ void DrawFinalPass::BindModelUniforms(GLuint shaderHandle, std::shared_ptrDiffuseColor)); glUniform4fv(glGetUniformLocation(shaderHandle, "FillColor"), 1, glm::value_ptr(job->FillColor)); glUniform1f(glGetUniformLocation(shaderHandle, "FillPercentage"), job->FillPercentage); + } diff --git a/src/Engine/Rendering/RenderSystem.cpp b/src/Engine/Rendering/RenderSystem.cpp index 98373a61..b51ab7f8 100644 --- a/src/Engine/Rendering/RenderSystem.cpp +++ b/src/Engine/Rendering/RenderSystem.cpp @@ -240,20 +240,17 @@ void RenderSystem::Update(double dt) m_Camera->SetOrientation(Transform::AbsoluteOrientation(m_CurrentCamera)); } - RenderScene scene; scene.Camera = m_Camera; scene.Viewport = Rectangle(1280, 720); - //auto cSceneLight = m_Renderer->m_World->GetComponents("SceneLight"); - //if (cSceneLight != nullptr) { - // m_Gamma = (double)(*cSceneLight->begin())["Gamma"]; - // m_Exposure = (double)(*cSceneLight->begin())["Exposure"]; - //} + auto cSceneLight = m_World->GetComponents("SceneLight"); + if (cSceneLight != nullptr) { + m_RenderFrame->Gamma = (double)(*cSceneLight->begin())["Gamma"]; + m_RenderFrame->Exposure = (double)(*cSceneLight->begin())["Exposure"]; + scene.AmbientColor = (glm::vec4)(*cSceneLight->begin())["AmbientColor"]; + } - //scene.ambient - //scene.gamma - //scene.exponent fillModels(scene.OpaqueObjects, scene.TransparentObjects); fillPointLights(scene.PointLightJobs, m_World); fillDirectionalLights(scene.DirectionalLightJobs, m_World); diff --git a/src/Engine/Rendering/Renderer.cpp b/src/Engine/Rendering/Renderer.cpp index 55cd8b03..0ec593df 100644 --- a/src/Engine/Rendering/Renderer.cpp +++ b/src/Engine/Rendering/Renderer.cpp @@ -120,8 +120,8 @@ void Renderer::Draw(RenderFrame& frame) } m_DrawBloomPass->Draw(m_DrawFinalPass->BloomTexture()); - if(m_DebugTextureToDraw == 0) { - m_DrawColorCorrectionPass->Draw(m_DrawFinalPass->SceneTexture(), m_DrawBloomPass->GaussianTexture()); + if (m_DebugTextureToDraw == 0) { + m_DrawColorCorrectionPass->Draw(m_DrawFinalPass->SceneTexture(), m_DrawBloomPass->GaussianTexture(), frame.Gamma, frame.Exposure); } if (m_DebugTextureToDraw == 1) { m_DrawScreenQuadPass->Draw(m_DrawFinalPass->SceneTexture()); From 53cae25eb2e23a209c821b53854ea3861ddca45b Mon Sep 17 00:00:00 2001 From: Tleety Date: Mon, 1 Feb 2016 16:56:55 +0100 Subject: [PATCH 05/19] WIP on widget fuckery --- include/Engine/Rendering/Util/GLError.h | 2 +- resources/Shaders/ExplosionEffect.geom.glsl | 12 ++- resources/Shaders/ForwardPlus.frag.glsl | 6 +- resources/Shaders/ForwardPlus.vert.glsl | 2 +- src/Engine/Editor/EditorRenderSystem.cpp | 2 +- .../Rendering/DrawColorCorrectionPass.cpp | 2 +- src/Engine/Rendering/DrawFinalPass.cpp | 75 +++++++++++++++---- src/Engine/Rendering/FrameBuffer.cpp | 7 -- 8 files changed, 76 insertions(+), 32 deletions(-) diff --git a/include/Engine/Rendering/Util/GLError.h b/include/Engine/Rendering/Util/GLError.h index 754623d1..2b244e1c 100644 --- a/include/Engine/Rendering/Util/GLError.h +++ b/include/Engine/Rendering/Util/GLError.h @@ -9,7 +9,7 @@ inline bool _GLERROR(const char* info, const char* file, const char* func, unsig GLenum error = glGetError(); if (error != GL_NO_ERROR) { - _LOG(LOG_LEVEL_ERROR, file, func, line, "GL Error: %s, %i, %s", info, error, gluErrorString(error)); + _LOG(LOG_LEVEL_ERROR, file, func, line, "GL Error: %s\nError code: %i, %s\n", info, error, gluErrorString(error)); return true; } diff --git a/resources/Shaders/ExplosionEffect.geom.glsl b/resources/Shaders/ExplosionEffect.geom.glsl index cb91b545..34e6230d 100644 --- a/resources/Shaders/ExplosionEffect.geom.glsl +++ b/resources/Shaders/ExplosionEffect.geom.glsl @@ -17,6 +17,8 @@ uniform bool ExponentialAccelaration; in VertexData{ vec3 Position; vec3 Normal; + vec3 Tangent; + vec3 BiTangent; vec2 TextureCoordinate; vec4 ExplosionColor; }Input[]; @@ -24,6 +26,8 @@ in VertexData{ out VertexData{ vec3 Position; vec3 Normal; + vec3 Tangent; + vec3 BiTangent; vec2 TextureCoordinate; vec4 ExplosionColor; }Output; @@ -132,6 +136,8 @@ void main() Output.Normal = Input[i].Normal; Output.Position = Input[i].Position; Output.TextureCoordinate = Input[i].TextureCoordinate; + Output.Tangent = Input[i].Tangent; + Output.BiTangent = Input[i].BiTangent; // convert to model space for the gravity to always be in -y vec4 ExplodedPositionInModelSpace = M * vec4(ExplodedPosition, 1.0); @@ -154,7 +160,7 @@ void main() // if explosion color should be affected by distance instead of time... if (ColorByDistance == true) { - Output.ExplosionColor = vec4(0.0); + Output.ExplosionColor = vec4(1.0); } else { @@ -168,7 +174,9 @@ void main() Output.Normal = Input[i].Normal; Output.Position = Input[i].Position; Output.TextureCoordinate = Input[i].TextureCoordinate; - + Output.Tangent = Input[i].Tangent; + Output.BiTangent = Input[i].BiTangent; + // no change in position, pass through vertex gl_Position = gl_in[i].gl_Position; EmitVertex(); diff --git a/resources/Shaders/ForwardPlus.frag.glsl b/resources/Shaders/ForwardPlus.frag.glsl index d9a2f7d5..025068f7 100644 --- a/resources/Shaders/ForwardPlus.frag.glsl +++ b/resources/Shaders/ForwardPlus.frag.glsl @@ -14,7 +14,6 @@ layout (binding = 1) uniform sampler2D NormalMapTexture; layout (binding = 2) uniform sampler2D SpecularMapTexture; layout (binding = 3) uniform sampler2D GlowMapTexture; - #define TILE_SIZE 16 struct LightSource { @@ -149,8 +148,9 @@ void main() totalLighting.Specular += light_result.Specular; } - - vec4 color_result = (DiffuseColor + Input.ExplosionColor) * (totalLighting.Diffuse + (totalLighting.Specular * specularTexel)) * diffuseTexel * Color; + vec4 color_result = Color * diffuseTexel * DiffuseColor * Input.ExplosionColor; + color_result = color_result * (totalLighting.Diffuse + (totalLighting.Specular * specularTexel)); + //vec4 color_result = (DiffuseColor + Input.ExplosionColor) * (totalLighting.Diffuse + (totalLighting.Specular * specularTexel)) * diffuseTexel * Color; float pos = ((P * vec4(Input.Position, 1)).y + 1.0)/2.0; diff --git a/resources/Shaders/ForwardPlus.vert.glsl b/resources/Shaders/ForwardPlus.vert.glsl index 1a7cca12..4e1f8734 100644 --- a/resources/Shaders/ForwardPlus.vert.glsl +++ b/resources/Shaders/ForwardPlus.vert.glsl @@ -41,5 +41,5 @@ void main() Output.Normal = vec3(M * vec4(Normal, 0.0)); Output.Tangent = vec3(M * vec4(Tangent, 0.0)); Output.BiTangent = vec3(M * vec4(BiTangent, 0.0)); - Output.ExplosionColor = vec4(0.0); + Output.ExplosionColor = vec4(1.0); } \ No newline at end of file diff --git a/src/Engine/Editor/EditorRenderSystem.cpp b/src/Engine/Editor/EditorRenderSystem.cpp index 898eac9d..d1b9083c 100644 --- a/src/Engine/Editor/EditorRenderSystem.cpp +++ b/src/Engine/Editor/EditorRenderSystem.cpp @@ -49,7 +49,7 @@ void EditorRenderSystem::Update(double dt) glm::mat4 modelMatrix = Transform::ModelMatrix(entity.ID, entity.World); for (auto matGroup : model->MaterialGroups()) { std::shared_ptr modelJob = std::make_shared(model, scene.Camera, modelMatrix, matGroup, cModel, entity.World, glm::vec4(0), 0.f); - if(cModel["Transparent"]) { + if (cModel["Transparent"]) { scene.TransparentObjects.push_back(modelJob); } else { scene.OpaqueObjects.push_back(modelJob); diff --git a/src/Engine/Rendering/DrawColorCorrectionPass.cpp b/src/Engine/Rendering/DrawColorCorrectionPass.cpp index 95de26e2..45401bce 100644 --- a/src/Engine/Rendering/DrawColorCorrectionPass.cpp +++ b/src/Engine/Rendering/DrawColorCorrectionPass.cpp @@ -27,7 +27,7 @@ void DrawColorCorrectionPass::Draw(GLuint sceneTexture, GLuint bloomTexture, GLf DrawScreenQuadPassState state = DrawScreenQuadPassState(); m_ColorCorrectionProgram->Bind(); - glClear(GL_COLOR_BUFFER_BIT); + //glClear(GL_COLOR_BUFFER_BIT); glUniform1f(glGetUniformLocation(m_ColorCorrectionProgram->GetHandle(), "Exposure"), exposure); glUniform1f(glGetUniformLocation(m_ColorCorrectionProgram->GetHandle(), "Gamma"), gamma); diff --git a/src/Engine/Rendering/DrawFinalPass.cpp b/src/Engine/Rendering/DrawFinalPass.cpp index 89538c9a..4fde4eae 100644 --- a/src/Engine/Rendering/DrawFinalPass.cpp +++ b/src/Engine/Rendering/DrawFinalPass.cpp @@ -44,6 +44,7 @@ void DrawFinalPass::InitializeShaderPrograms() m_ForwardPlusProgram->BindFragDataLocation(0, "sceneColor"); m_ForwardPlusProgram->BindFragDataLocation(1, "bloomColor"); m_ForwardPlusProgram->Link(); + GLERROR("Creating forward+ program"); m_ExplosionEffectProgram = ResourceManager::Load("#ExplosionEffectProgram"); m_ExplosionEffectProgram->AddShader(std::shared_ptr(new VertexShader("Shaders/ForwardPlus.vert.glsl"))); @@ -53,11 +54,12 @@ void DrawFinalPass::InitializeShaderPrograms() m_ExplosionEffectProgram->BindFragDataLocation(0, "sceneColor"); m_ExplosionEffectProgram->BindFragDataLocation(1, "bloomColor"); m_ExplosionEffectProgram->Link(); + GLERROR("Creating explosion program"); } void DrawFinalPass::Draw(RenderScene& scene) { - GLERROR("DrawFinalPass::Draw: Pre"); + GLERROR("Pre"); DrawFinalPassState* state = new DrawFinalPassState(m_FinalPassFrameBuffer.GetHandle()); if (scene.ClearDepth) { @@ -65,12 +67,12 @@ void DrawFinalPass::Draw(RenderScene& scene) } DrawModelRenderQueues(scene.OpaqueObjects, scene); - GLERROR("DrawFinalPass::Draw: OpaqueObjects"); + GLERROR("OpaqueObjects"); DrawModelRenderQueues(scene.TransparentObjects, scene); - GLERROR("DrawFinalPass::Draw: TransparentObjects"); + GLERROR("TransparentObjects"); - GLERROR("DrawFinalPass::Draw: END"); delete state; + GLERROR("END"); } @@ -111,7 +113,9 @@ void DrawFinalPass::GenerateMipMapTexture(GLuint* texture, GLenum wrapping, glm: void DrawFinalPass::DrawModelRenderQueues(std::list>& job, RenderScene& scene) { GLuint forwardHandle = m_ForwardPlusProgram->GetHandle(); + GLERROR("forwardHandle"); GLuint explosionHandle = m_ExplosionEffectProgram->GetHandle(); + GLERROR("explosionHandle"); glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 1, m_LightCullingPass->LightSSBO()); glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 2, m_LightCullingPass->LightGridSSBO()); @@ -122,10 +126,21 @@ void DrawFinalPass::DrawModelRenderQueues(std::list>& auto explosionEffectJob = std::dynamic_pointer_cast(job); if(explosionEffectJob) { //Bind program + if(GLERROR("Prebind")) { + continue; + } m_ExplosionEffectProgram->Bind(); + if(GLERROR("BindProgram")) { + continue; + } + + //glDisable(GL_CULL_FACE); //Bind uniforms BindExplosionUniforms(explosionHandle, explosionEffectJob, scene); + if(GLERROR("BindExplosionUniforms")) { + continue; + } if (explosionEffectJob->Model->m_RawModel->m_Skeleton != nullptr) { @@ -134,29 +149,35 @@ void DrawFinalPass::DrawModelRenderQueues(std::list>& glUniformMatrix4fv(glGetUniformLocation(explosionHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); } } + if(GLERROR("Animation")) { + continue; + } //bind textures BindExplosionTextures(explosionEffectJob); + if(GLERROR("BindExplosionTextures")) { + continue; + } //draw glBindVertexArray(explosionEffectJob->Model->VAO); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, explosionEffectJob->Model->ElementBuffer); glDrawElements(GL_TRIANGLES, explosionEffectJob->EndIndex - explosionEffectJob->StartIndex + 1, GL_UNSIGNED_INT, (void*)(explosionEffectJob->StartIndex*sizeof(unsigned int))); - GLERROR("DrawFinalPass::Model: 1"); + //glEnable(GL_CULL_FACE); + if(GLERROR("explosion effect end")) { + continue; + } } else { auto modelJob = std::dynamic_pointer_cast(job); if (modelJob) { //bind forward program m_ForwardPlusProgram->Bind(); - GLERROR("DrawFinalPass::Model: 2"); //bind uniforms BindModelUniforms(forwardHandle, modelJob, scene); - GLERROR("DrawFinalPass::Model: 3"); //bind textures BindModelTextures(modelJob); - GLERROR("DrawFinalPass::Model: 4"); if (modelJob->Model->m_RawModel->m_Skeleton != nullptr) { @@ -165,13 +186,14 @@ void DrawFinalPass::DrawModelRenderQueues(std::list>& glUniformMatrix4fv(glGetUniformLocation(forwardHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); } } - GLERROR("DrawFinalPass::Model: 5"); //draw glBindVertexArray(modelJob->Model->VAO); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, modelJob->Model->ElementBuffer); glDrawElements(GL_TRIANGLES, modelJob->EndIndex - modelJob->StartIndex + 1, GL_UNSIGNED_INT, (void*)(modelJob->StartIndex*sizeof(unsigned int))); - GLERROR("DrawFinalPass::Model: END"); + if(GLERROR("models end")) { + continue; + } } } } @@ -180,40 +202,46 @@ void DrawFinalPass::DrawModelRenderQueues(std::list>& void DrawFinalPass::BindExplosionUniforms(GLuint shaderHandle, std::shared_ptr& job, RenderScene& scene) { - glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "AmbientColor"), 1, GL_FALSE, glm::value_ptr(scene.AmbientColor)); + glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(job->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())); + glUniform2f(glGetUniformLocation(shaderHandle, "ScreenDimensions"), m_Renderer->Resolution().Width, m_Renderer->Resolution().Height); - glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(job->Matrix)); - glUniform4fv(glGetUniformLocation(shaderHandle, "Color"), 1, glm::value_ptr(job->Color)); glUniform3fv(glGetUniformLocation(shaderHandle, "ExplosionOrigin"), 1, glm::value_ptr(job->ExplosionOrigin)); glUniform1f(glGetUniformLocation(shaderHandle, "TimeSinceDeath"), job->TimeSinceDeath); glUniform1f(glGetUniformLocation(shaderHandle, "ExplosionDuration"), job->ExplosionDuration); glUniform4fv(glGetUniformLocation(shaderHandle, "EndColor"), 1, glm::value_ptr(job->EndColor)); glUniform1i(glGetUniformLocation(shaderHandle, "Randomness"), job->Randomness); + glUniform1fv(glGetUniformLocation(shaderHandle, "RandomNumbers"), 50, job->RandomNumbers.data()); glUniform1f(glGetUniformLocation(shaderHandle, "RandomnessScalar"), job->RandomnessScalar); glUniform2fv(glGetUniformLocation(shaderHandle, "Velocity"), 1, glm::value_ptr(job->Velocity)); glUniform1i(glGetUniformLocation(shaderHandle, "ColorByDistance"), job->ColorByDistance); glUniform1i(glGetUniformLocation(shaderHandle, "ExponentialAccelaration"), job->ExponentialAccelaration); + + glUniform4fv(glGetUniformLocation(shaderHandle, "Color"), 1, glm::value_ptr(job->Color)); glUniform4fv(glGetUniformLocation(shaderHandle, "DiffuseColor"), 1, glm::value_ptr(job->DiffuseColor)); - glUniform1fv(glGetUniformLocation(shaderHandle, "RandomNumbers"), 50, job->RandomNumbers.data()); + glUniform4fv(glGetUniformLocation(shaderHandle, "FillColor"), 1, glm::value_ptr(job->FillColor)); + glUniform1f(glGetUniformLocation(shaderHandle, "FillPercentage"), job->FillPercentage); + glUniform4fv(glGetUniformLocation(shaderHandle, "AmbientColor"), 1, glm::value_ptr(scene.AmbientColor)); + GLERROR("END"); } void DrawFinalPass::BindModelUniforms(GLuint shaderHandle, std::shared_ptr& job, RenderScene& scene) { - glUniform4fv(glGetUniformLocation(shaderHandle, "AmbientColor"), 1, glm::value_ptr(scene.AmbientColor)); + glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(job->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())); glUniform2f(glGetUniformLocation(shaderHandle, "ScreenDimensions"), m_Renderer->Resolution().Width, m_Renderer->Resolution().Height); - glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(job->Matrix)); glUniform4fv(glGetUniformLocation(shaderHandle, "Color"), 1, glm::value_ptr(job->Color)); glUniform4fv(glGetUniformLocation(shaderHandle, "DiffuseColor"), 1, glm::value_ptr(job->DiffuseColor)); glUniform4fv(glGetUniformLocation(shaderHandle, "FillColor"), 1, glm::value_ptr(job->FillColor)); glUniform1f(glGetUniformLocation(shaderHandle, "FillPercentage"), job->FillPercentage); + glUniform4fv(glGetUniformLocation(shaderHandle, "AmbientColor"), 1, glm::value_ptr(scene.AmbientColor)); + GLERROR("END"); } @@ -225,7 +253,22 @@ void DrawFinalPass::BindExplosionTextures(std::shared_ptr& j } else { glBindTexture(GL_TEXTURE_2D, m_WhiteTexture->m_Texture); } + glActiveTexture(GL_TEXTURE1); + if (job->NormalTexture != nullptr) { + glBindTexture(GL_TEXTURE_2D, job->NormalTexture->m_Texture); + } else { + glBindTexture(GL_TEXTURE_2D, m_NeutralNormalTexture->m_Texture); + } + + glActiveTexture(GL_TEXTURE2); + if (job->SpecularTexture != nullptr) { + glBindTexture(GL_TEXTURE_2D, job->SpecularTexture->m_Texture); + } else { + glBindTexture(GL_TEXTURE_2D, m_GreyTexture->m_Texture); + } + + glActiveTexture(GL_TEXTURE3); if (job->IncandescenceTexture != nullptr) { glBindTexture(GL_TEXTURE_2D, job->IncandescenceTexture->m_Texture); } else { diff --git a/src/Engine/Rendering/FrameBuffer.cpp b/src/Engine/Rendering/FrameBuffer.cpp index b7e908cc..9677f50e 100644 --- a/src/Engine/Rendering/FrameBuffer.cpp +++ b/src/Engine/Rendering/FrameBuffer.cpp @@ -54,13 +54,6 @@ void FrameBuffer::Generate() case GL_RENDERBUFFER: glFramebufferRenderbuffer(GL_FRAMEBUFFER, (*it)->m_Attachment, (*it)->m_ResourceType, *(*it)->m_ResourceHandle); GLERROR("FrameBuffer generate: glFramebufferRenderbuffer"); - if ( (*it)->m_Attachment != GL_COLOR_ATTACHMENT0 || - (*it)->m_Attachment != GL_COLOR_ATTACHMENT1 || - (*it)->m_Attachment != GL_DEPTH_ATTACHMENT || - (*it)->m_Attachment != GL_STENCIL_ATTACHMENT) //TODO: Viktor: Fixa detta - { - LOG_ERROR("RenderBuffer Attachment not valid."); - } break; } From ed7d00c1d821fb77e674281c894759da3627d689 Mon Sep 17 00:00:00 2001 From: Tleety Date: Mon, 1 Feb 2016 18:19:38 +0100 Subject: [PATCH 06/19] Bug where widgets did not get their ambient light now fixed. --- resources/Shaders/ForwardPlus.frag.glsl | 2 +- src/Engine/Editor/EditorRenderSystem.cpp | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/resources/Shaders/ForwardPlus.frag.glsl b/resources/Shaders/ForwardPlus.frag.glsl index 025068f7..d2c1c628 100644 --- a/resources/Shaders/ForwardPlus.frag.glsl +++ b/resources/Shaders/ForwardPlus.frag.glsl @@ -126,7 +126,7 @@ void main() tilePos.y = int(gl_FragCoord.y/TILE_SIZE); LightResult totalLighting; - totalLighting.Diffuse = AmbientColor; + totalLighting.Diffuse = vec4(AmbientColor.rgb, 1.0); int currentTile = int(floor(gl_FragCoord.x/TILE_SIZE) + (floor(gl_FragCoord.y/TILE_SIZE) * int(ScreenDimensions.x/TILE_SIZE))); int start = int(LightGrids.Data[currentTile].Start); diff --git a/src/Engine/Editor/EditorRenderSystem.cpp b/src/Engine/Editor/EditorRenderSystem.cpp index d1b9083c..ef1a33ce 100644 --- a/src/Engine/Editor/EditorRenderSystem.cpp +++ b/src/Engine/Editor/EditorRenderSystem.cpp @@ -23,6 +23,16 @@ void EditorRenderSystem::Update(double dt) scene.Camera = m_EditorCamera; scene.Viewport = Rectangle(1920, 1080); + auto cSceneLight = m_World->GetComponents("SceneLight"); + if (cSceneLight != nullptr) { + //m_RenderFrame->Gamma = (double)(*cSceneLight->begin())["Gamma"]; + //m_RenderFrame->Exposure = (double)(*cSceneLight->begin())["Exposure"]; + //scene.AmbientColor = (glm::vec4)(*cSceneLight->begin())["AmbientColor"]; + m_RenderFrame->Gamma = 2.2; + m_RenderFrame->Exposure = 1.0; + scene.AmbientColor = glm::vec4(0.6, 0.5, 0.5, 1.0); + } + auto models = m_World->GetComponents("Model"); if (models != nullptr) { for (auto& cModel : *models) { From a188a3f7faaab87c03876dde9011943cbd510a36 Mon Sep 17 00:00:00 2001 From: Tleety Date: Mon, 1 Feb 2016 18:22:36 +0100 Subject: [PATCH 07/19] Removed widget pointlight since it is now redundant --- resources/Schema/Entities/EditorWidgetTranslate.xml | 9 --------- src/Engine/Editor/EditorRenderSystem.cpp | 2 +- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/resources/Schema/Entities/EditorWidgetTranslate.xml b/resources/Schema/Entities/EditorWidgetTranslate.xml index d4ed5e76..c6dba4d9 100644 --- a/resources/Schema/Entities/EditorWidgetTranslate.xml +++ b/resources/Schema/Entities/EditorWidgetTranslate.xml @@ -84,15 +84,6 @@ - - - - - - - - - diff --git a/src/Engine/Editor/EditorRenderSystem.cpp b/src/Engine/Editor/EditorRenderSystem.cpp index ef1a33ce..de783f66 100644 --- a/src/Engine/Editor/EditorRenderSystem.cpp +++ b/src/Engine/Editor/EditorRenderSystem.cpp @@ -30,7 +30,7 @@ void EditorRenderSystem::Update(double dt) //scene.AmbientColor = (glm::vec4)(*cSceneLight->begin())["AmbientColor"]; m_RenderFrame->Gamma = 2.2; m_RenderFrame->Exposure = 1.0; - scene.AmbientColor = glm::vec4(0.6, 0.5, 0.5, 1.0); + scene.AmbientColor = glm::vec4(0.8, 0.8, 0.8, 1.0); } auto models = m_World->GetComponents("Model"); From 782c1a388a1fddb3c9b64b239689bb2d168a5856 Mon Sep 17 00:00:00 2001 From: Tleety Date: Mon, 1 Feb 2016 18:23:40 +0100 Subject: [PATCH 08/19] Comment --- src/Engine/Editor/EditorRenderSystem.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Engine/Editor/EditorRenderSystem.cpp b/src/Engine/Editor/EditorRenderSystem.cpp index de783f66..572dd83d 100644 --- a/src/Engine/Editor/EditorRenderSystem.cpp +++ b/src/Engine/Editor/EditorRenderSystem.cpp @@ -25,9 +25,7 @@ void EditorRenderSystem::Update(double dt) auto cSceneLight = m_World->GetComponents("SceneLight"); if (cSceneLight != nullptr) { - //m_RenderFrame->Gamma = (double)(*cSceneLight->begin())["Gamma"]; - //m_RenderFrame->Exposure = (double)(*cSceneLight->begin())["Exposure"]; - //scene.AmbientColor = (glm::vec4)(*cSceneLight->begin())["AmbientColor"]; + //these are hardcoded since they want special light treatment and a component just for widgets is stupid. m_RenderFrame->Gamma = 2.2; m_RenderFrame->Exposure = 1.0; scene.AmbientColor = glm::vec4(0.8, 0.8, 0.8, 1.0); From 8299b99e2f33ed24b20b04eef98d4b0d4c6998e8 Mon Sep 17 00:00:00 2001 From: Tleety Date: Mon, 1 Feb 2016 19:08:46 +0100 Subject: [PATCH 09/19] Test world changes and some other small fixes --- assets | 2 +- resources/Schema/Entities/EditorTestWorld.xml | 44 ++++++++++++++----- src/Engine/Editor/EditorRenderSystem.cpp | 2 - src/Engine/Rendering/DrawFinalPass.cpp | 4 +- 4 files changed, 36 insertions(+), 16 deletions(-) diff --git a/assets b/assets index 091ad5c0..01a73005 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 091ad5c01bf7b6ef5501fc907fc610576a4a45ea +Subproject commit 01a73005d45c1d5574428536be88f085f4f844ce diff --git a/resources/Schema/Entities/EditorTestWorld.xml b/resources/Schema/Entities/EditorTestWorld.xml index de65f736..6ffbad89 100755 --- a/resources/Schema/Entities/EditorTestWorld.xml +++ b/resources/Schema/Entities/EditorTestWorld.xml @@ -38,12 +38,12 @@ Models/DirectionalLightWidget.mesh - 1.0499999523162842 + 1 - + @@ -62,11 +62,31 @@ - Models/SecondaryWeapon.mesh + Models/DefenderGunBlue.mesh - - + + + + + + + + + + true + + 0.33345697685444975 + + + + Models/DefenderGunRed.mesh + true + false + + + + @@ -85,7 +105,7 @@ Run - + 1 @@ -101,7 +121,7 @@ Walk - + 1 @@ -163,7 +183,7 @@ - + @@ -227,7 +247,7 @@ - + @@ -259,7 +279,7 @@ - + @@ -301,7 +321,9 @@ - + + 2 + diff --git a/src/Engine/Editor/EditorRenderSystem.cpp b/src/Engine/Editor/EditorRenderSystem.cpp index 572dd83d..374704dc 100644 --- a/src/Engine/Editor/EditorRenderSystem.cpp +++ b/src/Engine/Editor/EditorRenderSystem.cpp @@ -26,8 +26,6 @@ void EditorRenderSystem::Update(double dt) auto cSceneLight = m_World->GetComponents("SceneLight"); if (cSceneLight != nullptr) { //these are hardcoded since they want special light treatment and a component just for widgets is stupid. - m_RenderFrame->Gamma = 2.2; - m_RenderFrame->Exposure = 1.0; scene.AmbientColor = glm::vec4(0.8, 0.8, 0.8, 1.0); } diff --git a/src/Engine/Rendering/DrawFinalPass.cpp b/src/Engine/Rendering/DrawFinalPass.cpp index ae2ebefc..8247797e 100644 --- a/src/Engine/Rendering/DrawFinalPass.cpp +++ b/src/Engine/Rendering/DrawFinalPass.cpp @@ -134,7 +134,7 @@ void DrawFinalPass::DrawModelRenderQueues(std::list>& continue; } - //glDisable(GL_CULL_FACE); + glDisable(GL_CULL_FACE); //Bind uniforms BindExplosionUniforms(explosionHandle, explosionEffectJob, scene); @@ -162,7 +162,7 @@ void DrawFinalPass::DrawModelRenderQueues(std::list>& glBindVertexArray(explosionEffectJob->Model->VAO); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, explosionEffectJob->Model->ElementBuffer); glDrawElements(GL_TRIANGLES, explosionEffectJob->EndIndex - explosionEffectJob->StartIndex + 1, GL_UNSIGNED_INT, (void*)(explosionEffectJob->StartIndex*sizeof(unsigned int))); - //glEnable(GL_CULL_FACE); + glEnable(GL_CULL_FACE); if(GLERROR("explosion effect end")) { continue; } From 9c2e459e0c35867f19bb50d87e4b22c1c3df1a56 Mon Sep 17 00:00:00 2001 From: Tleety Date: Tue, 2 Feb 2016 10:58:00 +0100 Subject: [PATCH 10/19] Deatheffect color now correctly calculated --- assets | 2 +- resources/Schema/Entities/EditorTestWorld.xml | 34 +++++++++++-------- resources/Shaders/ExplosionEffect.geom.glsl | 18 +++++++--- resources/Shaders/ForwardPlus.frag.glsl | 3 +- resources/Shaders/ForwardPlus.vert.glsl | 2 ++ 5 files changed, 38 insertions(+), 21 deletions(-) diff --git a/assets b/assets index 01a73005..763d7c5c 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 01a73005d45c1d5574428536be88f085f4f844ce +Subproject commit 763d7c5c0dcb84722221490b5ef9ed0aad18be06 diff --git a/resources/Schema/Entities/EditorTestWorld.xml b/resources/Schema/Entities/EditorTestWorld.xml index 6ffbad89..3c521e3f 100755 --- a/resources/Schema/Entities/EditorTestWorld.xml +++ b/resources/Schema/Entities/EditorTestWorld.xml @@ -43,15 +43,25 @@ - + + + true + + + 0.9332666733480437 + 5 + + 3 + Models/Assault.mesh + true @@ -62,23 +72,17 @@ - Models/DefenderGunBlue.mesh + Models/AssaultWeapon.mesh + true - - - true - - 0.33345697685444975 - - Models/DefenderGunRed.mesh true @@ -105,7 +109,7 @@ Run - + 1 @@ -121,7 +125,7 @@ Walk - + 1 @@ -183,7 +187,7 @@ - + @@ -247,7 +251,7 @@ - + @@ -279,7 +283,7 @@ - + @@ -322,7 +326,7 @@ - 2 + 1.3999999761581421 diff --git a/resources/Shaders/ExplosionEffect.geom.glsl b/resources/Shaders/ExplosionEffect.geom.glsl index 34e6230d..44b44aa6 100644 --- a/resources/Shaders/ExplosionEffect.geom.glsl +++ b/resources/Shaders/ExplosionEffect.geom.glsl @@ -21,6 +21,7 @@ in VertexData{ vec3 BiTangent; vec2 TextureCoordinate; vec4 ExplosionColor; + float ExplosionPercentageElapsed; }Input[]; out VertexData{ @@ -30,6 +31,7 @@ out VertexData{ vec3 BiTangent; vec2 TextureCoordinate; vec4 ExplosionColor; + float ExplosionPercentageElapsed; }Output; layout(triangles) in; @@ -118,12 +120,17 @@ void main() { // calculate the max distance (s) the triangle will move float s = (randomVelocity.x * ExplosionDuration) + (0.5 * a * pow(ExplosionDuration, 2)); + float te = (length(triangleCenter2ExplosionRadius) / s); - Output.ExplosionColor = EndColor * (length(triangleCenter2ExplosionRadius) / s); + Output.ExplosionColor = EndColor; + Output.ExplosionPercentageElapsed = te; + } else { - Output.ExplosionColor = EndColor * timePercetage; + Output.ExplosionColor = EndColor; + Output.ExplosionPercentageElapsed = timePercetage; + } // for every vertex on the triangle... @@ -160,11 +167,14 @@ void main() // if explosion color should be affected by distance instead of time... if (ColorByDistance == true) { - Output.ExplosionColor = vec4(1.0); + Output.ExplosionColor = EndColor; + Output.ExplosionPercentageElapsed = 0.0; } else { - Output.ExplosionColor = EndColor * timePercetage; + Output.ExplosionColor = EndColor; + Output.ExplosionPercentageElapsed = timePercetage; + } // for every vertex on the triangle... diff --git a/resources/Shaders/ForwardPlus.frag.glsl b/resources/Shaders/ForwardPlus.frag.glsl index d2c1c628..3431ed6b 100644 --- a/resources/Shaders/ForwardPlus.frag.glsl +++ b/resources/Shaders/ForwardPlus.frag.glsl @@ -55,6 +55,7 @@ in VertexData{ vec3 BiTangent; vec2 TextureCoordinate; vec4 ExplosionColor; + float ExplosionPercentageElapsed; }Input; out vec4 sceneColor; @@ -148,7 +149,7 @@ void main() totalLighting.Specular += light_result.Specular; } - vec4 color_result = Color * diffuseTexel * DiffuseColor * Input.ExplosionColor; + vec4 color_result = mix((Color * diffuseTexel * DiffuseColor), Input.ExplosionColor, Input.ExplosionPercentageElapsed); color_result = color_result * (totalLighting.Diffuse + (totalLighting.Specular * specularTexel)); //vec4 color_result = (DiffuseColor + Input.ExplosionColor) * (totalLighting.Diffuse + (totalLighting.Specular * specularTexel)) * diffuseTexel * Color; diff --git a/resources/Shaders/ForwardPlus.vert.glsl b/resources/Shaders/ForwardPlus.vert.glsl index 4e1f8734..3b3e931c 100644 --- a/resources/Shaders/ForwardPlus.vert.glsl +++ b/resources/Shaders/ForwardPlus.vert.glsl @@ -20,6 +20,7 @@ out VertexData{ vec3 BiTangent; vec2 TextureCoordinate; vec4 ExplosionColor; + float ExplosionPercentageElapsed; }Output; void main() @@ -42,4 +43,5 @@ void main() Output.Tangent = vec3(M * vec4(Tangent, 0.0)); Output.BiTangent = vec3(M * vec4(BiTangent, 0.0)); Output.ExplosionColor = vec4(1.0); + Output.ExplosionPercentageElapsed = 0.0; } \ No newline at end of file From 28d412f5c7ce64ec35d13c662e61a72868b9b004 Mon Sep 17 00:00:00 2001 From: Tleety Date: Tue, 2 Feb 2016 13:24:18 +0100 Subject: [PATCH 11/19] Some small changes to test world and assets --- assets | 2 +- resources/Schema/Entities/EditorTestWorld.xml | 24 ++++++++++--------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/assets b/assets index 763d7c5c..415bbd54 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 763d7c5c0dcb84722221490b5ef9ed0aad18be06 +Subproject commit 415bbd5409174bdd1257db57326f3e1ff66d7faf diff --git a/resources/Schema/Entities/EditorTestWorld.xml b/resources/Schema/Entities/EditorTestWorld.xml index 3c521e3f..4727c777 100755 --- a/resources/Schema/Entities/EditorTestWorld.xml +++ b/resources/Schema/Entities/EditorTestWorld.xml @@ -2,7 +2,9 @@ - + + + @@ -43,7 +45,7 @@ - + @@ -54,14 +56,13 @@ true - 0.9332666733480437 + 5.0498686575577523 5 3 Models/Assault.mesh - true @@ -72,11 +73,12 @@ - Models/AssaultWeapon.mesh + Models/AssaultWeaponRed.mesh true - + + @@ -109,7 +111,7 @@ Run - + 1 @@ -125,7 +127,7 @@ Walk - + 1 @@ -187,7 +189,7 @@ - + @@ -251,7 +253,7 @@ - + @@ -283,7 +285,7 @@ - + From 45a92b362f6877695715566e9ef22b42b493c5a8 Mon Sep 17 00:00:00 2001 From: verysecrethero Date: Tue, 2 Feb 2016 15:10:11 +0100 Subject: [PATCH 12/19] DoubleJumping now in InputController instead. --- include/Engine/Input/FirstPersonInputController.h | 15 ++++++++++----- include/Game/Systems/PlayerMovementSystem.h | 2 -- src/Game/Systems/PlayerMovementSystem.cpp | 6 +++--- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/include/Engine/Input/FirstPersonInputController.h b/include/Engine/Input/FirstPersonInputController.h index 426670c4..d4c9071c 100644 --- a/include/Engine/Input/FirstPersonInputController.h +++ b/include/Engine/Input/FirstPersonInputController.h @@ -15,7 +15,11 @@ public: virtual const glm::vec3 Rotation() const { return m_Rotation; } virtual bool Jumping() const { return m_Jumping; } virtual bool Crouching() const { return m_Crouching; } - + virtual bool DoubleJumping() const { return m_DoubleJumping; } + virtual void SetDoubleJumping(bool isDoubleJumping) { + m_DoubleJumping = isDoubleJumping; + } + void LockMouse(); void UnlockMouse(); virtual bool OnCommand(const Events::InputCommand& e) override; @@ -27,8 +31,9 @@ protected: glm::vec3 m_Rotation; glm::vec3 m_Movement; bool m_Jumping = false; + bool m_DoubleJumping = false; bool m_Crouching = false; - + EventRelay m_ELockMouse; bool OnLockMouse(const Events::LockMouse& e); EventRelay m_EUnlockMouse; @@ -36,7 +41,7 @@ protected: }; template -FirstPersonInputController::FirstPersonInputController(EventBroker* eventBroker, int playerID) +FirstPersonInputController::FirstPersonInputController(EventBroker* eventBroker, int playerID) : InputController(eventBroker) , m_PlayerID(playerID) { @@ -113,14 +118,14 @@ bool FirstPersonInputController::OnCommand(const Events::InputComm template bool FirstPersonInputController::OnUnlockMouse(const Events::UnlockMouse& e) { - m_MouseLocked = false; + m_MouseLocked = false; return true; } template bool FirstPersonInputController::OnLockMouse(const Events::LockMouse& e) { - m_MouseLocked = true; + m_MouseLocked = true; return true; } diff --git a/include/Game/Systems/PlayerMovementSystem.h b/include/Game/Systems/PlayerMovementSystem.h index 4fbb2c79..f39740ec 100644 --- a/include/Game/Systems/PlayerMovementSystem.h +++ b/include/Game/Systems/PlayerMovementSystem.h @@ -20,6 +20,4 @@ private: EventRelay m_EPlayerSpawned; bool OnPlayerSpawned(Events::PlayerSpawned& e); - - bool m_DoubleJumped = false; }; \ No newline at end of file diff --git a/src/Game/Systems/PlayerMovementSystem.cpp b/src/Game/Systems/PlayerMovementSystem.cpp index 868751f7..72900d7a 100644 --- a/src/Game/Systems/PlayerMovementSystem.cpp +++ b/src/Game/Systems/PlayerMovementSystem.cpp @@ -76,12 +76,12 @@ void PlayerMovementSystem::Update(double dt) ImGui::Text("velocity: (%f, %f, %f) |%f|", velocity.x, velocity.y, velocity.z, glm::length(velocity)); } - if (controller->Jumping() && !controller->Crouching() && (velocity.y == 0.f || !m_DoubleJumped)) { + if (controller->Jumping() && !controller->Crouching() && (velocity.y == 0.f || !controller->DoubleJumping())) { if (velocity.y == 0.f) { - m_DoubleJumped = false; + controller->SetDoubleJumping(false); } else { - m_DoubleJumped = true; + controller->SetDoubleJumping(true); } velocity.y += 4.f; } From b131f56f5e4b96d5c180abd43fe54614f6228370 Mon Sep 17 00:00:00 2001 From: Tleety Date: Tue, 2 Feb 2016 16:06:42 +0100 Subject: [PATCH 13/19] Made a quality assurance world that will need to be used before creating a pull request --- assets | 2 +- resources/Schema/Entities/AssetPedistal.xml | 51 + .../Schema/Entities/QualityAssurance.xml | 1230 +++++++++++++++++ .../Entities/SpawnPointClusterWithModels.xml | 68 + .../Entities/SpawnerWithPlayerModel.xml | 16 + src/Engine/Rendering/RenderSystem.cpp | 2 +- 6 files changed, 1367 insertions(+), 2 deletions(-) create mode 100644 resources/Schema/Entities/AssetPedistal.xml create mode 100644 resources/Schema/Entities/QualityAssurance.xml create mode 100644 resources/Schema/Entities/SpawnPointClusterWithModels.xml create mode 100644 resources/Schema/Entities/SpawnerWithPlayerModel.xml diff --git a/assets b/assets index 415bbd54..c4898d82 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 415bbd5409174bdd1257db57326f3e1ff66d7faf +Subproject commit c4898d8281b5584d89b1caf14dab8e5fac120321 diff --git a/resources/Schema/Entities/AssetPedistal.xml b/resources/Schema/Entities/AssetPedistal.xml new file mode 100644 index 00000000..728a3028 --- /dev/null +++ b/resources/Schema/Entities/AssetPedistal.xml @@ -0,0 +1,51 @@ + + + + + + Models/Core/UnitCylinder.mesh + + + + + + + + + + + + + + + + + + + + + 0.5 + + + + + + + + + + + Models/AssaultWeaponBlue.mesh + + + + + + + + + + + + + diff --git a/resources/Schema/Entities/QualityAssurance.xml b/resources/Schema/Entities/QualityAssurance.xml new file mode 100644 index 00000000..018e1121 --- /dev/null +++ b/resources/Schema/Entities/QualityAssurance.xml @@ -0,0 +1,1230 @@ + + + + + + + + + + + + + + Models/Core/UnitPlane.mesh + + + + + + + + + + + + + + + + + + + + + + 1 + + + + + + + + + + + Audio/crosscounter.wav + true + + + + + + + + + + SoundEmitter + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + Sound Test + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + 0.80000001192092896 + + + Models/DirectionalLightWidget.mesh + + + 1 + + + + + + + + + + + + + + + + + + + + + Run + + 1 + + + models/AssaultAnimated.mesh + + + + + + + + + + + Walk + + 1 + + + models/AssaultAnimated.mesh + + + + + + + + + Animation test + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + Models/Core/UnitCylinder.mesh + + + + + + + + + + + + + + + + + + + + 0.5 + + + + + + + + + + + Run + + 1 + + + Models/AssaultAnimated.mesh + + + + + + + + + + + + + + + + + + + + + + + + models/NormSpecIncdMapSphere.mesh + + + + + + + + + 1 + + + + + + + + + + + Models/Core/UnitSphere.mesh + + + + 3 + 1.1399998664855957 + + + + + + + + + + + + Models/Core/UnitSphere.mesh + + + + 5.0100002288818359 + 0.69999998807907104 + + + + + + + + + + + + Models/Core/UnitSphere.mesh + + + + 4 + 0.80000001192092896 + + + + + + + + + + + + + + 1 + + + + + + + + + + + Models/NormalMapSphere.mesh + + + + + + + + + + + Models/SpecularMapSphere.mesh + + + + + + + + + + 1 + + + + + + + + + + + Models/Core/UnitSphere.mesh + + + + 3 + 1.1399998664855957 + + + + + + + + + + + + + + + + Models/IncandescenceMapSphere.mesh + + + + + + + + + + + + + TextureMap's Test + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + 1.3999999761581421 + + + + + + + + + + + + + + + + + Schema/Entities/Player.xml + + + + + + + + + + + + + + + + Models/Assault.mesh + + + + + + + + + + + + + Models/Assault.mesh + + + + + + + + + + + + + Models/Assault.mesh + + + + + + + + + + + + + Models/Assault.mesh + + + + + + + + + + + + + + + Schema/Entities/Player.xml + + + + + + + + + + + + + + + + + Models/Assault.mesh + + + + + + + + + + + + + Models/Assault.mesh + + + + + + + + + + + + + Models/Assault.mesh + + + + + + + + + + + + + Models/Assault.mesh + + + + + + + + + + + + + + Spawn Test + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + + + + + + + Models/Core/UnitCube.mesh + + true + + + + + + + + + + + Models/Core/UnitCylinder.mesh + + true + + + + + + + + + + + Models/Core/UnitRaptor.mesh + + true + + + + + + + + + + + Models/Assault.mesh + + true + + + + + + + + + + + + Models/Core/UnitCube.mesh + + true + + + + + + + + + + + + + Transparency Test + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + + + + + + + Models/Core/UnitCylinder.mesh + + + + + + + + + + + + + + + + + + + + 0.5 + + + + + + + + + + + Models/AssaultWeaponBlue.mesh + + + + + + + + + + + + + + + + Models/Core/UnitCylinder.mesh + + + + + + + + + + + + + + + + + + + + 0.5 + + + + + + + + + + + Models/AssaultWeaponRed.mesh + + + + + + + + + + + + + + + + Asset Test + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + Models/Core/UnitCylinder.mesh + + + + + + + + + + + + + + + + + + + + 0.5 + + + + + + + + + + + Models/SecondaryWeapon.mesh + + + + + + + + + + + + + + + + Models/Core/UnitCylinder.mesh + + + + + + + + + + + + + + + + + + + + 0.5 + + + + + + + + + + + Models/AssualtSoft.mesh + + + + + + + + + + + + + + + Models/Core/UnitCylinder.mesh + + + + + + + + + + + + + + + + + + + + 0.5 + + + + + + + + + + + Models/DefenderGunBlue.mesh + + + + + + + + + + + + + + + + Models/Core/UnitCylinder.mesh + + + + + + + + + + + + + + + + + + + + 0.5 + + + + + + + + + + + Models/DefenderGunRed.mesh + + + + + + + + + + + + + + + + Models/Core/UnitCylinder.mesh + + + + + + + + + + + + + + + + + + + + 0.5 + + + + + + + + + + + Models/Assualt.mesh + + + + + + + + + + + + + + + + + + + + + + + + CapturePoint Test + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + Models/CapturePoint.mesh + + + + + + + + + + + + + + + + + Models/Core/UnitCube.mesh + + true + + + + + + + + + + + Red team home point + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + Models/CapturePoint.mesh + + + + + + + + + 1 + + + Models/Core/UnitCube.mesh + + true + + + + + + + + + + + Free capture point + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + Models/CapturePoint.mesh + + + + + + + + + + + + + + + 3 + + + Models/Core/UnitCube.mesh + + true + + + + + + + + + + + Blue team home point + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Models/Test/ObstacleCourse.mesh + + + + + + + + + + + Collision Test + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + Models/Core/UnitCube.mesh + + + + + + + + + + + + + + Models/Core/UnitCube.mesh + + + + + + + + + + + + + + Models/Core/UnitCube.mesh + + + + + + + + + + + + + diff --git a/resources/Schema/Entities/SpawnPointClusterWithModels.xml b/resources/Schema/Entities/SpawnPointClusterWithModels.xml new file mode 100644 index 00000000..9c42d0e4 --- /dev/null +++ b/resources/Schema/Entities/SpawnPointClusterWithModels.xml @@ -0,0 +1,68 @@ + + + + + + + Schema/Entities/Player.xml + + + + + + + + + + + + + + + Models/Assault.mesh + + + + + + + + + + + + Models/Assault.mesh + + + + + + + + + + + + Models/Assault.mesh + + + + + + + + + + + + Models/Assault.mesh + + + + + + + + + + diff --git a/resources/Schema/Entities/SpawnerWithPlayerModel.xml b/resources/Schema/Entities/SpawnerWithPlayerModel.xml new file mode 100644 index 00000000..1274eefa --- /dev/null +++ b/resources/Schema/Entities/SpawnerWithPlayerModel.xml @@ -0,0 +1,16 @@ + + + + + + + Models/Assault.mesh + + + + + + + + + diff --git a/src/Engine/Rendering/RenderSystem.cpp b/src/Engine/Rendering/RenderSystem.cpp index b51ab7f8..eaecf99e 100644 --- a/src/Engine/Rendering/RenderSystem.cpp +++ b/src/Engine/Rendering/RenderSystem.cpp @@ -245,7 +245,7 @@ void RenderSystem::Update(double dt) scene.Viewport = Rectangle(1280, 720); auto cSceneLight = m_World->GetComponents("SceneLight"); - if (cSceneLight != nullptr) { + if (cSceneLight != nullptr && cSceneLight->begin() != cSceneLight->end()) { m_RenderFrame->Gamma = (double)(*cSceneLight->begin())["Gamma"]; m_RenderFrame->Exposure = (double)(*cSceneLight->begin())["Exposure"]; scene.AmbientColor = (glm::vec4)(*cSceneLight->begin())["AmbientColor"]; From 12a181c1ff5848831df5b9f4bdf9d32e4c05cdae Mon Sep 17 00:00:00 2001 From: Tleety Date: Tue, 2 Feb 2016 16:11:03 +0100 Subject: [PATCH 14/19] Fixed a bug where normals scaled with model scale. Again. --- .../Schema/Entities/QualityAssurance.xml | 48 ++++++++++--------- resources/Shaders/ForwardPlus.frag.glsl | 1 + 2 files changed, 26 insertions(+), 23 deletions(-) diff --git a/resources/Schema/Entities/QualityAssurance.xml b/resources/Schema/Entities/QualityAssurance.xml index 018e1121..cef0582b 100644 --- a/resources/Schema/Entities/QualityAssurance.xml +++ b/resources/Schema/Entities/QualityAssurance.xml @@ -20,12 +20,14 @@ - + - + + 90 + - + @@ -37,7 +39,7 @@ - + @@ -96,7 +98,7 @@ - + @@ -113,7 +115,7 @@ Run - + 1 @@ -129,7 +131,7 @@ Walk - + 1 @@ -179,7 +181,7 @@ - + @@ -187,7 +189,7 @@ Run - + 1 @@ -208,7 +210,7 @@ - + @@ -228,7 +230,7 @@ - + @@ -292,7 +294,7 @@ - + @@ -324,7 +326,7 @@ - + @@ -673,7 +675,7 @@ - + @@ -720,7 +722,7 @@ - + @@ -780,7 +782,7 @@ - + @@ -827,7 +829,7 @@ - + @@ -873,7 +875,7 @@ - + @@ -920,7 +922,7 @@ - + @@ -967,7 +969,7 @@ - + @@ -991,7 +993,7 @@ - + @@ -1015,7 +1017,7 @@ - + @@ -1102,7 +1104,7 @@ - + diff --git a/resources/Shaders/ForwardPlus.frag.glsl b/resources/Shaders/ForwardPlus.frag.glsl index 3431ed6b..c09e0438 100644 --- a/resources/Shaders/ForwardPlus.frag.glsl +++ b/resources/Shaders/ForwardPlus.frag.glsl @@ -119,6 +119,7 @@ void main() vec4 specularTexel = texture2D(SpecularMapTexture, Input.TextureCoordinate); vec4 position = V * M * vec4(Input.Position, 1.0); vec4 normal = V * CalcNormalMappedValue(Input.Normal, Input.Tangent, Input.BiTangent, Input.TextureCoordinate, NormalMapTexture); + normal = normalize(normal); //vec4 normal = normalize(V * vec4(Input.Normal, 0.0)); vec4 viewVec = normalize(-position); From eba36b84929f178cce18844acb615de429fce201 Mon Sep 17 00:00:00 2001 From: Tleety Date: Tue, 2 Feb 2016 17:12:14 +0100 Subject: [PATCH 15/19] Some QA-map fixes --- .../Schema/Entities/QualityAssurance.xml | 405 +++++++++++++++--- resources/Schema/Entities/SoundEmitter.xml | 24 ++ 2 files changed, 378 insertions(+), 51 deletions(-) create mode 100644 resources/Schema/Entities/SoundEmitter.xml diff --git a/resources/Schema/Entities/QualityAssurance.xml b/resources/Schema/Entities/QualityAssurance.xml index cef0582b..b01d21ce 100644 --- a/resources/Schema/Entities/QualityAssurance.xml +++ b/resources/Schema/Entities/QualityAssurance.xml @@ -10,12 +10,13 @@ + + Models/Core/UnitPlane.mesh - @@ -39,7 +40,7 @@ - + @@ -50,7 +51,7 @@ true - + @@ -66,6 +67,12 @@ + + + + + + @@ -98,7 +105,7 @@ - + @@ -106,8 +113,8 @@ - - + + @@ -115,7 +122,7 @@ Run - + 1 @@ -131,7 +138,7 @@ Walk - + 1 @@ -181,7 +188,7 @@ - + @@ -189,7 +196,7 @@ Run - + 1 @@ -210,7 +217,7 @@ - + @@ -230,7 +237,7 @@ - + @@ -294,7 +301,7 @@ - + @@ -326,7 +333,7 @@ - + @@ -364,7 +371,7 @@ - + TextureMap's Test @@ -372,7 +379,7 @@ - + @@ -391,7 +398,7 @@ - + @@ -473,7 +480,7 @@ - + @@ -554,7 +561,7 @@ - + @@ -580,6 +587,7 @@ + @@ -626,7 +634,7 @@ - + Transparency Test @@ -634,7 +642,7 @@ - + @@ -644,7 +652,7 @@ - + @@ -675,7 +683,7 @@ - + @@ -722,7 +730,7 @@ - + @@ -782,7 +790,7 @@ - + @@ -829,7 +837,7 @@ - + @@ -875,7 +883,7 @@ - + @@ -922,7 +930,7 @@ - + @@ -969,7 +977,7 @@ - + @@ -993,7 +1001,7 @@ - + @@ -1014,14 +1022,13 @@ Models/CapturePoint.mesh - - + - + @@ -1031,16 +1038,23 @@ Models/Core/UnitCube.mesh - + true - - + + + + + + + + + - + Red team home point @@ -1056,6 +1070,51 @@ + + + + Models/CapturePoint.mesh + + + + + + + + + + + 1 + + + Models/Core/UnitCube.mesh + + + + + + + + + + + + + + + RedMiddle Point + Fonts/DroidSans.ttf + + + + + + + + + + + @@ -1064,27 +1123,29 @@ - + - 1 + 2 Models/Core/UnitCube.mesh - true - + + + + - + - Free capture point + Middle Point Fonts/DroidSans.ttf,64 @@ -1097,38 +1158,90 @@ + + + + Models/CapturePoint.mesh + + + + + + + + + + + -12.033302729641917 + 3 + + + Models/Core/UnitCube.mesh + + + + + + + + + + + + + + + BlueMiddle Point + Fonts/DroidSans.ttf + + + + + + + + + + + Models/CapturePoint.mesh - - + - + - 3 + 4 Models/Core/UnitCube.mesh - + true - - + + + + + + + + + - + Blue team home point @@ -1227,6 +1340,196 @@ + + + + + + + + + + + Models/Core/UnitCylinder.mesh + + + + + + + + + + + + + + + + + + + + 0.5 + + + + + + + + + + + true + + 0.66670660122008485 + 3.7999999523162842 + + true + + + Models/AssaultWeaponBlue.mesh + true + + + + + + + + + + + + + + + + Models/Core/UnitCylinder.mesh + + + + + + + + + + + + + + + + + + + + 0.5 + + + + + + + + + + + + + 0.20002680222910385 + + + Models/Assault.mesh + true + + + + + + + + + + + + + + + Models/Core/UnitCylinder.mesh + + + + + + + + + + + + + + + + + + + + 0.5 + + + + + + + + + + + Walk + + 1 + + + true + + + 1.4833885697323694 + + true + + + Models/AssaultAnimated.mesh + true + + + + + + + + + + + + + + + ExplosionEffect Test + Fonts/DroidSans.ttf,64 + + + + + + + + + + diff --git a/resources/Schema/Entities/SoundEmitter.xml b/resources/Schema/Entities/SoundEmitter.xml new file mode 100644 index 00000000..39b4c750 --- /dev/null +++ b/resources/Schema/Entities/SoundEmitter.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + SoundEmitter + Fonts/DroidSans.ttf,64 + + + + + + + + + + From 11025b5466e79397ddaa0e7c7f3abffa6d787592 Mon Sep 17 00:00:00 2001 From: Tleety Date: Tue, 2 Feb 2016 17:19:58 +0100 Subject: [PATCH 16/19] QA-map stuff --- .../Schema/Entities/QualityAssurance.xml | 46 +++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/resources/Schema/Entities/QualityAssurance.xml b/resources/Schema/Entities/QualityAssurance.xml index b01d21ce..c711d5dd 100644 --- a/resources/Schema/Entities/QualityAssurance.xml +++ b/resources/Schema/Entities/QualityAssurance.xml @@ -40,7 +40,7 @@ - + @@ -105,7 +105,7 @@ - + @@ -122,7 +122,7 @@ Run - + 1 @@ -138,7 +138,7 @@ Walk - + 1 @@ -188,7 +188,7 @@ - + @@ -196,7 +196,7 @@ Run - + 1 @@ -237,7 +237,7 @@ - + @@ -301,7 +301,7 @@ - + @@ -333,7 +333,7 @@ - + @@ -683,7 +683,7 @@ - + @@ -730,7 +730,7 @@ - + @@ -790,7 +790,7 @@ - + @@ -837,7 +837,7 @@ - + @@ -883,7 +883,7 @@ - + @@ -930,7 +930,7 @@ - + @@ -977,7 +977,7 @@ - + @@ -1374,7 +1374,7 @@ - + @@ -1383,7 +1383,7 @@ true - 0.66670660122008485 + 2.6005657651057277 3.7999999523162842 true @@ -1430,7 +1430,7 @@ - + @@ -1439,7 +1439,7 @@ - 0.20002680222910385 + 1.1504741652238408 Models/Assault.mesh @@ -1482,7 +1482,7 @@ - + @@ -1490,14 +1490,14 @@ Walk - + 1 true - 1.4833885697323694 + 0.43378409460495959 true From a3b7bd7df54ffa92ff2dd7c20d8bc7386d217e88 Mon Sep 17 00:00:00 2001 From: Tleety Date: Tue, 2 Feb 2016 17:39:57 +0100 Subject: [PATCH 17/19] Fix in picking pass, QA map fix. Blue and red ray change. Player weapon change. --- resources/Schema/Entities/Player.xml | 17 +++++-- .../Schema/Entities/QualityAssurance.xml | 50 +++++++++---------- resources/Schema/Entities/RayBlue.xml | 3 +- resources/Schema/Entities/RayRed.xml | 3 +- src/Engine/Rendering/PickingPass.cpp | 8 +-- 5 files changed, 45 insertions(+), 36 deletions(-) diff --git a/resources/Schema/Entities/Player.xml b/resources/Schema/Entities/Player.xml index e81ec5aa..d365c0ee 100644 --- a/resources/Schema/Entities/Player.xml +++ b/resources/Schema/Entities/Player.xml @@ -2,12 +2,12 @@ - + @@ -20,7 +20,7 @@ - + @@ -101,12 +101,19 @@ + + true + + 3.7999999523162842 + + true + - Models/AssaultWeapon.mesh + Models/AssaultWeaponRed.mesh - + @@ -141,7 +148,7 @@ Hold Pos - + 1 diff --git a/resources/Schema/Entities/QualityAssurance.xml b/resources/Schema/Entities/QualityAssurance.xml index c711d5dd..55e67c9b 100644 --- a/resources/Schema/Entities/QualityAssurance.xml +++ b/resources/Schema/Entities/QualityAssurance.xml @@ -40,7 +40,7 @@ - + @@ -105,7 +105,7 @@ - + @@ -122,7 +122,7 @@ Run - + 1 @@ -138,7 +138,7 @@ Walk - + 1 @@ -188,7 +188,7 @@ - + @@ -196,7 +196,7 @@ Run - + 1 @@ -237,7 +237,7 @@ - + @@ -301,7 +301,7 @@ - + @@ -333,7 +333,7 @@ - + @@ -683,7 +683,7 @@ - + @@ -730,7 +730,7 @@ - + @@ -790,7 +790,7 @@ - + @@ -837,7 +837,7 @@ - + @@ -883,7 +883,7 @@ - + @@ -930,7 +930,7 @@ - + @@ -977,7 +977,7 @@ - + @@ -1304,7 +1304,7 @@ Models/Core/UnitCube.mesh - + @@ -1332,7 +1332,7 @@ Models/Core/UnitCube.mesh - + @@ -1374,7 +1374,7 @@ - + @@ -1383,7 +1383,7 @@ true - 2.6005657651057277 + 0.016748705294958199 3.7999999523162842 true @@ -1430,7 +1430,7 @@ - + @@ -1439,7 +1439,7 @@ - 1.1504741652238408 + 0.96672645330102114 Models/Assault.mesh @@ -1482,7 +1482,7 @@ - + @@ -1490,14 +1490,14 @@ Walk - + 1 true - 0.43378409460495959 + 0.51665750859842774 true diff --git a/resources/Schema/Entities/RayBlue.xml b/resources/Schema/Entities/RayBlue.xml index 3b985a7e..4a0bb9d4 100644 --- a/resources/Schema/Entities/RayBlue.xml +++ b/resources/Schema/Entities/RayBlue.xml @@ -7,7 +7,8 @@ Models/CylinderBullet.mesh - + + true diff --git a/resources/Schema/Entities/RayRed.xml b/resources/Schema/Entities/RayRed.xml index df563476..e69df489 100644 --- a/resources/Schema/Entities/RayRed.xml +++ b/resources/Schema/Entities/RayRed.xml @@ -7,7 +7,8 @@ Models/CylinderBullet.mesh - + + true diff --git a/src/Engine/Rendering/PickingPass.cpp b/src/Engine/Rendering/PickingPass.cpp index 792539f8..3a86dd60 100644 --- a/src/Engine/Rendering/PickingPass.cpp +++ b/src/Engine/Rendering/PickingPass.cpp @@ -75,9 +75,9 @@ void PickingPass::Draw(RenderScene& scene) m_EntityColors[std::make_tuple(pickInfo.Entity, pickInfo.World, pickInfo.Camera)] = glm::ivec2(pickColor[0], pickColor[1]); if (m_ColorCounter[0] > 255) { m_ColorCounter[0] = 0; - m_ColorCounter[1] += 5; + m_ColorCounter[1] += 1; } else { - m_ColorCounter[0] += 50; + m_ColorCounter[0] += 1; } } @@ -121,9 +121,9 @@ void PickingPass::Draw(RenderScene& scene) m_EntityColors[std::make_tuple(pickInfo.Entity, pickInfo.World, pickInfo.Camera)] = glm::ivec2(pickColor[0], pickColor[1]); if (m_ColorCounter[0] > 255) { m_ColorCounter[0] = 0; - m_ColorCounter[1] += 5; + m_ColorCounter[1] += 1; } else { - m_ColorCounter[0] += 50; + m_ColorCounter[0] += 1; } } From 73716c28e225d57c9bd1d15f56b92dd975af9b2e Mon Sep 17 00:00:00 2001 From: Tleety Date: Tue, 2 Feb 2016 17:40:22 +0100 Subject: [PATCH 18/19] pickpass fix --- src/Engine/Rendering/PickingPass.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Engine/Rendering/PickingPass.cpp b/src/Engine/Rendering/PickingPass.cpp index 3a86dd60..abc79f2e 100644 --- a/src/Engine/Rendering/PickingPass.cpp +++ b/src/Engine/Rendering/PickingPass.cpp @@ -77,7 +77,7 @@ void PickingPass::Draw(RenderScene& scene) m_ColorCounter[0] = 0; m_ColorCounter[1] += 1; } else { - m_ColorCounter[0] += 1; + m_ColorCounter[0] += 1; } } From 51a588657efdf1df96d126d15fd25ccd8518c392 Mon Sep 17 00:00:00 2001 From: Tleety Date: Wed, 3 Feb 2016 10:11:53 +0100 Subject: [PATCH 19/19] QA map change --- .../Schema/Entities/QualityAssurance.xml | 69 ++++++++++++------- 1 file changed, 46 insertions(+), 23 deletions(-) diff --git a/resources/Schema/Entities/QualityAssurance.xml b/resources/Schema/Entities/QualityAssurance.xml index 55e67c9b..e057cf38 100644 --- a/resources/Schema/Entities/QualityAssurance.xml +++ b/resources/Schema/Entities/QualityAssurance.xml @@ -40,7 +40,7 @@ - + @@ -105,7 +105,7 @@ - + @@ -122,7 +122,7 @@ Run - + 1 @@ -138,7 +138,7 @@ Walk - + 1 @@ -188,7 +188,7 @@ - + @@ -196,7 +196,7 @@ Run - + 1 @@ -237,7 +237,7 @@ - + @@ -301,7 +301,7 @@ - + @@ -333,7 +333,7 @@ - + @@ -683,7 +683,7 @@ - + @@ -730,7 +730,7 @@ - + @@ -790,7 +790,7 @@ - + @@ -837,7 +837,7 @@ - + @@ -883,7 +883,7 @@ - + @@ -930,7 +930,7 @@ - + @@ -977,7 +977,7 @@ - + @@ -1374,7 +1374,7 @@ - + @@ -1383,7 +1383,7 @@ true - 0.016748705294958199 + 0.75008034908941568 3.7999999523162842 true @@ -1430,7 +1430,7 @@ - + @@ -1439,7 +1439,7 @@ - 0.96672645330102114 + 1.1999860997035228 Models/Assault.mesh @@ -1482,7 +1482,7 @@ - + @@ -1490,14 +1490,14 @@ Walk - + 1 true - 0.51665750859842774 + 0.68343188336345406 true @@ -1530,6 +1530,29 @@ + + + + + + + + + + + Remember to pick random entities. + Fonts/DroidSans.ttf,64 + + + + + + + + + + +