Added DirectionalLights to renderqueue jobs
This commit is contained in:
@@ -12,6 +12,7 @@
|
|||||||
#include "RenderJob.h"
|
#include "RenderJob.h"
|
||||||
#include "ModelJob.h"
|
#include "ModelJob.h"
|
||||||
#include "PointLightJob.h"
|
#include "PointLightJob.h"
|
||||||
|
#include "DirectionalLightJob.h"
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -53,12 +54,14 @@ struct RenderScene
|
|||||||
::Camera* Camera;
|
::Camera* Camera;
|
||||||
std::list<std::shared_ptr<RenderJob>> ForwardJobs;
|
std::list<std::shared_ptr<RenderJob>> ForwardJobs;
|
||||||
std::list<std::shared_ptr<RenderJob>> PointLightJobs;
|
std::list<std::shared_ptr<RenderJob>> PointLightJobs;
|
||||||
|
std::list<std::shared_ptr<RenderJob>> DirectionalLightJobs;
|
||||||
Rectangle Viewport;
|
Rectangle Viewport;
|
||||||
|
|
||||||
void Clear()
|
void Clear()
|
||||||
{
|
{
|
||||||
ForwardJobs.clear();
|
ForwardJobs.clear();
|
||||||
PointLightJobs.clear();
|
PointLightJobs.clear();
|
||||||
|
DirectionalLightJobs.clear();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<c:PointLight>
|
<c:PointLight>
|
||||||
|
<Direction X="0" Y="0" Z="0"/>
|
||||||
<Color R="1" G="1" B="1" A="1"/>
|
<Color R="1" G="1" B="1" A="1"/>
|
||||||
<Intensity>0.8</Intensity>
|
<Intensity>0.8</Intensity>
|
||||||
<Visible>true</Visible>
|
<Visible>true</Visible>
|
||||||
|
|||||||
@@ -102,22 +102,39 @@ 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::fillLight(std::list<std::shared_ptr<RenderJob>>& jobs, World* world)
|
||||||
{
|
{
|
||||||
auto pointLights = world->GetComponents("PointLight");
|
auto pointLights = world->GetComponents("PointLight");
|
||||||
if (pointLights == nullptr) {
|
if (pointLights != nullptr) {
|
||||||
return;
|
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));
|
auto directionalLights = world->GetComponents("DirectionalLight");
|
||||||
jobs.push_back(pointLightJob);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user