Merge remote-tracking branch 'origin/master' into Networking

This commit is contained in:
stiffly
2016-01-23 17:51:06 +01:00
7 changed files with 54 additions and 20 deletions
+2 -3
View File
@@ -17,8 +17,7 @@
#include "ImGuiRenderPass.h"
#include "Camera.h"
#include "../Core/Transform.h"
#include "TextRenderer.h"
#include "TextPass.h"
class Renderer : public IRenderer
{
@@ -36,7 +35,7 @@ public:
private:
//----------------------Variables----------------------//
EventBroker* m_EventBroker;
TextRenderer* m_TextRenderer;
TextPass* m_TextPass;
Texture* m_ErrorTexture;
Texture* m_WhiteTexture;
@@ -10,11 +10,12 @@
#include "Font.h"
#include "../Core/ResourceManager.h"
#include "RenderQueue.h"
#include "TextPassState.h"
class TextRenderer
class TextPass
{
public:
TextRenderer();
TextPass();
void Initialize();
void Update();
void Draw(RenderScene& scene);
+15
View File
@@ -0,0 +1,15 @@
#ifndef TextPassState_h__
#define TextPassState_h__
#include "Rendering/RenderState.h"
class TextPassState : public RenderState
{
public:
TextPassState();
~TextPassState();
private:
};
#endif
+4 -4
View File
@@ -9,8 +9,8 @@ void Renderer::Initialize()
glfwSwapInterval(m_VSYNC);
InitializeShaders();
InitializeTextures();
m_TextRenderer = new TextRenderer();
m_TextRenderer->Initialize();
m_TextPass = new TextPass();
m_TextPass->Initialize();
m_ScreenQuad = ResourceManager::Load<Model>("Models/Core/ScreenQuad.obj");
@@ -80,7 +80,7 @@ void Renderer::Update(double dt)
{
m_EventBroker->Process<Renderer>();
InputUpdate(dt);
m_TextRenderer->Update();
m_TextPass->Update();
m_ImGuiRenderPass->Update(dt);
}
@@ -102,7 +102,7 @@ void Renderer::Draw(RenderFrame& frame)
GLERROR("Renderer::Draw m_DrawScenePass->Draw");
m_TextRenderer->Draw(*scene);
m_TextPass->Draw(*scene);
}
@@ -1,11 +1,11 @@
#include "Rendering/TextRenderer.h"
#include "Rendering/TextPass.h"
TextRenderer::TextRenderer()
TextPass::TextPass()
{
}
void TextRenderer::Initialize()
void TextPass::Initialize()
{
glGenVertexArrays(1, &VAO);
glGenBuffers(1, &VBO);
@@ -24,12 +24,12 @@ void TextRenderer::Initialize()
m_TextProgram->Link();
}
void TextRenderer::Update()
void TextPass::Update()
{
}
void TextRenderer::Draw(RenderScene& scene)
void TextPass::Draw(RenderScene& scene)
{
for (auto &job : scene.TextJobs) {
auto textJob = std::dynamic_pointer_cast<TextJob>(job);
@@ -40,11 +40,11 @@ void TextRenderer::Draw(RenderScene& scene)
}
}
void TextRenderer::renderText(std::string text, Font* font, TextJob::AlignmentEnum alignment, glm::vec4 color, glm::mat4 modelMatrix, glm::mat4 projectionMatrix, glm::mat4 viewMatrix)
void TextPass::renderText(std::string text, Font* font, TextJob::AlignmentEnum alignment, glm::vec4 color, glm::mat4 modelMatrix, glm::mat4 projectionMatrix, glm::mat4 viewMatrix)
{
GLfloat penX = 0;
GLfloat penY = 0;
float scale = 1.0/font->FontSize;
GLfloat scale = 1.0/font->FontSize;
GLfloat stringWidth = 0.f;
@@ -61,10 +61,7 @@ void TextRenderer::renderText(std::string text, Font* font, TextJob::AlignmentEn
penX = 0;
}
glEnable(GL_BLEND);
glDisable(GL_CULL_FACE);
glEnable(GL_DEPTH_TEST);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
TextPassState state;
m_TextProgram->Bind();
glUniform3f(glGetUniformLocation(m_TextProgram->GetHandle(), "textColor"), color.x, color.y, color.z);
+16
View File
@@ -0,0 +1,16 @@
#include "Rendering/TextPassState.h"
TextPassState::TextPassState()
{
BindFramebuffer(0);
glEnable(GL_BLEND);
glDisable(GL_CULL_FACE);
glEnable(GL_DEPTH_TEST);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
TextPassState::~TextPassState()
{
}
+6
View File
@@ -66,6 +66,9 @@ void CapturePointSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper
nextPossibleCapturePoint["Blue"] = -1;
for (size_t i = 0; i < m_NumberOfCapturePoints; i++)
{
if (!m_World->HasComponent(m_CapturePointNumberToEntityIDMap[i], "Team")) {
continue;
}
ComponentWrapper& capturePointOwnedBy = m_World->GetComponent(m_CapturePointNumberToEntityIDMap[i], "Team");
if ((int)capturePointOwnedBy["Team"] == redTeam && m_RedTeamHomeCapturePoint == 0) {
nextPossibleCapturePoint["Red"] = i + 1;
@@ -76,6 +79,9 @@ void CapturePointSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper
}
for (int i = m_NumberOfCapturePoints - 1; i >= 0; i--)
{
if (!m_World->HasComponent(m_CapturePointNumberToEntityIDMap[i], "Team")) {
continue;
}
ComponentWrapper& capturePointOwnedBy = m_World->GetComponent(m_CapturePointNumberToEntityIDMap[i], "Team");
if ((int)capturePointOwnedBy["Team"] == redTeam && m_RedTeamHomeCapturePoint != 0) {
nextPossibleCapturePoint["Red"] = i - 1;