Merge remote-tracking branch 'origin/Importer' into Animations

# Conflicts:
#	src/Engine/Rendering/DrawFinalPass.cpp
This commit is contained in:
viktorljung
2016-02-02 15:01:34 +01:00
28 changed files with 883 additions and 375 deletions
+19 -6
View File
@@ -35,13 +35,12 @@ bool RenderSystem::isChildOfACamera(EntityWrapper entity)
{
return entity.FirstParentWithComponent("Camera").Valid();
}
bool RenderSystem::isChildOfCurrentCamera(EntityWrapper entity)
{
return entity == m_CurrentCamera || entity.IsChildOf(m_CurrentCamera);
}
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) {
@@ -84,7 +83,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(cModel.EntityID, "Fill")) {
@@ -108,7 +106,15 @@ void RenderSystem::fillModels(std::list<std::shared_ptr<RenderJob>>& jobs)
fillColor,
fillPercentage
));
jobs.push_back(explosionEffectJob);
if(explosionEffectJob->Color.a != 1.f || explosionEffectJob->EndColor.a != 1.f || explosionEffectJob->DiffuseColor.a != 1.f) {
cModel["Transparent"] = true;
}
if (cModel["Transparent"]) {
transparentJobs.push_back(explosionEffectJob);
} else {
opaqueJobs.push_back(explosionEffectJob);
}
} else {
std::shared_ptr<ModelJob> modelJob = std::shared_ptr<ModelJob>(new ModelJob(
model,
@@ -120,7 +126,14 @@ void RenderSystem::fillModels(std::list<std::shared_ptr<RenderJob>>& jobs)
fillColor,
fillPercentage
));
jobs.push_back(modelJob);
if (modelJob->Color.a != 1.f || modelJob->DiffuseColor.a != 1.f) {
cModel["Transparent"] = true;
}
if (cModel["Transparent"]) {
transparentJobs.push_back(modelJob);
} else {
opaqueJobs.push_back(modelJob);
}
}
}
}
@@ -231,7 +244,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);