Directional light now fully added to all lists.
This commit is contained in:
@@ -96,19 +96,19 @@ void LightCullingPass::FillLightList(RenderScene& scene)
|
||||
//p.Padding = 123.f;
|
||||
p.Type = LightSource::Point;
|
||||
m_LightSources.push_back(p);
|
||||
continue;
|
||||
|
||||
}
|
||||
}
|
||||
for(auto &job : scene.DirectionalLightJobs) {
|
||||
auto directionalLightJob = std::dynamic_pointer_cast<directionalLightJob>(job);
|
||||
auto directionalLightJob = std::dynamic_pointer_cast<DirectionalLightJob>(job);
|
||||
if(directionalLightJob) {
|
||||
LightSource p;
|
||||
p.Direction = directionalLightJob->Direction;
|
||||
p.Color = directionalLightJob->Color;
|
||||
p.Intensity = directionalLightJob->Intensity;
|
||||
p.Position = glm::vec4(glm::vec3(directionalLightJob->Position), 1.f);
|
||||
p.Type = LightSource::Directional;
|
||||
m_LightSources.push_back(p);
|
||||
continue;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ 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) {
|
||||
@@ -117,8 +117,11 @@ void RenderSystem::fillLight(std::list<std::shared_ptr<RenderJob>>& jobs, 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) {
|
||||
@@ -128,7 +131,7 @@ void RenderSystem::fillLight(std::list<std::shared_ptr<RenderJob>>& jobs, World*
|
||||
}
|
||||
|
||||
auto transformC = world->GetComponent(directionalLightC.EntityID, "Transform");
|
||||
if(&transformC == nullptr) {
|
||||
if (&transformC == nullptr) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -162,7 +165,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);
|
||||
m_RenderFrame->Add(scene);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user