Merge branch 'master' into CoolDeathAnimation

# Conflicts:
#	include/Engine/Rendering/ModelJob.h
#	resources/Shaders/ForwardPlus.frag.glsl
#	src/Engine/Rendering/DrawFinalPass.cpp
#	src/Engine/Rendering/RenderSystem.cpp
This commit is contained in:
2016-01-27 10:31:28 +01:00
44 changed files with 838 additions and 138 deletions
+39 -5
View File
@@ -4,6 +4,7 @@ RenderSystem::RenderSystem(World* world, EventBroker* eventBroker, const IRender
: System(world, eventBroker)
, m_Renderer(renderer)
, m_RenderFrame(renderFrame)
, m_World(world)
{
EVENT_SUBSCRIBE_MEMBER(m_ESetCamera, &RenderSystem::OnSetCamera);
EVENT_SUBSCRIBE_MEMBER(m_EInputCommand, &RenderSystem::OnInputCommand);
@@ -51,6 +52,12 @@ void RenderSystem::fillModels(std::list<std::shared_ptr<RenderJob>>& jobs)
// Don't render the local player
if (entity == m_LocalPlayer || entity.IsChildOf(m_LocalPlayer)) {
if (!entity.HasComponent("HealthHUD") && entity.Name() != "Crosshair" && entity.Name() != "Weapon") { //Should work but needs to be fixed. Should only render the things "childed" to the local player camera
continue;
}
}
if ((entity.Name() == "Weapon" || entity.HasComponent("HealthHUD")) && !entity.IsChildOf(m_LocalPlayer)) {
continue;
}
@@ -68,14 +75,42 @@ void RenderSystem::fillModels(std::list<std::shared_ptr<RenderJob>>& jobs)
}
}
float fillPercentage = 0.f;
glm::vec4 fillColor = glm::vec4(0);
if(m_World->HasComponent(modelComponent.EntityID, "Fill")) {
auto fillComponent = m_World->GetComponent(modelComponent.EntityID, "Fill");
fillPercentage = (float)(double)fillComponent["Percentage"];
fillColor = (glm::vec4)fillComponent["Color"];
}
glm::mat4 modelMatrix = Transform::ModelMatrix(modelComponent.EntityID, m_World);
for (auto matGroup : model->MaterialGroups()) {
if (m_World->HasComponent(modelComponent.EntityID, "ExplosionEffect")) {
auto explosionEffectComponent = m_World->GetComponent(modelComponent.EntityID, "ExplosionEffect");
std::shared_ptr<ExplosionEffectJob> explosionEffectJob = std::shared_ptr<ExplosionEffectJob>(new ExplosionEffectJob(explosionEffectComponent, model, m_Camera, modelMatrix, matGroup, modelComponent, m_World));
std::shared_ptr<ExplosionEffectJob> explosionEffectJob = std::shared_ptr<ExplosionEffectJob>(new ExplosionEffectJob(
explosionEffectComponent,
model,
m_Camera,
modelMatrix,
matGroup,
modelComponent,
m_World,
fillColor,
fillPercentage
));
jobs.push_back(explosionEffectJob);
} else {
std::shared_ptr<ModelJob> modelJob = std::shared_ptr<ModelJob>(new ModelJob(model, m_Camera, modelMatrix, matGroup, modelComponent, m_World));
std::shared_ptr<ModelJob> modelJob = std::shared_ptr<ModelJob>(new ModelJob(
model,
m_Camera,
modelMatrix,
matGroup,
modelComponent,
m_World,
fillColor,
fillPercentage
));
jobs.push_back(modelJob);
}
}
@@ -162,8 +197,8 @@ void RenderSystem::fillText(std::list<std::shared_ptr<RenderJob>>& jobs, World*
}
glm::mat4 modelMatrix = Transform::ModelMatrix(textComponent.EntityID, world);
std::shared_ptr<TextJob> modelJob = std::shared_ptr<TextJob>(new TextJob(modelMatrix, font, textComponent));
jobs.push_back(modelJob);
std::shared_ptr<TextJob> textJob = std::shared_ptr<TextJob>(new TextJob(modelMatrix, font, textComponent));
jobs.push_back(textJob);
}
}
@@ -183,7 +218,6 @@ void RenderSystem::Update(double dt)
m_Camera->SetOrientation(Transform::AbsoluteOrientation(m_CurrentCamera));
}
//Only supports opaque geometry atm
RenderScene scene;
scene.Camera = m_Camera;