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

# Conflicts:
#	include/Engine/Rendering/DrawFinalPass.h
#	resources/Schema/Components.xsd
#	resources/Schema/Entities/CollisionTestLevel.xml
#	resources/Schema/Types/Entity.xsd
#	src/Engine/Collision/Collision.cpp
#	src/Engine/Rendering/DrawFinalPass.cpp
#	src/Engine/Rendering/RenderSystem.cpp
This commit is contained in:
viktorljung
2016-02-10 11:33:45 +01:00
81 changed files with 2667 additions and 521 deletions
+62 -19
View File
@@ -40,7 +40,7 @@ bool RenderSystem::isChildOfCurrentCamera(EntityWrapper entity)
return entity == m_CurrentCamera || entity.IsChildOf(m_CurrentCamera);
}
void RenderSystem::fillModels(std::list<std::shared_ptr<RenderJob>>& opaqueJobs, std::list<std::shared_ptr<RenderJob>>& transparentJobs)
void RenderSystem::fillModels(RenderScene::Queues &Jobs)
{
auto models = m_World->GetComponents("Model");
if (models == nullptr) {
@@ -92,7 +92,9 @@ void RenderSystem::fillModels(std::list<std::shared_ptr<RenderJob>>& opaqueJobs,
}
glm::mat4 modelMatrix = Transform::ModelMatrix(cModel.EntityID, m_World);
//Loop through all materialgroups of a model
for (auto matGroup : model->MaterialGroups()) {
//If the model has an explosioneffect component, we will add an explosioneffectjob
if (m_World->HasComponent(cModel.EntityID, "ExplosionEffect")) {
auto explosionEffectComponent = m_World->GetComponent(cModel.EntityID, "ExplosionEffect");
std::shared_ptr<ExplosionEffectJob> explosionEffectJob = std::shared_ptr<ExplosionEffectJob>(new ExplosionEffectJob(
@@ -106,15 +108,35 @@ void RenderSystem::fillModels(std::list<std::shared_ptr<RenderJob>>& opaqueJobs,
fillColor,
fillPercentage
));
if(explosionEffectJob->Color.a != 1.f || explosionEffectJob->EndColor.a != 1.f || explosionEffectJob->DiffuseColor.a != 1.f) {
cModel["Transparent"] = true;
}
if (m_World->HasComponent(cModel.EntityID, "Shield")){
TODO Calc hash
Jobs.ShieldObjects.push_back(explosionEffectJob);
} else if (m_World->HasComponent(cModel.EntityID, "Shielded")
|| m_World->HasComponent(cModel.EntityID, "Player")) {
if (cModel["Transparent"]) {
transparentJobs.push_back(explosionEffectJob);
} else {
if (explosionEffectJob->Color.a != 1.f || explosionEffectJob->EndColor.a != 1.f || explosionEffectJob->DiffuseColor.a != 1.f) {
cModel["Transparent"] = true;
}
if (cModel["Transparent"]) {
TODO: Calc hash
Jobs.TransparentShieldedObjects.push_back(explosionEffectJob);
} else {
explosionEffectJob->CalculateHash();
opaqueJobs.push_back(explosionEffectJob);
Jobs.OpaqueShieldedObjects.push_back(explosionEffectJob);
}
} else {
if (explosionEffectJob->Color.a != 1.f || explosionEffectJob->EndColor.a != 1.f || explosionEffectJob->DiffuseColor.a != 1.f) {
cModel["Transparent"] = true;
}
if (cModel["Transparent"]) {
TODO CALC HASH
Jobs.TransparentObjects.push_back(explosionEffectJob);
} else {
TODO CALC HASH
Jobs.OpaqueObjects.push_back(explosionEffectJob);
}
}
} else {
std::shared_ptr<ModelJob> modelJob = std::shared_ptr<ModelJob>(new ModelJob(
@@ -127,14 +149,35 @@ void RenderSystem::fillModels(std::list<std::shared_ptr<RenderJob>>& opaqueJobs,
fillColor,
fillPercentage
));
if (modelJob->Color.a != 1.f || modelJob->DiffuseColor.a != 1.f) {
cModel["Transparent"] = true;
}
if (cModel["Transparent"]) {
transparentJobs.push_back(modelJob);
} else {
if (m_World->HasComponent(cModel.EntityID, "Shield")) {
TODO: CALC HASH
Jobs.ShieldObjects.push_back(modelJob);
} else if (m_World->HasComponent(cModel.EntityID, "Shielded")
|| m_World->HasComponent(cModel.EntityID, "Player")) {
if (modelJob->Color.a != 1.f || modelJob->DiffuseColor.a != 1.f) {
cModel["Transparent"] = true;
}
if (cModel["Transparent"]) {
TODO CALC HASH
Jobs.TransparentShieldedObjects.push_back(modelJob);
} else {
modelJob->CalculateHash();
opaqueJobs.push_back(modelJob);
Jobs.OpaqueShieldedObjects.push_back(modelJob);
}
} else {
if (modelJob->Color.a != 1.f || modelJob->DiffuseColor.a != 1.f) {
cModel["Transparent"] = true;
}
if (cModel["Transparent"]) {
CALC HASH
Jobs.TransparentObjects.push_back(modelJob);
} else {
CALC HASH
Jobs.OpaqueObjects.push_back(modelJob);
}
}
}
}
@@ -253,11 +296,11 @@ void RenderSystem::Update(double dt)
scene.AmbientColor = (glm::vec4)(*cSceneLight->begin())["AmbientColor"];
}
fillModels(scene.OpaqueObjects, scene.TransparentObjects);
fillModels(scene.Jobs);
fillPointLights(scene.Jobs.PointLight, m_World);
scene.OpaqueObjects.sort();
fillPointLights(scene.PointLightJobs, m_World);
fillDirectionalLights(scene.DirectionalLightJobs, m_World);
fillText(scene.TextJobs, m_World);
fillDirectionalLights(scene.Jobs.DirectionalLight, m_World);
fillText(scene.Jobs.Text, m_World);
m_RenderFrame->Add(scene);
}