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

# Conflicts:
#	include/Engine/Rendering/RenderQueue.h
#	include/Engine/Rendering/RenderSystem.h
#	include/Engine/Rendering/Renderer.h
#	src/Engine/Rendering/RenderSystem.cpp
This commit is contained in:
viktorljung
2016-01-19 17:27:09 +01:00
20 changed files with 285 additions and 121 deletions
+36 -15
View File
@@ -114,25 +114,45 @@ void RenderSystem::fillModels(std::list<std::shared_ptr<RenderJob>>& jobs, World
}
void RenderSystem::fillLight(std::list<std::shared_ptr<RenderJob>>& jobs, World* world)
void RenderSystem::fillPointLights(std::list<std::shared_ptr<RenderJob>>& jobs, World* world)
{
auto pointLights = world->GetComponents("PointLight");
if (pointLights == nullptr) {
return;
if (pointLights != nullptr) {
for (auto& pointlightC : *pointLights) {
bool visible = pointlightC["Visible"];
if (!visible) {
continue;
}
auto transformC = world->GetComponent(pointlightC.EntityID, "Transform");
if (&transformC == nullptr) {
continue;
}
std::shared_ptr<PointLightJob> pointLightJob = std::shared_ptr<PointLightJob>(new PointLightJob(transformC, pointlightC, m_World));
jobs.push_back(pointLightJob);
}
}
}
for (auto& pointlightC : *pointLights) {
bool visible = pointlightC["Visible"];
if (!visible) {
continue;
}
auto transformC = world->GetComponent(pointlightC.EntityID, "Transform");
if (&transformC == nullptr) {
return;
}
std::shared_ptr<PointLightJob> pointLightJob = std::shared_ptr<PointLightJob>(new PointLightJob(transformC, pointlightC, m_World));
jobs.push_back(pointLightJob);
void RenderSystem::fillDirectionalLights(std::list<std::shared_ptr<RenderJob>>& jobs, World* world)
{
auto directionalLights = world->GetComponents("DirectionalLight");
if (directionalLights != nullptr) {
for (auto& directionalLightC : *directionalLights) {
bool visable = directionalLightC["Visible"];
if (!visable) {
continue;
}
auto transformC = world->GetComponent(directionalLightC.EntityID, "Transform");
if (&transformC == nullptr) {
continue;
}
std::shared_ptr<DirectionalLightJob> directionalLightJob = std::shared_ptr<DirectionalLightJob>(new DirectionalLightJob(transformC, directionalLightC, m_World));
jobs.push_back(directionalLightJob);
}
}
}
@@ -196,7 +216,8 @@ void RenderSystem::Update(World* world, double dt)
scene.Camera = m_Camera;
scene.Viewport = Rectangle(1280, 720);
fillModels(scene.ForwardJobs, world);
fillLight(scene.PointLightJobs, world);
fillPointLights(scene.PointLightJobs, world);
fillDirectionalLights(scene.DirectionalLightJobs, world);
fillText(scene.TextJobs, world);
m_RenderFrame->Add(scene);