This commit is contained in:
Tleety
2016-01-27 12:10:00 +01:00
parent eb42217885
commit cbb17d22d4
10 changed files with 255 additions and 125 deletions
+12 -5
View File
@@ -31,7 +31,7 @@ bool RenderSystem::OnSetCamera(Events::SetCamera& e)
return true;
}
void RenderSystem::fillModels(std::list<std::shared_ptr<RenderJob>>& jobs)
void RenderSystem::fillModels(std::list<std::shared_ptr<RenderJob>>& opaqueJobs, std::list<std::shared_ptr<RenderJob>>& transparentJobs)
{
auto models = m_World->GetComponents("Model");
if (models == nullptr) {
@@ -75,7 +75,6 @@ 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")) {
@@ -99,7 +98,11 @@ void RenderSystem::fillModels(std::list<std::shared_ptr<RenderJob>>& jobs)
fillColor,
fillPercentage
));
jobs.push_back(explosionEffectJob);
if (modelComponent["Transparent"]) {
transparentJobs.push_back(explosionEffectJob);
} else {
opaqueJobs.push_back(explosionEffectJob);
}
} else {
std::shared_ptr<ModelJob> modelJob = std::shared_ptr<ModelJob>(new ModelJob(
model,
@@ -111,7 +114,11 @@ void RenderSystem::fillModels(std::list<std::shared_ptr<RenderJob>>& jobs)
fillColor,
fillPercentage
));
jobs.push_back(modelJob);
if (modelComponent["Transparent"]) {
transparentJobs.push_back(modelJob);
} else {
opaqueJobs.push_back(modelJob);
}
}
}
}
@@ -222,7 +229,7 @@ void RenderSystem::Update(double dt)
RenderScene scene;
scene.Camera = m_Camera;
scene.Viewport = Rectangle(1280, 720);
fillModels(scene.ForwardJobs);
fillModels(scene.OpaqueObjects, scene.TransparentObjects);
fillPointLights(scene.PointLightJobs, m_World);
fillDirectionalLights(scene.DirectionalLightJobs, m_World);
fillText(scene.TextJobs, m_World);